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
Labels
Merge Requests
139
Merge Requests
139
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
769ea29c
Commit
769ea29c
authored
Aug 17, 2018
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_officejs] Fix upload with erp5 storage
parent
693fe005
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
240 additions
and
135 deletions
+240
-135
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_sync_js.js
...plateItem/web_page_module/gadget_officejs_page_sync_js.js
+4
-1
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_sync_js.xml
...lateItem/web_page_module/gadget_officejs_page_sync_js.xml
+3
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_cloudooo_js.js
...athTemplateItem/web_page_module/ojs_gadget_cloudooo_js.js
+77
-10
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_cloudooo_js.xml
...thTemplateItem/web_page_module/ojs_gadget_cloudooo_js.xml
+3
-3
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
+50
-55
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
+2
-2
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
+46
-28
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
+3
-3
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.js
...emplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.js
+50
-28
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.xml
...mplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.xml
+2
-2
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_sync_js.js
View file @
769ea29c
...
...
@@ -16,7 +16,7 @@
return
gadget
.
reload
();
});
}
return
gadget
.
repair
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
if
(
gadget
.
state
.
cloudooo
)
{
return
gadget
.
getDeclaredGadget
(
'
cloudooo
'
)
...
...
@@ -25,6 +25,9 @@
});
}
})
.
push
(
function
()
{
return
gadget
.
repair
();
})
.
push
(
function
()
{
if
(
gadget
.
state
.
redirect
)
{
return
gadget
.
redirect
(
window
.
JSON
.
parse
(
gadget
.
state
.
redirect
));
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_page_sync_js.xml
View file @
769ea29c
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -244,7 +244,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
27633.19787.19507
</string>
</value>
<value>
<string>
969.
42224.7621.358
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -262,7 +262,7 @@
</tuple>
<state>
<tuple>
<float>
153
3639756.16
</float>
<float>
153
4757989.87
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_cloudooo_js.js
View file @
769ea29c
...
...
@@ -3,6 +3,65 @@
(
function
(
window
,
rJS
,
jIO
,
RSVP
)
{
"
use strict
"
;
function
fixDocument
(
gadget
,
id
)
{
var
doc
,
from
,
name_list
;
return
gadget
.
jio_get
(
id
)
.
push
(
function
(
result
)
{
doc
=
result
;
delete
doc
.
mime_type
;
return
RSVP
.
all
([
gadget
.
getSetting
(
'
parent_relative_url
'
),
gadget
.
getSetting
(
'
file_extension
'
)
]);
})
.
push
(
function
(
result
)
{
doc
.
parent_relative_url
=
result
[
0
];
if
(
doc
.
filename
.
indexOf
(
result
[
1
])
<
0
)
{
name_list
=
doc
.
filename
.
split
(
'
.
'
);
from
=
name_list
.
pop
();
name_list
.
push
(
result
[
1
]);
doc
.
filename
=
name_list
.
join
(
'
.
'
);
return
gadget
.
jio_put
(
'
CloudoooConversion/
'
+
id
+
'
/
'
+
result
[
1
],
{
status
:
'
convert
'
,
from
:
from
,
to
:
result
[
1
],
id
:
id
,
name
:
from
,
to_name
:
'
data
'
}
)
.
push
(
function
()
{
return
gadget
.
jio_getAttachment
(
id
,
'
data
'
);
})
.
push
(
function
(
blob
)
{
return
gadget
.
jio_putAttachment
(
id
,
from
,
blob
);
});
}
})
.
push
(
function
()
{
return
gadget
.
jio_put
(
id
,
doc
);
});
}
function
fixAllDocument
(
gadget
)
{
return
gadget
.
getSetting
(
'
portal_type
'
)
.
push
(
function
(
portal_type
)
{
return
gadget
.
jio_allDocs
({
'
query
'
:
'
(portal_type: "
'
+
portal_type
+
'
") AND (mime_type: "%")
'
});
})
.
push
(
function
(
result
)
{
var
i
,
promise_list
=
[];
for
(
i
=
0
;
i
<
result
.
data
.
total_rows
;
i
+=
1
)
{
promise_list
.
push
(
fixDocument
(
gadget
,
result
.
data
.
rows
[
i
].
id
));
}
return
RSVP
.
all
(
promise_list
);
});
}
rJS
(
window
)
.
ready
(
function
(
g
)
{
g
.
getDeclaredGadget
(
"
jio
"
)
...
...
@@ -24,6 +83,7 @@
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
/////////////////////////////////////////////////////////////////
// declared methods
...
...
@@ -32,7 +92,7 @@
var
gadget
=
this
;
return
gadget
.
jio_get
(
id
)
.
push
(
function
(
doc
)
{
return
gadget
.
convert
(
doc
.
id
,
doc
.
name
,
doc
.
from
,
doc
.
to
)
return
gadget
.
convert
(
doc
)
.
push
(
function
()
{
doc
.
status
=
"
converted
"
;
return
gadget
.
jio_put
(
id
,
doc
);
...
...
@@ -46,24 +106,28 @@
});
});
})
.
declareMethod
(
"
convert
"
,
function
(
id
,
name
,
from
,
to
)
{
.
declareMethod
(
"
convert
"
,
function
(
options
)
{
var
gadget
=
this
,
jio_gadget
;
return
gadget
.
getDeclaredGadget
(
"
jio
"
)
.
push
(
function
(
sub_gadget
)
{
jio_gadget
=
sub_gadget
;
return
RSVP
.
all
([
gadget
.
jio_getAttachment
(
id
,
name
),
jio_gadget
.
put
(
id
,
{
from
:
from
,
to
:
to
})
gadget
.
jio_getAttachment
(
options
.
id
,
options
.
name
),
jio_gadget
.
put
(
options
.
id
,
{
from
:
options
.
from
,
to
:
options
.
to
})
]);
})
.
push
(
function
(
result
)
{
return
jio_gadget
.
putAttachment
(
id
,
name
,
result
[
0
]);
return
jio_gadget
.
putAttachment
(
options
.
id
,
options
.
name
,
result
[
0
]);
})
.
push
(
function
()
{
return
jio_gadget
.
getAttachment
(
id
,
name
);
return
jio_gadget
.
getAttachment
(
options
.
id
,
options
.
name
);
})
.
push
(
function
(
converted_blob
)
{
return
gadget
.
jio_putAttachment
(
id
,
to
,
converted_blob
);
return
gadget
.
jio_putAttachment
(
options
.
id
,
options
.
to_name
||
options
.
to
,
converted_blob
);
});
})
.
declareMethod
(
'
repair
'
,
function
()
{
...
...
@@ -77,9 +141,12 @@
return
gadget
.
convertFromOperation
(
rows
[
i
].
id
);
});
}
return
gadget
.
jio_allDocs
({
'
query
'
:
'
status: "convert"
'
})
return
fixAllDocument
(
gadget
)
.
push
(
function
()
{
return
gadget
.
jio_allDocs
({
'
query
'
:
'
status: "convert"
'
});
})
.
push
(
function
(
result
)
{
var
i
=
result
.
data
.
total_rows
-
1
;
return
convertAndPush
(
result
.
data
.
rows
,
i
);
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_cloudooo_js.xml
View file @
769ea29c
...
...
@@ -255,7 +255,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
27633.19787.19507
</string>
</value>
<value>
<string>
969.
46608.54855.3123
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
153
3639646.43
</float>
<float>
153
4778298.94
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.js
View file @
769ea29c
...
...
@@ -3,9 +3,6 @@
(
function
(
window
,
rJS
,
RSVP
,
jIO
)
{
"
use strict
"
;
var
ATT_NAME
=
"
data
"
;
function
downloadFromBlob
(
gadget
,
blob
,
format
)
{
var
element
=
gadget
.
element
,
a
=
window
.
document
.
createElement
(
"
a
"
),
...
...
@@ -21,12 +18,43 @@
window
.
URL
.
revokeObjectURL
(
url
);
}
function
downloadFromFormat
(
gadget
,
format
)
{
return
gadget
.
getDeclaredGadget
(
'
ojs_cloudooo
'
)
.
push
(
function
(
ojs_cloudooo
)
{
return
ojs_cloudooo
.
getConvertedBlob
({
jio_key
:
gadget
.
state
.
jio_key
,
format
:
format
,
redirect
:
jIO
.
util
.
stringify
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_download_convert
'
,
'
jio_key
'
:
gadget
.
state
.
jio_key
,
'
download_format
'
:
format
}
})
});
})
.
push
(
function
(
result
)
{
return
downloadFromBlob
(
gadget
,
result
,
format
);
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
();
},
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Conversion Failed
"
,
status
:
"
error
"
});
}
throw
error
;
});
}
rJS
(
window
)
/////////////////////////////////////////////////////////////////
// Acquired methods
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
...
...
@@ -37,7 +65,7 @@
// declared methods
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
'
submitContent
'
,
function
()
{
var
gadget
=
this
,
format
;
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
...
...
@@ -47,52 +75,7 @@
return
form_gadget
.
getContent
();
})
.
push
(
function
(
result
)
{
format
=
result
.
format
;
if
(
format
===
gadget
.
state
.
format
)
{
return
gadget
.
jio_getAttachment
(
gadget
.
state
.
jio_key
,
ATT_NAME
);
}
return
gadget
.
getDeclaredGadget
(
'
ojs_cloudooo
'
)
.
push
(
function
(
ojs_cloudooo
)
{
return
ojs_cloudooo
.
getConvertedBlob
({
jio_key
:
gadget
.
state
.
jio_key
,
format
:
format
,
filename
:
gadget
.
state
.
doc
.
filename
});
});
})
.
push
(
function
(
result
)
{
return
downloadFromBlob
(
gadget
,
result
,
format
);
},
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
500
&&
error
.
message
===
"
Not converted
"
)
{
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
,
'
redirect
'
:
jIO
.
util
.
stringify
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_download_convert
'
,
'
jio_key
'
:
gadget
.
state
.
jio_key
}
})
}
});
}
throw
error
;
})
.
push
(
function
()
{
return
gadget
.
notifySubmitted
();
},
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
)
{
return
gadget
.
notifySubmitted
({
message
:
"
Conversion Failed
"
,
status
:
"
error
"
});
}
throw
error
;
return
downloadFromFormat
(
gadget
,
result
.
format
);
})
.
push
(
function
()
{
return
;
...
...
@@ -105,12 +88,19 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
return
gadget
.
jio_get
(
options
.
jio_key
)
.
push
(
function
(
doc
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
jio_get
(
options
.
jio_key
),
gadget
.
getSetting
(
'
file_extension
'
)
]);
})
.
push
(
function
(
result
)
{
return
gadget
.
changeState
({
jio_key
:
options
.
jio_key
,
doc
:
doc
,
format
:
doc
.
filename
.
split
(
'
.
'
).
pop
()
doc
:
result
[
0
],
format
:
result
[
1
],
download_format
:
options
.
download_format
});
});
})
...
...
@@ -173,6 +163,11 @@
previous_url
:
url_list
[
1
],
next_url
:
url_list
[
2
]
});
})
.
push
(
function
()
{
if
(
gadget
.
state
.
download_format
)
{
return
downloadFromFormat
(
gadget
,
gadget
.
state
.
download_format
);
}
});
});
}(
window
,
rJS
,
RSVP
,
jIO
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.xml
View file @
769ea29c
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.4
0397.55907.1280
</string>
</value>
<value>
<string>
969.4
6498.50089.26265
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
1534
406300.95
</float>
<float>
1534
771376.27
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.js
View file @
769ea29c
...
...
@@ -33,27 +33,34 @@
form_gadget
.
getContent
(),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
content_type
'
),
gadget
.
getSetting
(
'
file_extension
'
)
gadget
.
getSetting
(
'
file_extension
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
)
]);
})
.
push
(
function
(
result
)
{
var
file_name
,
from
,
jio_key
,
data
,
to
;
var
file_name_list
,
from
,
jio_key
,
data
,
to
,
att_name
=
ATT_NAME
,
filename
;
if
(
result
[
0
].
file
!==
undefined
)
{
file_name
=
result
[
0
].
file
.
file_name
;
from
=
file_name
.
split
(
'
.
'
).
pop
();
file_name_list
=
result
[
0
].
file
.
file_name
.
split
(
'
.
'
);
from
=
file_name_list
.
pop
();
file_name_list
.
push
(
result
[
3
]);
filename
=
file_name_list
.
join
(
'
.
'
);
data
=
jIO
.
util
.
dataURItoBlob
(
result
[
0
].
file
.
url
);
if
(
gadget
.
state
.
upload
.
hasOwnProperty
(
from
))
{
if
(
result
[
3
]
!==
from
)
{
att_name
=
from
;
}
to
=
gadget
.
state
.
upload
[
from
];
return
gadget
.
jio_post
({
title
:
file
_
name
,
title
:
filename
,
portal_type
:
result
[
1
],
content_type
:
result
[
2
],
filename
:
file
_
name
,
mime_type
:
from
filename
:
filename
,
parent_relative_url
:
result
[
4
]
})
.
push
(
function
(
doc_id
)
{
jio_key
=
doc_id
;
return
gadget
.
jio_putAttachment
(
jio_key
,
ATT_NAME
,
data
);
return
gadget
.
jio_putAttachment
(
jio_key
,
att_name
,
data
);
})
.
push
(
function
()
{
if
(
result
[
3
]
===
from
)
{
...
...
@@ -61,12 +68,31 @@
}
return
gadget
.
getDeclaredGadget
(
'
ojs_cloudooo
'
)
.
push
(
function
(
ojs_cloudooo
)
{
return
ojs_cloudooo
.
putCloudoooConvertOperation
({
status
:
"
convert
"
,
from
:
from
,
to
:
to
,
id
:
jio_key
,
name
:
ATT_NAME
return
RSVP
.
all
([
ojs_cloudooo
.
putCloudoooConvertOperation
({
status
:
"
convert
"
,
from
:
from
,
to
:
to
,
id
:
jio_key
,
name
:
att_name
,
to_name
:
ATT_NAME
}),
ojs_cloudooo
.
putCloudoooConvertOperation
({
status
:
"
converted
"
,
from
:
to
,
to
:
from
,
id
:
jio_key
,
name
:
ATT_NAME
})
]);
})
.
push
(
function
()
{
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
}
});
});
})
...
...
@@ -74,12 +100,7 @@
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
,
'
redirect
'
:
jIO
.
util
.
stringify
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
jio_key
'
:
jio_key
}
})
'
jio_key
'
:
jio_key
}
});
});
...
...
@@ -88,18 +109,15 @@
message
:
"
Can not convert, use format :
"
+
window
.
Object
.
keys
(
gadget
.
state
.
upload
).
join
(
'
,
'
),
status
:
"
error
"
})
.
push
(
function
()
{
return
;
});
});
}
return
gadget
.
notifySubmitted
({
message
:
"
File is required
"
,
status
:
"
error
"
})
.
push
(
function
()
{
return
;
})
;
})
;
})
.
push
(
function
()
{
return
;
});
})
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.xml
View file @
769ea29c
...
...
@@ -228,7 +228,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -242,7 +242,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
27633.19787.19507
</string>
</value>
<value>
<string>
969.
46490.21150.57958
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -260,7 +260,7 @@
</tuple>
<state>
<tuple>
<float>
153
3639694.58
</float>
<float>
153
4779925.16
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.js
View file @
769ea29c
...
...
@@ -19,40 +19,62 @@
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
// declared methods
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
getConvertedBlob
"
,
function
(
options
)
{
var
gadget
=
this
,
mime_type
=
options
.
filename
.
split
(
'
.
'
).
pop
();
if
(
mime_type
===
options
.
format
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
ATT_NAME
);
}
return
gadget
.
jio_get
(
getCloudoooId
(
options
.
jio_key
,
options
.
format
)
)
.
push
(
function
(
doc
)
{
var
err
,
obj
;
if
(
doc
.
status
===
"
converted
"
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
options
.
format
);
}
if
(
doc
.
status
===
"
error
"
)
{
obj
=
window
.
JSON
.
parse
(
doc
.
error
);
err
=
new
jIO
.
util
.
jIOError
(
obj
.
message
,
obj
.
status_code
);
err
.
detail
=
obj
.
detail
;
}
else
{
err
=
new
jIO
.
util
.
jIOError
(
"
Not converted
"
,
500
);
var
gadget
=
this
;
return
gadget
.
getSetting
(
'
file_extension
'
)
.
push
(
function
(
file_extension
)
{
if
(
file_extension
===
options
.
format
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
ATT_NAME
);
}
throw
err
;
},
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
404
)
{
return
gadget
.
putAllCloudoooConvertionOperation
({
format
:
mime_type
,
jio_key
:
options
.
jio_key
return
gadget
.
jio_get
(
getCloudoooId
(
options
.
jio_key
,
options
.
format
)
)
.
push
(
function
(
doc
)
{
var
err
,
obj
;
if
(
doc
.
status
===
"
converted
"
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
options
.
format
);
}
if
(
doc
.
status
===
"
error
"
)
{
obj
=
window
.
JSON
.
parse
(
doc
.
error
);
err
=
new
jIO
.
util
.
jIOError
(
obj
.
message
,
obj
.
status_code
);
err
.
detail
=
obj
.
detail
;
}
else
{
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
,
'
redirect
'
:
options
.
redirect
}
});
}
throw
err
;
},
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
404
)
{
return
gadget
.
putAllCloudoooConvertionOperation
({
format
:
file_extension
,
jio_key
:
options
.
jio_key
})
.
push
(
function
()
{
if
(
options
.
redirect
)
{
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
,
'
redirect
'
:
options
.
redirect
}
});
}
});
}
throw
error
;
});
}
throw
error
;
});
})
.
declareMethod
(
"
putCloudoooConvertOperation
"
,
function
(
options
)
{
...
...
@@ -78,7 +100,7 @@
from
:
options
.
format
,
to
:
format_list
[
i
],
id
:
options
.
jio_key
,
name
:
ATT_NAME
name
:
options
.
format
===
result
[
1
]
?
ATT_NAME
:
options
.
format
}));
}
return
RSVP
.
all
(
promise_list
);
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.xml
View file @
769ea29c
...
...
@@ -269,7 +269,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
32112.45524.32443
</string>
</value>
<value>
<string>
969.
46486.51629.28689
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -287,7 +287,7 @@
</tuple>
<state>
<tuple>
<float>
1534
407519.6
</float>
<float>
1534
770737.04
</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