[pLog-svn] r1239 - in plugins/trunk/templateeditor:
class/actionclass/view templates
Mark Wu
markplace at gmail.com
Tue Mar 1 05:16:22 GMT 2005
Hi Oscar:
Not only this, you can try blogtimes plugin, it comes with a very cool color
chooser. I believe if we can make the plog "eaiser" then we can get more
"user"
Mark
-----Original Message-----
From: plog-svn-bounces at devel.plogworld.net
[mailto:plog-svn-bounces at devel.plogworld.net] On Behalf Of Oscar Renalias
Sent: Monday, February 28, 2005 9:55 PM
To: plog-svn at devel.plogworld.net
Subject: Re: [pLog-svn] r1239 - in plugins/trunk/templateeditor:
class/actionclass/view templates
This is looking good :-)
Oscar
On Mon, 28 Feb 2005 13:22:22 +0000 (GMT), mark at devel.plogworld.net
<mark at devel.plogworld.net> wrote:
> Author: mark
> Date: 2005-02-28 13:22:22 +0000 (Mon, 28 Feb 2005) New Revision: 1239
>
> Modified:
>
plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.c
lass.php
>
plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction
.class.php
>
plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class
.php
>
> plugins/trunk/templateeditor/templates/siteedittemplatefile.template
> Log:
> Finally, backup file function works.
>
> ToDo:
> 1. Error Handling when file read/save/creatdir 2. Locale 3.
> SmartyEditor
>
> Modified:
> plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileac
> tion.class.php
> ===================================================================
> ---
plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.c
lass.php 2005-02-28 10:49:14 UTC (rev 1238)
> +++
plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.c
lass.php 2005-02-28 13:22:22 UTC (rev 1239)
> @@ -11,6 +11,7 @@
> {
> var $_templateId;
> var $_fileId;
> + var $_backupId;
>
> function PluginSiteEditTemplateFileAction( $actionInfo,
$request )
> {
> @@ -21,8 +22,9 @@
> {
> $this->_templateId = $this->_request->getValue( "templateId"
);
> $this->_fileId = $this->_request->getValue( "fileId" );
> + $this->_backupId = $this->_request->getValue( "backupId"
> + );
>
> - $this->_view = new PluginSiteEditTemplateFileView(
$this->_blogInfo, $this->_templateId, $this->_fileId );
> + $this->_view = new PluginSiteEditTemplateFileView(
> + $this->_blogInfo, $this->_templateId, $this->_fileId,
> + $this->_backupId );
>
> $this->setCommonData();
>
> Modified:
> plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefile
> action.class.php
> ===================================================================
> ---
plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction
.class.php 2005-02-28 10:49:14 UTC (rev 1238)
> +++
plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction
.class.php 2005-02-28 13:22:22 UTC (rev 1239)
> @@ -23,12 +23,14 @@
>
> $this->_templateId = $this->_request->getValue( "templateId"
);
> $this->_fileId = $this->_request->getValue( "fileId" );
> + $this->_backupId = $this->_request->getValue( "backupId"
> + );
>
> $this->registerFieldValidator( "fileContent", new
StringValidator());
> $this->registerFieldValidator( "templateId", new
StringValidator());
> $this->registerFieldValidator( "fileId", new
> StringValidator());
> + $this->registerField( "backupId" );
>
> - $view = new PluginSiteEditTemplateFileView(
$this->_blogInfo, $this->_templateId, $this->_fileId );
> + $view = new PluginSiteEditTemplateFileView(
> + $this->_blogInfo, $this->_templateId, $this->_fileId,
> + $this->_backupId );
> $view->setErrorMessage(
$this->_locale->tr("error_updating_post"));
> $this->setValidationErrorView( $view );
> }
>
> Modified:
> plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview
> .class.php
> ===================================================================
> ---
plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class
.php 2005-02-28 10:49:14 UTC (rev 1238)
> +++
plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class
.php 2005-02-28 13:22:22 UTC (rev 1239)
> @@ -3,6 +3,8 @@
> include_once(
PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
> include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php"
);
> include_once(
> PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php"
> );
> +
> + define( "MAX_BACKUP_FILES", 5 );
>
> /**
> * implements the main view of the feed reader plugin @@
> -11,13 +13,15 @@
> {
> var $_templateId;
> var $_fileId;
> + var $_backupId;
>
> - function PluginSiteEditTemplateFileView( $blogInfo,
$templateId, $fileId )
> + function PluginSiteEditTemplateFileView( $blogInfo,
> + $templateId, $fileId, $backupId )
> {
> $this->AdminPluginTemplatedView( $blogInfo,
> "templateeditor", "siteedittemplatefile" );
>
> $this->_templateId = $templateId;
> $this->_fileId = $fileId;
> + $this->_backupId = $backupId;
> }
>
> function render()
> @@ -32,22 +36,36 @@
> File::createDir( $backupFolder );
> }
>
> - $filename = $templateFolder . $this->_fileId;
> + if ( !$this->_backupId ) {
> + $filename = $templateFolder . $this->_fileId;
> + } else {
> + $filename = $backupFolder . $this->_fileId . "_" .
$this->_backupId;
> + }
> $backupFilePattern = $this->_fileId . "_*";
>
> $bakFiles = Glob::myGlob( $backupFolder,
> $backupFilePattern );
> + sort($bakFiles);
> $backupFiles = Array();
> - foreach ($bakFiles as $bakFile) {
> - $bakElements = explode ( "_" ,$bakFile);
> - $bakTime = strftime ( "%Y/%m/%d - %H:%M:%S ",
$bakElements[count($bakElements)-1] );
> - $file['time'] = $bakTime;
> - $file['fileName'] = basename($bakFile);
> - array_push ($backupFiles, $file);
> + $backupFileCount = 0;
> + for ($i = count($bakFiles) - 1; $i >= 0; $i--) {
> + $bakFile = $bakFiles[$i];
> + if ( $backupFileCount < MAX_BACKUP_FILES ) {
> + $bakElements = explode ( "_" ,$bakFile);
> + $bakId = $bakElements[count($bakElements)-1];
> + $bakTime = strftime ( "%Y/%m/%d - %H:%M:%S ", $bakId
);
> + $file['time'] = $bakTime;
> + $file['backupId'] = basename($bakId);
> + array_push ($backupFiles, $file);
> + $backupFileCount++;
> + } else {
> + File::delete($bakFile);
> + }
> }
>
> $file = new MyFile($filename);
> $fileContent = $file->readFileContent();
>
> + $this->setValue( "backupId", $this->_backupId );
> $this->setValue( "backupFiles", $backupFiles );
> $this->setValue( "currentTemplate", $this->_templateId );
> $this->setValue( "currentFile", $this->_fileId );
>
> Modified:
> plugins/trunk/templateeditor/templates/siteedittemplatefile.template
> ===================================================================
> --- plugins/trunk/templateeditor/templates/siteedittemplatefile.template
2005-02-28 10:49:14 UTC (rev 1238)
> +++ plugins/trunk/templateeditor/templates/siteedittemplatefile.template
2005-02-28 13:22:22 UTC (rev 1239)
> @@ -1,7 +1,15 @@
> {include file="$admintemplatepath/header.template"}
> {include file="$admintemplatepath/navigation.template"
> showOpt=templateEditor title=$locale->tr("templateEditor")}
> <link rel="stylesheet" href="js/editor/plogeditor.css"
> type="text/css" />
> +{literal}
> <script type="text/javascript"
> src="js/editor/plogeditor.js"></script>
> +<script type="text/javascript">
> +function MM_jumpMenu(targ,selObj,restore){ //v3.0
> +
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
> + if (restore) selObj.selectedIndex=0; } </script> {/literal}
> <form name="siteEditTemplateFile" method="post">
> <fieldset class="inputField">
> <legend>{$locale->tr("label_edit")}</legend>
> @@ -12,16 +20,17 @@
> <label for="backupFile">{$locale->tr("label_backupfile")}</label>
> <span class="required"></span>
> <div class="formHelp">{$locale->tr("templateeditor_backupfile")}</div>
> - <select name="backupFile" id="backupFile">
> - <option value="0"
selected="selected">{$locale->tr("templateeditor_choose_backupfile")}</optio
n>
> + <select name="backupFile" id="backupFile"
onChange="MM_jumpMenu('parent',this,0)">
> + <option
value="">{$locale->tr("templateeditor_choose_backupfile")}</option>
> + <option
> + value="admin.php?op=siteEditTemplateFile&templateId={$currentTem
> + plate}&fileId={$currentFile}">{$locale->tr("templateeditor_curre
> + ntfile")}</option>
> {foreach from=$backupFiles item=backupFile}
> - <option value="{$backupFile.fileName}">{$backupFile.time}</option>
> + <option
> + value="admin.php?op=siteEditTemplateFile&templateId={$currentTem
> + plate}&fileId={$currentFile}&backupId={$backupFile.backupId}
> + ">{$backupFile.time}</option>
> {/foreach}
> </select>
> </div>
>
> <div class="field">
> - <label for="fileContent"> <a
href="?op=siteTemplatesList&templateId={$currentTemplate}">{$currentTemp
late}</a> » {$currentFile}</label>
> + <label for="fileContent"><a
> + href="?op=siteTemplatesList&templateId={$currentTemplate}">{$cur
> + rentTemplate}</a> » {$currentFile} {if
> + !empty($backupId)}»
> + {$locale->tr("templateeditor_recover_from")}:
> + {$backupId}{/if}</label>
> <span class="required">*</span>
> <div
class="formHelp">{$locale->tr("templateeditor_filecontent")}</div>
> <script type="text/javascript">var ed1 = new
> pLogEditor('fileContent','ed1');</script>
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.plogworld.net
> http://devel.plogworld.net/mailman/listinfo/plog-svn
>
_______________________________________________
pLog-svn mailing list
pLog-svn at devel.plogworld.net
http://devel.plogworld.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list