diff --git a/admin/install/createdb.php b/admin/install/createdb.php
index a5658582353..150ce85bd01 100644
--- a/admin/install/createdb.php
+++ b/admin/install/createdb.php
@@ -41,7 +41,10 @@
if ($createdbtype=='mssql_n' || $createdbtype=='odbc_mssql' || $createdbtype=='odbtp') $createdbtype='mssql';
if($createdbtype=='postgres' && version_compare($connect->pgVersion, '9') >= 0)
{
- $connect->execute("ALTER DATABASE {$dbname} SET bytea_output='escape';");
+ $result=$connect->execute("ALTER DATABASE {$dbname} SET bytea_output='escape';");
+ if ($result==false){
+ die ('Database creation failed. Some database settings could not be set.
You need to be owner of the Postgres database. Please adjust your permissions and try again.');
+ }
}
if($createdbtype=='mssqlnative') $createdbtype='mssqlnative';
if (modify_database(dirname(__FILE__).'/create-'.$createdbtype.'.sql'))
diff --git a/admin/install/resetadminpw.php b/admin/install/resetadminpw.php
index 336d50ab8e8..eb3b1639c9c 100644
--- a/admin/install/resetadminpw.php
+++ b/admin/install/resetadminpw.php
@@ -32,7 +32,7 @@
case 'odbc_mssql':modify_database("",'UPDATE [prefix_users] set password=\'$defaultpass\' where uid=1;');
echo $modifyoutput; flush();
break;
- case 'postgres':modify_database("",'UPDATE prefix_users set \"password\"=\'$defaultpass\' where uid=1;');
+ case 'postgres':modify_database("",'UPDATE prefix_users set "password"=\'$defaultpass\' where uid=1;');
echo $modifyoutput; flush();
break;
}
diff --git a/admin/update/updater.php b/admin/update/updater.php
index baedf698487..8cc63396675 100644
--- a/admin/update/updater.php
+++ b/admin/update/updater.php
@@ -12,7 +12,7 @@
*
* $Id: updater.php 8987 2010-07-27 12:59:34Z c_schmitz $
*/
-list(,$updaterversion)=explode(' ','$Rev: 11664 $'); // this is updated by subversion so don't change this string
+$updaterversion='120614';
if (isset($_REQUEST['update'])) die();
diff --git a/classes/expressions/LimeExpressionManager.php b/classes/expressions/LimeExpressionManager.php
index 14f92928b63..6a4e29bf37b 100644
--- a/classes/expressions/LimeExpressionManager.php
+++ b/classes/expressions/LimeExpressionManager.php
@@ -1059,6 +1059,17 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
$cascadedAFE = array_reverse($cascadedAFE);
$subqs = $qinfo['subqs'];
+ if ($type == 'R') {
+ $subqs = array();
+ foreach ($this->qans[$qinfo['qid']] as $k=>$v)
+ {
+ $_code = explode('~',$k);
+ $subqs[] = array(
+ 'rowdivid'=>$qinfo['sgqa'] . $_code[1],
+ 'sqsuffix'=>'_' . $_code[1],
+ );
+ }
+ }
$last_rowdivid = '--';
foreach ($subqs as $sq) {
if ($sq['rowdivid'] == $last_rowdivid)
@@ -1083,6 +1094,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
case 'P': //Multiple choice with comments checkbox + text
case 'K': //MULTIPLE NUMERICAL QUESTION
case 'Q': //MULTIPLE SHORT TEXT
+ case 'R': //Ranking
// if ($this->sgqaNaming)
// {
foreach ($cascadedAF as $_caf)
@@ -1443,6 +1455,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
case 'K': //MULTIPLE NUMERICAL QUESTION
case 'Q': //MULTIPLE SHORT TEXT
case 'M': //Multiple choice checkbox
+ case 'R': //RANKING STYLE
if ($this->sgqaNaming)
{
$sq_name = substr($sq['jsVarName'],4) . '.NAOK';
@@ -1464,10 +1477,6 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
}
}
break;
- case 'R': //RANKING STYLE
- // TODO - does not have sub-questions, so how should this be done?
- // Current JavaScript works fine, but can't use expression value
- break;
default:
break;
}
@@ -1484,7 +1493,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
'qtype' => $type,
'type' => 'min_answers',
'class' => 'num_answers',
- 'eqn' => '(count(' . implode(', ', $sq_names) . ') >= (' . $min_answers . '))',
+ 'eqn' => 'if(is_empty('.$min_answers.'),1,(count(' . implode(', ', $sq_names) . ') >= (' . $min_answers . ')))',
'qid' => $questionNum,
);
}
@@ -1532,6 +1541,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
case 'K': //MULTIPLE NUMERICAL QUESTION
case 'Q': //MULTIPLE SHORT TEXT
case 'M': //Multiple choice checkbox
+ case 'R': //RANKING STYLE
if ($this->sgqaNaming)
{
$sq_name = substr($sq['jsVarName'],4) . '.NAOK';
@@ -1553,10 +1563,6 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
}
}
break;
- case 'R': //RANKING STYLE
- // TODO - does not have sub-questions, so how should this be done?
- // Current JavaScript works fine, but can't use expression value
- break;
default:
break;
}
@@ -1573,7 +1579,7 @@ public function _CreateSubQLevelRelevanceAndValidationEqns($onlyThisQseq=NULL)
'qtype' => $type,
'type' => 'max_answers',
'class' => 'num_answers',
- 'eqn' => '(count(' . implode(', ', $sq_names) . ') <= (' . $max_answers . '))',
+ 'eqn' => '(if(is_empty('.$max_answers.'),1,count(' . implode(', ', $sq_names) . ') <= (' . $max_answers . ')))',
'qid' => $questionNum,
);
}
@@ -2984,7 +2990,7 @@ private function setVariableAndTokenMappingsForExpressionManager($surveyid,$forc
$varName = $fielddata['title'] . '_' . $fielddata['aid'];
$question = $fielddata['subquestion'];
// $question = $fielddata['question'] . ': ' . $fielddata['subquestion'];
- if ($type != 'H' && $type != 'R') {
+ if ($type != 'H') {
if ($type == 'P' && preg_match("/comment$/", $sgqa)) {
// $rowdivid = substr($sgqa,0,-7);
}
@@ -4272,7 +4278,7 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false,$setSub
}
else
{
- // Otherwise, use the real date/time, it will only be saved when the table holds a
+ // Otherwise, use the real date/time, it will only be saved when the table holds a
// datestamp field
$datestamp=date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $this->surveyOptions['timeadjust']);
}
@@ -6009,9 +6015,10 @@ static function GetRelevanceAndTailoringJavaScript()
// Do all sub-question filtering (e..g array_filter)
/**
- * $afHide - if true, then use jQuery.show(). If false, then disable/enable the row
+ * $afHide - if true, then use jQuery.show(). If false, then disable/enable the row
*/
$afHide = (isset($LEM->qattr[$arg['qid']]['array_filter_style']) ? ($LEM->qattr[$arg['qid']]['array_filter_style'] == '0') : true);
+ $inputSelector = (($arg['type'] == 'R') ? '' : ' :input:not(:hidden)');
foreach ($subqParts as $sq)
{
$rowdividList[$sq['rowdivid']] = $sq['result'];
@@ -6023,15 +6030,15 @@ static function GetRelevanceAndTailoringJavaScript()
}
else
{
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').removeAttr('disabled');\n";
}
if ($sq['isExclusiveJS'] != '')
{
$relParts[] = " if ( " . $sq['isExclusiveJS'] . " ) {\n";
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').attr('disabled','disabled');\n";
$relParts[] = " }\n";
$relParts[] = " else {\n";
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').removeAttr('disabled');\n";
$relParts[] = " }\n";
}
$relParts[] = " relChange" . $arg['qid'] . "=true;\n";
@@ -6042,23 +6049,23 @@ static function GetRelevanceAndTailoringJavaScript()
if ($sq['irrelevantAndExclusiveJS'] != '')
{
$relParts[] = " if ( " . $sq['irrelevantAndExclusiveJS'] . " ) {\n";
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').attr('disabled','disabled');\n";
$relParts[] = " }\n";
$relParts[] = " else {\n";
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').removeAttr('disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').removeAttr('disabled');\n";
if ($afHide)
{
$relParts[] = " $('#javatbd" . $sq['rowdivid'] . "').hide();\n";
}
else
{
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').attr('disabled','disabled');\n";
}
$relParts[] = " }\n";
}
else
{
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').attr('disabled','disabled');\n";
}
}
else
@@ -6069,7 +6076,7 @@ static function GetRelevanceAndTailoringJavaScript()
}
else
{
- $relParts[] = " $('#javatbd" . $sq['rowdivid'] . " :input:not(:hidden)').attr('disabled','disabled');\n";
+ $relParts[] = " $('#javatbd" . $sq['rowdivid'] . "$inputSelector').attr('disabled','disabled');\n";
}
}
$relParts[] = " relChange" . $arg['qid'] . "=true;\n";
@@ -7001,6 +7008,8 @@ public static function usingCommaAsRadix()
private static function getConditionsForEM($surveyid=NULL, $qid=NULL)
{
+ global $databasetype;
+
if (!is_null($qid)) {
$where = " c.qid = ".$qid." and ";
}
@@ -7022,8 +7031,18 @@ private static function getConditionsForEM($surveyid=NULL, $qid=NULL)
." from ".db_table_name('conditions')." as c"
.", ".db_table_name('questions')." as q"
." where ". $where
- ." c.cqid = 0 and c.qid = q.qid"
- ." order by sid, qid, scenario, cqid, cfieldname, value";
+ ." c.cqid = 0 and c.qid = q.qid";
+
+ if ($databasetype == 'mssql')
+ {
+ $query .= " order by sid, c.qid, scenario, cqid, cfieldname, value";
+
+ }
+ else
+ {
+ $query .= " order by sid, qid, scenario, cqid, cfieldname, value";
+
+ }
$data = db_execute_assoc($query);
@@ -7888,7 +7907,7 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
break;
case 'other':
if ($value == 'N') {
- $value = NULL; // so can skip this one
+ $value = NULL; // so can skip this one
}
break;
}
@@ -8032,8 +8051,6 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
$sgqa_len = strlen($sid . 'X'. $gid . 'X' . $qid);
$varName = $rootVarName . '_' . substr($_rowdivid,$sgqa_len);
}
- case 'L':
- // TODO - need to show array filters applied to lists
break;
}
if (is_null($rowdivid)) {
@@ -8102,6 +8119,10 @@ static public function ShowSurveyLogicFile($sid, $gid=NULL, $qid=NULL,$LEMdebugL
$subQeqn = '';
$rowdivid = $sgqas[0] . $ansInfo[1];
+ if ($q['info']['type'] == 'R')
+ {
+ $rowdivid = $LEM->sid . 'X' . $gid . 'X' . $qid . $ansInfo[1];
+ }
if (isset($LEM->subQrelInfo[$qid][$rowdivid]))
{
$sq = $LEM->subQrelInfo[$qid][$rowdivid];
diff --git a/common_functions.php b/common_functions.php
index c424e185aef..410eff5aec2 100644
--- a/common_functions.php
+++ b/common_functions.php
@@ -3215,7 +3215,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT('Answer width'));
$qattributes["array_filter"]=array(
- "types"=>"1ABCEF:;MPLKQ",
+ "types"=>"1ABCEF:;MPLKQR",
'category'=>$clang->gT('Logic'),
'sortorder'=>100,
'inputtype'=>'text',
@@ -3223,7 +3223,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT('Array filter'));
$qattributes["array_filter_exclude"]=array(
- "types"=>"1ABCEF:;MPLKQ",
+ "types"=>"1ABCEF:;MPLKQR",
'category'=>$clang->gT('Logic'),
'sortorder'=>100,
'inputtype'=>'text',
@@ -3231,7 +3231,7 @@ function questionAttributes($returnByName=false)
"caption"=>$clang->gT('Array filter exclusion'));
$qattributes["array_filter_style"]=array(
- "types"=>"1ABCEF:;MPLKQ",
+ "types"=>"1ABCEF:;MPLKQR",
'category'=>$clang->gT('Logic'),
'sortorder'=>100,
'inputtype'=>'singleselect',
diff --git a/docs/release_notes.txt b/docs/release_notes.txt
index 54e20995354..4062d763299 100644
--- a/docs/release_notes.txt
+++ b/docs/release_notes.txt
@@ -78,31 +78,31 @@ HOW TO UPGRADE from a LimeSurvey 1.70(+) version to the latest 1.9x
Thank you to everyone who helped with this new release!
Changes from 1.92+ (build 120608) to 1.92+ (build 120613) June 13, 2012
-Fixed issue #6100: English in other language (Thomas White)
-Fixed issue #6130: Response emails sent as "text/plain" but with HTML embedded (Carsten Schmitz)
-Fixed issue #6147: "Please rank at least x items" not being translated (Carsten Schmitz)
-Fixed issue #6151: CSS errors on public statistics page (Carsten Schmitz)
-Fixed issue #6153: "Cannot find data type DATE" when activating a survey with MSSQL 2005 (Carsten Schmitz)
-Fixed issue #6168: Question preview ignores "no answer" setting (Thomas White)
-Fixed issue #6177: uppercase logical operators (e.g. 'OR') in EM yield JavaScript errors (Thomas White)
-Fixed issue #6178: es-CL is listed as Spanish (Mexico) instead of Spanish (Chile) (Carsten Schmitz)
-Fixed issue #6186: Array Question Type: EM doesn't convert condition correctly, AND becomes OR (Thomas White)
-Fixed issue #6187: Javascript Error on em_javascript.js : attr is undefined (Thomas White)
-Fixed issue #6196: Misplaced PopUpEditor icon (tpartner)
-Fixed issue #6200: if enter text into other box, then click the other checkbox, the entered text disappears (Thomas White)
-Fixed issue #6201: Fatal error: Cannot redeclare replacenewline() (Thomas White)
-Fixed issue: "Please check at least one item" not appropriate for single select list questions (Thomas White)
-Updated translation: Arabic by maan
-Updated translation: Croatian by rovinj
-Updated translation: Czech by slansky
-Updated translation: German by c_schmitz
-Updated translation: German (Informal) by c_schmitz
-Updated translation: Italian by lfanfoni
-Updated translation: Korean by heasunchun
-Updated translation: Norwegian (Bokmål) by c_schmitz
-Updated translation: Polish by elisa
-Updated translation: Portuguese (Brazil) by mauriciofurtado
-Updated translation: Spanish (Mexican) by scoutino
+-Fixed issue #6100: English in other language (Thomas White)
+-Fixed issue #6130: Response emails sent as "text/plain" but with HTML embedded (Carsten Schmitz)
+-Fixed issue #6147: "Please rank at least x items" not being translated (Carsten Schmitz)
+-Fixed issue #6151: CSS errors on public statistics page (Carsten Schmitz)
+-Fixed issue #6153: "Cannot find data type DATE" when activating a survey with MSSQL 2005 (Carsten Schmitz)
+-Fixed issue #6168: Question preview ignores "no answer" setting (Thomas White)
+-Fixed issue #6177: uppercase logical operators (e.g. 'OR') in EM yield JavaScript errors (Thomas White)
+-Fixed issue #6178: es-CL is listed as Spanish (Mexico) instead of Spanish (Chile) (Carsten Schmitz)
+-Fixed issue #6186: Array Question Type: EM doesn't convert condition correctly, AND becomes OR (Thomas White)
+-Fixed issue #6187: Javascript Error on em_javascript.js : attr is undefined (Thomas White)
+-Fixed issue #6196: Misplaced PopUpEditor icon (tpartner)
+-Fixed issue #6200: if enter text into other box, then click the other checkbox, the entered text disappears (Thomas White)
+-Fixed issue #6201: Fatal error: Cannot redeclare replacenewline() (Thomas White)
+-Fixed issue: "Please check at least one item" not appropriate for single select list questions (Thomas White)
+#Updated translation: Arabic by maan
+#Updated translation: Croatian by rovinj
+#Updated translation: Czech by slansky
+#Updated translation: German by c_schmitz
+#Updated translation: German (Informal) by c_schmitz
+#Updated translation: Italian by lfanfoni
+#Updated translation: Korean by heasunchun
+#Updated translation: Norwegian (Bokmål) by c_schmitz
+#Updated translation: Polish by elisa
+#Updated translation: Portuguese (Brazil) by mauriciofurtado
+#Updated translation: Spanish (Mexican) by scoutino
Changes from 1.92+ (build 120607) to 1.92+ (build 120608) June 7, 2012
Fixed issue HTML error in hidden field for equation question type
diff --git a/qanda.php b/qanda.php
index 6593d127b7b..709dbfbaf8e 100644
--- a/qanda.php
+++ b/qanda.php
@@ -155,12 +155,6 @@ function retrieveAnswers($ia)
if (count($values[1]) > 1 && $qidattributes['hide_tip']==0)
{
$question_text['help'] = $clang->gT("Click on an item in the list on the left, starting with your highest ranking item, moving through to your lowest ranking item.");
- if (trim($qidattributes['min_answers'])!='')
- {
- $qtitle .= "
\n"
- . sprintf($clang->ngT("Check at least %d item","Check at least %d items",$qidattributes['min_answers']),$qidattributes['min_answers'])."";
- $question_text['help'] .=' '.sprintf($clang->ngT("Check at least %d item","Check at least %d items",$qidattributes['min_answers']),$qidattributes['min_answers']);
- }
}
break;
case 'M': //Multiple choice checkbox
@@ -1944,16 +1938,38 @@ function do_ranking($ia)
if (trim($qidattributes["max_answers"])!='')
{
$max_answers=trim($qidattributes["max_answers"]);
+ $max_ans_val = LimeExpressionManager::ProcessString('{'.$max_answers.'}',$ia[0]);
+ if (!is_numeric($max_ans_val)) // this happens when try to do dynamic max ranking values and the starting value is blank
+ {
+ $max_ans_val = $anscount;
+ }
} else {
$max_answers=$anscount;
+ $max_ans_val = $anscount;
+ }
+ if (trim($qidattributes["min_answers"])!='')
+ {
+ $min_answers = trim($qidattributes["min_answers"]);
+ }
+ else
+ {
+ $min_answers = 0;
}
- $finished=$anscount-$max_answers;
+
$answer .= "\t\n";
- $answer = $minanswscript . $answer;
- }
-
return array($answer, $inputnames);
}
diff --git a/scripts/modaldialog.js b/scripts/modaldialog.js
index da4d2f9569e..d4fb86b9b05 100644
--- a/scripts/modaldialog.js
+++ b/scripts/modaldialog.js
@@ -66,6 +66,11 @@ $(document).ready(function() {
}else{
/*IE6*/ pass=document.getElementById('uploader').contentWindow.saveAndExit(fieldname,show_title,show_comment,pos);
}
+ if (pass) {
+ $('iframe#uploader').remove();
+ $(this).dialog('destroy');
+ checkconditions();
+ }
return true;
},
@@ -100,6 +105,11 @@ $(document).ready(function() {
}else{ /*IE6*/
pass=document.getElementById('uploader').contentWindow.saveAndExit(fieldname,show_title,show_comment,pos);
}
+ if (pass) {
+ $('iframe#uploader').remove();
+ $(this).dialog('destroy');
+ checkconditions();
+ }
return pass;
},
overlay: {