v26.6.0 updates
This commit is contained in:
49
web/api-common/SocialShare.js
Normal file
49
web/api-common/SocialShare.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/* eslint-disable no-restricted-globals */
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
const SocialShare = {
|
||||
facebook: (url) => {
|
||||
const w = 700;
|
||||
const h = 500;
|
||||
const left = (screen.width / 2) - (w / 2);
|
||||
const top = (screen.height / 2) - (h / 2);
|
||||
|
||||
url = `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(url)}`;
|
||||
|
||||
window.open(url, 'Share on Facebook', `width=${w},height=${h},left=${left},top=${top}`);
|
||||
return false;
|
||||
},
|
||||
|
||||
google: (url) => {
|
||||
const w = 500;
|
||||
const h = 500;
|
||||
const left = (screen.width / 2) - (w / 2);
|
||||
const top = (screen.height / 2) - (h / 2);
|
||||
|
||||
url = `https://plus.google.com/share?url=${encodeURIComponent(url)}`;
|
||||
|
||||
window.open(url, 'Share on Google', `width=${w},height=${h},left=${left},top=${top}`);
|
||||
return false;
|
||||
},
|
||||
|
||||
linkedin: (url) => {
|
||||
const w = 500;
|
||||
const h = 500;
|
||||
const left = (screen.width / 2) - (w / 2);
|
||||
const top = (screen.height / 2) - (h / 2);
|
||||
|
||||
url = `https://www.linkedin.com/cws/share?url=${encodeURIComponent(url)}`;
|
||||
|
||||
window.open(url, 'Share on Linked in', `width=${w},height=${h},left=${left},top=${top}`);
|
||||
return false;
|
||||
},
|
||||
|
||||
twitter(url, msg) {
|
||||
window.open(`http://twitter.com/share?text=${escape(msg)}&url=${escape(url)}`, 'popup', 'width=550,height=260,scrollbars=yes,resizable=yes,toolbar=no,directories=no,location=no,menubar=no,status=no,left=200,top=200');
|
||||
return false;
|
||||
},
|
||||
};
|
||||
|
||||
export default SocialShare;
|
||||
@@ -1,149 +1,140 @@
|
||||
var uploadId="";
|
||||
var uploadAttr="";
|
||||
var popupUpload = null;
|
||||
let uploadId = '';
|
||||
let uploadAttr = '';
|
||||
const popupUpload = null;
|
||||
|
||||
function showUploadDialog(id,msg,group,user,postUploadId,postUploadAttr,postUploadResultAttr,fileType){
|
||||
var ts = Math.round((new Date()).getTime() / 1000);
|
||||
uploadId = postUploadId;
|
||||
uploadAttr = postUploadAttr;
|
||||
uploadResultAttr = postUploadResultAttr;
|
||||
var html='<div><iframe src="'+CLIENT_BASE_URL+'fileupload_page.php?id=_id_&msg=_msg_&file_group=_file_group_&file_type=_file_type_&user=_user_" frameborder="0" scrolling="no" width="300px" height="55px"></iframe></div>';
|
||||
var html = html.replace(/_id_/g,id);
|
||||
var html = html.replace(/_msg_/g,msg);
|
||||
var html = html.replace(/_file_group_/g,group);
|
||||
var html = html.replace(/_user_/g,user);
|
||||
var html = html.replace(/_file_type_/g,fileType);
|
||||
function showUploadDialog(id, msg, group, user, postUploadId, postUploadAttr, postUploadResultAttr, fileType) {
|
||||
const ts = Math.round((new Date()).getTime() / 1000);
|
||||
uploadId = postUploadId;
|
||||
uploadAttr = postUploadAttr;
|
||||
uploadResultAttr = postUploadResultAttr;
|
||||
var html = `<div><iframe src="${CLIENT_BASE_URL}fileupload_page.php?id=_id_&msg=_msg_&file_group=_file_group_&file_type=_file_type_&user=_user_" frameborder="0" scrolling="no" width="300px" height="55px"></iframe></div>`;
|
||||
var html = html.replace(/_id_/g, id);
|
||||
var html = html.replace(/_msg_/g, msg);
|
||||
var html = html.replace(/_file_group_/g, group);
|
||||
var html = html.replace(/_user_/g, user);
|
||||
var html = html.replace(/_file_type_/g, fileType);
|
||||
|
||||
modJs.renderModel('upload',"Upload File",html);
|
||||
$('#uploadModel').modal('show');
|
||||
|
||||
modJs.renderModel('upload', 'Upload File', html);
|
||||
$('#uploadModel').modal('show');
|
||||
}
|
||||
|
||||
function closeUploadDialog(success,error,data){
|
||||
var arr = data.split("|");
|
||||
var file = arr[0];
|
||||
var fileBaseName = arr[1];
|
||||
var fileId = arr[2];
|
||||
|
||||
if(success == 1){
|
||||
//popupUpload.close();
|
||||
$('#uploadModel').modal('hide');
|
||||
if(uploadResultAttr == "url"){
|
||||
if(uploadAttr == "val"){
|
||||
$('#'+uploadId).val(file);
|
||||
}else if(uploadAttr == "html"){
|
||||
$('#'+uploadId).html(file);
|
||||
}else{
|
||||
$('#'+uploadId).attr(uploadAttr,file);
|
||||
}
|
||||
|
||||
}else if(uploadResultAttr == "name"){
|
||||
if(uploadAttr == "val"){
|
||||
$('#'+uploadId).val(fileBaseName);
|
||||
}else if(uploadAttr == "html"){
|
||||
$('#'+uploadId).html(fileBaseName);
|
||||
$('#'+uploadId).attr("val",fileBaseName);
|
||||
}else{
|
||||
$('#'+uploadId).attr(uploadAttr,fileBaseName);
|
||||
}
|
||||
$('#'+uploadId).show();
|
||||
$('#'+uploadId+"_download").show();
|
||||
$('#'+uploadId+"_remove").show();
|
||||
}else if(uploadResultAttr == "id"){
|
||||
if(uploadAttr == "val"){
|
||||
$('#'+uploadId).attr(uploadAttr,fileId);
|
||||
}else if(uploadAttr == "html"){
|
||||
$('#'+uploadId).html(fileBaseName);
|
||||
$('#'+uploadId).attr("val",fileId);
|
||||
}else{
|
||||
$('#'+uploadId).attr(uploadAttr,fileId);
|
||||
}
|
||||
$('#'+uploadId).show();
|
||||
$('#'+uploadId+"_download").show();
|
||||
$('#'+uploadId+"_remove").show();
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
//popupUpload.close();
|
||||
$('#uploadModel').modal('hide');
|
||||
}
|
||||
|
||||
}
|
||||
function closeUploadDialog(success, error, data) {
|
||||
const arr = data.split('|');
|
||||
const file = arr[0];
|
||||
const fileBaseName = arr[1];
|
||||
const fileId = arr[2];
|
||||
|
||||
function download(name, closeCallback, closeCallbackData){
|
||||
|
||||
var successCallback = function(data){
|
||||
|
||||
var link;
|
||||
var fileParts;
|
||||
var viewableImages = ["png","jpg","gif","bmp","jpge"];
|
||||
var viewableFiles = ["pdf","xml"];
|
||||
|
||||
$('.modal').modal('hide');
|
||||
|
||||
if(data['filename'].indexOf("https:") == 0 || data['filename'].indexOf("http:") == 0){
|
||||
fileParts = data['filename'].split("?");
|
||||
fileParts = fileParts[0].split(".");
|
||||
|
||||
if(jQuery.inArray(fileParts[fileParts.length - 1], viewableFiles ) >= 0) {
|
||||
var win = window.open(data['filename'], '_blank');
|
||||
win.focus();
|
||||
}else{
|
||||
link = '<a href="'+data['filename']+'" target="_blank">Download File <i class="icon-download-alt"></i> </a>';
|
||||
if(jQuery.inArray(fileParts[fileParts.length - 1], viewableImages ) >= 0) {
|
||||
link += '<br/><br/><img style="max-width:545px;max-height:350px;" src="'+data['filename']+'"/>';
|
||||
}
|
||||
modJs.showMessage("Download File Attachment",link,closeCallback,closeCallbackData);
|
||||
}
|
||||
}else{
|
||||
fileParts = data['filename'].split(".");
|
||||
link = '<a href="'+modJs.getCustomActionUrl("download",{'file':data['filename']})+'" target="_blank">Download File <i class="icon-download-alt"></i> </a>';
|
||||
if(jQuery.inArray(fileParts[fileParts.length - 1], viewableImages ) >= 0) {
|
||||
link += '<br/><br/><img style="max-width:545px;max-height:350px;" src="'+modJs.getClientDataUrl()+data['filename']+'"/>';
|
||||
}
|
||||
|
||||
modJs.showMessage("Download File Attachment",link,closeCallback,closeCallbackData);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
var failCallback = function(data){
|
||||
modJs.showMessage("Error Downloading File","File not found");
|
||||
};
|
||||
|
||||
modJs.sendCustomRequest("file",{'name':name},successCallback,failCallback);
|
||||
}
|
||||
|
||||
function randomString(length){
|
||||
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
|
||||
|
||||
if (! length) {
|
||||
length = Math.floor(Math.random() * chars.length);
|
||||
if (success == 1) {
|
||||
// popupUpload.close();
|
||||
$('#uploadModel').modal('hide');
|
||||
if (uploadResultAttr == 'url') {
|
||||
if (uploadAttr == 'val') {
|
||||
$(`#${uploadId}`).val(file);
|
||||
} else if (uploadAttr == 'html') {
|
||||
$(`#${uploadId}`).html(file);
|
||||
} else {
|
||||
$(`#${uploadId}`).attr(uploadAttr, file);
|
||||
}
|
||||
} else if (uploadResultAttr == 'name') {
|
||||
if (uploadAttr == 'val') {
|
||||
$(`#${uploadId}`).val(fileBaseName);
|
||||
} else if (uploadAttr == 'html') {
|
||||
$(`#${uploadId}`).html(fileBaseName);
|
||||
$(`#${uploadId}`).attr('val', fileBaseName);
|
||||
} else {
|
||||
$(`#${uploadId}`).attr(uploadAttr, fileBaseName);
|
||||
}
|
||||
$(`#${uploadId}`).show();
|
||||
$(`#${uploadId}_download`).show();
|
||||
$(`#${uploadId}_remove`).show();
|
||||
} else if (uploadResultAttr == 'id') {
|
||||
if (uploadAttr == 'val') {
|
||||
$(`#${uploadId}`).attr(uploadAttr, fileId);
|
||||
} else if (uploadAttr == 'html') {
|
||||
$(`#${uploadId}`).html(fileBaseName);
|
||||
$(`#${uploadId}`).attr('val', fileId);
|
||||
} else {
|
||||
$(`#${uploadId}`).attr(uploadAttr, fileId);
|
||||
}
|
||||
$(`#${uploadId}`).show();
|
||||
$(`#${uploadId}_download`).show();
|
||||
$(`#${uploadId}_remove`).show();
|
||||
}
|
||||
|
||||
var str = '';
|
||||
for (var i = 0; i < length; i++) {
|
||||
str += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return str;
|
||||
} else {
|
||||
// popupUpload.close();
|
||||
$('#uploadModel').modal('hide');
|
||||
}
|
||||
}
|
||||
|
||||
function verifyInstance(key){
|
||||
var object = {};
|
||||
object['a'] = "verifyInstance";
|
||||
object['key'] = key;
|
||||
$.post(this.baseUrl, object, function(data) {
|
||||
if(data.status == "SUCCESS"){
|
||||
$("#verifyModel").hide();
|
||||
$('body').removeClass('modal-open');
|
||||
$('.modal-backdrop').remove();
|
||||
alert("Success: Instance Verified");
|
||||
}else{
|
||||
alert("Error: "+data.message);
|
||||
}
|
||||
},"json");
|
||||
function download(name, closeCallback, closeCallbackData) {
|
||||
const successCallback = function (data) {
|
||||
let link;
|
||||
let fileParts;
|
||||
const viewableImages = ['png', 'jpg', 'gif', 'bmp', 'jpge'];
|
||||
const viewableFiles = ['pdf', 'xml'];
|
||||
|
||||
$('.modal').modal('hide');
|
||||
|
||||
if (data.filename.indexOf('https:') == 0 || data.filename.indexOf('http:') == 0) {
|
||||
fileParts = data.filename.split('?');
|
||||
fileParts = fileParts[0].split('.');
|
||||
|
||||
if (jQuery.inArray(fileParts[fileParts.length - 1], viewableFiles) >= 0) {
|
||||
const win = window.open(data.filename, '_blank');
|
||||
win.focus();
|
||||
} else {
|
||||
link = `<a href="${data.filename}" target="_blank">Download File <i class="icon-download-alt"></i> </a>`;
|
||||
if (jQuery.inArray(fileParts[fileParts.length - 1], viewableImages) >= 0) {
|
||||
link += `<br/><br/><img style="max-width:545px;max-height:350px;" src="${data.filename}"/>`;
|
||||
}
|
||||
modJs.showMessage('Download File Attachment', link, closeCallback, closeCallbackData);
|
||||
}
|
||||
} else {
|
||||
fileParts = data.filename.split('.');
|
||||
link = `<a href="${modJs.getCustomActionUrl('download', { file: data.filename })}" target="_blank">Download File <i class="icon-download-alt"></i> </a>`;
|
||||
if (jQuery.inArray(fileParts[fileParts.length - 1], viewableImages) >= 0) {
|
||||
link += `<br/><br/><img style="max-width:545px;max-height:350px;" src="${modJs.getClientDataUrl()}${data.filename}"/>`;
|
||||
}
|
||||
|
||||
modJs.showMessage('Download File Attachment', link, closeCallback, closeCallbackData);
|
||||
}
|
||||
};
|
||||
|
||||
const failCallback = function (data) {
|
||||
modJs.showMessage('Error Downloading File', 'File not found');
|
||||
};
|
||||
|
||||
modJs.sendCustomRequest('file', { name }, successCallback, failCallback);
|
||||
}
|
||||
|
||||
function randomString(length) {
|
||||
const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz'.split('');
|
||||
|
||||
if (!length) {
|
||||
length = Math.floor(Math.random() * chars.length);
|
||||
}
|
||||
|
||||
let str = '';
|
||||
for (let i = 0; i < length; i++) {
|
||||
str += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
function verifyInstance(key) {
|
||||
const object = {};
|
||||
object.a = 'verifyInstance';
|
||||
object.key = key;
|
||||
$.post(this.baseUrl, object, (data) => {
|
||||
if (data.status == 'SUCCESS') {
|
||||
$('#verifyModel').hide();
|
||||
$('body').removeClass('modal-open');
|
||||
$('.modal-backdrop').remove();
|
||||
alert('Success: Instance Verified');
|
||||
} else {
|
||||
alert(`Error: ${data.message}`);
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function nl2br(str, is_xhtml) {
|
||||
@@ -164,21 +155,28 @@ function nl2br(str, is_xhtml) {
|
||||
// example 3: nl2br("\nOne\nTwo\n\nThree\n", true);
|
||||
// returns 3: '<br />\nOne<br />\nTwo<br />\n<br />\nThree<br />\n'
|
||||
|
||||
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; // Adjust comment to avoid issue on phpjs.org display
|
||||
const breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br ' + '/>' : '<br>'; // Adjust comment to avoid issue on phpjs.org display
|
||||
|
||||
return (str + '')
|
||||
.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
|
||||
return (`${str}`)
|
||||
.replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, `$1${breakTag}$2`);
|
||||
}
|
||||
|
||||
function updateLanguage(language) {
|
||||
var object = {};
|
||||
object['a'] = "updateLanguage";
|
||||
object['language'] = language;
|
||||
$.post(this.baseUrl, object, function(data) {
|
||||
if(data.status == "SUCCESS"){
|
||||
location.reload();
|
||||
} else {
|
||||
alert("Error occurred while changing language");
|
||||
}
|
||||
},"json");
|
||||
const object = {};
|
||||
object.a = 'updateLanguage';
|
||||
object.language = language;
|
||||
$.post(this.baseUrl, object, (data) => {
|
||||
if (data.status == 'SUCCESS') {
|
||||
location.reload();
|
||||
} else {
|
||||
alert('Error occurred while changing language');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$('.treeview-menu a').hover(
|
||||
function () { $(this).find('.fa').addClass('faa-horizontal'); $(this).find('.fa').addClass('animated') },
|
||||
function () { $(this).find('.fa').removeClass('faa-horizontal'); $(this).find('.fa').removeClass('animated');},
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
/* global timeUtils */
|
||||
/*
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Copyright (c) 2018 [Glacies UG, Berlin, Germany] (http://glacies.de)
|
||||
Developer: Thilina Hasantha (http://lk.linkedin.com/in/thilinah | https://github.com/thilinah)
|
||||
*/
|
||||
import NotificationManager from './Notifications';
|
||||
import TimeUtils from './TimeUtils';
|
||||
|
||||
import RequestCache from './RequestCache';
|
||||
import SocialShare from './SocialShare';
|
||||
|
||||
const Aes = require('./Aes');
|
||||
|
||||
window.RequestCache = RequestCache;
|
||||
window.SocialShare = SocialShare;
|
||||
|
||||
window.setupTimeUtils = (diffHoursBetweenServerTimezoneWithGMT) => {
|
||||
const timeUtils = new TimeUtils();
|
||||
|
||||
Reference in New Issue
Block a user