From dfb6112e66aaa0621c18fe69e43ca9b7fa37768b Mon Sep 17 00:00:00 2001 From: james Date: Fri, 3 Sep 2010 16:59:05 +0000 Subject: [PATCH] Split committee management out --- admin/committee_committees.php | 55 +++++++++++++++++++++ admin/committees.php | 88 ++++------------------------------ admin/user_list.php | 4 +- tableeditor.class.php | 66 ++++++++++--------------- 4 files changed, 92 insertions(+), 121 deletions(-) create mode 100644 admin/committee_committees.php diff --git a/admin/committee_committees.php b/admin/committee_committees.php new file mode 100644 index 0000000..15cdbf8 --- /dev/null +++ b/admin/committee_committees.php @@ -0,0 +1,55 @@ + + Copyright (C) 2005 James Grant + + 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, version 2. + + 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; see the file COPYING. If not, write to + the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ +?> + 'committee_main.php', + 'Administration' => 'admin/index.php' ), + "committee_management"); + + + $_SESSION['last_page'] = 'committee_management'; + + //make sure storage folder exists + + $editor=new TableEditor("committees", + array("name"=>"Committee Name", + ) + ); + + $editor->setPrimaryKey("id"); + $editor->setDefaultSortField("name"); + $editor->setRecordType("Committee"); + $editor->execute(); + +send_footer(); +?> + diff --git a/admin/committees.php b/admin/committees.php index 65d6864..17bd7d4 100644 --- a/admin/committees.php +++ b/admin/committees.php @@ -33,7 +33,7 @@ if($_POST['accounts_id']) /* Now, start the output for this page */ - send_header("Committee Management", + send_header("Committee Member Management", array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php' ), "committee_management"); @@ -125,24 +125,15 @@ function actionSubmit() "; - echo ""; - - echo "

".i18n("Add Committee")."

\n"; - echo "
\n"; - echo "\n"; - echo ""; - echo " \n"; - echo "
".i18n("Committee Name").":
\n"; - echo "
\n"; - - echo " "; - - echo "

".i18n("Add Committee Member")."

\n"; - echo "
\n"; - echo "\n"; - echo "\n"; - echo " \n"; - echo "
".i18n("Member Email").": "; - echo "\n"; - echo "
\n"; - echo "".i18n("Reload committee list (needed after adding a new member)")."\n"; - echo "
\n"; - - echo ""; - echo ""; - - - echo "
"; - echo "

".i18n("Committee Member Management")."

\n"; echo "
\n"; echo ""; echo "
"; @@ -290,19 +244,16 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) { $q=mysql_query("SELECT * FROM committees ORDER BY ord,name"); if(mysql_num_rows($q)) { - echo "

".i18n("Committees")."

"; echo "\n"; echo ""; - echo ""; - echo ""; - echo ""; - while($r=mysql_fetch_object($q)) - { + echo ""; + echo ""; + while($r=mysql_fetch_object($q)) { echo ""; - echo "\n"; echo mysql_error(); while($r2=mysql_fetch_object($q2)) { @@ -335,26 +281,12 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) { echo "\n"; } - echo "\n"; + echo "\n"; } echo "\n"; echo "
".i18n('Title')."".i18n('Order')."".i18n("Public Email / Private Email")."
".i18n('Title within committee / Sort order')."
"; + echo ""; echo "id\" />"; - echo "ord\" />"; - echo "  $r->name"; +// echo "ord\" />"; + echo "$r->name"; $q2=mysql_query("SELECT @@ -318,11 +269,6 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) { ORDER BY ord, users.lastname "); - if(mysql_num_rows($q2)==0) { - echo "   "; - echo "id\">\"Remove"; - } - echo "
"; echo "{$u['name']}"; echo ""; - echo "title}\" name=\"title[{$r->id}][{$u['accounts_id']}]\" size=\"15\">"; + echo "title}\" name=\"title[{$r->id}][{$u['accounts_id']}]\" size=\"25\">"; echo ""; echo "ord}\" name=\"order[{$r->id}][{$u['accounts_id']}]\" size=\"2\">"; - - echo ""; - - if($u['email']) { - list($b,$a)=split("@",$u['email']); - echo ""; - } - - if($u['emailprivate']) { - if($u['email']) echo " / "; - list($b,$a)=split("@",$u['emailprivate']); - echo ""; - } - echo "
 
 
"; diff --git a/admin/user_list.php b/admin/user_list.php index 3e18f38..f8c42d8 100644 --- a/admin/user_list.php +++ b/admin/user_list.php @@ -105,11 +105,11 @@ function neweditor() "; - echo "- ".i18n('Hide Display Options').""; + echo "- ".i18n('Show Display Options').""; echo ""; - echo "
"; + echo "
"; echo ""; $x = 0; foreach($user_what as $k=>$v ) { diff --git a/tableeditor.class.php b/tableeditor.class.php index 78af9ea..66ac886 100644 --- a/tableeditor.class.php +++ b/tableeditor.class.php @@ -1032,9 +1032,11 @@ class TableEditor $query.=" LIMIT $offset,$this->rowsPerPage"; } - if($this->allowAdding) - { - echo "".i18n("Add new %1",array($this->recordType))."

