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

mark at devel.plogworld.net mark at devel.plogworld.net
Fri Mar 18 05:05:17 GMT 2005


Author: mark
Date: 2005-03-18 05:05:16 +0000 (Fri, 18 Mar 2005)
New Revision: 1543

Added:
   plugins/trunk/templateeditor/class/view/pluginblogeditsubfoldertemplatefileview.class.php
   plugins/trunk/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php
   plugins/trunk/templateeditor/class/view/pluginsiteeditsubfoldertemplatefileview.class.php
   plugins/trunk/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php
   plugins/trunk/templateeditor/templates/blogeditsubfoldertemplatefile.template
   plugins/trunk/templateeditor/templates/blogtemplatesubfolderlist.template
   plugins/trunk/templateeditor/templates/siteeditsubfoldertemplatefile.template
   plugins/trunk/templateeditor/templates/sitetemplatesubfolderlist.template
Modified:
   plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileaction.class.php
   plugins/trunk/templateeditor/class/action/pluginblogdeletetemplatefilesaction.class.php
   plugins/trunk/templateeditor/class/action/pluginblogedittemplatefileaction.class.php
   plugins/trunk/templateeditor/class/action/pluginblogtemplateslistaction.class.php
   plugins/trunk/templateeditor/class/action/pluginblogupdatetemplatefileaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php
   plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php
   plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class.php
   plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php
   plugins/trunk/templateeditor/readme.txt
   plugins/trunk/templateeditor/templates/blogtemplatesetslist.template
   plugins/trunk/templateeditor/templates/blogtemplateslist.template
   plugins/trunk/templateeditor/templates/sitetemplatesetslist.template
   plugins/trunk/templateeditor/templates/sitetemplateslist.template
Log:
1.1 2005/03/18
 Add Smarty Tag to online smarty editor
 Add the capability to browse sub folder under template set (Restrict to 1 level only)

