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
5644e5b4
Commit
5644e5b4
authored
Jun 15, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add jio.getJobArray method to JIO.
parent
c9ec180f
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
41 deletions
+65
-41
OfficeJS/lib/jio/jio.js
OfficeJS/lib/jio/jio.js
+32
-20
OfficeJS/lib/jio/jio.min.js
OfficeJS/lib/jio/jio.min.js
+1
-1
OfficeJS/src/jio/jio.outro.js
OfficeJS/src/jio/jio.outro.js
+4
-0
OfficeJS/src/jio/jobs/jobManager.js
OfficeJS/src/jio/jobs/jobManager.js
+28
-20
No files found.
OfficeJS/lib/jio/jio.js
View file @
5644e5b4
...
@@ -1049,7 +1049,7 @@ var jobManager = (function(spec, my) {
...
@@ -1049,7 +1049,7 @@ var jobManager = (function(spec, my) {
priv
.
id
=
spec
.
id
;
priv
.
id
=
spec
.
id
;
priv
.
interval_id
=
null
;
priv
.
interval_id
=
null
;
priv
.
interval
=
200
;
priv
.
interval
=
200
;
priv
.
job_a
=
[];
priv
.
job_a
rray
=
[];
my
.
jobManager
=
that
;
my
.
jobManager
=
that
;
my
.
jobIdHandler
=
jobIdHandler
;
my
.
jobIdHandler
=
jobIdHandler
;
...
@@ -1079,8 +1079,8 @@ var jobManager = (function(spec, my) {
...
@@ -1079,8 +1079,8 @@ var jobManager = (function(spec, my) {
*/
*/
priv
.
copyJobArrayToLocal
=
function
()
{
priv
.
copyJobArrayToLocal
=
function
()
{
var
new_a
=
[],
i
;
var
new_a
=
[],
i
;
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
new_a
.
push
(
priv
.
job_a
[
i
].
serialized
());
new_a
.
push
(
priv
.
job_a
rray
[
i
].
serialized
());
}
}
LocalOrCookieStorage
.
setItem
(
priv
.
getJobArrayName
(),
new_a
);
LocalOrCookieStorage
.
setItem
(
priv
.
getJobArrayName
(),
new_a
);
};
};
...
@@ -1091,13 +1091,13 @@ var jobManager = (function(spec, my) {
...
@@ -1091,13 +1091,13 @@ var jobManager = (function(spec, my) {
* @param {object} job The job object.
* @param {object} job The job object.
*/
*/
priv
.
removeJob
=
function
(
job
)
{
priv
.
removeJob
=
function
(
job
)
{
var
i
,
tmp_job_a
=
[];
var
i
,
tmp_job_a
rray
=
[];
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
if
(
priv
.
job_a
[
i
]
!==
job
)
{
if
(
priv
.
job_a
rray
[
i
]
!==
job
)
{
tmp_job_a
.
push
(
priv
.
job_a
[
i
]);
tmp_job_a
rray
.
push
(
priv
.
job_array
[
i
]);
}
}
}
}
priv
.
job_a
=
tmp_job_a
;
priv
.
job_a
rray
=
tmp_job_array
;
priv
.
copyJobArrayToLocal
();
priv
.
copyJobArrayToLocal
();
};
};
...
@@ -1119,8 +1119,8 @@ var jobManager = (function(spec, my) {
...
@@ -1119,8 +1119,8 @@ var jobManager = (function(spec, my) {
if
(
priv
.
interval_id
===
null
)
{
if
(
priv
.
interval_id
===
null
)
{
priv
.
interval_id
=
setInterval
(
function
()
{
priv
.
interval_id
=
setInterval
(
function
()
{
priv
.
restoreOldJio
();
priv
.
restoreOldJio
();
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
that
.
execute
(
priv
.
job_a
[
i
]);
that
.
execute
(
priv
.
job_a
rray
[
i
]);
}
}
},
priv
.
interval
);
},
priv
.
interval
);
}
}
...
@@ -1134,7 +1134,7 @@ var jobManager = (function(spec, my) {
...
@@ -1134,7 +1134,7 @@ var jobManager = (function(spec, my) {
if
(
priv
.
interval_id
!==
null
)
{
if
(
priv
.
interval_id
!==
null
)
{
clearInterval
(
priv
.
interval_id
);
clearInterval
(
priv
.
interval_id
);
priv
.
interval_id
=
null
;
priv
.
interval_id
=
null
;
if
(
priv
.
job_a
.
length
===
0
)
{
if
(
priv
.
job_a
rray
.
length
===
0
)
{
LocalOrCookieStorage
.
deleteItem
(
priv
.
getJobArrayName
());
LocalOrCookieStorage
.
deleteItem
(
priv
.
getJobArrayName
());
}
}
}
}
...
@@ -1242,8 +1242,8 @@ var jobManager = (function(spec, my) {
...
@@ -1242,8 +1242,8 @@ var jobManager = (function(spec, my) {
*/
*/
that
.
jobIdExists
=
function
(
id
)
{
that
.
jobIdExists
=
function
(
id
)
{
var
i
;
var
i
;
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
if
(
priv
.
job_a
[
i
].
getId
()
===
id
)
{
if
(
priv
.
job_a
rray
[
i
].
getId
()
===
id
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -1265,21 +1265,21 @@ var jobManager = (function(spec, my) {
...
@@ -1265,21 +1265,21 @@ var jobManager = (function(spec, my) {
* @param {object} job The new job.
* @param {object} job The new job.
*/
*/
that
.
addJob
=
function
(
job
)
{
that
.
addJob
=
function
(
job
)
{
var
result_a
=
that
.
validateJobAccordingToJobList
(
priv
.
job_a
,
job
);
var
result_a
=
that
.
validateJobAccordingToJobList
(
priv
.
job_a
rray
,
job
);
priv
.
appendJob
(
job
,
result_a
);
priv
.
appendJob
(
job
,
result_a
);
};
};
/**
/**
* Generate a result array containing action string to do with the good job.
* Generate a result array containing action string to do with the good job.
* @method validateJobAccordingToJobList
* @method validateJobAccordingToJobList
* @param {array} job_a A job array.
* @param {array} job_a
rray
A job array.
* @param {object} job The new job to compare with.
* @param {object} job The new job to compare with.
* @return {array} A result array.
* @return {array} A result array.
*/
*/
that
.
validateJobAccordingToJobList
=
function
(
job_a
,
job
)
{
that
.
validateJobAccordingToJobList
=
function
(
job_a
rray
,
job
)
{
var
i
,
result_a
=
[];
var
i
,
result_a
=
[];
for
(
i
=
0
;
i
<
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
job_a
rray
.
length
;
i
+=
1
)
{
result_a
.
push
(
jobRules
.
validateJobAccordingToJob
(
job_a
[
i
],
job
));
result_a
.
push
(
jobRules
.
validateJobAccordingToJob
(
job_a
rray
[
i
],
job
));
}
}
return
result_a
;
return
result_a
;
};
};
...
@@ -1295,7 +1295,7 @@ var jobManager = (function(spec, my) {
...
@@ -1295,7 +1295,7 @@ var jobManager = (function(spec, my) {
*/
*/
priv
.
appendJob
=
function
(
job
,
result_a
)
{
priv
.
appendJob
=
function
(
job
,
result_a
)
{
var
i
;
var
i
;
if
(
priv
.
job_a
.
length
!==
result_a
.
length
)
{
if
(
priv
.
job_a
rray
.
length
!==
result_a
.
length
)
{
throw
new
RangeError
(
"
Array out of bound
"
);
throw
new
RangeError
(
"
Array out of bound
"
);
}
}
for
(
i
=
0
;
i
<
result_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
result_a
.
length
;
i
+=
1
)
{
...
@@ -1318,10 +1318,18 @@ var jobManager = (function(spec, my) {
...
@@ -1318,10 +1318,18 @@ var jobManager = (function(spec, my) {
default
:
break
;
default
:
break
;
}
}
}
}
priv
.
job_a
.
push
(
job
);
priv
.
job_a
rray
.
push
(
job
);
priv
.
copyJobArrayToLocal
();
priv
.
copyJobArrayToLocal
();
};
};
that
.
serialized
=
function
()
{
var
a
=
[],
i
,
job_array
=
priv
.
job_array
||
[];
for
(
i
=
0
;
i
<
job_array
.
length
;
i
+=
1
)
{
a
.
push
(
job_array
[
i
].
serialized
());
}
return
a
;
};
return
that
;
return
that
;
}());
}());
...
@@ -1590,6 +1598,10 @@ var jobRules = (function(spec, my) {
...
@@ -1590,6 +1598,10 @@ var jobRules = (function(spec, my) {
return
jioNamespace
.
storage
(
description
,
my
).
isValid
();
return
jioNamespace
.
storage
(
description
,
my
).
isValid
();
};
};
that
.
getJobArray
=
function
()
{
return
jobManager
.
serialized
();
};
/**
/**
* Save a document.
* Save a document.
* @method saveDocument
* @method saveDocument
...
...
OfficeJS/lib/jio/jio.min.js
View file @
5644e5b4
This diff is collapsed.
Click to expand it.
OfficeJS/src/jio/jio.outro.js
View file @
5644e5b4
...
@@ -74,6 +74,10 @@
...
@@ -74,6 +74,10 @@
return
jioNamespace
.
storage
(
description
,
my
).
isValid
();
return
jioNamespace
.
storage
(
description
,
my
).
isValid
();
};
};
that
.
getJobArray
=
function
()
{
return
jobManager
.
serialized
();
};
/**
/**
* Save a document.
* Save a document.
* @method saveDocument
* @method saveDocument
...
...
OfficeJS/src/jio/jobs/jobManager.js
View file @
5644e5b4
...
@@ -8,7 +8,7 @@ var jobManager = (function(spec, my) {
...
@@ -8,7 +8,7 @@ var jobManager = (function(spec, my) {
priv
.
id
=
spec
.
id
;
priv
.
id
=
spec
.
id
;
priv
.
interval_id
=
null
;
priv
.
interval_id
=
null
;
priv
.
interval
=
200
;
priv
.
interval
=
200
;
priv
.
job_a
=
[];
priv
.
job_a
rray
=
[];
my
.
jobManager
=
that
;
my
.
jobManager
=
that
;
my
.
jobIdHandler
=
jobIdHandler
;
my
.
jobIdHandler
=
jobIdHandler
;
...
@@ -38,8 +38,8 @@ var jobManager = (function(spec, my) {
...
@@ -38,8 +38,8 @@ var jobManager = (function(spec, my) {
*/
*/
priv
.
copyJobArrayToLocal
=
function
()
{
priv
.
copyJobArrayToLocal
=
function
()
{
var
new_a
=
[],
i
;
var
new_a
=
[],
i
;
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
new_a
.
push
(
priv
.
job_a
[
i
].
serialized
());
new_a
.
push
(
priv
.
job_a
rray
[
i
].
serialized
());
}
}
LocalOrCookieStorage
.
setItem
(
priv
.
getJobArrayName
(),
new_a
);
LocalOrCookieStorage
.
setItem
(
priv
.
getJobArrayName
(),
new_a
);
};
};
...
@@ -50,13 +50,13 @@ var jobManager = (function(spec, my) {
...
@@ -50,13 +50,13 @@ var jobManager = (function(spec, my) {
* @param {object} job The job object.
* @param {object} job The job object.
*/
*/
priv
.
removeJob
=
function
(
job
)
{
priv
.
removeJob
=
function
(
job
)
{
var
i
,
tmp_job_a
=
[];
var
i
,
tmp_job_a
rray
=
[];
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
if
(
priv
.
job_a
[
i
]
!==
job
)
{
if
(
priv
.
job_a
rray
[
i
]
!==
job
)
{
tmp_job_a
.
push
(
priv
.
job_a
[
i
]);
tmp_job_a
rray
.
push
(
priv
.
job_array
[
i
]);
}
}
}
}
priv
.
job_a
=
tmp_job_a
;
priv
.
job_a
rray
=
tmp_job_array
;
priv
.
copyJobArrayToLocal
();
priv
.
copyJobArrayToLocal
();
};
};
...
@@ -78,8 +78,8 @@ var jobManager = (function(spec, my) {
...
@@ -78,8 +78,8 @@ var jobManager = (function(spec, my) {
if
(
priv
.
interval_id
===
null
)
{
if
(
priv
.
interval_id
===
null
)
{
priv
.
interval_id
=
setInterval
(
function
()
{
priv
.
interval_id
=
setInterval
(
function
()
{
priv
.
restoreOldJio
();
priv
.
restoreOldJio
();
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
that
.
execute
(
priv
.
job_a
[
i
]);
that
.
execute
(
priv
.
job_a
rray
[
i
]);
}
}
},
priv
.
interval
);
},
priv
.
interval
);
}
}
...
@@ -93,7 +93,7 @@ var jobManager = (function(spec, my) {
...
@@ -93,7 +93,7 @@ var jobManager = (function(spec, my) {
if
(
priv
.
interval_id
!==
null
)
{
if
(
priv
.
interval_id
!==
null
)
{
clearInterval
(
priv
.
interval_id
);
clearInterval
(
priv
.
interval_id
);
priv
.
interval_id
=
null
;
priv
.
interval_id
=
null
;
if
(
priv
.
job_a
.
length
===
0
)
{
if
(
priv
.
job_a
rray
.
length
===
0
)
{
LocalOrCookieStorage
.
deleteItem
(
priv
.
getJobArrayName
());
LocalOrCookieStorage
.
deleteItem
(
priv
.
getJobArrayName
());
}
}
}
}
...
@@ -201,8 +201,8 @@ var jobManager = (function(spec, my) {
...
@@ -201,8 +201,8 @@ var jobManager = (function(spec, my) {
*/
*/
that
.
jobIdExists
=
function
(
id
)
{
that
.
jobIdExists
=
function
(
id
)
{
var
i
;
var
i
;
for
(
i
=
0
;
i
<
priv
.
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
priv
.
job_a
rray
.
length
;
i
+=
1
)
{
if
(
priv
.
job_a
[
i
].
getId
()
===
id
)
{
if
(
priv
.
job_a
rray
[
i
].
getId
()
===
id
)
{
return
true
;
return
true
;
}
}
}
}
...
@@ -224,21 +224,21 @@ var jobManager = (function(spec, my) {
...
@@ -224,21 +224,21 @@ var jobManager = (function(spec, my) {
* @param {object} job The new job.
* @param {object} job The new job.
*/
*/
that
.
addJob
=
function
(
job
)
{
that
.
addJob
=
function
(
job
)
{
var
result_a
=
that
.
validateJobAccordingToJobList
(
priv
.
job_a
,
job
);
var
result_a
=
that
.
validateJobAccordingToJobList
(
priv
.
job_a
rray
,
job
);
priv
.
appendJob
(
job
,
result_a
);
priv
.
appendJob
(
job
,
result_a
);
};
};
/**
/**
* Generate a result array containing action string to do with the good job.
* Generate a result array containing action string to do with the good job.
* @method validateJobAccordingToJobList
* @method validateJobAccordingToJobList
* @param {array} job_a A job array.
* @param {array} job_a
rray
A job array.
* @param {object} job The new job to compare with.
* @param {object} job The new job to compare with.
* @return {array} A result array.
* @return {array} A result array.
*/
*/
that
.
validateJobAccordingToJobList
=
function
(
job_a
,
job
)
{
that
.
validateJobAccordingToJobList
=
function
(
job_a
rray
,
job
)
{
var
i
,
result_a
=
[];
var
i
,
result_a
=
[];
for
(
i
=
0
;
i
<
job_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
job_a
rray
.
length
;
i
+=
1
)
{
result_a
.
push
(
jobRules
.
validateJobAccordingToJob
(
job_a
[
i
],
job
));
result_a
.
push
(
jobRules
.
validateJobAccordingToJob
(
job_a
rray
[
i
],
job
));
}
}
return
result_a
;
return
result_a
;
};
};
...
@@ -254,7 +254,7 @@ var jobManager = (function(spec, my) {
...
@@ -254,7 +254,7 @@ var jobManager = (function(spec, my) {
*/
*/
priv
.
appendJob
=
function
(
job
,
result_a
)
{
priv
.
appendJob
=
function
(
job
,
result_a
)
{
var
i
;
var
i
;
if
(
priv
.
job_a
.
length
!==
result_a
.
length
)
{
if
(
priv
.
job_a
rray
.
length
!==
result_a
.
length
)
{
throw
new
RangeError
(
"
Array out of bound
"
);
throw
new
RangeError
(
"
Array out of bound
"
);
}
}
for
(
i
=
0
;
i
<
result_a
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
result_a
.
length
;
i
+=
1
)
{
...
@@ -277,9 +277,17 @@ var jobManager = (function(spec, my) {
...
@@ -277,9 +277,17 @@ var jobManager = (function(spec, my) {
default
:
break
;
default
:
break
;
}
}
}
}
priv
.
job_a
.
push
(
job
);
priv
.
job_a
rray
.
push
(
job
);
priv
.
copyJobArrayToLocal
();
priv
.
copyJobArrayToLocal
();
};
};
that
.
serialized
=
function
()
{
var
a
=
[],
i
,
job_array
=
priv
.
job_array
||
[];
for
(
i
=
0
;
i
<
job_array
.
length
;
i
+=
1
)
{
a
.
push
(
job_array
[
i
].
serialized
());
}
return
a
;
};
return
that
;
return
that
;
}());
}());
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