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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Amer
erp5
Commits
ff8fa162
Commit
ff8fa162
authored
Apr 10, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: refactoring on handle action gadget
parent
d97ff654
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
99 additions
and
125 deletions
+99
-125
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_create_document_html.html
...web_page_module/gadget_officejs_create_document_html.html
+1
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_create_document_html.xml
.../web_page_module/gadget_officejs_create_document_html.xml
+5
-5
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_create_document_js.js
...tem/web_page_module/gadget_officejs_create_document_js.js
+34
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_create_document_js.xml
...em/web_page_module/gadget_officejs_create_document_js.xml
+14
-8
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_appcache.xml
..._page_module/gadget_officejs_discussion_tool_appcache.xml
+4
-4
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_any_document_js.js
...dule/gadget_officejs_erp5_page_ojs_add_any_document_js.js
+0
-54
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_html.xml
...b_page_module/gadget_officejs_page_handle_action_html.xml
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
.../web_page_module/gadget_officejs_page_handle_action_js.js
+37
-49
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
...web_page_module/gadget_officejs_page_handle_action_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_
erp5_page_ojs_add_any
_document_html.html
→
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_
create
_document_html.html
View file @
ff8fa162
...
...
@@ -9,7 +9,7 @@
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_
erp5_page_ojs_add_any
_document.js"
></script>
<script
src=
"gadget_
officejs_create
_document.js"
></script>
</head>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_
erp5_page_ojs_add_any
_document_html.xml
→
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_
create
_document_html.xml
View file @
ff8fa162
...
...
@@ -87,7 +87,7 @@
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_
erp5_page_ojs_add_any
_document.html
</string>
</value>
<value>
<string>
gadget_
officejs_create
_document.html
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -97,7 +97,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_officejs_
erp5_page_ojs_add_any
_document_html
</string>
</value>
<value>
<string>
gadget_officejs_
create
_document_html
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
...
...
@@ -136,7 +136,7 @@
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
OfficeJS
Add Any
Document
</string>
</value>
<value>
<string>
OfficeJS
Create
Document
</string>
</value>
</item>
<item>
<key>
<string>
url_string
</string>
</key>
...
...
@@ -273,7 +273,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.6
0340.37429.26555
</string>
</value>
<value>
<string>
974.6
1745.63686.35191
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>
1554
833972.6
</float>
<float>
1554
915049.41
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_create_document_js.js
0 → 100644
View file @
ff8fa162
/*global window, rJS */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
createDocument
"
,
function
(
options
)
{
var
gadget
=
this
,
doc
=
{
title
:
"
Untitled Document
"
,
portal_type
:
options
.
portal_type
,
parent_relative_url
:
options
.
parent_relative_url
},
key
,
doc_key
,
doc_id
;
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
if
(
key
.
startsWith
(
"
my_
"
))
{
doc_key
=
key
.
replace
(
"
my_
"
,
""
);
doc
[
doc_key
]
=
options
[
key
];
}
}
}
return
gadget
.
jio_post
(
doc
);
});
//.declareMethod("render", function (options) { });
}(
window
,
rJS
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_
erp5_page_ojs_add_any
_document_js.xml
→
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_
create
_document_js.xml
View file @
ff8fa162
...
...
@@ -10,8 +10,11 @@
<key>
<string>
_Access_contents_information_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
...
...
@@ -49,8 +52,11 @@
<key>
<string>
_View_Permission
</string>
</key>
<value>
<tuple>
<string>
Anonymous
</string>
<string>
Assignee
</string>
<string>
Assignor
</string>
<string>
Associate
</string>
<string>
Auditor
</string>
<string>
Manager
</string>
</tuple>
</value>
...
...
@@ -77,7 +83,7 @@
</item>
<item>
<key>
<string>
default_reference
</string>
</key>
<value>
<string>
gadget_
erp5_page_ojs_add_any
_document.js
</string>
</value>
<value>
<string>
gadget_
officejs_create
_document.js
</string>
</value>
</item>
<item>
<key>
<string>
description
</string>
</key>
...
...
@@ -87,7 +93,7 @@
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
gadget_officejs_
erp5_page_ojs_add_any
_document_js
</string>
</value>
<value>
<string>
gadget_officejs_
create
_document_js
</string>
</value>
</item>
<item>
<key>
<string>
language
</string>
</key>
...
...
@@ -126,7 +132,7 @@
</item>
<item>
<key>
<string>
title
</string>
</key>
<value>
<string>
OfficeJS
Add Any
Document JS
</string>
</value>
<value>
<string>
OfficeJS
Create
Document JS
</string>
</value>
</item>
<item>
<key>
<string>
url_string
</string>
</key>
...
...
@@ -192,7 +198,7 @@
<dictionary>
<item>
<key>
<string>
action
</string>
</key>
<value>
<string>
hid
e
</string>
</value>
<value>
<string>
publish_aliv
e
</string>
</value>
</item>
<item>
<key>
<string>
actor
</string>
</key>
...
...
@@ -218,7 +224,7 @@
</tuple>
<state>
<tuple>
<float>
15549
03150.06
</float>
<float>
15549
12716.44
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
@@ -227,7 +233,7 @@
</item>
<item>
<key>
<string>
validation_state
</string>
</key>
<value>
<string>
hidden
</string>
</value>
<value>
<string>
published_alive
</string>
</value>
</item>
</dictionary>
</list>
...
...
@@ -263,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.6
0340.48045.57105
</string>
</value>
<value>
<string>
974.6
1769.15176.41096
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -281,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
1554
836734.22
</float>
<float>
1554
916400.71
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_discussion_tool_appcache.xml
View file @
ff8fa162
...
...
@@ -232,8 +232,8 @@ gadget_erp5_page_ojs_controller.html\n
gadget_erp5_page_ojs_controller.js\n
gadget_erp5_page_ojs_post_list.html\n
gadget_erp5_page_ojs_post_list.js\n
#gadget_erp5_page_ojs_add_any
_document.html\n
#gadget_erp5_page_ojs_add_any
_document.js\n
gadget_officejs_create
_document.html\n
gadget_officejs_create
_document.js\n
\n
#needed for appcachestorage sync\n
/\n
...
...
@@ -740,7 +740,7 @@ NETWORK:\n
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.6
0462.54910.6510
9
</string>
</value>
<value>
<string>
974.6
1748.30410.5329
9
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -758,7 +758,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>
15549
05710.65
</float>
<float>
15549
16428.12
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_erp5_page_ojs_add_any_document_js.js
deleted
100644 → 0
View file @
d97ff654
/*global window, rJS, RSVP */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
doc_id
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
)
]);
})
.
push
(
function
(
result
)
{
var
doc
=
{
title
:
"
Untitled Document
"
,
portal_type
:
result
[
0
],
parent_relative_url
:
result
[
1
]
},
key
,
doc_key
;
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
if
(
key
.
startsWith
(
"
my_
"
))
{
doc_key
=
key
.
replace
(
"
my_
"
,
""
);
doc
[
doc_key
]
=
options
[
key
];
}
}
}
return
gadget
.
jio_post
(
doc
);
})
.
push
(
function
(
id
)
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
id
,
editable
:
true
}
});
});
});
}(
window
,
rJS
,
RSVP
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_html.xml
View file @
ff8fa162
...
...
@@ -273,7 +273,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.
58750.16325.27204
</string>
</value>
<value>
<string>
974.
61695.23911.16588
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -291,7 +291,7 @@
</tuple>
<state>
<tuple>
<float>
1554
736092.72
</float>
<float>
1554
912040.86
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.js
View file @
ff8fa162
...
...
@@ -21,36 +21,28 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
,
action_reference
;
action_reference
,
gadget_script
;
return
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlParameter
(
"
action
"
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
)
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
declareGadget
(
"
gadget_officejs_create_document.html
"
)
]);
})
.
push
(
function
(
result
)
{
action_reference
=
result
[
0
];
// This is the custom code to handle each specific action
// TODO: move to specific gadgets by name? e.g. page: "action_" + portal_type + action_ref
if
(
action_reference
===
"
new_post
"
)
{
//TODO refactor doc creation to be reused by other actions (e.g. reply action)
// move to a js script?
var
doc
=
{
title
:
"
Untitled Document
"
,
portal_type
:
result
[
1
],
parent_relative_url
:
result
[
2
]
},
key
,
doc_key
;
for
(
key
in
options
)
{
if
(
options
.
hasOwnProperty
(
key
))
{
if
(
key
.
startsWith
(
"
my_
"
))
{
doc_key
=
key
.
replace
(
"
my_
"
,
""
);
doc
[
doc_key
]
=
options
[
key
];
}
}
}
return
gadget
.
jio_post
(
doc
)
.
push
(
function
(
result
)
{
var
portal_type
=
result
[
1
],
parent_relative_url
=
result
[
2
];
action_reference
=
result
[
0
];
gadget_script
=
result
[
3
];
// This is the custom code to handle each specific action
// TODO: move to specific gadgets by name? e.g. page: "action_" + portal_type + action_ref
if
(
action_reference
===
"
new_post
"
)
{
options
.
portal_type
=
portal_type
;
options
.
parent_relative_url
=
parent_relative_url
;
return
gadget_script
.
createDocument
(
options
)
.
push
(
function
(
id
)
{
return
gadget
.
redirect
({
command
:
'
display
'
,
...
...
@@ -60,36 +52,32 @@
}
});
});
}
if
(
action_reference
==
"
reply
"
)
{
return
gadget
.
jio_get
(
options
.
jio_key
)
}
if
(
action_reference
=
==
"
reply
"
)
{
return
gadget
.
jio_get
(
options
.
jio_key
)
.
push
(
function
(
document
)
{
var
doc
,
title
=
document
.
title
;
var
title
=
document
.
title
;
if
(
!
title
.
startsWith
(
"
Re:
"
))
{
title
=
"
Re:
"
+
document
.
title
;
}
doc
=
{
title
:
title
,
//thread parent: same as base post
source_reference
:
document
.
source_reference
,
portal_type
:
document
.
portal_type
,
parent_relative_url
:
document
.
parent_relative_url
};
return
gadget
.
jio_post
(
doc
)
.
push
(
function
(
id
)
{
return
gadget
.
redirect
({
command
:
"
change
"
,
options
:
{
page
:
undefined
,
jio_key
:
id
,
view
:
action_reference
}
});
});
options
.
portal_type
=
document
.
portal_type
;
options
.
parent_relative_url
=
document
.
parent_relative_url
;
options
.
my_title
=
title
;
options
.
my_source_reference
=
document
.
source_reference
;
return
gadget_script
.
createDocument
(
options
);
})
.
push
(
function
(
id
)
{
return
gadget
.
redirect
({
command
:
"
change
"
,
options
:
{
page
:
undefined
,
jio_key
:
id
,
view
:
action_reference
}
});
});
}
else
{
throw
"
Action
"
+
action_reference
+
"
not implemented yet
"
;
}
});
}
throw
"
Action
"
+
action_reference
+
"
not implemented yet
"
;
});
});
}(
window
,
rJS
,
RSVP
));
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_handle_action_js.xml
View file @
ff8fa162
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
974.61
589.61140.4744
</string>
</value>
<value>
<string>
974.61
766.59384.31590
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
15549
05840.9
4
</float>
<float>
15549
16263.2
4
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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