cvs: docweb /include/rfc rfc.php /www/rfc rfc-overview.php rfc-proposal-edit.php
| From: | Vincent Gevers | Date: | Sun, 05 Sep 2004 09:16:33 +0000 |
| Subject: | cvs: docweb /include/rfc rfc.php /www/rfc rfc-overview.php rfc-proposal-edit.php | ||
| Groups: | php.doc.web | ||
| Request: | Send a blank email to doc-web+get-235@lists.php.net to get a copy of this message | ||
vincent Sun Sep 5 05:16:33 2004 EDT
Modified files:
/docweb/include/rfc rfc.php
/docweb/www/rfc rfc-overview.php rfc-proposal-edit.php
Log:
- Go with a nices tabbed display for the overview page
- Some tweaking for the file upload part
http://cvs.php.net/diff.php/docweb/include/rfc/rfc.php?r1=1.6&r2=1.7&ty=u
Index: docweb/include/rfc/rfc.php
diff -u docweb/include/rfc/rfc.php:1.6 docweb/include/rfc/rfc.php:1.7
--- docweb/include/rfc/rfc.php:1.6 Thu Sep 2 14:24:12 2004
+++ docweb/include/rfc/rfc.php Sun Sep 5 05:16:32 2004
@@ -24,7 +24,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright Copyright (c) 1997-2004 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: rfc.php,v 1.6 2004/09/02 18:24:12 vincent Exp $
+ * @version $Id: rfc.php,v 1.7 2004/09/05 09:16:32 vincent Exp $
*/
require_once 'DB.php';
@@ -107,7 +107,7 @@
/**
* Prints a tabbed navigation bar based on the parameter $items
*/
-function print_tabbed_navigation($items)
+function print_tabbed_navigation($items, $no_active = false)
{
$page = basename($_SERVER['PHP_SELF']);
$master_url = get_resource_url();
@@ -116,7 +116,7 @@
foreach ($items as $title => $item) {
echo '<a href="' . $master_url . 'rfc/' .
$item['url'] // !!!
. '" title="' . $item['title'] . '"';
- if (strpos($item['url'], $page) !== false) {
+ if (strpos($item['url'], $page) !== false && $no_active == false) {
echo ' class="active"';
}
echo ' >' . $title . "</a>\n";
@@ -287,6 +287,22 @@
print_tabbed_navigation($items);
}
+function display_overview_nav ()
+{
+ global $proposalStatiMap;
+ $items = array(
+ 'All' => array('url' => 'rfc-overview.php',
+ 'title' => 'All'
+ )
+ );
+ foreach ($proposalStatiMap as $status => $name) {
+ $items[$name] = array('url' => 'rfc-overview.php?filter='.$status,
+ 'title' => $name
+ );
+ }
+
+ print_tabbed_navigation($items, true);
+}
function shorten_string($string)
{
@@ -387,13 +403,17 @@
return new proposal($res);
}
- function &getAll(&$dbh, $status = null, $limit = null)
+ function &getAll(&$dbh, $status = null, $limit = null, $order= null)
{
$sql = "SELECT * FROM package_proposals";
if (!empty($status)) {
$sql .= " WHERE status = '".$status."'";
}
- $sql .= " ORDER BY status ASC, draft_date DESC";
+ if (!isset($order)) {
+ $sql .= " ORDER BY status ASC, draft_date DESC";
+ } else {
+ $sql .= " ORDER BY ".$order;
+ }
if (!empty($limit)) {
$sql .= " LIMIT $limit";
}
@@ -457,6 +477,11 @@
}
}
} else {
+
+ if (empty($this->pkg_filehash)) {
+ $this->pkg_filehash = '';
+ }
+
$sql = "INSERT INTO package_proposals ( pkg_category, pkg_name, pkg_describtion,
pkg_filehash, draft_date, status, user_handle, markup) VALUES (
".$dbh->quoteSmart($this->pkg_category).",
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-overview.php?r1=1.3&r2=1.4&ty=u
Index: docweb/www/rfc/rfc-overview.php
diff -u docweb/www/rfc/rfc-overview.php:1.3 docweb/www/rfc/rfc-overview.php:1.4
--- docweb/www/rfc/rfc-overview.php:1.3 Sun Aug 29 16:26:51 2004
+++ docweb/www/rfc/rfc-overview.php Sun Sep 5 05:16:32 2004
@@ -22,7 +22,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright Copyright (c) 1997-2004 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: rfc-overview.php,v 1.3 2004/08/29 20:26:51 vincent Exp $
+ * @version $Id: rfc-overview.php,v 1.4 2004/09/05 09:16:32 vincent Exp $
*/
/**
@@ -31,34 +31,29 @@
require_once '../../include/lib_general.inc.php';
require_once '../../include/rfc/rfc.php';
-$form =& new HTML_QuickForm('filter_proposals', 'get');
-
-$values[''] = 'All';
-$values = array_merge($values, $proposalStatiMap);
-
-
-$filter = $form->addElement('select', 'filter', 'Filter',
$values);
-$form->addElement('submit', 'submit', 'Filter');
-
-$filter_value = $filter->getValue();
+if (isset($_GET['filter']) &&
isset($proposalStatiMap[$_GET['filter']])) {
+ $selectStatus = $_GET['filter'];
+} else {
+ $selectStatus = '';
+}
-if ($form->validate()) {
- if (trim($filter_value[0]) != "") {
- $selectStatus = $filter_value[0];
- }
+if ($selectStatus != '') {
+ $order = ' pkg_category ASC, pkg_name ASC';
}
-$proposals =& proposal::getAll($dbh, @$selectStatus);
+$proposals =& proposal::getAll($dbh, @$selectStatus, null, @$order);
echo site_header('RFC :: Proposals');
echo '<h1>Proposals</h1>' . "\n";
-$form->display();
+display_overview_nav();
$last_status = false;
$first_loop = true;
+$finishedCounter = 0;
+
foreach ($proposals as $proposal) {
if ($proposal->getStatus() != $last_status) {
if ($first_loop != true) {
@@ -72,6 +67,18 @@
$last_status = $proposal->getStatus();
$first_loop = false;
}
+ $prpCat = $proposal->pkg_category;
+ if ($selectStatus != '' && (!isset($lastChar) || $lastChar != $prpCat{0})) {
+ $lastChar = $prpCat{0};
+ echo '</ul>';
+ echo "<h3>$lastChar</h3>";
+ echo '<ul>';
+ }
+ if ($proposal->getStatus() == 'finished' && $selectStatus !=
'finished') {
+ if (++$finishedCounter == 10) {
+ break;
+ }
+ }
if (!isset($users[$proposal->user_handle])) {
$users[$proposal->user_handle] =
array('Test','name'=>'TestUser');//
user::info($proposal->user_handle); // !!!
}
@@ -123,6 +130,10 @@
}
echo "</ul>\n";
+
+if ($selectStatus == '') {
+ print_link('rfc-overview.php?filter=finished', 'All finished proposals');
+}
echo site_footer();
http://cvs.php.net/diff.php/docweb/www/rfc/rfc-proposal-edit.php?r1=1.7&r2=1.8&ty=u
Index: docweb/www/rfc/rfc-proposal-edit.php
diff -u docweb/www/rfc/rfc-proposal-edit.php:1.7 docweb/www/rfc/rfc-proposal-edit.php:1.8
--- docweb/www/rfc/rfc-proposal-edit.php:1.7 Thu Aug 26 15:07:41 2004
+++ docweb/www/rfc/rfc-proposal-edit.php Sun Sep 5 05:16:32 2004
@@ -22,7 +22,7 @@
* @author Daniel Convissor <danielc@php.net>
* @copyright Copyright (c) 1997-2004 The PHP Group
* @license http://www.php.net/license/3_0.txt
PHP License
- * @version $Id: rfc-proposal-edit.php,v 1.7 2004/08/26 19:07:41 vincent Exp $
+ * @version $Id: rfc-proposal-edit.php,v 1.8 2004/09/05 09:16:32 vincent Exp $
*/
/**
@@ -288,7 +288,7 @@
if (!empty($_FILES['thefile']['name'])) {
// this will need some more security checks
if ($_FILES['thefile']['size'] >= round((1024 * 1024)/10)) {
- report_error('The files should NOT be bigger then 100kb, please upload
+ report_error('The file should NOT be bigger then 100kb, please upload
it somewhere and link to it');
} else {
$filehash = md5($_FILES['thefile']['name'] . time());
@@ -297,7 +297,12 @@
$proposal->pkg_filehash = $proposal->pkg_filehash . '|' .
$_FILES['thefile']['name'] . $filehash;
}
+ } else {
+ if (isset($proposal) && empty($proposal->pkg_filehash)) {
+ $proposal->pkg_filehash = '';
+ }
}
+
if (isset($values['pkg_category_new']['pkg_category_new_do'])) {
$values['pkg_category'] =
$values['pkg_category_new']['pkg_category_new_text'];
}