Skip to content

Commit

Permalink
Dev Changing controller URLs to allow for IIS compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 30, 2012
1 parent 763097f commit 7ad1c76
Show file tree
Hide file tree
Showing 118 changed files with 394 additions and 395 deletions.
1 change: 1 addition & 0 deletions application/config/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

//Admin Routes
$route['admin/index'] = "admin";
$route['admin/<action:\w+>/sa/<sa:\w+>/*'] = 'admin/<action>/sa/<sa>';
$route['admin/<action:\w+>/<sa:\w+>/*'] = 'admin/<action>/sa/<sa>';

//question
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function run($action)

Yii::app()->session['redirectopage'] = Yii::app()->request->requestUri;

$this->redirect($this->createUrl('/admin/authentication/login'));
$this->redirect($this->createUrl('/admin/authentication/sa/login'));
}

return parent::run($sAction);
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/assessments.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private function _showAssessments($iSurveyID, $action, $surveyLanguage, Limesurv

Yii::app()->loadHelper('admin/htmleditor');
if ($surveyinfo['assessments']!='Y')
$urls['message'] = array('title' => $clang->gT("Assessments mode not activated"), 'message' => sprintf($clang->gT("Assessment mode for this survey is not activated. You can activate it in the %s survey settings %s (tab 'Notification & data management')."),'<a href="'.$this->getController()->createUrl('/admin/survey/editsurveysettings/surveyid/'.$iSurveyID).'">','</a>'), 'class'=> 'warningheader');
$urls['message'] = array('title' => $clang->gT("Assessments mode not activated"), 'message' => sprintf($clang->gT("Assessment mode for this survey is not activated. You can activate it in the %s survey settings %s (tab 'Notification & data management')."),'<a href="'.$this->getController()->createUrl('admin/survey/sa/editsurveysettings/surveyid/'.$iSurveyID).'">','</a>'), 'class'=> 'warningheader');
$urls['assessments_view'][]= $aData;
$this->_renderWrappedTemplate('', $urls, $aData);
}
Expand Down
18 changes: 9 additions & 9 deletions application/controllers/admin/conditionsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,10 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
if (!isset($_GET['ok']))
{
$button_yes = CHtml::submitButton($clang->gT("Yes"), array(
'onclick' => "window.open('".$this->getController()->createUrl("admin/conditions/index/subaction/resetsurveylogic/surveyid/$iSurveyID")."?ok=Y"."', '_top')"
'onclick' => "window.open('".$this->getController()->createUrl("admin/conditions/sa/index/subaction/resetsurveylogic/surveyid/$iSurveyID")."?ok=Y"."', '_top')"
));
$button_cancel = CHtml::submitButton($clang->gT("Cancel"), array(
'onclick' => "window.open('".$this->getController()->createUrl("admin/survey/view/surveyid/$iSurveyID")."', '_top')"
'onclick' => "window.open('".$this->getController()->createUrl("admin/survey/sa/view/surveyid/$iSurveyID")."', '_top')"
));

$messagebox_content = $clang->gT("You are about to delete all conditions on this survey's questions")."($iSurveyID)"
Expand All @@ -167,7 +167,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
LimeExpressionManager::RevertUpgradeConditionsToRelevance($iSurveyID);
Conditions::model()->deleteRecords("qid in (select qid from {{questions}} where sid={$iSurveyID})");
Yii::app()->session['flashmessage']=$clang->gT("All conditions in this survey have been deleted.");
$this->getController()->redirect($this->getController()->createUrl('/admin/survey/view/surveyid/'.$iSurveyID));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$iSurveyID));

}
}
Expand Down Expand Up @@ -665,7 +665,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
}

$questionNavOptions .= CHtml::tag('option', array(
'value' => $this->getController()->createUrl("/admin/conditions/index/subaction/editconditionsform/surveyid/$iSurveyID/gid/{$q->gid}/qid/{$q->id}")),
'value' => $this->getController()->createUrl("/admin/conditions/sa/index/subaction/editconditionsform/surveyid/$iSurveyID/gid/{$q->gid}/qid/{$q->id}")),
$questionselecter
);
}
Expand All @@ -683,7 +683,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
}

