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
4525e4b7
Commit
4525e4b7
authored
Oct 03, 2011
by
Sebastien Robin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixes done by Francois (sorry, I do not have details)
parent
2e3330ea
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
90 additions
and
81 deletions
+90
-81
UNGProject/js/login.js
UNGProject/js/login.js
+84
-77
UNGProject/js/theme.js
UNGProject/js/theme.js
+3
-3
UNGProject/js/tools.js
UNGProject/js/tools.js
+3
-1
No files found.
UNGProject/js/login.js
View file @
4525e4b7
...
@@ -14,22 +14,60 @@ var displayNewAccountForm = function(bool) {
...
@@ -14,22 +14,60 @@ var displayNewAccountForm = function(bool) {
}
}
}
}
function
logIntoDav
(
wallet
)
{
var
recall
=
window
.
location
;
window
.
location
.
href
=
wallet
.
storageLocation
+
"
#
"
+
recall
;
}
/**
* create a new storage
*/
function
initStorage
(
wallet
)
{
function
initStorage
(
wallet
)
{
if
(
!
wallet
.
provider
)
{
//local storage
if
(
wallet
.
provider
)
{
//DAV storage
/**
// load JIO file from a DAV and create the JIO object
* load JIO file from a DAV and create and return the JIO object
initializeFromDav
(
wallet
.
userName
,
wallet
.
storageLocation
,
{
"
ID
"
:
"
www.ungproject.com
"
,
"
password
"
:
wallet
.
applicationPassword
});
* This function will be replaced. The aim is to load JIO in more various ways, and use JIO.initialize after
}
else
{
* @param userName : name of the user
Storage
.
create
(
'
{"type":"local","userName":"
'
+
wallet
.
userName
+
'
"}
'
);
* @param location : server location
}
* @param applicant : (optional) information about the person/application needing this JIO object (allow limited access)
}
* @return JIO object
/**
* try to log an user just after having logged in their Dav account
* if the user is logged, it means that getApplicationPasswordFromURL has a result
*/
function
tryLog
()
{
var
wallet
=
getWallet
();
var
applicationPassword
=
getApplicationPasswordFromURL
();
if
(
applicationPassword
)
{
wallet
.
applicationPassword
=
applicationPassword
;
setWallet
(
wallet
);
//to delete for new registration each time
initStorage
(
wallet
);
//go to ung when the storage is ready
waitBeforeSucceed
(
function
()
{
return
getCurrentStorage
().
getUser
();},
function
(){
window
.
location
.
href
=
"
ung.html
"
;});
}
}
/**
* Log an user after they fill their Name and storage provider
*/
*/
(
function
initializeFromDav
(
userName
,
location
,
applicant
)
{
function
logUser
()
{
var
wallet
=
new
Wallet
();
setWallet
(
wallet
);
if
(
!
wallet
.
userName
)
{
return
;}
if
(
wallet
.
provider
)
{
if
(
!
wallet
.
storageLocation
)
{
alert
(
"
unable to find your storage from your provider
"
);
return
;}
if
(
!
wallet
.
applicationPassword
)
{
logIntoDav
(
wallet
);
return
;}
}
initStorage
(
wallet
);
//go to ung when the storage is ready
waitBeforeSucceed
(
function
()
{
return
getCurrentStorage
().
getUser
();},
function
(){
window
.
location
.
href
=
"
ung.html
"
;});
}
/***************************************************************************
********************** Unhosted functions *****************************
* these function are only required to respect the unhosted architecture */
// load JIO file from a DAV and create the JIO object
function
initializeFromDav
(
userName
,
location
,
applicant
)
{
//get the user personal JIO file
//get the user personal JIO file
$
.
ajax
({
$
.
ajax
({
url
:
location
+
"
/dav/
"
+
userName
+
"
/
"
+
applicant
.
ID
+
"
/
"
+
"
jio.json
"
,
//we could use userAdress instead...
url
:
location
+
"
/dav/
"
+
userName
+
"
/
"
+
applicant
.
ID
+
"
/
"
+
"
jio.json
"
,
//we could use userAdress instead...
...
@@ -44,16 +82,9 @@ function initStorage(wallet) {
...
@@ -44,16 +82,9 @@ function initStorage(wallet) {
error
:
function
(
type
)
{
alert
(
"
Error
"
+
type
.
status
+
"
: fail while trying to load jio.json
"
);}
error
:
function
(
type
)
{
alert
(
"
Error
"
+
type
.
status
+
"
: fail while trying to load jio.json
"
);}
});
});
return
JIO
;
return
JIO
;
})(
wallet
.
userName
,
wallet
.
storageLocation
,
{
"
ID
"
:
"
www.ungproject.com
"
,
"
password
"
:
wallet
.
applicationPassword
});
}
else
{
Storage
.
create
(
'
{"type":"local","userName":"
'
+
wallet
.
userName
+
'
"}
'
);
}
}
}
//unhosted functions
function
getStorageLocation
(
provider
)
{
function
getStorageLocation
(
provider
)
{
//TODO : use
s
webFinger
//TODO : use webFinger
return
"
http://
"
+
provider
;
return
"
http://
"
+
provider
;
}
}
function
getApplicationPasswordFromURL
()
{
function
getApplicationPasswordFromURL
()
{
...
@@ -70,36 +101,10 @@ var Wallet = function() {
...
@@ -70,36 +101,10 @@ var Wallet = function() {
this
.
provider
=
$
(
"
input#storage_location
"
).
attr
(
"
value
"
);
this
.
provider
=
$
(
"
input#storage_location
"
).
attr
(
"
value
"
);
this
.
storageLocation
=
getStorageLocation
(
this
.
provider
);
this
.
storageLocation
=
getStorageLocation
(
this
.
provider
);
}
}
//redirects the application to the storage of the user to log the application in and get the password for the application
function
logIntoDav
(
wallet
)
{
/**
var
recall
=
window
.
location
;
* try to log an user after having logged in their Dav account
window
.
location
.
href
=
wallet
.
storageLocation
+
"
#
"
+
recall
;
*/
function
tryLog
()
{
var
wallet
=
getWallet
();
var
applicationPassword
=
getApplicationPasswordFromURL
();
if
(
applicationPassword
)
{
wallet
.
applicationPassword
=
applicationPassword
;
setWallet
(
wallet
);
//to delete for new registration each time
initStorage
(
wallet
);
waitBeforeSucceed
(
function
()
{
return
getCurrentStorage
().
getUser
();},
function
(){
window
.
location
.
href
=
"
ung.html
"
;});
}
}
/**
* Log an user with it's Name and storage provider
*/
function
logUser
()
{
var
wallet
=
new
Wallet
();
setWallet
(
wallet
);
if
(
!
wallet
.
userName
)
{
return
;}
if
(
wallet
.
provider
)
{
if
(
!
wallet
.
storageLocation
)
{
alert
(
"
unable to find your storage from your provider
"
);
return
;}
if
(
!
wallet
.
applicationPassword
)
{
logIntoDav
(
wallet
);
return
;}
}
initStorage
(
wallet
);
waitBeforeSucceed
(
function
()
{
return
getCurrentStorage
().
getUser
();},
function
(){
window
.
location
.
href
=
"
ung.html
"
;});
}
}
...
@@ -109,7 +114,9 @@ function logUser() {
...
@@ -109,7 +114,9 @@ function logUser() {
/**********************************************************************
* functions from UNG Docs 1.0 and not currently used
*/
/**
/**
...
...
UNGProject/js/theme.js
View file @
4525e4b7
...
@@ -287,7 +287,7 @@ Storage.load({
...
@@ -287,7 +287,7 @@ Storage.load({
success
:
function
(
list
)
{
success
:
function
(
list
)
{
delete
list
[
getCurrentUser
().
getName
()
+
"
.profile
"
];
//remove the profile file
delete
list
[
getCurrentUser
().
getName
()
+
"
.profile
"
];
//remove the profile file
getCurrentStorage
().
documentList
=
list
;
getCurrentStorage
().
documentList
=
list
;
fireEvent
(
Storage
.
LIST_READY
);
Storage
.
fireEvent
(
Storage
.
LIST_READY
);
}
}
}
}
JIO
.
getDocumentList
(
option
);
JIO
.
getDocumentList
(
option
);
...
@@ -303,7 +303,7 @@ Storage.load({
...
@@ -303,7 +303,7 @@ Storage.load({
setUser
:
function
(
user
)
{
setUser
:
function
(
user
)
{
this
.
user
=
user
;
this
.
user
=
user
;
this
.
userName
=
user
.
getName
();
this
.
userName
=
user
.
getName
();
fireEvent
(
Storage
.
USER_READY
);
Storage
.
fireEvent
(
Storage
.
USER_READY
);
this
.
updateDocumentList
();
this
.
updateDocumentList
();
getCurrentStorage
().
save
();
getCurrentStorage
().
save
();
...
...
UNGProject/js/tools.js
View file @
4525e4b7
...
@@ -6,7 +6,9 @@
...
@@ -6,7 +6,9 @@
* Class UngObject
* Class UngObject
* provides useful general methods
* provides useful general methods
*/
*/
UngObject
=
function
()
{}
UngObject
=
function
()
{
this
.
listenerList
=
[];
}
/* return true if this object implements the interface */
/* return true if this object implements the interface */
UngObject
.
prototype
.
implement
=
function
(
myInterface
)
UngObject
.
prototype
.
implement
=
function
(
myInterface
)
{
{
...
...
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