From: x2003bruneau Date: Sat, 15 Jul 2006 15:46:47 +0000 (+0000) Subject: Introduces a new tab structure for browsing into banana X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=92f5ea62fd125ff4be9deb8df205a036a47e1484;hp=c24c62e736e973b9d994c77f9f4828b97d0a3b79;p=banana.git Introduces a new tab structure for browsing into banana git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@110 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- diff --git a/Changelog b/Changelog index 70c5395..1b2c924 100644 --- a/Changelog +++ b/Changelog @@ -1,4 +1,5 @@ Sat, 15 Jul 2006 Florent Bruneau + * New tabbed structure * Support of Content-ID references (multipart/related) Fri, 14 Jul 2006 Florent Bruneau diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 2940852..61cc777 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -132,19 +132,19 @@ class Banana if (is_null($group)) { if (isset($banana->get['subscribe'])) { - return $banana->action_listSubs(); + return makeTable($banana->action_listSubs()); } elseif (isset($_POST['validsubs'])) { $banana->action_saveSubs(); } - return $banana->action_listGroups(); + return makeTable($banana->action_listGroups()); } elseif (is_null($artid)) { if (isset($_POST['action']) && $_POST['action'] == 'new') { - return $banana->action_doFup($group, isset($_POST['artid']) ? intval($_POST['artid']) : -1); + return makeTable($banana->action_doFup($group, isset($_POST['artid']) ? intval($_POST['artid']) : -1)); } elseif ($action == 'new') { - return $banana->action_newFup($group); + return makeTable($banana->action_newFup($group)); } else { - return $banana->action_showThread($group, isset($banana->get['first']) ? intval($banana->get['first']) : 1); + return makeTable($banana->action_showThread($group, isset($banana->get['first']) ? intval($banana->get['first']) : 1)); } } else { @@ -167,12 +167,12 @@ class Banana . '' . '' . '

'; - return $form.$res; + return makeTable($form . $res); } - return $res; + return makeTable("" . $res); case 'new': - return $banana->action_newFup($group, $artid); + return makeTable($banana->action_newFup($group, $artid)); } } @@ -182,13 +182,10 @@ class Banana $view = true; } $att = $banana->action_getAttachment($group, $artid, $banana->get['pj'], $view); - if ($att != "") { - return $res.$att; - } - return ""; + return makeTable($res . $att); } - return $res . $banana->action_showArticle($group, $artid, $partid); + return makeTable($banana->action_showArticle($group, $artid, $partid)); } } @@ -205,15 +202,14 @@ class Banana { $this->_newGroup(); - $cuts = displayshortcuts(); - $res = '

'._b_('Les forums de Banana').'

'.$cuts.$this->groups->to_html(); + $res = $this->groups->to_html(); if (count($this->newgroups->overview)) { $res .= '

'._b_('Les forums suivants ont été créés depuis ton dernier passage :').'

'; $res .= $this->newgroups->to_html(); } $this->nntp->quit(); - return $res.$cuts; + return $res; } function action_listSubs() @@ -221,8 +217,7 @@ class Banana $this->_require('groups'); $this->groups = new BananaGroups(BANANA_GROUP_ALL); - $cuts = displayshortcuts(); - $res = '

'._b_('Abonnements').'

'.$cuts.$this->groups->to_html(true).$cuts; + $res = $this->groups->to_html(true); $this->nntp->quit(); return $res; @@ -239,15 +234,13 @@ class Banana } $first = $first - ($first % $this->tmax) + 1; - - $cuts = displayshortcuts($first); - $res = '

'.$group.'

'.$cuts; - $res .= $this->spool->to_html($first, $first+$this->tmax); + $pages = displayPages($first); + $res = $pages . $this->spool->to_html($first, $first+$this->tmax) . $pages; $this->nntp->quit(); - return $res.$cuts; + return $res; } function action_showArticle($group, $id, $part) @@ -261,16 +254,14 @@ class Banana $this->spool->delid($id); } $this->nntp->quit(); - return displayshortcuts().'

'._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'

'; + return '

'._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'

'; } - $cuts = displayshortcuts(); - $res = '

'._b_('Message').'

'.$cuts; - $res .= $this->post->to_html($part); + $res = $this->post->to_html($part); $this->nntp->quit(); - return $res.$cuts; + return $res; } function action_getAttachment($group, $id, $pjid, $action) @@ -284,14 +275,14 @@ class Banana $this->spool->delid($id); } $this->nntp->quit(); - return displayshortcuts().'

'._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'

'; + return '

'._b_('Impossible d\'accéder au message. Le message a peut-être été annulé').'

'; } $this->nntp->quit(); if ($this->post->get_attachment($pjid, $action)) { return ""; } else { - return displayshortcuts().'

'._b_('Impossible d\'accéder à la pièce jointe.').'

'; + return '

'._b_('Impossible d\'accéder à la pièce jointe.').'

'; } } @@ -342,9 +333,7 @@ class Banana $this->nntp->quit(); - $cuts = displayshortcuts(); - $html = '

'._b_('Nouveau message').'

