Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into cint
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jul 29, 2016
2 parents 308ce9c + aacde76 commit b6f67c3
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 34 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -16,7 +16,7 @@
$config['dbversionnumber'] = 258;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '28';
$config['assetsversionnumber'] = '29';
return $config;

?>
9 changes: 9 additions & 0 deletions application/controllers/admin/tokens.php
Expand Up @@ -279,6 +279,14 @@ public function deleteMultiple()
TokenDynamic::model($iSid)->deleteRecords($aTokenIds);
return true;
}
public function deleteToken()
{
// TODO: permission checks
$aTokenId = Yii::app()->getRequest()->getParam('sItem');
$iSid = Yii::app()->getRequest()->getParam('sid');
TokenDynamic::model($iSid)->deleteRecords([$aTokenId]);
return true;
}

/**
* Browse Tokens
Expand Down Expand Up @@ -1769,6 +1777,7 @@ public function email($iSurveyId, $tokenids = null)
else
{
$aData['sidemenu']['state'] = false;

$this->_renderWrappedTemplate('token', array( 'message' => array(
'title' => gT("Warning"),
'message' => gT("There were no eligible emails to send. This will be because none satisfied the criteria of:")
Expand Down
4 changes: 4 additions & 0 deletions application/models/TokenDynamic.php
Expand Up @@ -778,6 +778,7 @@ public function getbuttons()
$sEditUrl = App()->createUrl("/admin/tokens/sa/edit/iSurveyId/".self::$sid."/iTokenId/$this->tid/ajax/true");
$sInviteUrl = App()->createUrl("/admin/tokens/sa/email/surveyid/".self::$sid."/tokenids/$this->tid");
$sRemindUrl = App()->createUrl("admin/tokens/sa/email/action/remind/surveyid/".self::$sid."/tokenids/$this->tid");
$sDeleteUrl = App()->createUrl("admin/tokens/sa/deleteToken/sid/".self::$sid."/sItem/$this->tid");
$button = '';

// View response details
Expand Down Expand Up @@ -845,6 +846,9 @@ public function getbuttons()
{
// $sEditUrl = App()->createUrl("/admin/tokens/sa/edit/iSurveyId/".self::$sid."/iTokenId/$this->tid");
$button .= '<a class="btn btn-default btn-xs edit-token" href="#" data-sid="'.self::$sid.'" data-tid="'.$this->tid.'" data-url="'.$sEditUrl.'" role="button" data-toggle="tooltip" title="'.gT('Edit this survey participant').'"><span class="icon-edit" ></span></a>';
//Delete Token
$button .= '<a class="btn btn-danger btn-xs delete-token" href="#" data-sid="'.self::$sid.'" data-tid="'.$this->tid.'" data-url="'.$sDeleteUrl.'" role="button" data-toggle="tooltip" title="'.gT('Delte this survey participant token').'"><span class="fa fa-trash-o" ></span></a>';

}
else
{
Expand Down
14 changes: 8 additions & 6 deletions application/views/admin/super/messagebox.php
Expand Up @@ -5,12 +5,14 @@
* @var $message html
*/
?>
<div class="row">
<div class="col-sm-11 col-sm-offset-1 content-right">
<!-- Message box from super admin -->
<div class="jumbotron message-box <?php echo isset($class) ? $class : ""; ?>">
<h2 ><?php echo $title;?></h2>
<?php echo $message;?>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="row">
<div class="col-sm-12 content-center">
<!-- Message box from super admin -->
<div class="jumbotron message-box <?php echo isset($class) ? $class : ""; ?>">
<h2 ><?php echo $title;?></h2>
<?php echo $message;?>
</div>
</div>
</div>
</div>
16 changes: 9 additions & 7 deletions application/views/admin/token/emailpost.php
Expand Up @@ -5,13 +5,15 @@
* @var $message html
*/
?>
<div class="row" id="token-emailpost-messagebox">
<div class="col-sm-11 col-sm-offset-1 content-right">
<div class="jumbotron message-box">
<h2 ><?php if ($bEmail) eT("Sending invitations..."); else eT("Sending reminders...");?></h2>
<p style='border: 1px solid #ccc; height: 200px; overflow: scroll; text-align:left; padding-left:0.5em;'>
<?php echo $tokenoutput ?>
</p>
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="row" id="token-emailpost-messagebox">
<div class="col-sm-11 col-sm-offset-1 content-right">
<div class="jumbotron message-box">
<h2 ><?php if ($bEmail) eT("Sending invitations..."); else eT("Sending reminders...");?></h2>
<p style='border: 1px solid #ccc; height: 200px; overflow: scroll; text-align:left; padding-left:0.5em;'>
<?php echo $tokenoutput ?>
</p>
</div>
</div>
</div>
</div>
4 changes: 3 additions & 1 deletion application/views/admin/token/emailwarning.php
@@ -1,4 +1,5 @@
<div class="jumbotron message-box message-box-warning">
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<div class="jumbotron message-box message-box-warning">
<h2><?php eT("Warning"); ?></h2>

