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
alecs_myu
erp5
Commits
afa76a0e
Commit
afa76a0e
authored
May 15, 2018
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_officejs] Add download and export gadgets
parent
893e6ce9
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
1624 additions
and
0 deletions
+1624
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_html.html
...odule/ojs_gadget_erp5_page_ojs_download_convert_html.html
+25
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_html.xml
...module/ojs_gadget_erp5_page_ojs_download_convert_html.xml
+328
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.js
...ge_module/ojs_gadget_erp5_page_ojs_download_convert_js.js
+130
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.xml
...e_module/ojs_gadget_erp5_page_ojs_download_convert_js.xml
+330
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_html.html
..._module/ojs_gadget_erp5_page_ojs_upload_convert_html.html
+25
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_html.xml
...e_module/ojs_gadget_erp5_page_ojs_upload_convert_html.xml
+328
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.js
...page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.js
+130
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.xml
...age_module/ojs_gadget_erp5_page_ojs_upload_convert_js.xml
+328
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_html.html
0 → 100644
View file @
afa76a0e
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Gadget OnlyOffice Upload
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_erp5_page_ojs_download_convert.js"
></script>
</head>
<body>
<form
class=
"save_form ui-body-c"
novalidate
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
<div
data-gadget-url=
"gadget_erp5_pt_form_dialog.html"
data-gadget-scope=
"form_view"
data-gadget-sandbox=
"public"
>
</div>
</form>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_html.xml
0 → 100644
View file @
afa76a0e
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.js
0 → 100644
View file @
afa76a0e
/*global window, rJS, RSVP, jIO, document, URL */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
jIO
,
document
,
URL
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
jio_getAttachment
"
,
"
jio_getAttachment
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
notifySubmitted
"
,
'
notifySubmitted
'
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
'
upload_extension
'
),
gadget
.
getSetting
(
'
file_extension
'
)
]);
})
.
push
(
function
(
result
)
{
return
gadget
.
changeState
({
jio_key
:
options
.
jio_key
,
upload_extension
:
result
[
0
],
file_extension
:
result
[
1
]
});
});
})
.
onStateChange
(
function
()
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
'
form_view
'
)
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
_actions
"
:
{
"
put
"
:
{}},
"
form_id
"
:
{},
"
dialog_id
"
:
{},
"
my_format
"
:
{
"
title
"
:
"
Format
"
,
"
default
"
:
gadget
.
state
.
upload_extension
,
"
key
"
:
"
format
"
,
"
first_item
"
:
0
,
"
items
"
:
[
gadget
.
state
.
upload_extension
],
"
editable
"
:
1
,
"
type
"
:
"
ListField
"
}
}},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}
},
form_definition
:
{
title
:
"
Download
"
,
group_list
:
[[
"
center
"
,
[[
"
my_format
"
]]
]]
}
});
})
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getUrlFor
({
command
:
'
history_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_previous
'
}),
gadget
.
getUrlFor
({
command
:
'
selection_next
'
})
]);
})
.
push
(
function
(
url_list
)
{
return
gadget
.
updateHeader
({
page_title
:
"
Download File
"
,
selection_url
:
url_list
[
0
],
previous_url
:
url_list
[
1
],
next_url
:
url_list
[
2
]
});
});
})
.
allowPublicAcquisition
(
'
jio_putAttachment
'
,
function
()
{
var
gadget
=
this
,
format
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
getContent
();
})
.
push
(
function
(
content
)
{
format
=
content
.
format
;
return
RSVP
.
all
([
gadget
.
jio_getAttachment
(
gadget
.
state
.
jio_key
,
'
data?
'
+
format
),
gadget
.
jio_get
(
gadget
.
state
.
jio_key
)
]);
})
.
push
(
function
(
result
)
{
var
a
=
document
.
createElement
(
'
a
'
),
url
=
URL
.
createObjectURL
(
result
[
0
]);
a
.
href
=
url
;
a
.
download
=
result
[
1
].
filename
.
split
(
gadget
.
state
.
file_extension
)[
0
]
+
format
;
gadget
.
element
.
appendChild
(
a
);
a
.
click
();
gadget
.
element
.
removeChild
(
a
);
URL
.
revokeObjectURL
(
url
);
return
gadget
.
notifySubmitted
();
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
"
display
"
,
options
:
{
jio_key
:
gadget
.
state
.
jio_key
}
});
});
});
}(
window
,
rJS
,
RSVP
,
jIO
,
document
,
URL
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.xml
0 → 100644
View file @
afa76a0e
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_html.html
0 → 100644
View file @
afa76a0e
<!doctype html>
<html>
<head>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<title>
Gadget OnlyOffice Upload
</title>
<script
src=
"rsvp.js"
></script>
<script
src=
"renderjs.js"
></script>
<script
src=
"gadget_erp5_page_ojs_upload_convert.js"
></script>
</head>
<body>
<form
class=
"save_form ui-body-c"
novalidate
>
<button
type=
"submit"
class=
"ui-btn ui-btn-b ui-btn-inline
ui-icon-edit ui-btn-icon-right ui-screen-hidden"
></button>
<div
data-gadget-url=
"gadget_erp5_pt_form_dialog.html"
data-gadget-scope=
"form_view"
data-gadget-sandbox=
"public"
>
</div>
</form>
</body>
</html>
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_html.xml
0 → 100644
View file @
afa76a0e
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.js
0 → 100644
View file @
afa76a0e
/*global window, rJS, RSVP, jIO */
/*jslint nomen: true, indent: 2, maxerr: 3 */
(
function
(
window
,
rJS
,
RSVP
,
jIO
)
{
"
use strict
"
;
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
notifySubmitting
"
,
"
notifySubmitting
"
)
.
declareAcquiredMethod
(
"
jio_post
"
,
"
jio_post
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_putAttachment
"
,
"
jio_putAttachment
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
'
jio_putAttachment
'
,
function
()
{
var
gadget
=
this
,
file_name
,
jio_key
,
data
,
format
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
return
gadget
.
getDeclaredGadget
(
'
form_view
'
);
})
.
push
(
function
(
form_gadget
)
{
return
RSVP
.
all
([
form_gadget
.
getContent
(),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
content_type
'
)
]);
})
.
push
(
function
(
result
)
{
format
=
result
[
0
].
format
;
file_name
=
result
[
0
].
file
.
file_name
.
split
(
format
)[
0
];
data
=
jIO
.
util
.
dataURItoBlob
(
result
[
0
].
file
.
url
);
return
gadget
.
jio_post
({
title
:
file_name
,
portal_type
:
result
[
1
],
content_type
:
result
[
2
],
filename
:
file_name
});
})
.
push
(
function
(
doc_id
)
{
jio_key
=
doc_id
;
return
gadget
.
jio_putAttachment
(
jio_key
,
"
data?
"
+
format
,
data
);
})
.
push
(
function
()
{
return
gadget
.
redirect
({
command
:
'
display
'
,
options
:
{
jio_key
:
jio_key
}});
});
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
return
this
.
element
.
querySelector
(
'
button[type="submit"]
'
).
click
();
})
.
declareMethod
(
"
render
"
,
function
()
{
var
gadget
=
this
;
return
gadget
.
getSetting
(
'
upload_extension
'
)
.
push
(
function
(
upload_extension
)
{
return
gadget
.
changeState
({
upload_extension
:
upload_extension
});
});
})
.
onStateChange
(
function
()
{
var
gadget
=
this
;
return
gadget
.
getDeclaredGadget
(
'
form_view
'
)
.
push
(
function
(
form_gadget
)
{
return
form_gadget
.
render
({
erp5_document
:
{
"
_embedded
"
:
{
"
_view
"
:
{
"
_actions
"
:
{
"
put
"
:
{}},
"
form_id
"
:
{},
"
dialog_id
"
:
{},
"
my_file
"
:
{
"
description
"
:
""
,
"
title
"
:
"
File
"
,
"
default
"
:
""
,
"
css_class
"
:
""
,
"
required
"
:
1
,
"
editable
"
:
1
,
"
key
"
:
"
file
"
,
"
hidden
"
:
0
,
"
type
"
:
"
FileField
"
},
"
my_format
"
:
{
"
title
"
:
"
Format
"
,
"
default
"
:
gadget
.
state
.
upload_extension
,
"
key
"
:
"
format
"
,
"
first_item
"
:
0
,
"
items
"
:
[
gadget
.
state
.
upload_extension
],
"
editable
"
:
1
,
"
type
"
:
"
ListField
"
}
}},
"
_links
"
:
{
"
type
"
:
{
// form_list display portal_type in header
name
:
""
}
}
},
form_definition
:
{
title
:
"
Upload
"
,
group_list
:
[[
"
center
"
,
[[
"
my_file
"
],
[
"
my_format
"
]]
]]
}
});
})
.
push
(
function
()
{
return
gadget
.
getUrlFor
({
command
:
'
display
'
,
options
:
{
page
:
'
ojs_document_list
'
}});
})
.
push
(
function
(
url
)
{
return
gadget
.
updateHeader
({
page_title
:
"
Upload File
"
,
selection_url
:
url
});
});
});
}(
window
,
rJS
,
RSVP
,
jIO
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.xml
0 → 100644
View file @
afa76a0e
This diff is collapsed.
Click to expand it.
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