Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/2.1' into 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 29, 2012
2 parents 0f8c7a5 + 59aca5f commit d959f98
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 51 deletions.
72 changes: 39 additions & 33 deletions application/config/config-defaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,26 @@
* defaultpass (string)
* The password for the default administration username when LimeSurvey is installed
*/
$config['defaultpass'] = 'password';
$config['defaultpass'] = 'password';

/**
* admintheme (string)
* This setting specifys the directory where the admin finds it theme/css style files, e.g. setting 'default' points to /admin/styles/default
* This setting is overridden by the global settings in the administration.
*/
$config['admintheme'] = 'gringegreen';
$config['admintheme'] = 'gringegreen';

/**
* adminthemeiconsize (integer)
* This settings describes the icon size for a normal toolbar icon - default for gringegreen is 32
*/
$config['adminthemeiconsize'] = 32;
$config['adminthemeiconsize'] = 32;

/**
* login_max_attempts (integer)
* If the user enters password incorrectly lock them out after this many attempts
*/
$config['login_max_attempts'] = 3;
$config['login_max_attempts'] = 3;

/**
* login_lockout_time (integer)
Expand All @@ -73,18 +73,18 @@
* The default language to use - the available languages are the directory names in the /locale dir - for example de = German
* This setting is overridden by the global settings in the administration.
*/
$config['defaultlang'] = 'en';
$config['defaultlang'] = 'en';

/**
* timeadjust (integer)
* The number of hours to adjust between your webserver local time and your own local time (for datestamping responses)
* This setting is overridden by the global settings in the administration.
*/
$config['timeadjust'] = 0;
$config['timeadjust'] = 0;

/**
* @todo The following settings need to be moved to question attributes / advanced question settings / survey settings:
*
*
* repeatheadings
* minrepeatheadings
* shownoanswer
Expand All @@ -95,15 +95,15 @@

/**
* allowexportalldb (boolean)
* Setting this to false will only export prefixed tables when doing a database dump. If set to true ALL tables in the database will be exported
* Setting this to false will only export prefixed tables when doing a database dump. If set to true ALL tables in the database will be exported
*/
$config['allowexportalldb'] = false;
$config['allowexportalldb'] = false;

/**
* maxdumpdbrecords (integer)
* The maximum number of records that would be output in a go (and held in memory)during a database backup. Reduce this number if you're getting errors while backing up the entire database.
*/
$config['maxdumpdbrecords'] = 2500;
$config['maxdumpdbrecords'] = 2500;

/**
* allowmandbackwards (boolean)
Expand All @@ -113,7 +113,7 @@

/**
* deletenonvalues (boolean)
* By default, LimeSurvey does not save responses to conditional questions that haven't been or shouldn't have been answered/shown due to conditions.
* By default, LimeSurvey does not save responses to conditional questions that haven't been or shouldn't have been answered/shown due to conditions.
* To have LimeSurvey save these responses change this value to false.
* @todo Value not in use anymore ? has to be checked.
*/
Expand Down Expand Up @@ -169,21 +169,21 @@

/**
* defaulttemplate (string)
* This setting specifys the default theme used for the 'public list' of surveys
* This setting specifys the default theme used for the 'public list' of surveys
*/
$config['defaulttemplate'] = 'default';

/**
* allowedtemplateuploads (string)
* File types allowed to be uploaded in the templates section.
*/
$config['allowedtemplateuploads'] = 'gif,ico,jpg,png';
$config['allowedtemplateuploads'] = 'gif,ico,jpg,png';

/**
* allowedresourcesuploads (string)
* File types allowed to be uploaded in the resources sections, and with the HTML Editor
*/
$config['allowedresourcesuploads'] = '7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,ico,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip,pstpl,css,js';
$config['allowedresourcesuploads'] = '7z,aiff,asf,avi,bmp,csv,doc,fla,flv,gif,gz,gzip,ico,jpeg,jpg,mid,mov,mp3,mp4,mpc,mpeg,mpg,ods,odt,pdf,png,ppt,pxd,qt,ram,rar,rm,rmi,rmvb,rtf,sdc,sitd,swf,sxc,sxw,tar,tgz,tif,tiff,txt,vsd,wav,wma,wmv,xls,xml,zip,pstpl,css,js';

