summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichael <michael@content-space.de>2008-10-12 18:27:32 +0200
committermichael <michael@content-space.de>2008-10-12 18:27:32 +0200
commitabdcc39f43938df72d22c688c8e8f7d92b47e018 (patch)
tree12990918f1cec8a2fc639fae9a5ae33a3e489d05
parentc00de5466db3d6104eec84be1c2bd55afa6b86fa (diff)
downloadrpg-abdcc39f43938df72d22c688c8e8f7d92b47e018.tar.gz
rpg-abdcc39f43938df72d22c688c8e8f7d92b47e018.tar.bz2
Changed html_recent() to use Doku_Form, FS#135
html_recent() uses Doku_Form now, this makes it possible that action-plugins can customize the recent changes view as suggested in FS#135. darcs-hash:20081012162732-074e0-ed776be1229177c5a8bd31540002afb2da9b3d31.gz
-rw-r--r--inc/html.php112
-rw-r--r--inc/template.php4
2 files changed, 70 insertions, 46 deletions
diff --git a/inc/html.php b/inc/html.php
index 73e47bf2b..b9c6138b2 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -546,68 +546,88 @@ function html_recent($first=0){
if (getNS($ID) != '')
print '<div class="level1"><p>' . sprintf($lang['recent_global'], getNS($ID), wl('', 'do=recent')) . '</p></div>';
- print '<ul>';
+ $form = new Doku_Form('dw__recent', script(), 'get');
+ $form->addHidden('sectok', null);
+ $form->addHidden('do', 'recent');
+ $form->addHidden('id', $ID);
+ $form->addElement(form_makeOpenTag('ul'));
foreach($recents as $recent){
$date = strftime($conf['dformat'],$recent['date']);
- print ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) ? '<li class="minor">' : '<li>';
- print '<div class="li">';
-
- print $date.' ';
-
- print '<a href="'.wl($recent['id'],"do=diff").'">';
- $p = array();
- $p['src'] = DOKU_BASE.'lib/images/diff.png';
- $p['width'] = 15;
- $p['height'] = 11;
- $p['title'] = $lang['diff'];
- $p['alt'] = $lang['diff'];
- $att = buildAttributes($p);
- print "<img $att />";
- print '</a> ';
-
- print '<a href="'.wl($recent['id'],"do=revisions").'">';
- $p = array();
- $p['src'] = DOKU_BASE.'lib/images/history.png';
- $p['width'] = 12;
- $p['height'] = 14;
- $p['title'] = $lang['btn_revs'];
- $p['alt'] = $lang['btn_revs'];
- $att = buildAttributes($p);
- print "<img $att />";
- print '</a> ';
-
- print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']);
- print ' &ndash; '.htmlspecialchars($recent['sum']);
-
- print ' <span class="user">';
+ if ($recent['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
+ $form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
+ else
+ $form->addElement(form_makeOpenTag('li'));
+
+ $form->addElement(form_makeOpenTag('div', array('class' => 'li')));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'date')));
+ $form->addElement($date);
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => wl($recent['id'],"do=diff"))));
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/diff.png',
+ 'width' => 15,
+ 'height'=> 11,
+ 'title' => $lang['diff'],
+ 'alt' => $lang['diff']
+ )));
+ $form->addElement(form_makeCloseTag('a'));
+
+ $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => wl($recent['id'],"do=revisions"))));
+ $form->addElement(form_makeTag('img', array(
+ 'src' => DOKU_BASE.'lib/images/history.png',
+ 'width' => 12,
+ 'height'=> 14,
+ 'title' => $lang['btn_revs'],
+ 'alt' => $lang['btn_revs']
+ )));
+ $form->addElement(form_makeCloseTag('a'));
+
+ $form->addElement(html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
+ $form->addElement(' &ndash; '.htmlspecialchars($recent['sum']));
+ $form->addElement(form_makeCloseTag('span'));
+
+ $form->addElement(form_makeOpenTag('span', array('class' => 'user')));
if($recent['user']){
- print editorinfo($recent['user']);
+ $form->addElement(editorinfo($recent['user']));
}else{
- print $recent['ip'];
+ $form->addElement($recent['ip']);
}
- print '</span>';
+ $form->addElement(form_makeCloseTag('span'));
- print '</div>';
- print '</li>';
+ $form->addElement(form_makeCloseTag('div'));
+ $form->addElement(form_makeCloseTag('li'));
}
- print '</ul>';
+ $form->addElement(form_makeCloseTag('ul'));
- print '<div class="pagenav">';
+ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav')));
$last = $first + $conf['recent'];
if ($first > 0) {
$first -= $conf['recent'];
if ($first < 0) $first = 0;
- print '<div class="pagenav-prev">';
- print html_btn('newer','',"p",array('do' => 'recent', 'first' => $first));
- print '</div>';
+ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-prev')));
+ $form->addElement(form_makeTag('input', array(
+ 'type' => 'submit',
+ 'name' => 'first['.$first.']',
+ 'value' => $lang['btn_newer']
+ )));
+ $form->addElement(form_makeCloseTag('div'));
}
if ($hasNext) {
- print '<div class="pagenav-next">';
- print html_btn('older','',"n",array('do' => 'recent', 'first' => $last));
- print '</div>';
+ $form->addElement(form_makeOpenTag('div', array('class' => 'pagenav-next')));
+ $form->addElement(form_makeTag('input', array(
+ 'type' => 'submit',
+ 'name' => 'first['.$last.']',
+ 'value' => $lang['btn_older']
+ )));
+ $form->addElement(form_makeCloseTag('div'));
}
- print '</div>';
+ $form->addElement(form_makeCloseTag('div'));
+ html_form('recent', $form);
}
/**
diff --git a/inc/template.php b/inc/template.php
index 0b6e245ac..1385c7547 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -88,6 +88,10 @@ function tpl_content_core(){
html_diff();
break;
case 'recent':
+ if (is_array($_REQUEST['first'])) {
+ $_REQUEST['first'] = array_keys($_REQUEST['first']);
+ $_REQUEST['first'] = $_REQUEST['first'][0];
+ }
$first = is_numeric($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
html_recent($first);
break;