$questionNavOptions .= CHtml::tag('option', array(
'value'=>$this->getController()->createUrl("/admin/conditions/index/subaction/editconditionsform/surveyid/$iSurveyID/gid/$gid/qid/$qid"),
'value'=>$this->getController()->createUrl("/admin/conditions/sa/index/subaction/editconditionsform/surveyid/$iSurveyID/gid/$gid/qid/$qid"),
'selected'=>'selected'),
$questiontitle .': '. $questiontextshort);
$questionNavOptions .= CHtml::closeTag('optgroup');
Expand All @@ -703,7 +703,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$questionselecter = htmlspecialchars(mb_strcut(html_entity_decode($question,ENT_QUOTES,'UTF-8'), 0, 35, 'UTF-8'))."...";
}
$questionNavOptions .= CHtml::tag('option', array(
'value' => $this->getController()->createUrl("/admin/conditions/index/subaction/editconditionsform/surveyid/$iSurveyID/gid/{$row['gid']}/qid/{$row['qid']}")),
'value' => $this->getController()->createUrl("/admin/conditions/sa/index/subaction/editconditionsform/surveyid/$iSurveyID/gid/{$row['gid']}/qid/{$row['qid']}")),
$row['title'].':'.$questionselecter
);
}
Expand Down Expand Up @@ -979,7 +979,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
}

$aViewUrls['output'] .= "\t<tr class='{$markcidstyle}'>\n"
."\t<td colspan='2'><form style='margin-bottom:0;' name='conditionaction{$rows['cid']}' id='conditionaction{$rows['cid']}' method='post' action='".$this->getController()->createUrl("/admin/conditions/index/subaction/$subaction/surveyid/$iSurveyID/gid/$gid/qid/$qid/")."'>\n"
."\t<td colspan='2'><form style='margin-bottom:0;' name='conditionaction{$rows['cid']}' id='conditionaction{$rows['cid']}' method='post' action='".$this->getController()->createUrl("/admin/conditions/sa/index/subaction/$subaction/surveyid/$iSurveyID/gid/$gid/qid/$qid/")."'>\n"
."<table>\n"
."\t<tr>\n";