Modified: plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,6 +2,7 @@
     include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php" );		
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplateslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php" );
     include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php" );	
 
     /**
@@ -11,6 +12,7 @@
     {
 
     	var $_templateId;
+        var $_subFolderId;    	
     	var $_fileId;
     	var $_newFileId;
 
@@ -22,17 +24,26 @@
 		function validate()
 		{
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             $this->_fileId = $this->_request->getValue( "fileId" );
             $this->_newFileId = $this->_request->getValue( "newFileId" );
             if( !$this->isValidTamplateFileName( $this->_newFileId ) ) {
-                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+                if ( empty($this->_subFolderId) ) {
+                    $view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+                } else {
+                    $view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                } 
                 $this->_view->setErrorMessage( $this->_locale->tr("templateeditor_error_templatefile_name"));
                 $this->setCommonData();
 
                 return false;
             }
             if( !$this->isValidExtension( $this->_newFileId ) ) {
-                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+                if ( empty($this->_subFolderId) ) {
+                    $view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+                } else {
+                    $view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                }
                 $this->_view->setErrorMessage( $this->_locale->tr("templateeditor_error_templatefile_extension"));
                 $this->setCommonData();
 
@@ -46,13 +57,18 @@
         	$ts = new TemplateSetStorage();
             $blogId = $this->_blogInfo->getId();
             $templateFolder = $ts->getTemplateFolder($this->_templateId, $blogId);
+            if ( !empty($this->_subFolderId) ) $templateFolder = $templateFolder . $this->_subFolderId . "/";
 
 			// Get template files according extension
             $templateFiles = $this->getTemplateFiles( $templateFolder );            
             
             foreach ($templateFiles as $file) {
                 if ( $file['name'] == $this->_newFileId ) {
-                	$this->_view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+                    if ( empty($this->_subFolderId) ) {
+                        $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+                    } else {
+                        $this->_view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                    }
                 	$this->_view->setErrorMessage( $this->_locale->tr("error_duplicate_templatefile_name"));
                     $this->setCommonData();
                     return false;
@@ -63,7 +79,11 @@
             $newFile = $templateFolder . $this->_newFileId;
             
             if ( !File::copy($sourceFile, $newFile) ) {
-                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+                if ( empty($this->_subFolderId) ) {
+                    $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+                } else {
+                    $this->_view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                }
                 $this->_view->setErrorMessage( $this->_locale->tr("error_copying_templatefile"));
                 $this->setCommonData();
                 return false;                
@@ -73,7 +93,11 @@
             $this->_session->setValue( "blogInfo", $this->_blogInfo );
             $this->saveSession();
             
-			$this->_view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
 			$this->_view->setSuccessMessage( $this->_locale->tr("templateeditor_templatefile_copyed_ok"));
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginblogdeletetemplatefilesaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginblogdeletetemplatefilesaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginblogdeletetemplatefilesaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,6 +2,7 @@
     include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
     include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplateslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php" );
 	include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
 	include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
 
@@ -11,6 +12,7 @@
     class PluginBlogDeleteTemplateFilesAction extends BlogOwnerAdminAction
     {
         var $_templateId;
+        var $_subFolderId;
     	var $_fileIds;
     	var $_op;
 
@@ -19,6 +21,7 @@
         	$this->BlogOwnerAdminAction( $actionInfo, $request );
 
 			$this->_templateId = $this->_request->getValue( "templateId" );
+			$this->_subFolderId = $this->_request->getValue( "subFolderId" );
 			
 			// data validation stuff
         	$this->_op = $actionInfo->getActionParamValue();
@@ -27,6 +30,11 @@
         	else
         		$this->registerFieldValidator( "fileIds", new ArrayValidator());
         	$view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+            if ( empty($this->_subFolderId) ) {
+                $view = new PluginBlogTemplatesListView( $this->_blogInfo , $this->_templateId);
+            } else {
+                $view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }         	
         	$view->setErrorMessage( $this->_locale->tr("error_no_files_selected"));
         	$this->setValidationErrorView( $view );
         }
@@ -57,6 +65,7 @@
             
             $blogId = $this->_blogInfo->getId();
             $templateFolder = $ts->getTemplateFolder($this->_templateId, $blogId);
+            if ( !empty($this->_subFolderId) ) $templateFolder = $templateFolder . $this->_subFolderId . "/";
 
             foreach( $this->_fileIds as $fileId ) {
                 $filename = $templateFolder . $fileId;
@@ -73,7 +82,11 @@
             }
 
             // create the view and show some feedback
-            $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
 			if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
 			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
             $this->setCommonData();

Modified: plugins/trunk/templateeditor/class/action/pluginblogedittemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginblogedittemplatefileaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginblogedittemplatefileaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,13 +2,15 @@
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogedittemplatefileview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogeditsubfoldertemplatefileview.class.php" );
 
 	/**
 	 * shows a form with the current configuration
 	 */
 	class PluginBlogEditTemplateFileAction extends BlogOwnerAdminAction
 	{
-        var $_templateId;        
+        var $_templateId;
+        var $_subFolderId;       
         var $_fileId;
         var $_backupId;
         		
@@ -20,10 +22,16 @@
 		function perform()
 		{
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             $this->_fileId = $this->_request->getValue( "fileId" );
             $this->_backupId = $this->_request->getValue( "backupId" );
             
             $this->_view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            } else {
+                $this->_view = new PluginBlogEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+            }
             
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginblogtemplateslistaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginblogtemplateslistaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginblogtemplateslistaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,6 +2,7 @@
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplateslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php" );
 
 	/**
 	 * shows a form with the current configuration
@@ -9,6 +10,7 @@
 	class PluginBlogTemplatesListAction extends BlogOwnerAdminAction
 	{
         var $_templateId;
+        var $_subFolderId;
         		
 		function PluginBlogTemplatesListAction( $actionInfo, $request )
 		{
@@ -18,8 +20,13 @@
 		function perform()
 		{
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );     
             
-            $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
             
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginblogupdatetemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginblogupdatetemplatefileaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginblogupdatetemplatefileaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,7 +2,9 @@
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogedittemplatefileview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogeditsubfoldertemplatefileview.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplateslistview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesubfolderlistview.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" );	
     include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );	
@@ -13,7 +15,8 @@
 	class PluginBlogUpdateTemplateFileAction extends BlogOwnerAdminAction
 	{
         var $_fileContent;
-        var $_templateId;        
+        var $_templateId;
+        var $_subFolderId;     
         var $_fileId;
         		
 		function PluginBlogUpdateTemplateFileAction( $actionInfo, $request )
@@ -21,15 +24,21 @@
 			$this->BlogOwnerAdminAction( $actionInfo, $request );
 			
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             $this->_fileId = $this->_request->getValue( "fileId" );
             $this->_backupId = $this->_request->getValue( "backupId" );
 
 			$this->registerFieldValidator( "fileContent", new StringValidator());
 			$this->registerFieldValidator( "templateId", new StringValidator());
+			$this->registerField( "subFolderId" );
 			$this->registerFieldValidator( "fileId", new StringValidator());
 			$this->registerField( "backupId" );
 
-        	$view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            if ( empty($this->_subFolderId) ) {
+                $view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            } else {
+                $view = new PluginBlogEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+            }
         	$view->setErrorMessage( $this->_locale->tr("error_updating_template_file"));
         	$this->setValidationErrorView( $view );
 		}
@@ -43,6 +52,8 @@
             
             $blogId = $this->_blogInfo->getId();
             $templateFolder = $ts->getTemplateFolder($this->_templateId, $blogId);
+            if ( !empty($this->_subFolderId) ) $templateFolder = $templateFolder . $this->_subFolderId . "/";
+            
             $backupFolder = $templateFolder . "backups/";
 			if( !File::exists( $backupFolder )) {
 				File::createDir( $backupFolder );
@@ -51,7 +62,11 @@
             $fileName = $templateFolder . $this->_fileId;
             $backupFileName = $backupFolder . $this->_fileId . "_" . time();
             if( !File::copy($fileName,$backupFileName) ) {
-            	$this->_view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                if ( empty($this->_subFolderId) ) {
+                    $this->_view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                } else {
+                    $this->_view = new PluginBlogEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+                }
             	$this->_view->setErrorMessage( $this->_locale->tr("error_backup_template_file"));
                 $this->setCommonData();
                 return false;            	
@@ -59,7 +74,11 @@
             
         	$file = new MyFile($fileName);
         	if( !$file->isWritable() ) {
-            	$this->_view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                if ( empty($this->_subFolderId) ) {
+                    $this->_view = new PluginBlogEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                } else {
+                    $this->_view = new PluginBlogEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+                }
             	$this->_view->setErrorMessage( $this->_locale->tr("error_updating_template_file"));
                 $this->setCommonData();
                 return false;              
@@ -69,8 +88,12 @@
 			// if everything went ok...
             $this->_session->setValue( "blogInfo", $this->_blogInfo );
             $this->saveSession();
-            
-			$this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginBlogTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginBlogTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }            
 			$this->_view->setSuccessMessage( $this->_locale->tr("templateeditor_file_saved_ok"));
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,6 +2,7 @@
 	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."plugins/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php" );
     include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php" );	
 
     /**
@@ -11,6 +12,7 @@
     {
 
     	var $_templateId;
+        var $_subFolderId;
     	var $_fileId;
     	var $_newFileId;
 
@@ -22,17 +24,26 @@
 		function validate()
 		{
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             $this->_fileId = $this->_request->getValue( "fileId" );
             $this->_newFileId = $this->_request->getValue( "newFileId" );
             if( !$this->isValidTamplateFileName( $this->_newFileId ) ) {
-                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+                if ( empty($this->_subFolderId) ) {
+                    $view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+                } else {
+                    $view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                } 
                 $this->_view->setErrorMessage( $this->_locale->tr("templateeditor_error_templatefile_name"));
                 $this->setCommonData();
 
                 return false;
             }
             if( !$this->isValidExtension( $this->_newFileId ) ) {
-                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+                if ( empty($this->_subFolderId) ) {
+                    $view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+                } else {
+                    $view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                } 
                 $this->_view->setErrorMessage( $this->_locale->tr("templateeditor_error_templatefile_extension"));
                 $this->setCommonData();
 
@@ -46,13 +57,18 @@
         	$ts = new TemplateSetStorage();
             $blogId = $this->_blogInfo->getId();
             $templateFolder = $ts->getTemplateFolder($this->_templateId);
-
+            if ( !empty($this->_subFolderId) ) $templateFolder = $templateFolder . $this->_subFolderId . "/";
+          
 			// Get template files according extension
-            $templateFiles = $this->getTemplateFiles( $templateFolder );            
-            
+            $templateFiles = $this->getTemplateFiles( $templateFolder );
+              
             foreach ($templateFiles as $file) {
                 if ( $file['name'] == $this->_newFileId ) {
-                	$this->_view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+                    if ( empty($this->_subFolderId) ) {
+                        $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+                    } else {
+                        $this->_view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                    }
                 	$this->_view->setErrorMessage( $this->_locale->tr("error_duplicate_templatefile_name"));
                     $this->setCommonData();
                     return false;
@@ -63,7 +79,11 @@
             $newFile = $templateFolder . $this->_newFileId;
             
             if ( !File::copy($sourceFile, $newFile) ) {
-                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+                if ( empty($this->_subFolderId) ) {
+                    $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+                } else {
+                    $this->_view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+                }
                 $this->_view->setErrorMessage( $this->_locale->tr("error_copying_templatefile"));
                 $this->setCommonData();
                 return false;                
@@ -73,7 +93,11 @@
             $this->_session->setValue( "blogInfo", $this->_blogInfo );
             $this->saveSession();
             
-			$this->_view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
 			$this->_view->setSuccessMessage( $this->_locale->tr("templateeditor_templatefile_copyed_ok"));
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginsitedeletetemplatefilesaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,6 +2,7 @@
 	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."plugins/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php" );
 	include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );
 	include_once( PLOG_CLASS_PATH."class/data/validator/arrayvalidator.class.php" );
 
@@ -11,6 +12,7 @@
     class PluginSiteDeleteTemplateFilesAction extends SiteAdminAction
     {
         var $_templateId;
+        var $_subFolderId;
     	var $_fileIds;
     	var $_op;
 
@@ -19,6 +21,7 @@
         	$this->SiteAdminAction( $actionInfo, $request );
 
 			$this->_templateId = $this->_request->getValue( "templateId" );
+			$this->_subFolderId = $this->_request->getValue( "subFolderId" );
 			
 			// data validation stuff
         	$this->_op = $actionInfo->getActionParamValue();
@@ -26,7 +29,11 @@
         		$this->registerFieldValidator( "fileId", new StringValidator());
         	else
         		$this->registerFieldValidator( "fileIds", new ArrayValidator());
-        	$view = new PluginSiteTemplatesListView( $this->_blogInfo , $this->_templateId);
+            if ( empty($this->_subFolderId) ) {
+                $view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }        	
         	$view->setErrorMessage( $this->_locale->tr("error_no_files_selected"));
         	$this->setValidationErrorView( $view );
         }
@@ -57,6 +64,7 @@
             
             $blogId = $this->_blogInfo->getId();
             $templateFolder = $ts->getTemplateFolder($this->_templateId);
+            if ( !empty($this->_subFolderId) ) $templateFolder = $templateFolder . $this->_subFolderId . "/";
 
             foreach( $this->_fileIds as $fileId ) {
                 $filename = $templateFolder . $fileId;
@@ -73,7 +81,11 @@
             }
 
             // create the view and show some feedback
-            $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
 			if( $errorMessage != "" ) $this->_view->setErrorMessage( $errorMessage );
 			if( $successMessage != "" ) $this->_view->setSuccessMessage( $successMessage );
             $this->setCommonData();

Modified: plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginsiteedittemplatefileaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,13 +2,15 @@
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsiteedittemplatefileview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsiteeditsubfoldertemplatefileview.class.php" );
 
 	/**
 	 * shows a form with the current configuration
 	 */
 	class PluginSiteEditTemplateFileAction extends SiteAdminAction
 	{
-        var $_templateId;        
+        var $_templateId;
+        var $_subFolderId;      
         var $_fileId;
         var $_backupId;
         		
@@ -20,10 +22,15 @@
 		function perform()
 		{
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             $this->_fileId = $this->_request->getValue( "fileId" );
             $this->_backupId = $this->_request->getValue( "backupId" );
             
-            $this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            } else {
+                $this->_view = new PluginSiteEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+            }
             
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginsitetemplateslistaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,6 +2,7 @@
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplateslistview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php" );
 
 	/**
 	 * shows a form with the current configuration
@@ -9,6 +10,7 @@
 	class PluginSiteTemplatesListAction extends SiteAdminAction
 	{
         var $_templateId;
+        var $_subFolderId;
         		
 		function PluginSiteTemplatesListAction( $actionInfo, $request )
 		{
@@ -18,8 +20,13 @@
 		function perform()
 		{
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             
-            $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
             
 			$this->setCommonData();
 			

Modified: plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php
===================================================================
--- plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/action/pluginsiteupdatetemplatefileaction.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -2,7 +2,9 @@
 
 	include_once( PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsiteedittemplatefileview.class.php" );
+	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsiteeditsubfoldertemplatefileview.class.php" );
 	include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplateslistview.class.php" );
+    include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplatesubfolderlistview.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" );	
     include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.class.php" );	
@@ -13,7 +15,8 @@
 	class PluginSiteUpdateTemplateFileAction extends SiteAdminAction
 	{
         var $_fileContent;
-        var $_templateId;        
+        var $_templateId;
+        var $_subFolderId;     
         var $_fileId;
         		
 		function PluginSiteUpdateTemplateFileAction( $actionInfo, $request )
@@ -21,16 +24,22 @@
 			$this->SiteAdminAction( $actionInfo, $request );
 			
             $this->_templateId = $this->_request->getValue( "templateId" );
+            $this->_subFolderId = $this->_request->getValue( "subFolderId" );
             $this->_fileId = $this->_request->getValue( "fileId" );
             $this->_backupId = $this->_request->getValue( "backupId" );
 
 			$this->registerFieldValidator( "fileContent", new StringValidator());
 			$this->registerFieldValidator( "templateId", new StringValidator());
+			$this->registerField( "subFolderId" );
 			$this->registerFieldValidator( "fileId", new StringValidator());
 			$this->registerField( "backupId" );
 
-        	$view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
-        	$view->setErrorMessage( $this->_locale->tr("error_updating_template_file"));
+            if ( empty($this->_subFolderId) ) {
+                $view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+            } else {
+                $view = new PluginSiteEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+            }
+            $view->setErrorMessage( $this->_locale->tr("error_updating_template_file"));
         	$this->setValidationErrorView( $view );
 		}
 		
@@ -43,6 +52,8 @@
             
             $blogId = $this->_blogInfo->getId();
             $templateFolder = $ts->getTemplateFolder($this->_templateId);
+            if ( !empty($this->_subFolderId) ) $templateFolder = $templateFolder . $this->_subFolderId . "/";
+            
             $backupFolder = $templateFolder . "backups/";
 			if( !File::exists( $backupFolder )) {
 				File::createDir( $backupFolder );
@@ -51,7 +62,11 @@
             $fileName = $templateFolder . $this->_fileId;
             $backupFileName = $backupFolder . $this->_fileId . "_" . time();
             if( !File::copy($fileName,$backupFileName) ) {
-            	$this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                if ( empty($this->_subFolderId) ) {
+                    $this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                } else {
+                    $this->_view = new PluginSiteEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+                }
             	$this->_view->setErrorMessage( $this->_locale->tr("error_backup_template_file"));
                 $this->setCommonData();
                 return false;            	
@@ -59,7 +74,11 @@
             
         	$file = new MyFile($fileName);
         	if( !$file->isWritable() ) {
-            	$this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                if ( empty($this->_subFolderId) ) {
+                    $this->_view = new PluginSiteEditTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_fileId, $this->_backupId );
+                } else {
+                    $this->_view = new PluginSiteEditSubFolderTemplateFileView( $this->_blogInfo, $this->_templateId, $this->_subFolderId, $this->_fileId, $this->_backupId );
+                }
             	$this->_view->setErrorMessage( $this->_locale->tr("error_updating_template_file"));
                 $this->setCommonData();
                 return false;              
@@ -70,7 +89,11 @@
             $this->_session->setValue( "blogInfo", $this->_blogInfo );
             $this->saveSession();
             
-			$this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            if ( empty($this->_subFolderId) ) {
+                $this->_view = new PluginSiteTemplatesListView( $this->_blogInfo, $this->_templateId );
+            } else {
+                $this->_view = new PluginSiteTemplateSubFolderListView( $this->_blogInfo, $this->_templateId, $this->_subFolderId );
+            }
 			$this->_view->setSuccessMessage( $this->_locale->tr("templateeditor_file_saved_ok"));
 			$this->setCommonData();
 			

Added: plugins/trunk/templateeditor/class/view/pluginblogeditsubfoldertemplatefileview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginblogeditsubfoldertemplatefileview.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/view/pluginblogeditsubfoldertemplatefileview.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,84 @@
+<?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."plugins/templateeditor/class/file/myfile.class.php" );
+    
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginBlogEditSubFolderTemplateFileView extends AdminPluginTemplatedView
+	{
+        var $_templateId;
+        var $_subFolderId;
+        var $_fileId;
+        var $_backupId;
+
+		function PluginBlogEditSubFolderTemplateFileView( $blogInfo, $templateId, $subFolderId, $fileId, $backupId )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "blogeditsubfoldertemplatefile" );
+			
+			$this->_templateId = $templateId;
+			$this->_subFolderId = $subFolderId;
+			$this->_fileId = $fileId;
+			$this->_backupId = $backupId;
+		}
+		
+		function render()
+		{
+            $config =& Config::getConfig();
+            $maxBackupFiles = $config->getValue( "plugin_templateeditor_maxbackupfiles" );
+            if ($maxBackupFiles == "") $maxBackupFiles = 5;
+            		    
+			// get a list with all the specific template files 
+        	$ts = new TemplateSetStorage();
+            
+            $blogId = $this->_blogInfo->getId();
+            $templateFolder = $ts->getTemplateFolder($this->_templateId, $blogId);
+            $templateFolder = $templateFolder . $this->_subFolderId . "/";
+            
+            $backupFolder = $templateFolder . "backups/";
+			if( !File::exists( $backupFolder )) {
+				File::createDir( $backupFolder );
+			}
+           
+            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();
+            $backupFileCount = 0;
+            for ($i = count($bakFiles) - 1; $i >= 0; $i--) {
+                $bakFile = $bakFiles[$i];
+                if ( $backupFileCount < $maxBackupFiles ) {
+                    $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( "currentSubFolder", $this->_subFolderId );
+            $this->setValue( "currentFile", $this->_fileId );
+            $this->setValue( "fileContent", $fileContent );
+            		
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -14,7 +14,6 @@
 		function PluginBlogTemplatesListView( $blogInfo, $templateId )
 		{
 			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "blogtemplateslist" );
-			
 			$this->_templateId = $templateId;
 		}
 		
@@ -36,26 +35,67 @@
             $this->setValue( "currentTemplate", $this->_templateId );
             $this->setValue( "templateSets", $blogTemplateSets );
             $this->setValue( "templateFiles", $templateFiles );
+
+            $templateSubFolders = $this->getTemplateSubFolders( $templateFolder );
+            $this->setValue( "templateSubFolders", $templateSubFolders );            
             		
 			parent::render();
 		}
 
 		function getTemplateFiles( $folder ) {
-			$config =& Config::getConfig();
-			$allowedExtension = $config->getValue( "plugin_templateeditor_allowedextension" );
-			if ( $allowedExtension == "" ) $allowedExtension = "css,inc,template,txt";
-		    $extensionList = explode(",", $allowedExtension);
             $templateFiles = Array();
-		    for ($i = 0; $i < count($extensionList); $i++) {
-		        $extension = "*." . trim($extensionList[$i]);
-                $files = Glob::myGlob( $folder, $extension );
-                foreach ($files as $file) {
+            $files = Glob::myGlob( $folder, "*" );
+            foreach ($files as $file) {
+                if ( !File::isDir($file) ) {
                     $tmp['name'] = basename($file);
                     $tmp['size'] = filesize($file);
+                    $tmp['isEditable'] = $this->isValidExtension( $tmp['name'] );
+                    $tmp['isImage'] = $this->isImage( $tmp['name'] );
+                    $tmp['url'] = $file;
                     array_push ($templateFiles, $tmp);
                 }
             }
             return $templateFiles;
-        }		
+        }
+
+		function getTemplateSubFolders( $folder ) {
+            $templateSubFolders = Array();
+            $files = Glob::myGlob( $folder, "*" );
+            foreach ($files as $file) {
+                if ( File::isDir($file) ) {
+                    $tmp['name'] = basename($file);
+                    if ( $tmp['name'] != "backups" ) {
+                        array_push ($templateSubFolders, $tmp);
+                    }
+                }
+            }
+            return $templateSubFolders;
+        }        
+
+        function isValidExtension( $name )
+        {
+			$config =& Config::getConfig();
+			$allowedExtension = $config->getValue( "plugin_templateeditor_allowedextension" );
+		    $extensionList = explode(",", $allowedExtension);            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }
+
+        function isImage( $name )
+        {
+		    $extensionList = explode(",", "jpg,gif,png,bmp");            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }  	
 	}
 ?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/view/pluginblogtemplatesubfolderlistview.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,88 @@
+<?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 PluginBlogTemplateSubFolderListView extends AdminPluginTemplatedView
+	{
+        var $_templateId;
+        var $_subFolderId;
+
+		function PluginBlogTemplateSubFolderListView( $blogInfo, $templateId, $subFolderId )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "blogtemplatesubfolderlist" );
+			$this->_templateId = $templateId;
+			$this->_subFolderId = $subFolderId;			
+		}
+		
+		function render()
+		{
+			// get a list with all the global template sets
+        	$ts = new TemplateSets();
+            $blogTemplateSets = $ts->getBlogTemplateSets( $this->_blogInfo->getId(), false );
+
+			// get a list with all the specific template files 
+        	$ts = new TemplateSetStorage();
+            
+            $blogId = $this->_blogInfo->getId();
+            $templateFolder = $ts->getTemplateFolder($this->_templateId, $blogId);
+            $templateFolder = $templateFolder . $this->_subFolderId;
+
+			// Get template files according extension
+            $templateFiles = $this->getTemplateFiles( $templateFolder );
+
+            $this->setValue( "currentTemplate", $this->_templateId );
+            $this->setValue( "currentSubFolder", $this->_subFolderId );
+            $this->setValue( "templateSets", $blogTemplateSets );
+            $this->setValue( "templateFiles", $templateFiles );
+
+			parent::render();
+		}
+
+		function getTemplateFiles( $folder ) {
+            $templateFiles = Array();
+            $files = Glob::myGlob( $folder, "*" );
+            foreach ($files as $file) {
+                if ( !File::isDir($file) ) {
+                    $tmp['name'] = basename($file);
+                    $tmp['size'] = filesize($file);
+                    $tmp['isEditable'] = $this->isValidExtension( $tmp['name'] );
+                    $tmp['isImage'] = $this->isImage( $tmp['name'] );
+                    $tmp['url'] = $file;
+                    array_push ($templateFiles, $tmp);
+                }
+            }
+            return $templateFiles;
+        }
+
+        function isValidExtension( $name )
+        {
+			$config =& Config::getConfig();
+			$allowedExtension = $config->getValue( "plugin_templateeditor_allowedextension" );
+		    $extensionList = explode(",", $allowedExtension);            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }
+
+        function isImage( $name )
+        {
+		    $extensionList = explode(",", "jpg,gif,png,bmp");            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }  	
+	}
+?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/view/pluginsiteeditsubfoldertemplatefileview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsiteeditsubfoldertemplatefileview.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/view/pluginsiteeditsubfoldertemplatefileview.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,84 @@
+<?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."plugins/templateeditor/class/file/myfile.class.php" );
+    
+	/**
+	 * implements the main view of the feed reader plugin
+	 */
+	class PluginSiteEditSubFolderTemplateFileView extends AdminPluginTemplatedView
+	{
+        var $_templateId;
+        var $_subFolderId;
+        var $_fileId;
+        var $_backupId;
+
+		function PluginSiteEditSubFolderTemplateFileView( $blogInfo, $templateId, $subFolderId, $fileId, $backupId )
+		{
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "siteeditsubfoldertemplatefile" );
+			
+			$this->_templateId = $templateId;
+			$this->_subFolderId = $subFolderId;
+			$this->_fileId = $fileId;
+			$this->_backupId = $backupId;
+		}
+		
+		function render()
+		{
+            $config =& Config::getConfig();
+            $maxBackupFiles = $config->getValue( "plugin_templateeditor_maxbackupfiles" );
+            if ($maxBackupFiles == "") $maxBackupFiles = 5;
+
+			// get a list with all the specific template files 
+        	$ts = new TemplateSetStorage();
+            
+            $blogId = $this->_blogInfo->getId();
+            $templateFolder = $ts->getTemplateFolder($this->_templateId);
+            $templateFolder = $templateFolder . $this->_subFolderId . "/";
+            
+            $backupFolder = $templateFolder . "backups/";
+			if( !File::exists( $backupFolder )) {
+				File::createDir( $backupFolder );
+			}
+           
+            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();
+            $backupFileCount = 0;
+            for ($i = count($bakFiles) - 1; $i >= 0; $i--) {
+                $bakFile = $bakFiles[$i];
+                if ( $backupFileCount < $maxBackupFiles ) {
+                    $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( "currentSubFolder", $this->_subFolderId );
+            $this->setValue( "currentFile", $this->_fileId );
+            $this->setValue( "fileContent", $fileContent );
+            		
+			parent::render();
+		}
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -13,9 +13,8 @@
 
 		function PluginSiteTemplatesListView( $blogInfo, $templateId )
 		{
-			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "sitetemplateslist" );
-			
 			$this->_templateId = $templateId;
+    	    $this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "sitetemplateslist" );
 		}
 		
 		function render()
@@ -36,26 +35,67 @@
             $this->setValue( "currentTemplate", $this->_templateId );
             $this->setValue( "templateSets", $globalTemplates );
             $this->setValue( "templateFiles", $templateFiles );
+            
+            $templateSubFolders = $this->getTemplateSubFolders( $templateFolder );
+            $this->setValue( "templateSubFolders", $templateSubFolders );
             		
 			parent::render();
 		}
 		
 		function getTemplateFiles( $folder ) {
-			$config =& Config::getConfig();
-			$allowedExtension = $config->getValue( "plugin_templateeditor_allowedextension" );
-			if ( $allowedExtension == "" ) $allowedExtension = "css,inc,template,txt";
-		    $extensionList = explode(",", $allowedExtension);
             $templateFiles = Array();
-		    for ($i = 0; $i < count($extensionList); $i++) {
-		        $extension = "*." . trim($extensionList[$i]);
-                $files = Glob::myGlob( $folder, $extension );
-                foreach ($files as $file) {
+            $files = Glob::myGlob( $folder, "*" );
+            foreach ($files as $file) {
+                if ( !File::isDir($file) ) {
                     $tmp['name'] = basename($file);
                     $tmp['size'] = filesize($file);
+                    $tmp['isEditable'] = $this->isValidExtension( $tmp['name'] );
+                    $tmp['isImage'] = $this->isImage( $tmp['name'] );
+                    $tmp['url'] = $file;
                     array_push ($templateFiles, $tmp);
                 }
             }
             return $templateFiles;
-        }		    
+        }
+
+		function getTemplateSubFolders( $folder ) {
+            $templateSubFolders = Array();
+            $files = Glob::myGlob( $folder, "*" );
+            foreach ($files as $file) {
+                if ( File::isDir($file) ) {
+                    $tmp['name'] = basename($file);
+                    if ( $tmp['name'] != "backups" ) {
+                        array_push ($templateSubFolders, $tmp);
+                    }
+                }
+            }
+            return $templateSubFolders;
+        }        
+
+        function isValidExtension( $name )
+        {
+			$config =& Config::getConfig();
+			$allowedExtension = $config->getValue( "plugin_templateeditor_allowedextension" );
+		    $extensionList = explode(",", $allowedExtension);            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }
+
+        function isImage( $name )
+        {
+		    $extensionList = explode(",", "jpg,gif,png,bmp");            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }             	    
 	}
 ?>
\ No newline at end of file

Added: plugins/trunk/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php
===================================================================
--- plugins/trunk/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/class/view/pluginsitetemplatesubfolderlistview.class.php	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,88 @@
+<?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 PluginSiteTemplateSubFolderListView extends AdminPluginTemplatedView
+	{
+        var $_templateId;
+        var $_subFolderId;
+
+		function PluginSiteTemplateSubFolderListView( $blogInfo, $templateId, $subFolderId )
+		{
+			$this->_templateId = $templateId;
+			$this->_subFolderId = $subFolderId;
+			$this->AdminPluginTemplatedView( $blogInfo, "templateeditor", "sitetemplatesubfolderlist" );
+		}
+		
+		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);
+            $templateFolder = $templateFolder . $this->_subFolderId;
+
+			// Get template files according extension
+            $templateFiles = $this->getTemplateFiles( $templateFolder );
+
+            $this->setValue( "currentTemplate", $this->_templateId );
+            $this->setValue( "currentSubFolder", $this->_subFolderId );
+            $this->setValue( "templateSets", $globalTemplates );
+            $this->setValue( "templateFiles", $templateFiles );
+            
+			parent::render();
+		}
+		
+		function getTemplateFiles( $folder ) {
+            $templateFiles = Array();
+            $files = Glob::myGlob( $folder, "*" );
+            foreach ($files as $file) {
+                if ( !File::isDir($file) ) {
+                    $tmp['name'] = basename($file);
+                    $tmp['size'] = filesize($file);
+                    $tmp['isEditable'] = $this->isValidExtension( $tmp['name'] );
+                    $tmp['isImage'] = $this->isImage( $tmp['name'] );
+                    $tmp['url'] = $file;
+                    array_push ($templateFiles, $tmp);
+                }
+            }
+            return $templateFiles;
+        }
+
+        function isValidExtension( $name )
+        {
+			$config =& Config::getConfig();
+			$allowedExtension = $config->getValue( "plugin_templateeditor_allowedextension" );
+		    $extensionList = explode(",", $allowedExtension);            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }
+
+        function isImage( $name )
+        {
+		    $extensionList = explode(",", "jpg,gif,png,bmp");            
+            $fileExtension = array_pop(explode('.', $name));
+            foreach ($extensionList as $extension) {
+                if ( $fileExtension == trim($extension) ) {
+                    return true;   
+                }
+            }
+            return false;
+        }             	    
+	}
+?>
\ No newline at end of file

