Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
543c6f42
Commit
543c6f42
authored
May 30, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
Jun 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
JIO Local Storage does not browse all localStorage anymore.
parent
11f81591
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
22 deletions
+53
-22
OfficeJS/src/jio.storage.js
OfficeJS/src/jio.storage.js
+53
-22
No files found.
OfficeJS/src/jio.storage.js
View file @
543c6f42
...
...
@@ -32,6 +32,34 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
var
that
=
Jio
.
newBaseStorage
(
spec
,
my
),
priv
=
{};
priv
.
storage_file_array_name
=
'
jio/local/filearray
'
;
priv
.
getPathArray
=
function
()
{
var
storage_file_array
=
LocalOrCookieStorage
.
getItem
(
priv
.
storage_file_array_name
);
if
(
storage_file_array
===
null
)
{
LocalOrCookieStorage
.
setItem
(
priv
.
storage_file_array_name
,[]);
return
[];
}
return
storage_file_array
;
};
priv
.
addPath
=
function
(
path
)
{
var
patharray
=
priv
.
getPathArray
();
patharray
.
push
(
path
);
LocalOrCookieStorage
.
setItem
(
priv
.
storage_file_array_name
,
patharray
);
};
priv
.
removePath
=
function
(
path
)
{
var
i
,
patharray
=
priv
.
getPathArray
(),
newpatharray
=
[];
for
(
i
=
0
;
i
<
patharray
.
length
;
i
+=
1
)
{
if
(
patharray
[
i
]
!==
path
)
{
newpatharray
.
push
(
patharray
[
i
]);
}
}
LocalOrCookieStorage
.
setItem
(
priv
.
storage_file_array_name
,
newpatharray
);
};
that
.
checkNameAvailability
=
function
()
{
// checks the availability of the [job.userName].
// if the name already exists, it is not available.
...
...
@@ -39,14 +67,14 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// wait a little in order to simulate asynchronous operation
setTimeout
(
function
()
{
var
localStorageObject
=
null
,
k
,
splitk
;
localStorageObject
=
LocalOrCookieStorage
.
getAll
();
for
(
k
in
localStorageObject
)
{
split
k
=
k
.
split
(
'
/
'
);
if
(
split
k
[
0
]
===
'
jio
'
&&
split
k
[
1
]
===
'
local
'
&&
split
k
[
2
]
===
that
.
getUserName
())
{
var
allpatharray
,
i
,
split
;
allpatharray
=
priv
.
getPathArray
();
for
(
i
=
0
;
i
<
allpatharray
.
length
;
i
+=
1
)
{
split
=
allpatharray
.
split
(
'
/
'
);
if
(
split
[
0
]
===
'
jio
'
&&
split
[
1
]
===
'
local
'
&&
split
[
2
]
===
that
.
getUserName
())
{
return
that
.
done
(
false
);
}
}
...
...
@@ -64,13 +92,13 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// wait a little in order to simulate asynchronous saving
setTimeout
(
function
()
{
var
doc
=
null
;
var
doc
=
null
,
path
=
'
jio/local/
'
+
that
.
getStorageUserName
()
+
'
/
'
+
that
.
getApplicantID
()
+
'
/
'
+
that
.
getFileName
();
// reading
doc
=
LocalOrCookieStorage
.
getItem
(
'
jio/local/
'
+
that
.
getStorageUserName
()
+
'
/
'
+
that
.
getApplicantID
()
+
'
/
'
+
that
.
getFileName
());
doc
=
LocalOrCookieStorage
.
getItem
(
path
);
if
(
!
doc
)
{
// create document
doc
=
{
...
...
@@ -79,6 +107,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
'
creationDate
'
:
Date
.
now
(),
'
lastModified
'
:
Date
.
now
()
};
priv
.
addPath
(
path
);
}
else
{
// overwriting
doc
.
lastModified
=
Date
.
now
();
...
...
@@ -133,17 +162,18 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// 'lastModified':date,'creationDate':date}
setTimeout
(
function
()
{
var
list
=
[],
localStorageObject
=
null
,
k
=
'
key
'
,
var
list
=
[],
patharray
=
[],
i
,
k
=
'
key
'
,
splitk
=
[
'
splitedkey
'
],
fileObject
=
{};
localStorageObject
=
LocalOrCookieStorage
.
getAll
();
for
(
k
in
localStorageObject
)
{
patharray
=
priv
.
getPathArray
();
for
(
i
=
0
;
i
<
patharray
.
length
;
i
+=
1
)
{
k
=
patharray
[
i
];
splitk
=
k
.
split
(
'
/
'
);
if
(
splitk
[
0
]
===
'
jio
'
&&
splitk
[
1
]
===
'
local
'
&&
splitk
[
2
]
===
that
.
getStorageUserName
()
&&
splitk
[
3
]
===
that
.
getApplicantID
())
{
fileObject
=
JSON
.
parse
(
localStorageObject
[
k
]
);
fileObject
=
LocalOrCookieStorage
.
getItem
(
k
);
list
.
push
({
'
fileName
'
:
fileObject
.
fileName
,
'
creationDate
'
:
fileObject
.
creationDate
,
...
...
@@ -161,12 +191,13 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.fileName: the document name.
setTimeout
(
function
()
{
var
path
=
'
jio/local/
'
+
that
.
getStorageUserName
()
+
'
/
'
+
that
.
getApplicantID
()
+
'
/
'
+
that
.
getFileName
()
// deleting
LocalOrCookieStorage
.
deleteItem
(
'
jio/local/
'
+
that
.
getStorageUserName
()
+
'
/
'
+
that
.
getApplicantID
()
+
'
/
'
+
that
.
getFileName
());
LocalOrCookieStorage
.
deleteItem
(
path
);
priv
.
removePath
(
path
);
return
that
.
done
();
},
100
);
};
...
...
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