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
77e4848b
Commit
77e4848b
authored
Jul 07, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bugs with the getters of some complex elements
parent
2af60681
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
56 deletions
+70
-56
UNGProject/css/ung.css
UNGProject/css/ung.css
+6
-2
UNGProject/js/image-editor.js
UNGProject/js/image-editor.js
+12
-8
UNGProject/js/text-editor.js
UNGProject/js/text-editor.js
+15
-9
UNGProject/js/tools.js
UNGProject/js/tools.js
+7
-5
UNGProject/js/ung.js
UNGProject/js/ung.js
+27
-25
UNGProject/theme.html
UNGProject/theme.html
+0
-1
UNGProject/ung.html
UNGProject/ung.html
+3
-6
No files found.
UNGProject/css/ung.css
View file @
77e4848b
...
...
@@ -121,8 +121,7 @@ div#wrapper_header {
/* left */
div
.header-left
{
margin-top
:
-4px
;
min-width
:
32em
;
width
:
40%
;
width
:
32em
;
position
:
absolute
;
}
div
.header-left
h2
{
...
...
@@ -156,6 +155,11 @@ div#wrapper_header div.field a[name="document_title"]:hover {
background
:
none
repeat
scroll
0
0
#FFFFD6
;
border
:
1px
solid
#AAAAAA
;
}
/* research bar */
div
.input
form
{
margin-top
:
0.5em
;
float
:
right
;
}
/* right */
div
.header-right
{
...
...
UNGProject/js/image-editor.js
View file @
77e4848b
...
...
@@ -25,14 +25,20 @@ SVGEditor = function() {
/**
* SVG documents
* editable documents must implements the following methods
* getType : returns the type of a document
*
* editable documents must implements the following arguments and methods
* type : a unique type ID
* saveEdition : set the argument as the new content of the document. Change last modification time and display the changes
* setAsCurrentDocument : set the document as currentDocument in the local storage and display its properties in the current page
*
* @param arg : a json JSONTextDocument object to load
*/
var
JSONIllustrationDocument
=
function
()
{
JSONDocument
.
call
(
this
);
//inherits properties from JSONDocument
var
JSONIllustrationDocument
=
function
(
arg
)
{
JSONDocument
.
call
(
this
,
arg
);
//inherits properties from JSONDocument
if
(
arg
)
{
this
.
load
(
arg
);}
else
{
this
.
type
=
"
illustration
"
;
}
}
JSONIllustrationDocument
.
prototype
=
new
JSONDocument
();
//inherits methods from JSONDocument
...
...
@@ -53,8 +59,6 @@ JSONIllustrationDocument.prototype.setAsCurrentDocument = function() {
}
getCurrentDocument
=
function
()
{
var
doc
=
new
JSONIllustrationDocument
();
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
return
new
JSONIllustrationDocument
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
}
UNGProject/js/text-editor.js
View file @
77e4848b
...
...
@@ -31,15 +31,23 @@ var Xinha = function() {
/**
* Text documents
* editable documents must implements the following methods
* getType : returns the type of a document
*
* editable documents must implements the following arguments and methods
* type : a unique type ID
* saveEdition : set the argument as the new content of the document. Change last modification time and display the changes
* setAsCurrentDocument : set the document as currentDocument in the local storage and display its properties in the current page
*/
var
JSONTextDocument
=
function
()
{
JSONDocument
.
call
(
this
);
//inherits properties from JSONDocument
/**
* class JSONTextDocument
* @param arg : a json JSONTextDocument object to load
*/
var
JSONTextDocument
=
function
(
arg
)
{
JSONDocument
.
call
(
this
,
arg
);
//inherits properties from JSONDocument
if
(
arg
)
{
this
.
load
(
arg
);}
else
{
this
.
type
=
"
text
"
;
}
}
JSONTextDocument
.
prototype
=
new
JSONDocument
();
//inherits methods from JSONDocument
...
...
@@ -60,7 +68,5 @@ JSONTextDocument.prototype.setAsCurrentDocument = function() {
}
getCurrentDocument
=
function
()
{
var
doc
=
new
JSONTextDocument
();
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
return
new
JSONTextDocument
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
}
UNGProject/js/tools.js
View file @
77e4848b
...
...
@@ -36,18 +36,20 @@ UngObject.prototype.inherits = function(superClass) {
/**
* Class List
* this class provides usual API to manipulate list structure
* @param arg : a json list object
*/
var
List
=
function
(
arg
)
{
if
(
arg
)
{
this
.
load
(
arg
);}
else
{
this
.
content
=
new
Array
();
if
(
arg
)
{
this
.
content
=
arg
;}
this
.
length
=
this
.
content
.
length
;
}
}
List
.
prototype
=
new
UngObject
();
List
.
prototype
.
load
({
size
:
function
()
{
return
this
.
length
;},
put
:
function
(
key
,
value
)
{
if
(
!
this
.
content
[
key
])
{
this
.
length
=
this
.
length
+
1
;}
alert
(
""
+
this
.
length
+
this
.
content
[
key
]);
if
(
!
this
.
content
[
key
])
{
this
.
length
++
;}
this
.
content
[
key
]
=
value
;
},
add
:
function
(
element
)
{
this
.
put
(
this
.
size
(),
element
);},
...
...
UNGProject/js/ung.js
View file @
77e4848b
...
...
@@ -10,20 +10,26 @@ setCurrentDocumentID = function(ID) {return localStorage.setItem("currentDocumen
/**
* class DocumentList
* This class provides methods to manipulate the list of documents of the current user
* As the list is stored in the localStorage, we are obliged to call "setDocumentList" after
* any content modification
* @param arg : a documentList json object to load
*/
var
DocumentList
=
function
()
{
List
.
call
(
this
);
var
DocumentList
=
function
(
arg
)
{
List
.
call
(
this
,
arg
);
if
(
arg
)
{
this
.
load
(
arg
);
for
(
var
i
=
0
;
i
<
this
.
size
();
i
++
)
{
this
.
content
[
i
]
=
new
JSONDocument
(
this
.
get
(
i
));
//load methods of documents
}
this
.
selectionList
=
new
List
(
arg
.
selectionList
);
//load methods of selectionList
}
else
{
this
.
displayedPage
=
1
;
this
.
selectionList
=
new
List
();
}
}
DocumentList
.
prototype
=
new
List
();
DocumentList
.
prototype
.
load
({
/* override : returns the ith document */
get
:
function
(
i
)
{
var
doc
=
new
JSONDocument
();
doc
.
load
(
this
.
content
[
i
]);
return
doc
;
},
/* override : put an element at the specified position */
put
:
function
(
i
,
doc
)
{
this
.
content
[
i
]
=
doc
;
...
...
@@ -31,11 +37,7 @@ DocumentList.prototype.load({
setDocumentList
(
this
);
},
getSelectionList
:
function
()
{
var
list
=
new
List
();
list
.
load
(
this
.
selectionList
);
return
list
;
},
getSelectionList
:
function
()
{
return
this
.
selectionList
;
},
resetSelectionList
:
function
()
{
this
.
selectionList
=
new
List
();
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
)
{
...
...
@@ -45,8 +47,8 @@ DocumentList.prototype.load({
},
checkAll
:
function
()
{
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
)
{
this
.
selectionList
.
put
(
i
,
this
.
get
(
i
));
$
(
"
tr td.listbox-table-select-cell input#
"
+
this
.
get
(
i
).
getID
()
).
attr
(
"
checked
"
,
true
);
this
.
getSelectionList
()
.
put
(
i
,
this
.
get
(
i
));
$
(
"
tr td.listbox-table-select-cell input#
"
+
i
).
attr
(
"
checked
"
,
true
);
}
setDocumentList
(
this
);
},
...
...
@@ -83,19 +85,17 @@ DocumentList.prototype.load({
/* update the ith document information */
update
:
function
(
i
)
{
var
li
ne
=
this
;
var
doc
=
li
ne
.
get
(
i
);
var
li
st
=
this
;
var
doc
=
li
st
.
get
(
i
);
loadFile
(
getDocumentAddress
(
doc
),
"
json
"
,
function
(
data
)
{
doc
.
load
(
data
);
//todo : replace by data.header
doc
.
setContent
(
""
);
//
li
ne
.
put
(
i
,
doc
);
li
st
.
put
(
i
,
doc
);
});
}
});
getDocumentList
=
function
()
{
var
list
=
new
DocumentList
();
list
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
documentList
"
)));
return
list
;
return
new
DocumentList
(
JSON
.
parse
(
localStorage
.
getItem
(
"
documentList
"
)));
}
setDocumentList
=
function
(
list
)
{
localStorage
.
setItem
(
"
documentList
"
,
JSON
.
stringify
(
list
));}
...
...
@@ -120,19 +120,21 @@ Line.prototype = {
return
$
(
"
tr td.listbox-table-select-cell input#
"
+
this
.
getID
()).
attr
(
"
checked
"
);
},
/* add the document of this line to the list of selected documents */
addToSelection
:
function
()
{
var
list
=
getDocumentList
();
list
=
getDocumentList
();
list
.
getSelectionList
().
put
(
this
.
getID
(),
this
);
setDocumentList
(
list
);
},
/* remove the document of this line from the list of selected documents */
removeFromSelection
:
function
()
{
var
list
=
getDocumentList
();
list
.
getSelectionList
().
remove
(
this
.
getID
());
setDocumentList
(
list
);
},
/* check or uncheck the line */
changeState
:
function
()
{
this
.
isSelected
()
?
this
.
addToSelection
()
:
this
.
removeFromSelection
();
test
=
getDocumentList
().
getSelectionList
();
$
(
"
span#selected_row_number a
"
).
html
(
getDocumentList
().
getSelectionList
().
size
());
},
...
...
UNGProject/theme.html
View file @
77e4848b
...
...
@@ -36,7 +36,6 @@
var
initUser
=
function
()
{
var
user
=
getCurrentUser
();
if
(
!
user
)
{
user
=
new
User
();}
user
.
setAsCurrentUser
();
}
...
...
UNGProject/ung.html
View file @
77e4848b
...
...
@@ -53,10 +53,7 @@
</script>
</head>
<body>
<form
id=
"main_form"
class=
"main_form"
onsubmit=
"changed=false; return true"
method=
"post"
>
<div>
<div
class=
"container"
>
<div
class=
"navigation"
>
...
...
@@ -556,7 +553,7 @@
name=
"your_listbox_uncheckAll:method"
value=
"1"
alt=
"Uncheck All"
title=
"Uncheck All"
onclick=
"getDocu
e
mentList().resetSelectionList()"
onclick=
"getDocumentList().resetSelectionList()"
src=
"images/icons/decheckall.png"
/>
</th>
...
...
@@ -632,6 +629,6 @@
</div>
</div>
</div></div>
</
form
>
</
div
>
</body>
</html>
\ No newline at end of file
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