2 * interface/modules/zend_modules/public/js/installer/action.js
5 * @link https://www.open-emr.org
6 * @author Jacob T.Paul <jacob@zhservices.com>
7 * @author Vipin Kumar <vipink@zhservices.com>
8 * @author Jerry Padgett <sjpadgett@gmail.com>
9 * @copyright Copyright (c) 2020 Jerry Padgett <sjpadgett@gmail.com>
10 * @author Remesh Babu S <remesh@zhservices.com>
11 * @copyright Copyright (c) 2013 Z&H Consultancy Services Private Limited <sam@zhservices.com>
12 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 function register(status,title,name,method,type){
17 $.post("./Installer/register", { st: status, mod_title: title, mod_name: name, mod_method:method,mtype:type},
19 if(data == "Success") {
20 window.location.reload();
22 var resultTranslated = js_xl(data);
23 $('#err').html(resultTranslated.msg).fadeIn().delay(2000).fadeOut();
29 function manage(id,action){
30 if (action == 'unregister') {
31 if (!confirm("Please Confirm with OK to Unregister this Module.")) {
35 install_upgrade_log = $("#install_upgrade_log");
36 install_upgrade_log.empty();
38 if(document.getElementById('mod_enc_menu'))
39 modencmenu = document.getElementById('mod_enc_menu').value;
42 if(document.getElementById('mod_nick_name_'+id))
43 modnickname = document.getElementById('mod_nick_name_'+id).value;
48 url: "./Installer/manage",
49 data: { modId: id, modAction: action,mod_enc_menu:modencmenu,mod_nick_name:modnickname},
50 beforeSend: function(){
53 success: function(data){
55 var data_json = JSON.parse(data);
56 if(data_json.status == "Success") {
57 if(data_json.output != undefined && data_json.output.length > 1) {
58 install_upgrade_log.empty()
60 .append(data_json.output);
62 $(".show_hide_log").click(function(event) {
63 $(event.target).next("div.spoiler").toggle("slow");
67 if (parent.left_nav.location) {
68 parent.left_nav.location.reload();
69 parent.Title.location.reload();
70 if(self.name=='RTop') {
71 parent.RBot.location.reload();
74 parent.RTop.location.reload();
76 top.document.getElementById('fsright').rows = '*,*';
78 if(data_json.output == undefined || data_json.output.length <= 1) {
79 window.location.reload();
83 alert(data_json.status);
86 if (e instanceof SyntaxError) {
87 install_upgrade_log.append(data);
90 install_upgrade_log.append(data);
95 complete: function() {
101 var blockInput = function(element) {
102 $(element).prop('disabled', true);
103 $(element).css("background-color", "#c9c6c6");
104 $(element).closest("a").click(function(){return false;});
107 function configure(id,imgpath){
108 if($("#ConfigRow_"+id).css("display")!="none"){
110 $("#ConfigRow_"+id).fadeOut();
113 $.post("./Installer/configure", {mod_id:id},
116 $("#ConfigRow_"+id).hide();
117 $("#ConfigRow_"+id).html('<td colspan="10" style="background: ghostwhite;">'+data+'</td>').fadeIn();
123 function custom_toggle(obj){
124 if($("#"+obj).css("display")!="none"){
125 $("#"+obj).fadeOut();
132 function SaveMe(frmId,mod_id){
133 var SelAccIndTab = $('#configaccord'+mod_id).accordion('getSelected');
135 var Acctitle = SelAccIndTab.panel('options').title;
137 var SelTab = $('#tab'+mod_id).tabs('getSelected');
139 var Tabtitle = SelTab.panel('options').title;
141 if(frmId == 'hooksform'){
144 url: "./Installer/SaveHooks",
145 data: $('#'+frmId+mod_id).serialize(),
146 success: function(data){
147 $.each(data, function(jsonIndex, jsonValue){
148 if (jsonValue['return'] == 1) {
149 $("#hook_response"+mod_id).html(jsonValue['msg']).fadeIn().fadeOut(1000);
152 $('#tab'+mod_id).tabs('select',Tabtitle);
163 function DeleteACL(aclID,user,mod_id,msg){
164 var SelAccIndTab = $('#configaccord'+mod_id).accordion('getSelected');
166 var Acctitle = SelAccIndTab.panel('options').title;
170 url: "./Installer/DeleteAcl",
175 success: function(data){
176 $.each(data, function(jsonIndex, jsonValue){
177 if (jsonValue['return'] == 1) {
178 $("#ConfigRow_"+mod_id).hide();
179 configure(mod_id,'');
180 alert(jsonValue['msg']);
183 $('#configaccord'+mod_id).accordion('select',Acctitle);
192 function DeleteHooks(hooksID,mod_id,msg){
193 var SelTab = $('#tab'+mod_id).tabs('getSelected');
195 var Tabtitle = SelTab.panel('options').title;
199 url: "./Installer/DeleteHooks",
203 success: function(data){
204 $.each(data, function(jsonIndex, jsonValue){
205 if (jsonValue['return'] == 1) {
206 $("#ConfigRow_"+mod_id).hide();
207 configure(mod_id,'');
208 alert(jsonValue['msg']);
211 $('#tab'+mod_id).tabs('select',Tabtitle);
221 * Save Settings Tab Contents
223 * @param {string} frmId
224 * @param {int} mod_id
225 * @returns {undefined}
227 function saveConfig(frmId, mod_id) {
230 url: "./Installer/saveConfig",
231 data: $('#' + frmId + mod_id).serialize(),
232 success: function(data){
233 var resultTranslated = js_xl('Configuration saved successfully');
234 $('#target' + data.modeId).html(resultTranslated.msg + ' ....').show().fadeOut(4000);
240 function validateNickName(modId) {
241 Nickname = $("#mod_nick_name_"+modId).val();
242 if($.trim(Nickname) != ""){
245 url: "./Installer/nickName",
249 success: function(data){
251 $("#mod_nick_name_"+modId).css("background","#FFB9B5");
252 $("#mod_nick_name_message_"+modId).html("* Duplicate Nick Name");
254 $("#mod_nick_name_"+modId).css("background","");
255 $("#mod_nick_name_message_"+modId).html("");
263 $("#mod_nick_name_"+modId).css("background","");
264 $("#mod_nick_name_message_"+modId).html("");