2
0
mirror of https://github.com/ACSPRI/queXS synced 2024-04-02 12:12:16 +00:00

Added contactdetails tab (like respondent information) and CONTACT_DETAILS_TAB config directive to display it

Added ability to expand/contract the header when not in use with HEADER_EXPANDER config directive and jQuery javascript code
This commit is contained in:
azammitdcarf
2011-01-27 01:28:02 +00:00
parent f2e9f1c8d4
commit 2f78104de5
4 changed files with 212 additions and 6 deletions

View File

@@ -202,6 +202,16 @@ if (!defined('DEFAULT_TAB')) define('DEFAULT_TAB','casenotes');
*/ */
if (!defined('DEFAULT_TAB_APPOINTMENT')) define('DEFAULT_TAB_APPOINTMENT','casenotes'); if (!defined('DEFAULT_TAB_APPOINTMENT')) define('DEFAULT_TAB_APPOINTMENT','casenotes');
/**
* Show the contact details tab?
*/
if (!defined('CONTACT_DETAILS_TAB')) define('CONTACT_DETAILS_TAB', false);
/**
* Enable a header expander for the main page to shrink/expand when not in use?
*/
if (!defined('HEADER_EXPANDER')) define('HEADER_EXPANDER', false);
/** /**
* Database configuration for queXS * Database configuration for queXS
*/ */

162
contactdetails.php Normal file
View File

@@ -0,0 +1,162 @@
<?
/**
* Display sample details of respondent
*
*
* This file is part of queXS
*
* queXS 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; either version 2 of the License, or
* (at your option) any later version.
*
* queXS 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 queXS; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* @author Adam Zammit <adam.zammit@acspri.org.au
* @copyright Australian Consortium for Social and Political Research Incorporated (ACSPRI) 2011
* @package queXS
* @subpackage user
* @link http://www.acspri.org.au/ queXS was writen for ACSPRI
* @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License (GPL) Version 2
*
*/
/**
* Configuration file
*/
include ("config.inc.php");
/**
* Database file
*/
include ("db.inc.php");
/**
* XHTML functions
*/
include ("functions/functions.xhtml.php");
/**
* Calendar functions
*/
include("functions/functions.calendar.php");
/**
* Operator functions
*/
include("functions/functions.operator.php");
/**
* Input functions
*/
include("functions/functions.input.php");
$js = array("js/window.js");
if (AUTO_LOGOUT_MINUTES !== false)
{
$js[] = "include/jquery-ui/js/jquery-1.4.2.min.js";
$js[] = "js/childnap.js";
}
xhtml_head(T_("Contact details"),true,array("css/table.css","css/respondent_interface2.css"),$js);
global $db;
$db->StartTrans();
$operator_id = get_operator_id();
$call_attempt_id = get_call_attempt($operator_id,false);
$case_id = get_case_id($operator_id);
if (isset($_POST['submit']))
add_respondent($case_id,$_POST['firstName'],$_POST['lastName'],$_POST['Time_zone_name']);
if (isset($_GET['respondent_id']) && $_GET['respondent_id'] == 0)
{
?>
<form method="post" action="?">
<? display_respondent_form(false,$case_id); ?>
<div><input type='submit' name='submit' id='submit' value='<? echo T_("Add respondent"); ?>'/></div>
</form>
<div><a href="?"><? echo T_("Go back"); ?></a></div>
<?
}
else
{
print "<div>" . T_("Case id:") . " $case_id</div>";
print "<div>" . T_("Respondent:");
if (isset($_GET['respondent_id']) && $_GET['respondent_id'] != 0)
{
$respondent_id = bigintval($_GET['respondent_id']);
$sql = "UPDATE `call_attempt`
SET respondent_id = '$respondent_id'
WHERE call_attempt_id = '$call_attempt_id'";
$db->Execute($sql);
}
/* List respondents
*
*/
$sql = "SELECT r.firstName, r.lastName, r.respondent_id,r.Time_zone_name,CASE WHEN c.respondent_id = r.respondent_id THEN 'selected=\'selected\'' ELSE '' END AS selected
FROM respondent AS r
LEFT JOIN call_attempt AS c ON ( c.call_attempt_id = '$call_attempt_id' )
WHERE r.case_id = '$case_id'";
$rs = $db->GetAll($sql);
$timezone = "";
print "<select id='respondent' name='respondent' onchange=\"LinkUp('respondent')\"><option value='?respondent_id=0' class='addresp'>" . T_("Add respondent") . "</option>";
if (!empty($rs))
{
foreach($rs as $r)
{
if (!empty($r['selected'])) $timezone = $r['Time_zone_name'];
print "<option value='?respondent_id={$r['respondent_id']}' {$r['selected']}>{$r['firstName']} {$r['lastName']}</option>";
}
}
print "</select></div>";
print "<div>$timezone</div>";
//display sample details
// use type = 1 to limit to non specific sample variables
$sql = "SELECT s.var,s.val
FROM sample_var as s
JOIN `case` as c on (c.case_id = '$case_id' and c.sample_id = s.sample_id)
WHERE s.type = 1";
$rs = $db->GetAll($sql);
print "<div id='details'>";
if (!empty($rs))
{
xhtml_table($rs,array("var","val"),array(T_("Var"),T_("Value")));
}
print "</div>";
}
xhtml_foot();
$db->CompleteTrans();
?>

