Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio_mebibou
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
Alexandra Rogova
jio_mebibou
Commits
10aa7bcb
Commit
10aa7bcb
authored
Mar 18, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into erp5storage
parents
7bbd7745
ea956c97
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
121 additions
and
22 deletions
+121
-22
Makefile
Makefile
+1
-2
docs/_static/jio-2.0.0-wip-min.zip
docs/_static/jio-2.0.0-wip-min.zip
+0
-0
docs/_static/jio-2.0.0-wip.zip
docs/_static/jio-2.0.0-wip.zip
+0
-0
docs/metadata.rst
docs/metadata.rst
+4
-4
jio.js
jio.js
+11
-2
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+17
-8
src/queries/core/simplequery.js
src/queries/core/simplequery.js
+11
-2
test/html5.js
test/html5.js
+60
-4
test/queries/key.tests.js
test/queries/key.tests.js
+17
-0
No files found.
Makefile
View file @
10aa7bcb
...
...
@@ -26,11 +26,10 @@ zip:
@
mkdir
$(TMPDIR)
/jio
@
mkdir
$(TMPDIR)
/jio/storage
@
cp
jio.js
$(TMPDIR)
/jio/
@
cp
jiodate.js
$(TMPDIR)
/jio/
@
cp
jioquery.js
$(TMPDIR)
/jio/
@
cp
src/sha1.amd.js
$(TMPDIR)
/jio/
@
cp
src/sha2.amd.js
$(TMPDIR)
/jio/
@
cp
src/sha256.amd.js
$(TMPDIR)
/jio/
@
cp
src/jio.date/jiodate.js
$(TMPDIR)
/jio/
@
cp
lib/rsvp/rsvp-custom.js
$(TMPDIR)
/jio/
@
cp
lib/rsvp/rsvp-custom.amd.js
$(TMPDIR)
/jio/
@
cp
lib/jquery/jquery.js
$(TMPDIR)
/jio/
...
...
docs/_static/jio-2.0.0-wip-min.zip
View file @
10aa7bcb
No preview for this file type
docs/_static/jio-2.0.0-wip.zip
View file @
10aa7bcb
No preview for this file type
docs/metadata.rst
View file @
10aa7bcb
...
...
@@ -34,11 +34,11 @@ See below XML and its JSON equivalent:
+============================================+=======================================+
| .. code-block:: xml | .. code-block:: javascript |
| | |
| <dc:title>My Title</dc:title> | {"title":
"My Title"}
|
| <dc:title>My Title</dc:title> | {"title":
"My Title"}
|
+--------------------------------------------+---------------------------------------+
| .. code-block:: xml | .. code-block:: javascript |
| | |
| <dc:contributor>Me</dc:contributor> | {"contributor":
["Me", "And You"]}
|
| <dc:contributor>Me</dc:contributor> | {"contributor":
["Me", "And You"]}
|
| <dc:contributor>And You</dc:contributor> | |
+--------------------------------------------+---------------------------------------+
| .. code-block:: xml | .. code-block:: javascript |
...
...
@@ -63,7 +63,7 @@ Identification
A specific jIO metadata which helps the storage to find a document
(can be a real path name, a dc:identifier, a uuid, ...). **String Only**
* **identifer**
* **identif
i
er**
| ``{"identifier": "http://domain/jio_home_page"}``
| ``{"identifier": "urn:ISBN:978-1-2345-6789-X"}``
...
...
@@ -73,7 +73,7 @@ Identification
best practice is to identify the resource with a string or number
conforming to a formal identification system. Examples of formal identification
systems include the `Uniform Resource Identifier <http://en.wikipedia.org/wiki/URI>`_ (URI)
(including the `Uniform Resource Locator <http://en.wikipedia.org/wiki/URL>`_ (URL),
(including the `Uniform Resource Locator <http://en.wikipedia.org/wiki/URL>`_ (URL)
)
,
the `Digital Object Identifier <http://en.wikipedia.org/wiki/Digital_object_identifier>`_ (DOI)
and the `International Standard Book Number <http://en.wikipedia.org/wiki/Isbn>`_ (ISBN).
...
...
jio.js
View file @
10aa7bcb
...
...
@@ -4773,8 +4773,17 @@ SimpleQuery.prototype.match = function (item) {
cast_to
=
this
.
_key_schema
.
cast_lookup
[
cast_to
];
}
value
=
cast_to
(
value
);
object_value
=
cast_to
(
object_value
);
try
{
value
=
cast_to
(
value
);
}
catch
(
e
)
{
value
=
undefined
;
}
try
{
object_value
=
cast_to
(
object_value
);
}
catch
(
e
)
{
object_value
=
undefined
;
}
}
}
else
{
object_value
=
item
[
key
];
...
...
src/jio.storage/localstorage.js
View file @
10aa7bcb
...
...
@@ -5,7 +5,7 @@
*/
/*jslint indent: 2, maxlen: 80, sloppy: true, nomen: true, regexp: true */
/*global jIO, localStorage, setTimeout, window, define,
/*global jIO, localStorage, setTimeout, window, define,
Blob, Uint8Array,
exports, require */
/**
...
...
@@ -286,7 +286,7 @@
* @param {Object} options The command options
*/
LocalStorage
.
prototype
.
getAttachment
=
function
(
command
,
param
)
{
var
doc
;
var
doc
,
i
,
uint8array
,
binarystring
;
doc
=
this
.
_storage
.
getItem
(
this
.
_localpath
+
"
/
"
+
param
.
_id
);
if
(
doc
===
null
)
{
return
command
.
error
(
...
...
@@ -305,13 +305,22 @@
);
}
// Storing data twice in binarystring and in uint8array (in memory)
// is not a problem here because localStorage <= 5MB
binarystring
=
this
.
_storage
.
getItem
(
this
.
_localpath
+
"
/
"
+
param
.
_id
+
"
/
"
+
param
.
_attachment
)
||
""
;
uint8array
=
new
Uint8Array
(
binarystring
.
length
);
for
(
i
=
0
;
i
<
binarystring
.
length
;
i
+=
1
)
{
uint8array
[
i
]
=
binarystring
.
charCodeAt
(
i
);
// mask `& 0xFF` not necessary
}
uint8array
=
new
Blob
([
uint8array
],
{
"
type
"
:
doc
.
_attachments
[
param
.
_attachment
].
content_type
||
""
});
command
.
success
({
"
data
"
:
this
.
_storage
.
getItem
(
this
.
_localpath
+
"
/
"
+
param
.
_id
+
"
/
"
+
param
.
_attachment
)
||
""
,
"
digest
"
:
doc
.
_attachments
[
param
.
_attachment
].
digest
,
"
content_type
"
:
doc
.
_attachments
[
param
.
_attachment
].
content_type
||
""
"
data
"
:
uint8array
,
"
digest
"
:
doc
.
_attachments
[
param
.
_attachment
].
digest
});
};
...
...
src/queries/core/simplequery.js
View file @
10aa7bcb
...
...
@@ -159,8 +159,17 @@ SimpleQuery.prototype.match = function (item) {
cast_to
=
this
.
_key_schema
.
cast_lookup
[
cast_to
];
}
value
=
cast_to
(
value
);
object_value
=
cast_to
(
object_value
);
try
{
value
=
cast_to
(
value
);
}
catch
(
e
)
{
value
=
undefined
;
}
try
{
object_value
=
cast_to
(
object_value
);
}
catch
(
e
)
{
object_value
=
undefined
;
}
}
}
else
{
object_value
=
item
[
key
];
...
...
test/html5.js
View file @
10aa7bcb
...
...
@@ -106,8 +106,59 @@
////////////////////////////////////////////////////////////
function
Uint8Array
(
one
)
{
// , two, three
/*jslint bitwise: true */
var
i
;
if
(
one
instanceof
Uint8Array
)
{
for
(
i
=
0
;
i
<
one
.
length
;
i
+=
1
)
{
this
[
i
]
=
one
[
i
]
&
0xFF
;
}
this
.
length
=
one
.
length
;
return
;
}
if
(
typeof
one
===
"
number
"
&&
isFinite
(
one
))
{
for
(
i
=
0
;
i
<
one
;
i
+=
1
)
{
this
[
i
]
=
0
;
}
this
.
length
=
one
;
return
;
}
// if (one instanceof ArrayBuffer) {
// two === byteOffset
// three === length
// }
this
.
length
=
0
;
}
Uint8Array
.
prototype
.
set
=
function
()
{
throw
new
Error
(
"
Not implemented
"
);
};
Uint8Array
.
prototype
.
subarray
=
function
(
begin
,
end
)
{
if
(
typeof
begin
!==
"
number
"
||
!
isFinite
(
begin
)
||
begin
<
0
)
{
begin
=
0
;
}
if
(
begin
>
this
.
length
)
{
begin
=
this
.
length
;
}
if
(
typeof
end
!==
"
number
"
||
!
isFinite
(
end
)
||
end
>
this
.
length
)
{
end
=
this
.
length
;
}
if
(
end
<
begin
)
{
end
=
begin
;
}
var
i
,
j
,
uint8array
=
new
Uint8Array
(
end
-
begin
);
/*jslint bitwise: true */
for
(
i
=
begin
,
j
=
0
;
i
<
end
;
i
+=
1
,
j
+=
1
)
{
uint8array
[
j
]
=
this
[
i
]
&
0xFF
;
}
return
uint8array
;
};
////////////////////////////////////////////////////////////
function
Blob
(
parts
,
properties
)
{
var
i
,
part
,
raw
=
''
,
type
;
var
i
,
j
,
part
,
raw
=
''
,
type
;
type
=
(
properties
&&
properties
.
type
&&
properties
.
type
.
toString
())
||
""
;
if
(
!
Array
.
isArray
(
parts
))
{
throw
new
TypeError
(
"
The method parameter is missing or invalid.
"
);
...
...
@@ -121,6 +172,11 @@
part
=
parts
[
i
];
if
(
part
instanceof
Blob
)
{
raw
+=
part
.
_data
;
}
else
if
(
part
instanceof
Uint8Array
)
{
/*jslint bitwise: true */
for
(
j
=
0
;
j
<
part
.
length
;
j
+=
1
)
{
raw
+=
String
.
fromCharCode
(
part
[
j
]
&
0xFF
);
}
}
else
if
(
part
)
{
raw
+=
stringToUtf8ByteString
(
part
.
toString
());
}
else
if
(
part
===
undefined
)
{
...
...
@@ -160,8 +216,7 @@
};
////////////////////////////////////////////////////////////
// https://github.com/TristanCavelier/notesntools/blob/\
// master/javascript/emitter.js
function
FileReader
()
{
return
;
}
...
...
@@ -263,7 +318,8 @@
(
/
\b
PhantomJS
\b
/i
).
test
(
navigator
.
userAgent
))
{
window
.
Blob
=
Blob
;
window
.
FileReader
=
FileReader
;
//console.warn("Blob and FileReader have been replaced!");
window
.
Uint8Array
=
Uint8Array
;
//console.warn("Blob, FileReader and Uint8Array have been replaced!");
}
if
(
!
Function
.
prototype
.
bind
)
{
...
...
test/queries/key.tests.js
View file @
10aa7bcb
...
...
@@ -130,6 +130,10 @@
read_from
:
'
date
'
,
cast_to
:
dateCast
,
equal_match
:
sameYear
},
broken
:
{
read_from
:
'
date
'
,
cast_to
:
function
()
{
throw
new
Error
(
'
Broken!
'
);
}
}
};
...
...
@@ -178,6 +182,19 @@
})
);
promise
.
push
(
jIO
.
QueryFactory
.
create
({
type
:
'
simple
'
,
key
:
keys
.
broken
,
value
:
'
2013-02-10
'
}).
exec
(
docList
()).
then
(
function
(
dl
)
{
deepEqual
(
dl
.
length
,
0
,
'
Constructors that throw exceptions should not break a query, but silently fail comparisons
'
);
})
);
RSVP
.
all
(
promise
).
then
(
noop
).
always
(
start
);
});
...
...
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