diff --git a/htdocs/js/lib/custom/models/admin-down-offlineapps.js b/htdocs/js/lib/custom/models/admin-down-offlineapps.js new file mode 100644 index 00000000..716a0538 --- /dev/null +++ b/htdocs/js/lib/custom/models/admin-down-offlineapps.js @@ -0,0 +1,37 @@ +var uploader; +var param; +$(function() { + $('#file_upload').uploadify({ + 'swf' : '/js/lib/uploadify/uploadify.swf', + 'uploader' : '/admin/down/uploadapplicationform', + 'multi' : false, + 'auto' : true, + 'fileTypeExts' : '*.pdf', + 'onUploadSuccess' : function(file, data, response) { + upload.onsuccess(file, data, response); + }, + 'onUploadStart' : function(file) { + $('#file_upload').uploadify('settings','formData',param); + } + }); +}); + +var upload = { + onsuccess : function(file, data, response){ + _data = $.parseJSON(data); + if(!$.isEmptyObject(_data.error)) + { + alert(_data.error); + }else{ + $('#upload-form').modal('hide'); + window.location = window.location; + } + }, + showUploadForm : function(id){ + $('#upload-form').modal('show'); + param = { + "PHPSESSID" : _this.SessionID, + 'orderid' : id + }; + } +}; \ No newline at end of file diff --git a/htdocs/js/lib/custom/models/offlineapp-uploader.js b/htdocs/js/lib/custom/models/offlineapp-uploader.js new file mode 100644 index 00000000..74b630e1 --- /dev/null +++ b/htdocs/js/lib/custom/models/offlineapp-uploader.js @@ -0,0 +1,38 @@ +var uploader; +var param; +$(function() { + $('#file_upload').uploadify({ + 'swf' : '/js/lib/uploadify/uploadify.swf', + 'uploader' : '/service/uploadapplicationform', + 'multi' : false, + 'auto' : true, + 'fileTypeExts' : '*.pdf', + 'fileSizeLimit' : '20MB', + 'onUploadSuccess' : function(file, data, response) { + upload.onsuccess(file, data, response); + }, + 'onUploadStart' : function(file) { + $('#file_upload').uploadify('settings','formData',param); + } + }); +}); + +var upload = { + onsuccess : function(file, data, response){ + _data = $.parseJSON(data); + if(!$.isEmptyObject(_data.error)) + { + alert(_data.error); + }else{ + $('#upload-form').modal('hide'); + window.location = window.location; + } + }, + showUploadForm : function(id){ + $('#upload-form').modal('show'); + param = { + "PHPSESSID" : _this.SessionID, + 'offlineappid' : id + }; + } +}; \ No newline at end of file