Modified: plugins/trunk/templateeditor/readme.txt
===================================================================
--- plugins/trunk/templateeditor/readme.txt	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/readme.txt	2005-03-18 05:05:16 UTC (rev 1543)
@@ -1,10 +1,18 @@
 Plugin: Template Editor
 Author: Mark Wu
-Release Date: 2005/03/01
-Version: 1.0
+Release Date: 2005/03/18
+Version: 1.1
 
 The plugins offers complete template editor capabilities for pLog. It includes the following features.
 1. Template Sets Browser
 2. Template Files Browser
 3. Template Files Editor with a Online Smarty Editor (under development)
 4. Backup of template files.
+
+
+History
+1.1 2005/03/18
+ Add Smarty Tag to online smarty editor
+ Add the capability to browse sub folder under template set (Restrict to 1 level only)
+1.0 2005/03/01
+ Basic Template Editor function Ready

Added: plugins/trunk/templateeditor/templates/blogeditsubfoldertemplatefile.template
===================================================================
--- plugins/trunk/templateeditor/templates/blogeditsubfoldertemplatefile.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/blogeditsubfoldertemplatefile.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,53 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=BlogTemplateEditor title=$locale->tr("BlogTemplateEditor")}
+<link rel="stylesheet" href="plugins/templateeditor/js/editor/smartyeditor.css" type="text/css" />
+{literal}
+<script type="text/javascript" src="plugins/templateeditor/js/editor/smartyeditor.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="blogEditSubFolderTemplateFile" 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="backupFile">{$locale->tr("label_backupfile")}</label>
+   <span class="required"></span>
+   <div class="formHelp">{$locale->tr("templateeditor_backupfile")}</div>
+   <select name="backupFile" id="backupFile" onChange="MM_jumpMenu('parent',this,0)">
+    <option value="">{$locale->tr("templateeditor_choose_backupfile")}</option>
+    <option value="admin.php?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$currentFile}">{$locale->tr("templateeditor_currentfile")}</option>
+    {foreach from=$backupFiles item=backupFile}
+     <option value="admin.php?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$currentFile}&amp;backupId={$backupFile.backupId}">{$backupFile.time}</option>
+    {/foreach}
+   </select>
+  </div>
+
+  <div class="field">
+   <label for="fileContent"><a href="?op=blogTemplatesList&amp;templateId={$currentTemplate}">{$currentTemplate}</a> &raquo; <a href="?op=blogTemplatesList&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}">{$currentSubFolder}</a> &raquo; {$currentFile} {if !empty($backupId)}&raquo; {$locale->tr("templateeditor_recover_from")}: {$backupId|date_format:"%Y/%m/%d - %H:%M:%S"}{/if}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("templateeditor_filecontent")}</div>
+   <script type="text/javascript">var ed1 = new SmartyEditor('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="templateId" value="{$currentTemplate}" />
+  <input type="hidden" name="subFolderId" value="{$currentSubFolder}" />
+  <input type="hidden" name="fileId" value="{$currentFile}" />
+  <input type="hidden" name="op" value="blogUpdateTemplateFile" />
+  <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

Modified: plugins/trunk/templateeditor/templates/blogtemplatesetslist.template
===================================================================
--- plugins/trunk/templateeditor/templates/blogtemplatesetslist.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/blogtemplatesetslist.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -37,6 +37,7 @@
      <div align="center"><span style="background-color: #CCCCCC">&nbsp;&nbsp;&nbsp;</span></div>
     </td>
     <td  class="col_highlighted">
+     <img src="imgs/admin/icon_folder-16.png" />
      {$sitetemplate->getName()}
     </td>
     <td>
@@ -44,6 +45,8 @@
     </td>
     <td>
      <div class="list_action_button">
+      <img src="imgs/admin/icon_empty-16.png" />
+      <img src="imgs/admin/icon_empty-16.png" />
       <a href="?op=blogCopyTemplateSet&amp;type=1&amp;templateId={$sitetemplate->getName()}" id="{$sitetemplate->getName()}" onClick="copyTemplateSetTo(this.id)" >
         <img src="imgs/admin/icon_copy-16.png" alt="{$locale->tr("copy")}" />
       </a>      
@@ -63,7 +66,10 @@
        <input class="checkbox" type="checkbox" name="templateIds[{counter}]" value="{$blogtemplate->getName()}" />
     </td>
     <td  class="col_highlighted">
-     <a href="?op=blogTemplatesList&amp;templateId={$blogtemplate->getName()}">{$blogtemplate->getName()}</a>
+     <a href="?op=blogTemplatesList&amp;templateId={$blogtemplate->getName()}">
+      <img src="imgs/admin/icon_folder-16.png" />
+      {$blogtemplate->getName()}
+     </a>
     </td>
     <td>
      {$locale->tr("blog")}

Modified: plugins/trunk/templateeditor/templates/blogtemplateslist.template
===================================================================
--- plugins/trunk/templateeditor/templates/blogtemplateslist.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/blogtemplateslist.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -14,6 +14,11 @@
         url.setAttribute('href', '?op=blogTemplatesList&templateId=' + templateId);
     }
 }
