Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Hardik Juneja
jio-main
Commits
c74c465d
Commit
c74c465d
authored
Sep 21, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Plain Diff
merge indexedDB branch
parents
86eaa055
4ed7981c
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1873 additions
and
299 deletions
+1873
-299
jio.js
jio.js
+24
-1
src/jio.storage/davstorage.js
src/jio.storage/davstorage.js
+49
-8
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+681
-285
src/jio/features/restParamChecker.js
src/jio/features/restParamChecker.js
+21
-1
test/jio.storage/davstorage.tests.js
test/jio.storage/davstorage.tests.js
+288
-4
test/jio.storage/indexeddbstorage.tests.js
test/jio.storage/indexeddbstorage.tests.js
+802
-0
test/tests.html
test/tests.html
+8
-0
No files found.
jio.js
View file @
c74c465d
...
...
@@ -2427,6 +2427,9 @@ function restCommandRejecter(param, args) {
if
(
arg
.
columnNumber
!==
undefined
&&
arg
.
columnNumber
!==
null
)
{
current_priority
.
columnNumber
=
arg
.
columnNumber
;
}
if
(
arg
.
fileName
!==
undefined
&&
arg
.
fileName
!==
null
)
{
current_priority
.
fileName
=
arg
.
fileName
;
}
if
(
arg
.
filename
!==
undefined
&&
arg
.
filename
!==
null
)
{
current_priority
.
filename
=
arg
.
filename
;
}
...
...
@@ -3659,8 +3662,28 @@ function enableRestParamChecker(jio, shared) {
}
});
[
"
getAttachment
"
,
"
removeAttachment
"
].
forEach
(
function
(
method
)
{
[
"
removeAttachment
"
].
forEach
(
function
(
method
)
{
shared
.
on
(
method
,
function
(
param
)
{
if
(
!
checkId
(
param
))
{
checkAttachmentId
(
param
);
}
});
});
[
"
getAttachment
"
].
forEach
(
function
(
method
)
{
shared
.
on
(
method
,
function
(
param
)
{
if
(
param
.
storage_spec
.
type
!==
"
indexeddb
"
&&
param
.
storage_spec
.
type
!==
"
dav
"
&&
(
param
.
kwargs
.
_start
!==
undefined
||
param
.
kwargs
.
_end
!==
undefined
))
{
restCommandRejecter
(
param
,
[
'
bad_request
'
,
'
unsupport
'
,
'
_start, _end not support
'
]);
return
false
;
}
if
(
!
checkId
(
param
))
{
checkAttachmentId
(
param
);
}
...
...
src/jio.storage/davstorage.js
View file @
c74c465d
...
...
@@ -184,8 +184,15 @@
* An ajax object to do the good request according to the auth type
*/
var
ajax
=
{
"
none
"
:
function
(
method
,
type
,
url
,
data
)
{
"
none
"
:
function
(
method
,
type
,
url
,
data
,
start
,
end
)
{
var
headers
=
{};
if
(
start
!==
undefined
)
{
if
(
end
!==
undefined
)
{
headers
=
{
"
Range
"
:
"
bytes=
"
+
start
+
"
-
"
+
end
};
}
else
{
headers
=
{
"
Range
"
:
"
bytes=
"
+
start
+
"
-
"
};
}
}
if
(
method
===
"
PROPFIND
"
)
{
headers
.
Depth
=
"
1
"
;
}
...
...
@@ -197,8 +204,15 @@
"
headers
"
:
headers
});
},
"
basic
"
:
function
(
method
,
type
,
url
,
data
,
login
)
{
"
basic
"
:
function
(
method
,
type
,
url
,
data
,
start
,
end
,
login
)
{
var
headers
=
{
"
Authorization
"
:
"
Basic
"
+
login
};
if
(
start
!==
undefined
)
{
if
(
end
!==
undefined
)
{
headers
.
Range
=
"
bytes=
"
+
start
+
"
-
"
+
end
;
}
else
{
headers
.
Range
=
"
bytes=
"
+
start
+
"
-
"
;
}
}
if
(
method
===
"
PROPFIND
"
)
{
headers
.
Depth
=
"
1
"
;
}
...
...
@@ -253,6 +267,8 @@
this
.
_url
+
'
/
'
+
idsToFileName
(
param
.
_id
,
param
.
_attachment
)
+
"
?_=
"
+
Date
.
now
(),
param
.
_blob
,
undefined
,
undefined
,
this
.
_login
);
};
...
...
@@ -263,6 +279,8 @@
"
text
"
,
this
.
_url
+
'
/
'
+
idsToFileName
(
param
.
_id
),
null
,
undefined
,
undefined
,
this
.
_login
).
then
(
function
(
e
)
{
try
{
...
...
@@ -286,6 +304,8 @@
"
blob
"
,
this
.
_url
+
'
/
'
+
idsToFileName
(
param
.
_id
,
param
.
_attachment
),
null
,
param
.
_start
,
param
.
_end
-
1
,
this
.
_login
);
};
...
...
@@ -296,6 +316,8 @@
null
,
this
.
_url
+
'
/
'
+
idsToFileName
(
param
.
_id
)
+
"
?_=
"
+
Date
.
now
(),
null
,
undefined
,
undefined
,
this
.
_login
);
};
...
...
@@ -307,6 +329,8 @@
this
.
_url
+
'
/
'
+
idsToFileName
(
param
.
_id
,
param
.
_attachment
)
+
"
?_=
"
+
Date
.
now
(),
null
,
undefined
,
undefined
,
this
.
_login
);
};
...
...
@@ -317,6 +341,8 @@
"
text
"
,
this
.
_url
+
'
/
'
,
null
,
undefined
,
undefined
,
this
.
_login
).
then
(
function
(
e
)
{
var
i
,
rows
=
[],
row
,
responses
=
new
DOMParser
().
parseFromString
(
...
...
@@ -346,9 +372,11 @@
row
.
id
=
row
.
id
[
0
];
}
if
(
row
!==
undefined
)
{
if
(
row
.
id
!==
""
)
{
rows
[
rows
.
length
]
=
row
;
}
}
}
return
{
"
target
"
:
{
"
response
"
:
{
"
total_rows
"
:
rows
.
length
,
"
rows
"
:
rows
...
...
@@ -631,7 +659,18 @@
);
}
};
if
(
param
.
_start
<
0
||
param
.
_end
<
0
)
{
command
.
reject
(
405
,
"
invalide _start,_end
"
,
"
_start and _end must be positive
"
);
return
;
}
if
(
param
.
_start
>
param
.
_end
)
{
command
.
reject
(
405
,
"
invalide _start,_end
"
,
"
start is great then end
"
);
return
;
}
this
.
_get
(
param
).
then
(
o
.
getAttachment
).
then
(
o
.
success
,
o
.
reject
,
o
.
notifyProgress
);
...
...
@@ -833,10 +872,12 @@
}
e
.
target
.
response
.
rows
.
forEach
(
function
(
row
)
{
if
(
row
.
id
!==
""
)
{
requests
[
requests
.
length
]
=
that
.
_get
({
"
_id
"
:
row
.
id
}).
then
(
function
(
e
)
{
row
.
doc
=
e
.
target
.
response
;
});
}
});
o
.
count
=
0
;
...
...
src/jio.storage/indexeddbstorage.js
View file @
c74c465d
This diff is collapsed.
Click to expand it.
src/jio/features/restParamChecker.js
View file @
c74c465d
...
...
@@ -96,7 +96,7 @@ function enableRestParamChecker(jio, shared) {
}
});
[
"
getAttachment
"
,
"
removeAttachment
"
].
forEach
(
function
(
method
)
{
[
"
removeAttachment
"
].
forEach
(
function
(
method
)
{
shared
.
on
(
method
,
function
(
param
)
{
if
(
!
checkId
(
param
))
{
checkAttachmentId
(
param
);
...
...
@@ -104,6 +104,26 @@ function enableRestParamChecker(jio, shared) {
});
});
[
"
getAttachment
"
].
forEach
(
function
(
method
)
{
shared
.
on
(
method
,
function
(
param
)
{
if
(
param
.
storage_spec
.
type
!==
"
indexeddb
"
&&
param
.
storage_spec
.
type
!==
"
dav
"
&&
(
param
.
kwargs
.
_start
!==
undefined
||
param
.
kwargs
.
_end
!==
undefined
))
{
restCommandRejecter
(
param
,
[
'
bad_request
'
,
'
unsupport
'
,
'
_start, _end not support
'
]);
return
false
;
}
if
(
!
checkId
(
param
))
{
checkAttachmentId
(
param
);
}
});
});
[
"
check
"
,
"
repair
"
].
forEach
(
function
(
method
)
{
shared
.
on
(
method
,
function
(
param
)
{
if
(
param
.
kwargs
.
_id
!==
undefined
)
{
...
...
test/jio.storage/davstorage.tests.js
View file @
c74c465d
This diff is collapsed.
Click to expand it.
test/jio.storage/indexeddbstorage.tests.js
0 → 100644
View file @
c74c465d
This diff is collapsed.
Click to expand it.
test/tests.html
View file @
c74c465d
...
...
@@ -57,7 +57,15 @@
<script
src=
"../src/jio.storage/querystorage.js"
></script>
<script
src=
"../test/jio.storage/querystorage.tests.js"
></script>
<script
src=
"../src/jio.storage/replicatestorage.js"
></script>
<script
src=
"../test/jio.storage/replicatestorage.tests.js"
></script>
<!--
<script src="../src/jio.storage/indexeddbstorage.js"></script>
<script src="../test/jio.storage/indexeddbstorage.tests.js"></script>
-->
</body>
</html>
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