diff --git a/inc/html.php b/inc/html.php index f6f73142c00648a3056bc4eabe6ea348f9f6fa60..99fa4a9ce9ce6e0f328bc10038c5b9edc0c3810e 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1195,19 +1195,6 @@ function html_edit($text=null,$include='edit'){ //FIXME: include needed? } if(!$DATE) $DATE = $INFO['lastmod']; - $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; @@ -1218,59 +1205,77 @@ function html_edit_form($param) { 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')); - $form->addHidden('id', $ID); - $form->addHidden('rev', $REV); - $form->addHidden('date', $DATE); - $form->addHidden('prefix', $PRE); - $form->addHidden('suffix', $SUF); - $form->addHidden('changecheck', $check); - $attr = array('tabindex'=>'1'); - if (!$wr) $attr['readonly'] = 'readonly'; - $form->addElement(form_makeWikiText($text, $attr)); - $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar'))); - $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl'))); + + $form = new Doku_Form(array('id' => 'dw__editform')); + $form->addHidden('id', $ID); + $form->addHidden('rev', $REV); + $form->addHidden('date', $DATE); + $form->addHidden('prefix', $PRE); + $form->addHidden('suffix', $SUF); + $form->addHidden('changecheck', $check); + + $data = compact('wr', 'text', 'form'); + $data['media_manager'] = true; + trigger_event('HTML_EDIT_FORMSELECTION', $data, 'html_edit_form', true); + + $form->addElement(form_makeOpenTag('div', array('id'=>'wiki__editbar'))); + $form->addElement(form_makeOpenTag('div', array('id'=>'size__ctl'))); + $form->addElement(form_makeCloseTag('div')); + if ($wr) { + $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons'))); + $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4'))); + $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5'))); + $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6'))); $form->addElement(form_makeCloseTag('div')); - if ($wr) { - $form->addElement(form_makeOpenTag('div', array('class'=>'editButtons'))); - $form->addElement(form_makeButton('submit', 'save', $lang['btn_save'], array('id'=>'edbtn__save', 'accesskey'=>'s', 'tabindex'=>'4'))); - $form->addElement(form_makeButton('submit', 'preview', $lang['btn_preview'], array('id'=>'edbtn__preview', 'accesskey'=>'p', 'tabindex'=>'5'))); - $form->addElement(form_makeButton('submit', 'draftdel', $lang['btn_cancel'], array('tabindex'=>'6'))); - $form->addElement(form_makeCloseTag('div')); - $form->addElement(form_makeOpenTag('div', array('class'=>'summary'))); - $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2'))); - $elem = html_minoredit(); - if ($elem) $form->addElement($elem); - $form->addElement(form_makeCloseTag('div')); - } + $form->addElement(form_makeOpenTag('div', array('class'=>'summary'))); + $form->addElement(form_makeTextField('summary', $SUM, $lang['summary'], 'edit__summary', 'nowrap', array('size'=>'50', 'tabindex'=>'2'))); + $elem = html_minoredit(); + if ($elem) $form->addElement($elem); $form->addElement(form_makeCloseTag('div')); - if($wr && $conf['license']){ - $form->addElement(form_makeOpenTag('div', array('class'=>'license'))); - $out = $lang['licenseok']; - $out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"'; - if(isset($conf['target']['external'])) $out .= ' target="'.$conf['target']['external'].'"'; - $out .= '> '.$license[$conf['license']]['name'].'</a>'; - $form->addElement($out); - $form->addElement(form_makeCloseTag('div')); - } - html_form('edit', $form); - print '</div>'.NL; + } + $form->addElement(form_makeCloseTag('div')); + if($wr && $conf['license']){ + $form->addElement(form_makeOpenTag('div', array('class'=>'license'))); + $out = $lang['licenseok']; + $out .= '<a href="'.$license[$conf['license']]['url'].'" rel="license" class="urlextern"'; + if(isset($conf['target']['external'])) $out .= ' target="'.$conf['target']['external'].'"'; + $out .= '> '.$license[$conf['license']]['name'].'</a>'; + $form->addElement($out); + $form->addElement(form_makeCloseTag('div')); + } + + if ($wr) { + // sets changed to true when previewed + echo '<script type="text/javascript" charset="utf-8"><!--//--><![CDATA[//><!--'; + echo 'textChanged = ' . ($mod ? 'true' : 'false'); + echo '//--><!]]></script>'; + } ?> + <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 && $data['media_manager']){?><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 + + html_form('edit', $form); + print '</div>'.NL; +} + +/** + * Display the default edit form + * + * Is the default action for HTML_EDIT_FORMSELECTION. + * + * @triggers HTML_EDITFORM_OUTPUT + */ +function html_edit_form($param) { + extract($param); + $attr = array('tabindex'=>'1'); + if (!$wr) $attr['readonly'] = 'readonly'; + $form->addElement(form_makeWikiText($text, $attr)); } /**