+
+function openImagePreviewWindow( destUrl )
+{
+	PreviewWindow = window.open( destUrl, 'ImagePreview','scrollbars=yes,resizable=yes,toolbar=no,height=480,width=640');
+}
 </SCRIPT>
 {/literal}
 <div id="list_nav_bar">
@@ -55,28 +60,73 @@
     </tr>
   </thead>
   <tbody>
+
+  {foreach from=$templateSubFolders item=folder}
+   <tr class="{cycle values="odd,even"}">
+    <td>
+     <div align="center"><span style="background-color: #CCCCCC">&nbsp;&nbsp;&nbsp;</span></div>
+    </td>
+    <td  class="col_highlighted">
+     <a href="?op=blogTemplatesList&amp;templateId={$currentTemplate}&amp;subFolderId={$folder.name}">
+      <img src="imgs/admin/icon_folder-16.png" />
+      {$folder.name}
+     </a>
+    </td>
+    <td>
+    </td>    
+    <td>
+    </td>
+   </tr>
+  {/foreach}
+  
   {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=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">{$file.name}</a>
+     {if $file.isEditable}
+      <a href="?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
+       <img src="imgs/admin/icon_template-16.png" />
+       {$file.name}
+      </a>
+     {elseif $file.isImage}
+      <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+       <img src="imgs/admin/icon_photo-16.png" />
+	   {$file.name}
+	  </a>
+	 {else}
+	  <img src="imgs/admin/icon_other-16.png" />
+	  {$file.name}
+     {/if}      
     </td>
     <td>
      {$file.size}
     </td>    
     <td>
      <div class="list_action_button">
-      <a href="?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
+      {if $file.isEditable}
+       <a href="?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
         <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
-      </a>
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}     
       <a href="?op=blogDeleteTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
