[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 | }
|
---|
| 7 | }
|
---|
[717] | 8 | //if (first_visit == '1') {
|
---|
[661] | 9 |
|
---|
[717] | 10 | if (p_period == -1)
|
---|
| 11 | {
|
---|
| 12 | $('#alert-trial-services').modal('show');
|
---|
| 13 | $('#alert-trial-services').on('hidden.bs.modal', function () {
|
---|
| 14 | if (update_user_info == "1")
|
---|
| 15 | {
|
---|
| 16 | $('#update_user_info').modal({backdrop: 'static',keyboard: false,});
|
---|
| 17 | }
|
---|
| 18 | });
|
---|
[654] | 19 | }
|
---|
[717] | 20 | else
|
---|
| 21 | {
|
---|
| 22 | if (update_user_info == "1")
|
---|
| 23 | {
|
---|
| 24 | $('#update_user_info').modal({backdrop: 'static'});
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
[490] | 27 |
|
---|
[717] | 28 | //}
|
---|
[654] | 29 |
|
---|
[717] | 30 |
|
---|
[580] | 31 | $("#update_user_info.btn").click(function () {
|
---|
| 32 | $(".error").html("");
|
---|
| 33 | $.ajax({
|
---|
| 34 | url: 'user/update_info/',
|
---|
| 35 | type: 'POST',
|
---|
| 36 | data: $("#update_user_info.form").serialize(),
|
---|
| 37 | success: function (data, textStatus, jqXHR)
|
---|
| 38 | {
|
---|
| 39 | result = jQuery.parseJSON(data);
|
---|
| 40 | if (result.success == "1")
|
---|
| 41 | {
|
---|
[654] | 42 | $('#update_user_info').modal('hide');
|
---|
[661] | 43 |
|
---|
[580] | 44 | }
|
---|
| 45 | else
|
---|
| 46 | {
|
---|
| 47 | for (var key in result.errors)
|
---|
| 48 | {
|
---|
[654] | 49 | $("#" + result.errors[key]['field'] + ".error").html(result.errors[key]['content']);
|
---|
| 50 |
|
---|
[580] | 51 | }
|
---|
| 52 | }
|
---|
| 53 | }
|
---|
| 54 | });
|
---|
| 55 | });
|
---|
[661] | 56 |
|
---|
[490] | 57 | function showModal() {
|
---|
| 58 | console.log('Show modal!');
|
---|
[659] | 59 | $('#alert-services-package').modal('show');
|
---|
[744] | 60 | //$('#alert-services-package-bk').modal('show');
|
---|
[490] | 61 | }
|
---|
| 62 |
|
---|
| 63 | $('#services-reg').click(function () {
|
---|
[654] | 64 | $('#alert-services').modal('hide');
|
---|
| 65 | window.location = url + "frontend/user/profile#services-register";
|
---|
[490] | 66 | });
|
---|
[555] | 67 |
|
---|
| 68 | $('#save-package').click(function () {
|
---|
[654] | 69 | DoSaveLecture();
|
---|
[555] | 70 | });
|
---|
| 71 |
|
---|
[490] | 72 | $('#services-sign').click(function () {
|
---|
| 73 | $('#alert-services-reg').modal('hide');
|
---|
| 74 | $('#alert-services-reg-2').modal('show');
|
---|
| 75 | })
|
---|
| 76 |
|
---|
| 77 | var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
|
---|
| 78 | var g_Flash = null;
|
---|
| 79 | var g_cbData = "";
|
---|
| 80 |
|
---|
| 81 | function InitViolet() {
|
---|
| 82 | g_Flash = document.getElementById('LectorEditorOnline');
|
---|
| 83 | //g_Flash = $('#LectorEditorOnline');
|
---|
| 84 | //g_Flash = isInternetExplorer ? LectorEditorOnline : document.LectorEditorOnline;
|
---|
| 85 | }
|
---|
| 86 | ;
|
---|
| 87 |
|
---|
| 88 | function GetClipboardItem() {
|
---|
| 89 | var cbData = window.clipboardData ? window.clipboardData.getData('Text') : g_cbData;
|
---|
| 90 | g_Flash.SetVariable("clipboardData", cbData);
|
---|
| 91 | g_Flash.SetVariable("command", "Get Text");
|
---|
| 92 | }
|
---|
| 93 | ;
|
---|
| 94 |
|
---|
| 95 | function SetClipboardItem(args) {
|
---|
| 96 | if (window.clipboardData)
|
---|
| 97 | window.clipboardData.setData('Text', args);
|
---|
| 98 | else
|
---|
| 99 | g_cbData = args;
|
---|
| 100 | g_Flash.SetVariable("command", "Set OK");
|
---|
| 101 | }
|
---|
| 102 | ;
|
---|
| 103 |
|
---|
| 104 | function SetWindowTitle(fileName) {
|
---|
| 105 | if (fileName == "")
|
---|
| 106 | document.title = "Violet Online";
|
---|
| 107 | else {
|
---|
| 108 | var docName = fileName.substring(0, fileName.length - 4);
|
---|
| 109 | document.title = "Violet Online - " + docName;
|
---|
| 110 | }
|
---|
| 111 | }
|
---|
| 112 | ;
|
---|
| 113 |
|
---|
| 114 | function SetWindowState() {
|
---|
| 115 | var full = (g_Flash.width == "100%");
|
---|
| 116 | g_Flash.width = full ? "800" : "100%";
|
---|
| 117 | g_Flash.height = full ? "580" : "100%";
|
---|
| 118 | }
|
---|
| 119 | ;
|
---|
| 120 |
|
---|
[654] | 121 | function DoSaveLecture() {
|
---|
| 122 | g_Flash.SetVariable("command", "Press Save");
|
---|
[555] | 123 | }
|
---|
| 124 |
|
---|
[654] | 125 | function DoOpenLecture(filename) {
|
---|
| 126 | g_Flash.SetVariable("openedFileName", filename);
|
---|
| 127 | g_Flash.SetVariable("command", "Open File");
|
---|
[650] | 128 | }
|
---|
| 129 |
|
---|
[716] | 130 | function DoCloseLecture () {
|
---|
[718] | 131 | g_Flash.SetVariable("command", "Quit App");
|
---|
[716] | 132 | }
|
---|
| 133 |
|
---|
[718] | 134 | function getLectureState () {
|
---|
| 135 | var state = g_Flash.GetVariable("dataChanged");
|
---|
| 136 | return state == 'true' ? true: (state == 'false' ? false:false);
|
---|
| 137 | }
|
---|
| 138 |
|
---|
[490] | 139 | // Handle all the FSCommand messages in a Flash movie.
|
---|
| 140 | function LectorEditorOnline_DoFSCommand(command, args) {
|
---|
| 141 | switch (command) {
|
---|
| 142 | case "Set Title":
|
---|
| 143 | SetWindowTitle(args);
|
---|
| 144 | break;
|
---|
| 145 | case "Get Clipboard":
|
---|
| 146 | GetClipboardItem();
|
---|
| 147 | break;
|
---|
| 148 | case "Set Clipboard":
|
---|
| 149 | SetClipboardItem(args);
|
---|
| 150 | break;
|
---|
| 151 | case "Set State":
|
---|
[631] | 152 | //SetWindowState();
|
---|
[490] | 153 | break;
|
---|
| 154 | case "Quit":
|
---|
| 155 | window.open('', '_self').close();
|
---|
| 156 | break;
|
---|
| 157 | case "trace":
|
---|
| 158 | alert(args);
|
---|
| 159 | break;
|
---|
| 160 | case "Check License":
|
---|
| 161 | showModal();
|
---|
| 162 | break;
|
---|
| 163 | }
|
---|
| 164 | }
|
---|
| 165 | ;
|
---|
| 166 |
|
---|
| 167 | // Hook for Internet Explorer.
|
---|
| 168 | if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
|
---|
| 169 | document.write('<script language=\"VBScript\"\>\n');
|
---|
| 170 | document.write('On Error Resume Next\n');
|
---|
| 171 | document.write('Sub LectorEditorOnline_FSCommand(ByVal command, ByVal args)\n');
|
---|
| 172 | document.write(' Call LectorEditorOnline_DoFSCommand(command, args)\n');
|
---|
| 173 | document.write('End Sub\n');
|
---|
| 174 | document.write('</script\>\n');
|
---|
| 175 | }
|
---|
| 176 | ;
|
---|
| 177 |
|
---|
[650] | 178 |
|
---|
[490] | 179 | $(document).ready(function () {
|
---|
[654] | 180 | InitViolet();
|
---|
[650] | 181 | //$('#open-lecture').click(function(e){DoOpenLecture('http://sbgapi.violet.vn/space/file/id/7');});
|
---|
[716] | 182 | var inFormOrLink = false;
|
---|
[654] | 183 |
|
---|
[718] | 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 |
|
---|
[490] | 199 | }) |
---|