DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

tips:action_menu

Action menu

This hack help you to add selection action menu like in MoinMoin wiki and GMail

Add this to the end of \tpl\<your template>\main.php file:

/**
 * Create actions select box
 *
 * Create actions select box.
 *
 * @author Kirill Bezrukov <kirbez@mail.ru>
 */
function tpl_select_actions(){
  global $ID;
  global $INFO;
  global $REV;
  global $ACT;
  global $conf;
  global $lang;
  global $auth;
 
	if($ACT == 'show' || $ACT == 'search'){
		if($INFO['writable']){
			if($INFO['exists']){
			  print '<select class="edit" name="actionmenu" onchange=
						"if ((this.selectedIndex != 0) &&
								(this.options[this.selectedIndex].disabled == false)) {
							location.href = this.options[this.selectedIndex].value;
						}
			            this.selectedIndex = 0;" >'. DOKU_LF;	
				print '  <option value="show">Actions:</option>'.DOKU_LF;
				print '  <option value="'.wl($ID,'do=export_raw').'">Raw view</option>'. DOKU_LF;
			        print '  <option value="'.wl($ID,'do=export_html').'">HTML view</option>'. DOKU_LF;
			        print '  <option value="'.wl($ID,'do=export_odt').'">Export to OpenDocument</option>'. DOKU_LF;
			        print '  <option value="show" disabled="disabled" class="disabled">--------------------</option>'. DOKU_LF;
			        print '  <option value="'.wl($ID,'purge=true').'">Recache</option>'. DOKU_LF;
				print '  <option value="'.wl($ID,'do=admin&page=acl').'">ACL</option>'. DOKU_LF;
				print '  <option value="'.wl($ID,'do=admin&page=pagemove').'">Page move</option>'. DOKU_LF;
				print '</select>';	
		  }
		}
	}
 
  return true;
}

and this to the top bar div:

    <div class="bar" id="bar__top">
      <div class="bar-left" id="bar__topleft">
        <?php tpl_button('edit')?>
        <?php tpl_button('history')?>
++	<?php tpl_select_actions()?>
      </div>

Kirill Bezrukov 2008/03/18 10:03

tips/action_menu.txt · Last modified: 2008-03-18 10:04 by kirbez