MFB: Check for lock when renaming/merging.
authorJan Schneider <jan@horde.org>
Sun, 14 Feb 2010 18:29:17 +0000 (19:29 +0100)
committerJan Schneider <jan@horde.org>
Sun, 14 Feb 2010 22:24:06 +0000 (23:24 +0100)
wicked/lib/Page/MergeOrRename.php
wicked/templates/display/standard.inc

index d1d3e71..5551102 100644 (file)
@@ -44,6 +44,27 @@ class MergeOrRename extends Page {
     }
 
     /**
+     * Returns if the page allows a mode. Access rights and user state
+     * are taken into consideration.
+     *
+     * @see $supportedModes
+     *
+     * @param integer $mode  The mode to check for.
+     *
+     * @return boolean  True if the mode is allowed.
+     */
+    function allows($mode)
+    {
+        if ($mode == WICKED_MODE_EDIT) {
+            $page = Page::getPage($this->referrer());
+            if ($page->isLocked(Wicked::lockUser())) {
+                return false;
+            }
+        }
+        return parent::allows($mode);
+    }
+
+    /**
      * Retrieve this user's permissions for the referring page.
      *
      * @return integer  The permissions bitmask.
index dc417ec..08b0860 100644 (file)
@@ -17,7 +17,7 @@ if (!function_exists('separator')) {
 
 separator(true);
 
-if ($this->allows(WICKED_MODE_EDIT) && !$this->isLocked()) {
+if ($this->allows(WICKED_MODE_EDIT) && !$this->isLocked(Wicked::lockUser())) {
     separator();
     $url = Horde_Util::addParameter(Wicked::url('EditPage'),
                               'referrer', $this->pageName());
@@ -56,7 +56,7 @@ if ($this->allows(WICKED_MODE_REMOVE)) {
                        'widget', '', '', _("_Delete"));
 }
 
-if ($this->allows(WICKED_MODE_EDIT)) {
+if ($this->allows(WICKED_MODE_EDIT) && !$this->isLocked(Wicked::lockUser())) {
     separator();
     $url = Horde_Util::addParameter(Wicked::url('MergeOrRename'),
                               'referrer', $this->pageName());