Merge pull request #15414 from nextcloud/refactor/oc-constants-bundle

Move OC constants to the bundle
This commit is contained in:
Morris Jobke 2019-05-07 17:59:12 +02:00 committed by GitHub
commit 5893f218c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 23 deletions

View File

@ -158,7 +158,7 @@ function q(e){for(var t,n=[],a=0,r=-1,i=0;a<e.length;){t=e.charAt(a);var s=!i&&"
*
* 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/>.
*/if(void 0===G){var K=(G=location.pathname).indexOf("/index.php/");G=-1!==K?G.substr(0,K):G.substr(0,G.lastIndexOf("/"))}var X,Z=G,Q=a.a={Apps:i.a,AppConfig:void 0,appConfig:s,appswebroots:o.a,Backbone:v,ContactsMenu:k.a,config:Y,dialogs:x,EventSource:H,isUserAdmin:function(){return j},L10N:E,msg:N,Notification:z,PasswordConfirmation:$,Plugins:{_plugins:{},register:function(e,t){var n=this._plugins[e];n||(n=this._plugins[e]=[]),n.push(t)},getPlugins:function(e){return this._plugins[e]||[]},attach:function(e,t,n){for(var a=this.getPlugins(e),r=0;r<a.length;r++)a[r].attach&&a[r].attach(t,n)},detach:function(e,t,n){for(var a=this.getPlugins(e),r=0;r<a.length;r++)a[r].detach&&a[r].detach(t,n)}},search:U,Util:B,debug:V,generateUrl:function(e,t,n){var a=n||{};c.a.defaults(a,{escape:!0});var r=function(e,t){return t=t||[],e.replace(/{([^{}]*)}/g,function(e,n){var r=t[n];return a.escape?"string"==typeof r||"number"==typeof r?encodeURIComponent(r):encodeURIComponent(e):"string"==typeof r||"number"==typeof r?r:e})};return"/"!==e.charAt(0)&&(e="/"+e),!0===oc_config.modRewriteWorking?W()+r(e,t):W()+"/index.php"+r(e,t)},get:(X=window,function(e){for(var t=e.split("."),n=t.pop(),a=0;a<t.length;a++)if(!(X=X[t[a]]))return!1;return X[n]}),set:function(e){return function(t,n){for(var a=t.split("."),r=a.pop(),i=0;i<a.length;i++)e[a[i]]||(e[a[i]]={}),e=e[a[i]];e[r]=n}}(window),getRootPath:W,filePath:F,redirect:function(e){return window.location=e},reload:function(){return window.location.reload()},linkTo:function(e,t){return F(e,"",t)},linkToOCS:function(e,t){return t=2!==t?1:2,window.location.protocol+"//"+window.location.host+W()+"/ocs/v"+t+".php/"+e+"/"},linkToRemote:function(e){return window.location.protocol+"//"+window.location.host+C(e)},linkToRemoteBase:C,webroot:Z};
*/if(void 0===G){var K=(G=location.pathname).indexOf("/index.php/");G=-1!==K?G.substr(0,K):G.substr(0,G.lastIndexOf("/"))}var X,Z=G,Q=a.a={PERMISSION_ALL:31,PERMISSION_CREATE:4,PERMISSION_DELETE:8,PERMISSION_NONE:0,PERMISSION_READ:1,PERMISSION_SHARE:16,PERMISSION_UPDATE:2,TAG_FAVORITE:"_$!<Favorite>!$_",Apps:i.a,AppConfig:void 0,appConfig:s,appswebroots:o.a,Backbone:v,ContactsMenu:k.a,config:Y,dialogs:x,EventSource:H,isUserAdmin:function(){return j},L10N:E,msg:N,Notification:z,PasswordConfirmation:$,Plugins:{_plugins:{},register:function(e,t){var n=this._plugins[e];n||(n=this._plugins[e]=[]),n.push(t)},getPlugins:function(e){return this._plugins[e]||[]},attach:function(e,t,n){for(var a=this.getPlugins(e),r=0;r<a.length;r++)a[r].attach&&a[r].attach(t,n)},detach:function(e,t,n){for(var a=this.getPlugins(e),r=0;r<a.length;r++)a[r].detach&&a[r].detach(t,n)}},search:U,Util:B,debug:V,generateUrl:function(e,t,n){var a=n||{};c.a.defaults(a,{escape:!0});var r=function(e,t){return t=t||[],e.replace(/{([^{}]*)}/g,function(e,n){var r=t[n];return a.escape?"string"==typeof r||"number"==typeof r?encodeURIComponent(r):encodeURIComponent(e):"string"==typeof r||"number"==typeof r?r:e})};return"/"!==e.charAt(0)&&(e="/"+e),!0===oc_config.modRewriteWorking?W()+r(e,t):W()+"/index.php"+r(e,t)},get:(X=window,function(e){for(var t=e.split("."),n=t.pop(),a=0;a<t.length;a++)if(!(X=X[t[a]]))return!1;return X[n]}),set:function(e){return function(t,n){for(var a=t.split("."),r=a.pop(),i=0;i<a.length;i++)e[a[i]]||(e[a[i]]={}),e=e[a[i]];e[r]=n}}(window),getRootPath:W,filePath:F,redirect:function(e){return window.location=e},reload:function(){return window.location.reload()},linkTo:function(e,t){return F(e,"",t)},linkToOCS:function(e,t){return t=2!==t?1:2,window.location.protocol+"//"+window.location.host+W()+"/ocs/v"+t+".php/"+e+"/"},linkToRemote:function(e){return window.location.protocol+"//"+window.location.host+C(e)},linkToRemoteBase:C,webroot:Z};
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*

File diff suppressed because one or more lines are too long

24
core/js/dist/main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,14 +8,6 @@ var OCP = Object.assign({}, window.OCP);
* @namespace OC
*/
Object.assign(window.OC, {
PERMISSION_NONE:0,
PERMISSION_CREATE:4,
PERMISSION_READ:1,
PERMISSION_UPDATE:2,
PERMISSION_DELETE:8,
PERMISSION_SHARE:16,
PERMISSION_ALL:31,
TAG_FAVORITE: '_$!<Favorite>!$_',
/* jshint camelcase: false */
/**
* Capabilities

29
core/src/OC/constants.js Normal file
View File

@ -0,0 +1,29 @@
/*
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
* @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/>.
*/
export const PERMISSION_NONE = 0
export const PERMISSION_CREATE = 4
export const PERMISSION_READ = 1
export const PERMISSION_UPDATE = 2
export const PERMISSION_DELETE = 8
export const PERMISSION_SHARE = 16
export const PERMISSION_ALL = 31
export const TAG_FAVORITE = '_$!<Favorite>!$_'

View File

@ -24,6 +24,16 @@ import {AppConfig, appConfig} from './appconfig'
import appswebroots from './appswebroots'
import Backbone from './backbone'
import Config from './config'
import {
PERMISSION_ALL,
PERMISSION_CREATE,
PERMISSION_DELETE,
PERMISSION_NONE,
PERMISSION_READ,
PERMISSION_SHARE,
PERMISSION_UPDATE,
TAG_FAVORITE,
} from './constants'
import ContactsMenu from './contactsmenu'
import Dialogs from './dialogs'
import EventSource from './eventsource'
@ -51,6 +61,18 @@ import webroot from './webroot'
/** @namespace OC */
export default {
/*
* Constants
*/
PERMISSION_ALL,
PERMISSION_CREATE,
PERMISSION_DELETE,
PERMISSION_NONE,
PERMISSION_READ,
PERMISSION_SHARE,
PERMISSION_UPDATE,
TAG_FAVORITE,
Apps,
AppConfig,
appConfig,