[pLog-svn] r1211 - in plugins/trunk/templateeditor: . class class/action class/view locale templates

mark at devel.plogworld.net mark at devel.plogworld.net
Fri Feb 25 18:00:09 GMT 2005


Author: mark
Date: 2005-02-25 18:00:09 +0000 (Fri, 25 Feb 2005)
New Revision: 1211

Added:
   plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatesetsaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsitetemplatesetslistaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php
   plugins/trunk/templateeditor/class/view/
   plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php
   plugins/trunk/templateeditor/class/view/pluginsitetemplatesetslistview.class.php
   plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php
   plugins/trunk/templateeditor/locale/locale_zh_TW.php
   plugins/trunk/templateeditor/readme.txt
   plugins/trunk/templateeditor/templates/siteedittemplatefile.template
   plugins/trunk/templateeditor/templates/sitetemplatesetslist.template
   plugins/trunk/templateeditor/templates/sitetemplateslist.template
Removed:
   plugins/trunk/templateeditor/class/action/admintemplateeditoraction.class.php
   plugins/trunk/templateeditor/templates/main.template
Modified:
   plugins/trunk/templateeditor/locale/locale_en_UK.php
   plugins/trunk/templateeditor/plugintemplateeditor.class.php
Log:
Template Editor, only complete:
1. TemplateSets (List, Delete and Look Files)
2. TemplateFiles (List, Delete and Edit File)
3. Edit File (Only view, without updating)

To do:
1. Add update function
2. Add Backup function (Up to 5 backup files)
3. Add smarty tag to pLogEditor.js

Deleted: plugins/trunk/templateeditor/class/action/admintemplateeditoraction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/admintemplateeditoraction.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/action/admintemplateeditoraction.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -1,27 +0,0 @@
-<?php
-
-    include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
-    include_once( PLOG_CLASS_PATH."class/view/plugintemplatedview.class.php" );
-    
-    /**
-	 * shows the main and initial screen of the template editor. Other actions
-	 * will use their own Action class
-     */
-    class AdminTemplateEditorAction extends AdminAction
-    {
-    
-        function AdminTemplateEditorAction( $actionInfo, $request )
-        {
-            $this->AdminAction( $actionInfo, $request );
-        }
-        
-        function perform()
-        {
-			// very simple, load only one template and show it
-            $this->_view = new AdminPluginTemplatedView( $this->_blogInfo, "templateeditor", "main" );
-            $this->setCommonData();
-            
-            return true;
-        }
-    }
-?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,84 @@
+<?php
+	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+    include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplateslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+
+    /**
+     * Removes global templates from disk.
+     */
+    class PluginSiteDeleteTemplateFilesAction extends SiteAdminAction
+    {
+        var $_templateId;
+    	var $_fileIds;
+    	var $_op;
+
+        function PluginSiteDeleteTemplateFilesAction( $actionInfo, $request )
+        {
+        	$this->SiteAdminAction( $actionInfo, $request );
+
+			$this->_templateId = $this->_request->getValue( "templateId" );
+			
+			// data validation stuff
+        	$this->_op = $actionInfo->getActionParamValue();
+        	if( $this->_op == "siteDeleteTemplateFile" )
+        		$this->registerFieldValidator( "fileId", new StringValidator());
+        	else
+        		$this->registerFieldValidator( "fileIds", new ArrayValidator());
+        	$view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+        	$view->setErrorMessage( $this->_locale->tr("error_no_files_selected"));
+        	$this->setValidationErrorView( $view );
+        }
+
+        function perform()
+        {
+        	if( $this->_op == "siteDeleteTemplateFile" ) {
+        		$fileId = $this->_request->getValue( "fileId" );
+        		$this->_fileIds = Array();
+        		$this->_fileIds[] = $fileId;
+        	}
+        	else
+        		$this->_fileIds = $this->_request->getValue( "fileIds" );
+
+        	// carry out the
+        	$this->_deleteFiles();
+        }
+
+        function _deleteFiles()
+        {
+        	$ts = new TemplateSetStorage();
+
+        	$errorMessage = "";
+        	$successMessage = "";
+        	$totalOk = 0;
+
+        	$ts = new TemplateSetStorage();
+            
+            $blogId = $this->_blogInfo->getId();
+            $templateFolder = $ts->getTemplateFolder($this->_templateId);
+
+            foreach( $this->_fileIds as $fileId ) {
+                $filename = $templateFolder . $fileId;
+           		// if it's not the default, then try to really remove it from disk
+				if( !File::delete( $filename ))
+					$errorMessage .= $this->_locale->pr("error_removing_template_file", $fileId )."<br/>";
+				else {
+					$totalOk++;
+					if( $totalOk < 2 )
+						$successMessage = $this->_locale->pr("template_file_removed_ok", $fileId);
+					else
+						$successMessage = $this->_locale->pr( "template_files_removed_ok", $totalOk );
+				}
+            }
+
+            // create the view and show some feedback
+            $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+			if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
+			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
+            $this->setCommonData();
+
+            return true;
+        }
+    }
+?>

