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
37b13101
Commit
37b13101
authored
May 16, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
May 18, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add officejs simple tests
parent
fbc8f77d
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
949 additions
and
28 deletions
+949
-28
OfficeJS/css/bootstrap.min.css
OfficeJS/css/bootstrap.min.css
+689
-0
OfficeJS/css/officejs.css
OfficeJS/css/officejs.css
+6
-0
OfficeJS/img/glyphicons-halflings-white.png
OfficeJS/img/glyphicons-halflings-white.png
+0
-0
OfficeJS/img/glyphicons-halflings.png
OfficeJS/img/glyphicons-halflings.png
+0
-0
OfficeJS/index.html
OfficeJS/index.html
+99
-26
OfficeJS/script/loader.js
OfficeJS/script/loader.js
+155
-2
No files found.
OfficeJS/css/bootstrap.min.css
0 → 100644
View file @
37b13101
This diff is collapsed.
Click to expand it.
OfficeJS/css/officejs.css
View file @
37b13101
...
@@ -22,6 +22,12 @@ nav#left_navbar {
...
@@ -22,6 +22,12 @@ nav#left_navbar {
display
:
inline-block
;
display
:
inline-block
;
width
:
15%
;
width
:
15%
;
}
}
.nav_header
{
font-style
:
italic
;
list-style
:
none
outside
none
;
}
section
{
section
{
display
:
inline-block
;
display
:
inline-block
;
margin
:
0
;
margin
:
0
;
...
...
OfficeJS/img/glyphicons-halflings-white.png
0 → 100644
View file @
37b13101
4.25 KB
OfficeJS/img/glyphicons-halflings.png
0 → 100644
View file @
37b13101
4.25 KB
OfficeJS/index.html
View file @
37b13101
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<meta
charset=
"utf-8"
/>
<meta
charset=
"utf-8"
/>
<litk
rel=
"icon"
href=
"img/officejs/favicon.png"
/>
<litk
rel=
"icon"
href=
"img/officejs/favicon.png"
/>
<link
rel=
"shortcut icon"
href=
"img/officejs/favicon.png"
/>
<link
rel=
"shortcut icon"
href=
"img/officejs/favicon.png"
/>
<link
rel=
"stylesheet"
href=
"css/
officejs
.css"
/>
<link
rel=
"stylesheet"
href=
"css/
bootstrap.min
.css"
/>
<title>
OfficeJS
</title>
<title>
OfficeJS
</title>
<!-- js scripts -->
<!-- js scripts -->
<script
type=
"text/javascript"
src=
"lib/icanhaz/ICanHaz.min.js"
></script>
<script
type=
"text/javascript"
src=
"lib/icanhaz/ICanHaz.min.js"
></script>
...
@@ -12,39 +12,112 @@
...
@@ -12,39 +12,112 @@
type=
"text/javascript"
type=
"text/javascript"
src=
"lib/require/require.js"
></script>
src=
"lib/require/require.js"
></script>
<!-- html scripts -->
<!-- html scripts -->
<script
id=
"
test
"
type=
"text/html"
>
<script
id=
"
home
"
type=
"text/html"
>
<
article
>
<
article
>
<
p
>
<
p
>
test
home
<
/p
>
<
/p
>
<
/article
>
<
/article
>
</script>
</script>
<script
id=
"about"
type=
"text/html"
>
<
article
>
<
p
>
about
<
/p
>
<
/article
>
</script>
<script
id=
"login"
type=
"text/html"
>
<
article
>
<
div
class
=
"
control-group
"
>
<
label
class
=
"
control-label
"
for
=
"
input_json_storage
"
>
JSON
Storage
<
/label
>
<
div
class
=
"
controls docs-input-sizes
"
>
<
input
class
=
"
input-xlarge
"
type
=
"
text
"
name
=
"
JSONstorage
"
id
=
"
input_json_storage
"
value
=
"
{"type":"local","userName":"tristan"}
"
placeholder
=
"
storage
"
/>
<
/div
>
<
label
class
=
"
control-label
"
for
=
"
JSONapplicantID
"
>
JSON
Applicant
<
/label
>
<
div
class
=
"
controls docs-input-sizes
"
>
<
input
class
=
"
input-xlarge
"
type
=
"
text
"
name
=
"
JSONapplicant
"
id
=
"
input_json_applicant
"
value
=
"
{"ID":"jiotests"}
"
placeholder
=
"
applicant
"
/>
<
/div
>
<
/div
>
<
button
type
=
"
submit
"
class
=
"
btn
"
onclick
=
"
OfficeJS.setJio()
"
>
Create
New
JIO
<
/button
>
<
/article
>
</script>
<script
id=
"text_editor"
type=
"text/html"
>
<
article
>
<
div
class
=
"
control-group
"
>
<
label
class
=
"
control-label
"
for
=
"
fileName
"
>
File
Name
<
/label
>
<
div
class
=
"
controls docs-input-sizes
"
>
<
input
type
=
"
text
"
name
=
"
fileName
"
id
=
"
input_fileName
"
value
=
""
placeholder
=
"
file name
"
/>
<
/div
>
<
label
class
=
"
control-label
"
for
=
"
fileContent
"
>
File
Content
<
/label
>
<
div
class
=
"
controls docs-input-sizes
"
>
<
input
type
=
"
text
"
name
=
"
fileContent
"
id
=
"
input_content
"
value
=
""
placeholder
=
"
content
"
/>
<
/div
>
<
button
type
=
"
submit
"
class
=
"
btn btn-primary
"
onclick
=
"
OfficeJS.save()
"
><
i
class
=
"
icon-download-alt icon-white
"
><
/i> Save</
button
>&
nbsp
;
<
button
type
=
"
submit
"
class
=
"
btn
"
onclick
=
"
OfficeJS.load()
"
><
i
class
=
"
icon-upload
"
><
/i> Load</
button
>&
nbsp
;
<
button
type
=
"
submit
"
class
=
"
btn btn-danger
"
onclick
=
"
OfficeJS.remove()
"
><
i
class
=
"
icon-remove icon-white
"
><
/i> Remove</
button
>&
nbsp
;
<
button
type
=
"
submit
"
class
=
"
btn
"
onclick
=
"
OfficeJS.getlist()
"
><
i
class
=
"
icon-refresh
"
><
/i> Get List</
button
>&
nbsp
;
<
/div
>
<
div
id
=
"
document_list
"
class
=
"
span4
"
>
<
ul
>
{{
#
DocumentList
}}
<
li
>
{{
fileName
}}
<
/li
>
{{
/
DocumentList
}}
<
/ul
>
<
/div
>
<
/article
>
</script>
</head>
</head>
<body>
<body>
<header>
<aside>
<div
id=
"loading"
style=
"position: absolute; right: 20px; top: 20px;"
></div>
<nav
id=
"header_navbar"
>
<div
class=
"navbar"
>
<div
class=
"navbar-inner"
>
<div
class=
"container-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<h1>
OfficeJS
</h1>
</div>
<div
class=
"span10"
>
<ul
class=
"nav"
>
<ul
class=
"nav"
>
<li><a
href=
"#"
>
Nav
</a></li>
<li><a
href=
"#"
>
Nav
</a></li>
<li><a
href=
"#
about"
>
About
</a></li>
<li><a
href=
"#/
about"
>
About
</a></li>
<li><a
href=
"#
contact"
>
Contact
</a></li>
<li><a
href=
"#/
contact"
>
Contact
</a></li>
</ul>
</ul>
</nav>
</div>
</aside>
</div>
<h1>
OfficeJS
</h1>
</div>
</header>
</div>
</div>
<nav
id=
"left_navbar"
>
<div
class=
"container-fluid"
>
<ul
class=
"nav"
>
<div
class=
"row-fluid"
>
<div
class=
"span2"
>
<div
class=
"well"
>
<ul
class=
"nav nav-list"
>
<li
class=
"nav-header"
>
Nav
</li>
<li><a
href=
"#/login"
><i
class=
"icon-ok"
></i>
Login
</a></li>
<li
class=
"nav-header"
>
Documents
</li>
<li
class=
"nav-header"
>
Documents
</li>
<li
class=
"create_document"
><a
href=
"#/create_document"
>
Create Document
</a></li>
<li
class=
"texteditor"
><a
href=
"#/texteditor"
><i
class=
"icon-font"
></i>
Text Editor
</a></li>
<li><a
href=
"#/test"
>
Test
</a></li>
<li
class=
"other"
>
Other
</li>
</ul>
</ul>
</na
v>
</di
v>
</div>
<section
id=
"main"
>
<section
class=
"span10"
id=
"main"
>
<!-- Body content -->
<!-- Body content -->
<article>
<p>
Loading...
</p>
</article>
</section>
</section>
</div>
</div>
</body>
</body>
</html>
</html>
OfficeJS/script/loader.js
View file @
37b13101
// NEXEDI
// Author: Tristan Cavelier <tristan.cavelier@tiolive.com>
// Date: Wed May 16 14:31:08 2012
require
.
config
({
require
.
config
({
paths
:
{
paths
:
{
...
@@ -13,10 +16,160 @@ require.config ({
...
@@ -13,10 +16,160 @@ require.config ({
}
}
});
});
require
([
'
OfficeJS
'
],
function
(
OJS
)
{
require
([
'
OfficeJS
'
],
function
(
OJS
)
{
// globals
var
JIO
=
OJS
.
JIO
,
var
JIO
=
OJS
.
JIO
,
$
=
OJS
.
jQuery
,
$
=
OJS
.
jQuery
,
Base64
=
OJS
.
Base64
,
Base64
=
OJS
.
Base64
,
ich
=
OJS
.
ich
;
ich
=
OJS
.
ich
,
// conf vars
routes
=
{
'
default
'
:
'
home
'
,
'
/home
'
:
'
home
'
,
'
/about
'
:
'
about
'
,
'
/login
'
:
'
login
'
,
'
/texteditor
'
:
'
text_editor
'
},
// some vars
current_page
=
'
home
'
,
ich_object
=
{
DocumentList
:[]},
////////////////////////////////////////////////////////////////////////////
// load current page
loadcurrentpage
=
function
()
{
var
new_hash
;
// get new hash
new_hash
=
location
.
hash
.
split
(
'
#
'
);
if
(
typeof
new_hash
[
1
]
!==
"
undefined
"
)
{
// new direction
new_hash
=
new_hash
[
1
];
if
(
typeof
routes
[
new_hash
]
===
"
undefined
"
)
{
return
current_page
;
}
}
else
{
// default home
new_hash
=
'
default
'
;
}
return
routes
[
new_hash
];
},
// end load current page
////////////////////////////////////////////////////////////////////////////
// Repaint main page
repaint
=
function
()
{
$
(
'
#main
'
).
html
(
ich
[
current_page
](
ich_object
,
true
));
},
// end repaint main page
////////////////////////////////////////////////////////////////////////////
// change page according to the event
hrefClicked
=
function
()
{
var
new_page
=
loadcurrentpage
();
if
(
current_page
!==
new_page
)
{
// check if it is necessary to repaint the page.
current_page
=
new_page
;
repaint
();
}
};
// end change page according to the event
////////////////////////////////////////////////////////////////////////////
current_page
=
loadcurrentpage
();
repaint
();
$
(
'
#main
'
).
html
(
ich
[
'
test
'
]({},
true
));
window
.
OfficeJS
=
(
function
()
{
var
publ
=
{},
priv
=
{};
priv
.
jioIsSet
=
function
()
{
return
(
typeof
priv
.
jio
===
'
object
'
);
};
publ
.
setJio
=
function
()
{
if
(
priv
.
jioIsSet
())
{
alert
(
'
Jio already set.
'
);
return
;
}
alert
(
$
(
'
#input_json_storage
'
).
attr
(
'
value
'
));
// if there is not any jio created
priv
.
jio
=
JIO
.
createNew
(
JSON
.
parse
(
$
(
'
#input_json_storage
'
).
attr
(
'
value
'
)
),
JSON
.
parse
(
$
(
'
#input_json_applicant
'
).
attr
(
'
value
'
)
)
);
};
publ
.
save
=
function
()
{
var
filename
,
filecontent
;
if
(
!
priv
.
jioIsSet
())
{
alert
(
'
No Jio set yet.
'
);
return
;
}
filename
=
$
(
'
#input_fileName
'
).
attr
(
'
value
'
);
filecontent
=
$
(
'
#input_content
'
).
attr
(
'
value
'
);
priv
.
jio
.
saveDocument
({
'
fileName
'
:
filename
,
'
fileContent
'
:
filecontent
,
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
){
alert
(
result
.
isSaved
?
'
Document Saved.
'
:
'
Error:
'
+
result
.
message
);
}
});
};
publ
.
load
=
function
()
{
var
filename
;
if
(
!
priv
.
jioIsSet
())
{
alert
(
'
No Jio set yet.
'
);
return
;
}
filename
=
$
(
'
#input_fileName
'
).
attr
(
'
value
'
);
priv
.
jio
.
loadDocument
({
'
fileName
'
:
filename
,
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
){
if
(
result
.
document
.
fileName
)
{
$
(
'
#input_content
'
).
attr
(
'
value
'
,
result
.
document
.
fileContent
);
alert
(
'
Document loaded
'
);
}
else
{
alert
(
'
Error:
'
+
result
.
message
);
}
}
});
};
publ
.
remove
=
function
()
{
var
filename
;
if
(
!
priv
.
jioIsSet
())
{
alert
(
'
No Jio set yet.
'
);
return
;
}
filename
=
$
(
'
#input_fileName
'
).
attr
(
'
value
'
);
priv
.
jio
.
removeDocument
({
'
fileName
'
:
filename
,
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
)
{
alert
(
result
.
isRemoved
?
'
Document Removed.
'
:
'
Error:
'
+
result
.
message
);
}
});
};
publ
.
getlist
=
function
()
{
if
(
!
priv
.
jioIsSet
())
{
alert
(
'
No Jio set yet.
'
);
return
;
}
priv
.
jio
.
getDocumentList
({
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
)
{
var
htmlList
,
i
;
htmlList
=
'
<ul>
\n
'
;
for
(
i
in
result
.
list
)
{
htmlList
+=
'
<li>
\n
'
;
htmlList
+=
result
.
list
[
i
].
fileName
;
htmlList
+=
'
</li>
\n
'
;
}
htmlList
+=
'
</ul>
\n
'
;
$
(
'
#document_list
'
).
html
(
htmlList
);
ich_object
.
DocumentList
=
result
.
list
;
console
.
log
(
result
.
list
);
alert
(
result
.
message
);
}
});
};
return
publ
;
}());
// When someone clicks on a <a href..>..</a>, the interface may change.
$
(
window
).
bind
(
'
hashchange
'
,
hrefClicked
);
});
});
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