Update rolestasks to be conference-type specific

Add a  'new' theme for TUAG to start implementing
This commit is contained in:
james 2010-08-20 17:40:11 +00:00
parent 71b0489493
commit 69234c1657
23 changed files with 257 additions and 33 deletions

View File

@ -35,6 +35,7 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false) {
global $roles;
global $prependdir;
global $conference;
global $theme;
//do this so we can use send_header() a little more loosly and not worry about it being sent more than once.
if($HEADER_SENT) return;
@ -45,8 +46,11 @@ function send_header($title="", $nav=null, $icon=null, $titletranslated=false) {
<html>
<head>
<title><? if($title && !$titletranslated) echo i18n($title); else if($title) echo $title; else echo i18n($config['fairname']); ?></title>
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/jquery-ui-1.7.2.custom.css" type="text/css" media="all" />
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/theme/<?=$config['theme']?>/sfiab.css" type="text/css" media="all" />
<?
foreach($theme['css'] AS $cssfile) {
echo "<link rel=\"stylesheet\" href=\"{$config['SFIABDIRECTORY']}/theme/{$config['theme']}/{$cssfile}\" type=\"text/css\" media=\"all\" />\n";
}
?>
<link rel="stylesheet" href="<?=$config['SFIABDIRECTORY']?>/tableeditor.css" type="text/css" media="all" />
<meta charset="UTF-8">
</head>
@ -205,6 +209,7 @@ if(is_array($nav)) {
?>
<ul class="primarynav">
<?
/*
if ($config['website']) {
if ($config['website_name']) {
echo "<li><a href=\"{$config['website']}\">{$config['website_name']}</a></li>";
@ -231,22 +236,21 @@ if(is_array($nav)) {
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/important_dates.php\">".i18n("Important Dates").'</a></li>';
echo $registrationconfirmationlink;
/*
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/register_participants.php\">".i18n("Participant Registration").'</a></li>';
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_login.php?type=judge\">".i18n("Judges Registration").'</a></li>';
if($config['volunteer_enable'] == 'yes') {
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/user_login.php?type=volunteer\">".i18n("Volunteer Registration").'</a></li>';
}
*/
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/committees.php\">".i18n("Committee").'</a></li>';
if($config['show_winners'] == "yes") {
echo "<li><a href=\"{$config['SFIABDIRECTORY']}/winners.php\">".i18n("Winners").'</a></li>';
}
*/
if(is_array($_SESSION['roles'])) {
foreach($_SESSION['roles'] AS $roletype) {
$roleid=$roles[$roletype]['id'];
$q=mysql_query("SELECT * FROM rolestasks WHERE roles_id='$roleid' AND pid=0 ORDER BY task");
$q=mysql_query("SELECT * FROM rolestasks WHERE roles_id='$roleid' AND pid=0 AND conferencetype='{$conference['type']}' ORDER BY task");
if(mysql_num_rows($q)==1) {
$setPrimaryNav=true;
}

View File

@ -1 +1 @@
205
206

1
db/db.update.206.sql Normal file
View File

@ -0,0 +1 @@
ALTER TABLE `rolestasks` ADD `conferencetype` ENUM( 'sciencefair', 'scienceolympics' ) NOT NULL;

View File

@ -27,17 +27,17 @@
$level=0;
function doTree($id,$roleid) {
function doTree($id,$roleid,$ctype) {
global $level;
global $config;
$level++;
$q=mysql_query("SELECT * FROM rolestasks WHERE pid=$id AND roles_id='$roleid' ORDER BY ord");
$q=mysql_query("SELECT * FROM rolestasks WHERE pid=$id AND roles_id='$roleid' AND conferencetype='".mysql_real_escape_string($ctype)."' ORDER BY ord");
echo "<ul class=\"rolelist\">";
while($r=mysql_fetch_object($q)) {
echo "<li class=\"roletask\" id=\"rolestasks_{$r->id}\">";
//can only delete if there's no children
$tq=mysql_query("SELECT * FROM rolestasks WHERE pid='$r->id'");
$tq=mysql_query("SELECT * FROM rolestasks WHERE pid='$r->id' AND conferencetype='".mysql_real_escape_string($ctype)."'");
if(mysql_num_rows($tq)==0) {
echo "<a href=\"#\" onclick=\"return removeTask($r->id)\"><img src=\"{$config['SFIABDIRECTORY']}/images/16/button_cancel.png\" style=\"border: 0px;\"></a>&nbsp;";
}
@ -57,7 +57,7 @@ function doTree($id,$roleid) {
echo "<span id=\"task_save_{$r->id}\"></span>";
echo "</li>\n";
doTree($r->id,$roleid);
doTree($r->id,$roleid,$ctype);
}
$level--;
if($level<4) {
@ -73,7 +73,8 @@ function doTree($id,$roleid) {
if($_GET['action']=="load") {
if($_GET['roleid']) {
$roleid=intval($_GET['roleid']);
doTree(0,$roleid);
$ctype=trim($_GET['ctype']);
doTree(0,$roleid,$ctype);
}
exit;
}
@ -81,26 +82,29 @@ function doTree($id,$roleid) {
if($_POST['action']=="addtask") {
$pid=intval($_POST['pid']);
$roleid=intval($_POST['roleid']);
$ctype=trim($_POST['ctype']);
if($pid==0)
$level=0;
else {
$q=mysql_query("SELECT * FROM rolestasks WHERE id='$pid'");
$q=mysql_query("SELECT * FROM rolestasks WHERE id='$pid' AND conferencetype='".mysql_real_escape_string($ctype)."'");
$r=mysql_fetch_object($q);
$level=$r->level+1;
}
$q=mysql_query("SELECT MAX(ord) AS o FROM rolestasks WHERE pid='$pid'");
$q=mysql_query("SELECT MAX(ord) AS o FROM rolestasks WHERE pid='$pid' AND conferencetype='".mysql_real_escape_string($ctype)."'");
$r=mysql_fetch_object($q);
$ord=$r->o+1;
print_r($r);
mysql_query("INSERT INTO rolestasks (pid,roles_id,level,task,ord,link) VALUES (
mysql_query("INSERT INTO rolestasks (pid,roles_id,level,task,ord,link,conferencetype) VALUES (
'$pid',
'$roleid',
'$level',
'".mysql_real_escape_string($_POST['task'])."',
'$ord',
'')");
'',
'".mysql_real_escape_string($ctype)."'
)");
echo mysql_error();
exit;
}
@ -183,31 +187,39 @@ NOT intended for end-user usage. This tool exists only temporarily for develope
<script type="text/javascript">
var roleid=0;
var ctype='';
function roleChange(o) {
roleid=o.value;
reloadTasks();
}
function typeChange(o) {
ctype=o.value;
reloadTasks();
}
function reloadTasks() {
$("#list").load("roletasks.php?action=load&roleid="+roleid,null,function() {
$(".roletask").draggable({revert: 'invalid'});
$(".roletask").droppable({
hoverClass: 'drop-below',
drop: function(event, ui) {
$(this).addClass('ui-state-highlight');
var dragid=ui.draggable.attr('id');
var dropid=this.id;
$.post("roletasks.php",{action: 'movetask', dragid: dragid, dropid: dropid}, function() {
reloadTasks();
});
}
})
});
if(roleid && ctype) {
$("#list").load("roletasks.php?action=load&roleid="+roleid+"&ctype="+ctype,null,function() {
$(".roletask").draggable({revert: 'invalid'});
$(".roletask").droppable({
hoverClass: 'drop-below',
drop: function(event, ui) {
$(this).addClass('ui-state-highlight');
var dragid=ui.draggable.attr('id');
var dropid=this.id;
$.post("roletasks.php",{action: 'movetask', dragid: dragid, dropid: dropid}, function() {
reloadTasks();
});
}
})
});
}
}
function addTask(id) {
var v=$("#newtask_"+id).val();
$.post("roletasks.php",{action: 'addtask', task: v, pid: id, roleid: roleid}, function() {
$.post("roletasks.php",{action: 'addtask', task: v, pid: id, roleid: roleid, ctype: ctype}, function() {
reloadTasks();
});
return false;
@ -252,8 +264,16 @@ while($r=mysql_fetch_object($q)) {
echo "<option value=\"$r->id\">$r->name</option>\n";
}
echo "</select>\n";
echo "</form>";
echo "<br />";
$types=array("sciencefair"=>"Science Fair", "scienceolympics"=>"Science Olympics");
echo "<select name=\"ctype\" onchange=\"typeChange(this)\">";
echo "<option value=\"\">Choose a type</option>\n";
foreach($types AS $t=>$tn) {
echo "<option value=\"$t\">$tn</option>\n";
}
echo "</select>\n";
echo "</form>\n";
echo "<div id=\"list\">";

View File

@ -23,5 +23,9 @@
$theme['name']="Default";
$theme['description']="The default theme";
$theme['author']="James Grant <james@lightbox.org>";
$theme['css']=array(
"sfiab.css",
"jquery-ui-1.7.2.custom.css"
);
?>

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

163
theme/new/sfiab-layout.css Normal file
View File

@ -0,0 +1,163 @@
/** SFIAB-layout.css
Common Layout Styles for SFIAB and SOIAB Applications
*/
.clear {
clear: both;
}
body {
margin: 0;
padding: 0;
}
div#page-wrapper {
width: 100%;
}
div#page {
}
div#page-inner {
margin-left: auto;
margin-right: auto;
width: 970px;
}
div#notice_area {
}
div#topnav {
display: block;
float: right;
}
div#header {
border: 1px solid #888;
}
div#header-logo a img {
border: none;
display: block;
float: left;
width: 100px;
}
div#header-title {
border: 1px solid #888;
display: block;
float: left;
width: 360px;
}
div#header-conferences {
border: 1px solid #888;
display: block;
float: right;
}
div#header-login {
border: 1px solid #888;
display: block;
float: right;
width: 120px;
}
div#primarymenu {
border: 1px solid #888;
display: block;
float: left;
}
div#secondarymenu {
border: 1px solid #888;
display: block;
float: left;
}
div#tertiarymenu {
border: 1px solid #888;
display: block;
float: left;
width: 250px;
}
div#tertiarymenu_accordion {
}
span.menu-label {
display: block;
float: left;
}
div#main {
border: 1px solid #888;
display: block;
float: left;
}
div#main-title {
border: 1px solid #888;
display: block;
float: left;
width: 710px;
}
div#work-area {
border: 1px solid #888;
display: block;
float: left;
width: 710px;
}
div#main-topic-title,
div#main-content {
border: 1px solid #888;
display: block;
float: left;
width: 710px;
}
ul.primarynav {
display: block;
float: left;
}
ul.primarynav li {
display: block;
float: left;
margin: 10px 10px 10px 10px;
}
ul.secondarynav {
display: block;
float: left;
}
ul.secondarynav li {
display: block;
float: left;
margin: 10px 10px 10px 10px;
}
div#main-icon {
display: block;
float: left;
}
div#topic-title {
display: block;
float: left;
}
div#help-icon {
display: block;
float: right;
}

32
theme/new/theme.php Normal file
View File

@ -0,0 +1,32 @@
<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2008 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.
*/
$theme['name']="New Theme Designed by TUAG";
$theme['description']="New theme under development by TUAG";
$theme['author']="James Grant <james@lightbox.org>";
$theme['css']=array(
"jquery-ui-1.7.2.custom.css",
"sfiab-common.css",
"sfiab-layout.css",
);
?>