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
df16f201
Commit
df16f201
authored
Jun 04, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
Jun 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename vars.
parent
4a4b4a5b
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
646 additions
and
660 deletions
+646
-660
OfficeJS/component/elrte.html
OfficeJS/component/elrte.html
+1
-1
OfficeJS/component/jquery-sheet.html
OfficeJS/component/jquery-sheet.html
+1
-1
OfficeJS/component/left_nav_bar.html
OfficeJS/component/left_nav_bar.html
+6
-6
OfficeJS/component/slickgrid_document_lister.html
OfficeJS/component/slickgrid_document_lister.html
+32
-32
OfficeJS/component/svg-edit.html
OfficeJS/component/svg-edit.html
+1
-1
OfficeJS/index.html
OfficeJS/index.html
+1
-0
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+47
-51
OfficeJS/src/jio.dummystorages.js
OfficeJS/src/jio.dummystorages.js
+43
-51
OfficeJS/src/jio.js
OfficeJS/src/jio.js
+82
-82
OfficeJS/src/jio.storage.js
OfficeJS/src/jio.storage.js
+228
-231
OfficeJS/test/jiotests.js
OfficeJS/test/jiotests.js
+204
-204
No files found.
OfficeJS/component/elrte.html
View file @
df16f201
...
@@ -49,7 +49,7 @@ $().ready(function() {
...
@@ -49,7 +49,7 @@ $().ready(function() {
<div>
<div>
<input
type=
"text"
<input
type=
"text"
name=
"fileName"
name=
"fileName"
id=
"input_file
N
ame"
id=
"input_file
_n
ame"
value=
""
value=
""
placeholder=
"File name here"
/>
placeholder=
"File name here"
/>
<button
type=
"submit"
<button
type=
"submit"
...
...
OfficeJS/component/jquery-sheet.html
View file @
df16f201
...
@@ -208,7 +208,7 @@ function goToObj(s){
...
@@ -208,7 +208,7 @@ function goToObj(s){
<div>
<div>
<input
type=
"text"
<input
type=
"text"
name=
"fileName"
name=
"fileName"
id=
"input_file
N
ame"
id=
"input_file
_n
ame"
value=
""
value=
""
placeholder=
"File name here"
/>
placeholder=
"File name here"
/>
<button
type=
"submit"
<button
type=
"submit"
...
...
OfficeJS/component/left_nav_bar.html
View file @
df16f201
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<
li
class
=
"
texteditor left-nav-tools
"
>
<
li
class
=
"
texteditor left-nav-tools
"
>
<
a
href
=
"
#/texteditor
"
<
a
href
=
"
#/texteditor
"
onclick
=
"
javascript:
onclick
=
"
javascript:
OfficeJS.open({app:'text
E
ditor'});
OfficeJS.open({app:'text
_e
ditor'});
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-font
"
><
/i
>
<
i
class
=
"
icon-font
"
><
/i
>
New
Text
Document
New
Text
Document
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
<
li
class
=
"
imgeditor left-nav-tools
"
>
<
li
class
=
"
imgeditor left-nav-tools
"
>
<
a
href
=
"
#/imgeditor
"
<
a
href
=
"
#/imgeditor
"
onclick
=
"
javascript:
onclick
=
"
javascript:
OfficeJS.open({app:'img
E
ditor'});
OfficeJS.open({app:'img
_e
ditor'});
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-pencil
"
><
/i
>
<
i
class
=
"
icon-pencil
"
><
/i
>
New
Image
New
Image
...
@@ -38,16 +38,16 @@
...
@@ -38,16 +38,16 @@
<
li
class
=
"
spreadsheet left-nav-tools
"
>
<
li
class
=
"
spreadsheet left-nav-tools
"
>
<
a
href
=
"
#/spreadsheet
"
<
a
href
=
"
#/spreadsheet
"
onclick
=
"
javascript:
onclick
=
"
javascript:
OfficeJS.open({app:'speadsheet'});
OfficeJS.open({app:'sp
r
eadsheet'});
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-signal
"
><
/i
>
<
i
class
=
"
icon-signal
"
><
/i
>
New
Spreadsheet
New
Spreadsheet
<
/a
>
<
/a
>
<
/li
>
<
/li
>
<!--
<
li
class
=
"
editpreferences left-nav-tools
"
>
-->
<!--
<
li
class
=
"
editpreferences left-nav-tools
"
>
-->
<!--
<
a
href
=
"
#/editpreferences
"
-->
<!--
<
a
href
=
"
#/edit
_
preferences
"
-->
<!--
onclick
=
"
javascript: -->
<!--
onclick
=
"
javascript: -->
<!-- OfficeJS.open({app:'editpreferences'}); -->
<!-- OfficeJS.open({app:'edit
_
preferences'}); -->
<!-- return false;
"
>
-->
<!-- return false;
"
>
-->
<!--
<
i
class
=
"
icon-check
"
><
/i> --
>
<!--
<
i
class
=
"
icon-check
"
><
/i> --
>
<!--
Edit
Preferences
-->
<!--
Edit
Preferences
-->
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
<
li
id
=
"
nav_document_list_header left-nav-tools
"
>
<
li
id
=
"
nav_document_list_header left-nav-tools
"
>
<
a
href
=
"
#/doclist
"
<
a
href
=
"
#/doclist
"
onclick
=
"
javascript:
onclick
=
"
javascript:
OfficeJS.open({app:'document
L
ister'});
OfficeJS.open({app:'document
_l
ister'});
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-list
"
><
/i
>
<
i
class
=
"
icon-list
"
><
/i
>
Document
List
Document
List
...
...
OfficeJS/component/slickgrid_document_lister.html
View file @
df16f201
...
@@ -43,9 +43,9 @@
...
@@ -43,9 +43,9 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!--
<!--
(
function
()
{
(
function
()
{
var
grid
,
onSortFunction
,
onClickFunction
,
check
box
selector
,
var
grid
,
onSortFunction
,
onClickFunction
,
check
_box_
selector
,
onRemoveSeveral
,
showIconFormatter
,
onRemoveSeveral
,
showIconFormatter
,
documentlist
=
OfficeJS
.
cloneCurrentDocumentList
(),
document
_
list
=
OfficeJS
.
cloneCurrentDocumentList
(),
columns
=
[],
columns
=
[],
options
=
{
options
=
{
enableCellNavigation
:
true
,
enableCellNavigation
:
true
,
...
@@ -62,18 +62,18 @@
...
@@ -62,18 +62,18 @@
var
i
,
lm
,
cd
,
split
,
mime
;
var
i
,
lm
,
cd
,
split
,
mime
;
for
(
i
=
0
;
i
<
array
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
array
.
length
;
i
+=
1
)
{
// file names
// file names
split
=
array
[
i
].
fileN
ame
.
split
(
'
.
'
);
split
=
array
[
i
].
n
ame
.
split
(
'
.
'
);
array
[
i
].
fileE
xt
=
''
;
array
[
i
].
e
xt
=
''
;
if
(
split
.
length
>
1
)
{
if
(
split
.
length
>
1
)
{
array
[
i
].
fileE
xt
=
split
[
split
.
length
-
1
];
array
[
i
].
e
xt
=
split
[
split
.
length
-
1
];
split
.
length
-=
1
;
split
.
length
-=
1
;
}
}
array
[
i
].
fileBaseN
ame
=
split
.
join
(
'
.
'
);
array
[
i
].
base_n
ame
=
split
.
join
(
'
.
'
);
// app & icon
// app & icon
mime
=
OfficeJS
.
getMimeOfExt
(
array
[
i
].
fileE
xt
);
mime
=
OfficeJS
.
getMimeOfExt
(
array
[
i
].
e
xt
);
if
(
!
mime
)
{
if
(
!
mime
)
{
array
[
i
].
icon
=
'
?
'
;
array
[
i
].
icon
=
'
?
'
;
array
[
i
].
app
=
'
text
E
ditor
'
;
array
[
i
].
app
=
'
text
_e
ditor
'
;
}
else
{
}
else
{
array
[
i
].
icon
=
mime
.
icon
;
array
[
i
].
icon
=
mime
.
icon
;
array
[
i
].
app
=
mime
.
pref
||
mime
.
app
;
array
[
i
].
app
=
mime
.
pref
||
mime
.
app
;
...
@@ -81,51 +81,51 @@
...
@@ -81,51 +81,51 @@
// dates
// dates
// FIXME : we can have 2012/1/1 12:5
// FIXME : we can have 2012/1/1 12:5
// we should have 2012/01/01 12:05
// we should have 2012/01/01 12:05
lm
=
(
new
Date
(
array
[
i
].
last
M
odified
));
lm
=
(
new
Date
(
array
[
i
].
last
_m
odified
));
cd
=
(
new
Date
(
array
[
i
].
creation
D
ate
));
cd
=
(
new
Date
(
array
[
i
].
creation
_d
ate
));
array
[
i
].
last
M
odified
=
lm
.
getFullYear
()
+
'
/
'
+
array
[
i
].
last
_m
odified
=
lm
.
getFullYear
()
+
'
/
'
+
(
lm
.
getMonth
()
+
1
)
+
'
/
'
+
lm
.
getDate
()
+
'
'
+
(
lm
.
getMonth
()
+
1
)
+
'
/
'
+
lm
.
getDate
()
+
'
'
+
lm
.
getHours
()
+
'
:
'
+
lm
.
getMinutes
();
lm
.
getHours
()
+
'
:
'
+
lm
.
getMinutes
();
array
[
i
].
creation
D
ate
=
cd
.
getFullYear
()
+
'
/
'
+
array
[
i
].
creation
_d
ate
=
cd
.
getFullYear
()
+
'
/
'
+
(
cd
.
getMonth
()
+
1
)
+
'
/
'
+
cd
.
getDate
()
+
'
'
+
(
cd
.
getMonth
()
+
1
)
+
'
/
'
+
cd
.
getDate
()
+
'
'
+
cd
.
getHours
()
+
'
:
'
+
cd
.
getMinutes
();
cd
.
getHours
()
+
'
:
'
+
cd
.
getMinutes
();
}
}
}(
documentlist
));
}(
document
_
list
));
$
(
function
()
{
$
(
function
()
{
check
box
selector
=
new
Slick
.
CheckboxSelectColumn
({
check
_box_
selector
=
new
Slick
.
CheckboxSelectColumn
({
cssClass
:
"
slick-cell-checkboxsel
"
cssClass
:
"
slick-cell-checkboxsel
"
});
});
columns
.
push
(
check
box
selector
.
getColumnDefinition
());
columns
.
push
(
check
_box_
selector
.
getColumnDefinition
());
columns
.
push
({
id
:
"
icon
"
,
name
:
""
,
field
:
"
icon
"
,
columns
.
push
({
id
:
"
icon
"
,
name
:
""
,
field
:
"
icon
"
,
sortable
:
true
,
resizable
:
false
,
width
:
24
,
sortable
:
true
,
resizable
:
false
,
width
:
24
,
formatter
:
showIconFormatter
});
formatter
:
showIconFormatter
});
columns
.
push
({
id
:
"
file
N
ame
"
,
name
:
"
Document
"
,
columns
.
push
({
id
:
"
file
_n
ame
"
,
name
:
"
Document
"
,
field
:
"
fileBaseN
ame
"
,
sortable
:
true
});
field
:
"
base_n
ame
"
,
sortable
:
true
});
columns
.
push
({
id
:
"
last
M
odified
"
,
name
:
"
Modified
"
,
columns
.
push
({
id
:
"
last
_m
odified
"
,
name
:
"
Modified
"
,
field
:
"
last
M
odified
"
,
sortable
:
true
});
field
:
"
last
_m
odified
"
,
sortable
:
true
});
columns
.
push
({
id
:
"
creation
D
ate
"
,
name
:
"
Created
"
,
columns
.
push
({
id
:
"
creation
_d
ate
"
,
name
:
"
Created
"
,
field
:
"
creation
D
ate
"
,
sortable
:
true
});
field
:
"
creation
_d
ate
"
,
sortable
:
true
});
grid
=
new
Slick
.
Grid
(
"
#myDocumentList
"
,
grid
=
new
Slick
.
Grid
(
"
#myDocumentList
"
,
documentlist
,
document
_
list
,
columns
,
columns
,
options
);
options
);
grid
.
setSelectionModel
(
new
Slick
.
RowSelectionModel
(
grid
.
setSelectionModel
(
new
Slick
.
RowSelectionModel
(
{
selectActiveRow
:
false
}));
{
selectActiveRow
:
false
}));
grid
.
registerPlugin
(
check
box
selector
);
grid
.
registerPlugin
(
check
_box_
selector
);
onSortFunction
=
function
(
e
,
args
)
{
onSortFunction
=
function
(
e
,
args
)
{
var
cols
=
args
.
sortCols
;
var
cols
=
args
.
sortCols
;
document
list
.
sort
(
function
(
dataRow1
,
dataR
ow2
)
{
document
_list
.
sort
(
function
(
data_row1
,
data_r
ow2
)
{
var
i
,
l
,
field
,
sign
,
value1
,
value2
,
result
;
var
i
,
l
,
field
,
sign
,
value1
,
value2
,
result
;
for
(
i
=
0
,
l
=
cols
.
length
;
i
<
l
;
i
++
)
{
for
(
i
=
0
,
l
=
cols
.
length
;
i
<
l
;
i
++
)
{
field
=
cols
[
i
].
sortCol
.
field
;
field
=
cols
[
i
].
sortCol
.
field
;
sign
=
cols
[
i
].
sortAsc
?
1
:
-
1
;
sign
=
cols
[
i
].
sortAsc
?
1
:
-
1
;
value1
=
data
R
ow1
[
field
];
value1
=
data
_r
ow1
[
field
];
value2
=
data
R
ow2
[
field
];
value2
=
data
_r
ow2
[
field
];
result
=
(
value1
==
value2
?
0
:(
value1
>
value2
?
1
:
-
1
))
*
sign
;
result
=
(
value1
==
value2
?
0
:(
value1
>
value2
?
1
:
-
1
))
*
sign
;
if
(
result
!=
0
)
{
if
(
result
!=
0
)
{
return
result
;
return
result
;
...
@@ -138,18 +138,18 @@
...
@@ -138,18 +138,18 @@
};
};
onClickFunction
=
function
(
e
)
{
onClickFunction
=
function
(
e
)
{
var
cell
=
grid
.
getCellFromEvent
(
e
);
var
cell
=
grid
.
getCellFromEvent
(
e
);
if
(
cell
.
cell
===
grid
.
getColumnIndex
(
'
file
N
ame
'
))
{
if
(
cell
.
cell
===
grid
.
getColumnIndex
(
'
file
_n
ame
'
))
{
OfficeJS
.
open
({
app
:
documentlist
[
cell
.
row
].
app
,
OfficeJS
.
open
({
app
:
document
_
list
[
cell
.
row
].
app
,
file
Name
:
documentlist
[
cell
.
row
].
fileN
ame
});
file
_name
:
document_list
[
cell
.
row
].
n
ame
});
}
}
};
};
onRemoveSeveral
=
function
()
{
onRemoveSeveral
=
function
()
{
var
document
names
array
=
[],
selected
,
i
,
l
;
var
document
_name_
array
=
[],
selected
,
i
,
l
;
selected
=
grid
.
getSelectedRows
();
selected
=
grid
.
getSelectedRows
();
for
(
i
=
0
,
l
=
selected
.
length
;
i
<
l
;
i
+=
1
)
{
for
(
i
=
0
,
l
=
selected
.
length
;
i
<
l
;
i
+=
1
)
{
document
namesarray
.
push
(
documentlist
[
selected
[
i
]].
fileN
ame
);
document
_name_array
.
push
(
document_list
[
selected
[
i
]].
n
ame
);
}
}
OfficeJS
.
removeSeveralFromArray
(
document
names
array
);
OfficeJS
.
removeSeveralFromArray
(
document
_name_
array
);
};
};
document
.
querySelector
(
'
#slickgrid_document_lister_remove_selected
'
).
document
.
querySelector
(
'
#slickgrid_document_lister_remove_selected
'
).
onclick
=
onRemoveSeveral
;
onclick
=
onRemoveSeveral
;
...
...
OfficeJS/component/svg-edit.html
View file @
df16f201
<div>
<div>
<input
type=
"text"
<input
type=
"text"
name=
"fileName"
name=
"fileName"
id=
"input_file
N
ame"
id=
"input_file
_n
ame"
value=
""
value=
""
placeholder=
"File name here"
/>
placeholder=
"File name here"
/>
<button
type=
"submit"
<button
type=
"submit"
...
...
OfficeJS/index.html
View file @
df16f201
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
<script
type=
"text/javascript"
src=
"src/localorcookiestorage.js"
></script>
<script
type=
"text/javascript"
src=
"src/localorcookiestorage.js"
></script>
<script
type=
"text/javascript"
src=
"src/jio.js"
></script>
<script
type=
"text/javascript"
src=
"src/jio.js"
></script>
<script
type=
"text/javascript"
src=
"lib/base64/base64.js"
></script>
<script
type=
"text/javascript"
src=
"lib/base64/base64.js"
></script>
<script
type=
"text/javascript"
src=
"lib/sjcl/sjcl.js"
></script>
<script
type=
"text/javascript"
src=
"src/jio.storage.js"
></script>
<script
type=
"text/javascript"
src=
"src/jio.storage.js"
></script>
</head>
</head>
<body>
<body>
...
...
OfficeJS/js/officejs.js
View file @
df16f201
This diff is collapsed.
Click to expand it.
OfficeJS/src/jio.dummystorages.js
View file @
df16f201
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
// - dummyallfail
// - dummyallfail
// - dummyallnotfound
// - dummyallnotfound
// - dummyall3tries
// - dummyall3tries
(
function
()
{
var
jio
_dummy_storage_l
oader
=
function
(
Jio
)
{
(
function
()
{
var
jio
DummyStorageL
oader
=
function
(
Jio
)
{
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// Dummy Storage 1 : all ok
// Dummy Storage 1 : all ok
...
@@ -33,16 +33,16 @@
...
@@ -33,16 +33,16 @@
// Returns a document object containing all information of the
// Returns a document object containing all information of the
// document and its content.
// document and its content.
// document object is {'
fileName':string,'fileC
ontent':string,
// document object is {'
name':string,'c
ontent':string,
// 'creation
Date':date,'lastM
odified':date}
// 'creation
_date':date,'last_m
odified':date}
// wait a little in order to simulate asynchronous operation
// wait a little in order to simulate asynchronous operation
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
doc
=
{
var
doc
=
{
'
fileC
ontent
'
:
'
content
'
,
'
c
ontent
'
:
'
content
'
,
'
fileN
ame
'
:
'
file
'
,
'
n
ame
'
:
'
file
'
,
'
creation
D
ate
'
:
10000
,
'
creation
_d
ate
'
:
10000
,
'
last
M
odified
'
:
15000
};
'
last
_m
odified
'
:
15000
};
that
.
done
(
doc
);
that
.
done
(
doc
);
},
100
);
},
100
);
};
// end loadDocument
};
// end loadDocument
...
@@ -51,17 +51,17 @@
...
@@ -51,17 +51,17 @@
// It returns a document array containing all the user documents
// It returns a document array containing all the user documents
// informations, but not their content.
// informations, but not their content.
// the list is [object,object] -> object = {'
fileN
ame':string,
// the list is [object,object] -> object = {'
n
ame':string,
// 'last
Modified':date,'creationD
ate':date}
// 'last
_modified':date,'creation_d
ate':date}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
list
=
[
var
list
=
[
{
'
fileN
ame
'
:
'
file
'
,
{
'
n
ame
'
:
'
file
'
,
'
creation
D
ate
'
:
10000
,
'
creation
_d
ate
'
:
10000
,
'
last
M
odified
'
:
15000
},
'
last
_m
odified
'
:
15000
},
{
'
fileN
ame
'
:
'
memo
'
,
{
'
n
ame
'
:
'
memo
'
,
'
creation
D
ate
'
:
20000
,
'
creation
_d
ate
'
:
20000
,
'
last
M
odified
'
:
25000
'
last
_m
odified
'
:
25000
}];
}];
that
.
done
(
list
);
that
.
done
(
list
);
},
100
);
},
100
);
...
@@ -107,8 +107,8 @@
...
@@ -107,8 +107,8 @@
that
.
loadDocument
=
function
()
{
that
.
loadDocument
=
function
()
{
// Returns a document object containing nothing.
// Returns a document object containing nothing.
// document object is {'
fileName':string,'fileC
ontent':string,
// document object is {'
name':string,'c
ontent':string,
// 'creation
Date':date,'lastM
odified':date}
// 'creation
_date':date,'last_m
odified':date}
// wait a little in order to simulate asynchronous operation
// wait a little in order to simulate asynchronous operation
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -120,8 +120,8 @@
...
@@ -120,8 +120,8 @@
that
.
getDocumentList
=
function
()
{
that
.
getDocumentList
=
function
()
{
// It returns nothing.
// It returns nothing.
// the list is [object,object] -> object = {'
fileN
ame':string,
// the list is [object,object] -> object = {'
n
ame':string,
// 'last
Modified':date,'creationD
ate':date}
// 'last
_modified':date,'creation_d
ate':date}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
that
.
fail
({
status
:
0
,
statusText
:
'
Unknown Error
'
,
...
@@ -171,8 +171,8 @@
...
@@ -171,8 +171,8 @@
that
.
loadDocument
=
function
()
{
that
.
loadDocument
=
function
()
{
// Returns a document object containing nothing.
// Returns a document object containing nothing.
// document object is {'
fileName':string,'fileC
ontent':string,
// document object is {'
name':string,'c
ontent':string,
// 'creation
Date':date,'lastM
odified':date}
// 'creation
_date':date,'last_m
odified':date}
// wait a little in order to simulate asynchronous operation
// wait a little in order to simulate asynchronous operation
setTimeout
(
function
()
{
setTimeout
(
function
()
{
...
@@ -185,8 +185,8 @@
...
@@ -185,8 +185,8 @@
that
.
getDocumentList
=
function
()
{
that
.
getDocumentList
=
function
()
{
// It returns nothing.
// It returns nothing.
// the list is [object,object] -> object = {'
fileN
ame':string,
// the list is [object,object] -> object = {'
n
ame':string,
// 'last
Modified':date,'creationD
ate':date}
// 'last
_modified':date,'creation_d
ate':date}
setTimeout
(
function
()
{
setTimeout
(
function
()
{
that
.
fail
({
status
:
404
,
statusText
:
'
Not Found
'
,
that
.
fail
({
status
:
404
,
statusText
:
'
Not Found
'
,
...
@@ -214,15 +214,15 @@
...
@@ -214,15 +214,15 @@
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
newDummyStorageAll3Tries
=
function
(
spec
,
my
)
{
var
that
=
Jio
.
newBaseStorage
(
spec
,
my
),
priv
=
{};
var
that
=
Jio
.
newBaseStorage
(
spec
,
my
),
priv
=
{};
priv
.
doJob
=
function
(
if
ok
return
)
{
priv
.
doJob
=
function
(
if
_ok_
return
)
{
// wait a little in order to simulate asynchronous operation
// wait a little in order to simulate asynchronous operation
setTimeout
(
function
()
{
setTimeout
(
function
()
{
priv
.
Try3OKElseFail
(
that
.
cloneJob
().
tries
,
if
ok
return
);
priv
.
Try3OKElseFail
(
that
.
cloneJob
().
tries
,
if
_ok_
return
);
},
100
);
},
100
);
};
};
priv
.
Try3OKElseFail
=
function
(
tries
,
if
ok
return
)
{
priv
.
Try3OKElseFail
=
function
(
tries
,
if
_ok_
return
)
{
if
(
tries
===
3
)
{
if
(
tries
===
3
)
{
return
that
.
done
(
if
ok
return
);
return
that
.
done
(
if
_ok_
return
);
}
}
if
(
tries
<
3
)
{
if
(
tries
<
3
)
{
return
that
.
fail
({
message
:
''
+
(
3
-
tries
)
+
'
tries left.
'
});
return
that
.
fail
({
message
:
''
+
(
3
-
tries
)
+
'
tries left.
'
});
...
@@ -242,20 +242,20 @@
...
@@ -242,20 +242,20 @@
that
.
loadDocument
=
function
()
{
that
.
loadDocument
=
function
()
{
priv
.
doJob
({
priv
.
doJob
({
'
fileC
ontent
'
:
'
content2
'
,
'
c
ontent
'
:
'
content2
'
,
'
fileN
ame
'
:
'
file
'
,
'
n
ame
'
:
'
file
'
,
'
creation
D
ate
'
:
11000
,
'
creation
_d
ate
'
:
11000
,
'
last
M
odified
'
:
17000
'
last
_m
odified
'
:
17000
});
});
};
// end loadDocument
};
// end loadDocument
that
.
getDocumentList
=
function
()
{
that
.
getDocumentList
=
function
()
{
priv
.
doJob
([{
'
fileN
ame
'
:
'
file
'
,
priv
.
doJob
([{
'
n
ame
'
:
'
file
'
,
'
creation
D
ate
'
:
10000
,
'
creation
_d
ate
'
:
10000
,
'
last
M
odified
'
:
15000
},
'
last
_m
odified
'
:
15000
},
{
'
fileN
ame
'
:
'
memo
'
,
{
'
n
ame
'
:
'
memo
'
,
'
creation
D
ate
'
:
20000
,
'
creation
_d
ate
'
:
20000
,
'
last
M
odified
'
:
25000
}
'
last
_m
odified
'
:
25000
}
]);
]);
};
// end getDocumentList
};
// end getDocumentList
...
@@ -269,25 +269,17 @@
...
@@ -269,25 +269,17 @@
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// add key to storageObjectType of global jio
// add key to storageObjectType of global jio
Jio
.
addStorageType
(
'
dummyallok
'
,
function
(
options
)
{
Jio
.
addStorageType
(
'
dummyallok
'
,
newDummyStorageAllOk
);
return
newDummyStorageAllOk
(
options
);
Jio
.
addStorageType
(
'
dummyallfail
'
,
newDummyStorageAllFail
);
});
Jio
.
addStorageType
(
'
dummyallnotfound
'
,
newDummyStorageAllNotFound
);
Jio
.
addStorageType
(
'
dummyallfail
'
,
function
(
options
)
{
Jio
.
addStorageType
(
'
dummyall3tries
'
,
newDummyStorageAll3Tries
);
return
newDummyStorageAllFail
(
options
);
});
Jio
.
addStorageType
(
'
dummyallnotfound
'
,
function
(
options
)
{
return
newDummyStorageAllNotFound
(
options
);
});
Jio
.
addStorageType
(
'
dummyall3tries
'
,
function
(
options
)
{
return
newDummyStorageAll3Tries
(
options
);
});
};
};
if
(
window
.
requirejs
)
{
if
(
window
.
requirejs
)
{
define
(
'
JIODummyStorages
'
,[
'
JIO
'
],
jio
_dummy_storage_l
oader
);
define
(
'
JIODummyStorages
'
,[
'
JIO
'
],
jio
DummyStorageL
oader
);
}
else
{
}
else
{
jio
_dummy_storage_l
oader
(
JIO
);
jio
DummyStorageL
oader
(
JIO
);
}
}
}());
}());
OfficeJS/src/jio.js
View file @
df16f201
This diff is collapsed.
Click to expand it.
OfficeJS/src/jio.storage.js
View file @
df16f201
This diff is collapsed.
Click to expand it.
OfficeJS/test/jiotests.js
View file @
df16f201
This diff is collapsed.
Click to expand it.
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