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
Hardik Juneja
jio
Commits
7d7f2aeb
Commit
7d7f2aeb
authored
Nov 23, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating localstorage.js get method
parent
197468c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
20 deletions
+40
-20
src/jio.storage/localstorage.js
src/jio.storage/localstorage.js
+40
-20
No files found.
src/jio.storage/localstorage.js
View file @
7d7f2aeb
...
@@ -384,33 +384,53 @@ var newLocalStorage = function ( spec, my ) {
...
@@ -384,33 +384,53 @@ var newLocalStorage = function ( spec, my ) {
/**
/**
* Loads a document from the local storage.
* Loads a document from the local storage.
* It will load file in 'jio/local/USR/APP/FILE_NAME'.
* It will load file in 'jio/local/USR/APP/FILE_NAME'.
* You can add an 'options' object to the job, it can contain:
* - metadata_only {boolean} default false, retrieve the file metadata
* only if true.
* @method get
* @method get
*/
*/
that
.
get
=
function
(
command
)
{
that
.
get
=
function
(
command
)
{
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
secured_docid
=
priv
.
secureDocId
(
command
.
getDocId
()),
var
docid
,
doc
,
docpath
,
attmtid
,
attmt
;
doc
=
null
;
docid
=
command
.
getDocId
();
docpath
=
'
jio/local/
'
+
priv
.
secured_username
+
'
/
'
+
if
(
!
priv
.
checkSecuredDocId
(
priv
.
secured_applicationname
+
'
/
'
+
docid
;
secured_docid
,
command
.
getDocId
(),
'
get
'
))
{
return
;}
attmtid
=
command
.
getAttachmentId
();
doc
=
localStorage
.
getItem
(
if
(
attmtid
)
{
'
jio/local/
'
+
priv
.
secured_username
+
'
/
'
+
// this is an attachment
priv
.
secured_applicationname
+
'
/
'
+
secured_docid
);
attmt
=
localstorage
.
getItem
(
docpath
+
'
/
'
+
attmtid
);
if
(
!
doc
)
{
if
(
!
attmt
)
{
that
.
error
({
status
:
404
,
statusText
:
'
Not Found.
'
,
// there is no attachment to get
error
:
'
not_found
'
,
that
.
error
({
message
:
'
Document "
'
+
command
.
getDocId
()
+
status
:
404
,
statusText
:
'
Not found
'
,
error
:
'
not_found
'
,
'
" not found.
'
,
message
:
'
Document is missing attachment.
'
,
reason
:
'
missing
'
});
reason
:
'
document is missing attachment
'
});
return
;
}
// send the attachment content
that
.
success
(
attmt
);
}
else
{
}
else
{
if
(
command
.
getOption
(
'
metadata_only
'
))
{
// this is a document
delete
doc
.
content
;
doc
=
localstorage
.
getItem
(
docpath
);
if
(
!
doc
)
{
// the document does not exist
that
.
error
({
status
:
404
,
statusText
:
'
Not Found.
'
,
error
:
'
not_found
'
,
message
:
'
Document "
'
+
docid
+
'
" not found.
'
,
reason
:
'
missing
'
});
}
else
{
if
(
!
command
.
getDocInfo
(
'
revs
'
))
{
delete
doc
.
_revisions
;
}
if
(
!
command
.
getDocInfo
(
'
revs_info
'
))
{
delete
doc
.
_revs_info
;
}
if
(
command
.
getDocInfo
(
'
conflicts
'
))
{
doc
.
_conflicts
=
{
total_rows
:
0
,
rows
:[]};
}
that
.
success
(
doc
);
}
}
that
.
success
(
doc
);
}
}
});
});
};
// end get
};
// end get
...
...
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