-        <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+       <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
       </a>
-      <a href="?op=blogCopyTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}" id="{$file.name}" onClick="copyTemplateFileTo(this.id, '{$currentTemplate}')" >
+      {if $file.isEditable}
+       <a href="?op=blogCopyTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}" id="{$file.name}" onClick="copyTemplateFileTo(this.id, '{$currentTemplate}')" >
         <img src="imgs/admin/icon_copy-16.png" alt="{$locale->tr("copy")}" />
-      </a>        
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}      
+      {if $file.isImage}
+	   <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+		<img src="imgs/admin/icon_image-16.png" alt="Preview" />
+	   </a>      
+      {/if}         
      </div>
     </td>
    </tr>

Added: plugins/trunk/templateeditor/templates/blogtemplatesubfolderlist.template
===================================================================
--- plugins/trunk/templateeditor/templates/blogtemplatesubfolderlist.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/blogtemplatesubfolderlist.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,144 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=BlogTemplateEditor title=$locale->tr("BlogTemplateEditor")}
+<SCRIPT type="text/javascript"> var copyToMessage = '{$locale->tr("templateeditor_enter_new_templatefile_name")}'; </SCRIPT>
+{literal}
+<SCRIPT type="text/javascript">
+function copyTemplateFileTo( objId , templateId, subFolderId) {
+    copyToName = prompt(copyToMessage, 'new_' + objId);
+    url = document.getElementById(objId);
+    if (copyToName != '' && copyToName != null) {
+        originUrl = url.getAttribute('href');
+        newUrl = encodeURI(originUrl + '&newFileId=' + copyToName);
+        url.setAttribute('href', newUrl);
+    } else {
+        url.setAttribute('href', '?op=blogTemplatesList&templateId=' + templateId + '&subFolderId=' + subFolderId);
+    }
+}
+
+function openImagePreviewWindow( destUrl )
+{
+	PreviewWindow = window.open( destUrl, 'ImagePreview','scrollbars=yes,resizable=yes,toolbar=no,height=480,width=640');
+}
+</SCRIPT>
+{/literal}
+<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="blogTemplatesList">
+     <input type="submit" name="Show" value="{$locale->tr("show")}">
+    </div>
+   </fieldset> 
+  </form> 
+ </div>
+ <br style="clear:both">
+</div>
+
+<form id="blogTemplatesList" 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('blogTemplatesList');" /></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>
+
+  <tr class="{cycle values="odd,even"}">
+   <td>
+    <div align="center"><span style="background-color: #CCCCCC">&nbsp;&nbsp;&nbsp;</span></div>
+   </td>
+   <td  class="col_highlighted">
+    <a href="?op=blogTemplatesList&amp;templateId={$currentTemplate}">
+     <img src="imgs/admin/icon_folderopen-16.png" />
+     ..
+    </a>
+   </td>
+   <td>
+   </td>    
+   <td>
+   </td>
+  </tr>  
+  
+  {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">
+     {if $file.isEditable}
+      <a href="?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}">
+       <img src="imgs/admin/icon_template-16.png" />
+       {$file.name}
+      </a>
+     {elseif $file.isImage}
+      <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+       <img src="imgs/admin/icon_photo-16.png" />
+	   {$file.name}
+	  </a>
+	 {else}
+	  <img src="imgs/admin/icon_other-16.png" />
+	  {$file.name}
+     {/if}      
+    </td>
+    <td>
+     {$file.size}
+    </td>    
+    <td>
+     <div class="list_action_button">
+      {if $file.isEditable}
+       <a href="?op=blogEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}">
+        <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}     
+      <a href="?op=blogDeleteTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}">
+       <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+      </a>
+      {if $file.isEditable}
+       <a href="?op=blogCopyTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}" id="{$file.name}" onClick="copyTemplateFileTo(this.id, '{$currentTemplate}')" >
+        <img src="imgs/admin/icon_copy-16.png" alt="{$locale->tr("copy")}" />
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}      
+      {if $file.isImage}
+	   <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+		<img src="imgs/admin/icon_image-16.png" alt="Preview" />
+	   </a>      
+      {/if}         
+     </div>
+    </td>
+   </tr>
+  {/foreach}
+  </tbody>
+ </table>
+ </div>
+ <div id="list_action_bar">
+   <input type="hidden" name="templateId" value="{$currentTemplate}" />
+   <input type="hidden" name="subFolderId" value="{$currentSubFolder}" />
+   <input type="hidden" name="op" value="blogDeleteTemplateFiles" 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/siteeditsubfoldertemplatefile.template
===================================================================
--- plugins/trunk/templateeditor/templates/siteeditsubfoldertemplatefile.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/siteeditsubfoldertemplatefile.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,53 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=SiteTemplateEditor title=$locale->tr("SiteTemplateEditor")}
+<link rel="stylesheet" href="plugins/templateeditor/js/editor/smartyeditor.css" type="text/css" />
+{literal}
+<script type="text/javascript" src="plugins/templateeditor/js/editor/smartyeditor.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="siteEditSubFolderTemplateFile" 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="backupFile">{$locale->tr("label_backupfile")}</label>
+   <span class="required"></span>
+   <div class="formHelp">{$locale->tr("templateeditor_backupfile")}</div>
+   <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&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$currentFile}">{$locale->tr("templateeditor_currentfile")}</option>
+    {foreach from=$backupFiles item=backupFile}
+     <option value="admin.php?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$currentFile}&amp;backupId={$backupFile.backupId}">{$backupFile.time}</option>
+    {/foreach}
+   </select>
+  </div>
+
+  <div class="field">
+   <label for="fileContent"><a href="?op=siteTemplatesList&amp;templateId={$currentTemplate}">{$currentTemplate}</a> &raquo; <a href="?op=siteTemplatesList&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}">{$currentSubFolder}</a> &raquo; {$currentFile} {if !empty($backupId)}&raquo; {$locale->tr("templateeditor_recover_from")}: {$backupId|date_format:"%Y/%m/%d - %H:%M:%S"}{/if}</label>
+   <span class="required">*</span>
+   <div class="formHelp">{$locale->tr("templateeditor_filecontent")}</div>
+   <script type="text/javascript">var ed1 = new SmartyEditor('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="templateId" value="{$currentTemplate}" />
+  <input type="hidden" name="subFolderId" value="{$currentSubFolder}" />
+  <input type="hidden" name="fileId" value="{$currentFile}" />
+  <input type="hidden" name="op" value="siteUpdateTemplateFile" />
+  <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

Modified: plugins/trunk/templateeditor/templates/sitetemplatesetslist.template
===================================================================
--- plugins/trunk/templateeditor/templates/sitetemplatesetslist.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/sitetemplatesetslist.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -35,7 +35,10 @@
        <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>
+     <a href="?op=siteTemplatesList&amp;templateId={$sitetemplate->getName()}">
+      <img src="imgs/admin/icon_folder-16.png" />
+      {$sitetemplate->getName()}
+     </a>
     </td>
     <td>
      <div class="list_action_button">

Modified: plugins/trunk/templateeditor/templates/sitetemplateslist.template
===================================================================
--- plugins/trunk/templateeditor/templates/sitetemplateslist.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/sitetemplateslist.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -14,6 +14,11 @@
         url.setAttribute('href', '?op=siteTemplatesList&templateId=' + templateId);
     }
 }
