[pLog-svn] r1290 - in plugins/trunk/templateeditor: .
class/actionclass/file class/view locale templates
Mark Wu
markplace at gmail.com
Wed Mar 2 19:27:13 GMT 2005
Ah ... Forgot commit one comment. I already add a new option
"AllowedExtension". Now, Site owner can decide what can of template file
exntesion can used in his site. Default is =
"*.css,*.inc,*.template,*.txt".
Mark
-----Original Message-----
From: plog-svn-bounces at devel.plogworld.net
[mailto:plog-svn-bounces at devel.plogworld.net] On Behalf Of
mark at devel.plogworld.net
Sent: Thursday, March 03, 2005 3:19 AM
To: plog-svn at devel.plogworld.net
Subject: [pLog-svn] r1290 - in plugins/trunk/templateeditor: .
class/actionclass/file class/view locale templates
Author: mark
Date: 2005-03-02 19:18:34 +0000 (Wed, 02 Mar 2005) New Revision: 1290
Added:
=20
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileactio=
n.c
lass.php
=20
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatesetaction=
.cl
ass.php
=20
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileactio=
n.c
lass.php
=20
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatesetaction=
.cl
ass.php
Modified:
=20
plugins/trunk/templateeditor/class/action/plugintemplateeditorupdateconfi=
gac
tion.class.php
plugins/trunk/templateeditor/class/file/myfile.class.php
=20
plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class=
.ph
p
=20
plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class=
.ph
p
=20
plugins/trunk/templateeditor/class/view/plugintemplateeditorconfigview.cl=
ass
.php
plugins/trunk/templateeditor/locale/locale_en_UK.php
plugins/trunk/templateeditor/locale/locale_zh_TW.php
plugins/trunk/templateeditor/plugintemplateeditor.class.php
plugins/trunk/templateeditor/templates/blogtemplatesetslist.template
plugins/trunk/templateeditor/templates/blogtemplateslist.template
plugins/trunk/templateeditor/templates/pluginsettings.template
plugins/trunk/templateeditor/templates/sitetemplatesetslist.template
plugins/trunk/templateeditor/templates/sitetemplateslist.template
Log:
Add "Copy To" function to TemplateSetList and TemplateFileList. So, now
template editor can allow user to create a new file or template set =
through
"copy to" function. Not perfect, but workable.
Added:
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileactio=
n.c
lass.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileactio=
n.c
lass.php 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatefileactio=
n.c
lass.php 2005-03-02 19:18:34 UTC (rev 1290)
@@ -0,0 +1,126 @@
+<?php
+ include_once( =
PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.
class.php" );
+ include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php=
"
); =09
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplateslis=
tvi
ew.class.php" );
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php" );=09
+
+ /**
+ * Removes global templates from disk.
+ */
+ class PluginBlogCopyTemplateFileAction extends BlogOwnerAdminAction
+ {
+
+ var $_templateId;
+ var $_fileId;
+ var $_newFileId;
+
+ function PluginBlogCopyTemplateFileAction( $actionInfo, =
$request )
+ {
+ $this->BlogOwnerAdminAction( $actionInfo, $request );
+ }
+
+ function validate()
+ {
+ $this->_templateId =3D $this->_request->getValue( =
"templateId" );
+ $this->_fileId =3D $this->_request->getValue( "fileId" );
+ $this->_newFileId =3D $this->_request->getValue( =
"newFileId" );
+ if( !$this->isValidTamplateFileName( $this->_newFileId ) ) =
{
+ $this->_view =3D new PluginBlogTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_templatefile_name"));
+ $this->setCommonData();
+
+ return false;
+ }
+ if( !$this->isValidExtension( $this->_newFileId ) ) {
+ $this->_view =3D new PluginBlogTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_templatefile_extension"));
+ $this->setCommonData();
+
+ return false;
+ } =20
+ return true;
+ } =20
+
+ function perform()
+ {
+ $ts =3D new TemplateSetStorage();
+ $blogId =3D $this->_blogInfo->getId();
+ $templateFolder =3D=20
+ $ts->getTemplateFolder($this->_templateId, $blogId);
+
+ // Get template files according extension
+ $templateFiles =3D $this->getTemplateFiles( $templateFolder =
);
+ =20
+ foreach ($templateFiles as $file) {
+ if ( $file['name'] =3D=3D $this->_newFileId ) {
+ $this->_view =3D new PluginBlogTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_duplicate_templatefile_name"));
+ $this->setCommonData();
+ return false;
+ }
+ }
+
+ $sourceFile =3D $templateFolder . $this->_fileId;
+ $newFile =3D $templateFolder . $this->_newFileId;
+ =20
+ if ( !File::copy($sourceFile, $newFile) ) {
+ $this->_view =3D new PluginBlogTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_copying_templatefile"));
+ $this->setCommonData();
+ return false; =20
+ }
+
+ // if everything went ok...
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );
+ $this->saveSession();
+ =20
+ $this->_view =3D new PluginBlogTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setSuccessMessage(
$this->_locale->tr("templateeditor_templatefile_copyed_ok"));
+ $this->setCommonData();
+ =09
+ // clear the cache
+ CacheControl::resetBlogCache(
$this->_blogInfo->getId()); =09
+ =20
+ return true;
+ }
+
+ function isValidTamplateFileName( $name )
+ {
+ $pattern =3D '/^[a-zA-Z0-9\._-]*$/';
+ if (preg_match($pattern, $name) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ =20
+ function isValidExtension( $name )
+ {
+ $config =3D& Config::getConfig();
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" );
+ $extensionList =3D explode(",", $allowedExtension);
+ $fileExtension =3D "*." . array_pop(explode('.', $name));
+ foreach ($extensionList as $extension) {
+ if ( $fileExtension =3D=3D trim($extension) ) {
+ return true; =20
+ }
+ }
+ return false;
+ }
+
+ function getTemplateFiles( $folder ) {
+ $config =3D& Config::getConfig();
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" ); =20
+ $extensionList =3D explode(",", $allowedExtension);
+ $templateFiles =3D Array();
+ for ($i =3D 0; $i < count($extensionList); $i++) {
+ $files =3D Glob::myGlob( $folder, =
trim($extensionList[$i]) );
+ foreach ($files as $file) {
+ $tmp['name'] =3D basename($file);
+ $tmp['size'] =3D filesize($file);
+ array_push ($templateFiles, $tmp);
+ }
+ }
+ return $templateFiles;
+ } =20
+ }
+?>
Added:
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatesetaction=
.cl
ass.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatesetaction=
.cl
ass.php 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/action/pluginblogcopytemplatesetaction=
.cl
ass.php 2005-03-02 19:18:34 UTC (rev 1290)
@@ -0,0 +1,90 @@
+<?php
+ include_once( =
PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.
class.php" );
+ include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
+ include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php=
"
); =09
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesets=
lis
tview.class.php" );
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php" );=09
+
+ /**
+ * Removes global templates from disk.
+ */
+ class PluginBlogCopyTemplateSetAction extends BlogOwnerAdminAction
+ {
+
+ var $_templateId;
+ var $_newTemplateId;
+
+ function PluginBlogCopyTemplateSetAction( $actionInfo, $request =
)
+ {
+ $this->BlogOwnerAdminAction( $actionInfo, $request );
+ }
+
+ function validate()
+ {
+ $this->_templateId =3D $this->_request->getValue( =
"templateId" );
+ $this->_newTemplateId =3D $this->_request->getValue(
"newTemplateId" );
+ if( !$this->isValidTamplateSetName( $this->_newTemplateId ) =
) {
+ $this->_view =3D new PluginBlogTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_templateset_name"));
+ $this->setCommonData();
+
+ return false;
+ } =20
+ return true;
+ } =20
+
+ function perform()
+ {
+ // get a list with all the global template sets
+ $ts =3D new TemplateSets();
+ $blogTemplateSets =3D $ts->getBlogTemplateSets(=20
+$this->_blogInfo->getId(), false );
+ =20
+ foreach ($blogTemplateSets as $template) {
+ if ( $template->getName() =3D=3D $this->_newTemplateId =
) {
+ $this->_view =3D new PluginBlogTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_duplicate_templateset_name"));
+ $this->setCommonData();
+ return false;
+ }
+ }
+
+ $ts =3D new TemplateSetStorage();
+ $blogId =3D $this->_blogInfo->getId();
+ $sourceTemplateFolder =3D
$ts->getTemplateFolder($this->_templateId, $blogId);
+ $newTemplateFolder =3D=20
+ $ts->getBlogBaseTemplateFolder($blogId) . $this->_newTemplateId;
+ =20
+ if ( MyFile::copyDir($sourceTemplateFolder, =
$newTemplateFolder)
) {
+ $ts->addTemplate($this->_newTemplateId, $blogId);
+ } else {
+ File::deleteDir($newTemplateFolder);
+ $this->_view =3D new PluginBlogTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_copying_templateset"));
+ $this->setCommonData();
+ return false; =20
+ }
+
+ // if everything went ok...
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );
+ $this->saveSession();
+ =20
+ $this->_view =3D new PluginBlogTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setSuccessMessage(
$this->_locale->tr("templateeditor_templateset_copyed_ok"));
+ $this->setCommonData();
+ =09
+ // clear the cache
+ CacheControl::resetBlogCache(
$this->_blogInfo->getId()); =09
+ =20
+ return true;
+ }
+
+ function isValidTamplateSetName( $name )
+ {
+ $pattern =3D '/^[a-zA-Z0-9_-]*$/';
+ if (preg_match($pattern, $name) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+?>
Added:
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileactio=
n.c
lass.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileactio=
n.c
lass.php 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatefileactio=
n.c
lass.php 2005-03-02 19:18:34 UTC (rev 1290)
@@ -0,0 +1,126 @@
+<?php
+ include_once(
PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+ include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php=
"
); =09
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplateslis=
tvi
ew.class.php" );
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php" );=09
+
+ /**
+ * Removes global templates from disk.
+ */
+ class PluginSiteCopyTemplateFileAction extends SiteAdminAction
+ {
+
+ var $_templateId;
+ var $_fileId;
+ var $_newFileId;
+
+ function PluginSiteCopyTemplateFileAction( $actionInfo, =
$request )
+ {
+ $this->SiteAdminAction( $actionInfo, $request );
+ }
+
+ function validate()
+ {
+ $this->_templateId =3D $this->_request->getValue( =
"templateId" );
+ $this->_fileId =3D $this->_request->getValue( "fileId" );
+ $this->_newFileId =3D $this->_request->getValue( =
"newFileId" );
+ if( !$this->isValidTamplateFileName( $this->_newFileId ) ) =
{
+ $this->_view =3D new PluginSiteTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_templatefile_name"));
+ $this->setCommonData();
+
+ return false;
+ }
+ if( !$this->isValidExtension( $this->_newFileId ) ) {
+ $this->_view =3D new PluginSiteTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_templatefile_extension"));
+ $this->setCommonData();
+
+ return false;
+ } =20
+ return true;
+ } =20
+
+ function perform()
+ {
+ $ts =3D new TemplateSetStorage();
+ $blogId =3D $this->_blogInfo->getId();
+ $templateFolder =3D=20
+ $ts->getTemplateFolder($this->_templateId);
+
+ // Get template files according extension
+ $templateFiles =3D $this->getTemplateFiles( $templateFolder =
);
+ =20
+ foreach ($templateFiles as $file) {
+ if ( $file['name'] =3D=3D $this->_newFileId ) {
+ $this->_view =3D new PluginSiteTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_duplicate_templatefile_name"));
+ $this->setCommonData();
+ return false;
+ }
+ }
+
+ $sourceFile =3D $templateFolder . $this->_fileId;
+ $newFile =3D $templateFolder . $this->_newFileId;
+ =20
+ if ( !File::copy($sourceFile, $newFile) ) {
+ $this->_view =3D new PluginSiteTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_copying_templatefile"));
+ $this->setCommonData();
+ return false; =20
+ }
+
+ // if everything went ok...
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );
+ $this->saveSession();
+ =20
+ $this->_view =3D new PluginSiteTemplatesListView(
$this->_blogInfo , $this->_templateId);
+ $this->_view->setSuccessMessage(
$this->_locale->tr("templateeditor_templatefile_copyed_ok"));
+ $this->setCommonData();
+ =09
+ // clear the cache
+ CacheControl::resetBlogCache(
$this->_blogInfo->getId()); =09
+ =20
+ return true;
+ }
+
+ function isValidTamplateFileName( $name )
+ {
+ $pattern =3D '/^[a-zA-Z0-9\._-]*$/';
+ if (preg_match($pattern, $name) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ =20
+ function isValidExtension( $name )
+ {
+ $config =3D& Config::getConfig();
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" );
+ $extensionList =3D explode(",", $allowedExtension);
+ $fileExtension =3D "*." . array_pop(explode('.', $name));
+ foreach ($extensionList as $extension) {
+ if ( $fileExtension =3D=3D trim($extension) ) {
+ return true; =20
+ }
+ }
+ return false;
+ }
+
+ function getTemplateFiles( $folder ) {
+ $config =3D& Config::getConfig();
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" ); =20
+ $extensionList =3D explode(",", $allowedExtension);
+ $templateFiles =3D Array();
+ for ($i =3D 0; $i < count($extensionList); $i++) {
+ $files =3D Glob::myGlob( $folder, =
trim($extensionList[$i]) );
+ foreach ($files as $file) {
+ $tmp['name'] =3D basename($file);
+ $tmp['size'] =3D filesize($file);
+ array_push ($templateFiles, $tmp);
+ }
+ }
+ return $templateFiles;
+ } =20
+ }
+?>
Added:
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatesetaction=
.cl
ass.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatesetaction=
.cl
ass.php 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/action/pluginsitecopytemplatesetaction=
.cl
ass.php 2005-03-02 19:18:34 UTC (rev 1290)
@@ -0,0 +1,90 @@
+<?php
+ include_once(
PLOG_CLASS_PATH."class/action/admin/siteadminaction.class.php" );
+ include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
+ include_once(
PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php=
"
); =09
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginsitetemplatesets=
lis
tview.class.php" );
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/file/myfile.class.php" );=09
+
+ /**
+ * Removes global templates from disk.
+ */
+ class PluginSiteCopyTemplateSetAction extends SiteAdminAction
+ {
+
+ var $_templateId;
+ var $_newTemplateId;
+
+ function PluginSiteCopyTemplateSetAction( $actionInfo, $request =
)
+ {
+ $this->SiteAdminAction( $actionInfo, $request );
+ }
+
+ function validate()
+ {
+ $this->_templateId =3D $this->_request->getValue( =
"templateId" );
+ $this->_newTemplateId =3D $this->_request->getValue(
"newTemplateId" );
+ if( !$this->isValidTamplateSetName( $this->_newTemplateId ) =
) {
+ $this->_view =3D new PluginSiteTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_templateset_name"));
+ $this->setCommonData();
+
+ return false;
+ } =20
+ return true;
+ } =20
+
+ function perform()
+ {
+ // get a list with all the global template sets
+ $ts =3D new TemplateSets();
+ $globalTemplates =3D $ts->getGlobalTemplateSets();
+ =20
+ foreach ($globalTemplates as $template) {
+ if ( $template->getName() =3D=3D $this->_newTemplateId =
) {
+ $this->_view =3D new PluginSiteTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_duplicate_templateset_name"));
+ $this->setCommonData();
+ return false;
+ }
+ }
+
+ $ts =3D new TemplateSetStorage();
+ $blogId =3D $this->_blogInfo->getId();
+ $sourceTemplateFolder =3D
$ts->getTemplateFolder($this->_templateId);
+ $newTemplateFolder =3D $ts->getBaseTemplateFolder() . "/" . =
+ $this->_newTemplateId;
+ =20
+ if ( MyFile::copyDir($sourceTemplateFolder, =
$newTemplateFolder)
) {
+ $ts->addTemplate($this->_newTemplateId);
+ } else {
+ File::deleteDir($newTemplateFolder);
+ $this->_view =3D new PluginSiteTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("error_copying_templateset"));
+ $this->setCommonData();
+ return false; =20
+ }
+
+ // if everything went ok...
+ $this->_session->setValue( "blogInfo", $this->_blogInfo );
+ $this->saveSession();
+ =20
+ $this->_view =3D new PluginSiteTemplateSetsListView(
$this->_blogInfo );
+ $this->_view->setSuccessMessage(
$this->_locale->tr("templateeditor_templateset_copyed_ok"));
+ $this->setCommonData();
+ =09
+ // clear the cache
+ CacheControl::resetBlogCache(
$this->_blogInfo->getId()); =09
+ =20
+ return true;
+ }
+
+ function isValidTamplateSetName( $name )
+ {
+ $pattern =3D '/^[a-zA-Z0-9_-]*$/';
+ if (preg_match($pattern, $name) ) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+?>
Modified:
plugins/trunk/templateeditor/class/action/plugintemplateeditorupdateconfi=
gac
tion.class.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/action/plugintemplateeditorupdateconfi=
gac
tion.class.php 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/action/plugintemplateeditorupdateconfi=
gac
tion.class.php 2005-03-02 19:18:34 UTC (rev 1290)
@@ -1,7 +1,8 @@
<?php
=20
include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.
php" );
- include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/view/plugintemplateeditorco=
nfi
gview.class.php" );=09
+ include_once(
PLOG_CLASS_PATH."plugins/templateeditor/class/view/plugintemplateeditorco=
nfi
gview.class.php" );
+ include_once( PLOG_CLASS_PATH."class/data/validator/stringvalidator.
class.php" );=09
=09
/**
* updates the plugin configuration
@@ -10,6 +11,7 @@
{
var $_pluginEnabled;
var $_maxBackupFiles;
+ var $_allowedExtension;
=09
function PluginTemplateEditorUpdateConfigAction(
$actionInfo, $request )
{
@@ -27,7 +29,16 @@
$this->setCommonData();
=20
return false;
- } =20
+ }
+ $this->_allowedExtension =3D $this->_request->getValue(
"allowedExtension" );
+ $val =3D new StringValidator();
+ if ( !$val->validate($this->_allowedExtension) ) {
+ $this->_view =3D new PluginTemplateEditorConfigView(
$this->_blogInfo );
+ $this->_view->setErrorMessage(
$this->_locale->tr("templateeditor_error_allowedextension"));
+ $this->setCommonData();
+
+ return false;
+ } =20
=09
return true;
}
@@ -38,6 +49,7 @@
$config =3D& Config::getConfig();
$config->setValue( "plugin_templateeditor_enabled",
$this->_pluginEnabled );
$config->setValue( "plugin_templateeditor_maxbackupfiles",
$this->_maxBackupFiles );
+ $config->setValue(=20
+ "plugin_templateeditor_allowedextension", $this->_allowedExtension );
=09
if( !$config->save() ) {
$this->_view =3D new PluginTemplateEditorConfigView(
$this->_blogInfo );
Modified: plugins/trunk/templateeditor/class/file/myfile.class.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- plugins/trunk/templateeditor/class/file/myfile.class.php 2005-03-02
18:34:47 UTC (rev 1289)
+++ plugins/trunk/templateeditor/class/file/myfile.class.php 2005-03-02
19:18:34 UTC (rev 1290)
@@ -26,5 +26,48 @@
=20
return $bytes;
}
+ =20
+ /**
+ * Recursively copy a folder and its contents
+ * http://aidan.dotgeek.org/lib/?file=3Dfunction.copyr.php
+ *
+ * @author Aidan Lister <aidan at php.net>
+ * @version 1.0.1
+ * @param string $source Source path
+ * @param string $dest Destination path
+ * @return bool Returns TRUE on success, FALSE on =
failure
+ */
+ function copyDir($source, $dest)
+ {
+ clearstatcache();
+ =20
+ // Simple copy for a file
+ if (is_file($source)) {
+ return File::copy($source, $dest);
+ }
+ =20
+ // Make destination directory
+ if (!File::isDir($dest)) {
+ File::createDir($dest);
+ }
+ =20
+ // Loop through the folder
+ $dir =3D dir($source);
+ while (false !=3D=3D $entry =3D $dir->read()) {
+ // Skip pointers
+ if ($entry =3D=3D '.' || $entry =3D=3D '..') {
+ continue;
+ }
+ =20
+ // Deep copy directories
+ if ($dest !=3D=3D "$source/$entry") {
+ MyFile::copyDir("$source/$entry", "$dest/$entry");
+ }
+ }
+ =20
+ // Clean up
+ $dir->close();
+ return true;
+ }
}
?>
Modified:
plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class=
.ph
p
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class=
.ph
p 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/view/pluginblogtemplateslistview.class=
.ph
p 2005-03-02 19:18:34 UTC (rev 1290)
@@ -30,28 +30,30 @@
$blogId =3D $this->_blogInfo->getId();
$templateFolder =3D =
$ts->getTemplateFolder($this->_templateId,
$blogId);
=20
- $cssFiles =3D Glob::myGlob( $templateFolder, "*.css" );
- $tplFiles =3D Glob::myGlob( $templateFolder, "*.template" =
);
- =20
- $templateFiles =3D Array();
+ // Get template files according extension
+ $templateFiles =3D $this->getTemplateFiles( $templateFolder =
+);
=20
- foreach ($cssFiles as $cssFile) {
- $file['name'] =3D basename($cssFile);
- $file['size'] =3D filesize($cssFile);
- array_push ($templateFiles, $file);
- }
- =20
- foreach ($tplFiles as $tplFile) {
- $file['name'] =3D basename($tplFile);
- $file['size'] =3D filesize($tplFile);
- array_push ($templateFiles, $file);
- }
-
$this->setValue( "currentTemplate", $this->_templateId );
$this->setValue( "templateSets", $blogTemplateSets );
$this->setValue( "templateFiles", $templateFiles );
=09
parent::render();
}
+
+ function getTemplateFiles( $folder ) {
+ $config =3D& Config::getConfig();
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" ); =20
+ $extensionList =3D explode(",", $allowedExtension);
+ $templateFiles =3D Array();
+ for ($i =3D 0; $i < count($extensionList); $i++) {
+ $files =3D Glob::myGlob( $folder, =
trim($extensionList[$i]) );
+ foreach ($files as $file) {
+ $tmp['name'] =3D basename($file);
+ $tmp['size'] =3D filesize($file);
+ array_push ($templateFiles, $tmp);
+ }
+ }
+ return $templateFiles;
+ } =09
}
?>
\ No newline at end of file
Modified:
plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class=
.ph
p
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class=
.ph
p 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/view/pluginsitetemplateslistview.class=
.ph
p 2005-03-02 19:18:34 UTC (rev 1290)
@@ -30,28 +30,30 @@
$blogId =3D $this->_blogInfo->getId();
$templateFolder =3D =
$ts->getTemplateFolder($this->_templateId);
=20
- $cssFiles =3D Glob::myGlob( $templateFolder, "*.css" );
- $tplFiles =3D Glob::myGlob( $templateFolder, "*.template" =
);
- =20
- $templateFiles =3D Array();
+ // Get template files according extension
+ $templateFiles =3D $this->getTemplateFiles( $templateFolder =
+);
=20
- foreach ($cssFiles as $cssFile) {
- $file['name'] =3D basename($cssFile);
- $file['size'] =3D filesize($cssFile);
- array_push ($templateFiles, $file);
- }
- =20
- foreach ($tplFiles as $tplFile) {
- $file['name'] =3D basename($tplFile);
- $file['size'] =3D filesize($tplFile);
- array_push ($templateFiles, $file);
- }
-
$this->setValue( "currentTemplate", $this->_templateId );
$this->setValue( "templateSets", $globalTemplates );
$this->setValue( "templateFiles", $templateFiles );
=09
parent::render();
}
+ =09
+ function getTemplateFiles( $folder ) {
+ $config =3D& Config::getConfig();
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" ); =20
+ $extensionList =3D explode(",", $allowedExtension);
+ $templateFiles =3D Array();
+ for ($i =3D 0; $i < count($extensionList); $i++) {
+ $files =3D Glob::myGlob( $folder, =
trim($extensionList[$i]) );
+ foreach ($files as $file) {
+ $tmp['name'] =3D basename($file);
+ $tmp['size'] =3D filesize($file);
+ array_push ($templateFiles, $tmp);
+ }
+ }
+ return $templateFiles;
+ } =20
}
?>
\ No newline at end of file
Modified:
plugins/trunk/templateeditor/class/view/plugintemplateeditorconfigview.cl=
ass
.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/class/view/plugintemplateeditorconfigview.cl=
ass
.php 2005-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/class/view/plugintemplateeditorconfigview.cl=
ass
.php 2005-03-02 19:18:34 UTC (rev 1290)
@@ -20,10 +20,13 @@
$pluginEnabled =3D $config->getValue(
"plugin_templateeditor_enabled" );
$maxBackupFiles =3D $config->getValue(
"plugin_templateeditor_maxbackupfiles" );
if ($maxBackupFiles =3D=3D "") $maxBackupFiles =3D 5;
+ $allowedExtension =3D $config->getValue(
"plugin_templateeditor_allowedextension" );
+ if ($allowedExtension =3D=3D "") $allowedExtension =3D=20
+"*.css,*.inc,*.template,*.txt";
=09
// create a view and export the settings to the
template
$this->setValue( "pluginEnabled", $pluginEnabled );
$this->setValue( "maxBackupFiles", $maxBackupFiles
); =09
+ $this->setValue( "allowedExtension",
$allowedExtension );
=09
parent::render();
}
Modified: plugins/trunk/templateeditor/locale/locale_en_UK.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- plugins/trunk/templateeditor/locale/locale_en_UK.php 2005-03-02
18:34:47 UTC (rev 1289)
+++ plugins/trunk/templateeditor/locale/locale_en_UK.php 2005-03-02
19:18:34 UTC (rev 1290)
@@ -10,21 +10,38 @@
$messages["templateeditor_recover_from"] =3D "Recover From";
$messages["templateeditor_plugin_enabled"] =3D "Allow blog user to use
template editor"; $messages["templateeditor_maxbackupfiles"] =3D "Max =
backup
files of each template file";
+$messages["templateeditor_allowedextension"] =3D "Allowed extension for =
+template files"; $messages["templateeditor_enter_new_templateset_name"] =
+=3D "Please input your new template name:";=20
+$messages["templateeditor_enter_new_templatefile_name"] =3D "Please =
input=20
+your new template file name:";
=20
$messages["error_no_files_selected"] =3D "No files were selected to =
delete.";
$messages["error_removing_template_file"] =3D "There was an error =
deleting
template file %s."; $messages["error_updating_template_file"] =3D =
"There was
an error updating template file."; =
$messages["error_backup_template_file"]
=3D "There was an error backing up template file.";
$messages["templateeditor_error_maxbackupfiles"] =3D "Maximum Backup =
Files
Should > 0!";
+$messages["templateeditor_error_allowedextension"] =3D "Allowed =
extension=20
+can not be empty."; $messages["templateeditor_error_templatefile_name"] =
+=3D 'Wrong template file name. The file name is limited to a-z, A-Z, =
"_",=20
+"-" and ".", space in file name is not allowed.';=20
+$messages["templateeditor_error_templatefile_extension"] =3D "Wrong=20
+template extension."; $messages["error_duplicate_templatefile_name"] =
=3D=20
+"Duplicate template file name.";=20
+$messages["error_copying_templatefile"] =3D "There was an error copying =
+template file."; $messages["templateeditor_error_templateset_name"] =3D =
+'Wrong template set name. The set name is limited to a-z, A-Z, "_" and=20
+"-", space in set name is not allowed.';=20
+$messages["error_duplicate_templateset_name"] =3D "Duplicate template =
set=20
+name."; $messages["error_copying_templateset"] =3D "There was an error=20
+copying template set.";
=20
$messages["template_file_removed_ok"] =3D "Template file %s deleted
successfully."; $messages["template_files_removed_ok"] =3D "%s =
templates
files deleted successfully"; $messages["templateeditor_file_saved_ok"] =
=3D
"Template file saved successfully.";
$messages["templateeditor_settings_saved_ok"] =3D "Templete Editor =
settings
saved successfully!";
+$messages["templateeditor_templatefile_copyed_ok"] =3D "Template file=20
+copyed successfully.";=20
+$messages["templateeditor_templateset_copyed_ok"] =3D "Template set=20
+copyed successfully.";
=20
$messages["label_configuration"] =3D "Configuration";
$messages["label_enable"] =3D "Enable"; =
$messages["label_maxbackupfiles"] =3D
"Backup Files";
+$messages["label_allowedextension"] =3D "Allowed Extension";
$messages["label_edit"] =3D "Edit";
$messages["label_backupfile"] =3D "Backup Recover";
+
+$messages["edit"] =3D "Edit";
+$messages["copy"] =3D "Copy";
?>
\ No newline at end of file
Modified: plugins/trunk/templateeditor/locale/locale_zh_TW.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- plugins/trunk/templateeditor/locale/locale_zh_TW.php 2005-03-02
18:34:47 UTC (rev 1289)
+++ plugins/trunk/templateeditor/locale/locale_zh_TW.php 2005-03-02
19:18:34 UTC (rev 1290)
@@ -10,21 +10,38 @@
$messages["templateeditor_recover_from"] =3D "=A6^=B4_=A6=DB";
$messages["templateeditor_plugin_enabled"] =3D =
"=A4=B9=B3\=BA=F4=BBx=A8=CF=A5=CE=AA=CC=A8=CF=A5=CE=BC=D2=AA=A9=BDs=BF=E8=
=BE=B9
";
$messages["templateeditor_maxbackupfiles"] =3D =
"=B3=C6=A5=F7=C0=C9=AE=D7=AA=BA=C0x=A6s=AD=AD=A8=EE";
+$messages["templateeditor_allowedextension"] =3D =
"=A4=B9=B3\=BDs=BF=E8=AA=BA=BC=D2=AA=A9=C0=C9=AE=D7=AA=FE=A5[=C0=C9=A6W
";
+$messages["templateeditor_enter_new_templateset_name"] =3D =
"=BD=D0=BF=E9=A4J=B1z=B7s=AA=BA=BC=D2=AA=A9
=A6W=BA=D9=A1G";
+$messages["templateeditor_enter_new_templatefile_name"] =3D=20
+"=BD=D0=BF=E9=A4J=B1z=B7s=AA=BA=BC=D2=AA=A9=C0=C9=AE=D7=A6W=BA=D9=A1G";
=20
$messages["error_no_files_selected"] =3D =
"=B1z=A8S=A6=B3=BF=EF=BE=DC=A5=F4=A6=F3=BC=D2=AA=A9=C0=C9=AE=D7=A1C";
$messages["error_removing_template_file"] =3D =
"=A6b=A7R=B0=A3=BC=D2=AA=A9=C0=C9=AE=D7 %s =
=AE=C9=B5o=A5=CD=BF=F9=BB~=A1C
";
$messages["error_updating_template_file"] =3D =
"=A6b=A7=F3=B7s=BC=D2=AA=A9=C0=C9=AE=D7=AE=C9=B5o=A5=CD=BF=F9=BB~=A1C";
$messages["error_backup_template_file"] =3D =
"=A6b=B3=C6=A5=F7=BC=D2=AA=A9=C0=C9=AE=D7=AE=C9=B5o=A5=CD=BF=F9=BB~=A1C";=
$messages["templateeditor_error_maxbackupfiles"] =3D =
"=BC=D2=AA=A9=B3=C6=A5=F7=C0=C9=AE=D7=C0x=A6s=AD=AD=A8=EE=AD=D3
=BC=C6=A5=B2=B6=B7=ADn > 0!";
+$messages["templateeditor_error_allowedextension"] =3D=20
+"=A4=B9=B3\=BDs=BF=E8=AA=BA=BC=D2=AA=A9=C0=C9=AE=D7=AA=FE=A5[=C0=C9=A6W=A4=
=A3=A5i=AC=B0=AA=C5=A5=D5=A1C";
+$messages["templateeditor_error_templatefile_name"] =3D=20
+'=BC=D2=AA=A9=C0=C9=AE=D7=A6W=BA=D9=BF=F9=BB~=A1C=A5=B2=B6=B7=AC=B0=AD^=A4=
=E5=A6r=A1B=BC=C6=A6r=A1B"-"=A1B"_" =BBP =
"."=A1A=C0=C9=AE=D7=A6W=BA=D9=A4=A4=A4]=A4=A3=AF=E0=A6=B3
=AA=C5=A5=D5=A1C';
+$messages["templateeditor_error_templatefile_extension"] =3D=20
+"=BC=D2=AA=A9=C0=C9=AE=D7=AA=FE=A5[=C0=C9=A6W=BF=F9=BB~=A1C";
+$messages["error_duplicate_templatefile_name"] =3D =
"=AD=AB=BD=C6=AA=BA=BC=D2=AA=A9=C0=C9=AE=D7=A6W=BA=D9=A1C";
+$messages["error_copying_templatefile"] =3D =
"=A6b=BD=C6=BBs=BC=D2=AA=A9=C0=C9=AE=D7=AE=C9=B5o=A5=CD=BF=F9=BB~=A1C";
+$messages["templateeditor_error_templateset_name"] =3D=20
+'=BC=D2=AA=A9=A6W=BA=D9=BF=F9=BB~=A1C=A5=B2=B6=B7=AC=B0=AD^=A4=E5=A6r=A1=
B=BC=C6=A6r=A1B"-" =BBP =
"_"=A1A=BC=D2=AA=A9=A6W=BA=D9=A4=A4=A4]=A4=A3=AF=E0=A6=B3=AA=C5=A5=D5=A1C=
';;
+$messages["error_duplicate_templateset_name"] =3D =
"=AD=AB=BD=C6=AA=BA=BC=D2=AA=A9=A6W=BA=D9=A1C";
+$messages["error_copying_templateset"] =3D =
"=A6b=BD=C6=BBs=BC=D2=AA=A9=AE=C9=B5o=A5=CD=BF=F9=BB~=A1C";
=20
$messages["template_file_removed_ok"] =3D =
"=BC=D2=AA=A9=C0=C9=AE=D7=A1u%s=A1v=A4w=B6=B6=A7Q=A7R=B0=A3=A1C";
$messages["template_files_removed_ok"] =3D =
"=A4w=B6=B6=A7Q=A7R=B0=A3=A1u%s=A1v=AD=D3=BC=D2=AA=A9=C0=C9=AE=D7=A1C";
$messages["templateeditor_file_saved_ok"] =3D =
"=BC=D2=AA=A9=C0=C9=AE=D7=C0x=A6s=A6=A8=A5\=A1C";
$messages["templateeditor_settings_saved_ok"] =3D =
"=BC=D2=AA=A9=BDs=BF=E8=BE=B9=B3]=A9w=C0x=A6s=A6=A8=A5\=A1C";
+$messages["templateeditor_templatefile_copyed_ok"] =3D =
"=BC=D2=AA=A9=C0=C9=AE=D7=BD=C6=BBs=A6=A8=A5\=A1C";
+$messages["templateeditor_templateset_copyed_ok"] =3D =
"=BC=D2=AA=A9=BD=C6=BBs=A6=A8=A5\=A1C";
=20
$messages["label_configuration"] =3D "=B3]=A9w";
$messages["label_enable"] =3D "=B1=D2=B0=CA";
$messages["label_maxbackupfiles"] =3D =
"=BC=D2=AA=A9=B3=C6=A5=F7=AD=AD=A8=EE";
+$messages["label_allowedextension"] =3D "=AA=FE=A5[=C0=C9=A6W";
$messages["label_edit"] =3D "=BDs=BF=E8";
$messages["label_backupfile"] =3D "=B3=C6=A5=F7=A6^=C2=D0";
+
+$messages["edit"] =3D "=BDs=BF=E8";
+$messages["copy"] =3D "=BD=C6=BBs";
?>
\ No newline at end of file
Modified: plugins/trunk/templateeditor/plugintemplateeditor.class.php
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- plugins/trunk/templateeditor/plugintemplateeditor.class.php =
2005-03-02
18:34:47 UTC (rev 1289)
+++ plugins/trunk/templateeditor/plugintemplateeditor.class.php =
2005-03-02
19:18:34 UTC (rev 1290)
@@ -27,18 +27,22 @@
$this->registerAdminAction( "siteTemplateSetsList",
"PluginSiteTemplateSetsListAction" );
$this->registerAdminAction( "siteDeleteTemplateSet",
"PluginSiteDeleteTemplateSetsAction" );
$this->registerAdminAction( "siteDeleteTemplateSets",
"PluginSiteDeleteTemplateSetsAction" );
+ $this->registerAdminAction( "siteCopyTemplateSet",=20
+ "PluginSiteCopyTemplateSetAction" );
$this->registerAdminAction( "siteTemplatesList",
"PluginSiteTemplatesListAction" );
$this->registerAdminAction( "siteDeleteTemplateFile",
"PluginSiteDeleteTemplateFilesAction" );
$this->registerAdminAction( "siteDeleteTemplateFiles",
"PluginSiteDeleteTemplateFilesAction" );
+ $this->registerAdminAction( "siteCopyTemplateFile",=20
+ "PluginSiteCopyTemplateFileAction" );
$this->registerAdminAction( "siteEditTemplateFile",
"PluginSiteEditTemplateFileAction" );
$this->registerAdminAction( "siteUpdateTemplateFile",
"PluginSiteUpdateTemplateFileAction" );
=20
$this->registerAdminAction( "blogTemplateSetsList",
"PluginBlogTemplateSetsListAction" );
$this->registerAdminAction( "blogDeleteTemplateSet",
"PluginBlogDeleteTemplateSetsAction" );
$this->registerAdminAction( "blogDeleteTemplateSets",
"PluginBlogDeleteTemplateSetsAction" );
+ $this->registerAdminAction( "blogCopyTemplateSet",=20
+ "PluginBlogCopyTemplateSetAction" );
$this->registerAdminAction( "blogTemplatesList",
"PluginBlogTemplatesListAction" );
$this->registerAdminAction( "blogDeleteTemplateFile",
"PluginBlogDeleteTemplateFilesAction" );
$this->registerAdminAction( "blogDeleteTemplateFiles",
"PluginBlogDeleteTemplateFilesAction" );
+ $this->registerAdminAction( "blogCopyTemplateFile",=20
+ "PluginBlogCopyTemplateFileAction" );
$this->registerAdminAction( "blogEditTemplateFile",
"PluginBlogEditTemplateFileAction" );
$this->registerAdminAction( "blogUpdateTemplateFile",
"PluginBlogUpdateTemplateFileAction" );
=20
Modified:
plugins/trunk/templateeditor/templates/blogtemplatesetslist.template
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/templates/blogtemplatesetslist.template =
2005
-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/templates/blogtemplatesetslist.template =
2005
-03-02 19:18:34 UTC (rev 1290)
@@ -1,5 +1,21 @@
{include file=3D"$admintemplatepath/header.template"}
{include file=3D"$admintemplatepath/navigation.template"
showOpt=3DBlogTemplateEditor title=3D$locale->tr("BlogTemplateEditor")}
+<SCRIPT type=3D"text/javascript"> var copyToMessage =3D=20
+'{$locale->tr("templateeditor_enter_new_templateset_name")}'; </SCRIPT> =
+{literal} <SCRIPT type=3D"text/javascript"> function copyTemplateSetTo( =
+objId ) {
+ copyToName =3D prompt(copyToMessage, 'new_' + objId);
+ url =3D document.getElementById(objId);
+ if (copyToName !=3D '' && copyToName !=3D null) {
+ originUrl =3D url.getAttribute('href');
+ newUrl =3D encodeURI(originUrl + '&newTemplateId=3D' + =
copyToName);
+ url.setAttribute('href', newUrl);
+ } else {
+ url.setAttribute('href', '?op=3DblogTemplateSetsList');
+ }
+}
+</SCRIPT>
+{/literal}
<form id=3D"blogTemplateSetsList" method=3D"post" =
action=3D"admin.php">
<div id=3D"list">
{include file=3D"$admintemplatepath/successmessage.template"}
@@ -29,6 +45,9 @@
<a
href=3D"?op=3DblogDeleteTemplateSet&templateId=3D{$blogtemplate->getN=
ame()}">
<img src=3D"imgs/admin/icon_delete-16.png"
alt=3D"{$locale->tr("delete")}" />
</a>
+ <a
href=3D"?op=3DblogCopyTemplateSet&templateId=3D{$blogtemplate->getNam=
e()}"
id=3D"{$blogtemplate->getName()}" onClick=3D"copyTemplateSetTo(this.id)" =
>
+ <img src=3D"imgs/admin/icon_copy-16.png" =
alt=3D"{$locale->tr("copy")}"
/>
+ </a> =20
{if $blogtemplate->hasScreenshot()}
<a
href=3D"javascript:openScreenshotWindow('{$blogtemplate->getScreenshotUrl=
()}')
;">
<img src=3D"imgs/admin/icon_image-16.png" alt=3D"Screenshot"
/>
Modified: =
plugins/trunk/templateeditor/templates/blogtemplateslist.template
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/templates/blogtemplateslist.template 2005
-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/templates/blogtemplateslist.template 2005
-03-02 19:18:34 UTC (rev 1290)
@@ -1,6 +1,21 @@
{include file=3D"$admintemplatepath/header.template"}
{include file=3D"$admintemplatepath/navigation.template"
showOpt=3DBlogTemplateEditor title=3D$locale->tr("BlogTemplateEditor")}
-
+<SCRIPT type=3D"text/javascript"> var copyToMessage =3D=20
+'{$locale->tr("templateeditor_enter_new_templatefile_name")}';=20
+</SCRIPT> {literal} <SCRIPT type=3D"text/javascript"> function=20
+copyTemplateFileTo( objId ) {
+ copyToName =3D prompt(copyToMessage, 'new_' + objId);
+ url =3D document.getElementById(objId);
+ if (copyToName !=3D '' && copyToName !=3D null) {
+ originUrl =3D url.getAttribute('href');
+ newUrl =3D encodeURI(originUrl + '&newFileId=3D' + copyToName);
+ url.setAttribute('href', newUrl);
+ } else {
+ url.setAttribute('href', =
'?op=3DblogTemplatesList&templateId=3D' +
objId);
+ }
+}
+</SCRIPT>
+{/literal}
<div id=3D"list_nav_bar">
<div id=3D"list_nav_select">
<form id=3D"viewTemplateSets" action=3D"admin.php" method=3D"post"> =
@@ -59,6
+74,9 @@
<a
href=3D"?op=3DblogDeleteTemplateFile&templateId=3D{$currentTemplate}&=
amp;fileI
d=3D{$file.name}">
<img src=3D"imgs/admin/icon_delete-16.png"
alt=3D"{$locale->tr("delete")}" />
</a>
+ <a
href=3D"?op=3DblogCopyTemplateFile&templateId=3D{$currentTemplate}&am=
p;fileId=3D
{$file.name}" id=3D"{$file.name}" =
onClick=3D"copyTemplateFileTo(this.id)" >
+ <img src=3D"imgs/admin/icon_copy-16.png" =
alt=3D"{$locale->tr("copy")}"
/>
+ </a> =20
</div>
</td>
</tr>
Modified: plugins/trunk/templateeditor/templates/pluginsettings.template
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/templates/pluginsettings.template =
2005-03-02
18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/templates/pluginsettings.template =
2005-03-02
19:18:34 UTC (rev 1290)
@@ -19,6 +19,13 @@
<div
class=3D"formHelp">{$locale->tr("templateeditor_maxbackupfiles")}</div>
<input class=3D"text" type=3D"text" name=3D"maxBackupFiles"
id=3D"maxBackupFiles" value=3D"{$maxBackupFiles}" width=3D"10" />
</div>
+
+ <div class=3D"field">
+ <label
for=3D"allowedExtension">{$locale->tr("label_allowedextension")}</label>
+ <span class=3D"required">*</span>
+ <div
class=3D"formHelp">{$locale->tr("templateeditor_allowedextension")}</div>=
+ <input class=3D"text" type=3D"text" name=3D"allowedExtension"=20
+ id=3D"allowedExtension" value=3D"{$allowedExtension}" width=3D"10" /> =
+ </div>
=20
</fieldset>
=20
Modified:
plugins/trunk/templateeditor/templates/sitetemplatesetslist.template
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/templates/sitetemplatesetslist.template =
2005
-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/templates/sitetemplatesetslist.template =
2005
-03-02 19:18:34 UTC (rev 1290)
@@ -1,5 +1,21 @@
{include file=3D"$admintemplatepath/header.template"}
{include file=3D"$admintemplatepath/navigation.template"
showOpt=3DSiteTemplateEditor title=3D$locale->tr("SiteTemplateEditor")}
+<SCRIPT type=3D"text/javascript"> var copyToMessage =3D=20
+'{$locale->tr("templateeditor_enter_new_templateset_name")}'; </SCRIPT> =
+{literal} <SCRIPT type=3D"text/javascript"> function copyTemplateSetTo( =
+objId ) {
+ copyToName =3D prompt(copyToMessage, 'new_' + objId);
+ url =3D document.getElementById(objId);
+ if (copyToName !=3D '' && copyToName !=3D null) {
+ originUrl =3D url.getAttribute('href');
+ newUrl =3D encodeURI(originUrl + '&newTemplateId=3D' + =
copyToName);
+ url.setAttribute('href', newUrl);
+ } else {
+ url.setAttribute('href', '?op=3DsiteTemplateSetsList');
+ }
+}
+</SCRIPT>
+{/literal}
<form id=3D"siteTemplateSetsList" method=3D"post" =
action=3D"admin.php">
<div id=3D"list">
{include file=3D"$admintemplatepath/successmessage.template"}
@@ -29,6 +45,9 @@
<a
href=3D"?op=3DsiteDeleteTemplateSet&templateId=3D{$sitetemplate->getN=
ame()}">
<img src=3D"imgs/admin/icon_delete-16.png"
alt=3D"{$locale->tr("delete")}" />
</a>
+ <a
href=3D"?op=3DsiteCopyTemplateSet&templateId=3D{$sitetemplate->getNam=
e()}"
id=3D"{$sitetemplate->getName()}" onClick=3D"copyTemplateSetTo(this.id)" =
>
+ <img src=3D"imgs/admin/icon_copy-16.png" =
alt=3D"{$locale->tr("copy")}"
/>
+ </a> =20
{if $sitetemplate->hasScreenshot()}
<a
href=3D"javascript:openScreenshotWindow('{$sitetemplate->getScreenshotUrl=
()}')
;">
<img src=3D"imgs/admin/icon_image-16.png" alt=3D"Screenshot"
/>
Modified: =
plugins/trunk/templateeditor/templates/sitetemplateslist.template
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
---
plugins/trunk/templateeditor/templates/sitetemplateslist.template 2005
-03-02 18:34:47 UTC (rev 1289)
+++
plugins/trunk/templateeditor/templates/sitetemplateslist.template 2005
-03-02 19:18:34 UTC (rev 1290)
@@ -1,6 +1,21 @@
{include file=3D"$admintemplatepath/header.template"}
{include file=3D"$admintemplatepath/navigation.template"
showOpt=3DSiteTemplateEditor title=3D$locale->tr("SiteTemplateEditor")}
-
+<SCRIPT type=3D"text/javascript"> var copyToMessage =3D=20
+'{$locale->tr("templateeditor_enter_new_templatefile_name")}';=20
+</SCRIPT> {literal} <SCRIPT type=3D"text/javascript"> function=20
+copyTemplateFileTo( objId ) {
+ copyToName =3D prompt(copyToMessage, 'new_' + objId);
+ url =3D document.getElementById(objId);
+ if (copyToName !=3D '' && copyToName !=3D null) {
+ originUrl =3D url.getAttribute('href');
+ newUrl =3D encodeURI(originUrl + '&newFileId=3D' + copyToName);
+ url.setAttribute('href', newUrl);
+ } else {
+ url.setAttribute('href', =
'?op=3DsiteTemplatesList&templateId=3D' +
objId);
+ }
+}
+</SCRIPT>
+{/literal}
<div id=3D"list_nav_bar">
<div id=3D"list_nav_select">
<form id=3D"viewTemplateSets" action=3D"admin.php" method=3D"post"> =
@@ -59,6
+74,9 @@
<a
href=3D"?op=3DsiteDeleteTemplateFile&templateId=3D{$currentTemplate}&=
amp;fileI
d=3D{$file.name}">
<img src=3D"imgs/admin/icon_delete-16.png"
alt=3D"{$locale->tr("delete")}" />
</a>
+ <a
href=3D"?op=3DsiteCopyTemplateFile&templateId=3D{$currentTemplate}&am=
p;fileId=3D
{$file.name}" id=3D"{$file.name}" =
onClick=3D"copyTemplateFileTo(this.id)" >
+ <img src=3D"imgs/admin/icon_copy-16.png" =
alt=3D"{$locale->tr("copy")}"
/>
+ </a> =20
</div>
</td>
</tr>
_______________________________________________
pLog-svn mailing list
pLog-svn at devel.plogworld.net
http://devel.plogworld.net/mailman/listinfo/plog-svn
More information about the pLog-svn
mailing list