Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio
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
Vincent Bechu
jio
Commits
ef98a460
Commit
ef98a460
authored
Apr 16, 2013
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5storage.js uses jQuery ajax with "json" dataType now
parent
314f31ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
20 deletions
+14
-20
src/jio.storage/erp5storage.js
src/jio.storage/erp5storage.js
+14
-20
No files found.
src/jio.storage/erp5storage.js
View file @
ef98a460
...
@@ -116,8 +116,8 @@ jIO.addStorageType("erp5", function (spec, my) {
...
@@ -116,8 +116,8 @@ jIO.addStorageType("erp5", function (spec, my) {
*/
*/
priv
.
makeAjaxObject
=
function
(
json
,
method
,
ajax_object
)
{
priv
.
makeAjaxObject
=
function
(
json
,
method
,
ajax_object
)
{
ajax_object
.
type
=
"
POST
"
;
ajax_object
.
type
=
"
POST
"
;
ajax_object
.
dataType
=
"
text
"
;
ajax_object
.
dataType
=
"
json
"
;
ajax_object
.
data
=
JSON
.
stringify
(
json
)
;
ajax_object
.
data
=
[{
"
name
"
:
"
doc
"
,
"
value
"
:
JSON
.
stringify
(
json
)}]
;
ajax_object
.
url
=
priv
.
url
+
"
/JIO_
"
+
method
+
ajax_object
.
url
=
priv
.
url
+
"
/JIO_
"
+
method
+
"
?_=
"
+
Date
.
now
();
"
?_=
"
+
Date
.
now
();
ajax_object
.
async
=
ajax_object
.
async
===
false
?
false
:
true
;
ajax_object
.
async
=
ajax_object
.
async
===
false
?
false
:
true
;
...
@@ -222,11 +222,17 @@ jIO.addStorageType("erp5", function (spec, my) {
...
@@ -222,11 +222,17 @@ jIO.addStorageType("erp5", function (spec, my) {
* @method erp5.genericRequest
* @method erp5.genericRequest
* @param {object} doc The document object
* @param {object} doc The document object
* @param {string} method The ERP5 request method
* @param {string} method The ERP5 request method
* @param {boolean} parse Parse the data received if true
*/
*/
erp5
.
genericRequest
=
function
(
json
,
method
,
parse
)
{
erp5
.
genericRequest
=
function
(
json
,
method
)
{
var
jql
=
priv
.
makeJQLikeCallback
(),
error
=
null
;
var
jql
=
priv
.
makeJQLikeCallback
(),
error
=
null
;
priv
.
ajax
(
json
,
method
).
always
(
function
(
one
,
state
,
three
)
{
priv
.
ajax
(
json
,
method
).
always
(
function
(
one
,
state
,
three
)
{
if
(
state
===
"
parsererror
"
)
{
return
jql
.
respond
(
priv
.
createError
(
24
,
"
Cannot parse data
"
,
"
Corrupted data
"
),
undefined
);
}
if
(
state
!==
"
success
"
)
{
if
(
state
!==
"
success
"
)
{
error
=
priv
.
ajaxErrorToJioError
(
error
=
priv
.
ajaxErrorToJioError
(
one
,
one
,
...
@@ -238,21 +244,10 @@ jIO.addStorageType("erp5", function (spec, my) {
...
@@ -238,21 +244,10 @@ jIO.addStorageType("erp5", function (spec, my) {
}
}
return
jql
.
respond
(
error
,
undefined
);
return
jql
.
respond
(
error
,
undefined
);
}
}
if
(
parse
)
{
if
(
one
.
err
!==
null
)
{
try
{
return
jql
.
respond
(
one
.
err
,
undefined
);
one
=
JSON
.
parse
(
one
);
}
catch
(
e
)
{
return
jql
.
respond
(
priv
.
createError
(
24
,
"
Cannot parse data
"
,
"
Corrupted data
"
),
undefined
);
}
}
if
(
typeof
one
.
status
===
"
number
"
&&
typeof
one
.
error
===
"
string
"
)
{
return
jql
.
respond
(
one
,
undefined
);
}
}
return
jql
.
respond
(
undefined
,
one
);
return
jql
.
respond
(
undefined
,
one
.
response
);
});
});
return
jql
.
to_return
;
return
jql
.
to_return
;
};
};
...
@@ -267,8 +262,7 @@ jIO.addStorageType("erp5", function (spec, my) {
...
@@ -267,8 +262,7 @@ jIO.addStorageType("erp5", function (spec, my) {
priv
.
genericCommand
=
function
(
json
,
method
)
{
priv
.
genericCommand
=
function
(
json
,
method
)
{
erp5
.
genericRequest
(
erp5
.
genericRequest
(
json
,
json
,
method
,
method
method
!==
"
getAttachment
"
// parse received data if not getAttachment
).
always
(
function
(
err
,
response
)
{
).
always
(
function
(
err
,
response
)
{
if
(
err
)
{
if
(
err
)
{
return
that
.
error
(
err
);
return
that
.
error
(
err
);
...
...
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