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
15d6eafd
Commit
15d6eafd
authored
Jul 11, 2011
by
François Billioud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement multiple selections and delete
parent
214d845b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
706 additions
and
586 deletions
+706
-586
UNGProject/js/theme.js
UNGProject/js/theme.js
+55
-48
UNGProject/js/tools.js
UNGProject/js/tools.js
+150
-56
UNGProject/js/ung.js
UNGProject/js/ung.js
+39
-24
UNGProject/ung.html
UNGProject/ung.html
+462
-458
No files found.
UNGProject/js/theme.js
View file @
15d6eafd
...
@@ -21,7 +21,6 @@ var Page = function(page) {
...
@@ -21,7 +21,6 @@ var Page = function(page) {
this
.
html
=
window
.
document
;
this
.
html
=
window
.
document
;
this
.
xml
=
null
;
this
.
xml
=
null
;
this
.
editor
=
null
;
this
.
editor
=
null
;
//define as current page
//define as current page
currentPage
=
this
;
currentPage
=
this
;
if
(
page
!=
undefined
)
{
this
.
loadXML
(
"
xml/
"
+
page
+
"
.xml
"
);}
if
(
page
!=
undefined
)
{
this
.
loadXML
(
"
xml/
"
+
page
+
"
.xml
"
);}
...
@@ -139,13 +138,17 @@ setCurrentPage = function(page) {currentPage = page;}
...
@@ -139,13 +138,17 @@ setCurrentPage = function(page) {currentPage = page;}
/*
/*
* User Class
* User Class
* stores useful information about a user and provides methods to manipulate them
* stores useful information about a user and provides methods to manipulate them
* @param arg : a json User object to load
*/
*/
var
User
=
function
(
details
)
{
var
User
=
function
(
arg
)
{
if
(
arg
)
{
this
.
load
(
arg
);}
else
{
this
.
name
=
"
unknown
"
;
this
.
name
=
"
unknown
"
;
this
.
language
=
"
en
"
;
this
.
language
=
"
en
"
;
this
.
storage
=
"
http://www.unhosted-dav.com
"
;
this
.
storage
=
"
http://www.unhosted-dav.com
"
;
this
.
identityProvider
=
"
http://www.webfinger.com
"
;
this
.
identityProvider
=
"
http://www.webfinger.com
"
;
this
.
displayPreferences
=
15
;
//number of displayed document in the list
this
.
displayPreferences
=
15
;
//number of displayed document in the list
}
}
}
User
.
prototype
=
new
UngObject
();
//inherits from UngObject
User
.
prototype
=
new
UngObject
();
//inherits from UngObject
User
.
prototype
.
load
({
//add methods thanks to the UngObject.load method
User
.
prototype
.
load
({
//add methods thanks to the UngObject.load method
...
@@ -168,9 +171,7 @@ User.prototype.load({//add methods thanks to the UngObject.load method
...
@@ -168,9 +171,7 @@ User.prototype.load({//add methods thanks to the UngObject.load method
});
});
getCurrentUser
=
function
()
{
getCurrentUser
=
function
()
{
var
user
=
new
User
();
return
new
User
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentUser
"
)));
user
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentUser
"
)));
return
user
;
}
}
setCurrentUser
=
function
(
user
)
{
localStorage
.
setItem
(
"
currentUser
"
,
JSON
.
stringify
(
user
));}
setCurrentUser
=
function
(
user
)
{
localStorage
.
setItem
(
"
currentUser
"
,
JSON
.
stringify
(
user
));}
...
@@ -182,8 +183,13 @@ setCurrentUser = function(user) {localStorage.setItem("currentUser", JSON.string
...
@@ -182,8 +183,13 @@ setCurrentUser = function(user) {localStorage.setItem("currentUser", JSON.string
* to manipulate these elements.
* to manipulate these elements.
*/
*/
/* JSON document */
/**
var
JSONDocument
=
function
()
{
* JSON document
* @param arg : a json JSONDocument object to load
*/
var
JSONDocument
=
function
(
arg
)
{
if
(
arg
)
{
this
.
load
(
arg
);}
else
{
this
.
language
=
getCurrentUser
().
getLanguage
();
this
.
language
=
getCurrentUser
().
getLanguage
();
this
.
version
=
null
;
this
.
version
=
null
;
...
@@ -193,7 +199,8 @@ var JSONDocument = function() {
...
@@ -193,7 +199,8 @@ var JSONDocument = function() {
this
.
content
=
""
;
this
.
content
=
""
;
this
.
creation
=
currentTime
();
this
.
creation
=
currentTime
();
this
.
lastModification
=
currentTime
();
this
.
lastModification
=
currentTime
();
this
.
state
=
this
.
states
.
draft
;
this
.
state
=
JSONDocument
.
prototype
.
states
.
draft
;
}
}
}
JSONDocument
.
prototype
=
new
UngObject
();
//inherits from UngObject
JSONDocument
.
prototype
=
new
UngObject
();
//inherits from UngObject
...
@@ -240,7 +247,8 @@ JSONDocument.prototype.load({//add methods thanks to the UngObject.load method
...
@@ -240,7 +247,8 @@ JSONDocument.prototype.load({//add methods thanks to the UngObject.load method
save
:
function
(
instruction
)
{
save
:
function
(
instruction
)
{
var
doc
=
this
;
var
doc
=
this
;
saveFile
(
getDocumentAddress
(
this
),
doc
,
instruction
);
saveFile
(
getDocumentAddress
(
this
),
doc
,
instruction
);
}
},
remove
:
function
(
instruction
)
{
deleteFile
(
getDocumentAddress
(
this
),
instruction
);}
});
});
JSONDocument
.
prototype
.
states
=
{
JSONDocument
.
prototype
.
states
=
{
draft
:{
"
fr
"
:
"
Brouillon
"
,
"
en
"
:
"
Draft
"
},
draft
:{
"
fr
"
:
"
Brouillon
"
,
"
en
"
:
"
Draft
"
},
...
@@ -248,9 +256,7 @@ JSONDocument.prototype.states = {
...
@@ -248,9 +256,7 @@ JSONDocument.prototype.states = {
deleted
:{
"
fr
"
:
"
Supprimé
"
,
"
en
"
:
"
Deleted
"
}
deleted
:{
"
fr
"
:
"
Supprimé
"
,
"
en
"
:
"
Deleted
"
}
}
}
getCurrentDocument
=
function
()
{
getCurrentDocument
=
function
()
{
var
doc
=
new
JSONDocument
();
return
new
JSONDocument
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
doc
.
load
(
JSON
.
parse
(
localStorage
.
getItem
(
"
currentDocument
"
)));
return
doc
;
}
}
setCurrentDocument
=
function
(
doc
)
{
localStorage
.
setItem
(
"
currentDocument
"
,
JSON
.
stringify
(
doc
));}
setCurrentDocument
=
function
(
doc
)
{
localStorage
.
setItem
(
"
currentDocument
"
,
JSON
.
stringify
(
doc
));}
...
@@ -269,6 +275,7 @@ getDocumentAddress = function(doc) {return "dav/"+doc.getCreation();}
...
@@ -269,6 +275,7 @@ getDocumentAddress = function(doc) {return "dav/"+doc.getCreation();}
* open a dialog box to edit document information
* open a dialog box to edit document information
*/
*/
editDocumentSettings
=
function
()
{
editDocumentSettings
=
function
()
{
saveCurrentDocument
();
loadFile
(
"
xml/xmlElements.xml
"
,
"
html
"
,
function
(
data
)
{
loadFile
(
"
xml/xmlElements.xml
"
,
"
html
"
,
function
(
data
)
{
$
(
"
rename
"
,
data
).
dialog
({
$
(
"
rename
"
,
data
).
dialog
({
autoOpen
:
true
,
autoOpen
:
true
,
...
...
UNGProject/js/tools.js
View file @
15d6eafd
...
@@ -33,51 +33,132 @@ UngObject.prototype.inherits = function(superClass) {
...
@@ -33,51 +33,132 @@ UngObject.prototype.inherits = function(superClass) {
this
.
prototype
.
load
(
superClass
.
prototype
);
this
.
prototype
.
load
(
superClass
.
prototype
);
}
}
/* return true only if two objects are equals */
UngObject
.
prototype
.
equals
=
function
(
object
)
{
for
(
var
property
in
object
)
{
if
(
this
.
hasOwnProperty
(
property
))
{
var
isEquals
=
this
[
property
]
&&
typeof
(
this
[
property
])
==
"
object
"
?
UngObject
.
prototype
.
equals
.
call
(
this
[
property
],
object
[
property
])
:
this
[
property
]
===
object
[
property
];
if
(
!
isEquals
)
{
return
false
}
}
}
return
true
;
}
/**
/**
* Class List
* Class List
* this class provides usual API to manipulate list structure
* this class provides usual API to manipulate list structure
* @param arg : a json list object
* @param arg : a json list object
* @param contentType : the type of the elements of the list
*/
*/
var
List
=
function
(
arg
)
{
var
List
=
function
(
arg
,
contentType
)
{
if
(
arg
)
{
this
.
load
(
arg
);}
if
(
arg
&&
arg
.
headElement
)
{
if
(
contentType
)
{
this
.
headElement
=
new
contentType
(
arg
.
headElement
);
}
else
{
this
.
headElement
=
arg
.
headElement
;
}
this
.
length
=
arg
.
length
;
this
.
previous
=
new
List
(
arg
.
previous
,
contentType
);
}
else
{
else
{
this
.
content
=
new
Array
();
this
.
nullElement
();
this
.
length
=
this
.
content
.
length
;
}
}
}
}
List
.
prototype
=
new
UngObject
();
List
.
prototype
=
new
UngObject
();
List
.
prototype
.
load
({
List
.
prototype
.
load
({
nullElement
:
function
()
{
this
.
headElement
=
null
;
this
.
previous
=
undefined
;
this
.
length
=
0
;
},
size
:
function
()
{
return
this
.
length
;},
size
:
function
()
{
return
this
.
length
;},
put
:
function
(
key
,
value
)
{
head
:
function
()
{
return
this
.
headElement
;},
if
(
!
this
.
content
[
key
])
{
this
.
length
++
;}
tail
:
function
()
{
return
this
.
previous
;},
this
.
content
[
key
]
=
value
;
isEmpty
:
function
()
{
return
this
.
head
()
===
null
;},
equals
:
function
(
list
)
{
return
this
.
head
().
equals
(
list
.
head
())
&&
this
.
tail
().
equals
(
list
.
tail
());
},
},
add
:
function
(
element
)
{
this
.
put
(
this
.
size
(),
element
);},
add
:
function
(
value
)
{
get
:
function
(
i
)
{
return
this
.
content
[
i
];},
var
t
=
new
List
();
concat
:
function
(
list
)
{
while
(
!
list
.
isEmpty
())
{
this
.
add
(
list
.
pop
())}},
t
.
load
(
this
);
remove
:
function
(
i
)
{
delete
this
.
content
[
i
];
this
.
length
--
;},
this
.
headElement
=
value
;
isEmpty
:
function
()
{
return
this
.
size
()
==
0
;},
this
.
previous
=
t
;
head
:
function
()
{
return
this
.
isEmpty
()
?
null
:
this
.
get
(
this
.
size
()
-
1
);},
this
.
length
=
t
.
size
()
+
1
;
pop
:
function
()
{
},
if
(
this
.
isEmpty
())
{
return
null
;}
get
:
function
(
i
)
{
var
element
=
this
.
get
(
this
.
size
()
-
1
);
if
(
i
>=
this
.
size
())
{
return
null
;}
this
.
remove
(
this
.
size
()
-
1
);
if
(
i
==
0
)
{
return
this
.
head
();}
return
element
;
return
this
.
tail
().
get
(
i
-
1
)
;
},
},
recursiveCall
:
function
(
instruction
)
{
set
:
function
(
i
,
element
)
{
var
list
=
new
List
();
if
(
i
>=
this
.
size
())
{
error
(
"
set out of bounds,
"
+
i
+
"
:
"
+
this
.
size
(),
this
);
return
}
list
.
load
(
this
);
if
(
i
==
0
)
{
if
(
list
.
isEmpty
())
{
return
false
;}
this
.
headElement
=
element
;
var
result
=
instruction
(
list
.
pop
());
}
else
{
return
result
?
result
:
list
.
recursiveCall
(
instruction
);
this
.
tail
().
set
(
i
-
1
,
element
);
}
},
remove
:
function
(
i
)
{
if
(
i
>=
this
.
size
())
{
error
(
"
remove out of bounds,
"
+
i
+
"
:
"
+
this
.
size
(),
this
);
return
}
//particular case
if
(
i
==
0
)
{
this
.
pop
();
return
}
//particular case
if
(
i
==
1
)
{
//init
this
.
previous
=
this
.
tail
().
tail
();
}
else
{
//recursion
this
.
tail
().
remove
(
i
-
1
);
}
this
.
length
--
;
},
pop
:
function
()
{
if
(
this
.
isEmpty
())
{
error
(
"
pop on empty list
"
,
this
);
return
null
;}
var
h
=
this
.
head
();
this
.
load
(
this
.
tail
())
return
h
;
},
},
find
:
function
(
object
)
{
find
:
function
(
object
)
{
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
)
{
if
(
this
.
get
(
i
)
===
object
)
{
return
i
;}}
if
(
this
.
isEmpty
())
{
return
-
1
}
//init-false
return
-
1
;
var
elt
=
this
.
head
();
if
(
object
.
equals
)
{
//init-true
if
(
object
.
equals
(
this
.
head
()))
{
return
0
;}
//with an adapted comparator
}
else
{
if
(
object
===
this
.
head
())
{
return
0
;}
//with usual comparator
}
var
recursiveResult
=
this
.
tail
().
find
(
object
);
//recursion
return
recursiveResult
>=
0
?
this
.
tail
().
find
(
object
)
+
1
:
recursiveResult
;
},
contains
:
function
(
object
)
{
if
(
this
.
isEmpty
())
{
return
false
}
else
{
return
object
===
this
.
head
()
?
true
:
this
.
tail
().
contains
(
object
)}},
insert
:
function
(
element
,
i
)
{
if
(
i
>
this
.
size
())
{
error
(
"
insert out of bounds,
"
+
i
+
"
:
"
+
this
.
size
(),
this
);
return
}
//particular case
if
(
i
==
0
)
{
//init
this
.
add
(
element
);
}
else
{
//recursion
this
.
tail
().
insert
(
element
,
i
-
1
);
this
.
length
++
;
}
},
replace
:
function
(
oldElement
,
newElement
)
{
if
(
this
.
isEmpty
())
{
error
(
"
<<element not found>> when trying to replace
"
,
this
);
return
}
//init-false
if
(
oldElement
===
this
.
head
())
{
this
.
set
(
0
,
newElement
);
//init-true
}
else
{
this
.
tail
().
replace
(
oldElement
,
newElement
);
//recursion
}
},
},
contains
:
function
(
object
)
{
return
(
find
(
object
)
!=-
1
);
}
removeElement
:
function
(
element
)
{
//remove each occurence of the element in this list
if
(
this
.
isEmpty
())
{
return
}
this
.
tail
().
removeElement
(
element
);
if
(
element
.
equals
)
{
//init-true
if
(
element
.
equals
(
this
.
head
()))
{
this
.
pop
();}
//with an adapted comparator
}
else
{
if
(
element
===
this
.
head
())
{
this
.
pop
();}
//with usual comparator
}
}
});
});
error
:
function
(
message
,
object
)
{
errorObject
=
object
;
console
.
log
(
message
);
}
/**
/**
* returns the current date
* returns the current date
...
@@ -114,7 +195,7 @@ loadFile = function(address, type, instruction) {
...
@@ -114,7 +195,7 @@ loadFile = function(address, type, instruction) {
type
:
"
GET
"
,
type
:
"
GET
"
,
dataType
:
type
,
dataType
:
type
,
success
:
instruction
,
success
:
instruction
,
error
:
function
(
type
)
{
t
=
type
;
alert
(
"
er
"
);}
error
:
function
(
type
)
{
alert
(
"
Error
"
+
type
.
status
+
"
: fail while trying to load
"
+
address
);}
});
});
}
}
...
@@ -129,10 +210,23 @@ saveFile = function(address, content, instruction) {
...
@@ -129,10 +210,23 @@ saveFile = function(address, content, instruction) {
fields
:
{
withCredentials
:
"
true
"
},
fields
:
{
withCredentials
:
"
true
"
},
success
:
instruction
,
success
:
instruction
,
error
:
function
(
type
)
{
error
:
function
(
type
)
{
if
(
type
.
status
==
201
)
{
instruction
();}
//ajax thinks that 201 is an error...
if
(
type
.
status
==
201
||
type
.
status
==
204
)
{
instruction
();}
//ajax thinks that 201 is an error...
}
}
});
});
};
}
deleteFile
=
function
(
address
,
instruction
)
{
$
.
ajax
({
url
:
address
,
type
:
"
DELETE
"
,
headers
:
{
Authorization
:
"
Basic
"
+
btoa
(
"
smik:asdf
"
)},
fields
:
{
withCredentials
:
"
true
"
},
success
:
instruction
,
error
:
function
(
type
)
{
alert
(
type
.
status
);
//ajax thinks that 201 is an error...
}
});
}
// load
// load
loadXHR
=
function
(
address
)
{
loadXHR
=
function
(
address
)
{
...
...
UNGProject/js/ung.js
View file @
15d6eafd
...
@@ -15,13 +15,11 @@ setCurrentDocumentID = function(ID) {return localStorage.setItem("currentDocumen
...
@@ -15,13 +15,11 @@ setCurrentDocumentID = function(ID) {return localStorage.setItem("currentDocumen
* @param arg : a documentList json object to load
* @param arg : a documentList json object to load
*/
*/
var
DocumentList
=
function
(
arg
)
{
var
DocumentList
=
function
(
arg
)
{
List
.
call
(
this
,
arg
);
//List.call(this
);
if
(
arg
)
{
if
(
arg
)
{
this
.
load
(
arg
);
this
.
load
(
arg
);
for
(
var
i
=
0
;
i
<
this
.
size
();
i
++
)
{
this
.
load
(
new
List
(
arg
,
JSONDocument
));
this
.
content
[
i
]
=
new
JSONDocument
(
this
.
get
(
i
));
//load methods of documents
this
.
selectionList
=
new
List
(
arg
.
selectionList
,
JSONDocument
);
//load methods of selectionList
}
this
.
selectionList
=
new
List
(
arg
.
selectionList
);
//load methods of selectionList
}
}
else
{
else
{
this
.
displayedPage
=
1
;
this
.
displayedPage
=
1
;
...
@@ -30,27 +28,44 @@ var DocumentList = function(arg) {
...
@@ -30,27 +28,44 @@ var DocumentList = function(arg) {
}
}
DocumentList
.
prototype
=
new
List
();
DocumentList
.
prototype
=
new
List
();
DocumentList
.
prototype
.
load
({
DocumentList
.
prototype
.
load
({
/* override : put an element at the specified position */
addDocument
:
function
(
doc
)
{
put
:
function
(
i
,
doc
)
{
this
.
add
(
doc
);
this
.
content
[
i
]
=
doc
;
setDocumentList
(
this
);
if
(
!
this
.
content
[
i
])
{
this
.
length
++
;}
this
.
display
();
},
removeDocument
:
function
(
doc
)
{
var
i
=
this
.
find
(
doc
);
this
.
get
(
i
).
remove
()
//delete the file
this
.
remove
(
i
);
//remove from the list
setDocumentList
(
this
);
setDocumentList
(
this
);
this
.
display
();
},
},
getSelectionList
:
function
()
{
return
this
.
selectionList
;
},
getSelectionList
:
function
()
{
return
this
.
selectionList
;
},
resetSelectionList
:
function
()
{
resetSelectionList
:
function
()
{
this
.
selectionList
=
new
List
();
this
.
selectionList
=
new
List
();
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
this
.
size
()
;
i
++
)
{
$
(
"
tr td.listbox-table-select-cell input#
"
+
i
).
attr
(
"
checked
"
,
false
);
$
(
"
tr td.listbox-table-select-cell input#
"
+
i
).
attr
(
"
checked
"
,
false
);
//uncheck
}
}
setDocumentList
(
this
);
setDocumentList
(
this
);
$
(
"
span#selected_row_number a
"
).
html
(
0
);
//display the selected row number
},
},
checkAll
:
function
()
{
checkAll
:
function
()
{
for
(
var
i
=
0
;
i
<
this
.
length
;
i
++
)
{
this
.
selectionList
=
new
List
();
this
.
getSelectionList
().
put
(
i
,
this
.
get
(
i
));
for
(
var
i
=
0
;
i
<
this
.
size
();
i
++
)
{
this
.
getSelectionList
().
add
(
this
.
get
(
i
));
$
(
"
tr td.listbox-table-select-cell input#
"
+
i
).
attr
(
"
checked
"
,
true
);
$
(
"
tr td.listbox-table-select-cell input#
"
+
i
).
attr
(
"
checked
"
,
true
);
}
}
setDocumentList
(
this
);
setDocumentList
(
this
);
$
(
"
span#selected_row_number a
"
).
html
(
this
.
size
());
//display the selected row number
},
deleteSelectedDocuments
:
function
()
{
var
selection
=
this
.
getSelectionList
();
while
(
!
selection
.
isEmpty
())
{
var
doc
=
selection
.
pop
();
this
.
removeDocument
(
doc
);
}
},
},
getDisplayedPage
:
function
()
{
return
this
.
displayedPage
;},
getDisplayedPage
:
function
()
{
return
this
.
displayedPage
;},
...
@@ -58,6 +73,7 @@ DocumentList.prototype.load({
...
@@ -58,6 +73,7 @@ DocumentList.prototype.load({
/* display the list of documents in the web page */
/* display the list of documents in the web page */
displayContent
:
function
()
{
displayContent
:
function
()
{
$
(
"
table.listbox tbody
"
).
html
(
""
);
//empty the previous displayed list
var
n
=
this
.
size
();
var
n
=
this
.
size
();
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
for
(
var
i
=
0
;
i
<
n
;
i
++
)
{
var
ligne
=
new
Line
(
this
.
get
(
i
),
i
);
var
ligne
=
new
Line
(
this
.
get
(
i
),
i
);
...
@@ -90,14 +106,17 @@ DocumentList.prototype.load({
...
@@ -90,14 +106,17 @@ DocumentList.prototype.load({
loadFile
(
getDocumentAddress
(
doc
),
"
json
"
,
function
(
data
)
{
loadFile
(
getDocumentAddress
(
doc
),
"
json
"
,
function
(
data
)
{
doc
.
load
(
data
);
//todo : replace by data.header
doc
.
load
(
data
);
//todo : replace by data.header
doc
.
setContent
(
""
);
//
doc
.
setContent
(
""
);
//
list
.
put
(
i
,
doc
);
list
.
set
(
i
,
doc
);
setDocumentList
(
list
);
});
});
}
}
});
});
getDocumentList
=
function
()
{
getDocumentList
=
function
()
{
return
new
DocumentList
(
JSON
.
parse
(
localStorage
.
getItem
(
"
documentList
"
)));
return
new
DocumentList
(
JSON
.
parse
(
localStorage
.
getItem
(
"
documentList
"
)));
}
}
setDocumentList
=
function
(
list
)
{
localStorage
.
setItem
(
"
documentList
"
,
JSON
.
stringify
(
list
));}
setDocumentList
=
function
(
list
)
{
localStorage
.
setItem
(
"
documentList
"
,
JSON
.
stringify
(
list
));
}
/**
/**
...
@@ -122,20 +141,20 @@ Line.prototype = {
...
@@ -122,20 +141,20 @@ Line.prototype = {
/* add the document of this line to the list of selected documents */
/* add the document of this line to the list of selected documents */
addToSelection
:
function
()
{
addToSelection
:
function
()
{
list
=
getDocumentList
();
var
list
=
getDocumentList
();
list
.
getSelectionList
().
put
(
this
.
getID
(),
this
);
list
.
getSelectionList
().
add
(
this
.
getDocument
()
);
setDocumentList
(
list
);
setDocumentList
(
list
);
},
},
/* remove the document of this line from the list of selected documents */
/* remove the document of this line from the list of selected documents */
removeFromSelection
:
function
()
{
removeFromSelection
:
function
()
{
var
list
=
getDocumentList
();
var
list
=
getDocumentList
();
list
.
getSelectionList
().
remove
(
this
.
getID
());
list
.
getSelectionList
().
remove
Element
(
this
.
getDocument
());
setDocumentList
(
list
);
setDocumentList
(
list
);
},
},
/* check or uncheck the line */
/* check or uncheck the line */
changeState
:
function
()
{
changeState
:
function
()
{
this
.
isSelected
()
?
this
.
addToSelection
()
:
this
.
removeFromSelection
();
this
.
isSelected
()
?
this
.
addToSelection
()
:
this
.
removeFromSelection
();
$
(
"
span#selected_row_number a
"
).
html
(
getDocumentList
().
getSelectionList
().
size
());
$
(
"
span#selected_row_number a
"
).
html
(
getDocumentList
().
getSelectionList
().
size
());
//display the selected row number
},
},
/* load the document information in the html of a default line */
/* load the document information in the html of a default line */
...
@@ -182,11 +201,7 @@ var createNewDocument = function(type) {
...
@@ -182,11 +201,7 @@ var createNewDocument = function(type) {
newDocument
.
setType
(
type
);
newDocument
.
setType
(
type
);
newDocument
.
save
(
function
()
{
newDocument
.
save
(
function
()
{
getDocumentList
().
add
(
newDocument
);
getDocumentList
().
add
Document
(
newDocument
);
startDocumentEdition
(
newDocument
);
startDocumentEdition
(
newDocument
);
});
});
}
}
var
deleteSelectedDocuments
=
function
()
{
}
\ No newline at end of file
UNGProject/ung.html
View file @
15d6eafd
...
@@ -36,10 +36,16 @@
...
@@ -36,10 +36,16 @@
}
}
var
init
=
function
()
{
var
init
=
function
()
{
//delete localStorage.documentList;//delete the list for tests
setCurrentPage
(
new
Page
());
//provide methods on the page
setCurrentPage
(
new
Page
());
//provide methods on the page
initUser
();
//initialize the user
initUser
();
//initialize the user
if
(
getCurrentDocumentID
())
{
getDocumentList
().
update
(
getCurrentDocumentID
());}
//update the list of documents
if
(
getCurrentDocumentID
()
&&
getDocumentList
().
get
(
getCurrentDocumentID
()))
{
/* update the list with the modifications of the last edited document
* (this method has to been rewritten if using multi users) */
getDocumentList
().
update
(
getCurrentDocumentID
());
delete
localStorage
.
currentDocumentID
;
}
waitBeforeSucceed
(
//display the list of documents
waitBeforeSucceed
(
//display the list of documents
function
(){
return
Line
.
loadHTML
()},
function
()
{
function
(){
return
Line
.
loadHTML
()},
function
()
{
getDocumentList
().
resetSelectionList
();
getDocumentList
().
resetSelectionList
();
...
@@ -53,7 +59,6 @@
...
@@ -53,7 +59,6 @@
</script>
</script>
</head>
</head>
<body>
<body>
<div>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"navigation"
>
<div
class=
"navigation"
>
...
@@ -456,10 +461,10 @@
...
@@ -456,10 +461,10 @@
<div
class=
"input"
><div
>
<div
class=
"input"
><div
>
<div
class=
"toolbar"
>
<div
class=
"toolbar"
>
<button
name=
"WebSection_deleteObjectList:method
"
<button
class=
"delete
"
type=
"submit"
onclick=
"getDocumentList().deleteSelectedDocuments()"
>
Delete
class=
"delete"
>
Delete
</button>
</button>
<button
name=
"#"
type=
"submit
"
class=
"change_state"
>
Change State
</button>
<button
name=
"#
"
class=
"change_state"
>
Change State
</button>
</div>
</div>
</div></div>
</div></div>
...
@@ -629,6 +634,5 @@
...
@@ -629,6 +634,5 @@
</div>
</div>
</div>
</div>
</div></div>
</div></div>
</div>
</body>
</body>
</html>
</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