"; + echo "
\n"; + if($this->allowAdding) { + echo "\n"; } if($this->DEBUG) echo $query; @@ -1142,8 +1144,6 @@ class TableEditor // else // echo "no need to paganate, foundrows=$foundrows, rowsPerPage=".$this->rowsPerPage; - echo " (Total: $foundrows)\n"; - if(mysql_num_rows($q)) { echo "
".i18n('Type').":
"; @@ -1157,11 +1157,9 @@ class TableEditor } echo ""; echo ""; - while($r=mysql_fetch_object($q)) - { + while($r=mysql_fetch_object($q)) { echo ""; - foreach($this->listfields AS $f=>$n) - { + foreach($this->listfields AS $f=>$n) { //figure out what kind of input this should be $typeq=mysql_query("SHOW COLUMNS FROM `{$this->table}` LIKE '$f'"); $typer=mysql_fetch_object($typeq); @@ -1171,67 +1169,52 @@ class TableEditor echo ""; else if($typer->Type=="datetime") echo ""; - else if(substr($f,0,8)=="filename" && $this->uploadPath) - { + else if(substr($f,0,8)=="filename" && $this->uploadPath) { echo ""; } - else if(substr($f,0,7)=="website") - { + else if(substr($f,0,7)=="website") { echo ""; } - else - { - if($this->fieldOptions[$f]) - { - if(is_array($this->fieldOptions[$f][0])) - { + else { + if($this->fieldOptions[$f]) { + if(is_array($this->fieldOptions[$f][0])) { //if it is an aray, then we have a key=> and val=> so we need //to lookup the key and display the val $TE_Found_Field=false; - foreach($this->fieldOptions[$f] AS $i=>$o) - { - if($o['key']==$r->$f) - { + foreach($this->fieldOptions[$f] AS $i=>$o) { + if($o['key']==$r->$f) { echo ""; $TE_Found_Field=true; break; } } - if(!$TE_Found_Field) - { + if(!$TE_Found_Field) { echo ""; } } - else - { + else { //if its not an array, then each element is simply a data value anyways, so we can just show the value echo ""; - - } } - else - { + else { echo ""; } } @@ -1240,10 +1223,8 @@ class TableEditor $pk=$this->primaryKey; //custom action buttons go first - if(count($this->actionButtons)) - { - foreach($this->actionButtons AS $button) - { + if(count($this->actionButtons)) { + foreach($this->actionButtons AS $button) { echo "$pk."\">"; echo "  "; } @@ -1261,9 +1242,12 @@ class TableEditor echo ""; } echo "
".i18n("Actions")."
".$this->format_date($r->$f)."".$this->format_datetime($r->$f).""; if($this->downloadLink) { $pk=$this->primaryKey; echo "downloadLink}?{$pk}={$r->$pk}\">{$r->$f}"; } - else - { + else { //only show a link to the file if the upload path is inside the document root - if(strstr(realpath($this->uploadPath),$_SERVER['DOCUMENT_ROOT']) && file_exists($this->uploadPath."/".$editdata[$f])) - { + if(strstr(realpath($this->uploadPath),$_SERVER['DOCUMENT_ROOT']) && file_exists($this->uploadPath."/".$editdata[$f])) { echo "uploadPath}/{$r->$f}\">{$r->$f}"; } - else - { + else { echo $r->$f; } } echo ""; echo "$f}\" target=\"_blank\">{$r->$f}"; echo "{$o['val']}{$r->$f}{$r->$f}
"; + echo " (Total: $foundrows)\n"; + } echo "
"; + echo "
\n"; } function month_selector($name,$selected="")