Skip to content

Commit

Permalink
Added feature: Usability enhancements to response browsing
Browse files Browse the repository at this point in the history
Dev Unfinished

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_dev@8342 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Feb 4, 2010
1 parent 9f4d7ba commit 298594e
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 67 deletions.
20 changes: 13 additions & 7 deletions admin/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,6 @@
if(hasRight($surveyid,'export')) {include('exportresults.php');}
else { include('access_denied.php');}
}
elseif ($action == 'exportspss')
{
if(hasRight($surveyid,'export')) {include('export_data_spss.php');}
else { include('access_denied.php');}
}
elseif ($action == 'exportr')
{
if(hasRight($surveyid,'export')) {include('export_data_r.php');}
Expand Down Expand Up @@ -438,11 +433,11 @@
}

if (!isset($assessmentsoutput) && !isset($statisticsoutput) && !isset($browseoutput) && !isset($savedsurveyoutput) && !isset( $listcolumnoutput ) &&
!isset($conditionsoutput) && !isset($importoldresponsesoutput) && !isset($exportspssoutput) && !isset($exportroutput) &&
!isset($conditionsoutput) && !isset($importoldresponsesoutput) && !isset($exportroutput) &&
!isset($vvoutput) && !isset($tokenoutput) && !isset($exportoutput) && !isset($templatesoutput) && !isset($iteratesurveyoutput) && (substr($action,0,4)!= 'ajax') && ($action!='update') &&
(isset($surveyid) || $action=='listurveys' || $action=='personalsettings' || //Still to check
$action=='importsurvey' || $action=='editsurvey' || $action=='updatesurvey' || $action=='ordergroups' || $action=='dataentry' ||
$action=='newsurvey' || $action=='listsurveys' || $action=='globalsettings' || $action=='editusergroups' ||
$action=='newsurvey' || $action=='listsurveys' || $action=='globalsettings' || $action=='editusergroups' || $action=='exportspss' ||
$action=='surveyrights' || $action=='quotas' || $action=='editusers' || $action=='' || $action=='login' || $action=='browse') )
{
if ($action=='editsurvey' || $action=='updatesurvey')
Expand All @@ -463,6 +458,17 @@
include('access_denied.php');
}
}
elseif ($action == 'exportspss')
{
if(hasRight($surveyid,'export'))
{
include('export_data_spss.php');
}
else
{
include('access_denied.php');
}
}
elseif ($action == 'browse')
{
if(hasRight($surveyid,'browse_response'))
Expand Down
86 changes: 44 additions & 42 deletions admin/browse.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
return;
}

$js_adminheader_includes[]='scripts/browse.js';


//CHECK IF SURVEY IS ACTIVATED AND EXISTS
$actquery = "SELECT * FROM ".db_table_name('surveys')." as a inner join ".db_table_name('surveys_languagesettings')." as b on (b.surveyls_survey_id=a.sid and b.surveyls_language=a.language) WHERE a.sid=$surveyid";

Expand Down Expand Up @@ -252,6 +255,10 @@
* it containts
* $fnames[] = array(<dbfieldname>, <some strange title>, <questiontext>, <group_id>, <questiontype>);
*/

$browseoutput .= "\n<script type='text/javascript'>
var strdeleteconfirm='".$clang->gT('Do you really want to delete this response?','js')."';
</script>\n";
if (!isset($_POST['sql']))
{$browseoutput .= $surveyoptions;} //don't show options when called from another script with a filter on
else
Expand All @@ -268,52 +275,44 @@

}

if (isset($_POST['deleteanswer']) && $_POST['deleteanswer']!='')
{
$_POST['deleteanswer']=(int) $_POST['deleteanswer'];
$query="delete FROM $surveytable where id={$_POST['deleteanswer']}";
$connect->execute($query) or safe_die("Could not delete response<br />$dtquery<br />".$connect->ErrorMsg());
}