Expand Down Expand Up @@ -1210,7 +1210,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
if ($subaction == "copyconditionsform" || $subaction == "copyconditions")
{
$aViewUrls['output'] .= "<tr class=''><td colspan='3'>\n"
."<form action='".$this->getController()->createUrl("admin/conditions/index/subaction/copyconditions/surveyid/$iSurveyID/gid/$gid/qid/$qid/")."' name='copyconditions' id='copyconditions' method='post'>\n";
."<form action='".$this->getController()->createUrl("admin/conditions/sa/index/subaction/copyconditions/surveyid/$iSurveyID/gid/$gid/qid/$qid/")."' name='copyconditions' id='copyconditions' method='post'>\n";

$aViewUrls['output'] .= "<div class='header ui-widget-header'>".$clang->gT("Copy conditions")."</div>\n";

Expand Down Expand Up @@ -1314,7 +1314,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$subaction == "updatescenario" ||
$subaction == "editthiscondition" || $subaction == "delete")
{
$aViewUrls['output'] .= "<form action='".$this->getController()->createUrl("/admin/conditions/index/subaction/$subaction/surveyid/$iSurveyID/gid/$gid/qid/$qid/")."' name='editconditions' id='editconditions' method='post'>\n";
$aViewUrls['output'] .= "<form action='".$this->getController()->createUrl("/admin/conditions/sa/index/subaction/$subaction/surveyid/$iSurveyID/gid/$gid/qid/$qid/")."' name='editconditions' id='editconditions' method='post'>\n";
if ($subaction == "editthiscondition" && isset($p_cid))
{
$mytitle = $clang->gT("Edit condition");
Expand Down
21 changes: 9 additions & 12 deletions application/controllers/admin/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function index($sa = null)
}
else
{
$this->getController()->redirect($this->getController()->createUrl('/admin/survey/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
}
}

Expand Down Expand Up @@ -207,7 +207,7 @@ function index($sa = null)
}
else
{
$this->getController()->redirect($this->getController()->createUrl('/admin/question/answeroptions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
$this->getController()->redirect($this->getController()->createUrl('/admin/question/sa/answeroptions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
}

//$action='editansweroptions';
Expand Down Expand Up @@ -319,7 +319,7 @@ function index($sa = null)
}
else
{
$this->getController()->redirect($this->getController()->createUrl('/admin/question/subquestions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
$this->getController()->redirect($this->getController()->createUrl('/admin/question/sa/subquestions/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
}
}

Expand Down Expand Up @@ -551,7 +551,7 @@ function index($sa = null)
}
else
{
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
}
}

Expand Down Expand Up @@ -806,9 +806,9 @@ function index($sa = null)
else
{
if(Yii::app()->request->getPost('newpage') == "return") {
$this->getController()->redirect($this->getController()->createUrl('admin/question/editquestion/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
$this->getController()->redirect($this->getController()->createUrl('admin/question/sa/editquestion/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
} else {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
}
}
}
Expand Down Expand Up @@ -885,7 +885,7 @@ function index($sa = null)
}
else
{
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$surveyid));
}
}

Expand Down Expand Up @@ -1057,16 +1057,13 @@ function index($sa = null)
Yii::app()->session['flashmessage'] = $clang->gT("Error:").'<br>'.$clang->gT("Survey could not be updated.");
}


//redirect(site_url('admin/survey/view/'.$surveyid));

if (Yii::app()->request->getPost('action') == "updatesurveysettingsandeditlocalesettings")
{
$this->getController()->redirect($this->getController()->createUrl('/admin/survey/editlocalsettings/surveyid/'.$surveyid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/editlocalsettings/surveyid/'.$surveyid));
}
else
{
$this->getController()->redirect($this->getController()->createUrl('/admin/survey/view/surveyid/'.$surveyid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$surveyid));
}

}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/dataentry.php
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ function import($surveyid)
}
Yii::app()->session['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT);
}
$this->getController()->redirect(Yii::app()->getController()->createUrl("/admin/responses/index/surveyid/{$surveyid}"));
$this->getController()->redirect(Yii::app()->getController()->createUrl("/admin/responses/sa/index/surveyid/{$surveyid}"));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/emailtemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ function update($iSurveyId)
}
Yii::app()->session['flashmessage'] = $clang->gT("Email templates successfully saved.");
}
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/'.$iSurveyId));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/'.$iSurveyId));
}


Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function run()
}
else
{
Yii::app()->request->redirect(Yii::app()->getController()->createUrl('admin/survey/index'));
Yii::app()->request->redirect(Yii::app()->getController()->createUrl('admin/survey/sa/index'));
}

}
Expand Down
14 changes: 7 additions & 7 deletions application/controllers/admin/labels.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function importlabelresources()
if (!empty($lid))
{
if (Yii::app()->getConfig('demo_mode'))
$this->getController()->error($clang->gT("Demo mode only: Uploading files is disabled in this system."), $this->getController()->createUrl("admin/labels/view/lid/{$lid}"));
$this->getController()->error($clang->gT("Demo mode only: Uploading files is disabled in this system."), $this->getController()->createUrl("admin/labels/sa/view/lid/{$lid}"));

// Create temporary directory
// If dangerous content is unzipped
Expand All @@ -65,7 +65,7 @@ public function importlabelresources()
$zip = new PclZip($zipfilename);

if (!is_writeable($basedestdir))
$this->getController()->error(sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir), $this->getController()->createUrl("admin/labels/view/lid/{$lid}"));
$this->getController()->error(sprintf($clang->gT("Incorrect permissions in your %s folder."), $basedestdir), $this->getController()->createUrl("admin/labels/sa/view/lid/{$lid}"));

