[pLog-svn] r4522 - in plugins/trunk/unported/templateeditor: .
class/action locale
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Mon Jan 8 19:12:18 GMT 2007
Author: oscar
Date: 2007-01-08 19:12:17 +0000 (Mon, 08 Jan 2007)
New Revision: 4522
Modified:
plugins/trunk/unported/templateeditor/class/action/pluginblogcopytemplatesetaction.class.php
plugins/trunk/unported/templateeditor/class/action/pluginblogtemplatesetslistaction.class.php
plugins/trunk/unported/templateeditor/class/action/pluginblogtemplateslistaction.class.php
plugins/trunk/unported/templateeditor/class/action/pluginbloguploadtemplatefileaction.class.php
plugins/trunk/unported/templateeditor/locale/locale_en_UK.php
plugins/trunk/unported/templateeditor/locale/locale_es_ES.php
plugins/trunk/unported/templateeditor/plugintemplateeditor.class.php
Log:
Some work for the templateeditor plugin, not complete yet but we're getting there. This plugin is the first one for LT 1.2 that registers its own custom permission so that we can for example have users who are only allowed to edit templates and nothing else (or any combination of the permissions people can think of) The porting work with this one is a bit more tedious, as BlogOwnerAdminAction and SiteAdminAction do not exist anymore but otherwise it's pretty straightforward.
Modified: plugins/trunk/unported/templateeditor/class/action/pluginblogcopytemplatesetaction.class.php
===================================================================
--- plugins/trunk/unported/templateeditor/class/action/pluginblogcopytemplatesetaction.class.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/class/action/pluginblogcopytemplatesetaction.class.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -1,5 +1,5 @@
<?php
- include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesets.class.php" );
include_once( PLOG_CLASS_PATH."class/template/templatesets/templatesetstorage.class.php" );
include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesetslistview.class.php" );
@@ -8,7 +8,7 @@
/**
* Removes global templates from disk.
*/
- class PluginBlogCopyTemplateSetAction extends BlogOwnerAdminAction
+ class PluginBlogCopyTemplateSetAction extends AdminAction
{
var $_templateId;
@@ -17,7 +17,9 @@
function PluginBlogCopyTemplateSetAction( $actionInfo, $request )
{
- $this->BlogOwnerAdminAction( $actionInfo, $request );
+ $this->AdminAction( $actionInfo, $request );
+
+ $this->requirePermission( "edit_blog_templates" );
}
function validate()
Modified: plugins/trunk/unported/templateeditor/class/action/pluginblogtemplatesetslistaction.class.php
===================================================================
--- plugins/trunk/unported/templateeditor/class/action/pluginblogtemplatesetslistaction.class.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/class/action/pluginblogtemplatesetslistaction.class.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -1,17 +1,19 @@
<?php
- include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.class.php" );
include_once( PLOG_CLASS_PATH."plugins/templateeditor/class/view/pluginblogtemplatesetslistview.class.php" );
/**
* shows a form with the current configuration
*/
- class PluginBlogTemplateSetsListAction extends BlogOwnerAdminAction
+ class PluginBlogTemplateSetsListAction extends AdminAction
{
function PluginBlogTemplateSetsListAction( $actionInfo, $request )
{
- $this->BlogOwnerAdminAction( $actionInfo, $request );
+ $this->AdminAction( $actionInfo, $request );
+
+ $this->requirePermission( "edit_blog_templates" );
}
function perform()
Modified: plugins/trunk/unported/templateeditor/class/action/pluginblogtemplateslistaction.class.php
===================================================================
--- plugins/trunk/unported/templateeditor/class/action/pluginblogtemplateslistaction.class.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/class/action/pluginblogtemplateslistaction.class.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -1,20 +1,22 @@
<?php
- include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.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
*/
- class PluginBlogTemplatesListAction extends BlogOwnerAdminAction
+ class PluginBlogTemplatesListAction extends AdminAction
{
var $_templateId;
var $_subFolderId;
function PluginBlogTemplatesListAction( $actionInfo, $request )
{
- $this->BlogOwnerAdminAction( $actionInfo, $request );
+ $this->AdminAction( $actionInfo, $request );
+
+ $this->requirePermission( "edit_blog_templates" );
}
function perform()
Modified: plugins/trunk/unported/templateeditor/class/action/pluginbloguploadtemplatefileaction.class.php
===================================================================
--- plugins/trunk/unported/templateeditor/class/action/pluginbloguploadtemplatefileaction.class.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/class/action/pluginbloguploadtemplatefileaction.class.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -1,6 +1,6 @@
<?php
- include_once( PLOG_CLASS_PATH."class/action/admin/blogowneradminaction.class.php" );
+ include_once( PLOG_CLASS_PATH."class/action/admin/adminaction.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" );
@@ -8,7 +8,7 @@
/**
* shows a form with the current configuration
*/
- class PluginBlogUploadTemplateFileAction extends BlogOwnerAdminAction
+ class PluginBlogUploadTemplateFileAction extends AdminAction
{
var $_templateId;
var $_subFolderId;
@@ -16,7 +16,9 @@
function PluginBlogUploadTemplateFileAction( $actionInfo, $request )
{
- $this->BlogOwnerAdminAction( $actionInfo, $request );
+ $this->AdminAction( $actionInfo, $request );
+
+ $this->requirePermission( "edit_blog_templates" );
}
function validate()
Modified: plugins/trunk/unported/templateeditor/locale/locale_en_UK.php
===================================================================
--- plugins/trunk/unported/templateeditor/locale/locale_en_UK.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/locale/locale_en_UK.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -45,4 +45,7 @@
$messages["edit"] = "Edit";
$messages["copy"] = "Copy";
+
+$messages["edit_blog_templates_desc"] = "User can edit blog templates (templateeditor plugin)";
+$messages["edit_global_templates_desc"] = "User can edit global templates (templateeditor plugin)";
?>
\ No newline at end of file
Modified: plugins/trunk/unported/templateeditor/locale/locale_es_ES.php
===================================================================
--- plugins/trunk/unported/templateeditor/locale/locale_es_ES.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/locale/locale_es_ES.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -50,4 +50,7 @@
$messages["edit"] = "Editar";
$messages["copy"] = "Copiar";
+
+$messages["edit_blog_templates_desc"] = "Permiso para editar las plantillas del blog (plugin templateeditor)";
+$messages["edit_global_templates_desc"] = "Permiso para editar las plantillas globales (plugin templateeditor)";
?>
\ No newline at end of file
Modified: plugins/trunk/unported/templateeditor/plugintemplateeditor.class.php
===================================================================
--- plugins/trunk/unported/templateeditor/plugintemplateeditor.class.php 2007-01-08 17:46:00 UTC (rev 4521)
+++ plugins/trunk/unported/templateeditor/plugintemplateeditor.class.php 2007-01-08 19:12:17 UTC (rev 4522)
@@ -56,12 +56,32 @@
$this->registerAdminAction( "templateEditorConfig", "PluginTemplateEditorConfigAction" );
$this->registerAdminAction( "updateTemplateEditorConfig", "PluginTemplateEditorUpdateConfigAction" );
- $this->addMenuEntry( "/menu/adminSettings/Templates", "SiteTemplateEditor", "admin.php?op=siteTemplateSetsList", "" );
- $this->addMenuEntry( "/menu/adminSettings/Templates", "TemplateEditorConfig", "admin.php?op=templateEditorConfig", "" );
+ $this->addMenuEntry( "/menu/adminSettings/Templates", "SiteTemplateEditor", "admin.php?op=siteTemplateSetsList", "", Array( "edit_global_templates" ), Array(), true );
+ $this->addMenuEntry( "/menu/adminSettings/Templates", "TemplateEditorConfig", "admin.php?op=templateEditorConfig", "", Array( "edit_global_templates" ), Array(), true );
if ($this->pluginEnabled) {
- $this->addMenuEntry( "/menu/controlCenter/manageBlogTemplates", "BlogTemplateEditor", "admin.php?op=blogTemplateSetsList", "" );
+ $this->addMenuEntry( "/menu/controlCenter/manageBlogTemplates", "BlogTemplateEditor", "admin.php?op=blogTemplateSetsList", "", Array( "edit_blog_templates" ), Array(), false );
}
}
+
+ function register()
+ {
+ // add our new permission if it doesn't exist yet
+ lt_include( PLOG_CLASS_PATH."class/dao/permissions.class.php" );
+ $perms = new Permissions();
+ if( !$perms->getPermissionByName( "edit_blog_templates" )) {
+ $perm = new Permission( "edit_blog_templates", "edit_blog_templates_desc" );
+ $perms->addPermission( $perm );
+ }
+
+ // admin-only permisson to edit global templates
+ if( !$perms->getPermissionByName( "edit_global_templates" )) {
+ $perm = new Permission( "edit_global_templates", "edit_global_templates_desc" );
+ $perm->setAdminOnlyPermission( true );
+ $perms->addPermission( $perm );
+ }
+
+ return( true );
+ }
}
?>
\ No newline at end of file
More information about the pLog-svn
mailing list