[780] | 1 | if (licenseAvailable == "!OK")
|
---|
| 2 | {
|
---|
| 3 | $('#alert-services').modal('show');
|
---|
| 4 | if (first_visit == '1') {
|
---|
| 5 | $('#alert-services').modal('show');
|
---|
| 6 | }
|
---|
| 7 | }
|
---|
| 8 |
|
---|
| 9 | if (p_period == -1 && is_overdate == 1)
|
---|
| 10 | {
|
---|
[831] | 11 | $('#alert-trial-services').modal('show');
|
---|
| 12 | $('#alert-trial-services').on('hidden.bs.modal', function () {
|
---|
| 13 | if (update_user_info == "1")
|
---|
| 14 | {
|
---|
| 15 | $('#update_user_info').modal({backdrop: 'static', keyboard: false, });
|
---|
| 16 | }
|
---|
| 17 | });
|
---|
[780] | 18 | }
|
---|
| 19 | else
|
---|
| 20 | {
|
---|
[831] | 21 | if (update_user_info == "1")
|
---|
| 22 | {
|
---|
| 23 | $('#update_user_info').modal({backdrop: 'static'});
|
---|
| 24 | }
|
---|
[780] | 25 | }
|
---|
| 26 |
|
---|
| 27 | $("#update_user_info.btn").click(function () {
|
---|
| 28 | $(".error").html("");
|
---|
| 29 | $.ajax({
|
---|
| 30 | url: 'user/update_info/',
|
---|
| 31 | type: 'POST',
|
---|
| 32 | data: $("#update_user_info.form").serialize(),
|
---|
| 33 | success: function (data, textStatus, jqXHR)
|
---|
| 34 | {
|
---|
| 35 | result = jQuery.parseJSON(data);
|
---|
| 36 | if (result.success == "1")
|
---|
| 37 | {
|
---|
| 38 | $('#update_user_info').modal('hide');
|
---|
| 39 |
|
---|
| 40 | }
|
---|
| 41 | else
|
---|
| 42 | {
|
---|
| 43 | for (var key in result.errors)
|
---|
| 44 | {
|
---|
| 45 | $("#" + result.errors[key]['field'] + ".error").html(result.errors[key]['content']);
|
---|
| 46 |
|
---|
| 47 | }
|
---|
| 48 | }
|
---|
| 49 | }
|
---|
| 50 | });
|
---|
| 51 | });
|
---|
| 52 |
|
---|
| 53 | function showModal() {
|
---|
| 54 | console.log('Show modal!');
|
---|
| 55 | $('#alert-services-package').modal('show');
|
---|
[831] | 56 | //$('#alert-services-package-bk').modal('show');
|
---|
[780] | 57 | }
|
---|
| 58 |
|
---|
| 59 | $('#services-reg').click(function () {
|
---|
| 60 | $('#alert-services').modal('hide');
|
---|
| 61 | window.location = url + "frontend/user/profile#services-register";
|
---|
| 62 | });
|
---|
| 63 |
|
---|
| 64 | $('#save-package').click(function () {
|
---|
| 65 | DoSaveLecture();
|
---|
| 66 | });
|
---|
| 67 |
|
---|
| 68 | $('#services-sign').click(function () {
|
---|
| 69 | $('#alert-services-reg').modal('hide');
|
---|
| 70 | $('#alert-services-reg-2').modal('show');
|
---|
| 71 | })
|
---|
| 72 |
|
---|
| 73 | var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
|
---|
| 74 | var g_Flash = null;
|
---|
| 75 | var g_cbData = "";
|
---|
| 76 |
|
---|
| 77 | function InitViolet() {
|
---|
| 78 | g_Flash = document.getElementById('LectorEditorOnline');
|
---|
| 79 | //g_Flash = $('#LectorEditorOnline');
|
---|
| 80 | //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
|
---|
| 81 | }
|
---|
| 82 | ;
|
---|
| 83 |
|
---|
| 84 | function GetClipboardItem() {
|
---|
| 85 | var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
|
---|
| 86 | g_Flash.SetVariable("clipboardData", cbData);
|
---|
| 87 | g_Flash.SetVariable("command", "Get Text");
|
---|
| 88 | }
|
---|
| 89 | ;
|
---|
| 90 |
|
---|
| 91 | function SetClipboardItem(args) {
|
---|
| 92 | if (window.clipboardData)
|
---|
| 93 | window.clipboardData.setData('Text', args);
|
---|
| 94 | else
|
---|
| 95 | g_cbData = args;
|
---|
| 96 | g_Flash.SetVariable("command", "Set OK");
|
---|
| 97 | }
|
---|
| 98 | ;
|
---|
| 99 |
|
---|
| 100 | function SetWindowTitle(fileName) {
|
---|
| 101 | if (fileName == "")
|
---|
| 102 | document.title = "Violet Online";
|
---|
| 103 | else {
|
---|
| 104 | var docName = fileName.substring(0, fileName.length - 4);
|
---|
| 105 | document.title = "Violet Online - " + docName;
|
---|
| 106 | }
|
---|
| 107 | }
|
---|
| 108 | ;
|
---|
| 109 |
|
---|
| 110 | function SetWindowState() {
|
---|
| 111 | var full = (g_Flash.width == "100%");
|
---|
| 112 | g_Flash.width = full ? "800" : "100%";
|
---|
| 113 | g_Flash.height = full ? "580" : "100%";
|
---|
| 114 | }
|
---|
| 115 | ;
|
---|
| 116 |
|
---|
| 117 | function DoSaveLecture() {
|
---|
| 118 | g_Flash.SetVariable("command", "Press Save");
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | function DoOpenLecture(filename) {
|
---|
| 122 | g_Flash.SetVariable("openedFileName", filename);
|
---|
| 123 | g_Flash.SetVariable("command", "Open File");
|
---|
| 124 | }
|
---|
| 125 |
|
---|
[831] | 126 | function DoCloseLecture() {
|
---|
| 127 | g_Flash.SetVariable("command", "Quit App");
|
---|
[780] | 128 | }
|
---|
| 129 |
|
---|
[831] | 130 | function getLectureState() {
|
---|
| 131 | var state = g_Flash.GetVariable("dataChanged");
|
---|
| 132 | return state == 'true' ? true : (state == 'false' ? false : false);
|
---|
[780] | 133 | }
|
---|
| 134 |
|
---|
| 135 | // Handle all the FSCommand messages in a Flash movie.
|
---|
| 136 | function LectorEditorOnline_DoFSCommand(command, args) {
|
---|
| 137 | switch (command) {
|
---|
| 138 | case "Set Title":
|
---|
| 139 | SetWindowTitle(args);
|
---|
| 140 | break;
|
---|
| 141 | case "Get Clipboard":
|
---|
| 142 | GetClipboardItem();
|
---|
| 143 | break;
|
---|
| 144 | case "Set Clipboard":
|
---|
| 145 | SetClipboardItem(args);
|
---|
| 146 | break;
|
---|
| 147 | case "Set State":
|
---|
| 148 | //SetWindowState();
|
---|
| 149 | break;
|
---|
| 150 | case "Quit":
|
---|
| 151 | window.open('', '_self').close();
|
---|
| 152 | break;
|
---|
| 153 | case "trace":
|
---|
| 154 | alert(args);
|
---|
| 155 | break;
|
---|
| 156 | case "Check License":
|
---|
| 157 | showModal();
|
---|
| 158 | break;
|
---|
| 159 | }
|
---|
| 160 | }
|
---|
| 161 | ;
|
---|
| 162 |
|
---|
| 163 | // Hook for Internet Explorer.
|
---|
| 164 | if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
|
---|
| 165 | document.write('<script language=\"VBScript\"\>\n');
|
---|
| 166 | document.write('On Error Resume Next\n');
|
---|
| 167 | document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
|
---|
| 168 | document.write(' Call LectorEditorOnline_DoFSCommand(command, args)\n');
|
---|
| 169 | document.write('End Sub\n');
|
---|
| 170 | document.write('</script\>\n');
|
---|
| 171 | }
|
---|
| 172 | ;
|
---|
| 173 |
|
---|
| 174 |
|
---|
| 175 | $(document).ready(function () {
|
---|
[831] | 176 | InitViolet();
|
---|
| 177 | var inFormOrLink = false;
|
---|
[780] | 178 |
|
---|
[831] | 179 | $(window).on('beforeunload', function () {
|
---|
| 180 | var e = $.Event('webapp:page:closing');
|
---|
| 181 | $(window).trigger(e); // let other modules determine whether to prevent closing
|
---|
| 182 | if (e.isDefaultPrevented()) {
|
---|
| 183 | return e.message;
|
---|
| 184 | }
|
---|
| 185 | });
|
---|
[780] | 186 |
|
---|
[831] | 187 | $(window).on('webapp:page:closing', function (e) {
|
---|
| 188 | if (getLectureState()) {
|
---|
| 189 | e.preventDefault();
|
---|
| 190 | e.message = 'Bạn Äang soạn bà i giảng và chưa lưu dữ liá»u. Bạn có muá»n chuyá»n khá»i ứng dụng khÃŽng?';
|
---|
| 191 | }
|
---|
| 192 | });
|
---|
| 193 | setTimeout(function () {
|
---|
| 194 | if (fileid != "")
|
---|
| 195 | {
|
---|
| 196 | DoOpenLecture(api_url+'space/file/id/' + fileid);
|
---|
| 197 | }
|
---|
[780] | 198 |
|
---|
[831] | 199 | }, 1000);
|
---|
[828] | 200 | })
|
---|
| 201 |
|
---|