/**
* memorylimit (string)
Expand Down Expand Up @@ -273,7 +273,7 @@
* users accessing the /admin subdirectory, then the username returned by
* the webserver will be trusted by LimeSurvey and used for authentication
* unless a username mapping is used see auth_webserver_user_map below
*
*
* The user still needs to be defined in the limesurvey database in order to
* login and get his permissions (unless auth_webserver_autocreate_user is set to true)
*/
Expand Down Expand Up @@ -324,7 +324,7 @@
* The optionnal 'hook_get_auth_webserver_profile' function is for advanced user usage only.
* It is used to customize the profile of the imported user
* If set, this function will overwrite the auth_webserver_autocreate_profile defined above by its return value
*
*
* You can use any external DB in order to fill the profile for the user_name passed as the first parameter
* A dummy example for the 'hook_get_autouserprofile' function is given below:
*/
Expand Down Expand Up @@ -355,7 +355,7 @@ function hook_get_auth_webserver_profile($user_name)
*/
$config['filterxsshtml'] = true;

/**
/**
* usercontrolSameGroupPolicy (boolean)
* If this option is set to true, then limesurvey operators will only 'see'
* users that belong to at least one of their groups
Expand All @@ -367,7 +367,7 @@ function hook_get_auth_webserver_profile($user_name)
* demo_mode (boolean)
* If this option is set to true, then LimeSurvey will go into demo mode.
* Demo mode disables the following things:
*
*
* * Disables changing of the admin user's details and password
* * Disables uploading files on the Template Editor
* * Disables sending email invitations and reminders
Expand All @@ -376,7 +376,7 @@ function hook_get_auth_webserver_profile($user_name)
*/
$config['demo_mode'] = false;

/**
/**
* column_style (string)
* Because columns are tricky things, in terms of balancing visual
* layout against semantic markup. The choice has been left to the
Expand Down Expand Up @@ -463,7 +463,7 @@ function hook_get_auth_webserver_profile($user_name)
* pdforientation (string)
* PDF export responses settings - Set L for Landscape or P for portrait format
*/
$config['pdforientation'] = 'P';
$config['pdforientation'] = 'P';


/**
Expand All @@ -472,7 +472,7 @@ function hook_get_auth_webserver_profile($user_name)
*/

/**
* chartfontfile (string)
* chartfontfile (string)
* Set the font file name used to created the charts in statistics - this font must reside in <limesurvey root folder>/fonts
* Set this to specific font-file (for example 'DejaVuSans.ttf') or set it to 'auto' and LimeSurvey tried to pick the best font depending on your survey base language
*/
Expand Down Expand Up @@ -509,22 +509,22 @@ function hook_get_auth_webserver_profile($user_name)
$config['updatecheckperiod'] = 7;

/**
* updatekey (string)
* updatekey (string)
* Sets the default update key for the ComfortUpdater
*/
$config['updatekey'] = '';

/**
* showxquestions (string)
* showxquestions (string)
* Allows you to control whether or not {THEREAREXQUESTIONS} is displayed (if it is included in a template)
* hide = always hide {THEREAREXQUESTIONS}
* show = always show {THEREAREXQUESTIONS}
* choose = allow survey admins to choose
*/
$config['showxquestions'] = 'choose';

/**
* showgroupinfo (string)
* showgroupinfo (string)
* Allows you to control whether or not {GROUPNAME} and/or {GROUPDESCRIPTION} are displayed (if they are
* included in a template)
* none = always hide both title and description
Expand All @@ -534,9 +534,9 @@ function hook_get_auth_webserver_profile($user_name)
* choose = allow survey admins to choose
*/
$config['showgroupinfo'] = 'choose';

