Skip to content

Commit

Permalink
Dev: Nice modal popup when mapping token attributes to CPDB
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Feb 23, 2016
1 parent 89b78a3 commit 887dabd
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
12 changes: 8 additions & 4 deletions application/controllers/admin/participantsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -1510,14 +1510,18 @@ function addToCentral()

$response = Participant::model()->copyToCentral(Yii::app()->request->getPost('surveyid'), $newarr, $mapped, $overwriteauto, $overwriteman, $createautomap);

printf(gT("%s participants have been copied to the central participants table"), $response['success']);
echo "<p>";
printf(gT("%s participants have been copied to the central participants table"), "<span class='badge alert-success'>" . $response['success'] . "</span>&nbsp;");
echo "</p>";
if($response['duplicate'] > 0) {
echo "\r\n";
printf(gT("%s entries were not copied because they already existed"), $response['duplicate']);
echo "<p>";
printf(gT("%s entries were not copied because they already existed"), "<span class='badge alert-warning'>" . $response['duplicate'] . "</span>&nbsp;");
echo "</p>";
}
if($response['overwriteman']=="true" || $response['overwriteauto']) {
echo "\r\n";
echo "<p>";
eT("Attribute values for existing participants have been updated from the token records");
echo "</p>";
}
}

Expand Down
15 changes: 15 additions & 0 deletions application/views/admin/participants/attributeMapToken_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,18 @@
<?php echo CHtml::image($ajaxloader['src'], $ajaxloader['alt']); ?>
</div>
</div>
<div id='attribute-map-token-modal' class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title"><?php eT("Map token attributes"); ?></h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
7 changes: 5 additions & 2 deletions scripts/admin/attributeMapToken.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,12 @@ $(document).ready(function(){
overwriteman: attoverwriteman,
createautomap: attcreateautomap
}, function(msg){
alert(msg);
$('#attribute-map-token-modal .modal-body').html(msg);
$('#attribute-map-token-modal').on('hide.bs.modal' , function (e) {
$(location).attr('href',redUrl);
});
$('#attribute-map-token-modal').modal();

$(location).attr('href',redUrl);
});
});

Expand Down

0 comments on commit 887dabd

Please sign in to comment.