$fields=createFieldMap($surveyid,'full');
$counter=0;
foreach ($fields as $fielddetails)
{
if ($fielddetails['fieldname']=='startdate'){
$fielddetails['question']=$clang->gT("Date started");
}
elseif ($fielddetails['fieldname']=='datestamp'){
$fielddetails['question']=$clang->gT("Date last action");

if ($counter==1){
$fnames[] = array("completed", "Completed", $clang->gT("Completed"), "0", 'D');
}
elseif ($fielddetails['fieldname']=='token'){
$fielddetails['question']=$clang->gT("Token ID");
}
elseif ($fielddetails['fieldname']=='ipaddr'){
$fielddetails['question']=$clang->gT("IP address");
}

if ($fielddetails['fieldname']=='lastpage'){
$counter++; continue;
}
$fnames[]=array($fielddetails['fieldname'],
$fielddetails['fieldname'],
$fielddetails['question'],
$fielddetails['gid'],
$fielddetails['type']
);
$counter++;
}

$fnames[] = array("completed", "Completed", $clang->gT("Completed"), "0", 'D');

if ($surveyinfo['datestamp'] == "Y") //Add datestamp
{
// submitdate for not-datestamped surveys is always 1980/01/01
// so only display it when datestamped
$fnames[] = array("submitdate", "submitdate", $clang->gT("Date Submitted"), "0", 'D');
}

if ($surveyinfo['refurl'] == "Y") //refurl
{
$fnames[] = array("refurl", "refurl", $clang->gT("Referring URL"), "0",'');
}
$fncount = count($fnames);

//NOW LETS CREATE A TABLE WITH THOSE HEADINGS
if ($fncount < 10) {$cellwidth = "10%";} else {$cellwidth = "100";}

$tableheader = "<!-- DATA TABLE -->";
if ($fncount < 10) {$tableheader .= "<table class='browsetable' width='100%' cellpadding='0' cellspacing='1'>\n";}
else {$tableheader .= "<table class='browsetable' border='0' cellpadding='1' cellspacing='1' style='border: 1px solid #555555'>\n";}
if ($fncount < 10) {$tableheader .= "<table class='browsetable' width='100%'>\n";}
else {$tableheader .= "<table class='browsetable'>\n";}
$tableheader .= "\t<thead><tr valign='top'>\n"
. "<th class='evenrow' width='$cellwidth'><strong>id</strong></th>\n";
. "<th>&nbsp;</th>\n"
. "<th>Actions</th>\n";
foreach ($fnames as $fn)
{
if (!isset($currentgroup)) {$currentgroup = $fn[3]; $gbc = "oddrow";}
Expand All @@ -323,7 +322,7 @@
if ($gbc == "oddrow") {$gbc = "evenrow";}
else {$gbc = "oddrow";}
}
$tableheader .= "<th class='$gbc' width='$cellwidth'><strong>"
$tableheader .= "<th class='$gbc'><strong>"
. strip_javascript("$fn[2]")
. "</strong></th>\n";
}
Expand Down Expand Up @@ -401,7 +400,7 @@

$browseoutput .= "<div class='menubar'>\n"
. "\t<div class='menubar-title'>\n"
. "<strong>".$clang->gT("Data View Control")."</strong></div>\n"
. "<strong>".$clang->gT("Data view control")."</strong></div>\n"
. "\t<div class='menubar-main'>\n";
if (!isset($_POST['sql']))
{
Expand All @@ -421,32 +420,29 @@
"<img name='DataEnd' align='left' src='$imagefiles/dataend.png' alt='".$clang->gT("Show last..")."' /></a>\n"
."<img src='$imagefiles/seperator.gif' border='0' hspace='0' align='left' alt='' />\n";
}
$selectshow='';
$selectinc='';
$selecthide='';
if(incompleteAnsFilterstate() == "inc")
{
$selecthide="";
$selectshow="";
$selectinc="selected='selected'";
}
elseif (incompleteAnsFilterstate() == "filter")
{
$selecthide="selected='selected'";
$selectshow="";
$selectinc="";
}
else
{
$selecthide="";
$selectshow="selected='selected'";
$selectinc="";
}

$browseoutput .="<form action='$scriptname?action=browse' id='browseresults' method='post'><font size='1' face='verdana'>\n"
."<img src='$imagefiles/blank.gif' width='31' height='20' border='0' hspace='0' align='right' alt='' />\n"
."".$clang->gT("Records Displayed:")."<input type='text' size='4' value='$dtcount2' name='limit' id='limit' />\n"
."&nbsp;&nbsp; ".$clang->gT("Starting From:")."<input type='text' size='4' value='$start' name='start' id='start' />\n"
."&nbsp;&nbsp; ".$clang->gT("Display:")."<select name='filterinc' onchange='javascript:document.getElementById(\"limit\").value=\"\";submit();'>\n"
."\t<option value='show' $selectshow>".$clang->gT("All responses")."</option>\n"
."\t<option value='filter' $selecthide>".$clang->gT("Completed responses only")."</option>\n"
."\t<option value='show' $selectshow>".$clang->gT("All responses")."</option>\n"
."\t<option value='incomplete' $selectinc>".$clang->gT("Incomplete responses only")."</option>\n"
."</select>\n"
."&nbsp;&nbsp;&nbsp;&nbsp;<input type='submit' value='".$clang->gT("Show")."' />\n"
Expand All @@ -459,7 +455,7 @@
$browseoutput .= "<input type='hidden' name='sql' value='".html_escape($_POST['sql'])."' />\n";
}
$browseoutput .= "</form></div>\n"
."\t</div>\n";
."\t</div><form action='$scriptname?action=browse' id='resulttableform' method='post'>\n";

