From 95b451bc621ae202d0229176ad0712b22d14c953 Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Sat, 17 Sep 2011 19:36:34 +0200 Subject: Rework media manager HTML (JS and CSS will come) --- inc/html.php | 155 +++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 102 insertions(+), 53 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 1c48d6059..66bc83127 100644 --- a/inc/html.php +++ b/inc/html.php @@ -982,6 +982,73 @@ 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 = '—'; + }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 = ''.$l_user.''; + $l_sum = ($l_info['sum']) ? ''.hsc($l_info['sum']).'' : ''; + if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"'; + + $l_head = ''. + $id.' ['.dformat($l_rev).']'. + '
'.$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 = ''.$r_user.''; + $r_sum = ($r_info['sum']) ? ''.hsc($r_info['sum']).'' : ''; + if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; + + $r_head = ''. + $id.' ['.dformat($r_rev).']'. + '
'.$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 = ''.$_user.''; + $_sum = ($_info['sum']) ? ''.hsc($_info['sum']).'' : ''; + if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; + + $r_head = ''. + $id.' ['.dformat($_rev).'] '. + '('.$lang['current'].')'. + '
'.$_user.' '.$_sum; + }else{ + $r_head = '— ('.$lang['current'].')'; + } + + return array($l_head, $r_head, $l_minor, $r_minor); +} + /** * show diff * @@ -1056,59 +1123,7 @@ function html_diff($text='',$intro=true,$type=null){ } $r_text = rawWiki($ID,$r_rev); - if(!$l_rev){ - $l_head = '—'; - }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 = ''.$l_user.''; - $l_sum = ($l_info['sum']) ? ''.hsc($l_info['sum']).'' : ''; - if ($l_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $l_minor = 'class="minor"'; - - $l_head = ''. - $ID.' ['.dformat($l_rev).']'. - '
'.$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 = ''.$r_user.''; - $r_sum = ($r_info['sum']) ? ''.hsc($r_info['sum']).'' : ''; - if ($r_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; - - $r_head = ''. - $ID.' ['.dformat($r_rev).']'. - '
'.$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 = ''.$_user.''; - $_sum = ($_info['sum']) ? ''.hsc($_info['sum']).'' : ''; - if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; - - $r_head = ''. - $ID.' ['.dformat($_rev).'] '. - '('.$lang['current'].')'. - '
'.$_user.' '.$_sum; - }else{ - $r_head = '— ('.$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)), @@ -1811,3 +1826,37 @@ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts return $out; } +function html_tabs($tabs, $current_tab = null) { + echo ''; + echo '
'; +} +/** + * Prints a single tab + * + * @author Kate Arzamastseva + * @author Adrian Lang + * + * @param string $href - tab href + * @param string $caption - tab caption + * @param boolean $selected - is tab selected + */ + +function html_tab($href, $caption, $selected=false) { + $tab = '
  • '; + if ($selected) { + $tab .= ''; + } else { + $tab .= ''; + } + $tab .= hsc($caption) + . '' + . '
  • '; + echo $tab; +} + -- cgit v1.2.3 From 699c5072ff1d0470c53299ab9a4dfbb4457e7843 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 19 Sep 2011 00:28:25 +0100 Subject: media manager: small functionality and css changes --- inc/html.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 66bc83127..8cf22de82 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1006,8 +1006,9 @@ function html_diff_head($l_rev, $r_rev, $id = null, $media = false) { $l_sum = ($l_info['sum']) ? ''.hsc($l_info['sum']).'' : ''; 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 = ''. - $id.' ['.dformat($l_rev).']'. + $l_head_title.''. '
    '.$l_user.' '.$l_sum; } @@ -1023,8 +1024,9 @@ function html_diff_head($l_rev, $r_rev, $id = null, $media = false) { $r_sum = ($r_info['sum']) ? ''.hsc($r_info['sum']).'' : ''; 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 = ''. - $id.' ['.dformat($r_rev).']'. + $r_head_title.''. '
    '.$r_user.' '.$r_sum; }elseif($_rev = @filemtime($media_or_wikiFN($id))){ $_info = getRevisionInfo($id,$_rev,true, $media); @@ -1038,8 +1040,9 @@ function html_diff_head($l_rev, $r_rev, $id = null, $media = false) { $_sum = ($_info['sum']) ? ''.hsc($_info['sum']).'' : ''; if ($_info['type']===DOKU_CHANGE_TYPE_MINOR_EDIT) $r_minor = 'class="minor"'; + $r_head_title = ($media) ? dformat($_rev) : $id.' ['.dformat($_rev).']'; $r_head = ''. - $id.' ['.dformat($_rev).'] '. + $r_head_title.' '. '('.$lang['current'].')'. '
    '.$_user.' '.$_sum; }else{ -- cgit v1.2.3 From 94add30314d7c0ed51fa78304ca342d0273b366c Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Mon, 19 Sep 2011 01:22:32 +0100 Subject: media manager: added a few newlines to the output --- inc/html.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 8cf22de82..7f5a46b93 100644 --- a/inc/html.php +++ b/inc/html.php @@ -1830,14 +1830,13 @@ function html_flashobject($swf,$width,$height,$params=null,$flashvars=null,$atts } function html_tabs($tabs, $current_tab = null) { - echo '
      '; + echo '
        '.NL; foreach($tabs as $id => $tab) { html_tab($tab['href'], $tab['caption'], $id === $current_tab); } - echo '
      '; - echo '
      '; + echo '
    '.NL; } /** * Prints a single tab @@ -1859,7 +1858,7 @@ function html_tab($href, $caption, $selected=false) { } $tab .= hsc($caption) . '' - . ''; + . ''.NL; echo $tab; } -- cgit v1.2.3 From 8767131332327095c90b4a0a59f8605842095883 Mon Sep 17 00:00:00 2001 From: Hakan Sandell Date: Sat, 15 Oct 2011 15:21:52 +0200 Subject: Fixed missing ul wrapper in TOC (FS#2328) --- inc/html.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 7f5a46b93..1658e9b4c 100644 --- a/inc/html.php +++ b/inc/html.php @@ -899,7 +899,7 @@ function html_li_default($item){ * * @author Andreas Gohr */ -function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ +function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapper=false){ if (count($data) === 0) { return ''; } @@ -907,7 +907,7 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ $start_level = $data[0]['level']; $ret = ''; - if ($start_level < 2) { + 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) --$start_level; @@ -930,8 +930,9 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default'){ //close higher lists $ret .= "\n\n"; } + $ret .= "
      \n"; } elseif ($ret !== '') { - //close last item + //close previous item $ret .= "\n"; } @@ -1694,7 +1695,7 @@ function html_TOC($toc){ $out .= $lang['toc']; $out .= ''.DOKU_LF; $out .= '
      '.DOKU_LF; - $out .= html_buildlist($toc,'toc','html_list_toc'); + $out .= html_buildlist($toc,'toc','html_list_toc','html_li_default',true); $out .= '
      '.DOKU_LF.''.DOKU_LF; $out .= ''.DOKU_LF; return $out; -- cgit v1.2.3 From 434f59213c7786053b453612347ff83abfeb8b7b Mon Sep 17 00:00:00 2001 From: Hakan Sandell Date: Mon, 17 Oct 2011 20:17:05 +0200 Subject: HTML compliant fix for missing ul wrapper in TOC (FS#2328) --- inc/html.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'inc/html.php') diff --git a/inc/html.php b/inc/html.php index 1658e9b4c..1a2d7daef 100644 --- a/inc/html.php +++ b/inc/html.php @@ -905,40 +905,35 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapp } $start_level = $data[0]['level']; - $ret = ''; - - 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) - --$start_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 .= "
    • \n"; + if ($i) $ret .= "
    • "; $ret .= "\n
        \n"; + $open++; } + $level = $item['level']; + }elseif( $item['level'] < $level ){ //close last item $ret .= "\n"; - for ($i=0; $i<($level - $item['level']); $i++){ + while( $level > $item['level'] && $open > 0 ){ //close higher lists $ret .= "
      \n
    • \n"; + $level--; + $open--; } - $ret .= "
        \n"; } elseif ($ret !== '') { //close previous item $ret .= "\n"; } - //remember current level - $level = $item['level']; - //print item $ret .= call_user_func($lifunc,$item); $ret .= '
        '; @@ -948,8 +943,15 @@ function html_buildlist($data,$class,$func,$lifunc='html_li_default',$forcewrapp } //close remaining items and lists - while(--$level >= $start_level) { - $ret .= "
      \n"; + $ret .= "\n"; + while($open-- > 0) { + $ret .= "
    \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
      \n".$ret."
    \n"; } return $ret; -- cgit v1.2.3