diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/html.php | 61 | ||||
-rw-r--r-- | inc/parser/handler.php | 5 | ||||
-rw-r--r-- | inc/parser/renderer.php | 2 | ||||
-rw-r--r-- | inc/parser/xhtml.php | 3 |
4 files changed, 50 insertions, 21 deletions
diff --git a/inc/html.php b/inc/html.php index 29dddbe74..8a215f440 100644 --- a/inc/html.php +++ b/inc/html.php @@ -91,14 +91,18 @@ function html_secedit_button($matches){ global $ID; global $INFO; - $section = $matches[2]; - $name = $matches[1]; + $edittarget = ($matches[1] === 'SECTION') ? 'plain' : + strtolower($matches[1]); + + $section = $matches[3]; + $name = $matches[2]; $secedit = ''; - $secedit .= '<div class="secedit">'; + $secedit .= '<div class="secedit editbutton_' . $edittarget . '">'; $secedit .= html_btn('secedit',$ID,'', array('do' => 'edit', - 'lines' => "$section", + 'lines' => $section, + 'edittarget' => $edittarget, 'rev' => $INFO['lastmod']), 'post', $name); $secedit .= '</div>'; @@ -113,11 +117,13 @@ function html_secedit_button($matches){ function html_secedit($text,$show=true){ global $INFO; + $regexp = '#<!-- ([A-Z]+) (?:"(.*)" )?\[(\d+-\d*)\] -->#'; + if($INFO['writable'] && $show && !$INFO['rev']){ - $text = preg_replace_callback('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#', + $text = preg_replace_callback($regexp, 'html_secedit_button', $text); }else{ - $text = preg_replace('#<!-- SECTION "(.*?)" \[(\d+-\d*)\] -->#','',$text); + $text = preg_replace($regexp,'',$text); } return $text; @@ -181,7 +187,7 @@ function html_btn($name,$id,$akey,$params,$method='get',$tooltip=''){ $tip = htmlspecialchars($label); } - $ret .= '<input type="submit" value="'.htmlspecialchars($label).'" class="button" '; + $ret .= '<input type="submit" value="'.hsc($label).'" class="button" '; if($akey){ $tip .= ' ['.strtoupper($akey).']'; $ret .= 'accesskey="'.$akey.'" '; @@ -1104,11 +1110,9 @@ function html_updateprofile(){ } /** - * This displays the edit form (lots of logic included) + * Preprocess edit form data * - * @fixme this is a huge lump of code and should be modularized * @triggers HTML_PAGE_FROMTEMPLATE - * @triggers HTML_EDITFORM_INJECTION * @author Andreas Gohr <andi@splitbrain.org> */ function html_edit($text=null,$include='edit'){ //FIXME: include needed? @@ -1122,7 +1126,6 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? global $SUM; global $lang; global $conf; - global $license; //set summary default if(!$SUM){ @@ -1176,20 +1179,44 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? print p_locale_xhtml('read'); } if(!$DATE) $DATE = $INFO['lastmod']; - ?> - <div style="width:99%;"> - <div class="toolbar"> - <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.dformat();?></div> - <div id="tool__bar"><?php if($wr){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>" - target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div> + $data = compact('wr', 'text', 'mod', 'check'); + trigger_event('HTML_EDIT_FORMSELECTION', $data, 'html_edit_form', true); +} +/** + * Display the default edit form + * + * Is the default action for HTML_EDIT_FORMSELECTION. + * + * @triggers HTML_EDITFORM_OUTPUT + */ +function html_edit_form($param) { + extract($param); + global $conf; + global $license; + global $lang; + global $REV; + global $DATE; + global $PRE; + global $SUF; + global $INFO; + global $SUM; + global $ID; + ?> <?php if($wr){?> <script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!-- <?php /* sets changed to true when previewed */?> textChanged = <?php ($mod) ? print 'true' : print 'false' ?>; //--><!]]></script> <?php } ?> + <div style="width:99%;"> + + <div class="toolbar"> + <div id="draft__status"><?php if(!empty($INFO['draft'])) echo $lang['draftdate'].' '.dformat();?></div> + <div id="tool__bar"><?php if($wr){?><a href="<?php echo DOKU_BASE?>lib/exe/mediamanager.php?ns=<?php echo $INFO['namespace']?>" + target="_blank"><?php echo $lang['mediaselect'] ?></a><?php }?></div> + </div> <?php $form = new Doku_Form(array('id' => 'dw__editform')); diff --git a/inc/parser/handler.php b/inc/parser/handler.php index eaa42f9bf..ea5a69b35 100644 --- a/inc/parser/handler.php +++ b/inc/parser/handler.php @@ -589,10 +589,11 @@ class Doku_Handler { } else { $this->_addCall('tablecell', array(), $pos); } + $this->status['table_begin'] = $pos; break; case DOKU_LEXER_EXIT: - $this->_addCall('table_end', array(), $pos); + $this->_addCall('table_end', array($this->status['table_begin']+1, $pos), $pos); $this->CallWriter->process(); $ReWriter = & $this->CallWriter; $this->CallWriter = & $ReWriter->CallWriter; @@ -1222,7 +1223,7 @@ class Doku_Handler_Table { } function tableEnd($call) { - $this->tableCalls[] = array('table_close',array(),$call[2]); + $this->tableCalls[] = array('table_close',$call[1],$call[2]); $this->finalizeTable(); } diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php index 6082e935d..65dcaf8a1 100644 --- a/inc/parser/renderer.php +++ b/inc/parser/renderer.php @@ -233,7 +233,7 @@ class Doku_Renderer extends DokuWiki_Plugin { function table_open($maxcols = NULL, $numrows = NULL){} - function table_close(){} + function table_close($begin, $end){} function tablerow_open(){} diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 20acf4281..4e848ec1d 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -851,8 +851,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer { $this->doc .= '<table class="inline">'.DOKU_LF; } - function table_close(){ + function table_close($begin, $end){ $this->doc .= '</table>'.DOKU_LF; + $this->doc .= '<!-- TABLE ['. $begin .'-'.$end.'] -->'; } function tablerow_open(){ |