Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #7967: Without javascript there are still present button …
…that don't work in the survey Dev: except for change language and index : all work without JS in IE7 Dev: except for change language : all work without JS on modern browser
- Loading branch information
Showing
5 changed files
with
87 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -403,38 +403,7 @@ function templatereplace($line, $replacements = array(), &$redata = array(), $de | |
} | ||
if (isset($thissurvey['allowsave']) and $thissurvey['allowsave'] == "Y") | ||
{ | ||
// Find out if the user has any saved data | ||
if ($thissurvey['format'] == 'A') | ||
{ | ||
if ($thissurvey['tokenanswerspersistence'] != 'Y' || !isset($surveyid) || !tableExists('tokens_'.$surveyid)) | ||
{ | ||
$_saveall = "\t\t\t<input type='button' name='loadall' value='" . $clang->gT("Load unfinished survey") . "' class='saveall button' onclick=\"javascript:addHiddenField(document.getElementById('limesurvey'),'loadall',this.value);document.getElementById('limesurvey').submit();\" " . (($thissurvey['active'] != "Y") ? "disabled='disabled'" : "") . "/>" | ||
. "\n\t\t\t<input type='button' name='saveallbtn' value='" . $clang->gT("Resume later") . "' class='saveall button' onclick=\"javascript:document.limesurvey.move.value = this.value;addHiddenField(document.getElementById('limesurvey'),'saveall',this.value);document.getElementById('limesurvey').submit();\" " . (($thissurvey['active'] != "Y") ? "disabled='disabled'" : "") . "/>"; // Show Save So Far button | ||
} | ||
else | ||
{ | ||
$_saveall = "\t\t\t<input type='button' name='saveallbtn' value='" . $clang->gT("Resume later") . "' class='saveall button' onclick=\"javascript:document.limesurvey.move.value = this.value;addHiddenField(document.getElementById('limesurvey'),'saveall',this.value);document.getElementById('limesurvey').submit();\" " . (($thissurvey['active'] != "Y") ? "disabled='disabled'" : "") . "/>"; // Show Save So Far button | ||
}; | ||
} | ||
elseif (isset($surveyid) && (!isset($_SESSION['survey_'.$surveyid]['step']) || !$_SESSION['survey_'.$surveyid]['step'])) | ||
{ //First page, show LOAD | ||
if ($thissurvey['tokenanswerspersistence'] != 'Y' || !isset($surveyid) || !tableExists('tokens_'.$surveyid)) | ||
{ | ||
$_saveall = "\t\t\t<input type='button' name='loadall' value='" . $clang->gT("Load unfinished survey") . "' class='saveall button' onclick=\"javascript:addHiddenField(document.getElementById('limesurvey'),'loadall',this.value);document.getElementById('limesurvey').submit();\" " . (($thissurvey['active'] != "Y") ? "disabled='disabled'" : "") . "/>"; | ||
} | ||
else | ||
{ | ||
$_saveall = ''; | ||
} | ||
} | ||
elseif (isset($surveyid) && isset($_SESSION['survey_'.$surveyid]['scid']) && (isset($move) && $move == "movelast")) | ||
{ //Already saved and on Submit Page, dont show Save So Far button | ||
$_saveall = ''; | ||
} | ||
else | ||
{ | ||
$_saveall = "<input type='button' name='saveallbtn' value='" . $clang->gT("Resume later") . "' class='saveall button' onclick=\"javascript:document.limesurvey.move.value = this.value;addHiddenField(document.getElementById('limesurvey'),'saveall',this.value);document.getElementById('limesurvey').submit();\" " . (($thissurvey['active'] != "Y") ? "disabled='disabled'" : "") . "/>"; // Show Save So Far button | ||
} | ||
$_saveall = doHtmlSaveAll(isset($move)?$move:NULL); | ||
} | ||
else | ||
{ | ||
|
@@ -905,4 +874,45 @@ function PassthruReplace($line, $thissurvey) | |
return $line; | ||
} | ||
|
||
/** | ||
* doHtmlSaveAll return HTML part of saveall button in survey | ||
**/ | ||
function doHtmlSaveAll($move="") | ||
{ | ||
$surveyid=Yii::app()->getConfig('surveyID'); | ||
$thissurvey=getsurveyinfo($surveyid); | ||
$clang = Yii::app()->lang; | ||
$disabled=($thissurvey['active'] != "Y")? array("disabled"=>"disabled"):NULL; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Shnoulle
Author
Collaborator
|
||
$_saveall=""; | ||
// Find out if the user has any saved data | ||
if ($thissurvey['format'] == 'A') | ||
{ | ||
if ($thissurvey['tokenanswerspersistence'] != 'Y' || !isset($surveyid) || !tableExists('tokens_'.$surveyid)) | ||
{ | ||
$_saveall .= CHtml::htmlButton($clang->gT("Load unfinished survey"),array('type'=>'submit','id'=>"loadallbtn",'value'=>'loadall','name'=>'loadall','class'=>"saveall submit button",$disabled)); | ||
} | ||
$_saveall .= CHtml::htmlButton($clang->gT("Resume later"),array('type'=>'submit','id'=>"saveallbtn",'value'=>'saveall','name'=>'saveall','class'=>"saveall submit button",$disabled)); | ||
} | ||
elseif ($surveyid && (!isset($_SESSION['survey_'.$surveyid]['step']) || !$_SESSION['survey_'.$surveyid]['step']))//First page, show LOAD (but not save) | ||
{ | ||
if ($thissurvey['tokenanswerspersistence'] != 'Y' || !isset($surveyid) || !tableExists('tokens_'.$surveyid)) | ||
{ | ||
$_saveall .= CHtml::htmlButton($clang->gT("Load unfinished survey"),array('type'=>'submit','id'=>"loadallbtn",'value'=>'loadall','name'=>'loadall','class'=>"saveall submit button",$disabled)); | ||
} | ||
} | ||
elseif ($surveyid && (isset($_SESSION['survey_'.$surveyid]['maxstep']) && $_SESSION['survey_'.$surveyid]['maxstep']==1) && $thissurvey['showwelcome']=="N")//First page, show LOAD and SAVE | ||
{ //First page, show LOAD | ||
if ($thissurvey['tokenanswerspersistence'] != 'Y' || !isset($surveyid) || !tableExists('tokens_'.$surveyid)) | ||
{ | ||
$_saveall .= CHtml::htmlButton($clang->gT("Load unfinished survey"),array('type'=>'submit','id'=>"loadallbtn",'value'=>'loadall','name'=>'loadall','class'=>"saveall submit button",$disabled)); | ||
} | ||
$_saveall .= CHtml::htmlButton($clang->gT("Resume later"),array('type'=>'submit','id'=>"saveallbtn",'value'=>'saveall','name'=>'saveall','class'=>"saveall submit button",$disabled)); | ||
} | ||
elseif (!isset($_SESSION['survey_'.$surveyid]['scid']) || $move == "movelast") // Not on last page or submited survey | ||
{ | ||
$_saveall .= CHtml::htmlButton($clang->gT("Resume later"),array('type'=>'submit','id'=>"saveallbtn",'value'=>'saveall','name'=>'saveall','class'=>"saveall submit button",$disabled)); | ||
} | ||
return $_saveall; | ||
} | ||
|
||
// Closing PHP tag intentionally omitted - yes, it is okay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This creates errors! The htmloptions used later on should be key/value. The way it is done now adds [] = array('disabled'=>'disabled') and gives error in encoding ==> htmlspecialchars() expects parameter 1 to be string, array given