Added: plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatesetsaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatesetsaction.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatesetsaction.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,84 @@
+<?php
+	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+    include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplatesetslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
+	include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
+
+    /**
+     * Removes global templates from disk.
+     */
+    class PluginSiteDeleteTemplateSetsAction extends SiteAdminAction
+    {
+
+    	var $_templateIds;
+    	var $_op;
+
+        function PluginSiteDeleteTemplateSetsAction( $actionInfo, $request )
+        {
+        	$this->SiteAdminAction( $actionInfo, $request );
+
+			// data validation stuff
+        	$this->_op = $actionInfo->getActionParamValue();
+        	if( $this->_op == "siteDeleteTemplateSet" )
+        		$this->registerFieldValidator( "templateId", new StringValidator());
+        	else
+        		$this->registerFieldValidator( "templateIds", new ArrayValidator());
+        	$view = new PluginSiteTemplateSetsListView( $this->_blogInfo );
+        	$view->setErrorMessage( $this->_locale->tr("error_no_templates_selected"));
+        	$this->setValidationErrorView( $view );
+        }
+
+        function perform()
+        {
+        	if( $this->_op == "siteDeleteTemplateSet" ) {
+        		$templateId = $this->_request->getValue( "templateId" );
+        		$this->_templateIds = Array();
+        		$this->_templateIds[] = $templateId;
+        	}
+        	else
+        		$this->_templateIds = $this->_request->getValue( "templateIds" );
+
+        	// carry out the
+        	$this->_deleteTemplates();
+        }
+
+        function _deleteTemplates()
+        {
+        	$ts = new TemplateSetStorage();
+
+        	$errorMessage = "";
+        	$successMessage = "";
+        	$totalOk = 0;
+
+        	// get the id of the default template
+        	$defaultTemplate = $this->_config->getValue( "default_template" );
+
+            foreach( $this->_templateIds as $templateId ) {
+            	// we can't remove the default template
+            	if( $defaultTemplate ==$templateId )
+            		$errorMessage .=$this->_locale->pr( "error_template_is_default", $templateId)."<br/>";
+            	else {
+            		// if it's not the default, then try to really remove it from disk
+					if( !$ts->removeGlobalTemplate( $templateId ))
+						$errorMessage .= $this->_locale->pr("error_removing_template", $templateId )."<br/>";
+					else {
+						$totalOk++;
+						if( $totalOk < 2 )
+							$successMessage = $this->_locale->pr("template_removed_ok", $templateId);
+						else
+							$successMessage = $this->_locale->pr( "templates_removed_ok", $totalOk );
+					}
+				}
+            }
+
+            // create the view and show some feedback
+            $this->_view = new PluginSiteTemplateSetsListView( $this->_blogInfo );
+			if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
+			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
+            $this->setCommonData();
+
+            return true;
+        }
+    }
+?>

