%#
%# COPYRIGHT:
%#
-%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC
+%# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
%# <sales@bestpractical.com>
%#
%# (Except where explicitly superseded by other copyright notices)
$AddPrincipal = 'user'; # loc
}
}
+
+my $anchor = $DECODED_ARGS->{Anchor} || '';
+if ($anchor =~ /AddPrincipal/) {
+ for my $type ("group", "user") {
+ my $record = _ParseACLNewPrincipal($DECODED_ARGS, $type)
+ or next;
+ if ($record->PrincipalId) {
+ $anchor = "#acl-" . $record->PrincipalId;
+ last;
+ }
+ }
+}
</%init>
%# Principals is an array of arrays, where the inner arrays are like:
%# [ 'Category name' => $CollectionObj => 'DisplayColumn' => 1 ]
<script type="text/javascript">
jQuery(function() {
+ function sync_anchor(hash) {
+ if (!hash.length) return;
+ window.location.hash = hash;
+ jQuery(".rights-editor input[name=Anchor]").val(hash);
+ }
+ sync_anchor(<% $anchor |n,j %>);
+
jQuery(".rights-editor").tabs({
select: function(ev, ui) {
- window.location.hash = ui.tab.hash;
+ sync_anchor(ui.tab.hash);
+ if ( jQuery(ui.tab).find('input[type=text]').size() > 0 ) {
+ jQuery(ui.tab).find('input[type=text]:first').focus();
+ }
+ }
+ });
+
+ jQuery(".rights-editor .category-tabs").tabs({
+ cookie: { name: "rights-category-tab" /* saves current tab in cookie */ },
+ show: function(ev, ui) {
+ jQuery(".rights-editor .category-tabs").not(this).each(function() {
+ var item = jQuery(this);
+ var selected = item.tabs("option", "selected") || 0;
+ if (selected != ui.index)
+ item.tabs("select", ui.index);
+ });
}
});
- jQuery(".rights-editor .category-tabs").tabs();
});
</script>
<div class="rights-editor clearfix">
+ <input type="hidden" value="" name="Anchor" />
+
<ul>
<%perl>
for my $category (@$Principals) {
<%perl>
while ( my $obj = $collection->Next ) {
my $display = ref $col eq 'CODE' ? $col->($obj) : $obj->$col;
- my $id = "acl-$name-" . $obj->PrincipalId;
- $id =~ s/[^a-zA-Z0-9\-]/_/g;
+ my $id = "acl-" . $obj->PrincipalId;
</%perl>
<li><a href="#<% $id %>"><% $loc ? loc($display) : $display %></a></li>
<%perl>
my ($name, $collection, $col, $loc) = @$category;
while ( my $obj = $collection->Next ) {
my $display = ref $col eq 'CODE' ? $col->($obj) : $obj->$col;
- my $id = "acl-$name-" . $obj->PrincipalId;
- $id =~ s/[^a-zA-Z0-9\-]/_/g;
+ my $id = "acl-" . $obj->PrincipalId;
</%perl>
<div id="<% $id %>">