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 | {
|
---|
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 | });
|
---|
18 | }
|
---|
19 | else
|
---|
20 | {
|
---|
21 | if (update_user_info == "1")
|
---|
22 | {
|
---|
23 | $('#update_user_info').modal({backdrop: 'static'});
|
---|
24 | }
|
---|
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');
|
---|
56 | //$('#alert-services-package-bk').modal('show');
|
---|
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 |
|
---|
126 | function DoOpenLectureOnLoad(filename) {
|
---|
127 | g_Flash.SetVariable("openedFileName", filename);
|
---|
128 | g_Flash.SetVariable("command", "Init&Open File");
|
---|
129 | }
|
---|
130 |
|
---|
131 | function DoCloseLecture() {
|
---|
132 | g_Flash.SetVariable("command", "Quit App");
|
---|
133 | }
|
---|
134 |
|
---|
135 | function getLectureState() {
|
---|
136 | var state = g_Flash.GetVariable("dataChanged");
|
---|
137 | return state == 'true' ? true : (state == 'false' ? false : false);
|
---|
138 | }
|
---|
139 |
|
---|
140 | // Handle all the FSCommand messages in a Flash movie.
|
---|
141 | function LectorEditorOnline_DoFSCommand(command, args) {
|
---|
142 | switch (command) {
|
---|
143 | case "Set Title":
|
---|
144 | SetWindowTitle(args);
|
---|
145 | break;
|
---|
146 | case "Get Clipboard":
|
---|
147 | GetClipboardItem();
|
---|
148 | break;
|
---|
149 | case "Set Clipboard":
|
---|
150 | SetClipboardItem(args);
|
---|
151 | break;
|
---|
152 | case "Set State":
|
---|
153 | //SetWindowState();
|
---|
154 | break;
|
---|
155 | case "Quit":
|
---|
156 | window.open('', '_self').close();
|
---|
157 | break;
|
---|
158 | case "trace":
|
---|
159 | alert(args);
|
---|
160 | break;
|
---|
161 | case "Check License":
|
---|
162 | showModal();
|
---|
163 | break;
|
---|
164 | }
|
---|
165 | }
|
---|
166 | ;
|
---|
167 |
|
---|
168 | // Hook for Internet Explorer.
|
---|
169 | if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
|
---|
170 | document.write('<script language=\"VBScript\"\>\n');
|
---|
171 | document.write('On Error Resume Next\n');
|
---|
172 | document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
|
---|
173 | document.write(' Call LectorEditorOnline_DoFSCommand(command, args)\n');
|
---|
174 | document.write('End Sub\n');
|
---|
175 | document.write('</script\>\n');
|
---|
176 | }
|
---|
177 | ;
|
---|
178 |
|
---|
179 |
|
---|
180 | $(document).ready(function () {
|
---|
181 | InitViolet();
|
---|
182 | var inFormOrLink = false;
|
---|
183 |
|
---|
184 | $(window).on('beforeunload', function () {
|
---|
185 | var e = $.Event('webapp:page:closing');
|
---|
186 | $(window).trigger(e); // let other modules determine whether to prevent closing
|
---|
187 | if (e.isDefaultPrevented()) {
|
---|
188 | return e.message;
|
---|
189 | }
|
---|
190 | });
|
---|
191 |
|
---|
192 | $(window).on('webapp:page:closing', function (e) {
|
---|
193 | if (getLectureState()) {
|
---|
194 | e.preventDefault();
|
---|
195 | 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?';
|
---|
196 | }
|
---|
197 | });
|
---|
198 |
|
---|
199 | if (fileid != "")
|
---|
200 | {
|
---|
201 | console.log(api_url+'space/file/id/' + fileid);
|
---|
202 | DoOpenLectureOnLoad(api_url+'space/file/id/' + fileid);
|
---|
203 | }
|
---|
204 | else {
|
---|
205 | g_Flash.SetVariable("command", "Init OK");
|
---|
206 | }
|
---|
207 |
|
---|
208 |
|
---|
209 | /*setTimeout(function () {
|
---|
210 | if (fileid != "")
|
---|
211 | {
|
---|
212 | DoOpenLecture(api_url+'space/file/id/' + fileid);
|
---|
213 | }
|
---|
214 |
|
---|
215 | }, 1000);*/
|
---|
216 | })
|
---|
217 |
|
---|