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