summaryrefslogtreecommitdiff
path: root/inc/html.php
diff options
context:
space:
mode:
authorAdrian Lang <lang@cosmocode.de>2010-03-04 11:05:20 +0100
committerAdrian Lang <lang@cosmocode.de>2010-03-04 11:11:33 +0100
commit8e4da260f71ec0ef3b8559d38fc3f8f22208ec0f (patch)
treed5c11dcb30efb31297b3280294ec51ec5649f612 /inc/html.php
parent620404a5dcfbccb29cd939932ecaead95b6e24cd (diff)
downloadrpg-8e4da260f71ec0ef3b8559d38fc3f8f22208ec0f.tar.gz
rpg-8e4da260f71ec0ef3b8559d38fc3f8f22208ec0f.tar.bz2
Output common parts of edit forms before the event
Diffstat (limited to 'inc/html.php')
-rw-r--r--inc/html.php133
1 files 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;
- ?>
- <?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));
}
/**