$browseoutput .= $tableheader;
$dateformatdetails=getDateFormatData($_SESSION['dateformat']);
Expand All @@ -473,9 +469,11 @@
else {$bgcc = "evenrow";}
}
$browseoutput .= "\t<tr class='$bgcc' valign='top'>\n"
."<td align='center'>\n"
."<a href='$scriptname?action=browse&amp;sid=$surveyid&amp;subaction=id&amp;id={$dtrow['id']}' title='".$clang->gT("View This Record")."'>"
."{$dtrow['id']}</a></td>\n";
."<td align='center'><input type='checkbox' value='{$dtrow['id']}' name='markedresponses[]' /></td>\n"
."<td align='center'>
<a href='$scriptname?action=browse&amp;sid=$surveyid&amp;subaction=id&amp;id={$dtrow['id']}'><img src='$imagefiles/token_viewanswer.png' alt='".$clang->gT('View response details')."'/></a>
<a href='$scriptname?action=dataentry&amp;sid=$surveyid&amp;subaction=edit&amp;id={$dtrow['id']}'><img src='$imagefiles/token_edit.png' alt='".$clang->gT('Edit this response')."'/></a>
<a><img id='deleteresponse_{$dtrow['id']}' src='$imagefiles/token_delete.png' alt='".$clang->gT('Delete this response')."' class='deleteresponse'/></a></td>\n";

$i = 0;
if ($surveyinfo['private'] == "N" && $dtrow['token'])
Expand Down Expand Up @@ -512,7 +510,11 @@
}
$browseoutput .= "\t</tr>\n";
}
$browseoutput .= "</table>\n<br />\n";
$browseoutput .= "</table>
<input type='hidden' name='sid' value='$surveyid' />
<input type='hidden' name='subaction' value='all' />
<input id='deleteanswer' name='deleteanswer' value='' type='hidden' />
<form>\n<br />\n";
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion admin/html.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@



if (isset($surveyid) && $surveyid && $action!='dataentry' && $action!='browse')
if (isset($surveyid) && $surveyid && $action!='dataentry' && $action!='browse' && $action!='exportspss')
{
if(hasRight($surveyid))
{
Expand Down
7 changes: 6 additions & 1 deletion admin/scripts/admin_core.js
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,9 @@ String.prototype.splitCSV = function(sep) {
} else foo = foo.shift().split(sep).concat(foo);
} else foo[x].replace(/""/g, '"');
} return foo;
};
};

// This is a helper function to extract the question ID from a DOM ID element
function removechars(strtoconvert){
return strtoconvert.replace(/[a-zA-Z_]/g,"");
}
5 changes: 0 additions & 5 deletions admin/scripts/answers.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,6 @@ function updaterowproperties()
})
}

// This is a helper function to extract the question ID from a DOM ID element
function removechars(strtoconvert){
return strtoconvert.replace(/[a-zA-Z_]/g,"");
}

function updatecodes()
{

Expand Down
25 changes: 25 additions & 0 deletions admin/scripts/browse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* LimeSurvey
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v2 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id: browse.php 8331 2010-02-01 23:59:05Z c_schmitz $
*/

$(document).ready(function(){
$(".deleteresponse").click(function(){
thisid=removechars($(this).attr('id'));
answer = confirm(strdeleteconfirm);
if (answer==true)
{
$('#deleteanswer').val(thisid);
$('#resulttableform').submit();
}
});
});
5 changes: 0 additions & 5 deletions admin/scripts/subquestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ function updaterowproperties()
})
}

// This is a helper function to extract the question ID from a DOM ID element
function removechars(strtoconvert){
return strtoconvert.replace(/[a-zA-Z_]/g,"");
}

function updatecodes()
{

Expand Down
11 changes: 5 additions & 6 deletions admin/styles/default/adminstyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -611,14 +611,13 @@ a.optoutemail {

.browsetable th {
background-color: #D2E0F2;
font-size:10pt;
font-size:9pt;
padding:2px;
text-align: center;
min-width:80px;
}

.browsetable td {
width:140px;
min-width:120px;
font-size:8pt;
padding:1px 2px;
text-align: center;
Expand All @@ -640,9 +639,9 @@ a.optoutemail {
display:inline;
}

.browsetable td:first-child {
min-width:50px;
font-weight:bold;
.browsetable th:first-child {
width:20px;
min-width: 0px;
}

.answertable th {
Expand Down

0 comments on commit 298594e

Please sign in to comment.