/**
* showqnumcode (string)
* showqnumcode (string)
* Allows you to control whether or not {QUESTION_NUMBER} and/or {QUESTION_CODE} are displayed (if they
* are included in a template)
* none = always hide both {QUESTION_NUMBER} and {QUESTION_CODE}
Expand All @@ -546,9 +546,9 @@ function hook_get_auth_webserver_profile($user_name)
* choose = allow survey admins to choose
*/
$config['showqnumcode'] = 'choose';

/**
* force_ssl string (string)
* force_ssl string (string)
* Forces LimeSurvey to run through HTTPS or to block HTTPS
* 'on' = force SSL/HTTPS to be on (This will cause LimeSurvey
* to fail in SSL is turned off)
Expand All @@ -568,9 +568,9 @@ function hook_get_auth_webserver_profile($user_name)

/**
* ssl_emergency_override (boolean)
* Forces SSL off if you've turned HTTPS/SSL on in the global settings but your server doesn't have HTTPS
* Forces SSL off if you've turned HTTPS/SSL on in the global settings but your server doesn't have HTTPS
* enabled, the only way to turn it off is by changing a value in the database
* directly. This allows you to force HTTPS off while you change the global
* directly. This allows you to force HTTPS off while you change the global
* settings for Force Secure.
*
* false = do nothing;
Expand Down Expand Up @@ -601,6 +601,12 @@ function hook_get_auth_webserver_profile($user_name)
*/
$config['googletranslateapikey'] = '';

/**
* characterset (string)
* Default character set for file import/export
*/
$config['characterset'] = 'auto';

/**
* file_upload_total_space_mb (integer)
* This variable defines the total space available to the file upload question across all surveys in MB. If set to 0 then no limit applies.
Expand Down Expand Up @@ -645,7 +651,7 @@ function hook_get_auth_webserver_profile($user_name)
/**
=== Advanced Setup ===================================================================================
The following URL and directory locations do not need to be modified unless you have a non-standard
LimeSurvey installation. Do not change unless you know what you are doing.
LimeSurvey installation. Do not change unless you know what you are doing.
*/

if(!isset($argv[0]))
Expand Down
12 changes: 6 additions & 6 deletions application/controllers/admin/dataentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -766,33 +766,33 @@ public function update()
{
if (isset($_POST['completed']) && ($_POST['completed']== "N"))
{
$updateqr .= $q->fieldname." = NULL, \n"; //dbQuoteID($q->fieldname)." = NULL, \n";
$updateqr .= dbQuoteID($q->fieldname) . " = NULL, \n";
}
elseif (isset($_POST['completed']) && $thisvalue=="")
{
$updateqr .= $q->fieldname." = '" . $_POST['completed'] . "', \n";// dbQuoteID($q->fieldname)." = " . dbQuoteAll($_POST['completed'],true) . ", \n";
$updateqr .= dbQuoteID($q->fieldname)." = " . dbQuoteAll($_POST['completed']) . ", \n";
}
else
{
$updateqr .= $q->fieldname." = '" . $thisvalue . "', \n"; //dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue,true) . ", \n";
$updateqr .= dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue) . ", \n";
}
}
elseif(!is_a($q, 'QuestionModule'))
{
$thisvalue = $q->filter($thisvalue, 'dataentry');
$updateqr .= $q->fieldname . ' = ' . $thisvalue == null ? 'NULL' : $thisvalue . ', \n';
$updateqr .= dbQuoteID($q->fieldname) . ' = ' . $thisvalue == null ? 'NULL' : dbQuoteAll($thisvalue) . ', \n';
}
else
{
$updateqr .= $q->fieldname." = '" . $thisvalue . "', \n"; // dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue,true) . ", \n";
$updateqr .= dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue) . ", \n";
}
}
$updateqr = substr($updateqr, 0, -3);
$updateqr .= " WHERE id=$id";

$updateres = dbExecuteAssoc($updateqr) or safeDie("Update failed:<br />\n<br />$updateqr");

