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
Klaus Wölfel
erp5
Commits
ceb47fef
Commit
ceb47fef
authored
Sep 27, 2019
by
Roque
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: form view generic without only office
parent
d5cc854b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
90 deletions
+1
-90
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
...plateItem/web_page_module/gadget_officejs_form_view_js.js
+1
-90
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_form_view_js.js
View file @
ceb47fef
...
@@ -85,59 +85,6 @@
...
@@ -85,59 +85,6 @@
return
form_json
;
return
form_json
;
}
}
//TODO this should be in a custom view
//use: portal_type_dict.custom_view_gadget (handled by controller gadget)
function
renderOnlyOffice
(
gadget
,
options
,
portal_type_dict
,
state_dict
)
{
//TODO doc should come with filename. for now hardcoded if undefined
//get format extension from portal_type_dict
if
(
!
options
.
doc
.
filename
)
{
options
.
doc
.
filename
=
"
default.docx
"
;
}
state_dict
.
mime_type
=
portal_type_dict
.
file_extension
;
state_dict
.
only_office
=
true
;
if
(
options
.
doc
.
action
)
{
return
gadget
.
changeState
(
state_dict
);
}
state_dict
.
content_editable
=
options
.
doc
.
content_type
===
undefined
||
options
.
doc
.
content_type
.
indexOf
(
"
application/x-asc
"
)
===
0
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
!
state_dict
.
content_editable
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
"
data
"
);
}
return
gadget
.
declareGadget
(
"
gadget_ojs_cloudooo.html
"
)
.
push
(
function
(
ojs_cloudooo
)
{
return
ojs_cloudooo
.
getConvertedBlob
({
jio_key
:
options
.
jio_key
,
format
:
state_dict
.
mime_type
,
filename
:
options
.
doc
.
filename
});
});
})
.
push
(
undefined
,
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
404
)
{
return
new
Blob
();
}
throw
error
;
})
.
push
(
function
(
blob
)
{
if
(
state_dict
.
content_editable
)
{
return
jIO
.
util
.
readBlobAsDataURL
(
blob
);
}
return
jIO
.
util
.
readBlobAsText
(
blob
);
})
.
push
(
function
(
result
)
{
state_dict
.
data
=
result
.
target
.
result
;
if
(
portal_type_dict
.
blob_type
)
{
state_dict
.
blob_type
=
portal_type_dict
.
blob_type
;
}
else
{
state_dict
.
blob_type
=
"
ooffice
"
;
}
return
gadget
.
changeState
(
state_dict
);
});
}
function
handleSubmit
(
gadget
,
child_gadget
,
content_dict
)
{
function
handleSubmit
(
gadget
,
child_gadget
,
content_dict
)
{
var
data
,
name_list
;
var
data
,
name_list
;
return
gadget
.
notifySubmitting
()
return
gadget
.
notifySubmitting
()
...
@@ -146,19 +93,6 @@
...
@@ -146,19 +93,6 @@
//submit doc metadata
//submit doc metadata
data
=
content_dict
.
text_content
;
data
=
content_dict
.
text_content
;
delete
content_dict
.
text_content
;
delete
content_dict
.
text_content
;
//TODO this should be in a custom view
//use: portal_type_dict.custom_view_gadget
//ONLY OFFICE
if
(
gadget
.
state
.
only_office
)
{
name_list
=
gadget
.
state
.
doc
.
filename
.
split
(
'
.
'
);
if
(
name_list
.
pop
()
!==
gadget
.
state
.
mime_type
)
{
name_list
.
push
(
gadget
.
state
.
mime_type
);
content_dict
.
filename
=
name_list
.
join
(
'
.
'
);
}
content_dict
.
content_type
=
gadget
.
state
.
blob_type
;
}
//
}
}
return
child_gadget
.
submitContent
(
return
child_gadget
.
submitContent
(
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
child_gadget
.
state
.
jio_key
,
undefined
,
content_dict
...
@@ -169,26 +103,7 @@
...
@@ -169,26 +103,7 @@
//submit doc blob data
//submit doc blob data
return
gadget
return
gadget
.
jio_putAttachment
(
child_gadget
.
state
.
jio_key
,
'
data
'
,
.
jio_putAttachment
(
child_gadget
.
state
.
jio_key
,
'
data
'
,
jIO
.
util
.
dataURItoBlob
(
data
))
jIO
.
util
.
dataURItoBlob
(
data
));
//TODO this should be in a custom view
//use: portal_type_dict.custom_view_gadget
//ONLY OFFICE
.
push
(
function
()
{
if
(
gadget
.
state
.
only_office
)
{
return
gadget
.
declareGadget
(
"
gadget_ojs_cloudooo.html
"
);
}
})
.
push
(
function
(
cloudooo
)
{
if
(
gadget
.
state
.
only_office
)
{
return
cloudooo
.
putAllCloudoooConvertionOperation
({
format
:
gadget
.
state
.
mime_type
,
jio_key
:
child_gadget
.
state
.
jio_key
});
}
});
//
}
}
},
function
(
error
)
{
},
function
(
error
)
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -280,10 +195,6 @@
...
@@ -280,10 +195,6 @@
portal_type_dict
=
options
.
form_definition
.
portal_type_dict
,
portal_type_dict
=
options
.
form_definition
.
portal_type_dict
,
blob
;
blob
;
if
(
portal_type_dict
.
only_office
&&
options
.
doc
)
{
return
renderOnlyOffice
(
gadget
,
options
,
portal_type_dict
,
state_dict
);
}
if
(
portal_type_dict
.
blob_type
)
{
if
(
portal_type_dict
.
blob_type
)
{
if
(
options
.
jio_key
)
{
if
(
options
.
jio_key
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
"
data
"
)
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
"
data
"
)
...
...
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