Skip to content

Commit

Permalink
Fixed issue #7181: Deleting survey from survey list does not remove f…
Browse files Browse the repository at this point in the history
…rom drop down field
  • Loading branch information
c-schmitz committed Jan 14, 2013
1 parent 24ed587 commit 7b91ebf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 34 deletions.
35 changes: 6 additions & 29 deletions application/helpers/common_helper.php
Expand Up @@ -305,7 +305,7 @@ function isStandardTemplate($sTemplateName)
* @return string This string is returned containing <option></option> formatted list of existing surveys
*
*/
function getSurveyList($returnarray=false, $returnwithouturl=false, $surveyid=false)
function getSurveyList($returnarray=false, $surveyid=false)
{
static $cached = null;

Expand Down Expand Up @@ -356,13 +356,7 @@ function getSurveyList($returnarray=false, $returnwithouturl=false, $surveyid=fa
{
$inactivesurveys .= " selected='selected'"; $svexist = 1;
}
if ($returnwithouturl===false)
{
$inactivesurveys .=" value='".Yii::app()->getController()->createUrl("/admin/survey/sa/view/surveyid/".$sv['sid'])."'>{$surveylstitle}</option>\n";
} else
{
$inactivesurveys .=" value='{$sv['sid']}'>{$surveylstitle}</option>\n";
}
$inactivesurveys .=" value='{$sv['sid']}'>{$surveylstitle}</option>\n";
} elseif($sv['expires']!='' && $sv['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust))
{
$expiredsurveys .="<option ";
Expand All @@ -374,13 +368,7 @@ function getSurveyList($returnarray=false, $returnwithouturl=false, $surveyid=fa
{
$expiredsurveys .= " selected='selected'"; $svexist = 1;
}
if ($returnwithouturl===false)
{
$expiredsurveys .=" value='".Yii::app()->getController()->createUrl("/admin/survey/sa/view/surveyid/".$sv['sid'])."'>{$surveylstitle}</option>\n";
} else
{
$expiredsurveys .=" value='{$sv['sid']}'>{$surveylstitle}</option>\n";
}
$expiredsurveys .=" value='{$sv['sid']}'>{$surveylstitle}</option>\n";
} else
{
$activesurveys .= "<option ";
Expand All @@ -392,16 +380,11 @@ function getSurveyList($returnarray=false, $returnwithouturl=false, $surveyid=fa
{
$activesurveys .= " selected='selected'"; $svexist = 1;
}
if ($returnwithouturl===false)
{
$activesurveys .=" value='".Yii::app()->getController()->createUrl("/admin/survey/sa/view/surveyid/".$sv['sid'])."'>{$surveylstitle}</option>\n";
} else
{
$activesurveys .=" value='{$sv['sid']}'>{$surveylstitle}</option>\n";
}
$activesurveys .=" value='{$sv['sid']}'>{$surveylstitle}</option>\n";
}
} // End Foreach
}

//Only show each activesurvey group if there are some
if ($activesurveys!='')
{
Expand All @@ -423,13 +406,7 @@ function getSurveyList($returnarray=false, $returnwithouturl=false, $surveyid=fa
$surveyselecter = "<option selected='selected' value=''>".$clang->gT("Please choose...")."</option>\n".$surveyselecter;
} else
{
if ($returnwithouturl===false)
{
$surveyselecter = "<option value='".Yii::app()->getController()->createUrl("/admin")."'>".$clang->gT("None")."</option>\n".$surveyselecter;
} else
{
$surveyselecter = "<option value=''>".$clang->gT("None")."</option>\n".$surveyselecter;
}
$surveyselecter = "<option value=''>".$clang->gT("None")."</option>\n".$surveyselecter;
}
return $surveyselecter;
}
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/super/adminmenu.php
Expand Up @@ -89,8 +89,8 @@
</div>
<div class='menubar-right'>
<label for='surveylist'><?php $clang->eT("Surveys:");?></label>
<select id='surveylist' name='surveylist' onchange="window.open(this.options[this.selectedIndex].value,'_top')">
<?php echo getSurveyList(false, false, $surveyid); ?>
<select id='surveylist' name='surveylist' onchange="if (this.options[this.selectedIndex].value!='') {window.open('<?php echo $this->createUrl("/admin/survey/sa/view/surveyid/"); ?>/'+this.options[this.selectedIndex].value,'_top')} else {window.open('<?php echo $this->createUrl("/admin/survey/sa/index/");?>','_top')}">
<?php echo getSurveyList(false, $surveyid); ?>
</select>
<a href="<?php echo $this->createUrl("admin/survey/sa/index"); ?>">
<img src='<?php echo $sImageURL;?>surveylist.png' alt='<?php $clang->eT("Detailed list of surveys");?>' />
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/survey/subview/tabCopy_view.php
Expand Up @@ -3,7 +3,7 @@
<ul>
<li><label for='copysurveylist'><?php $clang->eT("Select survey to copy:"); ?> </label>
<select id='copysurveylist' name='copysurveylist' required="required">
<?php echo getSurveyList(false, true); ?> </select> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li>
<?php echo getSurveyList(false); ?> </select> <span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li>
<li><label for='copysurveyname'><?php echo $clang->gT("New survey title:"); ?> </label>
<input type='text' id='copysurveyname' size='82' maxlength='200' name='copysurveyname' value='' required="required" />
<span class='annotation'><?php echo $clang->gT("Required"); ?> </span></li>
Expand Down
16 changes: 14 additions & 2 deletions scripts/admin/listsurvey.js
Expand Up @@ -133,15 +133,27 @@ $(document).ready(function(){
del:true,
edit:false,
refresh: true,
search: true
search: true,

},{},{},{ msg:delmsg,
bSubmit: sDelCaption,
caption: sDelCaption,
bCancel: sCancel,
width : 450,
afterShowForm: function(form) {
form.closest('div.ui-jqdialog').center();
}
},
afterSubmit: function(response, postdata) {
if (postdata.oper=='del')
{
// Remove surveys from dropdown, too
aSurveyIDs=postdata.id.split(",");
$.each(aSurveyIDs,function(iIndex, iSurveyID){
$("#surveylist option[value='"+iSurveyID+"']").remove();
})
};
return [true];
}
},
{
caption: sSearchCaption,
Expand Down

0 comments on commit 7b91ebf

Please sign in to comment.