diff options
author | Andreas Gohr <andi@splitbrain.org> | 2015-07-15 16:11:46 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2015-07-15 16:11:46 +0200 |
commit | d4de18edf7fafb4241c8856b6ace1a4dce285930 (patch) | |
tree | c7af69590604fdae96522ef26cdbd8cf18dc8d89 /inc | |
parent | a1bc634ed7cd39d59f82797896dc5f42f753f527 (diff) | |
parent | 768d185262d4b53b1717808417c33fdd1ab64797 (diff) | |
download | rpg-d4de18edf7fafb4241c8856b6ace1a4dce285930.tar.gz rpg-d4de18edf7fafb4241c8856b6ace1a4dce285930.tar.bz2 |
Merge pull request #1231 from splitbrain/kill-all-input-buttons
Changed all input buttons to button buttons
Diffstat (limited to 'inc')
-rw-r--r-- | inc/form.php | 6 | ||||
-rw-r--r-- | inc/html.php | 18 | ||||
-rw-r--r-- | inc/template.php | 59 |
3 files changed, 31 insertions, 52 deletions
diff --git a/inc/form.php b/inc/form.php index 748983281..91a171555 100644 --- a/inc/form.php +++ b/inc/form.php @@ -400,7 +400,7 @@ function form_makeWikiText($text, $attrs=array()) { function form_makeButton($type, $act, $value='', $attrs=array()) { if ($value == '') $value = $act; $elem = array('_elem'=>'button', 'type'=>$type, '_action'=>$act, - 'value'=>$value, 'class'=>'button'); + 'value'=>$value); if (!empty($attrs['accesskey']) && empty($attrs['title'])) { $attrs['title'] = $value . ' ['.strtoupper($attrs['accesskey']).']'; } @@ -761,7 +761,9 @@ function form_wikitext($attrs) { */ function form_button($attrs) { $p = (!empty($attrs['_action'])) ? 'name="do['.$attrs['_action'].']" ' : ''; - return '<input '.$p.buildAttributes($attrs,true).' />'; + $value = $attrs['value']; + unset($attrs['value']); + return '<button '.$p.buildAttributes($attrs,true).'>'.$value.'</button>'; } /** diff --git a/inc/html.php b/inc/html.php index 2f10e3c08..1ccc056de 100644 --- a/inc/html.php +++ b/inc/html.php @@ -183,7 +183,7 @@ function html_topbtn(){ * @param bool|string $label label text, false: lookup btn_$name in localization * @return string */ -function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false){ +function html_btn($name, $id, $akey, $params, $method='get', $tooltip='', $label=false){ global $conf; global $lang; @@ -221,13 +221,15 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip='',$label=false $tip = htmlspecialchars($label); } - $ret .= '<input type="submit" value="'.hsc($label).'" class="button" '; + $ret .= '<button type="submit" '; if($akey){ $tip .= ' ['.strtoupper($akey).']'; $ret .= 'accesskey="'.$akey.'" '; } $ret .= 'title="'.$tip.'" '; $ret .= '/>'; + $ret .= hsc($label); + $ret .= '</button>'; $ret .= '</div></form>'; return $ret; @@ -856,26 +858,28 @@ function html_recent($first=0, $show_changes='both'){ $first -= $conf['recent']; if ($first < 0) $first = 0; $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev'))); - $form->addElement(form_makeTag('input', array( + $form->addElement(form_makeOpenTag('button', array( 'type' => 'submit', 'name' => 'first['.$first.']', - 'value' => $lang['btn_newer'], 'accesskey' => 'n', 'title' => $lang['btn_newer'].' [N]', 'class' => 'button show' ))); + $form->addElement($lang['btn_newer']); + $form->addElement(form_makeCloseTag('button')); $form->addElement(form_makeCloseTag('div')); } if ($hasNext) { $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next'))); - $form->addElement(form_makeTag('input', array( + $form->addElement(form_makeOpenTag('button', array( 'type' => 'submit', 'name' => 'first['.$last.']', - 'value' => $lang['btn_older'], 'accesskey' => 'p', 'title' => $lang['btn_older'].' [P]', 'class' => 'button show' ))); + $form->addElement($lang['btn_older']); + $form->addElement(form_makeCloseTag('button')); $form->addElement(form_makeCloseTag('div')); } $form->addElement(form_makeCloseTag('div')); @@ -1005,7 +1009,7 @@ function html_li_default($item){ * @param callable $func callback to print an list item * @param callable $lifunc callback to the opening li tag * @param bool $forcewrapper Trigger building a wrapper ul if the first level is - 0 (we have a root object) or 1 (just the root content) + * 0 (we have a root object) or 1 (just the root content) * @return string html of an unordered list */ function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapper=false){ diff --git a/inc/template.php b/inc/template.php index 95dc52deb..c7dea6b46 100644 --- a/inc/template.php +++ b/inc/template.php @@ -834,7 +834,7 @@ function tpl_searchform($ajax = true, $autocomplete = true) { print 'placeholder="'.$lang['btn_search'].'" '; if(!$autocomplete) print 'autocomplete="off" '; print 'id="qsearch__in" accesskey="f" name="id" class="edit" title="[F]" />'; - print '<input type="submit" value="'.$lang['btn_search'].'" class="button" title="'.$lang['btn_search'].'" />'; + print '<button type="submit" title="'.$lang['btn_search'].'">'.$lang['btn_search'].'</button>'; if($ajax) print '<div id="qsearch__out" class="ajax_qsearch JSpopup"></div>'; print '</div></form>'; return true; @@ -1613,6 +1613,12 @@ function tpl_actiondropdown($empty = '', $button = '>') { /** @var Input $INPUT */ global $INPUT; + $action_structure = array( + 'page_tools' => array('edit', 'revert', 'revisions', 'backlink', 'subscribe'), + 'site_tools' => array('recent', 'media', 'index'), + 'user_tools' => array('login', 'register', 'profile', 'admin'), + ); + echo '<form action="'.script().'" method="get" accept-charset="utf-8">'; echo '<div class="no">'; echo '<input type="hidden" name="id" value="'.$ID.'" />'; @@ -1624,50 +1630,17 @@ function tpl_actiondropdown($empty = '', $button = '>') { echo '<select name="do" class="edit quickselect" title="'.$lang['tools'].'">'; echo '<option value="">'.$empty.'</option>'; - echo '<optgroup label="'.$lang['page_tools'].'">'; - $act = tpl_get_action('edit'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('revert'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('revisions'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('backlink'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('subscribe'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - echo '</optgroup>'; - - echo '<optgroup label="'.$lang['site_tools'].'">'; - $act = tpl_get_action('recent'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('media'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('index'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - echo '</optgroup>'; - - echo '<optgroup label="'.$lang['user_tools'].'">'; - $act = tpl_get_action('login'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('register'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('profile'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - - $act = tpl_get_action('admin'); - if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; - echo '</optgroup>'; + foreach($action_structure as $tools => $actions) { + echo '<optgroup label="'.$lang[$tools].'">'; + foreach($actions as $action) { + $act = tpl_get_action($action); + if($act) echo '<option value="'.$act['params']['do'].'">'.$lang['btn_'.$act['type']].'</option>'; + } + echo '</optgroup>'; + } echo '</select>'; - echo '<input type="submit" value="'.$button.'" />'; + echo '<button type="submit">'.$button.'</button>'; echo '</div>'; echo '</form>'; } |