Skip to content

Commit

Permalink
Fixed issue: Several problems when editing a quota
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Aug 21, 2012
1 parent a6afb27 commit 2775fed
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 75 deletions.
15 changes: 12 additions & 3 deletions application/controllers/admin/quotas.php
Expand Up @@ -332,13 +332,22 @@ function editquota($iSurveyId)
$aData['quotainfo'] = $aQuotaInfo;

$aViewUrls[] = 'editquota_view';


foreach ($aLangs as $sLang)
$first=true;
foreach ($aLangs as $sLanguage)
{
$aData['langquotainfo'] = Quota_languagesettings::model()->findByAttributes(array('quotals_quota_id' => Yii::app()->request->getPost('quota_id'), 'quotals_language' => $sLang));
$aData['lang'] = $sLang;
$aTabTitles[$sLanguage] = getLanguageNameFromCode($sLanguage, false);
if ($first)
{
$aTabTitles[$sLanguage].= ' (' . $clang->gT("Base language") . ')';
$first = false;
}
$aData['langquotainfo'] = Quota_languagesettings::model()->findByAttributes(array('quotals_quota_id' => Yii::app()->request->getPost('quota_id'), 'quotals_language' => $sLanguage));
$aData['lang'] = $sLanguage;
$aViewUrls['editquotalang_view'][] = $aData;
}
$aData['aTabTitles']=$aTabTitles;

$aViewUrls[] = 'editquotafooter_view';

Expand Down
62 changes: 18 additions & 44 deletions application/views/admin/quotas/editquota_view.php
@@ -1,44 +1,18 @@
<form action="<?php echo $this->createUrl("admin/quotas/modifyquota/surveyid/$iSurveyId");?>" method="post">
<div class="ui-tabs ui-widget ui-widget-content ui-corner-all">
<table>
<tr>
<td valign="top">
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="2" class="header ui-widget-header"><?php $clang->eT("Edit quota");?></td>
</tr>
<tr class="evenrow">
<td align="right"><blockquote>
<p><strong><?php $clang->eT("Quota name");?>:</strong></p>
</blockquote></td>
<td align="left"> <input name="quota_name" type="text" size="30" maxlength="255" value="<?php echo $quotainfo['name'];?>" /></td>
</tr>
<tr class="evenrow">
<td align="right"><blockquote>
<p><strong><?php $clang->eT("Quota limit");?>:</strong></p>
</blockquote></td>
<td align="left"><input name="quota_limit" type="text" size="12" maxlength="8" value="<?php echo $quotainfo['qlimit'];?>" /></td>
</tr>
<tr class="evenrow">
<td align="right"><blockquote>
<p><strong><?php $clang->eT("Quota action");?>:</strong></p>
</blockquote></td>
<td align="left"> <select name="quota_action">
<option value ="1" '<?php if($quotainfo['action'] == 1) echo "selected"; ?>'><?php $clang->eT("Terminate survey");?></option>
<option value ="2" '<?php if($quotainfo['action'] == 2) echo "selected"; ?>'><?php $clang->eT("Terminate survey with warning");?></option>
</select></td>
</tr>
<tr class="evenrow">
<td align="right"><blockquote>
<p><strong><?php $clang->eT("Autoload URL");?>:</strong></p>
</blockquote></td>
<td align="left"><input name="autoload_url" type="checkbox" value="1"<?php if($quotainfo['autoload_url'] == "1") {echo " checked";}?> /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</div>
<div id="tabs">
<div class="header ui-tabs ui-widget ui-widget-content ui-corner-all"><?php $clang->eT("Edit quota");?></div>
<form class='form44' action="<?php echo $this->createUrl("admin/quotas/modifyquota/surveyid/$iSurveyId");?>" method="post">
<ul>
<li><label for='quota_name'><?php $clang->eT("Quota name:");?></label> <input id="quota_name" name="quota_name" type="text" size="30" maxlength="255" value="<?php echo $quotainfo['name'];?>" /></li>
<li><label for='quota_limit'><?php $clang->eT("Quota limit:");?></label><input id="quota_limit" name="quota_limit" type="text" size="12" maxlength="8" value="<?php echo $quotainfo['qlimit'];?>" /></li>
<li><label for='quota_action'><?php $clang->eT("Quota action:");?></label> <select name="quota_action" id="quota_action">
<option value ="1" <?php
if($quotainfo['action'] == 1) echo "selected='selected'"; ?>><?php $clang->eT("Terminate survey");?></option>
<option value ="2" <?php if($quotainfo['action'] == 2) echo "selected='selected'"; ?>><?php $clang->eT("Terminate survey with warning");?></option>
</select></li>
<li><label for='autoload_url'><?php $clang->eT("Autoload URL:");?></label><input id="autoload_url" name="autoload_url" type="checkbox" value="1"<?php if($quotainfo['autoload_url'] == "1") {echo " checked";}?> /></li>
</ul>
<div id="tabs">
<ul>
<?php foreach ($aTabTitles as $sLanguageCode=>$sTitle){?>
<li style='clear:none'><a href='#tabpage_<?php echo $sLanguageCode;?>'><?php echo $sTitle;?></a></li><?php
}?>
</ul>
33 changes: 5 additions & 28 deletions application/views/admin/quotas/editquotalang_view.php
@@ -1,30 +1,7 @@
<div class="tabpage_<?php echo $lang; ?>">
<table >
<tr>
<td valign="top">
<table width="100%" border="0">
<tbody>
<tr class="evenrow">
<td align="right" valign="top"><blockquote>
<p><strong><?php $clang->eT("Quota message");?>:</strong></p>
</blockquote></td>
<td align="left"> <textarea name="quotals_message_<?php echo $lang;?>" cols="60" rows="6"><?php echo $langquotainfo['quotals_message'];?></textarea></td>
</tr>
<tr class="evenrow">
<td align="right"><blockquote>
<p><strong><?php $clang->eT("URL");?>:</strong></p>
</blockquote></td>
<td align="left"> <input name="quotals_url_<?php echo $lang;?>" type="text" size="30" maxlength="255" value="<?php echo $langquotainfo['quotals_url'];?>" /></td>
</tr>
<tr class="evenrow">
<td align="right"><blockquote>
<p><strong><?php $clang->eT("URL description");?>:</strong></p>
</blockquote></td>
<td align="left"> <input name="quotals_urldescrip_<?php echo $lang;?>" type="text" size="30" maxlength="255" value="<?php echo $langquotainfo['quotals_urldescrip'];?>" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
<ul>
<li><label for='quotals_message_<?php echo $lang;?>'><?php $clang->eT("Quota message");?>:</label><textarea id="quotals_message_<?php echo $lang;?>" name="quotals_message_<?php echo $lang;?>" cols="60" rows="6"><?php echo htmlspecialchars($langquotainfo['quotals_message']);?></textarea></li>
<li><label for='quotals_url_<?php echo $lang;?>'><?php $clang->eT("Quota message");?>:</label><input id="quotals_url_<?php echo $lang;?>" name="quotals_url_<?php echo $lang;?>" type="text" size="30" maxlength="255" value="<?php echo htmlspecialchars($langquotainfo['quotals_url']);?>" /></li>
<li><label for='quotals_urldescrip_<?php echo $lang;?>'><?php $clang->eT("URL description");?>:</label><input id="quotals_urldescrip_<?php echo $lang;?>" name="quotals_urldescrip_<?php echo $lang;?>" type="text" size="30" maxlength="255" value="<?php echo htmlspecialchars($langquotainfo['quotals_urldescrip']);?>" /></li>
</ul>
</div>

0 comments on commit 2775fed

Please sign in to comment.