View File

@@ -110,20 +110,23 @@ if (AUTO_LOGOUT_MINUTES !== false)
$body = false; $body = false;
} }
if (HEADER_EXPANDER)
$js[] = "js/headerexpand.js";
xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js); xhtml_head(T_("queXS"), $body, array("css/index.css","css/tabber.css","include/jquery-ui/css/smoothness/jquery-ui-1.8.2.custom.css") , $js);
print $script; print $script;
?> ?>
<div id="casefunctions"> <div id="casefunctions" class="header">
<div class='box'><a href="javascript:poptastic('call.php?end=end');"><? echo T_("End"); ?></a></div> <div class='box'><a href="javascript:poptastic('call.php?end=end');"><? echo T_("End"); ?></a></div>
<div class='box'><a href="javascript:poptastic('appointment.php');"><? echo T_("Appointment"); ?></a></div> <div class='box'><a href="javascript:poptastic('appointment.php');"><? echo T_("Appointment"); ?></a></div>
<div class='box'><a href="javascript:poptastic('call.php');"><? echo T_("Call/Hangup"); ?></a></div> <div class='box important'><a href="javascript:poptastic('call.php');"><? echo T_("Call/Hangup"); ?></a></div>
<div class='box'><a href="javascript:poptastic('supervisor.php');"><? echo T_("Supervisor"); ?></a></div> <div class='box'><a href="javascript:poptastic('supervisor.php');"><? echo T_("Supervisor"); ?></a></div>
<div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><? echo T_("Start REC"); ?></a></div> <div class='box' id='recbox'><a id='reclink' class='offline' href="javascript:poptastic('record.php?start=start');"><? echo T_("Start REC"); ?></a></div>
</div> </div>
<div id="content"> <div id="content" class="content">
<? <?
$case_id = get_case_id($operator_id,true); $case_id = get_case_id($operator_id,true);
@@ -147,16 +150,16 @@ xhtml_object($data,"main-content");
?> ?>
</div> </div>
<div id="respondent"> <div id="respondent" class="header">
<?xhtml_object("respondent.php","main-respondent");?> <?xhtml_object("respondent.php","main-respondent");?>
</div> </div>
<div id="qstatus"> <div id="qstatus" class="header">
<?xhtml_object("status.php","main-qstatus");?> <?xhtml_object("status.php","main-qstatus");?>
</div> </div>
<div id="calllist"> <div id="calllist" class="header">
<div class="tabber" id="tab-main"> <div class="tabber" id="tab-main">
@@ -167,6 +170,14 @@ xhtml_object($data,"main-content");
<div id="div-casenotes" class="tabberdiv"><?xhtml_object("casenote.php","main-casenotes");?></div> <div id="div-casenotes" class="tabberdiv"><?xhtml_object("casenote.php","main-casenotes");?></div>
</div> </div>
<? if (CONTACT_DETAILS_TAB) { ?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'contactdetails' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'contactdetails' && $appointment))
print "tabbertabdefault"; ?>">
<h2><? echo T_("Contact details"); ?></h2>
<div id="div-contactdetails" class="tabberdiv"><?xhtml_object("contactdetails.php","main-contactdetails");?></div>
</div>
<? }?>
<div class="tabbertab <? if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment)) <div class="tabbertab <? if ((DEFAULT_TAB == 'calllist' && !$appointment) || (DEFAULT_TAB_APPOINTMENT == 'calllist' && $appointment))
print "tabbertabdefault"; ?>"> print "tabbertabdefault"; ?>">
@@ -220,6 +231,8 @@ xhtml_object($data,"main-content");
</div> </div>
<script type='text/javascript' src='js/headerexpand.js'/>
<? <?
xhtml_foot(); xhtml_foot();

21
js/headerexpand.js Normal file
View File

@@ -0,0 +1,21 @@
//Apply to all items of class header
$(document).ready(function(){
$(".header").hover(
//function on mouse over
function(){
$(".header").css("height","30%");
$(".content").css("height","70%");
$(".content").css("top","30%");
$(".box:not(.important)").css("display","inline");
},
//function on mouse out
function(){
$(".header").css("height","5%");
$(".content").css("height","95%");
$(".content").css("top","5%");
$(".box:not(.important)").css("display","none");
}
);
});