Author: dgoette Date: Fri May 29 19:21:32 2009 New Revision: 424
URL: http://svn.reactos.org/svn/reactos?rev=424&view=rev Log: some work on the list navigations
Removed: branches/compat/lib/view/Breadcrumb.class.php Modified: branches/compat/css/style.css branches/compat/lib/CDBConnection.class.php branches/compat/lib/view/HTML_List.class.php branches/compat/lib/view/HTML_Submit.class.php
Modified: branches/compat/css/style.css URL: http://svn.reactos.org/svn/reactos/branches/compat/css/style.css?rev=424&... ============================================================================== --- branches/compat/css/style.css [iso-8859-1] (original) +++ branches/compat/css/style.css [iso-8859-1] Fri May 29 19:21:32 2009 @@ -1,17 +1,11 @@
-.row1 { - background-color: #EEE; -} -.row2 { - background-color: #E7E7E7; -}
.tablebg { margin:10px 10px 0 0; width:500px; border:1px solid #dfdfdf; padding:1em; background-color:#EAF0F8; }
.rtable THEAD { - background-color:#5984C3;color:white;} + background-color:#5984C3;color:white;border-collapse: collapse;}
#submit { background-color: #EEE; @@ -73,6 +67,28 @@ cursor: pointer; }
+LABEL.stable { color: #00CC00 !important; } +LABEL.unstable { color: #FF7800 !important; } +LABEL.crash { color: #FF3300 !important; } + +.rtable TD.first { width: 1.5em;} + +.rtable TD.stable { background-color: #00CC00; opacity: 0.5; } +.rtable TD.unstable { background-color: #FFCC00; opacity: 0.5;} +.rtable TD.crash { background-color: #FF3300; opacity: 0.5;} +.rtable A { opacity: 1;} + +.rtable TH { font-size: 1.2em; padding: 3px; } +.rtable TD { border-bottom: 1px solid #CCC;padding: 2px 3px; } + +.row1 { background-color: #EEE; } +.row2 { background-color: #E7E7E7; } + +#breadcrumb { display:block; list-style-type:none; clear:both; padding-left: 0px; } +#breadcrumb LI { float:left; padding-left:10px; } + +#letternavi A {font-family: monospace; font-size:1.4em; text-decoration: none; padding: 0px 2px; } +
@@ -83,7 +99,7 @@ padding: 0; /* Only affects Opera */ background: #FFFFFF url('../images/topbar.jpg') repeat-x scroll top left; } - + /* hr { margin: 5px 0 5px 0; color: #8D8D8D; @@ -104,7 +120,7 @@ font-size: 9px; text-decoration:underline; } - +*/
h1, .contentSmallTitle { @@ -456,6 +472,6 @@ font-size: 15px; font-weight: bold; } - - - +*/ + +
Modified: branches/compat/lib/CDBConnection.class.php URL: http://svn.reactos.org/svn/reactos/branches/compat/lib/CDBConnection.class.p... ============================================================================== --- branches/compat/lib/CDBConnection.class.php [iso-8859-1] (original) +++ branches/compat/lib/CDBConnection.class.php [iso-8859-1] Fri May 29 19:21:32 2009 @@ -54,6 +54,7 @@ // show errors as warning, and use our own statement class $this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); $this->setAttribute(PDO::ATTR_STATEMENT_CLASS,array('CDBStatement', array($this))); + self::exec("SET NAMES 'utf8'"); } catch (PDOException $e) {
Removed: branches/compat/lib/view/Breadcrumb.class.php URL: http://svn.reactos.org/svn/reactos/branches/compat/lib/view/Breadcrumb.class... ============================================================================== --- branches/compat/lib/view/Breadcrumb.class.php [iso-8859-1] (original) +++ branches/compat/lib/view/Breadcrumb.class.php (removed) @@ -1,174 +1,0 @@ -<?php - /* - RSDB - ReactOS Support Database - Copyright (C) 2005-2006 Klemens Friedl frik85@reactos.org - 2009 Danny Götte dangerground@web.de - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -class Breadcrumb -{ - - - - const MODE_NONE = 0; // no breadcrumb - const MODE_INITIAL = 1; // show initial letter - const MODE_TREE = 2; // show hierarchical list - const MODE_VENDOR = 4; // show vendor - - const PARAM_UNKNOWN = 0; - const PARAM_CATEGORY = 1; - const PARAM_ENTRY = 2; - const PARAM_VERSION = 3; - const PARAM_VENDOR = 4; - - - - public function __construct( $mode = self::NONE, $param, $param_type = self::PARAM_UNKNOWN) - { - echo ' - <div style="clear: both;border: 2px solid gray;"> - <span style="float: left;">Browsing: </span> - <ul style="list-style-type: none;display: inline;">'; - - // needs entry - if ($mode & self::MODE_INITIAL) { - self::initial($param, $param_type); - } - - // needs entry or category - if ($mode & self::MODE_TREE) { - self::tree($param, $param_type); - } - - // needs vendor - if ($mode & self::MODE_VENDOR) { - self::vendor($param, $param_type); - } - - // get version data - if ($param > 0 && $param_type === self::PARAM_VERSION) { - $stmt=CDBConnection::getInstance()->prepare("SELECT comp_groupid, comp_id, comp_appversion, grpentr_name FROM rsdb_item_comp JOIN rsdb_groups ON grpentr_id=comp_group_id WHERE grpentr_visible = '1' AND comp_id = :item_id AND comp_visible='1'") ; - $stmt->bindParam('item_id',$param,PDO::PARAM_INT); - $stmt->execute(); - $version = $stmt->fetchOnce(PDO::FETCH_ASSOC); - $version_id = $version['comp_id']; - $version_name = $version['comp_appversion']; - $entry_id = $version['comp_groupid']; - } - - // get entry data - elseif ($param > 0 && $param_type === self::PARAM_ENTRY) { - $stmt=CDBConnection::getInstance()->prepare("SELECT grpentr_id, grpentr_category, grpentr_name FROM rsdb_groups WHERE grpentr_visible = '1' AND grpentr_id = :group_id") ; - $stmt->bindParam('group_id',$param,PDO::PARAM_INT); - $stmt->execute(); - $group = $stmt->fetchOnce(PDO::FETCH_ASSOC); - $entry_id = $group['grpentr_id']; - $entry_name = $group['grpentr_name']; - } - - // show entry, if selected - if (isset($entry_id)) { - echo ' - <li style="float: left;padding-left: 10px;">→ <a href="'.$entry_id.'">'.htmlspecialchars($entry_name).'</a></li>'; - } - - // show entry, if selected - if (isset($version_id)) { - echo ' - <li style="float: left;padding-left: 10px;"> [<a href="'.$version_id.'">'.htmlspecialchars($version_name).'</a>] </li>'; - } - - echo ' - </ul> - <br style="clear: both;"/> - </div>'; - } // end of constructor - - - - private function tree( $param, $param_type ) - { - global $RSDB_intern_link_category_cat; - - $description = 'Root directory of the tree.'; - - // check if category exists and is visible - if ($param > 0 && $param_type === self::PARAM_CATEGORY) { - $stmt=CDBConnection::getInstance()->prepare("SELECT cat_id FROM ".CDBT_CATEGORIES." WHERE id = :cat_id AND visible IS TRUE"); - $stmt->bindParam('cat_id',$param,PDO::PARAM_INT); - $stmt->execute(); - $category_id = $stmt->fetchColumn(); - - if ($category_id === false) { - echo 'Unknown Category'; - return; - } - } - - // check if entry exists and is visible - elseif ($param > 0 && $param_type === self::PARAM_ENTRY) { - $stmt=CDBConnection::getInstance()->prepare("SELECT grpentr_category, grpentr_name FROM rsdb_groups WHERE grpentr_visible = '1' AND grpentr_id = :group_id") ; - $stmt->bindParam('group_id',$param,PDO::PARAM_INT); - $stmt->execute(); - $category_id = $stmt->fetchColumn(); - - if ($category_id === false) { - echo 'Unknown Group'; - return; - } - } - - // check if entry version exists and is visible - elseif ($param > 0 && $param_type === self::PARAM_VERSION) { - //@TODO - } - - // show root - echo ' - <li style="float: left;"><a href="'.$RSDB_intern_link_category_cat.'0">Root</a></li>'; - - if (isset($category_id) && $category_id === false) { - echo '<li>→ Unknown Category</li>'; - return; - } - - // show current path - $stmt=CDBConnection::getInstance()->prepare("SELECT name, id, parent FROM ".CDBT_CATEGORIES." WHERE id=:cat_id AND visible IS TRUE"); - $stmt->bindParam('cat_id',$category_id,PDO::PARAM_INT); - $stmt->execute(); - - // get output in reversed order - $output = ''; - while ($category = $stmt->fetch(PDO::FETCH_ASSOC)) { - $output = ' - <li style="float: left;padding-left: 10px;">→ <a href="'.$RSDB_intern_link_category_cat.$category['id'].'">'.htmlspecialchars($category['name']).'</a></li>'.$output; - - if ($category['parent'] > 0) { - $stmt->bindParam('cat_id',$category['parent'],PDO::PARAM_INT); - $stmt->execute(); - } - } // end while - - echo $output; - } // end of member function tree - - - - -} // end of Breadcrumb -
Modified: branches/compat/lib/view/HTML_List.class.php URL: http://svn.reactos.org/svn/reactos/branches/compat/lib/view/HTML_List.class.... ============================================================================== --- branches/compat/lib/view/HTML_List.class.php [iso-8859-1] (original) +++ branches/compat/lib/view/HTML_List.class.php [iso-8859-1] Fri May 29 19:21:32 2009 @@ -25,6 +25,8 @@ private $where = ''; private $from = ''; private $params = array(); + private $select = ''; + private $showColumn = array();
public function __construct($filter='') @@ -71,7 +73,88 @@ } $stmt->execute(); $entries_count = $stmt->fetchColumn(); - + + if ($entries_count > 0) { + echo ' + <h2>Entries</h2> + <table class="rtable" cellspacing="0" cellpadding="0"> + <thead> + <tr> + <th> </th> + <th>Application</th>'; + if (count($this->showColumn) > 0) { + foreach ($this->showColumn as $column) { + echo '<th>'.$column['description'].'</th>'; + } + } + echo ' + <th>Last modified</th> + </tr> + </thead> + <tbody>'; + + reset($this->params); + $stmt=CDBConnection::getInstance()->prepare("SELECT e.id, e.name, e.modified, (SELECT works FROM ".CDBT_REPORTS." WHERE entry_id=e.id ORDER BY created DESC LIMIT 1) AS works ".$this->select." FROM ".CDBT_ENTRIES." e ".$this->from." WHERE e.visible IS TRUE ".$this->where." ORDER BY e.name ASC LIMIT :limit OFFSET :offset"); + foreach ($this->params as $param) { + $stmt->bindValue($param[0],$param[1],$param[2]); + } + $stmt->bindParam('limit', $limit, PDO::PARAM_INT); + $stmt->bindParam('offset', $offset, PDO::PARAM_INT); + $stmt->execute(); + $x=0; + while ($entry=$stmt->fetch(PDO::FETCH_ASSOC)) { + ++$x; + + $stmt_ver=CDBConnection::getInstance()->prepare("SELECT id, version FROM ".CDBT_VERSIONS." WHERE entry_id=:entry_id ORDER BY version DESC"); + $stmt_ver->bindParam('entry_id',$entry['id'],PDO::PARAM_STR); + $stmt_ver->execute(); + $versions = $stmt_ver->fetchAll(PDO::FETCH_ASSOC); + + // display entry only if it has also at least one version information + if (count($versions) > 0) { + echo ' + <tr class="row'.($x%2+1).'" id="tr'.$x.'" title="'.($entry['works'] == 'full' ? 'stable' : ($entry['works'] == 'part' ? 'unstable' : 'crash')).'"> + <td class="first '.($entry['works'] == 'full' ? 'stable' : ($entry['works'] == 'part' ? 'unstable' : 'crash')).'"> </td> + <td onmouseover="'."this.className=document.getElementById('tr".$x."').title;".'" onmouseout="this.className='';">'; + + if (count($versions) == 1) { + echo ' + <a href="?page=item&ver='.$versions[0]['id'].'">'.htmlspecialchars($entry['name']).' '.$versions[0]['version'].'</a>'; + } + else { + echo ' + <a href="?page=item&item='.$entry['id'].'">'.htmlspecialchars($entry['name']).'</a> + <ul style="display:none;">'; + + + foreach ($versions as $version) { + echo ' + <li><a href="item&ver='.$entry['id'].'">'.htmlspecialchars($entry['name']).' '.$version['version'].'</a></li>'; + } + + echo ' + </ul>'; + } + + + echo ' + </td>'; + if (count($this->showColumn) > 0) { + foreach ($this->showColumn as $column) { + echo '<th>'.$entry[$column['field']].'</th>'; + } + } + echo ' + <td class="modified">'.$entry['modified'].'</td> + </tr>'; + } + } + + echo ' + </tbody> + </table>'; + } + if ($entries_count > $limit) { echo '<div>Navigation:'; $to = ceil($entries_count/(float)$limit); @@ -85,127 +168,95 @@ } echo '</div>'; } + } + } // end of member function body + + + + private function naviLetter( $letter ) + { + echo '<div id="letternavi"><h2>Letter Navigation</h2>'; + for ($i=ord('a'); $i <= ord('z') ; ++$i) { + if (isset($letter) && chr($i)==$letter) { + echo '<strong>['.strtoupper(chr($i)).']</strong>'; + } + else { + echo '<a href="?page=list&letter='.chr($i).'">'.strtoupper(chr($i)).'</a>'; + } + } + echo '</div>'; + } + + + + private function naviCategory( $category_id ) + { + + // show root + echo ' + <ul id="breadcrumb"> + <li style="float: left;"><a href="?page=list&cat=0">Root</a></li>'; + + + // show current path + $stmt=CDBConnection::getInstance()->prepare("SELECT name, id, parent FROM ".CDBT_CATEGORIES." WHERE id=:cat_id AND visible IS TRUE"); + $stmt->bindParam('cat_id',$category_id,PDO::PARAM_INT); + $stmt->execute(); + + // get output in reversed order + $output = ''; + while ($category = $stmt->fetch(PDO::FETCH_ASSOC)) { + $output = ' + <li>→ <a href="?page=list&cat='.$category['id'].'">'.htmlspecialchars($category['name']).'</a></li>'.$output; + + if ($category['parent'] > 0) { + $stmt->bindParam('cat_id',$category['parent'],PDO::PARAM_INT); + $stmt->execute(); + } + } // end while + + echo $output.' + </ul>'; + + $stmt=CDBConnection::getInstance()->prepare("SELECT COUNT(*) FROM ".CDBT_CATEGORIES." p WHERE parent=:category_id"); + $stmt->bindParam('category_id',$category_id,PDO::PARAM_STR); + $stmt->execute(); + + if ($stmt->fetchColumn() > 0) {
- echo ' - <table class="rtable"> - <thead> - <tr> - <th>Application</th> - <th>Works?</th> - <th>Last modified</th> - </tr> - </thead> - <tbody>'; - - reset($this->params); - $stmt=CDBConnection::getInstance()->prepare("SELECT e.id, e.name, e.modified, (SELECT works FROM ".CDBT_REPORTS." WHERE entry_id=e.id ORDER BY created DESC LIMIT 1) AS works FROM ".CDBT_ENTRIES." e ".$this->from." WHERE e.visible IS TRUE ".$this->where." ORDER BY e.name ASC LIMIT :limit OFFSET :offset"); - foreach ($this->params as $param) { - $stmt->bindValue($param[0],$param[1],$param[2]); - } - $stmt->bindParam('limit', $limit, PDO::PARAM_INT); - $stmt->bindParam('offset', $offset, PDO::PARAM_INT); + <div style="margin-bottom: 3em;clear:both;"> + <h2>Category Navigation</h2> + <table class="rtable" cellspacing="0" cellpadding="0"> + <thead> + <tr> + <th>Name</th> + <th>Subcategories</th> + <th>direct entries</th> + </tr> + </thead> + <tbody>'; + + $stmt=CDBConnection::getInstance()->prepare("SELECT id, name, (SELECT COUNT(*) FROM ".CDBT_CATEGORIES." WHERE parent=p.id) AS subcategories, (SELECT COUNT(*) FROM ".CDBT_ENTRIES." WHERE category_id=p.id) AS entries FROM ".CDBT_CATEGORIES." p WHERE parent=:category_id ORDER BY name ASC"); + $stmt->bindParam('category_id',$category_id,PDO::PARAM_STR); $stmt->execute(); $x=0; - while ($entry=$stmt->fetch(PDO::FETCH_ASSOC)) { + while ($category=$stmt->fetch(PDO::FETCH_ASSOC)) { ++$x;
- $stmt_ver=CDBConnection::getInstance()->prepare("SELECT id, version FROM ".CDBT_VERSIONS." WHERE entry_id=:entry_id ORDER BY version DESC"); - $stmt_ver->bindParam('entry_id',$entry['id'],PDO::PARAM_STR); - $stmt_ver->execute(); - $versions = $stmt_ver->fetchAll(PDO::FETCH_ASSOC); - - // display entry only if it has also at least one version information - if (count($versions) > 0) { - echo ' - <tr class="row'.($x%2+1).'"> - <td>'; - - if (count($versions) == 1) { - echo ' - <a href="?page=item&ver='.$versions[0]['id'].'">'.htmlspecialchars($entry['name']).' '.$versions[0]['version'].'</a>'; - } - else { - echo ' - <a href="?page=item&item='.$entry['id'].'">'.htmlspecialchars($entry['name']).'</a> - <ul style="display:none;">'; - - - foreach ($versions as $version) { - echo ' - <li><a href="item&ver='.$entry['id'].'">'.htmlspecialchars($entry['name']).' '.$version['version'].'</a></li>'; - } - - echo ' - </ul>'; - } - - - echo ' - </td> - <td>'.$entry['works'].'</td> - <td>'.$entry['modified'].'</td> - </tr>'; - } + echo ' + <tr class="row'.($x%2+1).'"> + <td><a href="?page=list&cat='.$category['id'].'">'.$category['name'].'</a></td> + <td>'.$category['subcategories'].'</td> + <td>'.$category['entries'].'</td> + </tr>'; }
echo ' - </tbody> - </table>'; - } - } // end of member function body - - - - private function naviLetter( $letter ) - { - echo '<div>Letters:'; - for ($i=ord('a'); $i <= ord('z') ; ++$i) { - if (isset($letter) && chr($i)==$letter) { - echo '<strong>['.chr($i).']</strong>'; - } - else { - echo '<a href="?page=list&letter='.chr($i).'">'.strtoupper(chr($i)).'</a>'; - } - } - echo '</div>'; - } - - - - private function naviCategory( $category_id ) - { - echo ' - <div style="margin-bottom: 3em;">Categories - <table class="rtable"> - <thead> - <tr> - <th>Name</th> - <th>Subcategories</th> - <th>direct entries</th> - </tr> - </thead> - <tbody>'; - - $stmt=CDBConnection::getInstance()->prepare("SELECT id, name, (SELECT COUNT(*) FROM ".CDBT_CATEGORIES." WHERE parent=p.id) AS subcategories, (SELECT COUNT(*) FROM ".CDBT_ENTRIES." WHERE category_id=p.id) AS entries FROM ".CDBT_CATEGORIES." p WHERE parent=:category_id ORDER BY name ASC"); - $stmt->bindParam('category_id',$category_id,PDO::PARAM_STR); - $stmt->execute(); - $x=0; - while ($category=$stmt->fetch(PDO::FETCH_ASSOC)) { - ++$x; - - echo ' - <tr class="row'.($x%2+1).'"> - <td><a href="?page=list&cat='.$category['id'].'">'.$category['name'].'</a></td> - <td>'.$category['subcategories'].'</td> - <td>'.$category['entries'].'</td> - </tr>'; - } - - echo ' - </tbody> - </table> - </div>'; + </tbody> + </table> + </div>'; + } }
@@ -216,15 +267,16 @@ $stmt=CDBConnection::getInstance()->prepare("SELECT MAX((SELECT COUNT(*) FROM ".CDBT_TAGGED." WHERE tag_id=t.id)) AS max FROM ".CDBT_TAGS." t"); $stmt->execute(); $max = $stmt->fetchColumn(); - echo $max; - - echo ' - <div style="margin-bottom: 3em;">'; + + echo ' + <h2>Navigate by Tag</h2> + <div style="margin-bottom: 3em;text-align:left;">';
$stmt=CDBConnection::getInstance()->prepare("SELECT id, name, (SELECT COUNT(*) FROM ".CDBT_TAGGED." WHERE tag_id=t.id) AS count FROM ".CDBT_TAGS." t ORDER BY name ASC"); $stmt->execute(); while ($tag=$stmt->fetch(PDO::FETCH_ASSOC)) { - echo '<span style="float: left; margin-right: 20px; font-size: '.((floor($tag['count']/(float)$max)*12.0)+8).'px;"><a href="?page=list&tag='.htmlspecialchars($tag['name']).'">'.htmlspecialchars($tag['name']).'</a></span>'; + + echo '<a style="margin-right: 20px; font-size: '.(((int)$tag['count']/(float)$max*2.0)+0.9).'em;" href="?page=list&tag='.htmlspecialchars($tag['name']).'">'.htmlspecialchars($tag['name']).'</a>'; } echo ' </div>'; @@ -235,7 +287,12 @@
private function naviCustom( ) { - echo '<div>Not yet implemented</div>'; + echo ' + <form action="" method="get"> + <fieldset> + <legend></legend> + </fieldset> + </form>'; }
@@ -282,6 +339,15 @@ $this->params[] = array('tagname',$part[2],PDO::PARAM_STR); break;
+ // show additional columns + case 's': + switch ($part[2]) { + case 'category'; + $this->select .= " (SELECT name FROM ".CDBT_CATEGORIES." WHERE id=e.category_id) AS category"; + $this->showColumn[] = array('field'=>'category','description'=>'Category'); + } + break; + // category case 'c': if ($part[1] == 'is') {
Modified: branches/compat/lib/view/HTML_Submit.class.php URL: http://svn.reactos.org/svn/reactos/branches/compat/lib/view/HTML_Submit.clas... ============================================================================== --- branches/compat/lib/view/HTML_Submit.class.php [iso-8859-1] (original) +++ branches/compat/lib/view/HTML_Submit.class.php [iso-8859-1] Fri May 29 19:21:32 2009 @@ -164,13 +164,13 @@ <li> <span class="label">Outcome:</span><br /> <input type="radio" class="normal" name="status" id="works" value="full" onchange="'."javascript:document.getElementById('bugreport').style.display=(this.checked ? 'none' : 'block' );".'" /> - <label for="works" style="color: #00CC00;">Running Stable</label> + <label for="works" class="stable">Running Stable</label>
- <input type="radio" class="normal" name="status" id="partworks" value="part" onchange="'."javascript:document.getElementById('bugreport').style.display=(this.checked ? 'none' : 'block' );".'" /> - <label for="partworks" style="color: #FF7800;">Minor Problems</label> + <input type="radio" class="normal pworks" name="status" id="partworks" value="part" onchange="'."javascript:document.getElementById('bugreport').style.display=(this.checked ? 'none' : 'block' );".'" /> + <label for="partworks" class="unstable">Minor Problems</label>
- <input type="radio" class="normal" name="status" id="noworks" value="not" onchange="'."javascript:document.getElementById('bugreport').style.display=(this.checked ? 'block' : 'none' );".'" /> - <label for="noworks" style="color: #FF3300;">Crash</label> + <input type="radio" class="normal crash" name="status" id="noworks" value="not" onchange="'."javascript:document.getElementById('bugreport').style.display=(this.checked ? 'block' : 'none' );".'" /> + <label for="noworks" class="crash">Crash</label> <br /> <br /> </li>