+
+function openImagePreviewWindow( destUrl )
+{
+	PreviewWindow = window.open( destUrl, 'ImagePreview','scrollbars=yes,resizable=yes,toolbar=no,height=480,width=640');
+}
 </SCRIPT>
 {/literal}
 <div id="list_nav_bar">
@@ -55,28 +60,73 @@
     </tr>
   </thead>
   <tbody>
+
+  {foreach from=$templateSubFolders item=folder}
+   <tr class="{cycle values="odd,even"}">
+    <td>
+     <div align="center"><span style="background-color: #CCCCCC">&nbsp;&nbsp;&nbsp;</span></div>
+    </td>
+    <td  class="col_highlighted">
+     <a href="?op=siteTemplatesList&amp;templateId={$currentTemplate}&amp;subFolderId={$folder.name}">
+      <img src="imgs/admin/icon_folder-16.png" />
+      {$folder.name}
+     </a>
+    </td>
+    <td>
+    </td>    
+    <td>
+    </td>
+   </tr>
+  {/foreach}
+  
   {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>
+     {if $file.isEditable}
+      <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
+       <img src="imgs/admin/icon_template-16.png" />
+       {$file.name}
+      </a>
+     {elseif $file.isImage}
+      <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+       <img src="imgs/admin/icon_photo-16.png" />
+	   {$file.name}
+	  </a>
+	 {else}
+	  <img src="imgs/admin/icon_other-16.png" />
+	  {$file.name}
+     {/if}
     </td>
     <td>
      {$file.size}
     </td>    
     <td>
      <div class="list_action_button">
-      <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
+      {if $file.isEditable}
+       <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
         <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
-      </a>
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}
       <a href="?op=siteDeleteTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}">
