summaryrefslogtreecommitdiff
path: root/inc/html.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/html.php')
-rw-r--r--inc/html.php417
1 files changed, 302 insertions, 115 deletions
diff --git a/inc/html.php b/inc/html.php
index 6e187ebe1..1a2d7daef 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -415,20 +415,28 @@ function html_locked(){
*
* @author Andreas Gohr <andi@splitbrain.org>
* @author Ben Coburn <btcoburn@silicodon.net>
+ * @author Kate Arzamastseva <pshns@ukr.net>
*/
-function html_revisions($first=0){
+function html_revisions($first=0, $media_id = false){
global $ID;
global $INFO;
global $conf;
global $lang;
+ $id = $ID;
/* we need to get one additionally log entry to be able to
* decide if this is the last page or is there another one.
* see html_recent()
*/
- $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ if (!$media_id) $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ else {
+ $revisions = getRevisions($media_id, $first, $conf['recent']+1, 8192, true);
+ $id = $media_id;
+ }
+
if(count($revisions)==0 && $first!=0){
$first=0;
- $revisions = getRevisions($ID, $first, $conf['recent']+1);;
+ if (!$media_id) $revisions = getRevisions($ID, $first, $conf['recent']+1);
+ else $revisions = getRevisions($media_id, $first, $conf['recent']+1, 8192, true);
}
$hasNext = false;
if (count($revisions)>$conf['recent']) {
@@ -436,14 +444,22 @@ function html_revisions($first=0){
array_pop($revisions); // remove extra log entry
}
- $date = dformat($INFO['lastmod']);
+ if (!$media_id) $date = dformat($INFO['lastmod']);
+ else $date = dformat(@filemtime(mediaFN($id)));
+
+ if (!$media_id) print p_locale_xhtml('revisions');
- print p_locale_xhtml('revisions');
+ $params = array('id' => 'page__revisions');
+ if ($media_id) $params['action'] = media_managerURL(array('image' => $media_id), '&');
- $form = new Doku_Form(array('id' => 'page__revisions'));
+ $form = new Doku_Form($params);
$form->addElement(form_makeOpenTag('ul'));
- if($INFO['exists'] && $first==0){
- if (isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
+
+ if (!$media_id) $exists = $INFO['exists'];
+ else $exists = @file_exists(mediaFN($id));
+
+ if($exists && $first==0){
+ if (!$media_id && isset($INFO['meta']) && isset($INFO['meta']['last_change']) && $INFO['meta']['last_change']['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
else
$form->addElement(form_makeOpenTag('li'));
@@ -459,30 +475,53 @@ function html_revisions($first=0){
$form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />');
+ if (!$media_id) $href = wl($id);
+ else $href = media_managerURL(array('image' => $id, 'tab_details' => 'view'), '&');
$form->addElement(form_makeOpenTag('a', array(
'class' => 'wikilink1',
- 'href' => wl($ID))));
- $form->addElement($ID);
+ 'href' => $href)));
+ $form->addElement($id);
$form->addElement(form_makeCloseTag('a'));
- $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
- $form->addElement(' &ndash; ');
- $form->addElement(htmlspecialchars($INFO['sum']));
- $form->addElement(form_makeCloseTag('span'));
+ if ($media_id) $form->addElement(form_makeOpenTag('div'));
+
+ if (!$media_id) {
+ $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
+ $form->addElement(' &ndash; ');
+ $form->addElement(htmlspecialchars($INFO['sum']));
+ $form->addElement(form_makeCloseTag('span'));
+ }
$form->addElement(form_makeOpenTag('span', array('class' => 'user')));
- $form->addElement((empty($INFO['editor']))?('('.$lang['external_edit'].')'):editorinfo($INFO['editor']));
+ if (!$media_id) $editor = $INFO['editor'];
+ else {
+ $revinfo = getRevisionInfo($id, @filemtime(fullpath(mediaFN($id))), 1024, true);
+ if($revinfo['user']){
+ $editor = $revinfo['user'];
+ }else{
+ $editor = $revinfo['ip'];
+ }
+ }
+ $form->addElement((empty($editor))?('('.$lang['external_edit'].')'):editorinfo($editor));
$form->addElement(form_makeCloseTag('span'));
$form->addElement('('.$lang['current'].')');
+
+ if ($media_id) $form->addElement(form_makeCloseTag('div'));
+
$form->addElement(form_makeCloseTag('div'));
$form->addElement(form_makeCloseTag('li'));
}
foreach($revisions as $rev){
- $date = dformat($rev);
- $info = getRevisionInfo($ID,$rev,true);
- $exists = page_exists($ID,$rev);
+ $date = dformat($rev);
+ if (!$media_id) {
+ $info = getRevisionInfo($id,$rev,true);
+ $exists = page_exists($id,$rev);
+ } else {
+ $info = getRevisionInfo($id,$rev,true,true);
+ $exists = @file_exists(mediaFN($id,$rev));
+ }
if ($info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT)
$form->addElement(form_makeOpenTag('li', array('class' => 'minor')));
@@ -503,7 +542,9 @@ function html_revisions($first=0){
$form->addElement(form_makeCloseTag('span'));
if($exists){
- $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev,do=diff", false, '&'), 'class' => 'diff_link')));
+ if (!$media_id) $href = wl($id,"rev=$rev,do=diff", false, '&');
+ else $href = media_managerURL(array('image' => $id, 'rev' => $rev, 'mediado' => 'diff'), '&');
+ $form->addElement(form_makeOpenTag('a', array('href' => $href, 'class' => 'diff_link')));
$form->addElement(form_makeTag('img', array(
'src' => DOKU_BASE.'lib/images/diff.png',
'width' => 15,
@@ -511,19 +552,24 @@ function html_revisions($first=0){
'title' => $lang['diff'],
'alt' => $lang['diff'])));
$form->addElement(form_makeCloseTag('a'));
-
- $form->addElement(form_makeOpenTag('a', array('href' => wl($ID,"rev=$rev",false,'&'), 'class' => 'wikilink1')));
- $form->addElement($ID);
+ if (!$media_id) $href = wl($id,"rev=$rev",false,'&');
+ else $href = media_managerURL(array('image' => $id, 'tab_details' => 'view', 'rev' => $rev), '&');
+ $form->addElement(form_makeOpenTag('a', array('href' => $href, 'class' => 'wikilink1')));
+ $form->addElement($id);
$form->addElement(form_makeCloseTag('a'));
}else{
$form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />');
- $form->addElement($ID);
+ $form->addElement($id);
}
- $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
- $form->addElement(' &ndash; ');
- $form->addElement(htmlspecialchars($info['sum']));
- $form->addElement(form_makeCloseTag('span'));
+ if ($media_id) $form->addElement(form_makeOpenTag('div'));
+
+ if ($info['sum']) {
+ $form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
+ if (!$media_id) $form->addElement(' &ndash; ');
+ $form->addElement(htmlspecialchars($info['sum']));
+ $form->addElement(form_makeCloseTag('span'));
+ }
$form->addElement(form_makeOpenTag('span', array('class' => 'user')));
if($info['user']){
@@ -536,11 +582,18 @@ function html_revisions($first=0){
}
$form->addElement(form_makeCloseTag('span'));
+ if ($media_id) $form->addElement(form_makeCloseTag('div'));
+
$form->addElement(form_makeCloseTag('div'));
$form->addElement(form_makeCloseTag('li'));
}
$form->addElement(form_makeCloseTag('ul'));
- $form->addElement(form_makeButton('submit', 'diff', $lang['diff2']));
+ if (!$media_id) {
+ $form->addElement(form_makeButton('submit', 'diff', $lang['diff2']));
+ } else {
+ $form->addHidden('mediado', 'diff');
+ $form->addElement(form_makeButton('submit', '', $lang['diff2']));
+ }
html_form('revisions', $form);
print '<div class="pagenav">';
@@ -549,12 +602,20 @@ function html_revisions($first=0){
$first -= $conf['recent'];
if ($first < 0) $first = 0;
print '<div class="pagenav-prev">';
- print html_btn('newer',$ID,"p",array('do' => 'revisions', 'first' => $first));
+ if ($media_id) {
+ print html_btn('newer',$media_id,"p",media_managerURL(array('first' => $first), '&amp;', false, true));
+ } else {
+ print html_btn('newer',$id,"p",array('do' => 'revisions', 'first' => $first));
+ }
print '</div>';
}
if ($hasNext) {
print '<div class="pagenav-next">';
- print html_btn('older',$ID,"n",array('do' => 'revisions', 'first' => $last));
+ if ($media_id) {
+ print html_btn('older',$media_id,"n",media_managerURL(array('first' => $last), '&amp;', false, true));
+ } else {
+ print html_btn('older',$id,"n",array('do' => 'revisions', 'first' => $last));
+ }
print '</div>';
}
print '</div>';
@@ -567,8 +628,9 @@ function html_revisions($first=0){
* @author Andreas Gohr <andi@splitbrain.org>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
* @author Ben Coburn <btcoburn@silicodon.net>
+ * @author Kate Arzamastseva <pshns@ukr.net>
*/
-function html_recent($first=0){
+function html_recent($first=0, $show_changes='both'){
global $conf;
global $lang;
global $ID;
@@ -576,10 +638,20 @@ function html_recent($first=0){
* decide if this is the last page or is there another one.
* This is the cheapest solution to get this information.
*/
- $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
+ $flags = 0;
+ if ($show_changes == 'mediafiles' && $conf['mediarevisions']) {
+ $flags = RECENTS_MEDIA_CHANGES;
+ } elseif ($show_changes == 'pages') {
+ $flags = 0;
+ } elseif ($conf['mediarevisions']) {
+ $show_changes = 'both';
+ $flags = RECENTS_MEDIA_PAGES_MIXED;
+ }
+
+ $recents = getRecents($first,$conf['recent'] + 1,getNS($ID),$flags);
if(count($recents) == 0 && $first != 0){
$first=0;
- $recents = getRecents($first,$conf['recent'] + 1,getNS($ID));
+ $recents = getRecents($first,$conf['recent'] + 1,getNS($ID),$flags);
}
$hasNext = false;
if (count($recents)>$conf['recent']) {
@@ -596,6 +668,22 @@ function html_recent($first=0){
$form->addHidden('sectok', null);
$form->addHidden('do', 'recent');
$form->addHidden('id', $ID);
+
+ if ($conf['mediarevisions']) {
+ $form->addElement(form_makeListboxField(
+ 'show_changes',
+ array(
+ 'pages' => $lang['pages_changes'],
+ 'mediafiles' => $lang['media_changes'],
+ 'both' => $lang['both_changes']),
+ $show_changes,
+ $lang['changes_type'],
+ '','',
+ array('class'=>'quickselect')));
+
+ $form->addElement(form_makeButton('submit', 'recent', $lang['btn_apply']));
+ }
+
$form->addElement(form_makeOpenTag('ul'));
foreach($recents as $recent){
@@ -607,21 +695,48 @@ function html_recent($first=0){
$form->addElement(form_makeOpenTag('div', array('class' => 'li')));
+ if ($recent['media']) {
+ $form->addElement(media_printicon($recent['id']));
+ } else {
+ $icon = DOKU_BASE.'lib/images/fileicons/file.png';
+ $form->addElement('<img src="'.$icon.'" alt="'.$filename.'" class="icon" />');
+ }
+
$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", false, '&'))));
- $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'));
+ if ($recent['media']) {
+ $diff = (count(getRevisions($recent['id'], 0, 1, 8192, true)) && @file_exists(mediaFN($recent['id'])));
+ if ($diff) {
+ $href = media_managerURL(array('tab_details' => 'history',
+ 'mediado' => 'diff', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&');
+ }
+ } else {
+ $href = wl($recent['id'],"do=diff", false, '&');
+ }
- $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => wl($recent['id'],"do=revisions",false,'&'))));
+ if ($recent['media'] && !$diff) {
+ $form->addElement('<img src="'.DOKU_BASE.'lib/images/blank.gif" width="15" height="11" alt="" />');
+ } else {
+ $form->addElement(form_makeOpenTag('a', array('class' => 'diff_link', 'href' => $href)));
+ $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'));
+ }
+
+ if ($recent['media']) {
+ $href = media_managerURL(array('tab_details' => 'history',
+ 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&');
+ } else {
+ $href = wl($recent['id'],"do=revisions",false,'&');
+ }
+ $form->addElement(form_makeOpenTag('a', array('class' => 'revisions_link', 'href' => $href)));
$form->addElement(form_makeTag('img', array(
'src' => DOKU_BASE.'lib/images/history.png',
'width' => 12,
@@ -631,8 +746,15 @@ function html_recent($first=0){
)));
$form->addElement(form_makeCloseTag('a'));
- $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?null:$recent['id']));
-
+ if ($recent['media']) {
+ $href = media_managerURL(array('tab_details' => 'view', 'image' => $recent['id'], 'ns' => getNS($recent['id'])), '&');
+ $class = (file_exists(mediaFN($recent['id']))) ? 'wikilink1' : $class = 'wikilink2';
+ $form->addElement(form_makeOpenTag('a', array('class' => $class, 'href' => $href)));
+ $form->addElement($recent['id']);
+ $form->addElement(form_makeCloseTag('a'));
+ } else {
+ $form->addElement(html_wikilink(':'.$recent['id'],useHeading('navigation')?null:$recent['id']));
+ }
$form->addElement(form_makeOpenTag('span', array('class' => 'sum')));
$form->addElement(' &ndash; '.htmlspecialchars($recent['sum']));
$form->addElement(form_makeCloseTag('span'));
@@ -665,7 +787,7 @@ function html_recent($first=0){
'value' => $lang['btn_newer'],
'accesskey' => 'n',
'title' => $lang['btn_newer'].' [N]',
- 'class' => 'button'
+ 'class' => 'button show'
)));
$form->addElement(form_makeCloseTag('div'));
}
@@ -677,7 +799,7 @@ function html_recent($first=0){
'value' => $lang['btn_older'],
'accesskey' => 'p',
'title' => $lang['btn_older'].' [P]',
- 'class' => 'button'
+ 'class' => 'button show'
)));
$form->addElement(form_makeCloseTag('div'));
}
@@ -737,7 +859,7 @@ function html_list_index($item){
/**
* Index List item
*
- * This user function is used in html_build_lidt to build the
+ * This user function is used in html_buildlist to build the
* <li> tags for namespaces when displaying the page index
* it gives different classes to opened or closed "folders"
*
@@ -777,34 +899,41 @@ function html_li_default($item){
*
* @author Andreas Gohr <andi@splitbrain.org>
*/
-function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
- $level = 0;
- $opens = 0;
+function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapper=false){
+ if (count($data) === 0) {
+ return '';
+ }
+
+ $start_level = $data[0]['level'];
+ $level = $start_level;
$ret = '';
+ $open = 0;
foreach ($data as $item){
if( $item['level'] > $level ){
//open new list
for($i=0; $i<($item['level'] - $level); $i++){
- if ($i) $ret .= "<li class=\"clear\">\n";
+ if ($i) $ret .= "<li class=\"clear\">";
$ret .= "\n<ul class=\"$class\">\n";
+ $open++;
}
+ $level = $item['level'];
+
}elseif( $item['level'] < $level ){
//close last item
$ret .= "</li>\n";
- for ($i=0; $i<($level - $item['level']); $i++){
+ while( $level > $item['level'] && $open > 0 ){
//close higher lists
$ret .= "</ul>\n</li>\n";
+ $level--;
+ $open--;
}
- }else{
- //close last item
+ } elseif ($ret !== '') {
+ //close previous item
$ret .= "</li>\n";
}
- //remember current level
- $level = $item['level'];
-
//print item
$ret .= call_user_func($lifunc,$item);
$ret .= '<div class="li">';
@@ -814,8 +943,15 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){
}
//close remaining items and lists
- for ($i=0; $i < $level; $i++){
- $ret .= "</li></ul>\n";
+ $ret .= "</li>\n";
+ while($open-- > 0) {
+ $ret .= "</ul></li>\n";
+ }
+
+ if ($forcewrapper || $start_level < 2) {
+ // Trigger building a wrapper ul if the first level is
+ // 0 (we have a root object) or 1 (just the root content)
+ $ret = "\n<ul class=\"$class\">\n".$ret."</ul>\n";
}
return $ret;
@@ -849,6 +985,76 @@ function html_backlinks(){
}
}
+function html_diff_head($l_rev, $r_rev, $id = null, $media = false) {
+ global $lang;
+ if ($id === null) {
+ global $ID;
+ $id = $ID;
+ }
+ $media_or_wikiFN = $media ? 'mediaFN' : 'wikiFN';
+ $ml_or_wl = $media ? 'ml' : 'wl';
+ $l_minor = $r_minor = '';
+
+ if(!$l_rev){
+ $l_head = '&mdash;';
+ }else{
+ $l_info = getRevisionInfo($id,$l_rev,true, $media);
+ if($l_info['user']){
+ $l_user = editorinfo($l_info['user']);
+ if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')';
+ } else {
+ $l_user = $l_info['ip'];
+ }
+ $l_user = '<span class="user">'.$l_user.'</span>';
+ $l_sum = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : '';
+ if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
+
+ $l_head_title = ($media) ? dformat($l_rev) : $id.' ['.dformat($l_rev).']';
+ $l_head = '<a class="wikilink1" href="'.$ml_or_wl($id,"rev=$l_rev").'">'.
+ $l_head_title.'</a>'.
+ '<br />'.$l_user.' '.$l_sum;
+ }
+
+ if($r_rev){
+ $r_info = getRevisionInfo($id,$r_rev,true, $media);
+ if($r_info['user']){
+ $r_user = editorinfo($r_info['user']);
+ if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')';
+ } else {
+ $r_user = $r_info['ip'];
+ }
+ $r_user = '<span class="user">'.$r_user.'</span>';
+ $r_sum = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : '';
+ if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
+
+ $r_head_title = ($media) ? dformat($r_rev) : $id.' ['.dformat($r_rev).']';
+ $r_head = '<a class="wikilink1" href="'.$ml_or_wl($id,"rev=$r_rev").'">'.
+ $r_head_title.'</a>'.
+ '<br />'.$r_user.' '.$r_sum;
+ }elseif($_rev = @filemtime($media_or_wikiFN($id))){
+ $_info = getRevisionInfo($id,$_rev,true, $media);
+ if($_info['user']){
+ $_user = editorinfo($_info['user']);
+ if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')';
+ } else {
+ $_user = $_info['ip'];
+ }
+ $_user = '<span class="user">'.$_user.'</span>';
+ $_sum = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : '';
+ if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
+
+ $r_head_title = ($media) ? dformat($_rev) : $id.' ['.dformat($_rev).']';
+ $r_head = '<a class="wikilink1" href="'.$ml_or_wl($id).'">'.
+ $r_head_title.'</a> '.
+ '('.$lang['current'].')'.
+ '<br />'.$_user.' '.$_sum;
+ }else{
+ $r_head = '&mdash; ('.$lang['current'].')';
+ }
+
+ return array($l_head, $r_head, $l_minor, $r_minor);
+}
+
/**
* show diff
*
@@ -923,59 +1129,7 @@ function html_diff($text='',$intro=true,$type=null){
}
$r_text = rawWiki($ID,$r_rev);
- if(!$l_rev){
- $l_head = '&mdash;';
- }else{
- $l_info = getRevisionInfo($ID,$l_rev,true);
- if($l_info['user']){
- $l_user = editorinfo($l_info['user']);
- if(auth_ismanager()) $l_user .= ' ('.$l_info['ip'].')';
- } else {
- $l_user = $l_info['ip'];
- }
- $l_user = '<span class="user">'.$l_user.'</span>';
- $l_sum = ($l_info['sum']) ? '<span class="sum">'.hsc($l_info['sum']).'</span>' : '';
- if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"';
-
- $l_head = '<a class="wikilink1" href="'.wl($ID,"rev=$l_rev").'">'.
- $ID.' ['.dformat($l_rev).']</a>'.
- '<br />'.$l_user.' '.$l_sum;
- }
-
- if($r_rev){
- $r_info = getRevisionInfo($ID,$r_rev,true);
- if($r_info['user']){
- $r_user = editorinfo($r_info['user']);
- if(auth_ismanager()) $r_user .= ' ('.$r_info['ip'].')';
- } else {
- $r_user = $r_info['ip'];
- }
- $r_user = '<span class="user">'.$r_user.'</span>';
- $r_sum = ($r_info['sum']) ? '<span class="sum">'.hsc($r_info['sum']).'</span>' : '';
- if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
-
- $r_head = '<a class="wikilink1" href="'.wl($ID,"rev=$r_rev").'">'.
- $ID.' ['.dformat($r_rev).']</a>'.
- '<br />'.$r_user.' '.$r_sum;
- }elseif($_rev = @filemtime(wikiFN($ID))){
- $_info = getRevisionInfo($ID,$_rev,true);
- if($_info['user']){
- $_user = editorinfo($_info['user']);
- if(auth_ismanager()) $_user .= ' ('.$_info['ip'].')';
- } else {
- $_user = $_info['ip'];
- }
- $_user = '<span class="user">'.$_user.'</span>';
- $_sum = ($_info['sum']) ? '<span class="sum">'.hsc($_info['sum']).'</span>' : '';
- if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"';
-
- $r_head = '<a class="wikilink1" href="'.wl($ID).'">'.
- $ID.' ['.dformat($_rev).']</a> '.
- '('.$lang['current'].')'.
- '<br />'.$_user.' '.$_sum;
- }else{
- $r_head = '&mdash; ('.$lang['current'].')';
- }
+ list($l_head, $r_head, $l_minor, $r_minor) = html_diff_head($l_rev, $r_rev);
}
$df = new Diff(explode("\n",htmlspecialchars($l_text)),
@@ -1248,7 +1402,7 @@ function html_edit(){
$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']['extern'])) $out .= ' target="'.$conf['target']['extern'].'"';
+ if($conf['target']['extern']) $out .= ' target="'.$conf['target']['extern'].'"';
$out .= '>'.$license[$conf['license']]['name'].'</a>';
$form->addElement($out);
$form->addElement(form_makeCloseTag('div'));
@@ -1543,7 +1697,7 @@ function html_TOC($toc){
$out .= $lang['toc'];
$out .= '</div>'.DOKU_LF;
$out .= '<div id="toc__inside">'.DOKU_LF;
- $out .= html_buildlist($toc,'toc','html_list_toc');
+ $out .= html_buildlist($toc,'toc','html_list_toc','html_li_default',true);
$out .= '</div>'.DOKU_LF.'</div>'.DOKU_LF;
$out .= '<!-- TOC END -->'.DOKU_LF;
return $out;
@@ -1678,3 +1832,36 @@ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts
return $out;
}
+function html_tabs($tabs, $current_tab = null) {
+ echo '<ul class="tabs">'.NL;
+
+ foreach($tabs as $id => $tab) {
+ html_tab($tab['href'], $tab['caption'], $id === $current_tab);
+ }
+
+ echo '</ul>'.NL;
+}
+/**
+ * Prints a single tab
+ *
+ * @author Kate Arzamastseva <pshns@ukr.net>
+ * @author Adrian Lang <mail@adrianlang.de>
+ *
+ * @param string $href - tab href
+ * @param string $caption - tab caption
+ * @param boolean $selected - is tab selected
+ */
+
+function html_tab($href, $caption, $selected=false) {
+ $tab = '<li>';
+ if ($selected) {
+ $tab .= '<strong>';
+ } else {
+ $tab .= '<a href="' . hsc($href) . '">';
+ }
+ $tab .= hsc($caption)
+ . '</' . ($selected ? 'strong' : 'a') . '>'
+ . '</li>'.NL;
+ echo $tab;
+}
+