diff --git a/api.php b/api.php index 2bf0601..9c8dc28 100644 --- a/api.php +++ b/api.php @@ -38,15 +38,33 @@ $ret=array(); switch($request[0]) { case "conferences": - $ret['status']="ok"; - $ret['conferences']=array(); + if($request[1]=="switch") { + if($_POST['conferences_id']) { + //this makes sure its valid and sets teh session + switchConference($_POST['conferences_id']); - $response=array(); - $q=mysql_query("SELECT id,name,type FROM conferences WHERE status='running' ORDER BY id"); - while($r=mysql_fetch_assoc($q)) { - $response[]=$r; + //get rid of their current roles, and load their record for the new conference + if(is_array($_SESSION['roles'])) { + $_SESSION['roles']=array(); + user_conference_load($_SESSION['accounts_id'],$_SESSION['conferences_id']); + } + $ret['status']="ok"; + } else { + $ret['status']="error"; + $ret['error']='conferences_id (integer) is required'; + } + } + else { + $ret['status']="ok"; + $ret['conferences']=array(); + + $response=array(); + $q=mysql_query("SELECT id,name,type FROM conferences WHERE status='running' ORDER BY id"); + while($r=mysql_fetch_assoc($q)) { + $response[]=$r; + } + $ret['conferences']=$response; } - $ret['conferences']=$response; break; case "dates": diff --git a/common.inc.bootstrap.php b/common.inc.bootstrap.php index 132aa12..bee62e2 100644 --- a/common.inc.bootstrap.php +++ b/common.inc.bootstrap.php @@ -198,15 +198,18 @@ if(!$_SESSION['conferences_id']) { } } -//move the conference stuff before the configuration loading, so we can load the right configuration for the conference :) -if(isset($_GET['switchconference'])) { - //make sure its good - $cid=intval($_GET['switchconference']); +function switchConference($cid) { + $cid=intval($cid); // echo "cid=$cid"; $q=mysql_query("SELECT * FROM conferences WHERE id='$cid' AND status='running'"); if($r=mysql_fetch_object($q)) { $_SESSION['conferences_id']=$cid; } +} +//move the conference stuff before the configuration loading, so we can load the right configuration for the conference :) +if(isset($_GET['switchconference'])) { + //make sure its good + switchConference($_GET['switchconference']); unset($_SESSION['nav']); } diff --git a/js/nav.js b/js/nav.js index 85a674e..18d3fa9 100644 --- a/js/nav.js +++ b/js/nav.js @@ -38,7 +38,7 @@ function taskNavLevel(l1,l2,l3,l4) { //show the secondary $("#secondarymenu").show(); //and hide the tertiary - $("#tertiarymenu").hide(); +// $("#tertiarymenu").hide(); }); }