-        <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+       <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
       </a>
-      <a href="?op=siteCopyTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}" id="{$file.name}" onClick="copyTemplateFileTo(this.id, '{$currentTemplate}')" >
+      {if $file.isEditable}
+       <a href="?op=siteCopyTemplateFile&amp;templateId={$currentTemplate}&amp;fileId={$file.name}" id="{$file.name}" onClick="copyTemplateFileTo(this.id, '{$currentTemplate}')" >
         <img src="imgs/admin/icon_copy-16.png" alt="{$locale->tr("copy")}" />
-      </a>      
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}
+      {if $file.isImage}
+	   <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+		<img src="imgs/admin/icon_image-16.png" alt="Preview" />
+	   </a>      
+      {/if}         
      </div>
     </td>
    </tr>

Added: plugins/trunk/templateeditor/templates/sitetemplatesubfolderlist.template
===================================================================
--- plugins/trunk/templateeditor/templates/sitetemplatesubfolderlist.template	2005-03-17 23:46:27 UTC (rev 1542)
+++ plugins/trunk/templateeditor/templates/sitetemplatesubfolderlist.template	2005-03-18 05:05:16 UTC (rev 1543)
@@ -0,0 +1,144 @@
+{include file="$admintemplatepath/header.template"}
+{include file="$admintemplatepath/navigation.template" showOpt=SiteTemplateEditor title=$locale->tr("SiteTemplateEditor")}
+<SCRIPT type="text/javascript"> var copyToMessage = '{$locale->tr("templateeditor_enter_new_templatefile_name")}'; </SCRIPT>
+{literal}
+<SCRIPT type="text/javascript">
+function copyTemplateFileTo( objId , templateId, subFolderId) {
+    copyToName = prompt(copyToMessage, 'new_' + objId);
+    url = document.getElementById(objId);
+    if (copyToName != '' && copyToName != null) {
+        originUrl = url.getAttribute('href');
+        newUrl = encodeURI(originUrl + '&newFileId=' + copyToName);
+        url.setAttribute('href', newUrl);
+    } else {
+        url.setAttribute('href', '?op=siteTemplatesList&templateId=' + templateId + '&subFolderId=' + subFolderId);
+    }
+}
+
+function openImagePreviewWindow( destUrl )
+{
+	PreviewWindow = window.open( destUrl, 'ImagePreview','scrollbars=yes,resizable=yes,toolbar=no,height=480,width=640');
+}
+</SCRIPT>
+{/literal}
+<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('siteTemplatesList');" /></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>
+
+  <tr class="{cycle values="odd,even"}">
+   <td>
+    <div align="center"><span style="background-color: #CCCCCC">&nbsp;&nbsp;&nbsp;</span></div>
+   </td>
+   <td  class="col_highlighted">
+    <a href="?op=siteTemplatesList&amp;templateId={$currentTemplate}">
+     <img src="imgs/admin/icon_folderopen-16.png" />
+     ..
+    </a>
+   </td>
+   <td>
+   </td>    
+   <td>
+   </td>
+  </tr>
+ 
+  {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">
+     {if $file.isEditable}
+      <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}">
+       <img src="imgs/admin/icon_template-16.png" />
+       {$file.name}
+      </a>
+     {elseif $file.isImage}
+      <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+       <img src="imgs/admin/icon_photo-16.png" />
+	   {$file.name}
+	  </a>
+	 {else}
+	  <img src="imgs/admin/icon_other-16.png" />
+	  {$file.name}
+     {/if}
+    </td>
+    <td>
+     {$file.size}
+    </td>    
+    <td>
+     <div class="list_action_button">
+      {if $file.isEditable}
+       <a href="?op=siteEditTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}">
+        <img src="imgs/admin/icon_edit-16.png" alt="{$locale->tr("edit")}" />
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}
+      <a href="?op=siteDeleteTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}">
+       <img src="imgs/admin/icon_delete-16.png" alt="{$locale->tr("delete")}" />
+      </a>
+      {if $file.isEditable}
+       <a href="?op=siteCopyTemplateFile&amp;templateId={$currentTemplate}&amp;subFolderId={$currentSubFolder}&amp;fileId={$file.name}" id="{$file.name}" onClick="copyTemplateFileTo(this.id, '{$currentTemplate}', '{$currentSubFolder}')" >
+        <img src="imgs/admin/icon_copy-16.png" alt="{$locale->tr("copy")}" />
+       </a>
+      {else}
+       <img src="imgs/admin/icon_empty-16.png" />
+      {/if}
+      {if $file.isImage}
+	   <a href="javascript:openImagePreviewWindow('{$url->getUrl($file.url)}');">
+		<img src="imgs/admin/icon_image-16.png" alt="Preview" />
+	   </a>      
+      {/if}         
+     </div>
+    </td>
+   </tr>
+  {/foreach}
+  </tbody>
+ </table>
+ </div>
+ <div id="list_action_bar">
+   <input type="hidden" name="templateId" value="{$currentTemplate}" />
+   <input type="hidden" name="subFolderId" value="{$currentSubFolder}" />
+   <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