Skip to content

Commit

Permalink
Fix tokens tids not defined error while sending emails and browse urls
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11929 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
GautamGupta committed Jan 5, 2012
1 parent 79e7b3a commit 7fb624d
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 28 deletions.
19 changes: 11 additions & 8 deletions application/controllers/admin/tokens.php
Expand Up @@ -647,7 +647,7 @@ function edit($iSurveyId, $iTokenId)
$this->_renderWrappedTemplate(array('tokenbar', 'message' => array(
'title' => $clang->gT("Success"),
'message' => $clang->gT("The token entry was successfully updated.") . "<br /><br />\n"
. "\t\t<input type='button' value='" . $clang->gT("Display tokens") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/browse/index/surveyid/$iSurveyId/") . "', '_top')\" />\n"
. "\t\t<input type='button' value='" . $clang->gT("Display tokens") . "' onclick=\"window.open('" . $this->getController()->createUrl("admin/tokens/browse/surveyid/$iSurveyId/") . "', '_top')\" />\n"
)), $aData);
}
else
Expand Down Expand Up @@ -873,7 +873,7 @@ function updatetokenattributedescriptions($iSurveyId)
$fieldcontents.=$fieldname . '=' . strip_tags(CHttpRequest::getPost('description_' . $fieldname)) . "\n";
}

Survey::model()->updateByPk($iSurveyId,array("attributedescriptions" => $fieldcontents));
Survey::model()->updateByPk($iSurveyId, array('attributedescriptions' => $fieldcontents));
$aData['thissurvey'] = getSurveyInfo($iSurveyId);
$aData['surveyid'] = $iSurveyId;
$this->_renderWrappedTemplate(array('tokenbar', 'message' => array(
Expand Down Expand Up @@ -927,7 +927,7 @@ function email($iSurveyId, $aTokenIds = null)
$aData['surveyid'] = $iSurveyId;
$aData['sSubAction'] = $sSubAction;
$aData['bEmail'] = $bEmail;
$aData['surveylangs'] = $aSurveyLangs;
$aData['aSurveyLangs'] = $aData['surveylangs'] = $aSurveyLangs;
$aData['baselang'] = $sBaseLanguage;
$aData['tokenfields'] = $aTokenFields;
$aData['nrofattributes'] = $iAttributes;
Expand Down Expand Up @@ -1090,6 +1090,9 @@ function email($iSurveyId, $aTokenIds = null)
}
unset($fieldsarray);
}

$aViewUrls = array('tokenbar', 'emailpost');

if ($ctcount > $emcount)
{
$i = 0;
Expand All @@ -1100,14 +1103,14 @@ function email($iSurveyId, $aTokenIds = null)
array_shift($aTokenIds);
$i++;
}
$tids = implode('|', $aTokenIds);
$aData['tids'] = implode('|', $aTokenIds);
}
$lefttosend = $ctcount - $iMaxEmails;
}

$aData['tids'] = $tids;
$aData['lefttosend'] = $ctcount - $iMaxEmails;
$aViewUrls[] = 'emailwarning';
}

