Move OCP.AppCOnfig, OCP.Comments and OCP.WhatsNew to the server bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
fda74eb9b9
commit
9a46c9ed31
|
@ -14,10 +14,7 @@
|
|||
"sharedialogresharerinfoview.js",
|
||||
"sharedialogshareelistview.js",
|
||||
"contactsmenu_templates.js",
|
||||
"public/appconfig.js",
|
||||
"public/comments.js",
|
||||
"public/publicpage.js",
|
||||
"public/whatsnew.js",
|
||||
"multiselect.js",
|
||||
"oc-requesttoken.js",
|
||||
"setupchecks.js",
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,6 @@
|
|||
[
|
||||
"oc-dialogs.js",
|
||||
"js.js",
|
||||
"public/appconfig.js",
|
||||
"public/comments.js",
|
||||
"public/whatsnew.js",
|
||||
"oc-requesttoken.js",
|
||||
"mimetype.js",
|
||||
"mimetypelist.js",
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @namespace
|
||||
* @since 11.0.0
|
||||
*/
|
||||
OCP.AppConfig = {
|
||||
/**
|
||||
* @param {string} method
|
||||
* @param {string} endpoint
|
||||
* @param {Object} [options]
|
||||
* @param {Object} [options.data]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @internal
|
||||
*/
|
||||
_call: function(method, endpoint, options) {
|
||||
if ((method === 'post' || method === 'delete') && OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
||||
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this._call, this, method, endpoint, options));
|
||||
return;
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
$.ajax({
|
||||
type: method.toUpperCase(),
|
||||
url: OC.linkToOCS('apps/provisioning_api/api/v1', 2) + 'config/apps' + endpoint,
|
||||
data: options.data || {},
|
||||
success: options.success,
|
||||
error: options.error
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
getApps: function(options) {
|
||||
this._call('get', '', options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
getKeys: function(app, options) {
|
||||
this._call('get', '/' + app, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string} key
|
||||
* @param {string|function} defaultValue
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
getValue: function(app, key, defaultValue, options) {
|
||||
options = options || {};
|
||||
options.data = {
|
||||
defaultValue: defaultValue
|
||||
};
|
||||
|
||||
this._call('get', '/' + app + '/' + key, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
setValue: function(app, key, value, options) {
|
||||
options = options || {};
|
||||
options.data = {
|
||||
value: value
|
||||
};
|
||||
|
||||
this._call('post', '/' + app + '/' + key, options);
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string} key
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
deleteKey: function(app, key, options) {
|
||||
this._call('delete', '/' + app + '/' + key, options);
|
||||
}
|
||||
};
|
|
@ -1,59 +0,0 @@
|
|||
/**
|
||||
* @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*/
|
||||
|
||||
(function(OCP) {
|
||||
"use strict";
|
||||
|
||||
OCP.Comments = {
|
||||
|
||||
/*
|
||||
* Detects links:
|
||||
* Either the http(s) protocol is given or two strings, basically limited to ascii with the last
|
||||
* word being at least one digit long,
|
||||
* followed by at least another character
|
||||
*
|
||||
* The downside: anything not ascii is excluded. Not sure how common it is in areas using different
|
||||
* alphabets… the upside: fake domains with similar looking characters won't be formatted as links
|
||||
*/
|
||||
urlRegex: /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig,
|
||||
|
||||
plainToRich: function(content) {
|
||||
content = this.formatLinksRich(content);
|
||||
return content;
|
||||
},
|
||||
|
||||
richToPlain: function(content) {
|
||||
content = this.formatLinksPlain(content);
|
||||
return content;
|
||||
},
|
||||
|
||||
formatLinksRich: function(content) {
|
||||
return content.replace(this.urlRegex, function(_, leadingSpace, protocol, url, trailingSpace) {
|
||||
var linkText = url;
|
||||
if(!protocol) {
|
||||
protocol = 'https://';
|
||||
} else if (protocol === 'http://'){
|
||||
linkText = protocol + url;
|
||||
}
|
||||
|
||||
return leadingSpace + '<a class="external" target="_blank" rel="noopener noreferrer" href="' + protocol + url + '">' + linkText + '</a>' + trailingSpace;
|
||||
});
|
||||
},
|
||||
|
||||
formatLinksPlain: function(content) {
|
||||
var $content = $('<div></div>').html(content);
|
||||
$content.find('a').each(function () {
|
||||
var $this = $(this);
|
||||
$this.html($this.attr('href'));
|
||||
});
|
||||
return $content.html();
|
||||
}
|
||||
|
||||
};
|
||||
})(OCP);
|
|
@ -1,134 +0,0 @@
|
|||
/**
|
||||
* @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*/
|
||||
|
||||
(function(OCP) {
|
||||
"use strict";
|
||||
|
||||
OCP.WhatsNew = {
|
||||
|
||||
query: function(options) {
|
||||
options = options || {};
|
||||
var dismissOptions = options.dismiss || {};
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json',
|
||||
success: options.success || function(data, statusText, xhr) {
|
||||
OCP.WhatsNew._onQuerySuccess(data, statusText, xhr, dismissOptions);
|
||||
},
|
||||
error: options.error || this._onQueryError
|
||||
});
|
||||
},
|
||||
|
||||
dismiss: function(version, options) {
|
||||
options = options || {};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: options.url || OC.linkToOCS('core', 2) + 'whatsnew',
|
||||
data: {version: encodeURIComponent(version)},
|
||||
success: options.success || this._onDismissSuccess,
|
||||
error: options.error || this._onDismissError
|
||||
});
|
||||
// remove element immediately
|
||||
$('.whatsNewPopover').remove();
|
||||
},
|
||||
|
||||
_onQuerySuccess: function(data, statusText, xhr, dismissOptions) {
|
||||
console.debug('querying Whats New data was successful: ' + statusText);
|
||||
console.debug(data);
|
||||
|
||||
if(xhr.status !== 200) {
|
||||
return;
|
||||
}
|
||||
|
||||
var item, menuItem, text, icon;
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.classList.add('popovermenu', 'open', 'whatsNewPopover', 'menu-left');
|
||||
|
||||
var list = document.createElement('ul');
|
||||
|
||||
// header
|
||||
item = document.createElement('li');
|
||||
menuItem = document.createElement('span');
|
||||
menuItem.className = "menuitem";
|
||||
|
||||
text = document.createElement('span');
|
||||
text.innerText = t('core', 'New in') + ' ' + data['ocs']['data']['product'];
|
||||
text.className = 'caption';
|
||||
menuItem.appendChild(text);
|
||||
|
||||
icon = document.createElement('span');
|
||||
icon.className = 'icon-close';
|
||||
icon.onclick = function () {
|
||||
OCP.WhatsNew.dismiss(data['ocs']['data']['version'], dismissOptions);
|
||||
};
|
||||
menuItem.appendChild(icon);
|
||||
|
||||
item.appendChild(menuItem);
|
||||
list.appendChild(item);
|
||||
|
||||
// Highlights
|
||||
for (var i in data['ocs']['data']['whatsNew']['regular']) {
|
||||
var whatsNewTextItem = data['ocs']['data']['whatsNew']['regular'][i];
|
||||
item = document.createElement('li');
|
||||
|
||||
menuItem = document.createElement('span');
|
||||
menuItem.className = "menuitem";
|
||||
|
||||
icon = document.createElement('span');
|
||||
icon.className = 'icon-checkmark';
|
||||
menuItem.appendChild(icon);
|
||||
|
||||
text = document.createElement('p');
|
||||
text.innerHTML = _.escape(whatsNewTextItem);
|
||||
menuItem.appendChild(text);
|
||||
|
||||
item.appendChild(menuItem);
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
// Changelog URL
|
||||
if(!_.isUndefined(data['ocs']['data']['changelogURL'])) {
|
||||
item = document.createElement('li');
|
||||
|
||||
menuItem = document.createElement('a');
|
||||
menuItem.href = data['ocs']['data']['changelogURL'];
|
||||
menuItem.rel = 'noreferrer noopener';
|
||||
menuItem.target = '_blank';
|
||||
|
||||
icon = document.createElement('span');
|
||||
icon.className = 'icon-link';
|
||||
menuItem.appendChild(icon);
|
||||
|
||||
text = document.createElement('span');
|
||||
text.innerText = t('core', 'View changelog');
|
||||
menuItem.appendChild(text);
|
||||
|
||||
item.appendChild(menuItem);
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
div.appendChild(list);
|
||||
document.body.appendChild(div);
|
||||
},
|
||||
|
||||
_onQueryError: function (x, t, e) {
|
||||
console.debug('querying Whats New Data resulted in an error: ' + t + e);
|
||||
console.debug(x);
|
||||
},
|
||||
|
||||
_onDismissSuccess: function(data) {
|
||||
//noop
|
||||
},
|
||||
|
||||
_onDismissError: function (data) {
|
||||
console.debug('dismissing Whats New data resulted in an error: ' + data);
|
||||
}
|
||||
};
|
||||
})(OCP);
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
import OCP from '../OCP/index';
|
||||
|
||||
import {getValue, setValue, getApps, getKeys, deleteKey} from '../OCP/appconfig'
|
||||
|
||||
/**
|
||||
* @namespace
|
||||
* @deprecated 16.0.0 Use OCP.AppConfig instead
|
||||
|
@ -28,8 +30,8 @@ const AppConfig = {
|
|||
/**
|
||||
* @deprecated Use OCP.AppConfig.getValue() instead
|
||||
*/
|
||||
getValue:function(app,key,defaultValue,callback){
|
||||
OCP.AppConfig.getValue(app, key, defaultValue, {
|
||||
getValue: function (app, key, defaultValue, callback) {
|
||||
getValue(app, key, defaultValue, {
|
||||
success: callback
|
||||
});
|
||||
},
|
||||
|
@ -37,15 +39,15 @@ const AppConfig = {
|
|||
/**
|
||||
* @deprecated Use OCP.AppConfig.setValue() instead
|
||||
*/
|
||||
setValue:function(app,key,value){
|
||||
OCP.AppConfig.setValue(app, key, value);
|
||||
setValue: function (app, key, value) {
|
||||
setValue(app, key, value);
|
||||
},
|
||||
|
||||
/**
|
||||
* @deprecated Use OCP.AppConfig.getApps() instead
|
||||
*/
|
||||
getApps:function(callback){
|
||||
OCP.AppConfig.getApps({
|
||||
getApps: function (callback) {
|
||||
getApps({
|
||||
success: callback
|
||||
});
|
||||
},
|
||||
|
@ -53,8 +55,8 @@ const AppConfig = {
|
|||
/**
|
||||
* @deprecated Use OCP.AppConfig.getKeys() instead
|
||||
*/
|
||||
getKeys:function(app,callback){
|
||||
OCP.AppConfig.getKeys(app, {
|
||||
getKeys: function (app, callback) {
|
||||
getKeys(app, {
|
||||
success: callback
|
||||
});
|
||||
},
|
||||
|
@ -62,8 +64,8 @@ const AppConfig = {
|
|||
/**
|
||||
* @deprecated Use OCP.AppConfig.deleteKey() instead
|
||||
*/
|
||||
deleteKey:function(app,key){
|
||||
OCP.AppConfig.deleteKey(app, key);
|
||||
deleteKey: function (app, key) {
|
||||
deleteKey(app, key);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -0,0 +1,116 @@
|
|||
/**
|
||||
* @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
import $ from 'jquery'
|
||||
|
||||
import OC from '../OC/index'
|
||||
|
||||
/**
|
||||
* @param {string} method
|
||||
* @param {string} endpoint
|
||||
* @param {Object} [options]
|
||||
* @param {Object} [options.data]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @internal
|
||||
*/
|
||||
function call (method, endpoint, options) {
|
||||
if ((method === 'post' || method === 'delete') && OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
||||
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(call, this, method, endpoint, options));
|
||||
return;
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
$.ajax({
|
||||
type: method.toUpperCase(),
|
||||
url: OC.linkToOCS('apps/provisioning_api/api/v1', 2) + 'config/apps' + endpoint,
|
||||
data: options.data || {},
|
||||
success: options.success,
|
||||
error: options.error
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
export function getApps (options) {
|
||||
call('get', '', options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
export function getKeys (app, options) {
|
||||
call('get', '/' + app, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string} key
|
||||
* @param {string|function} defaultValue
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
export function getValue (app, key, defaultValue, options) {
|
||||
options = options || {};
|
||||
options.data = {
|
||||
defaultValue: defaultValue
|
||||
};
|
||||
|
||||
call('get', '/' + app + '/' + key, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
export function setValue (app, key, value, options) {
|
||||
options = options || {};
|
||||
options.data = {
|
||||
value: value
|
||||
};
|
||||
|
||||
call('post', '/' + app + '/' + key, options);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} app
|
||||
* @param {string} key
|
||||
* @param {Object} [options]
|
||||
* @param {function} [options.success]
|
||||
* @param {function} [options.error]
|
||||
* @since 11.0.0
|
||||
*/
|
||||
export function deleteKey (app, key, options) {
|
||||
call('delete', '/' + app + '/' + key, options);
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/**
|
||||
* @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*/
|
||||
|
||||
import $ from 'jquery'
|
||||
|
||||
/*
|
||||
* Detects links:
|
||||
* Either the http(s) protocol is given or two strings, basically limited to ascii with the last
|
||||
* word being at least one digit long,
|
||||
* followed by at least another character
|
||||
*
|
||||
* The downside: anything not ascii is excluded. Not sure how common it is in areas using different
|
||||
* alphabets… the upside: fake domains with similar looking characters won't be formatted as links
|
||||
*/
|
||||
const urlRegex = /(\s|^)(https?:\/\/)?((?:[-A-Z0-9+_]+\.)+[-A-Z]+(?:\/[-A-Z0-9+&@#%?=~_|!:,.;()]*)*)(\s|$)/ig;
|
||||
|
||||
export function plainToRich (content) {
|
||||
return this.formatLinksRich(content);
|
||||
}
|
||||
|
||||
export function richToPlain (content) {
|
||||
return this.formatLinksPlain(content);
|
||||
}
|
||||
|
||||
export function formatLinksRich (content) {
|
||||
return content.replace(urlRegex, function (_, leadingSpace, protocol, url, trailingSpace) {
|
||||
let linkText = url;
|
||||
if (!protocol) {
|
||||
protocol = 'https://';
|
||||
} else if (protocol === 'http://') {
|
||||
linkText = protocol + url;
|
||||
}
|
||||
|
||||
return leadingSpace + '<a class="external" target="_blank" rel="noopener noreferrer" href="' + protocol + url + '">' + linkText + '</a>' + trailingSpace;
|
||||
});
|
||||
}
|
||||
|
||||
export function formatLinksPlain (content) {
|
||||
const $content = $('<div></div>').html(content);
|
||||
$content.find('a').each(function () {
|
||||
const $this = $(this);
|
||||
$this.html($this.attr('href'));
|
||||
});
|
||||
return $content.html();
|
||||
}
|
|
@ -1,11 +1,17 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
import loader from './loader'
|
||||
import * as AppConfig from './appconfig'
|
||||
import * as Comments from './comments'
|
||||
import initialState from './initialstate'
|
||||
import Loader from './loader'
|
||||
import * as WhatsNew from './whatsnew'
|
||||
|
||||
/** @namespace OCP */
|
||||
export default {
|
||||
Loader: loader,
|
||||
AppConfig,
|
||||
Comments,
|
||||
InitialState: initialState,
|
||||
Loader,
|
||||
WhatsNew,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,132 @@
|
|||
/**
|
||||
* @copyright (c) 2017 Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* @author Arthur Schiwon <blizzz@arthur-schiwon.de>
|
||||
*
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later. See the COPYING file.
|
||||
*/
|
||||
|
||||
import _ from 'underscore'
|
||||
import $ from 'jquery'
|
||||
|
||||
import OC from '../OC/index'
|
||||
|
||||
export function query (options) {
|
||||
options = options || {};
|
||||
var dismissOptions = options.dismiss || {};
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: options.url || OC.linkToOCS('core', 2) + 'whatsnew?format=json',
|
||||
success: options.success || function (data, statusText, xhr) {
|
||||
onQuerySuccess(data, statusText, xhr, dismissOptions);
|
||||
},
|
||||
error: options.error || onQueryError
|
||||
});
|
||||
}
|
||||
|
||||
export function dismiss (version, options) {
|
||||
options = options || {};
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: options.url || OC.linkToOCS('core', 2) + 'whatsnew',
|
||||
data: {version: encodeURIComponent(version)},
|
||||
success: options.success || onDismissSuccess,
|
||||
error: options.error || onDismissError
|
||||
});
|
||||
// remove element immediately
|
||||
$('.whatsNewPopover').remove();
|
||||
}
|
||||
|
||||
function onQuerySuccess (data, statusText, xhr, dismissOptions) {
|
||||
console.debug('querying Whats New data was successful: ' + statusText);
|
||||
console.debug(data);
|
||||
|
||||
if (xhr.status !== 200) {
|
||||
return;
|
||||
}
|
||||
|
||||
var item, menuItem, text, icon;
|
||||
|
||||
var div = document.createElement('div');
|
||||
div.classList.add('popovermenu', 'open', 'whatsNewPopover', 'menu-left');
|
||||
|
||||
var list = document.createElement('ul');
|
||||
|
||||
// header
|
||||
item = document.createElement('li');
|
||||
menuItem = document.createElement('span');
|
||||
menuItem.className = "menuitem";
|
||||
|
||||
text = document.createElement('span');
|
||||
text.innerText = t('core', 'New in') + ' ' + data['ocs']['data']['product'];
|
||||
text.className = 'caption';
|
||||
menuItem.appendChild(text);
|
||||
|
||||
icon = document.createElement('span');
|
||||
icon.className = 'icon-close';
|
||||
icon.onclick = function () {
|
||||
dismiss(data['ocs']['data']['version'], dismissOptions);
|
||||
};
|
||||
menuItem.appendChild(icon);
|
||||
|
||||
item.appendChild(menuItem);
|
||||
list.appendChild(item);
|
||||
|
||||
// Highlights
|
||||
for (var i in data['ocs']['data']['whatsNew']['regular']) {
|
||||
var whatsNewTextItem = data['ocs']['data']['whatsNew']['regular'][i];
|
||||
item = document.createElement('li');
|
||||
|
||||
menuItem = document.createElement('span');
|
||||
menuItem.className = "menuitem";
|
||||
|
||||
icon = document.createElement('span');
|
||||
icon.className = 'icon-checkmark';
|
||||
menuItem.appendChild(icon);
|
||||
|
||||
text = document.createElement('p');
|
||||
text.innerHTML = _.escape(whatsNewTextItem);
|
||||
menuItem.appendChild(text);
|
||||
|
||||
item.appendChild(menuItem);
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
// Changelog URL
|
||||
if (!_.isUndefined(data['ocs']['data']['changelogURL'])) {
|
||||
item = document.createElement('li');
|
||||
|
||||
menuItem = document.createElement('a');
|
||||
menuItem.href = data['ocs']['data']['changelogURL'];
|
||||
menuItem.rel = 'noreferrer noopener';
|
||||
menuItem.target = '_blank';
|
||||
|
||||
icon = document.createElement('span');
|
||||
icon.className = 'icon-link';
|
||||
menuItem.appendChild(icon);
|
||||
|
||||
text = document.createElement('span');
|
||||
text.innerText = t('core', 'View changelog');
|
||||
menuItem.appendChild(text);
|
||||
|
||||
item.appendChild(menuItem);
|
||||
list.appendChild(item);
|
||||
}
|
||||
|
||||
div.appendChild(list);
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
function onQueryError (x, t, e) {
|
||||
console.debug('querying Whats New Data resulted in an error: ' + t + e);
|
||||
console.debug(x);
|
||||
}
|
||||
|
||||
function onDismissSuccess (data) {
|
||||
//noop
|
||||
}
|
||||
|
||||
function onDismissError (data) {
|
||||
console.debug('dismissing Whats New data resulted in an error: ' + data);
|
||||
}
|
Loading…
Reference in New Issue