'.$cuts; - $html .= '
'; $html .= ''; @@ -370,7 +359,7 @@ class Banana $html .= ''; $html .= '
'; - return $html.$cuts; + return $html; } function action_doFup($group, $artid = -1) diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 0786659..09cd285 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -380,67 +380,97 @@ function formatFrom($text) { return preg_replace("/\\\(\(|\))/","\\1",$result); } -function displayShortcuts($first = -1) +function displayTabs() { global $banana; extract($banana->state); - $res = '
'; - $res .= ' Profil : ' . makeHREF(Array('subscribe' => 1), _b_('Abonnements')); + $res = Array(); if (function_exists('hook_shortcuts') && $cstm = hook_shortcuts()) { - $res .= ' . ' . $cstm; + $res = $cstm; } - $res .= '
'; - - $res .= 'Navigation : ' - . (is_null($group) ? 'Les forums' : makeHREF(Array(), _b_('Les forums'))); + + array_push($res, + makeHREF(Array('subscribe' => 1), _b_('Abonnements')), + is_null($group) ? Array(_b_('Les forums'), true) : makeHREF(Array(), _b_('Les forums'))); if (!is_null($group)) { - $res .= ' > ' . makeHREF(Array('group' => $group), $group); + $grplink = makeHREF(Array('group' => $group), $group); + $grpcur = Array($group, true); if (is_null($artid)) { - if (sizeof($banana->spool->overview)>$banana->tmax) { - $res .= ' > Pages'; - $res .= '
'; - $n = intval(log(count($banana->spool->overview), 10))+1; - $i = 1; - for ($ndx = 1 ; $ndx <= sizeof($banana->spool->overview) ; $ndx += $banana->tmax) { - if ($first==$ndx) { - $res .= '' . $i . ' '; - } else { - $res .= makeHREF(Array('group' => $group, - 'first' => $ndx), - $i, - $ndx . '-' . min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))) - . ' '; - } - $i++; - } - $res .= '
'; - } - if (!is_null($action)) { - if ($action == 'new') { - $res .= ' > Nouveau Message'; - } + if (@$action == 'new') { + array_push($res, $grplink, Array(_b_('Nouveau Message'), true)); + } else { + array_push($res, $grpcur); } } else { if (!is_null($action)) { - $res .= ' > ' . makeHREF(Array('group' => $group, - 'artid' => $artid), - _b_('Message')) - . ' > '; + array_push($res, + $grplink, + makeHREF(Array('group' => $group, + 'artid' => $artid), + _b_('Message'))); if ($action == 'new') { - $res .= 'Répondre'; + array_push($res, Array(_b_('Répondre'), true)); } elseif ($action == 'cancel') { - $res .= 'Annuler'; + array_push($res, Array(_b_('Annuler'), true)); } } else { - $res .= ' > Message'; + array_push($res, $grplink, Array(_b_('Message'), true)); + } + } + } + $ret = '
    '; + foreach ($res as $onglet) { + if (is_string($onglet)) { + $ret .= '
  • ' . $onglet . '
  • '; + } else { + $ret .= '
  • ' . $onglet[0] . '
  • '; + } + } + $ret .= '
'; + return $ret; +} + +function displayPages($first = -1) +{ + global $banana; + extract($banana->state); + $res = null; + if (!is_null($group) && is_null($artid) + && sizeof($banana->spool->overview)>$banana->tmax) { + $res .= '
'; + $n = intval(log(count($banana->spool->overview), 10))+1; + $i = 1; + for ($ndx = 1 ; $ndx <= sizeof($banana->spool->overview) ; $ndx += $banana->tmax) { + if ($first==$ndx) { + $res .= '' . $i . ' '; + } else { + $res .= makeHREF(Array('group' => $group, + 'first' => $ndx), + $i, + $ndx . '-' . min($ndx+$banana->tmax-1,sizeof($banana->spool->overview))) + . ' '; } + $i++; } + $res .= '
'; } - return $res.'
'; + return $res; } +function makeTable($text) +{ + return '' + . '' + . '' + . '
' + . displayTabs() + . '
' + . $text + . '
'; +} + /******************************************************************************** * FORMATTING STUFF : BODY */ diff --git a/css/banana.css b/css/banana.css index b88a278..bd24dfb 100644 --- a/css/banana.css +++ b/css/banana.css @@ -66,3 +66,53 @@ table.bicol th { table.bicol td { padding: 0px 4px; } +table.cadre_a_onglet{ + width: 100%; + border-width: 0; + padding : 0; + margin: 0; +} + +td.conteneur_tab { + border-width : 1px 2px 2px 1px; + border-style : solid; + border-color : #a2c2e1; + padding : 4px 4px 4px 4px; +} + +#onglet { + display : block; + margin : 0; + padding : 0; +} + +#onglet li { + display : block; + float : left; + padding : 0.4ex; + margin : 0 0.3ex -1px 0; + background : #eee; + border-width : 1px 1px 0px 1px; + border-style : solid; + border-color : #a2c2e1; + border-bottom-color : #a2c2e1; + width: auto; + height: 5ex; + text-align: center; +} + +#onglet li:hover { background : #fc3; } + +#onglet li.actif { + background-color: #fff; + border-bottom-color : #eceade; +} + +#onglet li a { + font-size: 80%; + font-weight : normal; + text-decoration : none; +} + +#onglet li a:hover { text-decoration: underline; } +#onglet li img { margin-right : 2px; } diff --git a/css/style.css b/css/style.css index 004b3c4..9b48a5c 100644 --- a/css/style.css +++ b/css/style.css @@ -6,17 +6,11 @@ * Copyright: See COPYING files that comes with this distribution ********************************************************************************/ -div.banana_scuts { - text-align: left; - padding: 0.5em 0em; -} -div.banana_scuts .title { - font-weight: bold; -} -div.banana_scuts .pages { +div.pages { font-size: 80%; text-align: center; padding-top: 0.1em; + padding-bottom: 0.1em; } div.banana_action { float: right; } div.banana_menu { float: left; }