forked from vanderbilt-redcap/email-alerts-module
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodes_modal.php
More file actions
69 lines (61 loc) · 2.99 KB
/
Copy pathcodes_modal.php
File metadata and controls
69 lines (61 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
namespace Vanderbilt\EmailTriggerExternalModule;
use ExternalModules\AbstractExternalModule;
use ExternalModules\ExternalModules;
require_once 'EmailTriggerExternalModule.php';
?>
<script>
$(function(){
$('#btnModalAddForm').click(function () {
$('#AddNewForm').submit();
});
$('#AddNewForm').submit(function () {
var data = $('#AddNewForm').serialize();
var editor_text = tinymce.activeEditor.getContent();
data += "&email-text-editor="+encodeURIComponent(editor_text);
data += "&email-to="+encodeURIComponent($('#email-to').val());
data += "&email-cc="+encodeURIComponent($('#email-cc').val());
data += "&email-bcc="+encodeURIComponent($('#email-bcc').val());
var files = {};
$('#AddNewForm').find('input, select, textarea').each(function(index, element){
var element = $(element);
var name = element.attr('name');
var type = element[0].type;
if (type == 'file') {
// only store one file per variable - the first file
jQuery.each(element[0].files, function(i, file) {
if (typeof files[name] == "undefined") {
files[name] = file;
}
});
}
});
if(checkRequiredFieldsAndLoadOption('','')){
saveFilesIfTheyExist('<?=$module->getUrl('save-file.php')?>', files);
ajaxLoadOptionAndMessage(data,'<?=$module->getUrl('saveForm.php')?>',"A");
}
return false;
});
});
</script>
<!-- Modal -->
<form class="form-horizontal" action="" method="post" id='AddNewForm'>
<div class="modal fade" id="external-modules-configure-modal" name="external-modules-configure-modal" data-module="<?=$_REQUEST['prefix']?>" tabindex="-1" role="dialog" aria-labelledby="Codes">
<div class="modal-dialog" role="document" style="width: 800px">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title float-left" id="myModalLabel">Configure Email Alerts</h4>
<button type="button" class="close closeCustomModal float-right" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
</div>
<div class="modal-body">
<div id='errMsgContainerModal' class="alert alert-danger col-md-12" role="alert" style="display:none;margin-bottom:20px;"></div>
<table class="code_modal_table" id="code_modal_table"></table>
</div>
<div class="modal-footer">
<a class="btn btn-default btn-cancel" id='btnCloseCodesModal' data-dismiss="modal">Cancel</a>
<a class="btn btn-default save" id='btnModalAddForm'>Save</a>
</div>
</div>
</div>
</div>
</form>