Skip to content

Commit

Permalink
Dev: tokenify message buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Mar 15, 2016
1 parent 2c90134 commit 039b96f
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions application/controllers/admin/tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -722,27 +722,6 @@ function addnew($iSurveyId)

$sanitizedtoken = sanitize_token(Yii::app()->request->getPost('token'));

/* Mdekker: commented out this block as it doesn't respect tokenlength
* or existing tokens and was always handled by the tokenify action as
* the ui still suggests
if (empty($sanitizedtoken))
{
$isvalidtoken = false;
while ($isvalidtoken == false)
{
$newtoken = randomChars(15);
if (!isset($existingtokens[$newtoken]))
{
$isvalidtoken = true;
$existingtokens[$newtoken] = null;
}
}
$sanitizedtoken = $newtoken;
}
*/



$aData = array(
'firstname' => Yii::app()->request->getPost('firstname'),
'lastname' => Yii::app()->request->getPost('lastname'),
Expand Down Expand Up @@ -2441,20 +2420,19 @@ function tokenify($iSurveyId)
$aData["surveyinfo"] = $surveyinfo;
$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyId.")";
$aData['sidemenu']["token_menu"]=TRUE;
$aData['token_bar']['closebutton']['url'] = 'admin/tokens/sa/index/surveyid/'.$iSurveyId;


if (!Yii::app()->request->getParam('ok'))
{
$aData['sidemenu']['state'] = false;
$this->_renderWrappedTemplate('token', array( 'message' => array(
'title' => gT("Create tokens"),
'message' => gT("Clicking 'Yes' will generate tokens for all those in this token list that have not been issued one. Continue?") . "<br /><br />\n"
. "<input class='btn btn-default' type='submit' value='"
. "<input class='btn btn-default btn-lg' type='submit' value='"
. gT("Yes") . "' onclick=\"" . convertGETtoPOST($this->getController()->createUrl("admin/tokens/sa/tokenify/surveyid/$iSurveyId", array('ok'=>'Y'))) . "\" />\n"
. "<input class='btn btn-default' type='submit' value='"
. "<input class='btn btn-default btn-lg' type='submit' value='"
. gT("No") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/sa/index/surveyid/$iSurveyId") . "', '_top')\" />\n"
. "<br />\n"
. '<p><a href="'.App()->createUrl('admin/tokens/sa/index/surveyid/'.$iSurveyId).'" title="" class="btn btn-default btn-lg">'.gT("Ok").'</a></p>'
)), $aData);
}
else
Expand All @@ -2468,11 +2446,13 @@ function tokenify($iSurveyId)
$aData['success'] = false;
$message = ngT('Only {n} token has been created.|Only {n} tokens have been created.',$newtokencount)
.ngT('Need {n} token.|Need {n} tokens.',$neededtokencount);
$message .= '<p><a href="'.App()->createUrl('admin/tokens/sa/index/surveyid/'.$iSurveyId).'" title="" class="btn btn-default btn-lg">'.gT("Ok").'</a></p>';
}
else
{
$aData['success'] = true;
$message = ngT('{n} token has been created.|{n} tokens have been created.',$newtokencount);
$message .= '<p><a href="'.App()->createUrl('admin/tokens/sa/index/surveyid/'.$iSurveyId).'" title="" class="btn btn-default btn-lg">'.gT("Ok").'</a></p>';
}
$this->_renderWrappedTemplate('token', array( 'message' => array(
'title' => gT("Create tokens"),
Expand Down

0 comments on commit 039b96f

Please sign in to comment.