<?php echo CHtml::form(array("admin/tokens/sa/email/action/{$sSubAction}/surveyid/{$surveyid}"), 'post'); ?>
Expand Down Expand Up @@ -39,4 +40,5 @@
echo CHtml::hiddenField('message_'.$language, Yii::app()->request->getPost('message_' . $language));
} ?>
</form>
</div>
</div>
15 changes: 11 additions & 4 deletions scripts/admin/answers.js
Expand Up @@ -749,20 +749,24 @@ function quickaddlabels(scale_id, addOrReplace, table_id)
n = 1,
numeric = true,
codeAlphaPart = "",
currentCharacter,
codeSigil = (codes[0] !== undefined ? codes[0].split("") : ("A01").split(""));
while(numeric == true && n <= codeSigil.length){
var currentCharacter = codeSigil.pop() // get the current character
if ( !isNaN(Number(currentCharacter)) ) // check if it's numerical
currentCharacter = codeSigil.pop() // get the current character
if ( !isNaN(Number(currentCharacter)) ) // check if it's numerical
{
numericSuffix = currentCharacter+""+numericSuffix; // store it in a string
n++;
}
else
{
codeAlphaPart = codeSigil.join("")+currentCharacter;
$numeric = false; // At first non numeric character found, the loop is stoped
}
}
//Sometimes "0" is interpreted as NaN so test if it's just a missing Zero
if(isNaN(Number(currentCharacter))){
codeSigil.push(currentCharacter);
}
var tablerows = "";
for (var k in lsrows)
{
Expand All @@ -772,7 +776,10 @@ function quickaddlabels(scale_id, addOrReplace, table_id)
if (thisrow.length<=languages.length)
{
var qCode = (parseInt(k)+(1+parseInt(allrows)));
thisrow.unshift(codeAlphaPart+qCode);
while(qCode.toString().length < numericSuffix.length){
qCode = "0"+qCode;
}
thisrow.unshift( codeSigil.join('')+qCode);
}
else
{
Expand Down
16 changes: 9 additions & 7 deletions scripts/admin/subquestions.js
Expand Up @@ -847,22 +847,24 @@ function quickaddlabels(scale_id, addOrReplace, table_id)
var numericSuffix = '',
n = 1,
numeric = true,
codeAlphaPart = "",
currentCharacter,
codeSigil = (codes[0] !== undefined ? codes[0].split("") : ("SQ0001").split(""));
while(numeric == true && n <= codeSigil.length){
var currentCharacter = codeSigil.pop() // get the current character
if ( !isNaN(Number(currentCharacter)) ) // check if it's numerical
currentCharacter = codeSigil.pop() // get the current character
if ( !isNaN(Number(currentCharacter)) ) // check if it's numerical
{
numericSuffix = currentCharacter+""+numericSuffix; // store it in a string
n++;
}
else
{
codeAlphaPart = codeSigil.join("")+currentCharacter;
$numeric = false; // At first non numeric character found, the loop is stoped
}
}
codeSigil = codeSigil.join("");
//Sometimes "0" is interpreted as NaN so test if it's just a missing Zero
if(isNaN(Number(currentCharacter))){
codeSigil.push(currentCharacter);
}
var tablerows = "";
for (var k in lsrows)
{
Expand All @@ -872,10 +874,10 @@ function quickaddlabels(scale_id, addOrReplace, table_id)
if (thisrow.length<=languages.length)
{
var qCode = (parseInt(k)+(1+parseInt(allrows)));
while(qCode.length < numericSuffix.length){
while(qCode.toString().length < numericSuffix.length){
qCode = "0"+qCode;
}
thisrow.unshift(codeAlphaPart+qCode);
thisrow.unshift( codeSigil.join('')+qCode);
}
else
{
Expand Down
45 changes: 37 additions & 8 deletions scripts/admin/tokens.js
Expand Up @@ -181,18 +181,47 @@ $(document).ready(function(){
});
});

/**
* Token delete Token
*/
$(document).on('click', '.delete-token', function(){
var $that = $(this),
actionUrl = $that.data('url'),
$modal = $('#confirmation-modal');

$modal.data('ajax-url', actionUrl);
$modal.data('href', "#");
$modal.modal('show');
$modal.find('.modal-footer-yes-no').find('a.btn-ok').on('click', function(click){
$.ajax({
url: actionUrl,
method: "GET",
success: function(data){
try{
$.fn.yiiGridView.update('token-grid', {
complete: function(s){
$modal.modal('hide');
} // Update the surveys list
});
} catch(e){
if(e){console.log(e); $modal.modal('hide');}
}
}
});
})
});
/**
* Token edition
*/
$(document).on( 'click', '.edit-token', function(){
$that = $(this);
$sid = $that.data('sid');
$tid = $that.data('tid');
$actionUrl = $that.data('url');
$modal = $('#editTokenModal');
$modalBody = $modal.find('.modal-body');
$ajaxLoader = $('#ajaxContainerLoading2');
$oldModalBody = $modalBody.html();
var $that = $(this),
$sid = $that.data('sid'),
$tid = $that.data('tid'),
$actionUrl = $that.data('url'),
$modal = $('#editTokenModal'),
$modalBody = $modal.find('.modal-body'),
$ajaxLoader = $('#ajaxContainerLoading2'),
$oldModalBody = $modalBody.html();


$ajaxLoader.show();
Expand Down
4 changes: 4 additions & 0 deletions styles/Sea_Green/css/lime-admin-common.css
Expand Up @@ -1948,8 +1948,12 @@ h3,.h3 {

#token-grid table tr.odd .blank_button
{
/*For older Browsers with compatibilty issues*/
border-color: #f9f9f9;
background-color: #f9f9f9;
/*New CSS3 Style of doing it*/
border-color: rgba(0,0,0,0);
background-color: rgba(0,0,0,0);
}

#token-grid table tr .blank_button
Expand Down

0 comments on commit b6f67c3

Please sign in to comment.