summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2010-04-03 16:57:58 +0200
committerMichael Hamann <michael@content-space.de>2010-04-03 17:18:32 +0200
commit40307ce67e9cb6cc8f00ddcddf1677f41b42fb83 (patch)
tree979b16972445253f69375e59f636e224afd7f104 /lib
parentd74913c6df41b27eb1ea8388a47d94e66f97c652 (diff)
downloadrpg-40307ce67e9cb6cc8f00ddcddf1677f41b42fb83.tar.gz
rpg-40307ce67e9cb6cc8f00ddcddf1677f41b42fb83.tar.bz2
Preserve selected item in the acl manager during ajax requests
There are two new parameters submitted that contain the currently selected namespace and page id so it can be selected again indenpendently from the opened namespace.
Diffstat (limited to 'lib')
-rw-r--r--lib/plugins/acl/admin.php25
-rw-r--r--lib/plugins/acl/script.js6
2 files changed, 27 insertions, 4 deletions
diff --git a/lib/plugins/acl/admin.php b/lib/plugins/acl/admin.php
index dcd72b611..1f666660c 100644
--- a/lib/plugins/acl/admin.php
+++ b/lib/plugins/acl/admin.php
@@ -17,6 +17,15 @@ if(!defined('DOKU_INC')) die();
class admin_plugin_acl extends DokuWiki_Admin_Plugin {
var $acl = null;
var $ns = null;
+ /**
+ * The currently selected item, associative array with id and type.
+ * Populated from (in this order):
+ * $_REQUEST['current_ns']
+ * $_REQUEST['current_id']
+ * $ns
+ * $ID
+ */
+ var $current_item = null;
var $who = '';
var $usersgroups = array();
var $specials = array();
@@ -72,6 +81,16 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
$this->ns = cleanID($_REQUEST['ns']);
}
+ if ($_REQUEST['current_ns']) {
+ $this->current_item = array('id' => cleanID($_REQUEST['current_ns']), 'type' => 'd');
+ } elseif ($_REQUEST['current_id']) {
+ $this->current_item = array('id' => cleanID($_REQUEST['current_id']), 'type' => 'f');
+ } elseif ($this->ns) {
+ $this->current_item = array('id' => $this->ns, 'type' => 'd');
+ } else {
+ $this->current_item = array('id' => $ID, 'type' => 'f');
+ }
+
// user or group choosen?
$who = trim($_REQUEST['acl_w']);
if($_REQUEST['acl_t'] == '__g__' && $who){
@@ -167,7 +186,7 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
echo '<div class="level1">'.NL;
echo '<div id="acl__tree">'.NL;
- $this->_html_explorer($_REQUEST['ns']);
+ $this->_html_explorer();
echo '</div>'.NL;
echo '<div id="acl__detail">'.NL;
@@ -498,8 +517,8 @@ class admin_plugin_acl extends DokuWiki_Admin_Plugin {
}
// highlight?
- if( ($item['type']=='d' && $item['id'] == $this->ns) ||
- ($item['type']!='d' && $item['id'] == $ID)) $cl = ' cur';
+ if( ($item['type']== $this->current_item['type'] && $item['id'] == $this->current_item['id']))
+ $cl = ' cur';
// namespace or page?
if($item['type']=='d'){
diff --git a/lib/plugins/acl/script.js b/lib/plugins/acl/script.js
index 449a3c16a..d5d0371a9 100644
--- a/lib/plugins/acl/script.js
+++ b/lib/plugins/acl/script.js
@@ -118,7 +118,11 @@ acl = {
var ul = document.createElement('ul');
listitem.appendChild(ul);
ajax.elementObj = ul;
- ajax.runAJAX(link.search.substr(1)+'&ajax=tree');
+ ajax.setVar('ajax', 'tree');
+ var frm = $('acl__detail').getElementsByTagName('form')[0];
+ ajax.setVar('current_ns', encodeURIComponent(frm.elements['ns'].value));
+ ajax.setVar('current_id', encodeURIComponent(frm.elements['id'].value));
+ ajax.runAJAX(link.search.substr(1));
clicky.src = DOKU_BASE+'lib/images/minus.gif';
return false;
},