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
Léo-Paul Géneau
erp5
Commits
4172db50
Commit
4172db50
authored
May 09, 2017
by
Vincent Bechu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_web_renderjs_ui: jio Release Version 3.17.0
parent
a11a821e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
224 additions
and
163 deletions
+224
-163
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
...enderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
+222
-161
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
...nderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.js
View file @
4172db50
...
@@ -12527,35 +12527,30 @@ return new Parser;
...
@@ -12527,35 +12527,30 @@ return new Parser;
return
tx
;
return
tx
;
}
}
function
handleCursor
(
request
,
callback
)
{
function
handleCursor
(
request
,
callback
,
resolve
,
reject
)
{
function
resolver
(
resolve
,
reject
)
{
request
.
onerror
=
function
(
error
)
{
// Open DB //
if
(
request
.
transaction
)
{
request
.
onerror
=
function
(
error
)
{
request
.
transaction
.
abort
();
if
(
request
.
transaction
)
{
}
request
.
transaction
.
abort
();
reject
(
error
);
}
};
reject
(
error
);
};
request
.
onsuccess
=
function
(
evt
)
{
var
cursor
=
evt
.
target
.
result
;
if
(
cursor
)
{
// XXX Wait for result
try
{
callback
(
cursor
);
}
catch
(
error
)
{
reject
(
error
);
}
// continue to next iteration
request
.
onsuccess
=
function
(
evt
)
{
cursor
[
"
continue
"
]();
var
cursor
=
evt
.
target
.
result
;
}
else
{
if
(
cursor
)
{
resolve
();
// XXX Wait for result
try
{
callback
(
cursor
);
}
catch
(
error
)
{
reject
(
error
);
}
}
};
}
// continue to next iteration
// XXX Canceller???
cursor
[
"
continue
"
]();
return
new
RSVP
.
Promise
(
resolver
);
}
else
{
resolve
();
}
};
}
}
IndexedDBStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
IndexedDBStorage
.
prototype
.
buildQuery
=
function
(
options
)
{
...
@@ -12577,40 +12572,45 @@ return new Parser;
...
@@ -12577,40 +12572,45 @@ return new Parser;
}
}
return
openIndexedDB
(
this
)
return
openIndexedDB
(
this
)
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
var
tx
=
openTransaction
(
db
,
[
"
metadata
"
],
"
readonly
"
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
if
(
options
.
include_docs
===
true
)
{
var
tx
=
openTransaction
(
db
,
[
"
metadata
"
],
"
readonly
"
);
return
handleCursor
(
tx
.
objectStore
(
"
metadata
"
).
index
(
"
_id
"
)
if
(
options
.
include_docs
===
true
)
{
.
openCursor
(),
pushIncludedMetadata
);
handleCursor
(
tx
.
objectStore
(
"
metadata
"
).
index
(
"
_id
"
).
openCursor
(),
}
pushIncludedMetadata
,
resolve
,
reject
);
return
handleCursor
(
tx
.
objectStore
(
"
metadata
"
).
index
(
"
_id
"
)
}
else
{
.
openKeyCursor
(),
pushMetadata
);
handleCursor
(
tx
.
objectStore
(
"
metadata
"
).
index
(
"
_id
"
)
.
openKeyCursor
(),
pushMetadata
,
resolve
,
reject
);
}
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
result_list
;
return
result_list
;
});
});
};
};
function
handleGet
(
request
)
{
function
handleGet
(
request
,
resolve
,
reject
)
{
function
resolver
(
resolve
,
reject
)
{
request
.
onerror
=
reject
;
request
.
onerror
=
reject
;
request
.
onsuccess
=
function
()
{
request
.
onsuccess
=
function
()
{
if
(
request
.
result
)
{
if
(
request
.
result
)
{
resolve
(
request
.
result
);
resolve
(
request
.
result
);
}
else
{
}
// XXX How to get ID
// XXX How to get ID
reject
(
new
jIO
.
util
.
jIOError
(
"
Cannot find document
"
,
404
));
reject
(
new
jIO
.
util
.
jIOError
(
"
Cannot find document
"
,
404
));
};
}
}
};
return
new
RSVP
.
Promise
(
resolver
);
}
}
IndexedDBStorage
.
prototype
.
get
=
function
(
id
)
{
IndexedDBStorage
.
prototype
.
get
=
function
(
id
)
{
return
openIndexedDB
(
this
)
return
openIndexedDB
(
this
)
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
],
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
"
readonly
"
);
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
],
"
readonly
"
);
return
handleGet
(
transaction
.
objectStore
(
"
metadata
"
).
get
(
id
));
handleGet
(
transaction
.
objectStore
(
"
metadata
"
).
get
(
id
),
resolve
,
reject
);
});
})
})
.
push
(
function
(
result
)
{
.
push
(
function
(
result
)
{
return
result
.
doc
;
return
result
.
doc
;
...
@@ -12626,37 +12626,51 @@ return new Parser;
...
@@ -12626,37 +12626,51 @@ return new Parser;
return
openIndexedDB
(
this
)
return
openIndexedDB
(
this
)
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
,
"
attachment
"
],
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
"
readonly
"
);
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
,
"
attachment
"
],
return
RSVP
.
all
([
"
readonly
"
);
handleGet
(
transaction
.
objectStore
(
"
metadata
"
).
get
(
id
)),
function
getAttachments
()
{
handleCursor
(
transaction
.
objectStore
(
"
attachment
"
).
index
(
"
_id
"
)
handleCursor
(
.
openCursor
(
IDBKeyRange
.
only
(
id
)),
addEntry
)
transaction
.
objectStore
(
"
attachment
"
).
index
(
"
_id
"
)
]);
.
openCursor
(
IDBKeyRange
.
only
(
id
)),
addEntry
,
resolve
,
reject
);
}
handleGet
(
transaction
.
objectStore
(
"
metadata
"
).
get
(
id
),
getAttachments
,
reject
);
});
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
attachment_dict
;
return
attachment_dict
;
});
});
};
};
function
handleRequest
(
request
)
{
function
handleRequest
(
request
,
resolve
,
reject
)
{
function
resolver
(
resolve
,
reject
)
{
request
.
onerror
=
reject
;
request
.
onerror
=
reject
;
request
.
onsuccess
=
function
()
{
request
.
onsuccess
=
function
()
{
resolve
(
request
.
result
);
resolve
(
request
.
result
);
};
};
}
return
new
RSVP
.
Promise
(
resolver
);
}
}
IndexedDBStorage
.
prototype
.
put
=
function
(
id
,
metadata
)
{
IndexedDBStorage
.
prototype
.
put
=
function
(
id
,
metadata
)
{
return
openIndexedDB
(
this
)
return
openIndexedDB
(
this
)
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
],
"
readwrite
"
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
return
handleRequest
(
transaction
.
objectStore
(
"
metadata
"
).
put
({
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
],
"
readwrite
"
);
"
_id
"
:
id
,
handleRequest
(
"
doc
"
:
metadata
transaction
.
objectStore
(
"
metadata
"
).
put
({
}));
"
_id
"
:
id
,
"
doc
"
:
metadata
}),
resolve
,
reject
);
});
});
});
};
};
...
@@ -12665,19 +12679,38 @@ return new Parser;
...
@@ -12665,19 +12679,38 @@ return new Parser;
}
}
IndexedDBStorage
.
prototype
.
remove
=
function
(
id
)
{
IndexedDBStorage
.
prototype
.
remove
=
function
(
id
)
{
var
resolved_amount
=
0
;
return
openIndexedDB
(
this
)
return
openIndexedDB
(
this
)
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
,
"
attachment
"
,
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
"
blob
"
],
"
readwrite
"
);
function
resolver
()
{
return
RSVP
.
all
([
if
(
resolved_amount
<
2
)
{
handleRequest
(
transaction
resolved_amount
+=
1
;
.
objectStore
(
"
metadata
"
)[
"
delete
"
](
id
)),
}
else
{
resolve
();
}
}
var
transaction
=
openTransaction
(
db
,
[
"
metadata
"
,
"
attachment
"
,
"
blob
"
],
"
readwrite
"
);
handleRequest
(
transaction
.
objectStore
(
"
metadata
"
)[
"
delete
"
](
id
),
resolver
,
reject
);
// XXX Why not possible to delete with KeyCursor?
// XXX Why not possible to delete with KeyCursor?
handleCursor
(
transaction
.
objectStore
(
"
attachment
"
).
index
(
"
_id
"
)
handleCursor
(
transaction
.
objectStore
(
"
attachment
"
).
index
(
"
_id
"
)
.
openCursor
(
IDBKeyRange
.
only
(
id
)),
deleteEntry
),
.
openCursor
(
IDBKeyRange
.
only
(
id
)),
deleteEntry
,
resolver
,
reject
);
handleCursor
(
transaction
.
objectStore
(
"
blob
"
).
index
(
"
_id
"
)
handleCursor
(
transaction
.
objectStore
(
"
blob
"
).
index
(
"
_id
"
)
.
openCursor
(
IDBKeyRange
.
only
(
id
)),
deleteEntry
)
.
openCursor
(
IDBKeyRange
.
only
(
id
)),
]);
deleteEntry
,
resolver
,
reject
);
});
});
});
};
};
...
@@ -12691,48 +12724,64 @@ return new Parser;
...
@@ -12691,48 +12724,64 @@ return new Parser;
}
}
return
openIndexedDB
(
this
)
return
openIndexedDB
(
this
)
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
transaction
=
openTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readonly
"
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
// XXX Should raise if key is not good
transaction
=
openTransaction
(
return
handleGet
(
transaction
.
objectStore
(
"
attachment
"
)
db
,
.
get
(
buildKeyPath
([
id
,
name
])));
[
"
attachment
"
,
"
blob
"
],
})
"
readonly
"
.
push
(
function
(
attachment
)
{
var
total_length
=
attachment
.
info
.
length
,
i
,
promise_list
=
[],
store
=
transaction
.
objectStore
(
"
blob
"
),
start_index
,
end_index
;
type
=
attachment
.
info
.
content_type
;
start
=
options
.
start
||
0
;
end
=
options
.
end
||
total_length
;
if
(
end
>
total_length
)
{
end
=
total_length
;
}
if
(
start
<
0
||
end
<
0
)
{
throw
new
jIO
.
util
.
jIOError
(
"
_start and _end must be positive
"
,
400
);
}
if
(
start
>
end
)
{
throw
new
jIO
.
util
.
jIOError
(
"
_start is greater than _end
"
,
400
);
}
start_index
=
Math
.
floor
(
start
/
UNITE
);
end_index
=
Math
.
floor
(
end
/
UNITE
);
if
(
end
%
UNITE
===
0
)
{
end_index
-=
1
;
}
for
(
i
=
start_index
;
i
<=
end_index
;
i
+=
1
)
{
promise_list
.
push
(
handleGet
(
store
.
get
(
buildKeyPath
([
id
,
name
,
i
])))
);
);
}
function
getBlob
(
attachment
)
{
return
RSVP
.
all
(
promise_list
);
var
total_length
=
attachment
.
info
.
length
,
result_list
=
[],
store
=
transaction
.
objectStore
(
"
blob
"
),
start_index
,
end_index
;
type
=
attachment
.
info
.
content_type
;
start
=
options
.
start
||
0
;
end
=
options
.
end
||
total_length
;
if
(
end
>
total_length
)
{
end
=
total_length
;
}
if
(
start
<
0
||
end
<
0
)
{
throw
new
jIO
.
util
.
jIOError
(
"
_start and _end must be positive
"
,
400
);
}
if
(
start
>
end
)
{
throw
new
jIO
.
util
.
jIOError
(
"
_start is greater than _end
"
,
400
);
}
start_index
=
Math
.
floor
(
start
/
UNITE
);
end_index
=
Math
.
floor
(
end
/
UNITE
)
-
1
;
if
(
end
%
UNITE
===
0
)
{
end_index
-=
1
;
}
function
resolver
(
result
)
{
result_list
.
push
(
result
);
resolve
(
result_list
);
}
function
getPart
(
i
)
{
return
function
(
result
)
{
if
(
result
)
{
result_list
.
push
(
result
);
}
i
+=
1
;
handleGet
(
store
.
get
(
buildKeyPath
([
id
,
name
,
i
])),
(
i
<=
end_index
)
?
getPart
(
i
)
:
resolver
,
reject
);
};
}
getPart
(
start_index
-
1
)();
}
// XXX Should raise if key is not good
handleGet
(
transaction
.
objectStore
(
"
attachment
"
)
.
get
(
buildKeyPath
([
id
,
name
])),
getBlob
,
reject
);
});
})
})
.
push
(
function
(
result_list
)
{
.
push
(
function
(
result_list
)
{
var
array_buffer_list
=
[],
var
array_buffer_list
=
[],
...
@@ -12753,19 +12802,24 @@ return new Parser;
...
@@ -12753,19 +12802,24 @@ return new Parser;
});
});
};
};
function
removeAttachment
(
transaction
,
id
,
name
)
{
function
removeAttachment
(
transaction
,
id
,
name
,
resolve
,
reject
)
{
return
RSVP
.
all
([
// XXX How to get the right attachment
// XXX How to get the right attachment
handleRequest
(
transaction
.
objectStore
(
"
attachment
"
)[
"
delete
"
](
function
deleteContent
()
{
handleCursor
(
transaction
.
objectStore
(
"
blob
"
).
index
(
"
_id_attachment
"
)
.
openCursor
(
IDBKeyRange
.
only
([
id
,
name
])),
deleteEntry
,
resolve
,
reject
);
}
handleRequest
(
transaction
.
objectStore
(
"
attachment
"
)[
"
delete
"
](
buildKeyPath
([
id
,
name
])
buildKeyPath
([
id
,
name
])
)),
),
handleCursor
(
transaction
.
objectStore
(
"
blob
"
).
index
(
"
_id_attachment
"
)
deleteContent
,
.
openCursor
(
IDBKeyRange
.
only
(
reject
[
id
,
name
]
);
)),
deleteEntry
)
]);
}
}
IndexedDBStorage
.
prototype
.
putAttachment
=
function
(
id
,
name
,
blob
)
{
IndexedDBStorage
.
prototype
.
putAttachment
=
function
(
id
,
name
,
blob
)
{
...
@@ -12793,38 +12847,43 @@ return new Parser;
...
@@ -12793,38 +12847,43 @@ return new Parser;
// Remove previous attachment
// Remove previous attachment
transaction
=
openTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readwrite
"
);
transaction
=
openTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readwrite
"
);
return
removeAttachment
(
transaction
,
id
,
name
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
})
function
write
()
{
.
push
(
function
()
{
var
len
=
blob_part
.
length
-
1
,
attachment_store
=
transaction
.
objectStore
(
"
attachment
"
),
var
promise_list
=
[
blob_store
=
transaction
.
objectStore
(
"
blob
"
);
handleRequest
(
transaction
.
objectStore
(
"
attachment
"
).
put
({
function
putBlobPart
(
i
)
{
"
_key_path
"
:
buildKeyPath
([
id
,
name
]),
return
function
()
{
"
_id
"
:
id
,
i
+=
1
;
"
_attachment
"
:
name
,
handleRequest
(
"
info
"
:
{
blob_store
.
put
({
"
content_type
"
:
blob
.
type
,
"
_key_path
"
:
buildKeyPath
([
id
,
name
,
i
]),
"
length
"
:
blob
.
size
"
_id
"
:
id
,
}
"
_attachment
"
:
name
,
}))
"
_part
"
:
i
,
],
"
blob
"
:
blob_part
[
i
]
len
=
blob_part
.
length
,
}),
blob_store
=
transaction
.
objectStore
(
"
blob
"
),
(
i
<
len
)
?
putBlobPart
(
i
)
:
resolve
,
i
;
reject
for
(
i
=
0
;
i
<
len
;
i
+=
1
)
{
);
promise_list
.
push
(
};
handleRequest
(
blob_store
.
put
({
}
"
_key_path
"
:
buildKeyPath
([
id
,
name
,
handleRequest
(
i
]),
attachment_store
.
put
({
"
_id
"
:
id
,
"
_key_path
"
:
buildKeyPath
([
id
,
name
]),
"
_attachment
"
:
name
,
"
_id
"
:
id
,
"
_part
"
:
i
,
"
_attachment
"
:
name
,
"
blob
"
:
blob_part
[
i
]
"
info
"
:
{
}))
"
content_type
"
:
blob
.
type
,
);
"
length
"
:
blob
.
size
}
}
// Store all new data
}),
return
RSVP
.
all
(
promise_list
);
putBlobPart
(
-
1
),
reject
);
}
removeAttachment
(
transaction
,
id
,
name
,
write
,
reject
);
});
});
});
};
};
...
@@ -12833,7 +12892,9 @@ return new Parser;
...
@@ -12833,7 +12892,9 @@ return new Parser;
.
push
(
function
(
db
)
{
.
push
(
function
(
db
)
{
var
transaction
=
openTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
var
transaction
=
openTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readwrite
"
);
"
readwrite
"
);
return
removeAttachment
(
transaction
,
id
,
name
);
return
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
removeAttachment
(
transaction
,
id
,
name
,
resolve
,
reject
);
});
});
});
};
};
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_jio_js.xml
View file @
4172db50
...
@@ -236,7 +236,7 @@
...
@@ -236,7 +236,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
95
8.24032.62613.61166
</string>
</value>
<value>
<string>
95
9.8888.26905.39645
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -254,7 +254,7 @@
...
@@ -254,7 +254,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
149
1207924.21
</float>
<float>
149
4334109.43
</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