forked from science-ation/science-ation
Split committee management out
This commit is contained in:
parent
a5f309c022
commit
dfb6112e66
55
admin/committee_committees.php
Normal file
55
admin/committee_committees.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||
|
||||
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.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
require_once("../common.inc.php");
|
||||
require_once("../user.inc.php");
|
||||
require_once("../committee.inc.php");
|
||||
|
||||
user_auth_required('admin');
|
||||
|
||||
require("../tableeditor.class.php");
|
||||
/* Now, start the output for this page */
|
||||
send_header("Committee Management",
|
||||
array('Committee Main' => '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();
|
||||
?>
|
||||
|
@ -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()
|
||||
</script>
|
||||
<?
|
||||
|
||||
if($_POST['addcommittee'])
|
||||
{
|
||||
//add a new committee
|
||||
mysql_query("INSERT INTO committees (name) VALUES ('".mysql_escape_string($_POST['addcommittee'])."')");
|
||||
echo happy(i18n("Committee successfully added"));
|
||||
}
|
||||
|
||||
if($_POST['committees_id'] && $_POST['committees_ord']) {
|
||||
if($_POST['committees_id']) {
|
||||
//re-order the committees
|
||||
$x=0;
|
||||
$ids=$_POST['committees_id'];
|
||||
$ords=$_POST['committees_ord'];
|
||||
|
||||
$titles=$_POST['title'];
|
||||
$pords = $_POST['order'];
|
||||
while($ids[$x]) {
|
||||
$cid = intval($ids[$x]);
|
||||
mysql_query("UPDATE committees SET ord='".intval($ords[$x])."' WHERE id='$cid'");
|
||||
$x++;
|
||||
|
||||
$ctitle = $titles[$cid];
|
||||
@ -185,12 +176,6 @@ if($_POST['action']=="assign")
|
||||
echo error(("You must choose both a member and a committee"));
|
||||
}
|
||||
|
||||
if($_GET['deletecommittee']) {
|
||||
$del = intval($_GET['deletecommittee']);
|
||||
mysql_query("DELETE FROM committees WHERE id='$del'");
|
||||
echo happy(i18n("Committee removed"));
|
||||
}
|
||||
|
||||
if($_POST['action']=="remove") {
|
||||
/* user_delete takes care of unlinking the user in other tables */
|
||||
user_delete($accounts_id, 'committee');
|
||||
@ -205,37 +190,6 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
|
||||
echo happy(i18n("Committee member unlinked from committee"));
|
||||
}
|
||||
|
||||
|
||||
echo "<table>";
|
||||
echo "<tr><td>";
|
||||
|
||||
echo "<h4>".i18n("Add Committee")."</h4>\n";
|
||||
echo "<form method=\"post\" action=\"committees.php\">\n";
|
||||
echo "<table>\n";
|
||||
echo "<tr><td>".i18n("Committee Name").": </td><td><input type=\"text\" size=\"15\" name=\"addcommittee\" /></td>";
|
||||
echo " <td><input type=\"submit\" value=\"".i18n("Add")."\" /></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
echo "</td><td width=\"40\"> </td><td>";
|
||||
|
||||
echo "<h4>".i18n("Add Committee Member")."</h4>\n";
|
||||
echo "<form method=\"post\" name=\"addmember\" action=\"committees.php\" onsubmit=\"return neweditor();\">\n";
|
||||
echo "<table>\n";
|
||||
echo "<tr><td>".i18n("Member Email").": </td><td>";
|
||||
echo "<input type=\"text\" size=\"15\" name=\"add_member\" />\n";
|
||||
echo "</td>\n";
|
||||
echo " <td><input type=\"submit\" onclick=\"return neweditor();\" value=\"".i18n("Add")."\" /></td></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<a href=\"committees.php\">".i18n("Reload committee list (needed after adding a new member)")."</a>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
echo "</td></tr>";
|
||||
echo "</table>";
|
||||
|
||||
|
||||
echo "<hr />";
|
||||
echo "<h4>".i18n("Committee Member Management")."</h4>\n";
|
||||
echo "<form name=\"memberaction\" method=\"post\" action=\"committees.php\" onsubmit=\"return actionSubmit()\">\n";
|
||||
echo "<table>";
|
||||
echo "<tr><td>";
|
||||
@ -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 "<h4>".i18n("Committees")."</h4>";
|
||||
echo "<form method=\"post\" action=\"committees.php\">\n";
|
||||
echo "<table>";
|
||||
echo "<tr><td colspan=\"2\"></td><td><b>".i18n('Title')."</b></td>";
|
||||
echo "<td><b>".i18n('Order')."</b></td>";
|
||||
echo "<td><b>".i18n("Public Email / Private Email")."</b></td></tr>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr><td colspan=\"2\"></td><th colspan=\"2\">".i18n('Title within committee / Sort order')."</th>";
|
||||
echo "</tr>";
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo "<tr>";
|
||||
echo "<td colspan=\"3\">";
|
||||
echo "<td colspan=\"4\">";
|
||||
echo "<input type=\"hidden\" name=\"committees_id[]\" value=\"$r->id\" />";
|
||||
echo "<input size=\"1\" type=\"text\" name=\"committees_ord[]\" value=\"$r->ord\" />";
|
||||
echo " <b>$r->name</b>";
|
||||
// echo "<input size=\"1\" type=\"text\" name=\"committees_ord[]\" value=\"$r->ord\" />";
|
||||
echo "<b>$r->name</b>";
|
||||
|
||||
|
||||
$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 "<a title=\"Remove Committee\" onclick=\"return confirmClick('Are you sure you want to remove this committee?');\" href=\"committees.php?deletecommittee=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=\"0\" alt=\"Remove Committee\" /></a>";
|
||||
}
|
||||
|
||||
echo "</td></tr>\n";
|
||||
echo mysql_error();
|
||||
while($r2=mysql_fetch_object($q2)) {
|
||||
@ -335,26 +281,12 @@ if($_GET['unlinkmember'] && $_GET['unlinkcommittee']) {
|
||||
echo "<td valign=\"top\">";
|
||||
echo "<b>{$u['name']}</b>";
|
||||
echo "</td><td>";
|
||||
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['accounts_id']}]\" size=\"15\">";
|
||||
echo "<input type=\"text\" value=\"{$r2->title}\" name=\"title[{$r->id}][{$u['accounts_id']}]\" size=\"25\">";
|
||||
echo "</td><td>";
|
||||
echo "<input type=\"text\" value=\"{$r2->ord}\" name=\"order[{$r->id}][{$u['accounts_id']}]\" size=\"2\">";
|
||||
|
||||
echo "</td><td>";
|
||||
|
||||
if($u['email']) {
|
||||
list($b,$a)=split("@",$u['email']);
|
||||
echo "<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>";
|
||||
}
|
||||
|
||||
if($u['emailprivate']) {
|
||||
if($u['email']) echo " <b>/</b> ";
|
||||
list($b,$a)=split("@",$u['emailprivate']);
|
||||
echo "<script language=\"javascript\" type=\"text/javascript\">em('$b','$a')</script>";
|
||||
}
|
||||
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
echo "<tr><td colspan=\"2\"> </td></tr>\n";
|
||||
echo "<tr><td colspan=\"4\"> </td></tr>\n";
|
||||
}
|
||||
echo "<tr><td colspan=\"2\"><input type=\"submit\" value=\"".i18n("Save Committee Orders and Titles")."\" /></td></tr>\n";
|
||||
echo "</table>";
|
||||
|
@ -105,11 +105,11 @@ function neweditor()
|
||||
<?
|
||||
|
||||
echo "<div class=\"notice\">";
|
||||
echo "<a id=\"optionstext\" onclick=\"toggleoptions();return false;\">- ".i18n('Hide Display Options')."</a>";
|
||||
echo "<a id=\"optionstext\" onclick=\"toggleoptions();return false;\">- ".i18n('Show Display Options')."</a>";
|
||||
|
||||
echo "<form method=\"GET\" action=\"$PHP_SELF\">";
|
||||
|
||||
echo "<div id=\"options\" style=\"display: block;\" >";
|
||||
echo "<div id=\"options\" style=\"display: none;\" >";
|
||||
echo "<table><tr><td>".i18n('Type').":</td>";
|
||||
$x = 0;
|
||||
foreach($user_what as $k=>$v ) {
|
||||
|
@ -1032,9 +1032,11 @@ class TableEditor
|
||||
$query.=" LIMIT $offset,$this->rowsPerPage";
|
||||
}
|
||||
|
||||
if($this->allowAdding)
|
||||
{
|
||||
echo "<a href=\"{$_SERVER['PHP_SELF']}?TableEditorAction=add\">".i18n("Add new %1",array($this->recordType))."</a><br /><br />";
|
||||
echo "<div id=\"table-editor-wrapper\">\n";
|
||||
if($this->allowAdding) {
|
||||
echo "<div id=\"table-editor-addnew\">\n";
|
||||
echo "<a href=\"{$_SERVER['PHP_SELF']}?TableEditorAction=add\">".i18n("Add new %1",array($this->recordType))."</a>";
|
||||
echo "</div>\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 "<table cellspacing=\"0\" class=\"tableview\">";
|
||||
@ -1157,11 +1157,9 @@ class TableEditor
|
||||
}
|
||||
echo "<th>".i18n("Actions")."</th>";
|
||||
echo "</tr>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
while($r=mysql_fetch_object($q)) {
|
||||
echo "<tr>";
|
||||
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 "<td valign=\"top\">".$this->format_date($r->$f)."</td>";
|
||||
else if($typer->Type=="datetime")
|
||||
echo "<td valign=\"top\">".$this->format_datetime($r->$f)."</td>";
|
||||
else if(substr($f,0,8)=="filename" && $this->uploadPath)
|
||||
{
|
||||
else if(substr($f,0,8)=="filename" && $this->uploadPath) {
|
||||
echo "<td valign=\"top\">";
|
||||
if($this->downloadLink) {
|
||||
$pk=$this->primaryKey;
|
||||
echo "<a href=\"{$this->downloadLink}?{$pk}={$r->$pk}\">{$r->$f}</a>";
|
||||
}
|
||||
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 "<A href=\"{$this->uploadPath}/{$r->$f}\">{$r->$f}</a>";
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
echo $r->$f;
|
||||
}
|
||||
}
|
||||
echo "</td>";
|
||||
}
|
||||
else if(substr($f,0,7)=="website")
|
||||
{
|
||||
else if(substr($f,0,7)=="website") {
|
||||
echo "<td valign=\"top\">";
|
||||
echo "<a href=\"{$r->$f}\" target=\"_blank\">{$r->$f}</a>";
|
||||
echo "</td>";
|
||||
}
|
||||
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 "<td valign=\"top\">{$o['val']}</td>";
|
||||
$TE_Found_Field=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!$TE_Found_Field)
|
||||
{
|
||||
if(!$TE_Found_Field) {
|
||||
echo "<td valign=\"top\"></td>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
//if its not an array, then each element is simply a data value anyways, so we can just show the value
|
||||
echo "<td valign=\"top\">{$r->$f}</td>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
echo "<td valign=\"top\">{$r->$f}</td>";
|
||||
}
|
||||
}
|
||||
@ -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 "<a title=\"{$button["name"]}\" href=\"{$button["link"]}?$pk=".$r->$pk."\"><img src=\"{$button["icon"]}.$icon_extension\" border=0></a>";
|
||||
echo " ";
|
||||
}
|
||||
@ -1261,9 +1242,12 @@ class TableEditor
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo " (Total: $foundrows)\n";
|
||||
|
||||
}
|
||||
|
||||
echo "<br />";
|
||||
echo "</div><!--table-editor-wrapper-->\n";
|
||||
}
|
||||
|
||||
function month_selector($name,$selected="")
|
||||
|
Loading…
Reference in New Issue
Block a user