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
89c6789c
Commit
89c6789c
authored
May 23, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
Jun 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change return value var name from jobs + grunt tests.
parent
fe1379fb
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
224 additions
and
174 deletions
+224
-174
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+10
-10
OfficeJS/lib/jio/jio.js
OfficeJS/lib/jio/jio.js
+48
-30
OfficeJS/lib/jio/jio.min.js
OfficeJS/lib/jio/jio.min.js
+2
-2
OfficeJS/lib/jio/jio.storage.js
OfficeJS/lib/jio/jio.storage.js
+25
-17
OfficeJS/lib/jio/jio.storage.min.js
OfficeJS/lib/jio/jio.storage.min.js
+2
-2
OfficeJS/lib/jio/localorcookiestorage.js
OfficeJS/lib/jio/localorcookiestorage.js
+1
-1
OfficeJS/lib/jio/localorcookiestorage.min.js
OfficeJS/lib/jio/localorcookiestorage.min.js
+1
-1
OfficeJS/src/jio.js
OfficeJS/src/jio.js
+47
-29
OfficeJS/src/jio.storage.js
OfficeJS/src/jio.storage.js
+24
-16
OfficeJS/test/jiotests.js
OfficeJS/test/jiotests.js
+64
-66
No files found.
OfficeJS/js/officejs.js
View file @
89c6789c
...
...
@@ -225,9 +225,9 @@ require(['OfficeJS'],function (OJS) {
priv
.
jio
.
loadDocument
({
'
fileName
'
:
filename
,
'
callback
'
:
function
(
result
){
if
(
result
.
document
.
fileName
)
{
if
(
result
.
return_value
.
fileName
)
{
getCurrentEditor
().
setHTML
(
result
.
document
.
fileContent
);
result
.
return_value
.
fileContent
);
}
else
{
console
.
error
(
'
Error:
'
+
result
.
message
);
}
...
...
@@ -264,17 +264,17 @@ require(['OfficeJS'],function (OJS) {
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
)
{
var
htmlString
=
''
,
i
,
document_array
=
[];
for
(
i
=
0
;
i
<
result
.
list
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
result
.
return_value
.
length
;
i
+=
1
)
{
htmlString
+=
'
<li><a href="#/texteditor:fileName=
'
+
result
.
list
[
i
].
fileName
+
'
">
\n
'
+
result
.
list
[
i
].
fileName
;
result
.
list
[
i
].
creationDate
=
(
new
Date
(
result
.
list
[
i
].
creationDate
)).
result
.
return_value
[
i
].
fileName
+
'
">
\n
'
+
result
.
return_value
[
i
].
fileName
;
result
.
return_value
[
i
].
creationDate
=
(
new
Date
(
result
.
return_value
[
i
].
creationDate
)).
toLocaleString
();
result
.
list
[
i
].
lastModified
=
(
new
Date
(
result
.
list
[
i
].
lastModified
)).
result
.
return_value
[
i
].
lastModified
=
(
new
Date
(
result
.
return_value
[
i
].
lastModified
)).
toLocaleString
();
document_array
.
push
(
result
.
list
[
i
]);
document_array
.
push
(
result
.
return_value
[
i
]);
htmlString
+=
'
</a></li>
\n
'
;
}
if
(
htmlString
===
''
)
{
...
...
OfficeJS/lib/jio/jio.js
View file @
89c6789c
/*! JIO - v0.1.0 - 2012-05-2
2
/*! JIO - v0.1.0 - 2012-05-2
3
* Copyright (c) 2012 Nexedi; Licensed */
...
...
@@ -713,52 +713,50 @@ var JIO =
//// Private Methods
priv
.
fail_checkNameAvailability
=
function
()
{
priv
.
res
.
isAvailable
=
false
;
priv
.
res
.
message
=
'
Unable to check name availability.
'
;
};
priv
.
done_checkNameAvailability
=
function
(
isavailable
)
{
priv
.
res
.
message
=
priv
.
job
.
userName
+
'
is
'
+
(
isavailable
?
''
:
'
not
'
)
+
'
available.
'
;
priv
.
res
.
isAvailabl
e
=
isavailable
;
priv
.
res
.
return_valu
e
=
isavailable
;
};
priv
.
fail_loadDocument
=
function
()
{
priv
.
res
.
document
=
{}
;
priv
.
res
.
message
=
'
Unable to load document.
'
;
};
priv
.
done_loadDocument
=
function
(
returneddocument
)
{
priv
.
res
.
message
=
'
Document loaded.
'
;
priv
.
res
.
document
=
returneddocument
;
priv
.
res
.
return_value
=
returneddocument
;
// transform date into ms
priv
.
res
.
document
.
lastModified
=
new
Date
(
priv
.
res
.
document
.
lastModified
).
getTime
();
priv
.
res
.
document
.
creationDate
=
new
Date
(
priv
.
res
.
document
.
creationDate
).
getTime
();
priv
.
res
.
return_value
.
lastModified
=
new
Date
(
priv
.
res
.
return_value
.
lastModified
).
getTime
();
priv
.
res
.
return_value
.
creationDate
=
new
Date
(
priv
.
res
.
return_value
.
creationDate
).
getTime
();
};
priv
.
fail_saveDocument
=
function
()
{
priv
.
res
.
isSaved
=
false
;
priv
.
res
.
message
=
'
Unable to save document.
'
;
};
priv
.
done_saveDocument
=
function
()
{
priv
.
res
.
message
=
'
Document saved.
'
;
priv
.
res
.
isSaved
=
true
;
};
priv
.
fail_getDocumentList
=
function
()
{
priv
.
res
.
list
=
[]
;
priv
.
res
.
message
=
'
Unable to retrieve document list.
'
;
};
priv
.
done_getDocumentList
=
function
(
documentlist
)
{
var
i
;
priv
.
res
.
message
=
'
Document list received.
'
;
priv
.
res
.
list
=
documentlist
;
for
(
i
=
0
;
i
<
priv
.
res
.
list
.
length
;
i
+=
1
)
{
priv
.
res
.
list
[
i
].
lastModified
=
new
Date
(
priv
.
res
.
list
[
i
].
lastModified
).
getTime
();
priv
.
res
.
list
[
i
].
creationDate
=
new
Date
(
priv
.
res
.
list
[
i
].
creationDate
).
getTime
();
priv
.
res
.
return_value
=
documentlist
;
for
(
i
=
0
;
i
<
priv
.
res
.
return_value
.
length
;
i
+=
1
)
{
priv
.
res
.
return_value
[
i
].
lastModified
=
new
Date
(
priv
.
res
.
return_value
[
i
].
lastModified
).
getTime
();
priv
.
res
.
return_value
[
i
].
creationDate
=
new
Date
(
priv
.
res
.
return_value
[
i
].
creationDate
).
getTime
();
}
};
priv
.
fail_removeDocument
=
function
()
{
priv
.
res
.
isRemoved
=
false
;
priv
.
res
.
message
=
'
Unable to removed document.
'
;
};
priv
.
done_removeDocument
=
function
()
{
priv
.
res
.
message
=
'
Document removed.
'
;
priv
.
res
.
isRemoved
=
true
;
};
priv
.
retryLater
=
function
()
{
...
...
@@ -1004,9 +1002,13 @@ var JIO =
// - true if the job was added or replaced
// example :
// jio.checkNameAvailability({'userName':'myName','callback':
// function (result) { alert('is available? ' +
// result.isAvailable); }});
// jio.checkNameAvailability({'userName':'myName','callback':
// function (result) {
// if (result.status === 'done') {
// if (result.return_value === true) { // available
// } else { } // not available
// } else { } // Error
// }});
var
settings
=
$
.
extend
({
'
userName
'
:
priv
.
storage
.
userName
,
...
...
@@ -1036,8 +1038,10 @@ var JIO =
// - true if the job was added or replaced
// jio.saveDocument({'fileName':'file','fileContent':'content',
// 'callback': function (result) { alert('saved?' +
// result.isSaved); }});
// 'callback': function (result) {
// if (result.status === 'done') { // Saved
// } else { } // Error
// }});
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
@@ -1067,9 +1071,14 @@ var JIO =
// - true if the job was added or replaced
// jio.loadDocument({'fileName':'file','callback':
// function (result) { alert('content: '+
// result.doc.fileContent + ' creation date: ' +
// result.doc.creationDate); }});
// function (result) {
// if (result.status === 'done') { // Loaded
// } else { } // Error
// }});
// result.return_value is a document object that looks like {
// fileName:'string',fileContent:'string',
// creationDate:123,lastModified:456 }
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
@@ -1097,7 +1106,13 @@ var JIO =
// - true if the job was added or replaced
// jio.getDocumentList({'callback':
// function (result) { alert('list: '+result.list); }});
// function (result) {
// if (result.status === 'done') { // OK
// console.log(result.return_value);
// } else { } // Error
// }});
// result.return_value is an Array that contains documents objects.
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
@@ -1124,7 +1139,10 @@ var JIO =
// - true if the job was added or replaced
// jio.removeDocument({'fileName':'file','callback':
// function (result) { alert('removed? '+result.isRemoved); }});
// function (result) {
// if(result.status === 'done') { // Removed
// } else { } // Not Removed
// }});
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
OfficeJS/lib/jio/jio.min.js
View file @
89c6789c
This diff is collapsed.
Click to expand it.
OfficeJS/lib/jio/jio.storage.js
View file @
89c6789c
/*! JIO Storage - v0.1.0 - 2012-05-2
2
/*! JIO Storage - v0.1.0 - 2012-05-2
3
* Copyright (c) 2012 Nexedi; Licensed */
...
...
@@ -521,18 +521,30 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// if the name already exists in a storage, it is not available.
// this.job.userName: the name we want to check.
// this.job.storage.storageArray: An Array of storages.
// TODO
var
newjob
=
{},
i
savailable
=
true
,
i
=
'
id
'
,
var
newjob
=
{},
i
=
'
id
'
,
done
=
false
,
res
=
{
'
status
'
:
'
done
'
},
callback
=
function
(
result
)
{
priv
.
returnsValuesArray
.
push
(
result
);
if
(
result
.
status
===
'
fail
'
)
{
res
.
status
=
'
fail
'
;
}
if
(
!
result
.
isAvailable
)
{
isavailable
=
false
;
}
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
// if this is the last callback
that
.
done
(
isavailable
);
if
(
!
done
)
{
if
(
result
.
status
===
'
fail
'
)
{
res
.
status
=
'
fail
'
;
}
else
{
if
(
result
.
return_value
===
false
)
{
that
.
done
(
false
);
done
=
true
;
return
;
}
}
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
if
(
res
.
status
===
'
fail
'
)
{
that
.
fail
(
'
Unable to check name availability.
'
,
0
);
}
else
{
that
.
done
(
true
);
}
done
=
true
;
return
;
}
}
};
priv
.
execJobsFromStorageArray
(
callback
);
...
...
@@ -546,7 +558,6 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.applicant.ID: the applicant ID.
// this.job.fileName: the document name.
// this.job.fileContent: the document content.
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
callback
=
function
(
result
)
{
...
...
@@ -580,7 +591,6 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// document object is {'fileName':string,'fileContent':string,
// 'creationDate':date,'lastModified':date}
// TODO
var
newjob
=
{},
aredifferent
=
false
,
doc
=
{},
i
=
'
id
'
,
done
=
false
,
...
...
@@ -588,7 +598,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
priv
.
returnsValuesArray
.
push
(
result
);
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
that
.
done
(
result
.
document
);
that
.
done
(
result
.
return_value
);
done
=
true
;
}
else
{
if
(
priv
.
returnsValuesArray
.
length
===
...
...
@@ -610,16 +620,15 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.storage.password: the user password.
// this.job.applicant.ID: the applicant id.
// the list is [object,object] -> object = {'fileName':string,
// the list is [object,object
,...
] -> object = {'fileName':string,
// 'lastModified':date,'creationDate':date}
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
callback
=
function
(
result
)
{
priv
.
returnsValuesArray
.
push
(
result
);
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
that
.
done
(
result
.
list
);
that
.
done
(
result
.
return_value
);
done
=
true
;
}
else
{
if
(
priv
.
returnsValuesArray
.
length
===
...
...
@@ -640,7 +649,6 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.storage.userName: the user name.
// this.job.storage.password: the user password.
// this.job.applicant.ID: the applicant id.
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
key
'
,
done
=
false
,
callback
=
function
(
result
)
{
...
...
OfficeJS/lib/jio/jio.storage.min.js
View file @
89c6789c
This diff is collapsed.
Click to expand it.
OfficeJS/lib/jio/localorcookiestorage.js
View file @
89c6789c
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-2
2
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-2
3
* Copyright (c) 2012 Nexedi; Licensed */
var
LocalOrCookieStorage
=
...
...
OfficeJS/lib/jio/localorcookiestorage.min.js
View file @
89c6789c
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-2
2
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-2
3
* Copyright (c) 2012 Nexedi; Licensed */
var
LocalOrCookieStorage
=
function
(){
var
a
=
function
(){
var
a
=
function
(){};
a
.
prototype
=
{
getItem
:
function
(
a
){
return
JSON
.
parse
(
localStorage
.
getItem
(
a
))},
setItem
:
function
(
a
,
b
){
if
(
a
)
return
localStorage
.
setItem
(
a
,
JSON
.
stringify
(
b
))},
getAll
:
function
(){
return
localStorage
},
deleteItem
:
function
(
a
){
a
&&
delete
localStorage
[
a
]}};
var
b
=
function
(){};
b
.
prototype
=
{
getItem
:
function
(
a
){
var
b
=
document
.
cookie
.
split
(
"
;
"
),
c
;
for
(
c
=
0
;
c
<
b
.
length
;
c
+=
1
){
var
d
=
b
[
c
].
substr
(
0
,
b
[
c
].
indexOf
(
"
=
"
)),
e
=
b
[
c
].
substr
(
b
[
c
].
indexOf
(
"
=
"
)
+
1
);
d
=
d
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
if
(
d
===
a
)
return
unescape
(
e
)}
return
null
},
setItem
:
function
(
a
,
b
){
return
b
!==
undefined
?(
document
.
cookie
=
a
+
"
=
"
+
JSON
.
stringify
(
b
)
+
"
;domain=
"
+
window
.
location
.
hostname
+
"
;path=
"
+
window
.
location
.
pathname
,
!
0
):
!
1
},
getAll
:
function
(){
var
a
=
{},
b
,
c
=
document
.
cookie
.
split
(
"
:
"
);
for
(
b
=
0
;
b
<
c
.
length
;
b
+=
1
){
var
d
=
c
[
b
].
substr
(
0
,
c
[
b
].
indexOf
(
"
=
"
)),
e
=
c
[
b
].
substr
(
c
[
b
].
indexOf
(
"
=
"
)
+
1
);
d
=
d
.
replace
(
/^
\s
+|
\s
+$/g
,
""
),
a
[
d
]
=
unescape
(
e
)}
return
a
},
deleteItem
:
function
(
a
){
document
.
cookie
=
a
+
"
=null;domain=
"
+
window
.
location
.
hostname
+
"
;path=
"
+
window
.
location
.
pathname
+
"
;expires=Thu, 01-Jan-1970 00:00:01 GMT
"
}};
try
{
return
localStorage
.
getItem
?
new
a
:
new
b
}
catch
(
c
){
return
new
b
}};
return
window
.
requirejs
?(
define
(
"
LocalOrCookieStorage
"
,[],
a
),
undefined
):
a
()}();
\ No newline at end of file
OfficeJS/src/jio.js
View file @
89c6789c
...
...
@@ -710,52 +710,50 @@ var JIO =
//// Private Methods
priv
.
fail_checkNameAvailability
=
function
()
{
priv
.
res
.
isAvailable
=
false
;
priv
.
res
.
message
=
'
Unable to check name availability.
'
;
};
priv
.
done_checkNameAvailability
=
function
(
isavailable
)
{
priv
.
res
.
message
=
priv
.
job
.
userName
+
'
is
'
+
(
isavailable
?
''
:
'
not
'
)
+
'
available.
'
;
priv
.
res
.
isAvailabl
e
=
isavailable
;
priv
.
res
.
return_valu
e
=
isavailable
;
};
priv
.
fail_loadDocument
=
function
()
{
priv
.
res
.
document
=
{}
;
priv
.
res
.
message
=
'
Unable to load document.
'
;
};
priv
.
done_loadDocument
=
function
(
returneddocument
)
{
priv
.
res
.
message
=
'
Document loaded.
'
;
priv
.
res
.
document
=
returneddocument
;
priv
.
res
.
return_value
=
returneddocument
;
// transform date into ms
priv
.
res
.
document
.
lastModified
=
new
Date
(
priv
.
res
.
document
.
lastModified
).
getTime
();
priv
.
res
.
document
.
creationDate
=
new
Date
(
priv
.
res
.
document
.
creationDate
).
getTime
();
priv
.
res
.
return_value
.
lastModified
=
new
Date
(
priv
.
res
.
return_value
.
lastModified
).
getTime
();
priv
.
res
.
return_value
.
creationDate
=
new
Date
(
priv
.
res
.
return_value
.
creationDate
).
getTime
();
};
priv
.
fail_saveDocument
=
function
()
{
priv
.
res
.
isSaved
=
false
;
priv
.
res
.
message
=
'
Unable to save document.
'
;
};
priv
.
done_saveDocument
=
function
()
{
priv
.
res
.
message
=
'
Document saved.
'
;
priv
.
res
.
isSaved
=
true
;
};
priv
.
fail_getDocumentList
=
function
()
{
priv
.
res
.
list
=
[]
;
priv
.
res
.
message
=
'
Unable to retrieve document list.
'
;
};
priv
.
done_getDocumentList
=
function
(
documentlist
)
{
var
i
;
priv
.
res
.
message
=
'
Document list received.
'
;
priv
.
res
.
list
=
documentlist
;
for
(
i
=
0
;
i
<
priv
.
res
.
list
.
length
;
i
+=
1
)
{
priv
.
res
.
list
[
i
].
lastModified
=
new
Date
(
priv
.
res
.
list
[
i
].
lastModified
).
getTime
();
priv
.
res
.
list
[
i
].
creationDate
=
new
Date
(
priv
.
res
.
list
[
i
].
creationDate
).
getTime
();
priv
.
res
.
return_value
=
documentlist
;
for
(
i
=
0
;
i
<
priv
.
res
.
return_value
.
length
;
i
+=
1
)
{
priv
.
res
.
return_value
[
i
].
lastModified
=
new
Date
(
priv
.
res
.
return_value
[
i
].
lastModified
).
getTime
();
priv
.
res
.
return_value
[
i
].
creationDate
=
new
Date
(
priv
.
res
.
return_value
[
i
].
creationDate
).
getTime
();
}
};
priv
.
fail_removeDocument
=
function
()
{
priv
.
res
.
isRemoved
=
false
;
priv
.
res
.
message
=
'
Unable to removed document.
'
;
};
priv
.
done_removeDocument
=
function
()
{
priv
.
res
.
message
=
'
Document removed.
'
;
priv
.
res
.
isRemoved
=
true
;
};
priv
.
retryLater
=
function
()
{
...
...
@@ -1001,9 +999,13 @@ var JIO =
// - true if the job was added or replaced
// example :
// jio.checkNameAvailability({'userName':'myName','callback':
// function (result) { alert('is available? ' +
// result.isAvailable); }});
// jio.checkNameAvailability({'userName':'myName','callback':
// function (result) {
// if (result.status === 'done') {
// if (result.return_value === true) { // available
// } else { } // not available
// } else { } // Error
// }});
var
settings
=
$
.
extend
({
'
userName
'
:
priv
.
storage
.
userName
,
...
...
@@ -1033,8 +1035,10 @@ var JIO =
// - true if the job was added or replaced
// jio.saveDocument({'fileName':'file','fileContent':'content',
// 'callback': function (result) { alert('saved?' +
// result.isSaved); }});
// 'callback': function (result) {
// if (result.status === 'done') { // Saved
// } else { } // Error
// }});
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
@@ -1064,9 +1068,14 @@ var JIO =
// - true if the job was added or replaced
// jio.loadDocument({'fileName':'file','callback':
// function (result) { alert('content: '+
// result.doc.fileContent + ' creation date: ' +
// result.doc.creationDate); }});
// function (result) {
// if (result.status === 'done') { // Loaded
// } else { } // Error
// }});
// result.return_value is a document object that looks like {
// fileName:'string',fileContent:'string',
// creationDate:123,lastModified:456 }
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
@@ -1094,7 +1103,13 @@ var JIO =
// - true if the job was added or replaced
// jio.getDocumentList({'callback':
// function (result) { alert('list: '+result.list); }});
// function (result) {
// if (result.status === 'done') { // OK
// console.log(result.return_value);
// } else { } // Error
// }});
// result.return_value is an Array that contains documents objects.
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
@@ -1121,7 +1136,10 @@ var JIO =
// - true if the job was added or replaced
// jio.removeDocument({'fileName':'file','callback':
// function (result) { alert('removed? '+result.isRemoved); }});
// function (result) {
// if(result.status === 'done') { // Removed
// } else { } // Not Removed
// }});
var
settings
=
$
.
extend
({
'
storage
'
:
priv
.
storage
,
...
...
OfficeJS/src/jio.storage.js
View file @
89c6789c
...
...
@@ -518,18 +518,30 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// if the name already exists in a storage, it is not available.
// this.job.userName: the name we want to check.
// this.job.storage.storageArray: An Array of storages.
// TODO
var
newjob
=
{},
i
savailable
=
true
,
i
=
'
id
'
,
var
newjob
=
{},
i
=
'
id
'
,
done
=
false
,
res
=
{
'
status
'
:
'
done
'
},
callback
=
function
(
result
)
{
priv
.
returnsValuesArray
.
push
(
result
);
if
(
result
.
status
===
'
fail
'
)
{
res
.
status
=
'
fail
'
;
}
if
(
!
result
.
isAvailable
)
{
isavailable
=
false
;
}
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
// if this is the last callback
that
.
done
(
isavailable
);
if
(
!
done
)
{
if
(
result
.
status
===
'
fail
'
)
{
res
.
status
=
'
fail
'
;
}
else
{
if
(
result
.
return_value
===
false
)
{
that
.
done
(
false
);
done
=
true
;
return
;
}
}
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
if
(
res
.
status
===
'
fail
'
)
{
that
.
fail
(
'
Unable to check name availability.
'
,
0
);
}
else
{
that
.
done
(
true
);
}
done
=
true
;
return
;
}
}
};
priv
.
execJobsFromStorageArray
(
callback
);
...
...
@@ -543,7 +555,6 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.applicant.ID: the applicant ID.
// this.job.fileName: the document name.
// this.job.fileContent: the document content.
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
callback
=
function
(
result
)
{
...
...
@@ -577,7 +588,6 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// document object is {'fileName':string,'fileContent':string,
// 'creationDate':date,'lastModified':date}
// TODO
var
newjob
=
{},
aredifferent
=
false
,
doc
=
{},
i
=
'
id
'
,
done
=
false
,
...
...
@@ -585,7 +595,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
priv
.
returnsValuesArray
.
push
(
result
);
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
that
.
done
(
result
.
document
);
that
.
done
(
result
.
return_value
);
done
=
true
;
}
else
{
if
(
priv
.
returnsValuesArray
.
length
===
...
...
@@ -607,16 +617,15 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.storage.password: the user password.
// this.job.applicant.ID: the applicant id.
// the list is [object,object] -> object = {'fileName':string,
// the list is [object,object
,...
] -> object = {'fileName':string,
// 'lastModified':date,'creationDate':date}
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
callback
=
function
(
result
)
{
priv
.
returnsValuesArray
.
push
(
result
);
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
that
.
done
(
result
.
list
);
that
.
done
(
result
.
return_value
);
done
=
true
;
}
else
{
if
(
priv
.
returnsValuesArray
.
length
===
...
...
@@ -637,7 +646,6 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// this.job.storage.userName: the user name.
// this.job.storage.password: the user password.
// this.job.applicant.ID: the applicant id.
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
key
'
,
done
=
false
,
callback
=
function
(
result
)
{
...
...
OfficeJS/test/jiotests.js
View file @
89c6789c
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