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
e5fcf54d
Commit
e5fcf54d
authored
Jun 06, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
Jun 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename 'callback' to 'onResponse'
parent
b38a48a0
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
99 additions
and
99 deletions
+99
-99
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+5
-5
OfficeJS/src/jio.js
OfficeJS/src/jio.js
+27
-27
OfficeJS/src/jio.storage.js
OfficeJS/src/jio.storage.js
+31
-31
OfficeJS/test/jiotests.js
OfficeJS/test/jiotests.js
+36
-36
No files found.
OfficeJS/js/officejs.js
View file @
e5fcf54d
...
@@ -411,7 +411,7 @@
...
@@ -411,7 +411,7 @@
'
limit
'
:{
begin
:
0
,
end
:
50
},
'
limit
'
:{
begin
:
0
,
end
:
50
},
// 'search':{name:'a'},
// 'search':{name:'a'},
'
maxtries
'
:
3
,
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
)
{
'
onResponse
'
:
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
priv
.
data_object
.
documentList
=
result
.
return_value
;
priv
.
data_object
.
documentList
=
result
.
return_value
;
priv
.
showDocumentListInsideLeftNavBar
();
priv
.
showDocumentListInsideLeftNavBar
();
...
@@ -446,7 +446,7 @@
...
@@ -446,7 +446,7 @@
priv
.
jio
.
saveDocument
({
priv
.
jio
.
saveDocument
({
'
name
'
:
basename
+
'
.
'
+
current_editor
.
ext
,
'
name
'
:
basename
+
'
.
'
+
current_editor
.
ext
,
'
content
'
:
current_editor
.
getContent
(),
'
content
'
:
current_editor
.
getContent
(),
'
callback
'
:
function
(
result
)
{
'
onResponse
'
:
function
(
result
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
result
.
status
===
'
fail
'
)
{
console
.
error
(
result
.
message
);
console
.
error
(
result
.
message
);
}
}
...
@@ -471,7 +471,7 @@
...
@@ -471,7 +471,7 @@
priv
.
jio
.
loadDocument
({
priv
.
jio
.
loadDocument
({
'
name
'
:
basename
+
'
.
'
+
current_editor
.
ext
,
'
name
'
:
basename
+
'
.
'
+
current_editor
.
ext
,
'
maxtries
'
:
3
,
'
maxtries
'
:
3
,
'
callback
'
:
function
(
result
)
{
'
onResponse
'
:
function
(
result
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
result
.
status
===
'
fail
'
)
{
console
.
error
(
result
.
message
);
console
.
error
(
result
.
message
);
}
else
{
}
else
{
...
@@ -496,7 +496,7 @@
...
@@ -496,7 +496,7 @@
priv
.
loading_object
.
remove
();
priv
.
loading_object
.
remove
();
priv
.
jio
.
removeDocument
({
priv
.
jio
.
removeDocument
({
'
name
'
:
name
,
'
name
'
:
name
,
'
callback
'
:
function
(
result
)
{
'
onResponse
'
:
function
(
result
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
result
.
status
===
'
fail
'
)
{
console
.
error
(
result
.
message
);
console
.
error
(
result
.
message
);
}
}
...
@@ -521,7 +521,7 @@
...
@@ -521,7 +521,7 @@
priv
.
loading_object
.
remove
();
priv
.
loading_object
.
remove
();
priv
.
jio
.
removeDocument
({
priv
.
jio
.
removeDocument
({
name
:
documentarray
[
i
],
name
:
documentarray
[
i
],
callback
:
function
(
result
)
{
onResponse
:
function
(
result
)
{
cpt
+=
1
;
cpt
+=
1
;
if
(
cpt
===
l
)
{
if
(
cpt
===
l
)
{
if
(
typeof
current_editor
.
update
!==
'
undefined
'
)
{
if
(
typeof
current_editor
.
update
!==
'
undefined
'
)
{
...
...
OfficeJS/src/jio.js
View file @
e5fcf54d
...
@@ -259,7 +259,7 @@ var JIO =
...
@@ -259,7 +259,7 @@ var JIO =
priv
.
job_object
=
{};
priv
.
job_object
=
{};
that
.
copyJobQueueToLocalStorage
();
that
.
copyJobQueueToLocalStorage
();
for
(
k
in
priv
.
recovered_job_object
)
{
for
(
k
in
priv
.
recovered_job_object
)
{
priv
.
recovered_job_object
[
k
].
callback
=
emptyFun
;
priv
.
recovered_job_object
[
k
].
onResponse
=
emptyFun
;
that
.
addJob
(
priv
.
recovered_job_object
[
k
]);
that
.
addJob
(
priv
.
recovered_job_object
[
k
]);
}
}
};
};
...
@@ -547,7 +547,7 @@ var JIO =
...
@@ -547,7 +547,7 @@ var JIO =
};
};
that
.
ended
=
function
(
endedjob
)
{
that
.
ended
=
function
(
endedjob
)
{
// It is a callback function called just before user
callback
.
// It is a callback function called just before user
onResponse
.
// It is called to manage job_object according to the ended job.
// It is called to manage job_object according to the ended job.
var
job
=
$
.
extend
(
true
,{},
endedjob
);
// copy
var
job
=
$
.
extend
(
true
,{},
endedjob
);
// copy
...
@@ -698,7 +698,7 @@ var JIO =
...
@@ -698,7 +698,7 @@ var JIO =
//// Private attributes
//// Private attributes
priv
.
job
=
options
.
job
;
priv
.
job
=
options
.
job
;
priv
.
callback
=
options
.
job
.
callback
;
priv
.
onResponse
=
options
.
job
.
onResponse
;
priv
.
queue
=
options
.
queue
;
priv
.
queue
=
options
.
queue
;
priv
.
res
=
{
'
status
'
:
'
done
'
,
'
message
'
:
''
};
priv
.
res
=
{
'
status
'
:
'
done
'
,
'
message
'
:
''
};
priv
.
sorted
=
false
;
priv
.
sorted
=
false
;
...
@@ -854,7 +854,7 @@ var JIO =
...
@@ -854,7 +854,7 @@ var JIO =
priv
.
job
.
tries
=
0
;
priv
.
job
.
tries
=
0
;
priv
.
job
.
date
=
newjob
.
date
;
priv
.
job
.
date
=
newjob
.
date
;
priv
.
job
.
callback
=
newjob
.
callback
;
priv
.
job
.
onResponse
=
newjob
.
onResponse
;
priv
.
res
.
status
=
'
fail
'
;
priv
.
res
.
status
=
'
fail
'
;
priv
.
res
.
message
=
'
Job Stopped!
'
;
priv
.
res
.
message
=
'
Job Stopped!
'
;
...
@@ -863,7 +863,7 @@ var JIO =
...
@@ -863,7 +863,7 @@ var JIO =
priv
.
res
.
error
.
statusText
=
'
Replaced
'
;
priv
.
res
.
error
.
statusText
=
'
Replaced
'
;
priv
.
res
.
error
.
message
=
'
The job was replaced by a newer one.
'
;
priv
.
res
.
error
.
message
=
'
The job was replaced by a newer one.
'
;
priv
[
'
fail_
'
+
priv
.
job
.
method
]();
priv
[
'
fail_
'
+
priv
.
job
.
method
]();
priv
.
callback
(
priv
.
res
);
priv
.
onResponse
(
priv
.
res
);
};
};
that
.
fail
=
function
(
errorobject
)
{
that
.
fail
=
function
(
errorobject
)
{
// Called when a job has failed.
// Called when a job has failed.
...
@@ -886,18 +886,18 @@ var JIO =
...
@@ -886,18 +886,18 @@ var JIO =
priv
.
job
.
status
=
'
fail
'
;
priv
.
job
.
status
=
'
fail
'
;
priv
[
'
fail_
'
+
priv
.
job
.
method
]();
priv
[
'
fail_
'
+
priv
.
job
.
method
]();
priv
.
queue
.
ended
(
priv
.
job
);
priv
.
queue
.
ended
(
priv
.
job
);
priv
.
callback
(
priv
.
res
);
priv
.
onResponse
(
priv
.
res
);
}
}
};
};
that
.
done
=
function
(
retvalue
)
{
that
.
done
=
function
(
retvalue
)
{
// Called when a job has terminated successfully.
// Called when a job has terminated successfully.
// It will return the return value by the calling
the callback
// It will return the return value by the calling
of onResponse
// function.
// function.
priv
.
job
.
status
=
'
done
'
;
priv
.
job
.
status
=
'
done
'
;
priv
[
'
done_
'
+
priv
.
job
.
method
](
retvalue
);
priv
[
'
done_
'
+
priv
.
job
.
method
](
retvalue
);
priv
.
queue
.
ended
(
priv
.
job
);
priv
.
queue
.
ended
(
priv
.
job
);
priv
.
callback
(
priv
.
res
);
priv
.
onResponse
(
priv
.
res
);
};
};
that
.
execute
=
function
()
{
that
.
execute
=
function
()
{
// Execute the good function from the good storage.
// Execute the good function from the good storage.
...
@@ -1037,10 +1037,10 @@ var JIO =
...
@@ -1037,10 +1037,10 @@ var JIO =
var
m
=
'
Method:
'
+
settings
.
method
+
var
m
=
'
Method:
'
+
settings
.
method
+
'
, One or some parameters are undefined.
'
;
'
, One or some parameters are undefined.
'
;
console
.
error
(
m
);
console
.
error
(
m
);
settings
.
callback
({
status
:
'
fail
'
,
settings
.
onResponse
({
status
:
'
fail
'
,
error
:
{
status
:
0
,
error
:
{
status
:
0
,
statusText
:
'
Undefined Parameter
'
,
statusText
:
'
Undefined Parameter
'
,
message
:
m
}});
message
:
m
}});
return
null
;
return
null
;
};
};
...
@@ -1128,14 +1128,14 @@ var JIO =
...
@@ -1128,14 +1128,14 @@ var JIO =
// return value.
// return value.
// options.storage : the storage where to check (optional)
// options.storage : the storage where to check (optional)
// options.applicant : the applicant (optional)
// options.applicant : the applicant (optional)
// options.
callback
(result) : called to get the result.
// options.
onResponse
(result) : called to get the result.
// returns: - null if dependencies are missing
// returns: - null if dependencies are missing
// - false if the job was not added
// - false if the job was not added
// - true if the job was added or replaced
// - true if the job was added or replaced
// example :
// example :
// jio.checkNameAvailability({'user_name':'myName','
callback
':
// jio.checkNameAvailability({'user_name':'myName','
onResponse
':
// function (result) {
// function (result) {
// if (result.status === 'done') {
// if (result.status === 'done') {
// if (result.return_value === true) { // available
// if (result.return_value === true) { // available
...
@@ -1148,7 +1148,7 @@ var JIO =
...
@@ -1148,7 +1148,7 @@ var JIO =
'
storage
'
:
priv
.
storage
,
'
storage
'
:
priv
.
storage
,
'
applicant
'
:
priv
.
applicant
,
'
applicant
'
:
priv
.
applicant
,
'
method
'
:
'
checkNameAvailability
'
,
'
method
'
:
'
checkNameAvailability
'
,
'
callback
'
:
function
()
{}
'
onResponse
'
:
function
()
{}
},
options
);
},
options
);
// check dependencies
// check dependencies
if
(
that
.
isReady
()
&&
settings
.
user_name
&&
if
(
that
.
isReady
()
&&
settings
.
user_name
&&
...
@@ -1164,14 +1164,14 @@ var JIO =
...
@@ -1164,14 +1164,14 @@ var JIO =
// 'job_done' will be sent with this job.
// 'job_done' will be sent with this job.
// options.storage : the storage where to save (optional)
// options.storage : the storage where to save (optional)
// options.applicant : the applicant (optional)
// options.applicant : the applicant (optional)
// options.
callback
(result) : called to get the result.
// options.
onResponse
(result) : called to get the result.
// returns: - null if dependencies are missing
// returns: - null if dependencies are missing
// - false if the job was not added
// - false if the job was not added
// - true if the job was added or replaced
// - true if the job was added or replaced
// jio.saveDocument({'name':'file','content':'content',
// jio.saveDocument({'name':'file','content':'content',
// '
callback
': function (result) {
// '
onResponse
': function (result) {
// if (result.status === 'done') { // Saved
// if (result.status === 'done') { // Saved
// } else { } // Error
// } else { } // Error
// }});
// }});
...
@@ -1181,7 +1181,7 @@ var JIO =
...
@@ -1181,7 +1181,7 @@ var JIO =
'
applicant
'
:
priv
.
applicant
,
'
applicant
'
:
priv
.
applicant
,
'
content
'
:
''
,
'
content
'
:
''
,
'
method
'
:
'
saveDocument
'
,
'
method
'
:
'
saveDocument
'
,
'
callback
'
:
function
()
{}
'
onResponse
'
:
function
()
{}
},
options
);
},
options
);
// check dependencies
// check dependencies
if
(
that
.
isReady
()
&&
settings
.
name
&&
if
(
that
.
isReady
()
&&
settings
.
name
&&
...
@@ -1198,13 +1198,13 @@ var JIO =
...
@@ -1198,13 +1198,13 @@ var JIO =
// return value.
// return value.
// options.storage : the storage where to load (optional)
// options.storage : the storage where to load (optional)
// options.applicant : the applicant (optional)
// options.applicant : the applicant (optional)
// options.
callback
(result) : called to get the result.
// options.
onResponse
(result) : called to get the result.
// returns: - null if dependencies are missing
// returns: - null if dependencies are missing
// - false if the job was not added
// - false if the job was not added
// - true if the job was added or replaced
// - true if the job was added or replaced
// jio.loadDocument({'name':'file','
callback
':
// jio.loadDocument({'name':'file','
onResponse
':
// function (result) {
// function (result) {
// if (result.status === 'done') { // Loaded
// if (result.status === 'done') { // Loaded
// } else { } // Error
// } else { } // Error
...
@@ -1218,7 +1218,7 @@ var JIO =
...
@@ -1218,7 +1218,7 @@ var JIO =
'
storage
'
:
priv
.
storage
,
'
storage
'
:
priv
.
storage
,
'
applicant
'
:
priv
.
applicant
,
'
applicant
'
:
priv
.
applicant
,
'
method
'
:
'
loadDocument
'
,
'
method
'
:
'
loadDocument
'
,
'
callback
'
:
function
(){}
'
onResponse
'
:
function
(){}
},
options
);
},
options
);
// check dependencies
// check dependencies
if
(
that
.
isReady
()
&&
settings
.
name
&&
if
(
that
.
isReady
()
&&
settings
.
name
&&
...
@@ -1233,13 +1233,13 @@ var JIO =
...
@@ -1233,13 +1233,13 @@ var JIO =
// or in the storage set at init.
// or in the storage set at init.
// options.storage : the storage where to get the list (optional)
// options.storage : the storage where to get the list (optional)
// options.applicant : the applicant (optional)
// options.applicant : the applicant (optional)
// options.
callback
(result) : called to get the result.
// options.
onResponse
(result) : called to get the result.
// returns: - null if dependencies are missing
// returns: - null if dependencies are missing
// - false if the job was not added
// - false if the job was not added
// - true if the job was added or replaced
// - true if the job was added or replaced
// jio.getDocumentList({'
callback
':
// jio.getDocumentList({'
onResponse
':
// function (result) {
// function (result) {
// if (result.status === 'done') { // OK
// if (result.status === 'done') { // OK
// console.log(result.return_value);
// console.log(result.return_value);
...
@@ -1252,7 +1252,7 @@ var JIO =
...
@@ -1252,7 +1252,7 @@ var JIO =
'
storage
'
:
priv
.
storage
,
'
storage
'
:
priv
.
storage
,
'
applicant
'
:
priv
.
applicant
,
'
applicant
'
:
priv
.
applicant
,
'
method
'
:
'
getDocumentList
'
,
'
method
'
:
'
getDocumentList
'
,
'
callback
'
:
function
(){}
'
onResponse
'
:
function
(){}
},
options
);
},
options
);
// check dependencies
// check dependencies
if
(
that
.
isReady
()
&&
settings
.
storage
&&
settings
.
applicant
)
{
if
(
that
.
isReady
()
&&
settings
.
storage
&&
settings
.
applicant
)
{
...
@@ -1266,13 +1266,13 @@ var JIO =
...
@@ -1266,13 +1266,13 @@ var JIO =
// or in the storage set at init.
// or in the storage set at init.
// options.storage : the storage where to remove (optional)
// options.storage : the storage where to remove (optional)
// options.applicant : the applicant (optional)
// options.applicant : the applicant (optional)
// options.
callback
(result) : called to get the result.
// options.
onResponse
(result) : called to get the result.
// returns: - null if dependencies are missing
// returns: - null if dependencies are missing
// - false if the job was not added
// - false if the job was not added
// - true if the job was added or replaced
// - true if the job was added or replaced
// jio.removeDocument({'name':'file','
callback
':
// jio.removeDocument({'name':'file','
onResponse
':
// function (result) {
// function (result) {
// if(result.status === 'done') { // Removed
// if(result.status === 'done') { // Removed
// } else { } // Not Removed
// } else { } // Not Removed
...
@@ -1282,7 +1282,7 @@ var JIO =
...
@@ -1282,7 +1282,7 @@ var JIO =
'
storage
'
:
priv
.
storage
,
'
storage
'
:
priv
.
storage
,
'
applicant
'
:
priv
.
applicant
,
'
applicant
'
:
priv
.
applicant
,
'
method
'
:
'
removeDocument
'
,
'
method
'
:
'
removeDocument
'
,
'
callback
'
:
function
(){}
'
onResponse
'
:
function
(){}
},
options
);
},
options
);
if
(
that
.
isReady
()
&&
settings
.
name
&&
if
(
that
.
isReady
()
&&
settings
.
name
&&
settings
.
storage
&&
settings
.
applicant
)
{
settings
.
storage
&&
settings
.
applicant
)
{
...
...
OfficeJS/src/jio.storage.js
View file @
e5fcf54d
...
@@ -589,13 +589,13 @@
...
@@ -589,13 +589,13 @@
that
.
setMaxTries
(
1
);
that
.
setMaxTries
(
1
);
priv
.
execJobsFromStorageArray
=
function
(
callback
)
{
priv
.
execJobsFromStorageArray
=
function
(
onResponse
)
{
var
newjob
=
{},
i
;
var
newjob
=
{},
i
;
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
newjob
=
that
.
cloneJob
();
newjob
=
that
.
cloneJob
();
newjob
.
max_tries
=
priv
.
max_tries
;
newjob
.
max_tries
=
priv
.
max_tries
;
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
callback
=
callback
;
newjob
.
onResponse
=
onResponse
;
that
.
addJob
(
newjob
)
;
that
.
addJob
(
newjob
)
;
}
}
};
};
...
@@ -607,7 +607,7 @@
...
@@ -607,7 +607,7 @@
// this.job.storage.storageArray: An Array of storages.
// this.job.storage.storageArray: An Array of storages.
var
i
=
'
id
'
,
done
=
false
,
error_array
=
[],
var
i
=
'
id
'
,
done
=
false
,
error_array
=
[],
res
=
{
'
status
'
:
'
done
'
},
callback
=
function
(
result
)
{
res
=
{
'
status
'
:
'
done
'
},
onResponse
=
function
(
result
)
{
priv
.
return_value_array
.
push
(
result
);
priv
.
return_value_array
.
push
(
result
);
if
(
!
done
)
{
if
(
!
done
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
result
.
status
===
'
fail
'
)
{
...
@@ -637,7 +637,7 @@
...
@@ -637,7 +637,7 @@
}
}
}
}
};
};
priv
.
execJobsFromStorageArray
(
callback
);
priv
.
execJobsFromStorageArray
(
onResponse
);
};
};
that
.
saveDocument
=
function
()
{
that
.
saveDocument
=
function
()
{
// Save a single document in several storages.
// Save a single document in several storages.
...
@@ -651,7 +651,7 @@
...
@@ -651,7 +651,7 @@
var
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
var
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
error_array
=
[],
done
=
false
,
error_array
=
[],
callback
=
function
(
result
)
{
onResponse
=
function
(
result
)
{
priv
.
return_value_array
.
push
(
result
);
priv
.
return_value_array
.
push
(
result
);
if
(
!
done
)
{
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
if
(
result
.
status
!==
'
fail
'
)
{
...
@@ -671,7 +671,7 @@
...
@@ -671,7 +671,7 @@
}
}
}
}
};
};
priv
.
execJobsFromStorageArray
(
callback
);
priv
.
execJobsFromStorageArray
(
onResponse
);
};
};
that
.
loadDocument
=
function
()
{
that
.
loadDocument
=
function
()
{
...
@@ -687,7 +687,7 @@
...
@@ -687,7 +687,7 @@
var
doc
=
{},
i
=
'
id
'
,
var
doc
=
{},
i
=
'
id
'
,
done
=
false
,
error_array
=
[],
done
=
false
,
error_array
=
[],
res
=
{
'
status
'
:
'
done
'
},
callback
=
function
(
result
)
{
res
=
{
'
status
'
:
'
done
'
},
onResponse
=
function
(
result
)
{
priv
.
return_value_array
.
push
(
result
);
priv
.
return_value_array
.
push
(
result
);
if
(
!
done
)
{
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
if
(
result
.
status
!==
'
fail
'
)
{
...
@@ -707,7 +707,7 @@
...
@@ -707,7 +707,7 @@
}
}
}
}
};
};
priv
.
execJobsFromStorageArray
(
callback
);
priv
.
execJobsFromStorageArray
(
onResponse
);
};
};
that
.
getDocumentList
=
function
()
{
that
.
getDocumentList
=
function
()
{
...
@@ -720,7 +720,7 @@
...
@@ -720,7 +720,7 @@
var
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
var
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
error_array
=
[],
done
=
false
,
error_array
=
[],
callback
=
function
(
result
)
{
onResponse
=
function
(
result
)
{
priv
.
return_value_array
.
push
(
result
);
priv
.
return_value_array
.
push
(
result
);
if
(
!
done
)
{
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
if
(
result
.
status
!==
'
fail
'
)
{
...
@@ -740,7 +740,7 @@
...
@@ -740,7 +740,7 @@
}
}
}
}
};
};
priv
.
execJobsFromStorageArray
(
callback
);
priv
.
execJobsFromStorageArray
(
onResponse
);
};
};
that
.
removeDocument
=
function
()
{
that
.
removeDocument
=
function
()
{
...
@@ -753,7 +753,7 @@
...
@@ -753,7 +753,7 @@
var
res
=
{
'
status
'
:
'
done
'
},
i
=
'
key
'
,
var
res
=
{
'
status
'
:
'
done
'
},
i
=
'
key
'
,
done
=
false
,
error_array
=
[],
done
=
false
,
error_array
=
[],
callback
=
function
(
result
)
{
onResponse
=
function
(
result
)
{
priv
.
return_value_array
.
push
(
result
);
priv
.
return_value_array
.
push
(
result
);
if
(
!
done
)
{
if
(
!
done
)
{
if
(
result
.
status
!==
'
fail
'
)
{
if
(
result
.
status
!==
'
fail
'
)
{
...
@@ -773,7 +773,7 @@
...
@@ -773,7 +773,7 @@
}
}
}
}
};
};
priv
.
execJobsFromStorageArray
(
callback
);
priv
.
execJobsFromStorageArray
(
onResponse
);
};
};
return
that
;
return
that
;
};
};
...
@@ -929,9 +929,9 @@
...
@@ -929,9 +929,9 @@
* returned the result.
* returned the result.
* @method update
* @method update
*/
*/
priv
.
update
=
function
(
callback
)
{
priv
.
update
=
function
(
onResponse
)
{
// retreive list before, and then retreive all files
// retreive list before, and then retreive all files
var
getlist_
callback
=
function
(
result
)
{
var
getlist_
onResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
!
priv
.
isAnIndexedStorage
(
that
.
getSecondStorage
()))
{
if
(
!
priv
.
isAnIndexedStorage
(
that
.
getSecondStorage
()))
{
priv
.
addIndexedStorage
(
that
.
getSecondStorage
());
priv
.
addIndexedStorage
(
that
.
getSecondStorage
());
...
@@ -944,7 +944,7 @@
...
@@ -944,7 +944,7 @@
applicant
:
{
ID
:
that
.
getApplicantID
()},
applicant
:
{
ID
:
that
.
getApplicantID
()},
method
:
'
getDocumentList
'
,
method
:
'
getDocumentList
'
,
max_tries
:
3
,
max_tries
:
3
,
callback
:
getlist_callback
onResponse
:
getlist_onResponse
};
};
that
.
addJob
(
newjob
);
that
.
addJob
(
newjob
);
};
};
...
@@ -957,7 +957,7 @@
...
@@ -957,7 +957,7 @@
var
new_job
=
that
.
cloneJob
();
var
new_job
=
that
.
cloneJob
();
priv
.
update
();
priv
.
update
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
function
(
result
)
{
new_job
.
onResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
that
.
done
(
result
.
return_value
);
that
.
done
(
result
.
return_value
);
}
else
{
}
else
{
...
@@ -974,7 +974,7 @@
...
@@ -974,7 +974,7 @@
that
.
saveDocument
=
function
()
{
that
.
saveDocument
=
function
()
{
var
new_job
=
that
.
cloneJob
();
var
new_job
=
that
.
cloneJob
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
function
(
result
)
{
new_job
.
onResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
!
priv
.
isFileIndexed
(
that
.
getFileName
()))
{
if
(
!
priv
.
isFileIndexed
(
that
.
getFileName
()))
{
priv
.
addFile
({
name
:
that
.
getFileName
(),
priv
.
addFile
({
name
:
that
.
getFileName
(),
...
@@ -998,7 +998,7 @@
...
@@ -998,7 +998,7 @@
*/
*/
that
.
loadDocument
=
function
()
{
that
.
loadDocument
=
function
()
{
var
file_array
,
i
,
l
,
new_job
,
var
file_array
,
i
,
l
,
new_job
,
load
Callback
=
function
(
result
)
{
load
OnResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
// if (file_array[i].last_modified !==
// if (file_array[i].last_modified !==
// result.return_value.last_modified ||
// result.return_value.last_modified ||
...
@@ -1016,7 +1016,7 @@
...
@@ -1016,7 +1016,7 @@
secondLoadDocument
=
function
()
{
secondLoadDocument
=
function
()
{
new_job
=
that
.
cloneJob
();
new_job
=
that
.
cloneJob
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
loadCallback
;
new_job
.
onResponse
=
loadOnResponse
;
that
.
addJob
(
new_job
);
that
.
addJob
(
new_job
);
},
},
settings
=
that
.
cloneOptionObject
();
settings
=
that
.
cloneOptionObject
();
...
@@ -1061,7 +1061,7 @@
...
@@ -1061,7 +1061,7 @@
that
.
removeDocument
=
function
()
{
that
.
removeDocument
=
function
()
{
var
new_job
=
that
.
cloneJob
();
var
new_job
=
that
.
cloneJob
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
function
(
result
)
{
new_job
.
onResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
priv
.
removeFile
(
that
.
getFileName
());
priv
.
removeFile
(
that
.
getFileName
());
priv
.
update
();
priv
.
update
();
...
@@ -1139,7 +1139,7 @@
...
@@ -1139,7 +1139,7 @@
that
.
checkNameAvailability
=
function
()
{
that
.
checkNameAvailability
=
function
()
{
var
new_job
=
that
.
cloneJob
();
var
new_job
=
that
.
cloneJob
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
function
(
result
)
{
new_job
.
onResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
that
.
done
(
result
.
return_value
);
that
.
done
(
result
.
return_value
);
}
else
{
}
else
{
...
@@ -1172,7 +1172,7 @@
...
@@ -1172,7 +1172,7 @@
new_job
.
name
=
new_file_name
;
new_job
.
name
=
new_file_name
;
new_job
.
content
=
newfilecontent
;
new_job
.
content
=
newfilecontent
;
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
function
(
result
)
{
new_job
.
onResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
that
.
done
();
that
.
done
();
}
else
{
}
else
{
...
@@ -1202,10 +1202,10 @@
...
@@ -1202,10 +1202,10 @@
new_job
=
that
.
cloneJob
();
new_job
=
that
.
cloneJob
();
new_job
.
name
=
new_file_name
;
new_job
.
name
=
new_file_name
;
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
loadCallback
;
new_job
.
onResponse
=
loadOnResponse
;
that
.
addJob
(
new_job
);
that
.
addJob
(
new_job
);
},
},
load
Callback
=
function
(
result
)
{
load
OnResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
result
.
return_value
.
name
=
that
.
getFileName
();
result
.
return_value
.
name
=
that
.
getFileName
();
if
(
option
.
metadata_only
)
{
if
(
option
.
metadata_only
)
{
...
@@ -1243,24 +1243,24 @@
...
@@ -1243,24 +1243,24 @@
_1
=
function
()
{
_1
=
function
()
{
new_job
=
that
.
cloneJob
();
new_job
=
that
.
cloneJob
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
getListCallback
;
new_job
.
onResponse
=
getListOnResponse
;
that
.
addJob
(
new_job
);
that
.
addJob
(
new_job
);
},
},
getList
Callback
=
function
(
result
)
{
getList
OnResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
array
=
result
.
return_value
;
array
=
result
.
return_value
;
for
(
i
=
0
,
l
=
array
.
length
;
i
<
l
;
i
+=
1
)
{
for
(
i
=
0
,
l
=
array
.
length
;
i
<
l
;
i
+=
1
)
{
// cpt--;
// cpt--;
priv
.
decrypt
(
array
[
i
].
name
,
priv
.
decrypt
(
array
[
i
].
name
,
last
Callback
,
i
,
'
name
'
);
last
OnResponse
,
i
,
'
name
'
);
// priv.decrypt (array[i].content,
// priv.decrypt (array[i].content,
// last
Callback
,i,'content');
// last
OnResponse
,i,'content');
}
}
}
else
{
}
else
{
that
.
fail
(
result
.
error
);
that
.
fail
(
result
.
error
);
}
}
},
},
last
Callback
=
function
(
res
,
index
,
key
)
{
last
OnResponse
=
function
(
res
,
index
,
key
)
{
var
tmp
;
var
tmp
;
cpt
++
;
cpt
++
;
if
(
typeof
res
===
'
object
'
)
{
if
(
typeof
res
===
'
object
'
)
{
...
@@ -1296,10 +1296,10 @@
...
@@ -1296,10 +1296,10 @@
new_job
=
that
.
cloneJob
();
new_job
=
that
.
cloneJob
();
new_job
.
name
=
new_file_name
;
new_job
.
name
=
new_file_name
;
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
storage
=
that
.
getSecondStorage
();
new_job
.
callback
=
removeCallback
;
new_job
.
onResponse
=
removeOnResponse
;
that
.
addJob
(
new_job
);
that
.
addJob
(
new_job
);
},
},
remove
Callback
=
function
(
result
)
{
remove
OnResponse
=
function
(
result
)
{
if
(
result
.
status
===
'
done
'
)
{
if
(
result
.
status
===
'
done
'
)
{
that
.
done
();
that
.
done
();
}
else
{
}
else
{
...
...
OfficeJS/test/jiotests.js
View file @
e5fcf54d
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