From 8e4da260f71ec0ef3b8559d38fc3f8f22208ec0f Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 4 Mar 2010 11:05:20 +0100 Subject: Output common parts of edit forms before the event --- inc/html.php | 133 +++++++++++++++++++++++++++++++---------------------------- 1 file changed, 69 insertions(+), 64 deletions(-) diff --git a/inc/html.php b/inc/html.php index f6f73142c..99fa4a9ce 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; - ?> - - - -
- -
-
-
- -
- '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 .= ''; - $form->addElement($out); - $form->addElement(form_makeCloseTag('div')); - } - html_form('edit', $form); - print '
'.NL; + } + $form->addElement(form_makeCloseTag('div')); + if($wr && $conf['license']){ + $form->addElement(form_makeOpenTag('div', array('class'=>'license'))); + $out = $lang['licenseok']; + $out .= ''; + $form->addElement($out); + $form->addElement(form_makeCloseTag('div')); + } + + if ($wr) { + // sets changed to true when previewed + echo ''; + } ?> +
+ +
+
+
+ +
+ '.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)); } /** -- cgit v1.2.3