Added: plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,32 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsiteedittemplatefileview.class.php" );
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginSiteEditTemplateFileAction extends AdminAction
+	{
+        var $_templateId;        
+        var $_fileId;
+        		
+		function PluginSiteEditTemplateFileAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform()
+		{
+            $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_fileId = $this->_request->getValue( "fileId" );
+            
+            $this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId );
+            
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/action/pluginsitetemplatesetslistaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitetemplatesetslistaction.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/action/pluginsitetemplatesetslistaction.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,27 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplatesetslistview.class.php" );
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginSiteTemplateSetsListAction extends AdminAction
+	{
+		
+		function PluginSiteTemplateSetsListAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform()
+		{
+            $this->_view = new PluginSiteTemplateSetsListView( $this->_blogInfo );
+			
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,30 @@
+<?php
+
+	include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplateslistview.class.php" );
+
+	/**
+	 * shows a form with the current configuration
+	 */
+	class PluginSiteTemplatesListAction extends AdminAction
+	{
+        var $_templateId;
+        		
+		function PluginSiteTemplatesListAction( $actionInfo, $request )
+		{
+			$this->AdminAction( $actionInfo, $request );
+		}
+		
+		function perform()
+		{
+            $this->_templateId = $this->_request->getValue( "templateId" );
+            
+            $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            
+			$this->setCommonData();
+			
+			return true;
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/view/pluginsiteedittemplatefileview.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,46 @@
+<?php
+	
+	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."class/file/file.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginSiteEditTemplateFileView extends AdminPluginTemplatedView
+	{
+        var $_templateId;
+        var $_fileId;
+
+		function PluginSiteEditTemplateFileView( $blogInfo, $templateId, $fileId )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "siteedittemplatefile" );
+			
+			$this->_templateId = $templateId;
+			$this->_fileId = $fileId;
+		}
+		
+		function render()
+		{
+			// get a list with all the specific template files 
+        	$ts = new TemplateSetStorage();
+            
+            $blogId = $this->_blogInfo->getId();
+            $templateFolder = $ts->getTemplateFolder($this->_templateId);
+            
+            $filename = $templateFolder . $this->_fileId;
+			// get a list with all the global template sets
+        	$file = new File($filename);
+            
+            $fileContent = $file->readFile();
+            
+            $fileContent = implode("\n" , $fileContent);
+
+            $this->setValue( "currentTemplate", $this->_templateId );
+            $this->setValue( "currentFile", $this->_fileId );
+            $this->setValue( "fileContent", $fileContent );
+            		
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/view/pluginsitetemplatesetslistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsitetemplatesetslistview.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/view/pluginsitetemplatesetslistview.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,28 @@
+<?php
+	
+	include_once( PLOG_CLASS_PATH."class/view/admin/adminplugintemplatedview.class.php" );
+	include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );	
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginSiteTemplateSetsListView extends AdminPluginTemplatedView
+	{
+
+		function PluginSiteTemplateSetsListView( $blogInfo )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "sitetemplatesetslist" );
+		}
+		
+		function render()
+		{
+			// get a list with all the global template sets
+        	$ts = new TemplateSets();
+            $globalTemplates = $ts->getGlobalTemplateSets();
+            $this->setValue( "templates", $globalTemplates );
+            $this->setValue( "defaultTemplate", $ts->getDefaultTemplateSet());
+		
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,59 @@
+<?php
+	
+	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."class/misc/glob.class.php" );
+
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginSiteTemplatesListView extends AdminPluginTemplatedView
+	{
+        var $_templateId;
+
+		function PluginSiteTemplatesListView( $blogInfo, $templateId )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "sitetemplateslist" );
+			
+			$this->_templateId = $templateId;
+		}
+		
+		function render()
+		{
+			// get a list with all the global template sets
+        	$ts = new TemplateSets();
+            $globalTemplates = $ts->getGlobalTemplateSets();
+
+			// get a list with all the specific template files 
+        	$ts = new TemplateSetStorage();
+            
+            $blogId = $this->_blogInfo->getId();
+            $templateFolder = $ts->getTemplateFolder($this->_templateId);
+
+            $cssFiles = Glob::myGlob( $templateFolder, "*.css" );
+            $tplFiles = Glob::myGlob( $templateFolder, "*.template" );
+           
+            $templateFiles = Array();
+
+            foreach ($cssFiles as $cssFile) {
+                $file['name'] = basename($cssFile);
+                $file['fullPath'] = $cssFile;
+                $file['size'] = filesize($cssFile);
+                array_push ($templateFiles, $file);
+            }
+            
+            foreach ($tplFiles as $tplFile) {
+                $file['name'] = basename($tplFile);
+                $file['fullPath'] = $tplFile;
+                $file['size'] = filesize($tplFile);
+                array_push ($templateFiles, $file);
+            }
+
+            $this->setValue( "currentTemplate", $this->_templateId );
+            $this->setValue( "templateSets", $globalTemplates );
+            $this->setValue( "templateFiles", $templateFiles );
+            		
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/templateeditor/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/templateeditor/locale/locale_en_UK.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/locale/locale_en_UK.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -1,3 +1,12 @@
 <?php
-$messages["templateEditor"] = "Template Editor";
+$messages["manageAntiSpamPlugins"] = "Anti Spam Management";
+$messages["NoFollow"] = "NoFollow";
+
+$messages["nofollow_plugin_enabled"] = "Enable this plugin";
+$messages["nofollow_plugin"] = "No Follow Plugin";
+
+$messages["nofollow_settings_saved_ok"] = "No Follow settings saved successfully!";
+
+$messages["label_configuration"] = "Configuration";
+$messages["label_enable"] = "Enable";
 ?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/locale/locale_zh_TW.php
===================================================================
--- plugins/trunk/templateeditor/locale/locale_zh_TW.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/locale/locale_zh_TW.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,12 @@
+<?php
+$messages["manageAntiSpamPlugins"] = "防制垃圾干擾管理";
+$messages["NoFollow"] = "NoFollow 協議設定";
+
+$messages["nofollow_plugin_enabled"] = "啟動外掛程式";
+$messages["nofollow_plugin"] = "No Follow 外掛程式";
+
+$messages["nofollow_settings_saved_ok"] = "No Follow 設定儲存成功。";
+
+$messages["label_configuration"] = "設定";
+$messages["label_enable"] = "啟動";
+?>
\ No newline at end of file

Modified: plugins/trunk/templateeditor/plugintemplateeditor.class.php
===================================================================
--- plugins/trunk/templateeditor/plugintemplateeditor.class.php	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/plugintemplateeditor.class.php	2005-02-25 18:00:09 UTC (rev 1211)
@@ -1,35 +1,35 @@
-<?php
-
-	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
-	
-	/**
-	 * on-line template editor
-	 */
-	class PluginTemplateEditor extends PluginBase
-	{
-	
-		function PluginTemplateEditor()
-		{
-			$this->PluginBase();
-			
-			$this->id = "templateeditor";
-			$this->description = "Allows users to edit their templates online";
-			$this->author = "The pLog Team";
-			$this->locales = Array( "en_UK" );
-			
-			$this->init();
-		}
-		
-		/**
-		 * registers all the filters and actions that we're going to use
-		 */
-		function init()
-		{			
-		    // register a new admin action, this one will show the main page of the template editor
-		    $this->registerAdminAction( "templateEditor", "AdminTemplateEditorAction" );
-			
-			// add one new menu entry under blogsettings so that users can edit templates
-			$this->addMenuEntry( "/menu/controlCenter/manageBlogTemplates", "templateEditor", "admin.php?op=templateEditor", "", true, false );			
-		}
-	}  
+<?php
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginbase.class.php" );
+	include_once( PLOG_CLASS_PATH."class/plugin/pluginmanager.class.php" );
+
+	class PluginTemplateEditor extends PluginBase
+	{
+		var $pluginEnabled;
+		
+		function PluginTemplateEditor()
+		{
+			$this->PluginBase();
+
+			$this->id      = "templateeditor";
+			$this->author  = "Mark Wu";
+			$this->desc    = "The plugin offer online template editor function for pLog";
+
+			$this->locales = Array( "en_UK" , "zh_TW" );
+
+			$this->init();
+		}
+
+		function init()
+		{
+            $this->registerAdminAction( "siteTemplateSetsList", "PluginSiteTemplateSetsListAction" );
+            $this->registerAdminAction( "siteDeleteTemplateSet", "PluginSiteDeleteTemplateSetsAction" );
+            $this->registerAdminAction( "siteDeleteTemplateSets", "PluginSiteDeleteTemplateSetsAction" );
+            $this->registerAdminAction( "siteTemplatesList", "PluginSiteTemplatesListAction" );
+            $this->registerAdminAction( "siteDeleteTemplateFile", "PluginSiteDeleteTemplateFilesAction" );
+            $this->registerAdminAction( "siteDeleteTemplateFiles", "PluginSiteDeleteTemplateFilesAction" );
+            $this->registerAdminAction( "siteEditTemplateFile", "PluginSiteEditTemplateFileAction" );
+			
+			$this->addMenuEntry( "/menu/adminSettings/Templates", "templateEditor", "admin.php?op=siteTemplateSetsList", "templateEditor", false, true );
+		}
+	}
 ?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/readme.txt
===================================================================
--- plugins/trunk/templateeditor/readme.txt	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/readme.txt	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,7 @@
+Plugin: No Follow
+Author: Original by Minstrel Chiu, Modified by Mark Wu
+Release Date: 2005/01/23
+Version: 1.0
+
+Prevents comment spams with 'rel=nofollow'
+

Deleted: plugins/trunk/templateeditor/templates/main.template
===================================================================
--- plugins/trunk/templateeditor/templates/main.template	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/templates/main.template	2005-02-25 18:00:09 UTC (rev 1211)
@@ -1,8 +0,0 @@
-{include file="$admintemplatepath/header.template"}
-{include file="$admintemplatepath/navigation.template" showOpt=templateEditor title=$locale->tr("templateEditor")}
-<p>
- This is the main page! Here users will see a list of the templates currently installed,
- and what can be done with them...
-</p>
-{include file="$admintemplatepath/footernavigation.template"}
-{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plugins/trunk/templateeditor/templates/siteedittemplatefile.template
===================================================================
--- plugins/trunk/templateeditor/templates/siteedittemplatefile.template	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/templates/siteedittemplatefile.template	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,29 @@
+{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" />
+<script type="text/javascript" src="js/editor/plogeditor.js"></script>
+<form name="siteEditTemplateFile" method="post">
+ <fieldset class="inputField">
+ <legend>{$locale->tr("label_edit")}</legend>  
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}   
+
+  <div class="field">
+   <label for="fileContent">{$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>
+   <textarea rows="25" id="fileContent" name="fileContent" style="width:100%">{$fileContent|escape:"html"}</textarea>
+  </div>
+  
+ </fieldset>  
+
+ <div class="buttons">
+  <input type="hidden" name="op" value="updateNoFollowConfig" />
+  <input type="reset" name="{$locale->tr("reset")}" />    
+  <input type="submit" name="{$locale->tr("update_settings")}" value="{$locale->tr("update")}" />
+ </div>
+</form>
+ 
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plugins/trunk/templateeditor/templates/sitetemplatesetslist.template
===================================================================
--- plugins/trunk/templateeditor/templates/sitetemplatesetslist.template	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/templates/sitetemplatesetslist.template	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,51 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=templateEditor title=$locale->tr("templateEditor")}
+ <form id="siteTemplateSetsList" method="post" action="admin.php">
+ <div id="list">
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+  <table class="info">
+   <thead>
+    <tr>
+      <th style="width:10px;"><input class="checkbox" type="checkbox" class="check" name="all" id="all" value="1" onclick="toggleAllChecks('siteTemplates');" /></th>
+      <th style="width:670px;">{$locale->tr("template")}</th>
+      <th style="width:95px;">{$locale->tr("actions")}</th>
+    </tr>
+  </thead>
+  <tbody>
+  {foreach from=$templates item=sitetemplate}
+   <tr class="{cycle values="odd,even"}">
+    <td>
+       <input class="checkbox" type="checkbox" name="templateIds[{counter}]" value="{$sitetemplate->getName()}" />
+    </td>
+    <td  class="col_highlighted">
+     <a href="?op=siteTemplatesList&amp;templateId={$sitetemplate->getName()}">{$sitetemplate->getName()}</a>
+    </td>
+    <td>
+     <div class="list_action_button">
+      <a href="?op=siteTemplatesList&amp;templateId={$sitetemplate->getName()}">
+        <img src="imgs/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+      </a>
+      <a href="?op=siteDeleteTemplateSet&amp;templateId={$sitetemplate->getName()}">
+        <img src="imgs/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+      </a>
+	  {if $sitetemplate->hasScreenshot()}
+	    <a href="javascript:openScreenshotWindow('{$sitetemplate->getScreenshotUrl()}');">
+		  <img src="imgs/icon_image-16.png" alt="Screenshot" />
+		</a>
+	  {/if}	  
+     </div>
+    </td>
+   </tr>
+  {/foreach}
+  </tbody>
+ </table>
+ </div>
+ <div id="list_action_bar">
+   <input type="hidden" name="op" value="siteDeleteTemplateSets" class="submit" />
+   <input type="submit" name="{$locale->tr("delete")}" value="{$locale->tr("delete")}"/>
+ </div>
+ </form>
+ 
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file

Added: plugins/trunk/templateeditor/templates/sitetemplateslist.template
===================================================================
--- plugins/trunk/templateeditor/templates/sitetemplateslist.template	2005-02-25 17:09:01 UTC (rev 1210)
+++ plugins/trunk/templateeditor/templates/sitetemplateslist.template	2005-02-25 18:00:09 UTC (rev 1211)
@@ -0,0 +1,77 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=templateEditor title=$locale->tr("templateEditor")}
+
+<div id="list_nav_bar">
+ <div id="list_nav_select">
+  <form id="viewTemplateSets" action="admin.php" method="post">
+   <fieldset>
+    <legend>{$locale->tr("show_by")}</legend>
+    <div class="list_nav_option">
+     <label for="templateId">{$locale->tr("template")}</label>
+	 <br />
+	 <select name="templateId" id="templateId">
+      {foreach from=$templateSets item=templateSet}
+       <option value="{$templateSet->getName()}" {if $currentTemplate == $templateSet->getName()} selected="selected" {/if}>{$templateSet->getName()}</option>
+      {/foreach}
+     </select>
+    </div>
+    <div class="list_nav_option">
+     <br />
+     <input type="hidden" name="op" value="siteTemplatesList">
+     <input type="submit" name="Show" value="{$locale->tr("show")}">
+    </div>
+   </fieldset> 
+  </form> 
+ </div>
+ <br style="clear:both">
+</div>
+
+<form id="siteTemplatesList" method="post" action="admin.php">
+ <div id="list">
+  {include file="$admintemplatepath/successmessage.template"}
+  {include file="$admintemplatepath/errormessage.template"}
+  <table class="info">
+   <thead>
+    <tr>
+      <th style="width:10px;"><input class="checkbox" type="checkbox" class="check" name="all" id="all" value="1" onclick="toggleAllChecks('templateFiles');" /></th>
+      <th style="width:520px;">{$locale->tr("file")}</th>
+      <th style="width:150px;">{$locale->tr("size")} ({$locale->tr("bytes")})</th>
+      <th style="width:95px;">{$locale->tr("actions")}</th>
+    </tr>
+  </thead>
+  <tbody>
+  {foreach from=$templateFiles item=file}
+   <tr class="{cycle values="odd,even"}">
+    <td>
+       <input class="checkbox" type="checkbox" name="fileIds[{counter}]" value="{$file.name}" />
+    </td>
+    <td  class="col_highlighted">
+     <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">{$file.name}</a>
+    </td>
+    <td>
+     {$file.size}
+    </td>    
+    <td>
+     <div class="list_action_button">
+      <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
+        <img src="imgs/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+      </a>
+      <a href="?op=siteDeleteTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
+        <img src="imgs/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+      </a>
+     </div>
+    </td>
+   </tr>
+  {/foreach}
+  </tbody>
+ </table>
+ </div>
+ <div id="list_action_bar">
+   <input type="hidden" name="templateId" value="{$currentTemplate}" />
+   <input type="hidden" name="op" value="siteDeleteTemplateFiles" class="submit" />
+   <input type="submit" name="{$locale->tr("delete")}" value="{$locale->tr("delete")}"/>
+ </div>
+</form>
+ 
+{include file="$admintemplatepath/footernavigation.template"}
+{include file="$admintemplatepath/footer.template"}
\ No newline at end of file




More information about the pLog-svn mailing list