Made quite a few changes so that the code works in the server
[vanilla-miry.git] / themes / settings_category_list.php
blob133d5a2b9fc09b6c917ae431016319dc0c6a847d
1 <?php
2 // Note: This file is included from the library/Vanilla/Vanilla.Control.CategoryForm.php control.
4 echo '<div id="Form" class="Account CategoryList">';
5 $Action = ForceIncomingString("Action", "");
6 if ($Action == 'Removed') {
7 echo '<div id="Success">'.$this->Context->GetDefinition('CategoryRemoved').'</div>';
8 } else if ($Action == 'Saved') {
9 echo '<div id="Success">'.$this->Context->GetDefinition('CategorySaved').'</div>';
10 } else if ($Action == 'SavedNew') {
11 echo '<div id="Success">'.$this->Context->GetDefinition('NewCategorySaved').'</div>';
13 echo '<fieldset>
14 <legend>'.$this->Context->GetDefinition('CategoryManagement').'</legend>'
15 .$this->Get_Warnings()
16 .'<form method="get" action="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl).'">
17 <input type="hidden" name="PostBackAction" value="Category" />
18 <p>'.$this->Context->GetDefinition('CategoryReorderNotes').'</p>
19 <div class="SortList" id="SortCategories">
21 if ($this->CategoryData) {
22 $c = $this->Context->ObjectFactory->NewObject($this->Context, 'Category');
23 while ($Row = $this->Context->Database->GetRow($this->CategoryData)) {
24 $c->Clear();
25 $c->GetPropertiesFromDataSet($Row);
26 $c->FormatPropertiesForDisplay();
27 echo '<div class="SortListItem'.($c->RoleBlocked?' RoleBlocked':'').($this->Context->Session->User->Permission('PERMISSION_SORT_CATEGORIES') ? ' MovableSortListItem':'').'" id="item_'.$c->CategoryID.'">
28 <div class="SortListOptions">';
29 if ($this->Context->Session->User->Permission('PERMISSION_EDIT_CATEGORIES')) echo '<a class="SortEdit" href="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=Category&amp;CategoryID='.$c->CategoryID).'">'.$this->Context->GetDefinition('Edit').'</a>';
30 if ($this->Context->Session->User->Permission('PERMISSION_REMOVE_CATEGORIES')) echo '<a class="SortRemove" href="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', '', '', '', 'PostBackAction=CategoryRemove&amp;CategoryID='.$c->CategoryID).'">&nbsp;</a>';
31 echo '</div>'
32 .$c->Name.'
33 </div>
37 echo '</div>
38 <div id="SortResult" style="display: none;"></div>';
40 if ($this->Context->Session->User->Permission('PERMISSION_SORT_CATEGORIES')) {
41 echo "
42 <script type=\"text/javascript\" language=\"javascript\">
43 // <![CDATA[
44 Sortable.create('SortCategories', {dropOnEmpty:true, tag:'div', constraint: 'vertical', ghosting: false, onUpdate: function() {new Ajax.Updater('SortResult', '"
45 . $this->Context->Configuration['WEB_ROOT'] . "ajax/sortcategories.php', "
46 . "{onComplete: function(request) { new Effect.Highlight('SortCategories',{startcolor:'#ffff99'});}, "
47 . "parameters:Sortable.serialize('SortCategories', {tag:'div', name:'CategoryID'})"
48 ." + '&PostBackKey=" . $this->SessionPostBackKey . "', "
49 . "evalScripts:true, asynchronous:true})}});
50 // ]]>
51 </script>";
53 echo '<div class="Submit">
54 <input type="submit" name="btnSave" value="'.$this->Context->GetDefinition('CreateNewCategory').'" class="Button SubmitButton NewCategoryButton" />
55 <a href="'.GetUrl($this->Context->Configuration, $this->Context->SelfUrl).'" class="CancelButton">'.$this->Context->GetDefinition('Cancel').'</a>
56 </div>
57 </form>
58 </fieldset>
59 </div>';