Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
40e6c158
Commit
40e6c158
authored
Jul 25, 2016
by
Boris Kocherov
Committed by
Boris Kocherov
Nov 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs_ooffice: integrate jio inside ooffice
parent
74302ba0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
215 additions
and
192 deletions
+215
-192
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_spreadsheet_view_js.js
...eb_page_module/gadget_officejs_jio_spreadsheet_view_js.js
+26
-8
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/ooffice_gadget_ooffice_js.js
...TemplateItem/web_page_module/ooffice_gadget_ooffice_js.js
+189
-184
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_spreadsheet_view_js.js
View file @
40e6c158
...
...
@@ -2,6 +2,12 @@
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
,
document
,
RSVP
,
rJS
,
Handlebars
,
loopEventListener
)
{
"
use strict
"
;
function
this_func_link
(
name
)
{
return
function
()
{
return
this
[
name
].
apply
(
this
,
arguments
[
0
]);
};
}
function
saveContent
(
gadget
,
submit_event
)
{
var
i
,
...
...
@@ -22,7 +28,7 @@
})
.
push
(
function
(
data
)
{
doc
.
data
=
data
.
text_content
;
return
gadget
.
put
(
gadget
.
options
.
jio_key
,
doc
);
return
gadget
.
jio_
put
(
gadget
.
options
.
jio_key
,
doc
);
});
}
...
...
@@ -96,11 +102,17 @@
})
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
translateHtml
"
,
"
translateHtml
"
)
.
declareAcquiredMethod
(
"
put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
'
allDocs
'
,
'
jio_allDocs
'
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
allowPublicAcquisition
(
"
jio_get
"
,
this_func_link
(
"
jio_get
"
))
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
allowPublicAcquisition
(
"
jio_put
"
,
this_func_link
(
"
jio_put
"
))
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
allowPublicAcquisition
(
"
jio_getAttachment
"
,
this_func_link
(
"
jio_getAttachment
"
))
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
allowPublicAcquisition
(
"
jio_putAttachment
"
,
function
(
jio_key
,
part_name
,
blob
){
this
.
jio_putAttachment
(
jio_key
,
part_name
,
new
Blob
());
})
.
allowPublicAcquisition
(
'
setFillStyle
'
,
function
()
{
return
setFillStyle
(
this
);
...
...
@@ -183,14 +195,20 @@
text_gadget
=
text_content_gadget
;
gadget
.
setFillStyle
();
// switchMaximizeMode(gadget);
return
text_content_gadget
;
})
.
push
(
function
(
text_content_gadget
)
{
console
.
log
(
'
prerender
'
);
return
text_content_gadget
.
render
({
"
key
"
:
'
text_content
'
,
"
value
"
:
gadget
.
options
.
doc
.
data
,
"
portal_type
"
:
gadget
.
options
.
doc
.
portal_type
"
jio_key
"
:
gadget
.
options
.
jio_key
});
})
.
push
(
function
()
{
console
.
log
(
'
getelement
'
);
return
text_gadget
.
getElement
();
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
'
render subgadget error:
'
+
error
);
});
})
...
...
bt5/erp5_officejs_ooffice/PathTemplateItem/web_page_module/ooffice_gadget_ooffice_js.js
View file @
40e6c158
...
...
@@ -8,20 +8,29 @@ if (Common === undefined) {
rJS
(
window
)
.
ready
(
function
(
g
)
{
console
.
log
(
'
gadget_ooffice.js ready 1
'
);
g
.
props
=
{
save_defer
:
null
,
handlers
:
{}
};
})
.
ready
(
function
(
g
)
{
console
.
log
(
'
gadget_ooffice.js ready 2
'
);
return
g
.
getElement
()
.
push
(
function
(
element
)
{
console
.
log
(
'
gadget_ooffice.js ready 3
'
);
g
.
props
.
element
=
element
;
return
{};
});
})
.
declareAcquiredMethod
(
"
triggerSubmit
"
,
"
triggerSubmit
"
)
.
declareAcquiredMethod
(
"
triggerMaximize
"
,
"
triggerMaximize
"
)
.
declareAcquiredMethod
(
"
setFillStyle
"
,
"
setFillStyle
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
// methods emulating Gateway used for connection with ooffice begin.
.
declareMethod
(
'
ready
'
,
function
()
{
...
...
@@ -42,10 +51,11 @@ if (Common === undefined) {
});
g
.
props
.
handlers
.
opendocument
({
doc
:
{
title
:
g
.
props
.
title
,
key
:
g
.
props
.
jio_key
,
title
:
g
.
props
.
doc
.
title
||
""
,
//fileType: undefined,
//vkey: undefined,
data
:
g
.
props
.
value
,
data
:
g
.
props
.
doc
.
data
,
permissions
:
{
edit
:
true
,
download
:
true
,
...
...
@@ -69,7 +79,7 @@ if (Common === undefined) {
if
(
g
.
props
.
save_defer
===
null
)
{
g
.
triggerSubmit
();
}
else
{
result
[
g
.
props
.
key
]
=
url
;
;
result
[
g
.
props
.
key
]
=
url
;
g
.
props
.
save_defer
.
resolve
(
result
);
g
.
props
.
save_defer
=
null
;
}
...
...
@@ -85,27 +95,17 @@ if (Common === undefined) {
message
:
""
});
})
.
declareMethod
(
'
requestHistory
'
,
function
()
{
})
.
declareMethod
(
'
requestHistoryData
'
,
function
(
revision
)
{
})
.
declareMethod
(
'
requestHistoryClose
'
,
function
()
{
})
.
declareMethod
(
'
requestHistory
'
,
function
()
{})
.
declareMethod
(
'
requestHistoryData
'
,
function
(
revision
)
{})
.
declareMethod
(
'
requestHistoryClose
'
,
function
()
{})
.
declareMethod
(
'
reportError
'
,
function
(
code
,
description
)
{
console
.
log
([
'
reportError
'
,
code
,
description
])
})
.
declareMethod
(
'
setDocumentModified
'
,
function
(
modified
)
{
console
.
log
([
'
reportError
'
,
code
,
description
]);
})
.
declareMethod
(
'
setDocumentModified
'
,
function
(
modified
)
{})
.
declareMethod
(
'
internalMessage
'
,
function
(
event_name
,
data
)
{
console
.
log
([
'
internalMessage
'
,
event_name
,
data
])
})
.
declareMethod
(
'
updateVersion
'
,
function
()
{
console
.
log
([
'
internalMessage
'
,
event_name
,
data
]);
})
.
declareMethod
(
'
updateVersion
'
,
function
()
{})
.
declareMethod
(
'
on
'
,
function
(
event_name
,
handler
)
{
var
g
=
this
;
g
.
props
.
handlers
[
event_name
]
=
handler
;
...
...
@@ -113,31 +113,32 @@ if (Common === undefined) {
// methods emulating Gateway used for connection with ooffice end.
.
declareMethod
(
'
render
'
,
function
(
options
)
{
var
g
=
this
,
documentType
,
magic_to_format_map
=
{
'
DOCY;
'
:
'
text
'
,
'
XLSY;
'
:
'
spreadsheet
'
,
'
PPTY;
'
:
'
presentation
'
};
if
(
options
.
value
===
undefined
)
{
documentType
=
options
.
portal_type
;
g
.
props
.
value
=
''
;
}
else
{
documentType
=
magic_to_format_map
[
options
.
value
.
substring
(
0
,
5
)];
if
(
documentType
===
undefined
)
{
g
.
props
.
element
.
getElementsByClassName
(
placeholder
)[
0
]
.
textContent
=
options
.
value
;
return
{};
}
g
.
props
.
value
=
options
.
value
;
}
g
.
props
.
title
=
options
.
title
;
g
.
props
.
key
=
options
.
key
||
"
text_content
"
;
return
g
.
setFillStyle
()
console
.
log
(
'
begin render
'
);
var
g
=
this
;
g
.
props
.
jio_key
=
options
.
jio_key
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
g
.
jio_get
(
options
.
jio_key
);
})
.
push
(
function
(
doc
)
{
var
magic_to_format_map
=
{
'
DOCY;
'
:
'
text
'
,
'
XLSY;
'
:
'
spreadsheet
'
,
'
PPTY;
'
:
'
presentation
'
};
g
.
props
.
doc
=
doc
;
if
(
doc
.
data
===
undefined
)
{
g
.
props
.
documentType
=
doc
.
portal_type
.
toLowerCase
();
}
else
{
g
.
props
.
documentType
=
magic_to_format_map
[
doc
.
data
.
substring
(
0
,
5
)];
if
(
g
.
props
.
documentType
===
undefined
)
{
return
{};
}
}
g
.
props
.
key
=
options
.
key
||
"
text_content
"
;
return
g
.
setFillStyle
();
})
.
push
(
function
(
size
)
{
var
element
=
g
.
props
.
element
,
sdkPath
,
...
...
@@ -147,72 +148,72 @@ if (Common === undefined) {
element
.
style
.
height
=
size
.
height
;
element
.
style
.
width
=
size
.
width
;
// g.fullscreen();
switch
(
documentType
)
{
case
'
spreadsheet
'
:
sdkPath
=
'
Excel
'
;
nameSpace
=
"
SSE
"
;
backboneControllers
=
[
"
Viewport
"
,
"
DocumentHolder
"
,
"
CellEditor
"
,
"
FormulaDialog
"
,
"
Print
"
,
"
Toolbar
"
,
"
Statusbar
"
,
"
RightMenu
"
,
"
LeftMenu
"
,
"
Main
"
,
"
Common.Controllers.Fonts
"
,
"
Common.Controllers.Chat
"
,
"
Common.Controllers.Comments
"
];
styles
=
[
// sdk changed to sdk/Excel/sdk-all
"
css!sdk/../css/main.css
"
,
"
css!spreadsheeteditor/main/resources/css/app.css
"
];
break
;
case
'
text
'
:
sdkPath
=
'
Word
'
;
nameSpace
=
"
DE
"
;
backboneControllers
=
[
"
Viewport
"
,
"
DocumentHolder
"
,
"
Toolbar
"
,
"
Statusbar
"
,
"
RightMenu
"
,
"
LeftMenu
"
,
"
Main
"
,
"
Common.Controllers.Fonts
"
,
"
Common.Controllers.History
"
,
"
Common.Controllers.Chat
"
,
"
Common.Controllers.Comments
"
,
"
Common.Controllers.ExternalDiagramEditor
"
];
styles
=
[
"
css!documenteditor/main/resources/css/app.css
"
];
break
;
case
'
presentation
'
:
sdkPath
=
'
PowerPoint
'
;
nameSpace
=
"
PE
"
;
backboneControllers
=
[
"
Viewport
"
,
"
DocumentHolder
"
,
"
Toolbar
"
,
"
Statusbar
"
,
"
RightMenu
"
,
"
LeftMenu
"
,
"
Main
"
,
"
Common.Controllers.Fonts
"
,
"
Common.Controllers.Chat
"
,
"
Common.Controllers.Comments
"
,
"
Common.Controllers.ExternalDiagramEditor
"
];
styles
=
[
"
css!presentationeditor/main/resources/css/app.css
"
];
break
;
switch
(
g
.
props
.
documentType
)
{
case
'
spreadsheet
'
:
sdkPath
=
'
Excel
'
;
nameSpace
=
"
SSE
"
;
backboneControllers
=
[
"
Viewport
"
,
"
DocumentHolder
"
,
"
CellEditor
"
,
"
FormulaDialog
"
,
"
Print
"
,
"
Toolbar
"
,
"
Statusbar
"
,
"
RightMenu
"
,
"
LeftMenu
"
,
"
Main
"
,
"
Common.Controllers.Fonts
"
,
"
Common.Controllers.Chat
"
,
"
Common.Controllers.Comments
"
];
styles
=
[
// sdk changed to sdk/Excel/sdk-all
"
css!sdk/../css/main.css
"
,
"
css!spreadsheeteditor/main/resources/css/app.css
"
];
break
;
case
'
text
'
:
sdkPath
=
'
Word
'
;
nameSpace
=
"
DE
"
;
backboneControllers
=
[
"
Viewport
"
,
"
DocumentHolder
"
,
"
Toolbar
"
,
"
Statusbar
"
,
"
RightMenu
"
,
"
LeftMenu
"
,
"
Main
"
,
"
Common.Controllers.Fonts
"
,
"
Common.Controllers.History
"
,
"
Common.Controllers.Chat
"
,
"
Common.Controllers.Comments
"
,
"
Common.Controllers.ExternalDiagramEditor
"
];
styles
=
[
"
css!documenteditor/main/resources/css/app.css
"
];
break
;
case
'
presentation
'
:
sdkPath
=
'
PowerPoint
'
;
nameSpace
=
"
PE
"
;
backboneControllers
=
[
"
Viewport
"
,
"
DocumentHolder
"
,
"
Toolbar
"
,
"
Statusbar
"
,
"
RightMenu
"
,
"
LeftMenu
"
,
"
Main
"
,
"
Common.Controllers.Fonts
"
,
"
Common.Controllers.Chat
"
,
"
Common.Controllers.Comments
"
,
"
Common.Controllers.ExternalDiagramEditor
"
];
styles
=
[
"
css!presentationeditor/main/resources/css/app.css
"
];
break
;
}
Common
.
Gateway
=
g
;
...
...
@@ -279,85 +280,89 @@ if (Common === undefined) {
controllers
:
backboneControllers
});
Common
.
Locale
.
apply
();
switch
(
documentType
)
{
case
'
spreadsheet
'
:
require
([
"
spreadsheeteditor/main/app/controller/Viewport
"
,
"
spreadsheeteditor/main/app/controller/DocumentHolder
"
,
"
spreadsheeteditor/main/app/controller/CellEditor
"
,
"
spreadsheeteditor/main/app/controller/Toolbar
"
,
"
spreadsheeteditor/main/app/controller/Statusbar
"
,
"
spreadsheeteditor/main/app/controller/RightMenu
"
,
"
spreadsheeteditor/main/app/controller/LeftMenu
"
,
"
spreadsheeteditor/main/app/controller/Main
"
,
"
spreadsheeteditor/main/app/controller/Print
"
,
"
spreadsheeteditor/main/app/view/ParagraphSettings
"
,
"
spreadsheeteditor/main/app/view/ImageSettings
"
,
"
spreadsheeteditor/main/app/view/ChartSettings
"
,
"
spreadsheeteditor/main/app/view/ShapeSettings
"
,
"
common/main/lib/util/utils
"
,
"
common/main/lib/controller/Fonts
"
,
"
common/main/lib/controller/Comments
"
,
"
common/main/lib/controller/Chat
"
],
function
()
{
app
.
start
();
});
break
;
case
'
text
'
:
require
([
"
documenteditor/main/app/controller/Viewport
"
,
"
documenteditor/main/app/controller/DocumentHolder
"
,
"
documenteditor/main/app/controller/Toolbar
"
,
"
documenteditor/main/app/controller/Statusbar
"
,
"
documenteditor/main/app/controller/RightMenu
"
,
"
documenteditor/main/app/controller/LeftMenu
"
,
"
documenteditor/main/app/controller/Main
"
,
"
documenteditor/main/app/view/ParagraphSettings
"
,
"
documenteditor/main/app/view/HeaderFooterSettings
"
,
"
documenteditor/main/app/view/ImageSettings
"
,
"
documenteditor/main/app/view/TableSettings
"
,
"
documenteditor/main/app/view/ShapeSettings
"
,
"
common/main/lib/util/utils
"
,
"
common/main/lib/controller/Fonts
"
,
"
common/main/lib/controller/History
"
,
"
common/main/lib/controller/Comments
"
,
"
common/main/lib/controller/Chat
"
,
"
documenteditor/main/app/view/ChartSettings
"
,
"
common/main/lib/controller/ExternalDiagramEditor
"
],
function
()
{
app
.
start
();
});
break
;
case
'
presentation
'
:
require
([
"
presentationeditor/main/app/controller/Viewport
"
,
"
presentationeditor/main/app/controller/DocumentHolder
"
,
"
presentationeditor/main/app/controller/Toolbar
"
,
"
presentationeditor/main/app/controller/Statusbar
"
,
"
presentationeditor/main/app/controller/RightMenu
"
,
"
presentationeditor/main/app/controller/LeftMenu
"
,
"
presentationeditor/main/app/controller/Main
"
,
"
presentationeditor/main/app/view/ParagraphSettings
"
,
"
presentationeditor/main/app/view/ImageSettings
"
,
"
presentationeditor/main/app/view/ShapeSettings
"
,
"
presentationeditor/main/app/view/SlideSettings
"
,
"
presentationeditor/main/app/view/TableSettings
"
,
"
common/main/lib/util/utils
"
,
"
common/main/lib/controller/Fonts
"
,
"
common/main/lib/controller/Comments
"
,
"
common/main/lib/controller/Chat
"
,
"
presentationeditor/main/app/view/ChartSettings
"
,
"
common/main/lib/controller/ExternalDiagramEditor
"
],
function
()
{
app
.
start
();
});
break
;
switch
(
g
.
props
.
documentType
)
{
case
'
spreadsheet
'
:
require
([
"
spreadsheeteditor/main/app/controller/Viewport
"
,
"
spreadsheeteditor/main/app/controller/DocumentHolder
"
,
"
spreadsheeteditor/main/app/controller/CellEditor
"
,
"
spreadsheeteditor/main/app/controller/Toolbar
"
,
"
spreadsheeteditor/main/app/controller/Statusbar
"
,
"
spreadsheeteditor/main/app/controller/RightMenu
"
,
"
spreadsheeteditor/main/app/controller/LeftMenu
"
,
"
spreadsheeteditor/main/app/controller/Main
"
,
"
spreadsheeteditor/main/app/controller/Print
"
,
"
spreadsheeteditor/main/app/view/ParagraphSettings
"
,
"
spreadsheeteditor/main/app/view/ImageSettings
"
,
"
spreadsheeteditor/main/app/view/ChartSettings
"
,
"
spreadsheeteditor/main/app/view/ShapeSettings
"
,
"
common/main/lib/util/utils
"
,
"
common/main/lib/controller/Fonts
"
,
"
common/main/lib/controller/Comments
"
,
"
common/main/lib/controller/Chat
"
],
function
()
{
app
.
start
();
});
break
;
case
'
text
'
:
require
([
"
documenteditor/main/app/controller/Viewport
"
,
"
documenteditor/main/app/controller/DocumentHolder
"
,
"
documenteditor/main/app/controller/Toolbar
"
,
"
documenteditor/main/app/controller/Statusbar
"
,
"
documenteditor/main/app/controller/RightMenu
"
,
"
documenteditor/main/app/controller/LeftMenu
"
,
"
documenteditor/main/app/controller/Main
"
,
"
documenteditor/main/app/view/ParagraphSettings
"
,
"
documenteditor/main/app/view/HeaderFooterSettings
"
,
"
documenteditor/main/app/view/ImageSettings
"
,
"
documenteditor/main/app/view/TableSettings
"
,
"
documenteditor/main/app/view/ShapeSettings
"
,
"
common/main/lib/util/utils
"
,
"
common/main/lib/controller/Fonts
"
,
"
common/main/lib/controller/History
"
,
"
common/main/lib/controller/Comments
"
,
"
common/main/lib/controller/Chat
"
,
"
documenteditor/main/app/view/ChartSettings
"
,
"
common/main/lib/controller/ExternalDiagramEditor
"
],
function
()
{
app
.
start
();
});
break
;
case
'
presentation
'
:
require
([
"
presentationeditor/main/app/controller/Viewport
"
,
"
presentationeditor/main/app/controller/DocumentHolder
"
,
"
presentationeditor/main/app/controller/Toolbar
"
,
"
presentationeditor/main/app/controller/Statusbar
"
,
"
presentationeditor/main/app/controller/RightMenu
"
,
"
presentationeditor/main/app/controller/LeftMenu
"
,
"
presentationeditor/main/app/controller/Main
"
,
"
presentationeditor/main/app/view/ParagraphSettings
"
,
"
presentationeditor/main/app/view/ImageSettings
"
,
"
presentationeditor/main/app/view/ShapeSettings
"
,
"
presentationeditor/main/app/view/SlideSettings
"
,
"
presentationeditor/main/app/view/TableSettings
"
,
"
common/main/lib/util/utils
"
,
"
common/main/lib/controller/Fonts
"
,
"
common/main/lib/controller/Comments
"
,
"
common/main/lib/controller/Chat
"
,
"
presentationeditor/main/app/view/ChartSettings
"
,
"
common/main/lib/controller/ExternalDiagramEditor
"
],
function
()
{
app
.
start
();
});
break
;
}
});
return
{};
})
.
push
(
undefined
,
function
(
error
)
{
console
.
log
(
'
gadget_ooffice.js redner error:
'
+
error
);
});
})
.
declareMethod
(
'
getContent
'
,
function
()
{
var
g
=
this
;
g
.
props
.
save_defer
=
RSVP
.
defer
();
...
...
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