=====WikkaMenusAdmin Action===== >>==See also :== Documentation : ""WikkaMenusAdminInfo"" Other: WikkaMenus ==Works with :== Wikka 1.2>> This is the development page for the WikkaMenusAdmin action for Wikka version > 1.2. ::c:: DarTar did [[WikkaMenus]], a solution to manage users customized menus stored in MySql database. WikkaMenusAdmin is a "downgraded" version which manages menulets files introduced with Wikka version 1.2. ==Usage== Place in a page ""{{wikkamenusadmin}}"", you can also apply ACLs restriction (despite this action is made for admin user only). ==Installation== - Save the code block below as ##/plugins/actions/wikkamenusadmin.php## - Give it the same file permissions as the other php files in that directory - Customized menulets directory if needed ==Code== %%(php;1)

Menu Configuration


IsAdmin()) { switch ($_POST['operation']) { case 'Create Menu': if (file_exists(MENU_PATH.$_POST['newname'])) { echo $this->Format('<<**Sorry!** --- A menu named "'.$_POST['newname'].'" already exists. --- Please choose another name<<::c::--- --- '); } else { WriteMyMenu($_POST["newname"], $_POST["menu"]); echo $this->Format("<<**Thanks!** --- Menu \"".$_POST["newname"]."\" has been created<<::c:: --- "); } break; case 'Delete Menu': echo $this->Format('<<**Confirmation required**<<::c:: --- Do you really want to delete **'.$_POST['name'].'**? --- --- '); $formdelete = '
'. ''. '

 

'; echo $this->FormOpen('','','post')."\n"; echo $formdelete."\n"; echo $this->FormClose()."\n"; break; case 'Confirm Deletion': DeleteMyMenu($_POST['name']); echo $this->Format('<<**Thanks!** --- Menu "'.$_POST['name'].'" has been deleted<<::c:: --- '); break; case 'Rename Menu': if (file_exists(MENU_PATH.$_POST["newname"])) { echo $this->Format('<<**Sorry!** --- A menu named "'.$_POST["newname"].'" already exists. --- Please choose another name<<::c:: --- --- '); } else { echo $this->Format('<<**Confirmation required**<<::c:: --- Do you really want to rename **'.$_POST["name"].'** as **'.$_POST["newname"].'**? --- --- '); $formrename = '
'. ''. ''. '

 

'; echo $this->FormOpen('','','post')."\n"; echo $formrename."\n"; echo $this->FormClose()."\n"; } break; case 'Confirm Rename': rename(MENU_PATH.$_POST['oldname'], MENU_PATH.$_POST['newname']); echo $this->Format('<<**Thanks!** --- Menu has been renamed as "'.$_POST["newname"].'"<<::c:: --- --- '); break; case 'Update Menu': WriteMyMenu($_POST['name'], TrimMenu($_POST['content'])); echo $this->Format('<<**Menu configuration stored** --- Thanks for updating "'.$_POST["name"].'"!<<::c:: --- --- '); break; } // load stored menus and print menu forms echo $this->Format('Please enter menu items on separate lines. --- You can either use //""CamelCase"" links// like ##""PageIndex""## --- or //forced links// like: ##""[[http://www.mydomain.com | External Link]]""## --- --- --- '); $allmenus = LoadAllMyMenus(); foreach ($allmenus as $item) { $formarray[$item['name']] = '
Menu: '.$item['name'].'
'. ''. '
'. ''. '
'. ''. '

 

'; print $this->FormOpen('','','post'); echo $formarray[$item['name']]; print($this->FormClose()); } // "Create menu" form $newmenuform = '
'. '
Menu name:
'. '
'; echo $this->Format('== Create a new menu =='); echo $this->FormOpen('','','post')."\n"; echo $newmenuform; echo $this->FormClose()."\n"; } else { echo 'Sorry, only Wikka Administrators can modify the Menu configuration.'; } ?> %% That's all ! ---- CategoryUserContributions - CategoryDevelopmentActions