[490] | 1 | if (licenseAvailable == "!OK")
|
---|
| 2 | {
|
---|
[654] | 3 | $('#alert-services').modal('show');
|
---|
[553] | 4 | if (first_visit == '1') {
|
---|
[654] | 5 | $('#alert-services').modal('show');
|
---|
[490] | 6 | }
|
---|
[906] | 7 | $('#alert-services').on('hidden.bs.modal', function () {
|
---|
| 8 | if (update_user_info == "1")
|
---|
| 9 | {
|
---|
| 10 | $('#update_user_info').modal({backdrop: 'static',keyboard: false,});
|
---|
| 11 | }
|
---|
| 12 | });
|
---|
[490] | 13 | }
|
---|
[661] | 14 |
|
---|
[765] | 15 | if (p_period == -1 && is_overdate == 1)
|
---|
[717] | 16 | {
|
---|
[906] | 17 |
|
---|
[717] | 18 | $('#alert-trial-services').modal('show');
|
---|
| 19 | $('#alert-trial-services').on('hidden.bs.modal', function () {
|
---|
| 20 | if (update_user_info == "1")
|
---|
| 21 | {
|
---|
| 22 | $('#update_user_info').modal({backdrop: 'static',keyboard: false,});
|
---|
| 23 | }
|
---|
| 24 | });
|
---|
[654] | 25 | }
|
---|
[906] | 26 |
|
---|
[717] | 27 | else
|
---|
| 28 | {
|
---|
[906] | 29 | if (licenseAvailable == "OK"){
|
---|
| 30 | if (update_user_info == "1")
|
---|
| 31 | {
|
---|
| 32 | $('#update_user_info').modal({backdrop: 'static'});
|
---|
| 33 | }
|
---|
[717] | 34 | }
|
---|
| 35 | }
|
---|
[490] | 36 |
|
---|
[580] | 37 | $("#update_user_info.btn").click(function () {
|
---|
| 38 | $(".error").html("");
|
---|
| 39 | $.ajax({
|
---|
| 40 | url: 'user/update_info/',
|
---|
| 41 | type: 'POST',
|
---|
| 42 | data: $("#update_user_info.form").serialize(),
|
---|
| 43 | success: function (data, textStatus, jqXHR)
|
---|
| 44 | {
|
---|
| 45 | result = jQuery.parseJSON(data);
|
---|
| 46 | if (result.success == "1")
|
---|
| 47 | {
|
---|
[654] | 48 | $('#update_user_info').modal('hide');
|
---|
[661] | 49 |
|
---|
[580] | 50 | }
|
---|
| 51 | else
|
---|
| 52 | {
|
---|
| 53 | for (var key in result.errors)
|
---|
| 54 | {
|
---|
[654] | 55 | $("#" + result.errors[key]['field'] + ".error").html(result.errors[key]['content']);
|
---|
| 56 |
|
---|
[580] | 57 | }
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
| 60 | });
|
---|
| 61 | });
|
---|
[661] | 62 |
|
---|
[490] | 63 | function showModal() {
|
---|
| 64 | console.log('Show modal!');
|
---|
[659] | 65 | $('#alert-services-package').modal('show');
|
---|
[744] | 66 | //$('#alert-services-package-bk').modal('show');
|
---|
[490] | 67 | }
|
---|
| 68 |
|
---|
| 69 | $('#services-reg').click(function () {
|
---|
[654] | 70 | $('#alert-services').modal('hide');
|
---|
| 71 | window.location = url + "frontend/user/profile#services-register";
|
---|
[490] | 72 | });
|
---|
[555] | 73 |
|
---|
| 74 | $('#save-package').click(function () {
|
---|
[654] | 75 | DoSaveLecture();
|
---|
[555] | 76 | });
|
---|
| 77 |
|
---|
[490] | 78 | $('#services-sign').click(function () {
|
---|
| 79 | $('#alert-services-reg').modal('hide');
|
---|
| 80 | $('#alert-services-reg-2').modal('show');
|
---|
| 81 | })
|
---|
| 82 |
|
---|
| 83 | var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
|
---|
| 84 | var g_Flash = null;
|
---|
| 85 | var g_cbData = "";
|
---|
| 86 |
|
---|
| 87 | function InitViolet() {
|
---|
| 88 | g_Flash = document.getElementById('LectorEditorOnline');
|
---|
| 89 | //g_Flash = $('#LectorEditorOnline');
|
---|
| 90 | //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
|
---|
| 91 | }
|
---|
| 92 | ;
|
---|
| 93 |
|
---|
| 94 | function GetClipboardItem() {
|
---|
| 95 | var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
|
---|
| 96 | g_Flash.SetVariable("clipboardData", cbData);
|
---|
| 97 | g_Flash.SetVariable("command", "Get Text");
|
---|
| 98 | }
|
---|
| 99 | ;
|
---|
| 100 |
|
---|
| 101 | function SetClipboardItem(args) {
|
---|
| 102 | if (window.clipboardData)
|
---|
| 103 | window.clipboardData.setData('Text', args);
|
---|
| 104 | else
|
---|
| 105 | g_cbData = args;
|
---|
| 106 | g_Flash.SetVariable("command", "Set OK");
|
---|
| 107 | }
|
---|
| 108 | ;
|
---|
| 109 |
|
---|
| 110 | function SetWindowTitle(fileName) {
|
---|
| 111 | if (fileName == "")
|
---|
| 112 | document.title = "Violet Online";
|
---|
| 113 | else {
|
---|
| 114 | var docName = fileName.substring(0, fileName.length - 4);
|
---|
| 115 | document.title = "Violet Online - " + docName;
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 | ;
|
---|
| 119 |
|
---|
| 120 | function SetWindowState() {
|
---|
| 121 | var full = (g_Flash.width == "100%");
|
---|
| 122 | g_Flash.width = full ? "800" : "100%";
|
---|
| 123 | g_Flash.height = full ? "580" : "100%";
|
---|
| 124 | }
|
---|
| 125 | ;
|
---|
| 126 |
|
---|
[654] | 127 | function DoSaveLecture() {
|
---|
| 128 | g_Flash.SetVariable("command", "Press Save");
|
---|
[555] | 129 | }
|
---|
| 130 |
|
---|
[654] | 131 | function DoOpenLecture(filename) {
|
---|
| 132 | g_Flash.SetVariable("openedFileName", filename);
|
---|
| 133 | g_Flash.SetVariable("command", "Open File");
|
---|
[650] | 134 | }
|
---|
| 135 |
|
---|
[716] | 136 | function DoCloseLecture () {
|
---|
[718] | 137 | g_Flash.SetVariable("command", "Quit App");
|
---|
[716] | 138 | }
|
---|
| 139 |
|
---|
[718] | 140 | function getLectureState () {
|
---|
| 141 | var state = g_Flash.GetVariable("dataChanged");
|
---|
| 142 | return state == 'true' ? true: (state == 'false' ? false:false);
|
---|
| 143 | }
|
---|
| 144 |
|
---|
[490] | 145 | // Handle all the FSCommand messages in a Flash movie.
|
---|
| 146 | function LectorEditorOnline_DoFSCommand(command, args) {
|
---|
| 147 | switch (command) {
|
---|
| 148 | case "Set Title":
|
---|
| 149 | SetWindowTitle(args);
|
---|
| 150 | break;
|
---|
| 151 | case "Get Clipboard":
|
---|
| 152 | GetClipboardItem();
|
---|
| 153 | break;
|
---|
| 154 | case "Set Clipboard":
|
---|
| 155 | SetClipboardItem(args);
|
---|
| 156 | break;
|
---|
| 157 | case "Set State":
|
---|
[631] | 158 | //SetWindowState();
|
---|
[490] | 159 | break;
|
---|
| 160 | case "Quit":
|
---|
| 161 | window.open('', '_self').close();
|
---|
| 162 | break;
|
---|
| 163 | case "trace":
|
---|
| 164 | alert(args);
|
---|
| 165 | break;
|
---|
| 166 | case "Check License":
|
---|
| 167 | showModal();
|
---|
| 168 | break;
|
---|
| 169 | }
|
---|
| 170 | }
|
---|
| 171 | ;
|
---|
| 172 |
|
---|
| 173 | // Hook for Internet Explorer.
|
---|
| 174 | if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
|
---|
| 175 | document.write('<script language=\"VBScript\"\>\n');
|
---|
| 176 | document.write('On Error Resume Next\n');
|
---|
| 177 | document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
|
---|
| 178 | document.write(' Call LectorEditorOnline_DoFSCommand(command, args)\n');
|
---|
| 179 | document.write('End Sub\n');
|
---|
| 180 | document.write('</script\>\n');
|
---|
| 181 | }
|
---|
| 182 | ;
|
---|
| 183 |
|
---|
[650] | 184 |
|
---|
[490] | 185 | $(document).ready(function () {
|
---|
[654] | 186 | InitViolet();
|
---|
[650] | 187 | //$('#open-lecture').click(function(e){DoOpenLecture('http://sbgapi.violet.vn/space/file/id/7');});
|
---|
[716] | 188 | var inFormOrLink = false;
|
---|
[654] | 189 |
|
---|
[718] | 190 | $(window).on('beforeunload', function() {
|
---|
| 191 | var e = $.Event('webapp:page:closing');
|
---|
| 192 | $(window).trigger(e); // let other modules determine whether to prevent closing
|
---|
| 193 | if(e.isDefaultPrevented()) {
|
---|
| 194 | return e.message;
|
---|
| 195 | }
|
---|
| 196 | });
|
---|
| 197 |
|
---|
| 198 | $(window).on('webapp:page:closing', function(e) {
|
---|
| 199 | if(getLectureState()) {
|
---|
| 200 | e.preventDefault();
|
---|
| 201 | 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?';
|
---|
| 202 | }
|
---|
| 203 | });
|
---|
| 204 |
|
---|
[838] | 205 | });
|
---|
[906] | 206 | $(document).ready(function(){
|
---|
| 207 | if ($("#form-field-province").val() !== 'undefined'){
|
---|
| 208 | provinceId = $("#form-field-province").val();
|
---|
| 209 | $.ajax({
|
---|
| 210 | url: 'user/getDistrict/' + provinceId,
|
---|
| 211 | type: 'POST',
|
---|
| 212 | success: function (data, textStatus, jqXHR)
|
---|
| 213 | {
|
---|
| 214 | result = jQuery.parseJSON(data);
|
---|
| 215 | content = "<option></option>";
|
---|
| 216 | if (result != null){
|
---|
| 217 | for (var i in result){
|
---|
| 218 | content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>'
|
---|
| 219 | }
|
---|
| 220 |
|
---|
[838] | 221 | }
|
---|
| 222 | $("#form-field-district").html(content);
|
---|
| 223 | }
|
---|
[906] | 224 | });
|
---|
| 225 | }
|
---|
[838] | 226 |
|
---|
[906] | 227 | $("#form-field-province").change(function(){
|
---|
| 228 | provinceId = this.value;
|
---|
| 229 | $.ajax({
|
---|
| 230 | url: 'user/getDistrict/' + provinceId,
|
---|
| 231 | type: 'POST',
|
---|
| 232 | success: function (data, textStatus, jqXHR)
|
---|
| 233 | {
|
---|
| 234 | console.log(data);
|
---|
| 235 | result = jQuery.parseJSON(data);
|
---|
| 236 | content = "<option></option>";
|
---|
| 237 | if (result != null){
|
---|
| 238 | for (var i in result){
|
---|
| 239 | content = content + '<option value="' + result[i].district_id + '">' + result[i].district_name + '</option>'
|
---|
| 240 | }
|
---|
| 241 |
|
---|
[838] | 242 | }
|
---|
| 243 | $("#form-field-district").html(content);
|
---|
| 244 | }
|
---|
[906] | 245 | });
|
---|
| 246 | });
|
---|
| 247 | });
|
---|