if (!is_dir($destdir))
mkdir($destdir);
Expand All @@ -76,7 +76,7 @@ public function importlabelresources()
if (is_file($zipfilename))
{
if ($zip->extract($extractdir) <= 0)
$this->getController()->error($clang->gT("This file is not a valid ZIP file archive. Import failed. " . $zip->errorInfo(true)), $this->getController()->createUrl("admin/labels/view/lid/{$lid}"));
$this->getController()->error($clang->gT("This file is not a valid ZIP file archive. Import failed. " . $zip->errorInfo(true)), $this->getController()->createUrl("admin/labels/sa/view/lid/{$lid}"));

// now read tempdir and copy authorized files only
$folders = array('flash', 'files', 'images');
Expand All @@ -94,10 +94,10 @@ public function importlabelresources()
unlink($zipfilename);

if (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo))
$this->getController()->error($clang->gT("This ZIP archive contains no valid Resources files. Import failed."), $this->getController()->createUrl("admin/labels/view/lid/{$lid}"));
$this->getController()->error($clang->gT("This ZIP archive contains no valid Resources files. Import failed."), $this->getController()->createUrl("admin/labels/sa/view/lid/{$lid}"));
}
else
$this->getController()->error(sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), $basedestdir), $this->getController()->createUrl("admin/labels/view/lid/{$lid}"));
$this->getController()->error(sprintf($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."), $basedestdir), $this->getController()->createUrl("admin/labels/sa/view/lid/{$lid}"));

$aData = array(
'aErrorFilesInfo' => $aErrorFilesInfo,
Expand Down Expand Up @@ -347,9 +347,9 @@ public function process()


if ($lid)
$this->getController()->redirect($this->getController()->createUrl("admin/labels/view/lid/" . $lid));
$this->getController()->redirect($this->getController()->createUrl("admin/labels/sa/view/lid/" . $lid));
else
$this->getController()->redirect($this->getController()->createUrl("admin/labels/view"));
$this->getController()->redirect($this->getController()->createUrl("admin/labels/sa/view"));
}
}

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/participantsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ function getSurveyInfo_json()
$surveylink = $row['survey_id'];
} else
{
$surveylink = '<a href=' . Yii::app()->getController()->createUrl("/admin/tokens/browse/surveyid/{$row['survey_id']}") . '>' . $row['survey_id'].'</a>';
$surveylink = '<a href=' . Yii::app()->getController()->createUrl("/admin/tokens/sa/browse/surveyid/{$row['survey_id']}") . '>' . $row['survey_id'].'</a>';
}
$aData->rows[$i]['cell'] = array($surveyname[0]['surveyls_title'], $surveylink, $row['token_id'], $row['date_created'], $row['date_invited'], $row['date_completed']);
$i++;
Expand Down
8 changes: 4 additions & 4 deletions application/controllers/admin/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -877,10 +877,10 @@ public function delete($surveyid, $gid, $qid)
if (isset($qidarray))
$qidlist = implode(", ", $qidarray);
$message =$clang->gT("Question could not be deleted. There are conditions for other questions that rely on this question. You cannot delete this question until those conditions are removed.");
$message .="<br /><a href='". $this->getController()->createUrl("admin/expressions/survey_logic_file/sid/{$surveyid}")."' >".$clang->gT("Look at survey logic files")."</a>.";
$message .="<br /><a href='". $this->getController()->createUrl("admin/expressions/sa/survey_logic_file/sid/{$surveyid}")."' >".$clang->gT("Look at survey logic files")."</a>.";
$this->getController()->error(
$message,
$this->getController()->createUrl("admin/survey/view/surveyid/{$surveyid}/gid/{$gid}/qid/{$qid}")
$this->getController()->createUrl("admin/survey/sa/view/surveyid/{$surveyid}/gid/{$gid}/qid/{$qid}")
);
}
else
Expand Down Expand Up @@ -912,12 +912,12 @@ public function delete($surveyid, $gid, $qid)

Yii::app()->session['flashmessage'] = $clang->gT("Question was successfully deleted.");

$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $surveyid . '/gid/' . $gid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid . '/gid/' . $gid));
}
else
{
Yii::app()->session['flashmessage'] = $clang->gT("You are not authorized to delete questions.");
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $surveyid . '/gid/' . $gid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid . '/gid/' . $gid));
}
}

Expand Down

0 comments on commit 7ad1c76

Please sign in to comment.