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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
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
Show 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 @@
...
@@ -16,7 +16,7 @@
return
gadget
.
reload
();
return
gadget
.
reload
();
});
});
}
}
return
gadget
.
repair
()
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
if
(
gadget
.
state
.
cloudooo
)
{
if
(
gadget
.
state
.
cloudooo
)
{
return
gadget
.
getDeclaredGadget
(
'
cloudooo
'
)
return
gadget
.
getDeclaredGadget
(
'
cloudooo
'
)
...
@@ -25,6 +25,9 @@
...
@@ -25,6 +25,9 @@
});
});
}
}
})
})
.
push
(
function
()
{
return
gadget
.
repair
();
})
.
push
(
function
()
{
.
push
(
function
()
{
if
(
gadget
.
state
.
redirect
)
{
if
(
gadget
.
state
.
redirect
)
{
return
gadget
.
redirect
(
window
.
JSON
.
parse
(
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 @@
...
@@ -230,7 +230,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -244,7 +244,7 @@
...
@@ -244,7 +244,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
27633.19787.19507
</string>
</value>
<value>
<string>
969.
42224.7621.358
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
153
3639756.16
</float>
<float>
153
4757989.87
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_cloudooo_js.js
View file @
769ea29c
...
@@ -3,6 +3,65 @@
...
@@ -3,6 +3,65 @@
(
function
(
window
,
rJS
,
jIO
,
RSVP
)
{
(
function
(
window
,
rJS
,
jIO
,
RSVP
)
{
"
use strict
"
;
"
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
)
rJS
(
window
)
.
ready
(
function
(
g
)
{
.
ready
(
function
(
g
)
{
g
.
getDeclaredGadget
(
"
jio
"
)
g
.
getDeclaredGadget
(
"
jio
"
)
...
@@ -24,6 +83,7 @@
...
@@ -24,6 +83,7 @@
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_allDocs
"
,
"
jio_allDocs
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
...
@@ -32,7 +92,7 @@
...
@@ -32,7 +92,7 @@
var
gadget
=
this
;
var
gadget
=
this
;
return
gadget
.
jio_get
(
id
)
return
gadget
.
jio_get
(
id
)
.
push
(
function
(
doc
)
{
.
push
(
function
(
doc
)
{
return
gadget
.
convert
(
doc
.
id
,
doc
.
name
,
doc
.
from
,
doc
.
to
)
return
gadget
.
convert
(
doc
)
.
push
(
function
()
{
.
push
(
function
()
{
doc
.
status
=
"
converted
"
;
doc
.
status
=
"
converted
"
;
return
gadget
.
jio_put
(
id
,
doc
);
return
gadget
.
jio_put
(
id
,
doc
);
...
@@ -46,24 +106,28 @@
...
@@ -46,24 +106,28 @@
});
});
});
});
})
})
.
declareMethod
(
"
convert
"
,
function
(
id
,
name
,
from
,
to
)
{
.
declareMethod
(
"
convert
"
,
function
(
options
)
{
var
gadget
=
this
,
jio_gadget
;
var
gadget
=
this
,
jio_gadget
;
return
gadget
.
getDeclaredGadget
(
"
jio
"
)
return
gadget
.
getDeclaredGadget
(
"
jio
"
)
.
push
(
function
(
sub_gadget
)
{
.
push
(
function
(
sub_gadget
)
{
jio_gadget
=
sub_gadget
;
jio_gadget
=
sub_gadget
;
return
RSVP
.
all
([
return
RSVP
.
all
([
gadget
.
jio_getAttachment
(
id
,
name
),
gadget
.
jio_getAttachment
(
options
.
id
,
options
.
name
),
jio_gadget
.
put
(
id
,
{
from
:
from
,
to
:
to
})
jio_gadget
.
put
(
options
.
id
,
{
from
:
options
.
from
,
to
:
options
.
to
})
]);
]);
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
return
jio_gadget
.
putAttachment
(
id
,
name
,
result
[
0
]);
return
jio_gadget
.
putAttachment
(
options
.
id
,
options
.
name
,
result
[
0
]);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
jio_gadget
.
getAttachment
(
id
,
name
);
return
jio_gadget
.
getAttachment
(
options
.
id
,
options
.
name
);
})
})
.
push
(
function
(
converted_blob
)
{
.
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
()
{
.
declareMethod
(
'
repair
'
,
function
()
{
...
@@ -77,8 +141,11 @@
...
@@ -77,8 +141,11 @@
return
gadget
.
convertFromOperation
(
rows
[
i
].
id
);
return
gadget
.
convertFromOperation
(
rows
[
i
].
id
);
});
});
}
}
return
fixAllDocument
(
gadget
)
.
push
(
function
()
{
return
gadget
.
jio_allDocs
({
return
gadget
.
jio_allDocs
({
'
query
'
:
'
status: "convert"
'
'
query
'
:
'
status: "convert"
'
});
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
var
i
=
result
.
data
.
total_rows
-
1
;
var
i
=
result
.
data
.
total_rows
-
1
;
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_cloudooo_js.xml
View file @
769ea29c
...
@@ -255,7 +255,7 @@
...
@@ -255,7 +255,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -269,7 +269,7 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
27633.19787.19507
</string>
</value>
<value>
<string>
969.
46608.54855.3123
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
153
3639646.43
</float>
<float>
153
4778298.94
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_download_convert_js.js
View file @
769ea29c
...
@@ -3,9 +3,6 @@
...
@@ -3,9 +3,6 @@
(
function
(
window
,
rJS
,
RSVP
,
jIO
)
{
(
function
(
window
,
rJS
,
RSVP
,
jIO
)
{
"
use strict
"
;
"
use strict
"
;
var
ATT_NAME
=
"
data
"
;
function
downloadFromBlob
(
gadget
,
blob
,
format
)
{
function
downloadFromBlob
(
gadget
,
blob
,
format
)
{
var
element
=
gadget
.
element
,
var
element
=
gadget
.
element
,
a
=
window
.
document
.
createElement
(
"
a
"
),
a
=
window
.
document
.
createElement
(
"
a
"
),
...
@@ -21,12 +18,43 @@
...
@@ -21,12 +18,43 @@
window
.
URL
.
revokeObjectURL
(
url
);
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
)
rJS
(
window
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// Acquired methods
// Acquired methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
getUrlFor
"
,
"
getUrlFor
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
updateHeader
"
,
"
updateHeader
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
...
@@ -37,7 +65,7 @@
...
@@ -37,7 +65,7 @@
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
allowPublicAcquisition
(
'
submitContent
'
,
function
()
{
.
allowPublicAcquisition
(
'
submitContent
'
,
function
()
{
var
gadget
=
this
,
format
;
var
gadget
=
this
;
return
gadget
.
notifySubmitting
()
return
gadget
.
notifySubmitting
()
.
push
(
function
()
{
.
push
(
function
()
{
...
@@ -47,52 +75,7 @@
...
@@ -47,52 +75,7 @@
return
form_gadget
.
getContent
();
return
form_gadget
.
getContent
();
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
format
=
result
.
format
;
return
downloadFromFormat
(
gadget
,
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
;
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
;
return
;
...
@@ -105,12 +88,19 @@
...
@@ -105,12 +88,19 @@
.
declareMethod
(
"
render
"
,
function
(
options
)
{
.
declareMethod
(
"
render
"
,
function
(
options
)
{
var
gadget
=
this
;
var
gadget
=
this
;
return
gadget
.
jio_get
(
options
.
jio_key
)
return
new
RSVP
.
Queue
()
.
push
(
function
(
doc
)
{
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
jio_get
(
options
.
jio_key
),
gadget
.
getSetting
(
'
file_extension
'
)
]);
})
.
push
(
function
(
result
)
{
return
gadget
.
changeState
({
return
gadget
.
changeState
({
jio_key
:
options
.
jio_key
,
jio_key
:
options
.
jio_key
,
doc
:
doc
,
doc
:
result
[
0
],
format
:
doc
.
filename
.
split
(
'
.
'
).
pop
()
format
:
result
[
1
],
download_format
:
options
.
download_format
});
});
});
});
})
})
...
@@ -173,6 +163,11 @@
...
@@ -173,6 +163,11 @@
previous_url
:
url_list
[
1
],
previous_url
:
url_list
[
1
],
next_url
:
url_list
[
2
]
next_url
:
url_list
[
2
]
});
});
})
.
push
(
function
()
{
if
(
gadget
.
state
.
download_format
)
{
return
downloadFromFormat
(
gadget
,
gadget
.
state
.
download_format
);
}
});
});
});
});
}(
window
,
rJS
,
RSVP
,
jIO
));
}(
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 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1534
406300.95
</float>
<float>
1534
771376.27
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.js
View file @
769ea29c
...
@@ -33,27 +33,34 @@
...
@@ -33,27 +33,34 @@
form_gadget
.
getContent
(),
form_gadget
.
getContent
(),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
portal_type
'
),
gadget
.
getSetting
(
'
content_type
'
),
gadget
.
getSetting
(
'
content_type
'
),
gadget
.
getSetting
(
'
file_extension
'
)
gadget
.
getSetting
(
'
file_extension
'
),
gadget
.
getSetting
(
'
parent_relative_url
'
)
]);
]);
})
})
.
push
(
function
(
result
)
{
.
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
)
{
if
(
result
[
0
].
file
!==
undefined
)
{
file_name
=
result
[
0
].
file
.
file_name
;
file_name_list
=
result
[
0
].
file
.
file_name
.
split
(
'
.
'
);
from
=
file_name
.
split
(
'
.
'
).
pop
();
from
=
file_name_list
.
pop
();
file_name_list
.
push
(
result
[
3
]);
filename
=
file_name_list
.
join
(
'
.
'
);
data
=
jIO
.
util
.
dataURItoBlob
(
result
[
0
].
file
.
url
);
data
=
jIO
.
util
.
dataURItoBlob
(
result
[
0
].
file
.
url
);
if
(
gadget
.
state
.
upload
.
hasOwnProperty
(
from
))
{
if
(
gadget
.
state
.
upload
.
hasOwnProperty
(
from
))
{
if
(
result
[
3
]
!==
from
)
{
att_name
=
from
;
}
to
=
gadget
.
state
.
upload
[
from
];
to
=
gadget
.
state
.
upload
[
from
];
return
gadget
.
jio_post
({
return
gadget
.
jio_post
({
title
:
file
_
name
,
title
:
filename
,
portal_type
:
result
[
1
],
portal_type
:
result
[
1
],
content_type
:
result
[
2
],
content_type
:
result
[
2
],
filename
:
file
_
name
,
filename
:
filename
,
mime_type
:
from
parent_relative_url
:
result
[
4
]
})
})
.
push
(
function
(
doc_id
)
{
.
push
(
function
(
doc_id
)
{
jio_key
=
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
()
{
.
push
(
function
()
{
if
(
result
[
3
]
===
from
)
{
if
(
result
[
3
]
===
from
)
{
...
@@ -61,25 +68,39 @@
...
@@ -61,25 +68,39 @@
}
}
return
gadget
.
getDeclaredGadget
(
'
ojs_cloudooo
'
)
return
gadget
.
getDeclaredGadget
(
'
ojs_cloudooo
'
)
.
push
(
function
(
ojs_cloudooo
)
{
.
push
(
function
(
ojs_cloudooo
)
{
return
ojs_cloudooo
.
putCloudoooConvertOperation
({
return
RSVP
.
all
([
ojs_cloudooo
.
putCloudoooConvertOperation
({
status
:
"
convert
"
,
status
:
"
convert
"
,
from
:
from
,
from
:
from
,
to
:
to
,
to
:
to
,
id
:
jio_key
,
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
name
:
ATT_NAME
});
})
}
);
]
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
gadget
.
redirect
({
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
command
'
:
'
display
'
,
'
options
'
:
{
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
,
'
auto_repair
'
:
true
'
redirect
'
:
jIO
.
util
.
stringify
({
}
'
command
'
:
'
display
'
,
});
'
options
'
:
{
'
jio_key
'
:
jio_key
}
});
})
})
.
push
(
function
()
{
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
jio_key
'
:
jio_key
}
}
});
});
});
});
...
@@ -88,19 +109,16 @@
...
@@ -88,19 +109,16 @@
message
:
"
Can not convert, use format :
"
+
message
:
"
Can not convert, use format :
"
+
window
.
Object
.
keys
(
gadget
.
state
.
upload
).
join
(
'
,
'
),
window
.
Object
.
keys
(
gadget
.
state
.
upload
).
join
(
'
,
'
),
status
:
"
error
"
status
:
"
error
"
})
.
push
(
function
()
{
return
;
});
});
}
}
return
gadget
.
notifySubmitted
({
return
gadget
.
notifySubmitted
({
message
:
"
File is required
"
,
message
:
"
File is required
"
,
status
:
"
error
"
status
:
"
error
"
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
;
return
;
});
});
});
})
})
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
.
declareMethod
(
"
triggerSubmit
"
,
function
()
{
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_erp5_page_ojs_upload_convert_js.xml
View file @
769ea29c
...
@@ -228,7 +228,7 @@
...
@@ -228,7 +228,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
actor
</string>
</key>
<key>
<string>
actor
</string>
</key>
<value>
<string>
P0
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
comment
</string>
</key>
<key>
<string>
comment
</string>
</key>
...
@@ -242,7 +242,7 @@
...
@@ -242,7 +242,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
27633.19787.19507
</string>
</value>
<value>
<string>
969.
46490.21150.57958
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -260,7 +260,7 @@
...
@@ -260,7 +260,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
153
3639694.58
</float>
<float>
153
4779925.16
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/ojs_gadget_ojs_cloudooo_js.js
View file @
769ea29c
...
@@ -19,14 +19,16 @@
...
@@ -19,14 +19,16 @@
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_put
"
,
"
jio_put
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
jio_get
"
,
"
jio_get
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
redirect
"
,
"
redirect
"
)
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
// declared methods
// declared methods
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
.
declareMethod
(
"
getConvertedBlob
"
,
function
(
options
)
{
.
declareMethod
(
"
getConvertedBlob
"
,
function
(
options
)
{
var
gadget
=
this
,
var
gadget
=
this
;
mime_type
=
options
.
filename
.
split
(
'
.
'
).
pop
();
return
gadget
.
getSetting
(
'
file_extension
'
)
if
(
mime_type
===
options
.
format
)
{
.
push
(
function
(
file_extension
)
{
if
(
file_extension
===
options
.
format
)
{
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
ATT_NAME
);
return
gadget
.
jio_getAttachment
(
options
.
jio_key
,
ATT_NAME
);
}
}
return
gadget
.
jio_get
(
return
gadget
.
jio_get
(
...
@@ -42,18 +44,38 @@
...
@@ -42,18 +44,38 @@
err
=
new
jIO
.
util
.
jIOError
(
obj
.
message
,
obj
.
status_code
);
err
=
new
jIO
.
util
.
jIOError
(
obj
.
message
,
obj
.
status_code
);
err
.
detail
=
obj
.
detail
;
err
.
detail
=
obj
.
detail
;
}
else
{
}
else
{
err
=
new
jIO
.
util
.
jIOError
(
"
Not converted
"
,
500
);
return
gadget
.
redirect
({
'
command
'
:
'
display
'
,
'
options
'
:
{
'
page
'
:
'
ojs_sync
'
,
'
auto_repair
'
:
true
,
'
redirect
'
:
options
.
redirect
}
});
}
}
throw
err
;
throw
err
;
},
function
(
error
)
{
},
function
(
error
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
404
)
{
if
(
error
instanceof
jIO
.
util
.
jIOError
&&
error
.
status_code
===
404
)
{
return
gadget
.
putAllCloudoooConvertionOperation
({
return
gadget
.
putAllCloudoooConvertionOperation
({
format
:
mime_type
,
format
:
file_extension
,
jio_key
:
options
.
jio_key
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
)
{
.
declareMethod
(
"
putCloudoooConvertOperation
"
,
function
(
options
)
{
return
this
.
jio_put
(
getCloudoooId
(
options
.
id
,
options
.
to
),
options
);
return
this
.
jio_put
(
getCloudoooId
(
options
.
id
,
options
.
to
),
options
);
...
@@ -78,7 +100,7 @@
...
@@ -78,7 +100,7 @@
from
:
options
.
format
,
from
:
options
.
format
,
to
:
format_list
[
i
],
to
:
format_list
[
i
],
id
:
options
.
jio_key
,
id
:
options
.
jio_key
,
name
:
ATT_NAME
name
:
options
.
format
===
result
[
1
]
?
ATT_NAME
:
options
.
format
}));
}));
}
}
return
RSVP
.
all
(
promise_list
);
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 @@
...
@@ -269,7 +269,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
969.
32112.45524.32443
</string>
</value>
<value>
<string>
969.
46486.51629.28689
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -287,7 +287,7 @@
...
@@ -287,7 +287,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1534
407519.6
</float>
<float>
1534
770737.04
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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