Built files from Bizgaze WebServer
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529
  1. var Unibase;
  2. (function (Unibase) {
  3. let Apps;
  4. (function (Apps) {
  5. let Collaboration;
  6. (function (Collaboration) {
  7. let Components;
  8. (function (Components) {
  9. let DocEditor;
  10. (function (DocEditor) {
  11. class Base {
  12. init(response, res, callback) {
  13. this.result = response.result;
  14. this.documentGroup = this.result.DocumentGroup;
  15. this.filedata = res.result;
  16. this.FileName = response.result.FileTitle;
  17. this.FileId = response.result.FileId;
  18. this.sourceFileId = response.result.SourceFileId;
  19. this.Priority = response.result.Priority;
  20. this.lastEditedTime = response.result.LastUpdateTime;
  21. this.timePeriod = response.result.TimePeriod;
  22. this.username = response.result.LastUpdateByName;
  23. this.Priority = response.result.Priority;
  24. this.newUpload = response.result.NewUpload;
  25. this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  26. this.unibaseusername = this.identity.name.trim();
  27. this.NewDocument = response.result.NewDocument;
  28. this.render();
  29. if (callback != null) {
  30. callback();
  31. }
  32. }
  33. unwireBootStrapKeyEvent() {
  34. let popup = document.body.getElementsByClassName('_bizgaze_popup_container');
  35. let events = $._data($(popup)[0], "events");
  36. if (events && events.keydown) {
  37. $(popup).off('keydown.dismiss.bs.modal', events.keydown[0].handler);
  38. }
  39. }
  40. render() {
  41. this.renderPopup();
  42. this.updateProps();
  43. this.renderMenuBar();
  44. this.refreshHeight();
  45. this.wordDocumentRender();
  46. this.ribbon.init(this.wordDocumentObj, this.result);
  47. this.priorityRender();
  48. this.initSetInterval();
  49. this.eventListeners();
  50. this.unwireBootStrapKeyEvent();
  51. if (!this.NewDocument) {
  52. this.connectHub(this.FileId, this.documentGroup);
  53. }
  54. }
  55. connectHub(fileId, documentgroup) {
  56. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFiles(["apps/collaboration/components/docconnector.js", "apps/collaboration/components/unidochub.js"], function () {
  57. Unibase.Apps.Collaboration.Components.DocConnector.Instance().init(fileId, documentgroup);
  58. });
  59. }
  60. priorityRender() {
  61. if (this.Priority) {
  62. $(".biz_doc_star_icon_" + this.FileId).removeClass("fa-star-o");
  63. $(".biz_doc_star_icon_" + this.FileId).addClass("fa-star");
  64. $(".biz_doc_star_icon_" + this.FileId).removeClass("text-light");
  65. $(".biz_doc_star_icon_" + this.FileId).css("color", "orange");
  66. }
  67. }
  68. eventListeners() {
  69. try {
  70. document.body.addEventListener("keydown", this.keyDown.bind(this));
  71. document.body.addEventListener("mousedown", this.mouseDown.bind(this));
  72. document.getElementsByClassName("biz-doc-starred")[0].addEventListener('click', (event) => {
  73. });
  74. document.getElementsByClassName("biz-doc-filename")[0].addEventListener('focusout', (event) => {
  75. this.fileNameChange();
  76. });
  77. (document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("keydown", (ele) => {
  78. if (ele.keyCode == 122) {
  79. event.preventDefault();
  80. this.openFullscreen(this.container);
  81. }
  82. });
  83. (document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("keyup", (ele) => {
  84. this.editorkeyUp(ele);
  85. });
  86. (document.getElementsByClassName('e-de-text-target')[0].contentWindow.document).addEventListener("mousedown", (ele) => {
  87. this.editorMouseDown(ele);
  88. });
  89. this.container.addEventListener("fullscreenchange", () => {
  90. this.fullscreenHandler(this.container);
  91. });
  92. this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("beforeOpen", this.cmenuBfOpen.bind(this));
  93. this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("beforeItemRender", this.cmenuBfItemRndr.bind(this));
  94. this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.addEventListener("select", this.cmenuSelect.bind(this));
  95. }
  96. catch (e) {
  97. }
  98. }
  99. keyDown(ele) {
  100. if (ele.keyCode == 122) {
  101. event.preventDefault();
  102. setTimeout(() => { this.openFullscreen(this.container); }, 0);
  103. }
  104. if (ele.target.classList.contains("biz-doc-fileshare-btn")) {
  105. Unibase.Platform.Helpers.FileCacheHelper.Instance().loadJsFile('apps/collaboration/components/unicloud.js', () => {
  106. Unibase.Apps.Collaboration.Components.UniCloud.Instance().share(this.sourceFileId, "File", 0);
  107. });
  108. }
  109. }
  110. editorkeyUp(e) {
  111. this.updateUndoRedo();
  112. }
  113. updateUndoRedo() {
  114. let undoOverley = document.getElementById("DocumentViewer_toolbar_undo").parentElement.classList.contains("e-overlay");
  115. let redoOverley = document.getElementById("DocumentViewer_toolbar_redo").parentElement.classList.contains("e-overlay");
  116. let undobtn = document.getElementsByClassName("biz-doc-undo")[0];
  117. let redobtn = document.getElementsByClassName("biz-doc-redo")[0];
  118. this.enableOrDisableIcon(undoOverley, undobtn);
  119. this.enableOrDisableIcon(redoOverley, redobtn);
  120. }
  121. editorMouseDown(e) {
  122. let undo = e.target.closest(".biz-doc-undo");
  123. let redo = e.target.closest(".biz-doc-redo");
  124. (undo) && document.getElementById("DocumentViewer_toolbar_undo").click();
  125. (redo) && document.getElementById("DocumentViewer_toolbar_redo").click();
  126. this.updateUndoRedo();
  127. }
  128. mouseDown(e) {
  129. if (e.target.id == "biz_doc_undobtn" || e.target.classList.contains("biz-doc-undo-icon")) {
  130. document.getElementById("DocumentViewer_toolbar_undo").click();
  131. }
  132. else if (e.target.id == "biz_doc_redobtn" || e.target.classList.contains("biz-doc-redo-icon")) {
  133. document.getElementById("DocumentViewer_toolbar_redo").click();
  134. }
  135. this.updateUndoRedo();
  136. }
  137. enableOrDisableIcon(undoOverley, btn) {
  138. if (undoOverley) {
  139. if (!btn.classList.contains("e-disabled"))
  140. btn.classList.add("e-disabled");
  141. }
  142. else {
  143. if (btn.classList.contains("e-disabled"))
  144. btn.classList.remove("e-disabled");
  145. }
  146. }
  147. openFullscreen(elem) {
  148. if (elem.requestFullscreen) {
  149. elem.requestFullscreen();
  150. }
  151. else if (elem.webkitRequestFullscreen) {
  152. elem.webkitRequestFullscreen();
  153. }
  154. else if (elem.msRequestFullscreen) {
  155. elem.msRequestFullscreen();
  156. }
  157. }
  158. fullscreenHandler(container) {
  159. setTimeout(() => {
  160. if (document.fullscreenElement) {
  161. this.fullscreenChange(container);
  162. }
  163. else {
  164. this.fullscreenChange(container);
  165. }
  166. }, 100);
  167. }
  168. fullscreenChange(ele) {
  169. let ribbonHeight = this.ribbonElem.offsetHeight;
  170. let toolbarHeight = document.getElementsByClassName("biz-doc-bottomtoolbar")[0].offsetHeight;
  171. let footerHeight = this.element.parentElement.nextElementSibling.offsetHeight;
  172. var totalHeight = window.innerHeight - ribbonHeight - toolbarHeight - footerHeight;
  173. this.element.parentElement.style.height = totalHeight + 'px';
  174. this.wordDocumentObj.height = totalHeight + 'px';
  175. }
  176. wordDocumentRender() {
  177. var instance = this;
  178. this.wordDocumentObj = new ej.documenteditor.DocumentEditorContainer({
  179. height: "100%",
  180. enableEditor: true,
  181. enableEditorHistory: true,
  182. enableSelection: true,
  183. enableSearch: true,
  184. created: () => {
  185. setTimeout(() => {
  186. let updateTextPositionFn = this.wordDocumentObj.documentEditor.selectionModule.updateTextPosition.bind(this.wordDocumentObj.documentEditor.selectionModule);
  187. this.wordDocumentObj.documentEditor.selectionModule.updateTextPosition = (a1, a2) => {
  188. updateTextPositionFn(a1, a2);
  189. let result = this.wordDocumentObj.documentEditor.selectionModule.updateTextPositionIn(a1, undefined, 0, a2, false);
  190. this.formatInfo = result;
  191. return result;
  192. };
  193. }, 800);
  194. },
  195. });
  196. setInterval(() => {
  197. var instance = this;
  198. if (instance.contentChanged) {
  199. this.onlineStatus = (window.navigator.onLine ? 'on' : 'off') + 'line';
  200. window.addEventListener('online', () => document.getElementsByClassName('biz-ss-cloudsave')[0].style.display = 'inline-block');
  201. window.addEventListener('online', () => document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "none");
  202. window.addEventListener('offline', () => document.getElementsByClassName('biz-ss-cloudsave')[0].style.display = 'none');
  203. window.addEventListener('offline', () => document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "inline-block");
  204. if (this.onlineStatus == "online") {
  205. Unibase.Apps.Collaboration.Components.Common.Download.Instance().saveDocumentFile(instance.FileId, instance.documentGroup, instance.documentContainer).then(function () {
  206. });
  207. }
  208. instance.contentChanged = false;
  209. }
  210. }, 3000);
  211. this.wordDocumentObj.appendTo('.DocumentViewer');
  212. (this.filedata) && this.wordDocumentObj.documentEditor.open(this.filedata);
  213. this.wordDocumentObj.documentEditor.enableSfdtExport = true;
  214. this.wordDocumentObj.documentEditor.enableWordExport = true;
  215. this.wordDocumentObj.documentEditor.enableTextExport = true;
  216. this.wordDocumentObj.documentEditor.enableSelection = true;
  217. this.wordDocumentObj.documentEditor.enableEditor = true;
  218. this.wordDocumentObj.documentEditor.isReadOnly = false;
  219. this.wordDocumentObj.documentEditor.enableLocalPaste = false;
  220. var xyz = $("#DocumentViewer_editor")[0];
  221. this.documentContainer = xyz.ej2_instances[0];
  222. }
  223. cmenuBfOpen(args) {
  224. let cmenuModule = this.wordDocumentObj.documentEditor.contextMenuModule;
  225. let items = this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.items;
  226. if (items.find(x => x.id == this.wordDocumentObj.element.id + "_cmenu_delete") == undefined) {
  227. items.splice(5, 0, {
  228. text: "Delete", iconCss: "e-icons MT_Delete", id: this.wordDocumentObj.element.id + "_cmenu_delete"
  229. });
  230. items.push({ text: "Clear Formatting", iconCss: "e-icons MT_ClearFormat", id: this.wordDocumentObj.element.id + "_cmenu_clear_formatting" });
  231. }
  232. this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.items = items;
  233. this.wordDocumentObj.documentEditor.contextMenuModule.contextMenuInstance.dataBind();
  234. cmenuModule.showHideElements(cmenuModule.documentHelper.selection);
  235. }
  236. cmenuBfItemRndr(e) {
  237. if (e.item.id == this.wordDocumentObj.element.id + "_cmenu_delete") {
  238. let selectedText = this.wordDocumentObj.documentEditor.editor.selection.text;
  239. if (selectedText.length == 0) {
  240. e.element.classList.add("e-disabled");
  241. }
  242. }
  243. }
  244. cmenuSelect(args) {
  245. if (args.item.id == this.wordDocumentObj.element.id + "_cmenu_delete") {
  246. this.wordDocumentObj.documentEditor.editor.delete();
  247. }
  248. else if (args.item.id == this.wordDocumentObj.element.id + "_cmenu_clear_formatting") {
  249. this.wordDocumentObj.documentEditor.editor.clearFormatting();
  250. }
  251. }
  252. updateProps() {
  253. this.element = document.getElementById('DocumentViewer');
  254. this.fileName = this.result.FileName + "." + this.result.FileType;
  255. this.ribbon = Unibase.Apps.Collaboration.Components.DocEditor.Ribbon.Instance();
  256. this.util = Unibase.Apps.Collaboration.Components.Common.Util.Instance();
  257. }
  258. refreshHeight() {
  259. var toolbarHeight = this.element.parentElement.previousElementSibling.offsetHeight;
  260. var rootHeight = this.element.parentElement.parentElement.offsetHeight;
  261. var rbnHeight = document.body.getElementsByClassName('biz-doc-ribbon')[0].offsetHeight;
  262. this.element.parentElement.style.height = (rootHeight - rbnHeight - toolbarHeight) + 'px';
  263. }
  264. initSetInterval() {
  265. if (this.timePeriod === "Minutes" || this.timePeriod === "Minute") {
  266. this.intr = setInterval(() => {
  267. this.lastEditedTime = this.lastEditedTime + 1;
  268. this.username = this.username;
  269. this.timePeriod = this.timePeriod;
  270. if (this.lastEditedTime != 1) {
  271. if (this.lastEditedTime >= 59 && this.timePeriod === "Minutes") {
  272. Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
  273. this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  274. this.unibaseusername = this.identity.name.trim();
  275. this.lastEditedTime = response.result.Lastedittime;
  276. this.username = response.result.LastUpdatedByName;
  277. this.timePeriod = response.result.TimePeriod;
  278. if (this.unibaseusername === this.username) {
  279. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  280. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
  281. }
  282. else {
  283. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  284. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
  285. }
  286. });
  287. }
  288. else {
  289. this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  290. this.unibaseusername = this.identity.name.trim();
  291. if (this.unibaseusername === this.username) {
  292. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  293. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
  294. }
  295. else {
  296. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  297. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
  298. }
  299. }
  300. }
  301. }, 60000);
  302. }
  303. else if (this.timePeriod === "Hour" || this.timePeriod === "Hours") {
  304. this.intrhour = setInterval(() => {
  305. this.lastEditedTime = this.lastEditedTime + 1;
  306. this.username = this.username;
  307. this.timePeriod = this.timePeriod;
  308. if (this.lastEditedTime >= 23 && this.timePeriod === "Hours") {
  309. Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
  310. this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  311. this.unibaseusername = this.identity.name.trim();
  312. this.lastEditedTime = response.result.Lastedittime;
  313. this.username = response.result.LastUpdatedByName;
  314. this.timePeriod = response.result.TimePeriod;
  315. if (this.unibaseusername === this.username) {
  316. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  317. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
  318. }
  319. else {
  320. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  321. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
  322. }
  323. });
  324. }
  325. else {
  326. this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  327. this.unibaseusername = this.identity.name.trim();
  328. if (this.unibaseusername === this.username) {
  329. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  330. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
  331. }
  332. else {
  333. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  334. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago by " + this.username;
  335. }
  336. }
  337. }, 3600000);
  338. }
  339. }
  340. fileNameChange() {
  341. var tempfilename = $(".biz-doc-filename").val();
  342. var data = {
  343. FileTitle: tempfilename,
  344. FileId: this.FileId
  345. };
  346. Unibase.Apps.Collaboration.DocumentManager.Instance().renameFileTitle(data);
  347. }
  348. activeUsers(FileUsers) {
  349. var connecteduser = [];
  350. for (var v in FileUsers) {
  351. let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  352. let unibaseId = identity.unibaseId;
  353. if (unibaseId != FileUsers[v].unibaseId) {
  354. connecteduser.push(FileUsers[v].firstName);
  355. }
  356. }
  357. this.connecteduserfirstName = connecteduser;
  358. console.log(this.connecteduserfirstName);
  359. this.showActiveUsers(FileUsers);
  360. return this.connecteduserfirstName;
  361. }
  362. showActiveUsers(FileUsers) {
  363. var onlineusername = document.getElementsByClassName("biz-doc-onlineusersintials")[0];
  364. let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  365. let unibaseId = identity.unibaseId;
  366. var connectedUsersFirstChar = [];
  367. for (var user in this.connecteduserfirstName) {
  368. connectedUsersFirstChar.push(this.connecteduserfirstName[user].trim().charAt(0));
  369. }
  370. var element = document.getElementById('biz-doc-connected_users_container');
  371. if (typeof (element) != 'undefined' && element != null) {
  372. element.remove();
  373. }
  374. let html = "";
  375. let html1 = `<div id="biz-doc-connected_users_container"></div>`;
  376. $(".biz-doc-onlineusersintials").append(html1);
  377. let usersHtml = '', randomColor;
  378. let colorPalette = ['#6640b2', '#3a55b1', '#0092ee', '#00acf0', '#1ebccd', '#009b84', '#22af47', '#88c241', '#d0d962', '#fde335', '#ffbf36', '#ff9528', '#ff6028', '#7a5449', '#c1993f', '#9e9e9e', '#5e7d8a', '#324148', '#f5f5f6', '#f95851', '#ef3975', '#b642b5', '#7a59bc', '#536bbb', '#21a0f0', '#21b7f2'];
  379. for (let i = 0; i < this.connecteduserfirstName.length; i++) {
  380. randomColor = colorPalette[Math.floor(Math.random() * colorPalette.length)];
  381. html = `<div id="biz-doc-connecteduser-` + unibaseId + `" class="d-flex flex-row border rounded-circle w-35p h-35p biz-doc-users-` + i + `" style="margin-right:-8px; background-color:` + randomColor + `">
  382. <div id="biz-doc-connecteduser_` + unibaseId + `" class="biz-doc-connectedusersfirstletter m-auto" data-toggle="popover" data-placement="top" title = "` + this.connecteduserfirstName[i] + `">` + connectedUsersFirstChar[i] + `</div></div>`;
  383. if (i <= 5) {
  384. $("#biz-doc-connected_users_container").append(html);
  385. }
  386. usersHtml += '<a class="dropdown-item d-flex flex-row align-items-center p-1 my-1" href="javascript:void(0)"><div class="biz-doc-connectedusersfirstletter border mr-2 px-2 rounded-circle text-white" style="background-color:#' + randomColor + '" title = "' + this.connecteduserfirstName[i] + '">' + connectedUsersFirstChar[i] + '</div><span class="font-13 font-weight-500">' + FileUsers[i].firstName + '</span></a>';
  387. if (i > 5) {
  388. $("#biz-doc-connected_users_container").children().last().remove();
  389. $("#biz-doc-connected_users_container").append('<div class="users-dropdown"><a href="javascript:void(0);" class="d-flex flex-row border rounded-circle w-35p h-35p text-dark biz-doc-users-' + i + '" role="button" id="biz-doc-connecteduser-' + unibaseId + '" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style=" background-color:lightgray;margin-right:-8px"><span class="m-auto font-14 font-weight-500"><span class="font-12 text-muted"><i class="la la-plus"></i></span>' + [i - 4] + '</span></a><div class="dropdown-menu z-index-10 position-absolute bg-white h-275p scroll-bar" aria-labelledby="biz-doc-connecteduser-' + unibaseId + '"></div>');
  390. $('.users-dropdown .dropdown-menu').append(usersHtml);
  391. }
  392. }
  393. }
  394. renderPopup() {
  395. Unibase.Apps.Collaboration.Components.Documents.Instance().loadForm(0, this.FileId, 0, null, this.documentGroup);
  396. }
  397. renderMenuBar() {
  398. let containers = document.body.getElementsByClassName('_bizgaze_popup_container');
  399. this.container = containers[containers.length - 1];
  400. this.container.insertBefore(this.util.createElement("div", 'class', 'biz-doc-ribbon'), document.body.getElementsByClassName('_bizgaze_popup_container')[0].firstElementChild);
  401. this.util.appendChildren('biz-doc-ribbon', 0, this.util.createElement("div", 'class', 'biz-doc-docxlogo'), this.util.createElement("div", 'class', 'biz-doc-tooolbar'), this.util.createElement("div", 'class', 'biz-doc-userdetails'));
  402. this.util.appendChildren('biz-doc-docxlogo', 0, this.util.createElement("img", 'class', 'biz-doc-logo'));
  403. this.util.appendChildren('biz-doc-tooolbar', 0, this.util.createElement("div", 'class', 'biz-doc-fileinfo'), this.util.createElement("div", 'class', 'biz-doc-fileshare-wrapper'), this.util.createElement("div", 'class', 'biz-doc-onlineusers'), this.util.createElement("div", 'class', 'biz-doc-toolbarmenu'));
  404. this.util.appendChildren('biz-doc-fileinfo', 0, this.util.createElement("input", 'class', 'biz-doc-filename'), this.util.createElement('div', 'class', 'biz-doc-starred'), this.util.createElement('div', 'class', 'biz-ss-autosave'));
  405. this.util.appendChildren('biz-doc-starred', 0, this.util.createElement("span", 'id', 'biz-doc-star'), this.util.createElement("i", 'class', 'fa fa-star-o text-light font-7 biz_doc_star_icon_' + this.FileId));
  406. this.util.appendChildren('biz-ss-autosave', 0, this.util.createElement("img", 'class', 'biz-ss-saveicon biz-ss-cloudsave'), this.util.createElement("img", 'class', 'biz-ss-saveicon biz-ss-cloudoff'), this.util.createElement("div", 'class', 'biz-ss-cloudloading e-icons'), this.util.createElement('div', 'class', 'biz-ss-saving'));
  407. this.util.appendChildren('biz-doc-fileshare-wrapper', 0, this.util.createElement("div", 'class', 'biz-doc-fileshare'));
  408. this.util.appendChildren('biz-doc-onlineusers', 0, this.util.createElement("div", 'class', 'biz-doc-onlineusersintials d-flex flex-row text-white mx-35 pull-right'));
  409. this.util.appendChildren('biz-doc-fileshare', 0, this.util.createElement("button", 'class', 'biz-doc-fileshare-btn'));
  410. this.util.appendChildren('biz-doc-userdetails', 0, this.util.createElement("div", 'class', 'biz-doc-userinitial'));
  411. this.util.appendChildren('biz-doc-toolbarmenu', 0, this.util.createElement("ul", 'id', 'menu'), this.util.createElement("input", 'class', 'biz-doc-lastedited'));
  412. document.getElementsByClassName("biz-doc-ribbon")[0].after(this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar e-toolbar'));
  413. this.util.appendChildren('biz-doc-bottomtoolbar', 0, this.util.createElement("div", 'class', 'biz-doc-toolbar-wrapper'));
  414. this.util.appendChildren('biz-doc-toolbar-wrapper', 0, this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-undoredo e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-text e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-paragraph e-toolbar-items'), this.util.createElement("div", 'class', 'biz-doc-bottomtoolbar-indent e-toolbar-items'));
  415. this.userInitial = document.getElementsByClassName("biz-doc-userinitial")[0];
  416. let identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  417. if (!identity.photoUrl) {
  418. this.userInitial.textContent += identity.name.trim().slice(0, 1);
  419. this.userInitial.classList.add('biz-doc-initial-text');
  420. }
  421. else {
  422. this.userInitial.classList.add('biz-doc-initial-img');
  423. this.userInitial.style.backgroundImage = "url(" + identity.photoUrl + ")";
  424. }
  425. document.getElementsByClassName("biz-doc-logo")[0].setAttribute('src', 'imgs/BizgazeDocsIcon.svg');
  426. document.getElementsByClassName("biz-ss-cloudsave")[0].setAttribute('src', 'imgs/cloud-computing.svg');
  427. document.getElementsByClassName("biz-ss-cloudoff")[0].setAttribute('src', 'imgs/cloud-off.svg');
  428. document.getElementsByClassName("biz-ss-cloudoff")[0].style.display = "none";
  429. let attributes = {
  430. 'value': this.FileName,
  431. 'type': 'text'
  432. };
  433. document.getElementsByClassName("biz-doc-fileshare-btn")[0].style.backgroundColor = "#049503";
  434. var shareBtn = new ej.buttons.Button({ cssClass: `e-primary`, content: `Share`, iconCss: 'biz-doc-fileshare-icon icon-doc-lockopen' });
  435. shareBtn.appendTo(".biz-doc-fileshare-btn");
  436. document.getElementsByClassName("biz-doc-userinitial")[0].setAttribute("title", identity.name.trim());
  437. let color = this.util.colorHash(identity.name.trim());
  438. document.getElementsByClassName("biz-doc-userinitial")[0].style.backgroundColor = color.hex;
  439. if (!this.newUpload) {
  440. debugger;
  441. if (this.lastEditedTime != 0) {
  442. if (this.unibaseusername === this.username) {
  443. let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
  444. this.util.addAttributes(htmlelementlastedited, {
  445. 'value': 'last edit was made ' + this.lastEditedTime + ' ' + this.timePeriod + ' ago',
  446. 'type': 'span'
  447. });
  448. }
  449. else {
  450. let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
  451. this.util.addAttributes(htmlelementlastedited, {
  452. 'value': 'last edit was made ' + this.lastEditedTime + ' ' + this.timePeriod + ' ago by ' + this.username,
  453. 'type': 'span'
  454. });
  455. }
  456. }
  457. else {
  458. if (this.unibaseusername === this.username) {
  459. let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
  460. this.util.addAttributes(htmlelementlastedited, {
  461. 'value': 'last edit was made seconds ago ',
  462. 'type': 'span'
  463. });
  464. }
  465. else {
  466. let htmlelementlastedited = document.getElementsByClassName('biz-doc-lastedited')[0];
  467. this.util.addAttributes(htmlelementlastedited, {
  468. 'value': 'last edit was made seconds ago by ' + this.username,
  469. 'type': 'span'
  470. });
  471. }
  472. }
  473. }
  474. let htmlelement = document.getElementsByClassName('biz-doc-filename')[0];
  475. this.util.addAttributes(htmlelement, attributes);
  476. let attributesforautosave = {
  477. 'type': 'text'
  478. };
  479. let htmlelementforautosave = document.getElementsByClassName('biz-ss-saving')[0];
  480. this.util.addAttributes(htmlelementforautosave, attributesforautosave);
  481. document.getElementsByClassName('biz-ss-saving')[0].style.display = 'none';
  482. document.getElementsByClassName('biz-doc-lastedited')[0].setAttribute('disabled', "");
  483. document.getElementsByClassName('biz-ss-saving')[0].innerText = 'Saving...';
  484. this.ribbonElem = document.body.getElementsByClassName('biz-doc-ribbon')[0];
  485. }
  486. editDetails() {
  487. if (this.FileId != 0) {
  488. Unibase.Apps.Collaboration.DocumentManager.Instance().lastEdit(this.FileId).then((response) => {
  489. this.identity = Unibase.Platform.Membership.Infos.Identity.getCurrentUser();
  490. this.unibaseusername = this.identity.name.trim();
  491. this.lastEditedTime = response.result.Lastedittime;
  492. this.username = response.result.LastUpdatedByName;
  493. this.timePeriod = response.result.TimePeriod;
  494. if (this.unibaseusername === this.username && this.lastEditedTime === 0) {
  495. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  496. element.value = "last edit was made seconds ago";
  497. }
  498. else if (this.unibaseusername === this.username && this.lastEditedTime !== 0) {
  499. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  500. element.value = "last edit was made " + this.lastEditedTime + " " + this.timePeriod + " ago";
  501. }
  502. else {
  503. let element = (document.getElementsByClassName('biz-doc-lastedited')[0]);
  504. element.value = "last edit was made seconds ago by " + this.username;
  505. }
  506. });
  507. }
  508. clearInterval(this.intr);
  509. clearInterval(this.intrhour);
  510. this.initSetInterval();
  511. }
  512. convertDocsToPdfDownload(FileId) {
  513. Unibase.Apps.Collaboration.DocumentManager.Instance().ConvertDocstoPdfDownload(FileId).then((response) => {
  514. Unibase.Themes.Compact.Components.Notification.Instance().Downloadfile(response.result);
  515. });
  516. }
  517. static Instance() {
  518. if (this.instance === undefined) {
  519. this.instance = new Base();
  520. }
  521. return this.instance;
  522. }
  523. }
  524. DocEditor.Base = Base;
  525. })(DocEditor = Components.DocEditor || (Components.DocEditor = {}));
  526. })(Components = Collaboration.Components || (Collaboration.Components = {}));
  527. })(Collaboration = Apps.Collaboration || (Apps.Collaboration = {}));
  528. })(Apps = Unibase.Apps || (Unibase.Apps = {}));
  529. })(Unibase || (Unibase = {}));