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
c8acfa1c
Commit
c8acfa1c
authored
Jul 01, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement the document selection
create List object and methods implement basic rename function
parent
34732c78
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
145 additions
and
71 deletions
+145
-71
UNGProject/css/ung.css
UNGProject/css/ung.css
+3
-3
UNGProject/index.php
UNGProject/index.php
+2
-2
UNGProject/js/theme.js
UNGProject/js/theme.js
+33
-33
UNGProject/js/tools.js
UNGProject/js/tools.js
+31
-2
UNGProject/js/ung.js
UNGProject/js/ung.js
+48
-22
UNGProject/ung.html
UNGProject/ung.html
+25
-6
UNGProject/xml/image-editor.xml
UNGProject/xml/image-editor.xml
+1
-1
UNGProject/xml/table-editor.xml
UNGProject/xml/table-editor.xml
+1
-1
UNGProject/xml/text-editor.xml
UNGProject/xml/text-editor.xml
+1
-1
No files found.
UNGProject/css/ung.css
View file @
c8acfa1c
...
...
@@ -136,7 +136,7 @@ div.main-left {
background-color
:
#DAE6F6
;
height
:
100%
;
margin-left
:
-4px
;
width
:
1
8%
;
width
:
1
2em
;
margin-top
:
-0.6em
;
overflow
:
auto
;
float
:
left
;
...
...
@@ -257,7 +257,6 @@ div.listbox-domain-tree-container select {
/* right */
div
.main-right
{
width
:
82%
;
height
:
100%
;
margin-top
:
-0.6em
;
float
:
right
;
...
...
@@ -331,11 +330,12 @@ a.your_listbox_title {
/* records displayer */
div
.listbox-header-box
{
height
:
0
;
float
:
right
;
}
div
.listbox-number-of-records
{
float
:
right
;
font-size
:
12px
;
margin-right
:
12
em
;
margin-right
:
5
em
;
margin-top
:
-18px
;
min-width
:
30%
;
}
...
...
UNGProject/index.php
View file @
c8acfa1c
...
...
@@ -5,7 +5,7 @@
<title></title>
<script
text=
"javascript"
>
function
reloc
(
url
)
{
window
.
location
=
url
;}
</script>
</head>
<body
onload=
"reloc('
theme
.html');"
>
<textarea
id=
"errors"
name=
"errors"
style=
"width:100%; height:100px; background:silver;"
></textarea>
<body
onload=
"reloc('
ung
.html');"
>
</body>
</html>
UNGProject/js/theme.js
View file @
c8acfa1c
...
...
@@ -60,23 +60,25 @@ Page.prototype = {
switch
(
this
.
name
)
{
case
"
text-editor
"
:
editor
=
new
Xinha
();
if
(
!
doc
)
{
doc
=
new
JSONTextDocument
();}
doc
=
new
JSONTextDocument
();
break
;
case
"
table-editor
"
:
editor
=
new
SheetEditor
();
if
(
!
doc
)
{
doc
=
new
JSONSheetDocument
();}
doc
=
new
JSONSheetDocument
();
break
;
case
"
image-editor
"
:
editor
=
new
SVGEditor
();
if
(
!
doc
)
{
doc
=
new
JSONIllustrationDocument
();}
doc
=
new
JSONIllustrationDocument
();
break
;
default
:
//renvoie à la page d'accueil
window
.
location
=
"
ung.html
"
;
return
;
break
;
}
setCurrentDocument
(
doc
);
doc
.
load
(
getCurrentDocument
());
this
.
setEditor
(
editor
);
doc
.
setAsCurrentDocument
();
},
/* include a javascript or a css file */
...
...
@@ -188,7 +190,6 @@ setCurrentUser = function(user) {localStorage.setItem("currentUser", JSON.string
/* JSON document */
var
JSONDocument
=
function
()
{
this
.
type
=
"
table
"
;
//test
this
.
language
=
getCurrentUser
().
getLanguage
();
this
.
version
=
null
;
...
...
@@ -252,44 +253,43 @@ getCurrentDocument = function() {
}
setCurrentDocument
=
function
(
doc
)
{
localStorage
.
setItem
(
"
currentDocument
"
,
JSON
.
stringify
(
doc
));}
getDocumentList
=
function
()
{
var
list
=
localStorage
.
getItem
(
"
documentList
"
);
return
list
?
list
:
new
List
();
var
list
=
new
DocumentList
();
list
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
documentList
"
)));
return
list
;
}
setDocumentList
=
function
(
)
{
localStorage
.
setItem
(
"
documentList
"
,
list
);}
setDocumentList
=
function
(
list
)
{
localStorage
.
setItem
(
"
documentList
"
,
JSON
.
stringify
(
list
)
);}
supportedDocuments
=
{
"
text
"
:{
editorPage
:
"
text-editor
"
,
icon
:
"
images/icons/document.png
"
},
"
illustration
"
:{
editorPage
:
"
image-editor
"
,
icon
:
"
images/icons/svg.png
"
},
"
table
"
:{
editorPage
:
"
table-editor
"
,
icon
:
"
images/icons/table.png
"
},
"
other
"
:{
editorPage
:
null
,
icon
:
"
images/icons/other.gif
"
}
"
other
"
:{
editorPage
:
null
,
icon
:
"
images/icons/other.gif
"
},
undefined
:{
editorPage
:
null
,
icon
:
"
images/icons/other.gif
"
}
}
/*
* actions
*/
editDocumentSettings
=
function
()
{
$
(
"
#edit_document
"
).
dialog
({
autoOpen
:
true
,
height
:
131
,
width
:
389
,
modal
:
true
,
buttons
:
{
"
Save
"
:
function
(){
/*getCurrentDocument().setTitle($(getCurrentDocument()).find("#name").attr("value"));
//var new_short_title = $("input#short_title.short_title").attr("value");
getCurrentDocument().setLanguage($(getCurrentDocument()).find("#language").attr("value"));
getCurrentDocument().setVersion($(getCurrentDocument()).find("#version").attr("value"));
//var new_int_index = $("input#sort_index.sort_index").attr("value");
//var new_subject_list = $("textarea#keyword_list").attr("value").replace(/\n+/g, ",");
getCurrentDocument().setAsCurrentDocument();//diplay modifications
//save_button.click();*/
$
(
this
).
dialog
(
"
close
"
);
},
Cancel
:
function
()
{
$
(
this
).
dialog
(
"
close
"
);
}
}
});
}
loadFile
(
"
xml/xmlElements.xml
"
,
"
html
"
,
function
(
data
)
{
$
(
"
rename
"
,
data
).
dialog
({
autoOpen
:
true
,
height
:
131
,
width
:
389
,
modal
:
true
,
buttons
:
{
"
Save
"
:
function
(){
getCurrentDocument
().
setTitle
(
$
(
getCurrentDocument
()).
find
(
"
#name
"
).
attr
(
"
value
"
));
getCurrentDocument
().
setLanguage
(
$
(
getCurrentDocument
()).
find
(
"
#language
"
).
attr
(
"
value
"
));
getCurrentDocument
().
setVersion
(
$
(
getCurrentDocument
()).
find
(
"
#version
"
).
attr
(
"
value
"
));
getCurrentDocument
().
setAsCurrentDocument
();
//diplay modifications
$
(
this
).
dialog
(
"
close
"
);
},
Cancel
:
function
()
{
$
(
this
).
dialog
(
"
close
"
);
}
}
});
}
)}
saveCurrentDocument
=
function
()
{
getCurrentPage
().
getEditor
().
saveEdition
();
...
...
UNGProject/js/tools.js
View file @
c8acfa1c
...
...
@@ -42,7 +42,8 @@ var List = function(arg) {
if
(
arg
)
{
this
.
content
=
arg
;}
this
.
length
=
this
.
content
.
length
;
}
List
.
prototype
=
{
List
.
prototype
=
new
UngObject
();
List
.
prototype
.
load
({
size
:
function
()
{
return
this
.
length
;},
add
:
function
(
element
)
{
this
.
content
[
this
.
size
()]
=
element
;
this
.
length
++
;},
get
:
function
(
i
)
{
return
this
.
content
[
i
];},
...
...
@@ -56,7 +57,7 @@ List.prototype = {
this
.
remove
(
this
.
size
()
-
1
);
return
element
;
}
}
}
);
/**
* returns the current date
...
...
@@ -90,6 +91,27 @@ loadFile = function(address, type, instruction) {
});
}
// load methode, used for testing
//(Francois)
loadTest
=
function
(
address
)
{
$
.
ajax
({
url
:
address
,
type
:
"
GET
"
,
dataType
:
"
json
"
,
/*headers: {
Authorization: "Basic "+"nom:test"},
fields: {
withCredentials: "true"
},*/
success
:
function
(
data
){
var
list
=
getDocumentList
();
var
doc
=
new
JSONDocument
();
doc
.
load
(
data
);
list
.
add
(
doc
);
}
});
}
// load
loadXHR
=
function
(
address
)
{
$
.
ajax
({
...
...
@@ -139,4 +161,11 @@ tryUntilSucceed = function(func) {
nb
*=
nb
;
}
execute
();
}
/**
* Resize the right part of ung
*/
var
resize
=
function
()
{
$
(
"
div.main-right
"
).
width
(
$
(
window
).
width
()
-
$
(
"
div.main-left
"
).
width
());
}
\ No newline at end of file
UNGProject/js/ung.js
View file @
c8acfa1c
var
documentList
=
getDocumentList
();
documentList
.
add
(
new
JSONDocument
());
documentList
.
add
(
new
JSONDocument
());
documentList
.
add
(
new
JSONDocument
());
/**
* This file provides the javascript used to display the list of user's documents
*/
/**
* create a ligne representing a document in the main table
* class DocumentList
* This class provides methods to manipulate the list of documents of the current user
*/
var
DocumentList
=
function
()
{
List
.
call
(
this
);}
DocumentList
.
prototype
=
new
List
();
DocumentList
.
prototype
.
load
({
get
:
function
(
i
)
{
var
doc
=
new
JSONDocument
();
doc
.
load
(
this
.
content
[
i
]);
return
doc
;
},
add
:
function
(
doc
)
{
this
.
content
[
this
.
size
()]
=
doc
;
this
.
length
++
;
setDocumentList
(
this
)
},
display
:
function
()
{
var
n
=
getDocumentList
().
size
();
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
ligne
=
new
Line
(
getDocumentList
().
get
(
i
),
0
);
ligne
.
updateHTML
();
ligne
.
display
();
}
}
})
/* initialize the list */
//current lines are just for testing
setDocumentList
(
new
List
());
loadTest
(
"
dav/temp.json
"
);
loadTest
(
"
dav/temp2.json
"
);
getDocumentList
().
add
(
new
JSONDocument
());
/**
* create a line representing a document in the main table
* @param doc : document to represent
* @param i : ID of the line (number)
*/
...
...
@@ -25,11 +61,11 @@ Line.prototype = {
/* load the document information in the html of a default line */
updateHTML
:
function
()
{
var
line
=
this
;
this
.
setHTML
(
$
(
this
.
getHTML
()).
attr
(
"
class
"
,
this
.
getType
())
.
find
(
"
td.listbox-table-select-cell input
"
).
attr
(
"
id
"
,
this
.
getID
()).
end
()
//ID
//.find("td.listbox-table-data-cell a").attr("onclick",this.startEdition).end()//clic
.
find
(
"
td.listbox-table-data-cell
"
)
.
click
(
this
.
startEdition
)
//clic
.
click
(
function
()
{
line
.
startEdition
(
line
.
getDocument
())}
)
//clic
.
find
(
"
a.listbox-document-icon
"
)
.
find
(
"
img
"
)
.
attr
(
"
src
"
,
supportedDocuments
[
this
.
getType
()].
icon
)
//icon
...
...
@@ -43,10 +79,12 @@ Line.prototype = {
/* add the line in the table */
display
:
function
()
{
$
(
"
table.listbox tbody
"
).
append
(
$
(
this
.
getHTML
()));},
/* edit the document if clicked */
startEdition
:
function
()
{
setCurrentDocument
(
this
.
document
);
window
.
location
=
"
theme.html
"
;
startEdition
:
function
(
doc
)
{
setCurrentDocument
(
doc
);
if
(
supportedDocuments
[
doc
.
getType
()].
editorPage
)
{
window
.
location
=
"
theme.html
"
;}
else
alert
(
"
no editor available for this document
"
);
}
}
/* load the html code of a default line */
Line
.
loadHTML
=
function
()
{
...
...
@@ -55,15 +93,3 @@ Line.loadHTML = function() {
}
/* return the html code of a default line */
Line
.
getOriginalHTML
=
function
()
{
return
Line
.
originalHTML
;}
/* load the table */
waitBeforeSucceed
(
function
(){
return
Line
.
loadHTML
()},
function
()
{
for
(
var
i
=
0
;
i
<
documentList
.
size
();
i
++
)
{
var
ligne
=
new
Line
(
documentList
.
get
(
i
),
0
);
ligne
.
updateHTML
();
ligne
.
display
();
}
}
);
\ No newline at end of file
UNGProject/ung.html
View file @
c8acfa1c
...
...
@@ -29,6 +29,25 @@
<link
rel=
"shortcut icon"
type=
"image/x-icon"
href=
"images/ung/favicon.ico"
/>
<script
type=
"text/javascript"
>
var
initUser
=
function
()
{
var
user
=
getCurrentUser
();
if
(
!
user
)
{
user
=
new
User
();}
user
.
setAsCurrentUser
();
}
var
init
=
function
()
{
setCurrentPage
(
new
Page
());
initUser
();
waitBeforeSucceed
(
function
(){
return
Line
.
loadHTML
()},
getDocumentList
().
display
);
resize
();
}
$
(
window
).
resize
(
resize
);
$
(
document
).
ready
(
init
);
</script>
</head>
<body>
<form
id=
"main_form"
class=
"main_form"
...
...
@@ -84,10 +103,10 @@
<div
id=
"select_language"
>
<ul><li>
<span
id=
"
available
_language"
>
en
</span>
<span
id=
"
current
_language"
>
en
</span>
<img
src=
"images/ung/arrow_20C.png"
/>
<ul>
<li><
span
onclick=
"changeLanguage(this.innerHTML)"
id=
"fr"
>
fr
</span><
/li>
<ul
id=
"available_languages"
>
<li></li>
</ul>
</li></ul>
...
...
@@ -104,7 +123,7 @@
<a
id=
"right_message"
>
Not Implemented yet
</a>
<div
id=
"preference_dialog"
title=
"UNG Preferences"
></div>
<a
>
zope
</a>
<a
id=
"userName"
>
Unknown
</a>
|
<a
id=
"settings"
href=
"#"
>
Settings
</a>
|
<a
id=
"help"
href=
"#"
>
Help
</a>
|
<a
href=
"..WebSite_logout"
>
Sign out
</a>
...
...
@@ -134,7 +153,7 @@
<div
class=
"input"
><div
>
<a
class=
"ung_docs"
href=
"javascript:window.location.reload()"
>
<a
class=
"ung_docs"
href=
"
#"
onclick=
"
javascript:window.location.reload()"
>
<img
src=
"images/ung/ung-logo.gif"
/>
</a>
<a
id=
"loading_message"
>
Loading...
</a>
...
...
@@ -431,7 +450,7 @@
<div
class=
"favorite"
>
<a
class=
"domain_selected"
></a>
<a
href=
"
...
"
>
Refresh
</a>
<a
href=
"
#"
onclick=
"javascript:window.location.reload()
"
>
Refresh
</a>
</div>
</div></div>
...
...
UNGProject/xml/image-editor.xml
View file @
c8acfa1c
...
...
@@ -10,7 +10,7 @@
</div></div>
</content>
<dependencies>
<scriptfile>
js/i
llustration
.js
</scriptfile>
<scriptfile>
js/i
mage-editor
.js
</scriptfile>
<stylefile>
css/jquery-ui.css
</stylefile>
</dependencies>
</root>
UNGProject/xml/table-editor.xml
View file @
c8acfa1c
...
...
@@ -111,7 +111,7 @@
<scriptfile>
js/jquery/plugin/colorpicker/jquery.colorPicker.min.js
</scriptfile>
<scriptfile>
js/jquery/plugin/elastic/jquery.elastic.min.js
</scriptfile>
<scriptfile>
js/jquery/plugin/sheet/jquery.sheet.js
</scriptfile>
<scriptfile>
js/table.js
</scriptfile>
<scriptfile>
js/table
-editor
.js
</scriptfile>
<stylefile>
js/jquery/plugin/sheet/jquery.sheet.css
</stylefile>
<stylefile>
css/table.css
</stylefile>
<stylefile>
js/jquery/plugin/colorpicker/jquery.colorPicker.css
</stylefile>
...
...
UNGProject/xml/text-editor.xml
View file @
c8acfa1c
...
...
@@ -12,7 +12,7 @@
</div>
</content>
<dependencies>
<scriptfile>
js/editor.js
</scriptfile>
<scriptfile>
js/
text-
editor.js
</scriptfile>
<stylefile>
css/jquery-ui.css
</stylefile>
</dependencies>
</root>
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