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 DoCloseLecture () {
|
---|
127 | g_Flash.SetVariable("command", "Quit App");
|
---|
128 | }
|
---|
129 |
|
---|
130 | function getLectureState () {
|
---|
131 | var state = g_Flash.GetVariable("dataChanged");
|
---|
132 | return state == 'true' ? true: (state == 'false' ? false:false);
|
---|
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 () {
|
---|
176 | InitViolet();
|
---|
177 | if(fileid!="")
|
---|
178 | {
|
---|
179 |
|
---|
180 | $('#open-lecture').click(function(e){DoOpenLecture('http://sbgapi.violet.vn/space/file/id/'+fileid);});
|
---|
181 | }
|
---|
182 |
|
---|
183 | var inFormOrLink = false;
|
---|
184 |
|
---|
185 | $(window).on('beforeunload', function() {
|
---|
186 | var e = $.Event('webapp:page:closing');
|
---|
187 | $(window).trigger(e); // let other modules determine whether to prevent closing
|
---|
188 | if(e.isDefaultPrevented()) {
|
---|
189 | return e.message;
|
---|
190 | }
|
---|
191 | });
|
---|
192 |
|
---|
193 | $(window).on('webapp:page:closing', function(e) {
|
---|
194 | if(getLectureState()) {
|
---|
195 | e.preventDefault();
|
---|
196 | 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?';
|
---|
197 | }
|
---|
198 | });
|
---|
199 |
|
---|
200 | }) |
---|