Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
web-apps
Commits
6c427e92
Commit
6c427e92
authored
Feb 21, 2017
by
Julia Radzhabova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DE] Change plugins loading.
parent
be56f9e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
9 deletions
+49
-9
apps/common/main/lib/view/Plugins.js
apps/common/main/lib/view/Plugins.js
+1
-1
apps/documenteditor/main/app/controller/Main.js
apps/documenteditor/main/app/controller/Main.js
+48
-8
No files found.
apps/common/main/lib/view/Plugins.js
View file @
6c427e92
...
...
@@ -72,7 +72,7 @@ define([
initialize
:
function
(
options
)
{
_
.
extend
(
this
,
options
);
this
.
pluginsPath
=
'
../../../../sdkjs-plugins/
'
;
this
.
pluginsPath
=
''
;
this
.
_locked
=
false
;
this
.
_state
=
{
DisabledControls
:
true
...
...
apps/documenteditor/main/app/controller/Main.js
View file @
6c427e92
...
...
@@ -864,6 +864,7 @@ define([
pluginsController
.
setApi
(
me
.
api
);
me
.
updatePlugins
(
me
.
plugins
,
false
);
me
.
requestPlugins
(
'
../../../../sdkjs-plugins/config.json
'
);
me
.
api
.
asc_registerCallback
(
'
asc_onPluginsInit
'
,
_
.
bind
(
me
.
updatePluginsList
,
me
));
documentHolderController
.
setApi
(
me
.
api
);
...
...
@@ -1852,6 +1853,48 @@ define([
if
(
url
)
this
.
iframePrint
.
src
=
url
;
},
requestPlugins
:
function
(
pluginsPath
)
{
// request plugins
if
(
!
pluginsPath
)
return
;
var
_createXMLHTTPObject
=
function
()
{
var
xmlhttp
;
try
{
xmlhttp
=
new
ActiveXObject
(
"
Msxml2.XMLHTTP
"
);
}
catch
(
e
)
{
try
{
xmlhttp
=
new
ActiveXObject
(
"
Microsoft.XMLHTTP
"
);
}
catch
(
E
)
{
xmlhttp
=
false
;
}
}
if
(
!
xmlhttp
&&
typeof
XMLHttpRequest
!=
'
undefined
'
)
{
xmlhttp
=
new
XMLHttpRequest
();
}
return
xmlhttp
;
};
var
_getPluginJson
=
function
(
plugin
)
{
if
(
!
plugin
)
return
''
;
try
{
var
xhrObj
=
_createXMLHTTPObject
();
if
(
xhrObj
&&
plugin
)
{
xhrObj
.
open
(
'
GET
'
,
plugin
,
false
);
xhrObj
.
send
(
''
);
var
pluginJson
=
eval
(
"
(
"
+
xhrObj
.
responseText
+
"
)
"
);
return
pluginJson
;
}
}
catch
(
e
)
{}
return
null
;
};
var
value
=
_getPluginJson
(
pluginsPath
);
if
(
value
)
this
.
updatePlugins
(
value
,
false
);
},
updatePlugins
:
function
(
plugins
,
uiCustomize
)
{
// plugins from config
if
(
!
plugins
)
return
;
...
...
@@ -1892,20 +1935,17 @@ define([
return
null
;
};
var
arr
=
[],
baseUrl
=
plugins
.
url
;
var
arr
=
[];
pluginsData
.
forEach
(
function
(
item
){
var
url
=
item
;
if
(
!
/
(
^https
?
:
\/\/)
/i
.
test
(
url
)
&&
!
/
(
^www.
)
/i
.
test
(
item
))
url
=
baseUrl
+
item
;
var
value
=
_getPluginJson
(
url
);
var
url
=
item
,
value
=
_getPluginJson
(
url
);
value
.
baseUrl
=
url
.
substring
(
0
,
url
.
lastIndexOf
(
"
config.json
"
));
if
(
value
)
arr
.
push
(
value
);
});
if
(
arr
.
length
>
0
)
this
.
updatePluginsList
({
autoStartGuid
:
plugins
.
autoStartGuid
,
url
:
plugins
.
url
,
pluginsData
:
arr
},
!!
uiCustomize
);
},
...
...
@@ -1927,7 +1967,7 @@ define([
}
if
(
isSupported
&&
(
isEdit
||
itemVar
.
isViewer
))
{
var
isRelativeUrl
=
!
(
/
(
^https
?
:
\/\/)
/i
.
test
(
itemVar
.
url
)
||
/
(
^www.
)
/i
.
test
(
itemVar
.
url
));
item
.
isUICustomizer
?
arrUI
.
push
((
isRelativeUrl
)
?
(
(
item
.
baseUrl
?
item
.
baseUrl
:
plugins
.
url
)
+
itemVar
.
url
)
:
itemVar
.
url
)
:
item
.
isUICustomizer
?
arrUI
.
push
((
isRelativeUrl
)
?
(
item
.
baseUrl
+
itemVar
.
url
)
:
itemVar
.
url
)
:
variationsArr
.
push
(
new
Common
.
Models
.
PluginVariation
({
description
:
itemVar
.
description
,
index
:
variationsArr
.
length
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment