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
8b66f91e
Commit
8b66f91e
authored
Aug 20, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OfficeJS: updated to work with jio, and security improved
parent
b7e3ff26
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1100 additions
and
1122 deletions
+1100
-1122
OfficeJS/component/basic_conflict_solver.html
OfficeJS/component/basic_conflict_solver.html
+2
-45
OfficeJS/component/elrte.html
OfficeJS/component/elrte.html
+14
-12
OfficeJS/component/jquery-sheet.html
OfficeJS/component/jquery-sheet.html
+3
-97
OfficeJS/component/left_nav_bar.html
OfficeJS/component/left_nav_bar.html
+7
-7
OfficeJS/component/login.html
OfficeJS/component/login.html
+47
-42
OfficeJS/component/slickgrid_document_lister.html
OfficeJS/component/slickgrid_document_lister.html
+9
-130
OfficeJS/component/svg-edit.html
OfficeJS/component/svg-edit.html
+3
-3
OfficeJS/component/top_nav_bar.html
OfficeJS/component/top_nav_bar.html
+2
-2
OfficeJS/component/workinprogress.html
OfficeJS/component/workinprogress.html
+1
-35
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+1012
-749
No files found.
OfficeJS/component/basic_conflict_solver.html
View file @
8b66f91e
<div
id=
"basic_conflict_solver_div"
style=
"text-align:center;"
class=
"well"
>
<div
id=
"basic_conflict_solver_div"
style=
"text-align:center;"
class=
"well"
>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span12"
>
<div
class=
"span12"
>
A conflict occured while saving this document:
There is a conflict in document
<span
id=
"basic_conflict_solver_docid"
></span>
</div>
</div>
</div>
</div>
<div
id=
"revisions"
>
<div
id=
"revisions"
>
</div>
</div>
<div
class=
"row-fluid"
>
<div
class=
"row-fluid"
>
<div
class=
"span12"
>
<div
class=
"span12"
>
<button
onclick=
"
basic_conflict_solver.abort()
"
>
Abort
</button>
<button
onclick=
"
OfficeJS_basic_conflict_solver.abort();
"
>
Abort
</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script
type=
"text/javascript"
>
<!--
window
.
basic_conflict_solver
=
{
conflict_object
:{},
addRevision
:
function
(
doc
)
{
document
.
querySelector
(
'
#basic_conflict_solver_div #revisions
'
).
innerHTML
+=
'
<div class="row-fluid"><div class="span12">
'
+
'
<div>
'
+
(
new
Date
(
doc
.
last_modified
)).
toString
()
+
'
</div>
'
+
'
<div><textarea id="
'
+
doc
.
revision
+
'
">
'
+
doc
.
content
+
'
</textarea></div>
'
+
'
<div><button onclick="
'
+
//'console.log('+"'"+revision+"'"+');'+
"
basic_conflict_solver.keepRevision('
"
+
doc
.
revision
+
"
');
"
+
'
">Save this one</button></div><hr/>
'
+
'
</div></div>
'
;
},
addRemovedRevision
:
function
(
doc
)
{
document
.
querySelector
(
'
#basic_conflict_solver_div #revisions
'
).
innerHTML
+=
'
<div class="row-fluid"><div class="span12">
'
+
'
<div>
'
+
(
new
Date
(
doc
.
last_modified
)).
toString
()
+
'
</div>
'
+
'
<div>Removed</div>
'
+
'
<div><button onclick="
'
+
//'console.log('+"'"+revision+"'"+');'+
"
basic_conflict_solver.removeRevision();
"
+
'
">Save this one</button></div><hr/>
'
+
'
</div></div>
'
;
},
removeRevision
:
function
()
{
OfficeJS
.
solveConflict
(
this
.
conflict_object
);
},
keepRevision
:
function
(
revision
)
{
OfficeJS
.
solveConflict
(
this
.
conflict_object
,
$
(
'
#
'
+
revision
).
text
()
);
},
abort
:
function
()
{
OfficeJS
.
abortSolveConflict
();
}
};
//-->
</script>
OfficeJS/component/elrte.html
View file @
8b66f91e
...
@@ -32,7 +32,8 @@
...
@@ -32,7 +32,8 @@
</script>
</script>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<script
type=
"text/javascript"
charset=
"utf-8"
>
<!--
<!--
$
().
ready
(
function
()
{
(
function
()
{
$
().
ready
(
function
()
{
var
opts
=
{
var
opts
=
{
cssClass
:
'
el-rte
'
,
cssClass
:
'
el-rte
'
,
lang
:
'
en
'
,
lang
:
'
en
'
,
...
@@ -41,7 +42,8 @@ $().ready(function() {
...
@@ -41,7 +42,8 @@ $().ready(function() {
cssfiles
:
[
'
lib/elrte/css/elrte-inner.css
'
]
cssfiles
:
[
'
lib/elrte/css/elrte-inner.css
'
]
}
}
$
(
'
#elrte_editor
'
).
elrte
(
opts
);
$
(
'
#elrte_editor
'
).
elrte
(
opts
);
})
});
}());
//-->
//-->
</script>
</script>
</head>
</head>
...
@@ -49,12 +51,12 @@ $().ready(function() {
...
@@ -49,12 +51,12 @@ $().ready(function() {
<div>
<div>
<input
type=
"text"
<input
type=
"text"
name=
"fileName"
name=
"fileName"
id=
"
input_file_name
"
id=
"
elrte_docid
"
value=
""
value=
""
placeholder=
"File name here"
/>
placeholder=
"File name here"
/>
<button
type=
"submit"
<button
type=
"submit"
class=
"btn btn-primary"
class=
"btn btn-primary"
onclick=
"OfficeJS
.save($('#input_file_name').attr('value')
);"
>
onclick=
"OfficeJS
_elrte.save(
);"
>
<i
class=
"icon-download-alt icon-white"
></i>
<i
class=
"icon-download-alt icon-white"
></i>
Save
Save
</button>
</button>
...
...
OfficeJS/component/jquery-sheet.html
View file @
8b66f91e
...
@@ -59,101 +59,7 @@
...
@@ -59,101 +59,7 @@
<!--/Optional-->
<!--/Optional-->
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!--
<!--
$
(
function
(){
OfficeJS_jquerysheet
.
firstload
();
//Here is where we initiate the sheets
//every time sheet is created it creates a new jQuery.sheet.instance
//(array), to manipulate each sheet, the jQuery object is returned
$
(
'
#jQuerySheet
'
).
sheet
({
title
:
''
,
inlineMenu
:
inlineMenu
(
$
.
sheet
.
instance
),
urlGet
:
'
component/newspreadsheet.html
'
,
// buildSheet: true,
editable
:
true
,
autoFiller
:
true
});
//examples of how to use jQuery.sheet
/*
//Inline sheet(s), non-editable (like a gridview)
$('.jQuerySheet').sheet({
title: 'jQuery.sheet - The Web Based Spreadsheet Demo',
buildSheet: true, //will turn object #jQuerySheet's child tables into sheets
editable: false,
calcOff: true
});
//New single custom sized sheet
$('#jQuerySheet').sheet({
title: 'jQuery.sheet - The Web Based Spreadsheet Demo',
inlineMenu: inlineMenu(jQuery.sheet.instance),
buildSheet: '5x100'
});
//Custom object sheet(s)
$('#jQuerySheet').sheet({
title: 'jQuery.sheet - The Web Based Spreadsheet Demo',
inlineMenu: inlineMenu(jQuery.sheet.instance),
buildSheet: $('#jQuerySheet').find('table')
});
//Custom object sheet(s)
$('#jQuerySheet').sheet({
title: 'jQuery.sheet - The Web Based Spreadsheet Demo',
inlineMenu: inlineMenu(jQuery.sheet.instance),
buildSheet: $.sheet.makeTable.fromSize('5x100').add($.sheet.makeTable.fromSize('5x100'))
});
*/
//This is to give a themeswitcher on the page
//$('#themeSwitcher').themeswitcher();
//This is for some fancy menu stuff
var
o
=
$
(
'
#structures
'
);
var
top
=
o
.
offset
().
top
-
300
;
$
(
document
).
scroll
(
function
(
e
){
if
(
$
(
this
).
scrollTop
()
>
top
)
{
$
(
'
#lockedMenu
'
).
removeClass
(
'
locked
'
);
}
else
{
$
(
'
#lockedMenu
'
).
addClass
(
'
locked
'
);
}
}).
scroll
();
});
//This function builds the inline menu to make it easy to interact with each sheet instance
function
inlineMenu
(
I
){
I
=
(
I
?
I
.
length
:
0
);
//we want to be able to edit the html for the menu to make them multi
//instance
var
html
=
$
(
'
#inlineMenu
'
).
html
().
replace
(
/sheetInstance/g
,
"
$.sheet.instance[
"
+
I
+
"
]
"
);
var
menu
=
$
(
html
);
//The following is just so you get an idea of how to style cells
menu
.
find
(
'
.colorPickerCell
'
).
colorPicker
().
change
(
function
(){
$
.
sheet
.
instance
[
I
].
cellChangeStyle
(
'
background-color
'
,
$
(
this
).
val
());
});
menu
.
find
(
'
.colorPickerFont
'
).
colorPicker
().
change
(
function
(){
$
.
sheet
.
instance
[
I
].
cellChangeStyle
(
'
color
'
,
$
(
this
).
val
());
});
menu
.
find
(
'
.colorPickers
'
).
children
().
eq
(
1
).
css
(
'
background-image
'
,
"
url('lib/jquery.sheet/images/palette.png')
"
);
menu
.
find
(
'
.colorPickers
'
).
children
().
eq
(
3
).
css
(
'
background-image
'
,
"
url('lib/jquery.sheet/images/palette_bg.png')
"
);
return
menu
;
}
function
goToObj
(
s
){
$
(
'
html, body
'
).
animate
({
scrollTop
:
$
(
s
).
offset
().
top
},
'
slow
'
);
return
false
;
}
//-->
//-->
</script>
</script>
<!--Page styles-->
<!--Page styles-->
...
@@ -208,12 +114,12 @@ function goToObj(s){
...
@@ -208,12 +114,12 @@ function goToObj(s){
<div>
<div>
<input
type=
"text"
<input
type=
"text"
name=
"fileName"
name=
"fileName"
id=
"
input_file_name
"
id=
"
jquery-sheet_docid
"
value=
""
value=
""
placeholder=
"File name here"
/>
placeholder=
"File name here"
/>
<button
type=
"submit"
<button
type=
"submit"
class=
"btn btn-primary"
class=
"btn btn-primary"
onclick=
"OfficeJS
.save($('#input_file_name').attr('value')
);"
>
onclick=
"OfficeJS
_jquerysheet.save(
);"
>
<i
class=
"icon-download-alt icon-white"
></i>
<i
class=
"icon-download-alt icon-white"
></i>
Save
Save
</button>
</button>
...
...
OfficeJS/component/left_nav_bar.html
View file @
8b66f91e
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
<li>
<li>
<a
href=
"#/login"
<a
href=
"#/login"
onclick=
"javascript:
onclick=
"javascript:
OfficeJS
.open({app:'login'}
);
OfficeJS
_left_nav_bar.login(
);
return false;"
>
return false;"
>
<i
class=
"icon-ok"
>
<i
class=
"icon-ok"
>
</i>
</i>
...
@@ -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_editor'}
);
OfficeJS
_left_nav_bar.newTextDocument(
);
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_editor'}
);
OfficeJS
_left_nav_bar.newImage(
);
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-pencil
"
><
/i
>
<
i
class
=
"
icon-pencil
"
><
/i
>
New
Image
New
Image
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
<
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:'spreadsheet'}
);
OfficeJS
_left_nav_bar.newSpreadSheet(
);
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-signal
"
><
/i
>
<
i
class
=
"
icon-signal
"
><
/i
>
New
Spreadsheet
New
Spreadsheet
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
<
li
class
=
"
spreadsheet left-nav-tools
"
>
<
li
class
=
"
spreadsheet left-nav-tools
"
>
<
a
href
=
"
#/workinprogress
"
<
a
href
=
"
#/workinprogress
"
onclick
=
"
javascript:
onclick
=
"
javascript:
OfficeJS
.open({app:'workinprogress'}
);
OfficeJS
_left_nav_bar.showActivities(
);
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-tasks
"
><
/i
>
<
i
class
=
"
icon-tasks
"
><
/i
>
Show
Activity
Show
Activity
...
@@ -56,7 +56,7 @@
...
@@ -56,7 +56,7 @@
<!--
<
li
class
=
"
editpreferences left-nav-tools
"
>
-->
<!--
<
li
class
=
"
editpreferences left-nav-tools
"
>
-->
<!--
<
a
href
=
"
#/edit_preferences
"
-->
<!--
<
a
href
=
"
#/edit_preferences
"
-->
<!--
onclick
=
"
javascript: -->
<!--
onclick
=
"
javascript: -->
<!-- OfficeJS
.open({app:'edit_preferences'}
); -->
<!-- OfficeJS
_left_nav_bar.editPreference(
); -->
<!-- return false;
"
>
-->
<!-- return false;
"
>
-->
<!--
<
i
class
=
"
icon-check
"
><
/i> --
>
<!--
<
i
class
=
"
icon-check
"
><
/i> --
>
<!--
Edit
Preferences
-->
<!--
Edit
Preferences
-->
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,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_lister'}
);
OfficeJS
_left_nav_bar.showDocumentList(
);
return false;
"
>
return false;
"
>
<
i
class
=
"
icon-list
"
><
/i
>
<
i
class
=
"
icon-list
"
><
/i
>
Document
List
Document
List
...
...
OfficeJS/component/login.html
View file @
8b66f91e
...
@@ -14,61 +14,66 @@
...
@@ -14,61 +14,66 @@
<div>
<div>
Remember me
Remember me
<input
id=
"remember_me"
type=
"checkbox"
<input
id=
"remember_me"
type=
"checkbox"
onclick=
"
window.OfficeJS_login
.toggleRememberMe();"
/>
onclick=
"
OfficeJS_login.object
.toggleRememberMe();"
/>
</div>
</div>
<div>
<div>
<button
type=
"submit"
<button
type=
"submit"
class=
"btn"
class=
"btn"
onclick=
"
window.OfficeJS_login.createJIO
();"
>
onclick=
"
OfficeJS_login.object.connect
();"
>
Create New JIO
Create New JIO
</button>
</button>
</div>
</div>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!--
<!--
window
.
OfficeJS_login
=
{
(
function
()
{
storageId
:
'
#login-gadget #login_input
'
,
"
use strict
"
;
storagePath
:
'
OfficeJS/login/login
'
,
var
odf
=
function
(
obj
,
name
,
value
)
{
rememberId
:
'
#login-gadget #remember_me
'
,
Object
.
defineProperty
(
obj
,
name
,{
rememberPath
:
'
OfficeJS/login/remember_me
'
,
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
value
localStorage
:
LocalOrCookieStorage
,
});
};
fillLogin
:
function
()
{
odf
(
OfficeJS_login
,
'
object
'
,{});
$
(
this
.
storageId
).
attr
(
var
that
=
OfficeJS_login
.
object
;
'
value
'
,
this
.
localStorage
.
getItem
(
this
.
storagePath
)
||
''
);
odf
(
OfficeJS_login
.
object
,
'
storage_id
'
,
'
#login-gadget #login_input
'
);
},
odf
(
OfficeJS_login
.
object
,
'
storage_path
'
,
'
OfficeJS/login/login
'
);
odf
(
OfficeJS_login
.
object
,
'
remember_id
'
,
'
#login-gadget #remember_me
'
);
isRememberMe
:
function
()
{
odf
(
OfficeJS_login
.
object
,
'
remember_path
'
,
'
OfficeJS/login/remember_me
'
);
return
$
(
this
.
rememberId
).
attr
(
'
checked
'
);
odf
(
OfficeJS_login
.
object
,
'
fillLogin
'
,
function
()
{
},
$
(
that
.
storage_id
).
attr
(
fillRememberMe
:
function
()
{
'
value
'
,
localStorage
.
getItem
(
that
.
storage_path
)
||
''
);
var
t
=
this
.
localStorage
.
getItem
(
this
.
rememberPath
);
});
odf
(
OfficeJS_login
.
object
,
'
isRememberMe
'
,
function
()
{
return
$
(
that
.
remember_id
).
attr
(
'
checked
'
);
});
odf
(
OfficeJS_login
.
object
,
'
fillRememberMe
'
,
function
()
{
var
t
=
localStorage
.
getItem
(
that
.
remember_path
);
if
(
t
)
{
if
(
t
)
{
th
is
.
rememberMe
();
th
at
.
rememberMe
();
}
}
},
});
rememberMe
:
function
()
{
odf
(
OfficeJS_login
.
object
,
'
rememberMe
'
,
function
()
{
$
(
this
.
rememberId
).
attr
(
'
checked
'
,
'
1
'
);
$
(
that
.
remember_id
).
attr
(
'
checked
'
,
'
1
'
);
this
.
localStorage
.
setItem
(
this
.
rememberPath
,
'
1
'
);
localStorage
.
setItem
(
that
.
remember_path
,
'
1
'
);
},
});
dontRememberMe
:
function
()
{
odf
(
OfficeJS_login
.
object
,
'
dontRememberMe
'
,
function
()
{
$
(
this
.
rememberId
).
removeAttr
(
'
checked
'
);
$
(
that
.
remember_id
).
removeAttr
(
'
checked
'
);
this
.
localStorage
.
deleteItem
(
this
.
rememberPath
);
localStorage
.
deleteItem
(
that
.
remember_path
);
},
});
toggleRememberMe
:
function
()
{
odf
(
OfficeJS_login
.
object
,
'
toggleRememberMe
'
,
function
()
{
var
t
=
this
.
localStorage
.
getItem
(
this
.
rememberPath
);
var
t
=
localStorage
.
getItem
(
that
.
remember_path
);
if
(
t
)
{
this
.
dontRememberMe
()
}
else
{
this
.
rememberMe
();
}
if
(
t
)
{
that
.
dontRememberMe
()
}
else
{
that
.
rememberMe
();
}
},
});
odf
(
OfficeJS_login
.
object
,
'
connect
'
,
function
()
{
createJIO
:
function
()
{
var
spec
=
$
(
'
#login-gadget #login_input
'
).
attr
(
'
value
'
);
var
spec
=
$
(
'
#login-gadget #login_input
'
).
attr
(
'
value
'
);
this
.
localStorage
.
setItem
(
this
.
storagePath
,
spec
);
localStorage
.
setItem
(
that
.
storage_path
,
spec
);
OfficeJS
.
setJio
(
spec
);
OfficeJS_login
.
connect
(
spec
);
});
that
.
fillRememberMe
();
if
(
that
.
isRememberMe
())
{
that
.
fillLogin
();
}
}
};
}());
window
.
OfficeJS_login
.
fillRememberMe
();
if
(
window
.
OfficeJS_login
.
isRememberMe
())
{
window
.
OfficeJS_login
.
fillLogin
();
}
//-->
//-->
</script>
</script>
</div>
</div>
OfficeJS/component/slickgrid_document_lister.html
View file @
8b66f91e
...
@@ -24,8 +24,15 @@
...
@@ -24,8 +24,15 @@
<i
class=
"icon-remove icon-white"
></i>
<i
class=
"icon-remove icon-white"
></i>
Remove Selected
Remove Selected
</button>
</button>
<button
type=
"submit"
id=
"slickgrid_document_lister_refresh"
class=
"btn"
onclick=
"OfficeJS_slickgrid.refresh();"
>
<i
class=
"icon-refresh"
></i>
Refresh
</button>
</div>
</div>
<div
id=
"
myDocumentL
ist"
style=
"width:100%;height:300px"
></div>
<div
id=
"
slickgrid_documentl
ist"
style=
"width:100%;height:300px"
></div>
<script
type=
"text/javascript"
<script
type=
"text/javascript"
src=
"lib/jquery/jquery.js"
></script>
src=
"lib/jquery/jquery.js"
></script>
<script
type=
"text/javascript"
<script
type=
"text/javascript"
...
@@ -42,135 +49,7 @@
...
@@ -42,135 +49,7 @@
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
<!--
<!--
window
.
OfficeJS_slickgrid
=
{};
OfficeJS_slickgrid
.
load
();
window
.
OfficeJS_slickgrid
.
reload
=
function
()
{
$
(
'
#myDocumentList
'
).
html
(
''
);
var
grid
,
onSortFunction
,
onClickFunction
,
check_box_selector
,
onRemoveSeveral
,
showIconFormatter
,
document_list
=
OfficeJS
.
cloneCurrentDocumentList
(),
columns
=
[],
options
=
{
enableCellNavigation
:
true
,
enableColumnReorder
:
false
,
multiColumnSort
:
true
,
forceFitColumns
:
true
};
showIconFormatter
=
function
(
row
,
cell
,
value
,
columnDef
,
dataContext
)
{
return
dataContext
.
icon
;
};
(
function
(
array
)
{
var
i
,
lm
,
cd
,
split
,
mime
;
for
(
i
=
0
;
i
<
array
.
length
;
i
+=
1
)
{
// file names
split
=
array
[
i
].
name
.
split
(
'
.
'
);
array
[
i
].
ext
=
''
;
if
(
split
.
length
>
1
)
{
array
[
i
].
ext
=
split
[
split
.
length
-
1
];
split
.
length
-=
1
;
}
array
[
i
].
base_name
=
split
.
join
(
'
.
'
);
// app & icon
mime
=
OfficeJS
.
getMimeOfExt
(
array
[
i
].
ext
);
if
(
!
mime
)
{
array
[
i
].
icon
=
'
?
'
;
array
[
i
].
app
=
'
text_editor
'
;
}
else
{
array
[
i
].
icon
=
mime
.
icon
;
array
[
i
].
app
=
mime
.
preferred_application
||
mime
.
application
;
}
if
(
array
[
i
].
revision
)
{
array
[
i
].
conflict
=
array
[
i
].
revision_object
[
array
[
i
].
revision
].
conflict
?
'
X
'
:
''
;
}
else
{
array
[
i
].
conflict
=
''
;
}
// dates
// FIXME : we can have 2012/1/1 12:5
// we should have 2012/01/01 12:05
lm
=
(
new
Date
(
array
[
i
].
last_modified
));
cd
=
(
new
Date
(
array
[
i
].
creation_date
));
array
[
i
].
last_modified
=
lm
.
getFullYear
()
+
'
/
'
+
(
lm
.
getMonth
()
+
1
)
+
'
/
'
+
lm
.
getDate
()
+
'
'
+
lm
.
getHours
()
+
'
:
'
+
lm
.
getMinutes
();
array
[
i
].
creation_date
=
cd
.
getFullYear
()
+
'
/
'
+
(
cd
.
getMonth
()
+
1
)
+
'
/
'
+
cd
.
getDate
()
+
'
'
+
cd
.
getHours
()
+
'
:
'
+
cd
.
getMinutes
();
}
}(
document_list
));
$
(
function
()
{
check_box_selector
=
new
Slick
.
CheckboxSelectColumn
({
cssClass
:
"
slick-cell-checkboxsel
"
});
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_name
"
,
name
:
"
Document
"
,
field
:
"
base_name
"
,
sortable
:
true
});
columns
.
push
({
id
:
"
last_modified
"
,
name
:
"
Modified
"
,
field
:
"
last_modified
"
,
sortable
:
true
});
columns
.
push
({
id
:
"
creation_date
"
,
name
:
"
Created
"
,
field
:
"
creation_date
"
,
sortable
:
true
});
columns
.
push
({
id
:
'
on_conflict
'
,
name
:
''
,
field
:
'
conflict
'
,
sortable
:
true
,
resizable
:
false
,
width
:
24
});
grid
=
new
Slick
.
Grid
(
"
#myDocumentList
"
,
document_list
,
columns
,
options
);
grid
.
setSelectionModel
(
new
Slick
.
RowSelectionModel
(
{
selectActiveRow
:
false
}));
grid
.
registerPlugin
(
check_box_selector
);
onSortFunction
=
function
(
e
,
args
)
{
var
cols
=
args
.
sortCols
;
document_list
.
sort
(
function
(
data_row1
,
data_row2
)
{
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_row1
[
field
];
value2
=
data_row2
[
field
];
result
=
(
value1
==
value2
?
0
:(
value1
>
value2
?
1
:
-
1
))
*
sign
;
if
(
result
!=
0
)
{
return
result
;
}
}
return
0
;
});
grid
.
invalidate
();
grid
.
render
();
};
onClickFunction
=
function
(
e
)
{
var
cell
=
grid
.
getCellFromEvent
(
e
);
if
(
cell
.
cell
===
grid
.
getColumnIndex
(
'
file_name
'
))
{
OfficeJS
.
open
({
app
:
document_list
[
cell
.
row
].
app
,
file_name
:
document_list
[
cell
.
row
].
name
});
}
};
onRemoveSeveral
=
function
()
{
var
document_name_array
=
[],
selected
,
i
,
l
;
selected
=
grid
.
getSelectedRows
();
for
(
i
=
0
,
l
=
selected
.
length
;
i
<
l
;
i
+=
1
)
{
document_name_array
.
push
(
document_list
[
selected
[
i
]].
name
);
}
OfficeJS
.
removeSeveralFromArray
(
document_name_array
);
};
document
.
querySelector
(
'
#slickgrid_document_lister_remove_selected
'
).
onclick
=
onRemoveSeveral
;
grid
.
onClick
.
subscribe
(
onClickFunction
);
grid
.
onSort
.
subscribe
(
onSortFunction
);
});
};
window
.
OfficeJS_slickgrid
.
reload
();
//-->
//-->
</script>
</script>
</body>
</body>
...
...
OfficeJS/component/svg-edit.html
View file @
8b66f91e
<div>
<div>
<input
type=
"text"
<input
type=
"text"
name=
"fileName"
name=
"fileName"
id=
"
input_file_name
"
id=
"
svg-edit_docid
"
value=
""
value=
""
placeholder=
"File name here"
/>
placeholder=
"File name here"
/>
<button
type=
"submit"
<button
type=
"submit"
class=
"btn btn-primary"
class=
"btn btn-primary"
onclick=
"OfficeJS
.save($('#input_file_name').attr('value')
);"
>
onclick=
"OfficeJS
_svgedit.save(
);"
>
<i
class=
"icon-download-alt icon-white"
></i>
<i
class=
"icon-download-alt icon-white"
></i>
Save
Save
</button>
</button>
</div>
</div>
<iframe
src=
"lib/svg-edit/svg-editor.html"
<iframe
src=
"lib/svg-edit/svg-editor.html"
id=
"svg
_
edit_frame"
id=
"svg
-
edit_frame"
style=
"width:100%;
style=
"width:100%;
height:500px;"
height:500px;"
scrolling=
"no"
>
scrolling=
"no"
>
...
...
OfficeJS/component/top_nav_bar.html
View file @
8b66f91e
...
@@ -44,11 +44,11 @@
...
@@ -44,11 +44,11 @@
<li><h1>
OfficeJS
</h1></li>
<li><h1>
OfficeJS
</h1></li>
<li><a
href=
"#/about"
<li><a
href=
"#/about"
onclick=
"javascript:
onclick=
"javascript:
OfficeJS
.open({app:'about'}
);
OfficeJS
_top_nav_bar.about(
);
return false;"
>
About
</a></li>
return false;"
>
About
</a></li>
<li><a
href=
"#/contact"
<li><a
href=
"#/contact"
onclick=
"javascript:
onclick=
"javascript:
OfficeJS
.open({app:'contact'}
);
OfficeJS
_top_nav_bar.contact(
);
return false;"
>
Contact
</a></li>
return false;"
>
Contact
</a></li>
</ul>
</ul>
</div>
</div>
...
...
OfficeJS/component/workinprogress.html
View file @
8b66f91e
<h2>
Activities
</h2>
<h2>
Activities
</h2>
<div
id=
"activities"
></div>
<div
id=
"workinprogress_activities"
></div>
<script
type=
"text/javascript"
>
<!--
(
function
()
{
var
id
;
if
(
typeof
work_in_progress
!==
'
object
'
)
{
id
=
null
;
work_in_progress
=
{
start
:
function
(){
if
(
id
===
null
)
{
var
update
=
function
()
{
var
act
=
OfficeJS
.
getActivity
(),
i
,
str
=
''
;
for
(
i
=
0
;
i
<
act
.
length
;
i
+=
1
)
{
str
+=
act
[
i
]
+
'
<br />
'
;
}
if
(
str
===
''
)
{
str
=
'
There is no on going tasks.<br />
'
;
}
document
.
getElementById
(
'
activities
'
).
innerHTML
=
str
;
};
update
();
id
=
setInterval
(
update
,
200
);
}
},
stop
:
function
(){
if
(
id
!==
null
)
{
clearInterval
(
id
);
id
=
null
;
}
}
};
}
}());
//-->
</script>
OfficeJS/js/officejs.js
View file @
8b66f91e
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