$onerecord_link = $this->getController()->createUrl('/').'/admin/responses/index/surveyid/'.$surveyid.'/id/'.$id;
$onerecord_link = $this->getController()->createUrl('/').'/admin/responses/view/surveyid/'.$surveyid.'/id/'.$id;
$allrecords_link = $this->getController()->createUrl('/').'/admin/responses/index/surveyid/'.$surveyid;
$aDataentryoutput .= "<div class='messagebox ui-corner-all'><div class='successheader'>".$clang->gT("Success")."</div>\n"
.$clang->gT("Record has been updated.")."<br /><br />\n"
Expand Down
3 changes: 1 addition & 2 deletions application/controllers/admin/participantsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,6 @@ function getParticipants_json()
$aRowToAdd=array();
foreach ($records as $key => $row)
{
$surveycount = Participants::model()->getSurveyCount($row['participant_id']);
if (array_key_exists('can_edit', $row)) {
$sCanEdit = $row['can_edit'];
if (is_null($sCanEdit)) {
Expand All @@ -1022,7 +1021,7 @@ function getParticipants_json()
// Super admin
$sCanEdit = "true";
}
$aRowToAdd['cell'] = array($row['participant_id'], $sCanEdit, $row['firstname'], $row['lastname'], $row['email'], $row['blacklisted'], $surveycount, $row['language'], $row['ownername']);
$aRowToAdd['cell'] = array($row['participant_id'], $sCanEdit, $row['firstname'], $row['lastname'], $row['email'], $row['blacklisted'], $row['survey'], $row['language'], $row['ownername']);
$aRowToAdd['id'] = $row['participant_id'];
unset($row['participant_id'], $row['firstname'], $row['lastname'], $row['email'], $row['blacklisted'], $row['language'],$row['ownername'],$row['owner_uid'], $row['can_edit']);
foreach($row as $key=>$attvalue)
Expand Down
19 changes: 11 additions & 8 deletions application/models/Participants.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,16 @@ function getParticipants($page, $limit,$attid, $order = null, $userid = null)
$start = $limit * $page - $limit;
$selectValue = array();
$joinValue = array();
array_push($selectValue,"p.*");
array_push($selectValue,"luser.full_name as ownername");

$selectValue[] = "p.*";
$selectValue[] = "luser.full_name as ownername";

// Add survey count subquery
$subQuery = Yii::app()->db->createCommand()
->select('count(*) survey')
->from('{{survey_links}} sl')
->where('sl.participant_id = p.participant_id');
$selectValue[] = sprintf('(%s) survey',$subQuery->getText());
array_push($joinValue,"left join {{users}} luser ON luser.uid=p.owner_uid");
foreach($attid as $key=>$attid)
{
Expand All @@ -254,12 +262,7 @@ function getParticipants($page, $limit,$attid, $order = null, $userid = null)
$data->setJoin($joinValue);

if (!empty($order)) {
list($field, $sortOrder) = explode(' ' , $order);
// survey field is not sortable (and searchable) right now until we include it in the query just skip to prevent ugly errors
$aNotSortable = array('survey');
if (!in_array($field, $aNotSortable)) {
$data->setOrder($order);
}
$data->setOrder($order);
}

if (!is_null($userid)) {
Expand Down
11 changes: 9 additions & 2 deletions application/modules/NumericalQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ public function getAnswerHTML()
$tiwidth=10;
}

$fValue=rtrim($_SESSION['survey_'.$this->surveyid][$this->fieldname],'0.');// Remove ending . and extra 0
$fValue=$_SESSION['survey_'.Yii::app()->getConfig('surveyID')][$ia[1]];
if(strpos($fValue,"."))
{
$fValue=rtrim(rtrim($fValue,"0"),".");
}
$integeronly=0;
if (trim($aQuestionAttributes['num_value_int_only'])==1)
{
Expand Down Expand Up @@ -98,7 +102,10 @@ public function getDataEntry($idrow, &$fnames, $language)

public function getExtendedAnswer($value, $language)
{
$value=rtrim($value,"0.");
if(strpos($value,".")!==false)
{
$value=rtrim(rtrim($value,"0"),".");
}
$aQuestionAttributes = $this->getAttributeValues();
if($aQuestionAttributes['num_value_int_only'])
{
Expand Down

0 comments on commit d959f98

Please sign in to comment.