Made quite a few changes so that the code works in the server
[vanilla-miry.git] / themes / settings_role_list.php
blob1bc3e9316af301a1840beda0bf20f8e4bb138e69
1 <?php
2 // Note: This file is included from the library/Vanilla/Vanilla.Control.RoleForm.php control.
4 echo '<div id="Form" class="Account Roles">';
5 $Action = ForceIncomingString("Action", "");
6 if ($Action == 'Removed') {
7 echo '<div id="Success">'.$this->Context->GetDefinition('RoleRemoved').'</div>';
8 } else if ($Action == 'Saved') {
9 echo '<div id="Success">'.$this->Context->GetDefinition('RoleSaved').'</div>';
10 } else if ($Action == 'SavedNew') {
11 echo '<div id="Success">'.$this->Context->GetDefinition('NewRoleSaved').'</div>';
14 echo '<fieldset>
15 <legend>'.$this->Context->GetDefinition('RoleManagement').'</legend>'
16 .$this->Get_Warnings().
17 '<form method="get" action="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl).'">
18 <input type="hidden" name="PostBackAction" value="Role" />
19 <p>'.$this->Context->GetDefinition('RoleReorderNotes').'</p>
21 <div class="SortList" id="SortRoles">';
22 if ($this->RoleData) {
23 $r = $this->Context->ObjectFactory->NewContextObject($this->Context, 'Role');
25 while ($Row = $this->Context->Database->GetRow($this->RoleData)) {
26 $r->Clear();
27 $r->GetPropertiesFromDataSet($Row);
28 $r->FormatPropertiesForDisplay();
29 echo '<div class="SortListItem'.($this->Context->Session->User->Permission('PERMISSION_SORT_ROLES') ? ' MovableSortListItem' : '').'" id="item_'.$r->RoleID.'">
30 <div class="SortListOptions">';
31 if ($this->Context->Session->User->Permission('PERMISSION_EDIT_ROLES')) echo '<a class="SortEdit" href="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=Role&amp;RoleID='.$r->RoleID).'">'.$this->Context->GetDefinition('Edit').'</a>';
32 if ($this->Context->Session->User->Permission('PERMISSION_REMOVE_ROLES')) {
33 if (!$r->Unauthenticated) {
34 echo '<a class="SortRemove" href="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=RoleRemove&amp;RoleID='.$r->RoleID).'">&nbsp;</a>';
35 } else {
36 echo '<span class="SortNoRemove">&nbsp;</span>';
39 echo '</div>'
40 .$r->RoleName
41 .'</div>';
44 echo '</div>';
45 if ($this->Context->Session->User->Permission('PERMISSION_SORT_ROLES')) {
46 echo "<script type=\"text/javascript\" language=\"javascript\">
47 // <![CDATA[
48 Sortable.create('SortRoles', {dropOnEmpty:true, tag:'div', constraint: 'vertical', ghosting: false, onUpdate: function() {new Ajax.Updater('SortResult', '"
49 . $this->Context->Configuration['WEB_ROOT'] . "ajax/sortroles.php', "
50 . "{onComplete: function(request) { new Effect.Highlight('SortRoles',{startcolor:'#ffff99'});}, "
51 . "parameters:Sortable.serialize('SortRoles', {tag:'div', name:'RoleID'})"
52 ." + '&PostBackKey=" . $this->SessionPostBackKey . "', "
53 ."evalScripts:true, asynchronous:true})}});
54 // ]]>
55 </script>";
56 // Debug
57 echo '<div id="SortResult" style="display: none;"></div>';
59 if ($this->Context->Session->User->Permission('PERMISSION_ADD_ROLES')) {
60 echo '<div class="Submit">
61 <input type="submit" name="btnSave" value="'.$this->Context->GetDefinition('CreateANewRole').'" class="Button SubmitButton NewRoleButton" />
62 <a href="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl).'" class="CancelButton">'.$this->Context->GetDefinition('Cancel').'</a>
63 </div>';
65 echo '</form>
66 </fieldset>
67 </div>';