$this->_renderWrappedTemplate(array('tokenbar', 'emailpost', 'emailwarning'), $aData);
$this->_renderWrappedTemplate($aViewUrls, $aData);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/participants/attributeMap_view.php
Expand Up @@ -4,7 +4,7 @@
var redirect = "<?php echo $redirect ?>";
if(redirect=='TRUE')
{
redUrl = "<?php echo Yii::app()->baseUrl . "/index.php/admin/tokens/browse/index/surveyid" . '/' . $survey_id; ?>";
redUrl = "<?php echo Yii::app()->baseUrl . "/index.php/admin/tokens/browse/surveyid" . '/' . $survey_id; ?>";
}
var copyUrl = "<?php echo Yii::app()->baseUrl . "/index.php/admin/participants/addToTokenattmap"; ?>";
var participant_id = "<?php echo $participant_id; ?>";
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/token/addtokenpost.php
Expand Up @@ -4,14 +4,14 @@
{ ?>
<div class='successheader'><?php $clang->eT("Success"); ?></div>
<br /><?php $clang->eT("New token was added."); ?><br /><br />
<input type='button' value='<?php $clang->eT("Display tokens"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/browse/index/surveyid/$surveyid"); ?>', '_top')" /><br />
<input type='button' value='<?php $clang->eT("Display tokens"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/browse/surveyid/$surveyid"); ?>', '_top')" /><br />
<input type='button' value='<?php $clang->eT("Add another token entry"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/addnew/surveyid/$surveyid"); ?>', '_top')" /><br />
<?php }
else
{ ?>
<div class='warningheader'><?php $clang->eT("Failed"); ?></div>
<br /><?php $clang->eT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries."); ?><br /><br />
<input type='button' value='<?php $clang->eT("Display tokens"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/browse/index/surveyid/$surveyid"); ?>', '_top')" /><br />
<input type='button' value='<?php $clang->eT("Display tokens"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/browse/surveyid/$surveyid"); ?>', '_top')" /><br />
<input type='button' value='<?php $clang->eT("Add new token entry"); ?>' onclick="window.open('<?php echo $this->createUrl("admin/tokens/addnew/surveyid/$surveyid"); ?>', '_top')" /><br />
<?php } ?>
</div>
4 changes: 2 additions & 2 deletions application/views/admin/token/emailwarning.php
Expand Up @@ -2,7 +2,7 @@
<div class='warningheader'><?php $clang->eT("Warning"); ?></div><br />
<form method='post' action='<?php echo $this->createUrl("/admin/tokens/{$sSubAction}/surveyid/{$surveyid}"); ?>'>
<?php $clang->eT("There are more emails pending than can be sent in one batch. Continue sending emails by clicking below."); ?><br /><br />
<?php echo str_replace("{EMAILCOUNT}", "$lefttosend", $clang->gT("There are {EMAILCOUNT} emails still to be sent.")); ?>
<?php echo str_replace("{EMAILCOUNT}", (string) $lefttosend, $clang->gT("There are {EMAILCOUNT} emails still to be sent.")); ?>
<br /><br />
<input type='submit' value='<?php $clang->eT("Continue"); ?>' />
<input type='hidden' name='ok' value="absolutely" />
Expand All @@ -22,7 +22,7 @@
<?php }
}
?>
<?php if (!empty($tokenids)) { ?>
<?php if (!empty($tids)) { ?>
<input type='hidden' name='tokenids' value="<?php echo $tids; ?>" />
<?php } ?>
<?php
Expand Down
47 changes: 32 additions & 15 deletions application/views/admin/token/managetokenattributes.php
@@ -1,25 +1,40 @@
<div class='header ui-widget-header'><?php $clang->eT("Manage token attribute fields"); ?></div>

<form action="<?php echo $this->createUrl("admin/tokens/updatetokenattributedescriptions/surveyid/$surveyid"); ?>" method="post">
<table class='listsurveys'><tr><th><?php $clang->eT("Attribute field"); ?></th><th><?php $clang->eT("Field description"); ?></th><th><?php $clang->eT("Example data"); ?></th></tr>
<table class='listsurveys'>
<tr>
<th><?php $clang->eT("Attribute field"); ?></th>
<th><?php $clang->eT("Field description"); ?></th>
<th><?php $clang->eT("Field caption"); ?></th>
<th><?php $clang->eT("Mandatory?"); ?></th>
<th><?php $clang->eT("Example data"); ?></th>
</tr>


<?php
foreach ($tokenfields as $tokenfield => $tokendescription)
foreach ($tokenfields as $tokenfield => $tokenvalues)
{
$nrofattributes++;
echo "<tr><td>$tokenfield</td><td><input type='text' name='description_$tokenfield' value='" . htmlspecialchars($tokendescription, ENT_QUOTES, 'UTF-8') . "' /></td><td>";
if ($examplerow !== false)
{
if (!$tokenfield[10] == 'c')
{
echo htmlspecialchars($examplerow[$tokenfield]);
}
}
else
{
$clang->eT('<no data>');
}
echo "<tr>
<td>$tokenfield</td>
<td><input type='text' name='description_$tokenfield' value='" . htmlspecialchars($tokenvalues['tokendescription'], ENT_QUOTES, 'UTF-8') . "' /></td>
<td><input type='text' name='caption_$tokenfield' value='" . htmlspecialchars($tokenvalues['tokencaption'], ENT_QUOTES, 'UTF-8') . "' /></td>
<td><input type='checkbox' name='mandatory_$tokenfield' value='Y'";
if($tokenvalues['tokenmandatory'] == 'Y')
echo ' selected="selected"';
echo " /></td>
<td>";
if ($examplerow !== false)
{
if (!$tokenfield[10] == 'c')
{
echo htmlspecialchars($examplerow[$tokenfield]);
}
}
else
{
$clang->gT('<no data>');
}
echo "</td></tr>";
}
?>
Expand All @@ -28,7 +43,9 @@
<input type="submit" value="<?php $clang->eT('Save'); ?>" />
<input type='hidden' name='action' value='tokens' />
<input type='hidden' name='subaction' value='updatetokenattributedescriptions' />
</form><br /><br />
</form>

<br /><br />

<div class='header ui-widget-header'><?php $clang->eT("Add token attributes"); ?></div><p>

Expand Down

0 comments on commit 7fb624d

Please sign in to comment.