includes/clientside/static/acl.js
changeset 42 45ebe475ff75
parent 40 723bb7acf914
child 73 0a74676a2f2f
equal deleted inserted replaced
41:7c7920b65f42 42:45ebe475ff75
   102   lbl = document.createElement('label');
   102   lbl = document.createElement('label');
   103   lbl.appendChild(grpb);
   103   lbl.appendChild(grpb);
   104   lbl.appendChild(document.createTextNode('A usergroup'));
   104   lbl.appendChild(document.createTextNode('A usergroup'));
   105   lbl.style.display = 'block';
   105   lbl.style.display = 'block';
   106   span.appendChild(grpsel);
   106   span.appendChild(grpsel);
       
   107   
       
   108   anoninfo = document.createElement('div');
       
   109   anoninfo.className = 'info-box-mini';
       
   110   anoninfo.appendChild(document.createTextNode('To edit permissions for guests, select "a specific user", and enter Anonymous as the username.'));
       
   111   span.appendChild(document.createElement('br'));
       
   112   span.appendChild(anoninfo);
   107   
   113   
   108   usrb = document.createElement('input');
   114   usrb = document.createElement('input');
   109   usrb.type = 'radio';
   115   usrb.type = 'radio';
   110   usrb.name  = 'target_type';
   116   usrb.name  = 'target_type';
   111   usrb.value = '2'; // ACL_TYPE_USER
   117   usrb.value = '2'; // ACL_TYPE_USER
   172   selector.appendChild(span2);
   178   selector.appendChild(span2);
   173   
   179   
   174   container = document.createElement('div');
   180   container = document.createElement('div');
   175   container.style.margin = 'auto';
   181   container.style.margin = 'auto';
   176   container.style.width = '360px';
   182   container.style.width = '360px';
   177   container.style.paddingTop = '70px';
   183   container.style.paddingTop = '100px';
   178   
   184   
   179   head = document.createElement('h2');
   185   head = document.createElement('h2');
   180   head.appendChild(document.createTextNode('Manage page access'));
   186   head.appendChild(document.createTextNode('Manage page access'));
   181   
   187   
   182   desc = document.createElement('p');
   188   desc = document.createElement('p');
   365             document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
   371             document.getElementById(aclManagerID + '_main').insertBefore(note, document.getElementById(aclManagerID + '_main').firstChild);
   366             if(!document.getElementById(aclManagerID+'_deletelnk'))
   372             if(!document.getElementById(aclManagerID+'_deletelnk'))
   367               document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'Do you really want to delete this rule?\')) __aclDeleteRule(); return false;" style="color: red;">Delete this rule</a></p>';
   373               document.getElementById(aclManagerID + '_main').innerHTML += '<p id="'+aclManagerID+'_deletelnk" style="text-align: right;"><a href="#delete_acl_rule" onclick="if(confirm(\'Do you really want to delete this rule?\')) __aclDeleteRule(); return false;" style="color: red;">Delete this rule</a></p>';
   368             //fadeInfoBoxes();
   374             //fadeInfoBoxes();
   369             document.getElementById(aclManagerID+'_main').scrollTop = 0;
   375             document.getElementById(aclManagerID+'_main').scrollTop = 0;
       
   376             
       
   377             aclDataCache.mode = 'save_edit';
   370             break;
   378             break;
   371           case 'delete':
   379           case 'delete':
   372             
   380             
   373             params = {
   381             params = {
   374               'mode' : 'listgroups'
   382               'mode' : 'listgroups'
   387                 __aclBuildSelector(groups);
   395                 __aclBuildSelector(groups);
   388                 
   396                 
   389                 note = document.createElement('div');
   397                 note = document.createElement('div');
   390                 note.className = 'info-box';
   398                 note.className = 'info-box';
   391                 note.style.marginLeft = '0';
   399                 note.style.marginLeft = '0';
       
   400                 note.style.position = 'absolute';
       
   401                 note.style.width = '558px';
       
   402                 note.id = 'aclSuccessNotice_' + Math.floor(Math.random() * 100000);
   392                 b = document.createElement('b');
   403                 b = document.createElement('b');
   393                 b.appendChild(document.createTextNode('Entry deleted'));
   404                 b.appendChild(document.createTextNode('Entry deleted'));
   394                 note.appendChild(b);
   405                 note.appendChild(b);
   395                 note.appendChild(document.createElement('br'));
   406                 note.appendChild(document.createElement('br'));
   396                 note.appendChild(document.createTextNode('The access rules for '+aclDataCache.target_name+' on this page have been deleted.'));
   407                 note.appendChild(document.createTextNode('The access rules for '+aclDataCache.target_name+' on this page have been deleted.'));
   397                 note.appendChild(document.createElement('br'));
   408                 note.appendChild(document.createElement('br'));
   398                 a = document.createElement('a');
   409                 a = document.createElement('a');
   399                 a.href = '#';
   410                 a.href = '#';
   400                 a.onclick = function() { this.parentNode.parentNode.removeChild(this.parentNode); return false; };
   411                 a.onclick = function() { opacity(this.parentNode.id, 100, 0, 1000); setTimeout('var div = document.getElementById("' + this.parentNode.id + '"); div.parentNode.removeChild(div);', 1100); return false; };
   401                 a.appendChild(document.createTextNode('[ dismiss :'));
   412                 a.appendChild(document.createTextNode('[ dismiss :'));
   402                 note.appendChild(a);
   413                 note.appendChild(a);
   403                 a = document.createElement('a');
   414                 a = document.createElement('a');
   404                 a.href = '#';
   415                 a.href = '#';
   405                 a.onclick = function() { killACLManager(); return false; };
   416                 a.onclick = function() { killACLManager(); return false; };
   712   }
   723   }
   713 }
   724 }
   714 
   725 
   715 function __aclDeleteRule()
   726 function __aclDeleteRule()
   716 {
   727 {
   717   if(!aclDataCache) return false;
   728   if(!aclDataCache) 
   718   if(aclDataCache.mode != 'seltarget') return false;
   729   {
       
   730     if ( window.console )
       
   731     {
       
   732       try{ console.error('ACL editor: can\'t load data cache on delete'); } catch(e) {};
       
   733     }
       
   734     return false;
       
   735   }
       
   736   if(aclDataCache.mode != 'seltarget' && aclDataCache.mode != 'save_new' && aclDataCache.mode != 'save_edit')
       
   737   {
       
   738     if ( window.console )
       
   739     {
       
   740       try{ console.error('ACL editor: wrong mode on aclDataCache: ' + aclDataCache.mode); } catch(e) {};
       
   741     }
       
   742     return false;
       
   743   }
   719   parms = {
   744   parms = {
   720     'target_type' : aclDataCache.target_type,
   745     'target_type' : aclDataCache.target_type,
   721     'target_id' : aclDataCache.target_id,
   746     'target_id' : aclDataCache.target_id,
   722     'target_name' : aclDataCache.target_name,
   747     'target_name' : aclDataCache.target_name,
   723     'page_id' : aclDataCache.page_id,
   748     'page_id' : aclDataCache.page_id,