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 29, 2012
1 parent c4fcfbe commit b57ae1b
Show file tree
Hide file tree
Showing 59 changed files with 150 additions and 152 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/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
4 changes: 2 additions & 2 deletions application/controllers/admin/conditionsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
'onclick' => "window.open('".$this->getController()->createUrl("admin/conditions/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
15 changes: 6 additions & 9 deletions application/controllers/admin/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,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 @@ -586,7 +586,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 @@ -880,7 +880,7 @@ function index($sa = null)
if(Yii::app()->request->getPost('newpage') == "return") {
$this->getController()->redirect($this->getController()->createUrl('admin/question/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 @@ -959,7 +959,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 @@ -1131,16 +1131,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/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('demoMode'))
$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
6 changes: 3 additions & 3 deletions application/controllers/admin/question.php
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ public function delete($surveyid, $gid, $qid)
$message .="<br /><a href='". $this->getController()->createUrl("admin/expressions/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 @@ -908,12 +908,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
8 changes: 4 additions & 4 deletions application/controllers/admin/questiongroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public function insert($surveyid)
$errorstring.= getLanguageNameFromCode($grouplang, false) . "\\n";

if ($errorstring != '')
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $surveyid));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $surveyid));

else
{
Expand Down Expand Up @@ -213,7 +213,7 @@ public function insert($surveyid)
$gid = $groupid;
Yii::app()->session['flashmessage'] = Yii::app()->lang->gT("New question group was saved.");
}
$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 Expand Up @@ -244,7 +244,7 @@ public function delete($iSurveyId, $iGroupId)
else
Yii::app()->user->setFlash('flashmessage', $clang->gT('Group could not be deleted'));

$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/' . $iSurveyId));
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/view/surveyid/' . $iSurveyId));

LimeExpressionManager::UpgradeConditionsToRelevance($iSurveyId);
}
Expand Down Expand Up @@ -398,7 +398,7 @@ public function update($gid)
}

Yii::app()->session['flashmessage'] = Yii::app()->lang->gT("Question group successfully saved.");
$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
2 changes: 1 addition & 1 deletion application/controllers/admin/responses.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private function _getData($params)
if ($actrow['active'] == 'N') //SURVEY IS NOT ACTIVE YET
{
Yii::app()->session['flashmessage'] = $clang->gT("This survey has not been activated. There are no results to browse.");
$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

0 comments on commit b57ae1b

Please sign in to comment.