[pLog-svn] r1238 - in plugins/trunk/templateeditor: . class/action
class/view templates
mark at devel.plogworld.net
mark at devel.plogworld.net
Mon Feb 28 10:49:14 GMT 2005
Author: mark
Date: 2005-02-28 10:49:14 +0000 (Mon, 28 Feb 2005)
New Revision: 1238
Modified:
plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php
plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php
plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php
plugins/trunk/templateeditor/readme.txt
plugins/trunk/templateeditor/templates/siteedittemplatefile.template
Log:
Add a "navigation bar" and "backup select option box" to edittemplatefile
Modified: plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php 2005-02-27 23:48:31 UTC (rev 1237)
+++ plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php 2005-02-28 10:49:14 UTC (rev 1238)
@@ -42,9 +42,16 @@
$blogId = $this->_blogInfo->getId();
$templateFolder = $ts->getTemplateFolder($this->_templateId);
+ $backupFolder = $templateFolder . "backups/";
+ if( !File::exists( $backupFolder )) {
+ File::createDir( $backupFolder );
+ }
- $filename = $templateFolder . $this->_fileId;
- $file = new MyFile($filename);
+ $fileName = $templateFolder . $this->_fileId;
+ $backupFileName = $backupFolder . $this->_fileId . "_" . time();
+ File::copy($fileName,$backupFileName);
+
+ $file = new MyFile($fileName);
$fileContent = $file->writeFileContent( stripslashes($this->_fileContent) );
// if everything went ok...
Modified: plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php 2005-02-27 23:48:31 UTC (rev 1237)
+++ plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php 2005-02-28 10:49:14 UTC (rev 1238)
@@ -27,15 +27,28 @@
$blogId = $this->_blogInfo->getId();
$templateFolder = $ts->getTemplateFolder($this->_templateId);
-
+ $backupFolder = $templateFolder . "backups/";
+ if( !File::exists( $backupFolder )) {
+ File::createDir( $backupFolder );
+ }
+
$filename = $templateFolder . $this->_fileId;
- // get a list with all the global template sets
+ $backupFilePattern = $this->_fileId . "_*";
+
+ $bakFiles = Glob::myGlob( $backupFolder, $backupFilePattern );
+ $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);
+ }
+
$file = new MyFile($filename);
-
$fileContent = $file->readFileContent();
- //$fileContent = implode("\n" , $fileContent);
-
+ $this->setValue( "backupFiles", $backupFiles );
$this->setValue( "currentTemplate", $this->_templateId );
$this->setValue( "currentFile", $this->_fileId );
$this->setValue( "fileContent", $fileContent );
Modified: plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php 2005-02-27 23:48:31 UTC (rev 1237)
+++ plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php 2005-02-28 10:49:14 UTC (rev 1238)
@@ -37,7 +37,7 @@
foreach ($cssFiles as $cssFile) {
$file['name'] = basename($cssFile);
- $file['fullPath'] = $cssFile;
+ // $file['fullPath'] = $cssFile;
$file['size'] = filesize($cssFile);
array_push ($templateFiles, $file);
}
Modified: plugins/trunk/templateeditor/readme.txt
===================================================================
--- plugins/trunk/templateeditor/readme.txt 2005-02-27 23:48:31 UTC (rev 1237)
+++ plugins/trunk/templateeditor/readme.txt 2005-02-28 10:49:14 UTC (rev 1238)
@@ -1,7 +1,6 @@
-Plugin: No Follow
-Author: Original by Minstrel Chiu, Modified by Mark Wu
-Release Date: 2005/01/23
+Plugin: Template Editor
+Author: Mark Wu
+Release Date: 2005/02/28
Version: 1.0
-Prevents comment spams with 'rel=nofollow'
-
+Template Editor.
Modified: plugins/trunk/templateeditor/templates/siteedittemplatefile.template
===================================================================
--- plugins/trunk/templateeditor/templates/siteedittemplatefile.template 2005-02-27 23:48:31 UTC (rev 1237)
+++ plugins/trunk/templateeditor/templates/siteedittemplatefile.template 2005-02-28 10:49:14 UTC (rev 1238)
@@ -9,7 +9,19 @@
{include file="$admintemplatepath/errormessage.template"}
<div class="field">
- <label for="fileContent">{$currentFile}</label>
+ <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")}</option>
+ {foreach from=$backupFiles item=backupFile}
+ <option value="{$backupFile.fileName}">{$backupFile.time}</option>
+ {/foreach}
+ </select>
+ </div>
+
+ <div class="field">
+ <label for="fileContent"> <a href="?op=siteTemplatesList&templateId={$currentTemplate}">{$currentTemplate}</a> » {$currentFile}</label>
<span class="required">*</span>
<div class="formHelp">{$locale->tr("templateeditor_filecontent")}</div>
<script type="text/javascript">var ed1 = new pLogEditor('fileContent','ed1');</script>
More information about the pLog-svn
mailing list