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
5e2582e0
Commit
5e2582e0
authored
Jun 15, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding application "workinprogress" to OfficeJS that shows the on going tasks.
parent
5644e5b4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
180 additions
and
54 deletions
+180
-54
OfficeJS/component/left_nav_bar.html
OfficeJS/component/left_nav_bar.html
+9
-0
OfficeJS/component/login.html
OfficeJS/component/login.html
+6
-13
OfficeJS/component/workinprogress.html
OfficeJS/component/workinprogress.html
+43
-0
OfficeJS/index.html
OfficeJS/index.html
+3
-2
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+119
-39
No files found.
OfficeJS/component/left_nav_bar.html
View file @
5e2582e0
...
@@ -44,6 +44,15 @@
...
@@ -44,6 +44,15 @@
New
Spreadsheet
New
Spreadsheet
<
/a
>
<
/a
>
<
/li
>
<
/li
>
<
li
class
=
"
spreadsheet left-nav-tools
"
>
<
a
href
=
"
#/workinprogress
"
onclick
=
"
javascript:
OfficeJS.open({app:'workinprogress'});
return false;
"
>
<
i
class
=
"
icon-tasks
"
><
/i
>
Show
Activity
<
/a
>
<
/li
>
<!--
<
li
class
=
"
editpreferences left-nav-tools
"
>
-->
<!--
<
li
class
=
"
editpreferences left-nav-tools
"
>
-->
<!--
<
a
href
=
"
#/edit_preferences
"
-->
<!--
<
a
href
=
"
#/edit_preferences
"
-->
<!--
onclick
=
"
javascript: -->
<!--
onclick
=
"
javascript: -->
...
...
OfficeJS/component/login.html
View file @
5e2582e0
...
@@ -6,20 +6,13 @@
...
@@ -6,20 +6,13 @@
<div
class=
"controls docs-input-sizes"
>
<div
class=
"controls docs-input-sizes"
>
<input
class=
"input-xlarge"
<input
class=
"input-xlarge"
type=
"text"
name=
"JSONstorage"
id=
"input_json_storage"
type=
"text"
name=
"JSONstorage"
id=
"input_json_storage"
value=
"{"type":"
local","userName":"tristan"
}"
value=
"{"type":"
replicate","storagelist":[{"type":"dummyall3tries","a":"b"},{"type":"dummyall3tries","c":"d"}]
}"
placeholder=
"storage"
/>
placeholder=
"storage"
/>
<!-- value="{"type":"dav","userName":"tristan","password":"mdp","location":"http://localhost:80"}" -->
<!-- value="{"type":"replicate","storagelist":[{"type":"replicate","storagelist":[{"type":"dummyallfail","username":"1"},{"type":"dummyall3tries","username":"2"}]},{"type":"replicate","storagelist":[{"type":"dummyallfail","username":"3"},{"type":"dummyall3tries","username":"4"}]}]}" -->
<!-- value="{"type":"replicate","storageArray":[{"type":"local","userName":"tristan"},{"type":"dav","userName":"tristan","password":"mdp","location":"http://localhost:80"}]}" -->
<!-- value="{"type":"replicate","storagelist":[{"type":"dummyallfail"},{"type":"replicate","storagelist":[{"type":"dummyall3tries","username":"1"},{"type":"dummyallfail","username":"2"}]},{"type":"replicate","storagelist":[{"type":"dummyallnotfound","username":"3"}]}]}" -->
</div>
<!-- value="{"type":"local","username":"tristan","applicationname":"jiotests"}" -->
<label
class=
"control-label"
<!-- value="{"type":"dav","username":"tristan","password":"mdp","url":"http://localhost:80"}" -->
for=
"JSONapplicantID"
>
<!-- value="{"type":"replicate","storagelist":[{"type":"local","username":"tristan"},{"type":"dav","username":"tristan","password":"mdp","url":"http://localhost:80"}]}" -->
JSON Applicant
</label>
<div
class=
"controls docs-input-sizes"
>
<input
class=
"input-xlarge"
type=
"text"
name=
"JSONapplicant"
id=
"input_json_applicant"
value=
"{"ID":"jiotests"}"
placeholder=
"applicant"
/>
</div>
</div>
</div>
</div>
<button
type=
"submit"
<button
type=
"submit"
...
...
OfficeJS/component/workinprogress.html
0 → 100644
View file @
5e2582e0
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h2>
Activities
</h2>
<div
id=
"workinprogress"
></div>
<script
type=
"text/javascript"
>
<!--
(
function
()
{
var
id
;
if
(
!
window
.
workinprogress
)
{
id
=
null
;
window
.
workinprogress
=
{
start
:
function
(){
if
(
id
===
null
)
{
var
update
=
function
()
{
var
act
=
OfficeJS
.
getActivity
(),
i
,
str
=
''
;
for
(
i
=
0
;
i
<
act
.
length
;
i
+=
1
)
{
str
+=
act
[
i
]
+
'
<br />
'
;
}
if
(
str
===
''
)
{
str
=
'
There is no on going tasks.
'
;
}
document
.
querySelector
(
'
#workinprogress
'
).
innerHTML
=
str
;
};
update
();
id
=
setInterval
(
update
,
200
);
}
},
stop
:
function
(){
if
(
id
!==
null
)
{
clearInterval
(
id
);
id
=
null
;
}
}
};
}
}());
//-->
</script>
</body>
</html>
OfficeJS/index.html
View file @
5e2582e0
...
@@ -11,10 +11,11 @@
...
@@ -11,10 +11,11 @@
<script
type=
"text/javascript"
src=
"lib/renderjs/renderjs.js"
></script>
<script
type=
"text/javascript"
src=
"lib/renderjs/renderjs.js"
></script>
<script
type=
"text/javascript"
src=
"src/localorcookiestorage.js"
></script>
<script
type=
"text/javascript"
src=
"src/localorcookiestorage.js"
></script>
<script
type=
"text/javascript"
src=
"
src
/jio.js"
></script>
<script
type=
"text/javascript"
src=
"
lib/jio
/jio.js"
></script>
<script
type=
"text/javascript"
src=
"lib/base64/base64.js"
></script>
<script
type=
"text/javascript"
src=
"lib/base64/base64.js"
></script>
<script
type=
"text/javascript"
src=
"lib/sjcl/sjcl.min.js"
></script>
<script
type=
"text/javascript"
src=
"lib/sjcl/sjcl.min.js"
></script>
<script
type=
"text/javascript"
src=
"src/jio.storage.js"
></script>
<script
type=
"text/javascript"
src=
"lib/jio/jio.storage.js"
></script>
<script
type=
"text/javascript"
src=
"src/jio.dummystorages.js"
></script>
</head>
</head>
<body>
<body>
...
...
OfficeJS/js/officejs.js
View file @
5e2582e0
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
return
file_name
;
return
file_name
;
}
}
};
};
var
JIO
=
jio
;
/**
/**
* OfficeJS Object
* OfficeJS Object
...
@@ -174,6 +175,25 @@
...
@@ -174,6 +175,25 @@
update
:
function
()
{
update
:
function
()
{
OfficeJS
.
open
({
app
:
'
document_lister
'
,
force
:
true
});
OfficeJS
.
open
({
app
:
'
document_lister
'
,
force
:
true
});
}
}
},
workinprogress
:
{
type
:
'
viewer
'
,
path
:
'
component/workinprogress.html
'
,
gadget_id
:
'
page-content
'
,
onload
:
function
()
{
var
i
=
null
,
wait
=
function
()
{
// wait for workinprogress initialization end.
if
(
window
.
workinprogress
)
{
window
.
workinprogress
.
start
();
clearInterval
(
i
);
}
}
i
=
setInterval
(
wait
,
100
);
},
onunload
:
function
()
{
window
.
workinprogress
.
stop
();
return
true
;
}
}
}
};
};
priv
.
mime_object
=
{
priv
.
mime_object
=
{
...
@@ -227,7 +247,7 @@
...
@@ -227,7 +247,7 @@
end_getlist
:
function
(){
this
.
end_main
(
'
getlist
'
);
this
.
end_spin
();},
end_getlist
:
function
(){
this
.
end_main
(
'
getlist
'
);
this
.
end_spin
();},
end_remove
:
function
(){
this
.
end_main
(
'
remove
'
);
this
.
end_spin
();}
end_remove
:
function
(){
this
.
end_main
(
'
remove
'
);
this
.
end_spin
();}
};
};
priv
.
lastfailure
=
{};
// Initializer //
// Initializer //
priv
.
init
=
function
()
{
priv
.
init
=
function
()
{
};
};
...
@@ -384,7 +404,7 @@
...
@@ -384,7 +404,7 @@
return
;
return
;
}
}
// if there is not any jio created
// if there is not any jio created
priv
.
jio
=
JIO
.
newJio
(
storage
,
applicant
);
priv
.
jio
=
JIO
.
newJio
(
JSON
.
parse
(
storage
)
);
// update left nav bar
// update left nav bar
leftnavbar
=
priv
.
getRealApplication
(
'
leftnavbar
'
);
leftnavbar
=
priv
.
getRealApplication
(
'
leftnavbar
'
);
if
(
typeof
leftnavbar
.
update
!==
'
undefined
'
)
{
if
(
typeof
leftnavbar
.
update
!==
'
undefined
'
)
{
...
@@ -405,18 +425,21 @@
...
@@ -405,18 +425,21 @@
return
;
return
;
}
}
priv
.
loading_object
.
getlist
();
priv
.
loading_object
.
getlist
();
priv
.
jio
.
getDocumentList
({
priv
.
jio
.
getDocumentList
(
'
sort
'
:{
'
last_modified
'
:
'
descending
'
,
'
.
'
,
'
name
'
:
'
ascending
'
},
{
sort
:{
last_modified
:
'
descending
'
,
'
limit
'
:{
begin
:
0
,
end
:
50
},
name
:
'
ascending
'
},
// 'search':{name:'a'},
limit
:{
begin
:
0
,
end
:
50
},
'
maxtries
'
:
3
,
// search:{name:'a'},
'
onResponse
'
:
function
(
result
)
{
max_retry
:
3
,
if
(
result
.
status
===
'
done
'
)
{
onResponse
:
function
(
result
)
{
priv
.
data_object
.
documentList
=
result
.
return_value
;
if
(
result
.
status
.
isDone
())
{
priv
.
data_object
.
documentList
=
result
.
value
;
priv
.
showDocumentListInsideLeftNavBar
();
priv
.
showDocumentListInsideLeftNavBar
();
}
else
{
}
else
{
console
.
error
(
result
.
message
);
priv
.
lastfailure
.
path
=
'
.
'
;
priv
.
lastfailure
.
method
=
'
getDocumentList
'
;
console
.
error
(
result
.
error
.
message
);
}
}
priv
.
loading_object
.
end_getlist
();
priv
.
loading_object
.
end_getlist
();
if
(
typeof
callback
!==
'
undefined
'
)
{
if
(
typeof
callback
!==
'
undefined
'
)
{
...
@@ -443,17 +466,18 @@
...
@@ -443,17 +466,18 @@
return
;
return
;
}
}
priv
.
loading_object
.
save
();
priv
.
loading_object
.
save
();
priv
.
jio
.
saveDocument
({
priv
.
jio
.
saveDocument
(
'
name
'
:
basename
+
'
.
'
+
current_editor
.
ext
,
basename
+
'
.
'
+
current_editor
.
ext
,
'
content
'
:
current_editor
.
getContent
(),
current_editor
.
getContent
(),
'
onResponse
'
:
function
(
result
)
{
{
onResponse
:
function
(
result
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
!
result
.
status
.
isDone
())
{
console
.
error
(
result
.
message
);
priv
.
lastfailure
.
path
=
basename
;
priv
.
lastfailure
.
method
=
'
saveDocument
'
;
console
.
error
(
result
.
error
.
message
);
}
}
priv
.
loading_object
.
end_save
();
priv
.
loading_object
.
end_save
();
that
.
getList
();
that
.
getList
();
}
}});
});
};
};
/**
/**
...
@@ -468,19 +492,20 @@
...
@@ -468,19 +492,20 @@
return
;
return
;
}
}
priv
.
loading_object
.
load
();
priv
.
loading_object
.
load
();
priv
.
jio
.
loadDocument
({
priv
.
jio
.
loadDocument
(
'
name
'
:
basename
+
'
.
'
+
current_editor
.
ext
,
basename
+
'
.
'
+
current_editor
.
ext
,
'
maxtries
'
:
3
,
{
max_retry
:
3
,
'
onResponse
'
:
function
(
result
)
{
onResponse
:
function
(
result
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
!
result
.
status
.
isDone
())
{
console
.
error
(
result
.
message
);
console
.
error
(
result
.
error
.
message
);
priv
.
lastfailure
.
path
=
basename
;
priv
.
lastfailure
.
method
=
'
loadDocument
'
;
}
else
{
}
else
{
current_editor
.
setContent
(
current_editor
.
setContent
(
result
.
return_
value
.
content
);
result
.
value
.
content
);
}
}
priv
.
loading_object
.
end_load
();
priv
.
loading_object
.
end_load
();
}
}});
});
};
};
/**
/**
...
@@ -494,16 +519,17 @@
...
@@ -494,16 +519,17 @@
return
;
return
;
}
}
priv
.
loading_object
.
remove
();
priv
.
loading_object
.
remove
();
priv
.
jio
.
removeDocument
({
priv
.
jio
.
removeDocument
(
'
name
'
:
name
,
name
,
'
onResponse
'
:
function
(
result
)
{
{
onResponse
:
function
(
result
)
{
if
(
result
.
status
===
'
fail
'
)
{
if
(
!
result
.
status
.
isDone
())
{
console
.
error
(
result
.
message
);
console
.
error
(
result
.
error
.
message
);
priv
.
lastfailure
.
path
=
name
;
priv
.
lastfailure
.
method
=
'
removeDocument
'
;
}
}
priv
.
loading_object
.
end_remove
();
priv
.
loading_object
.
end_remove
();
that
.
getList
();
that
.
getList
();
}
}});
});
};
};
/**
/**
...
@@ -519,9 +545,9 @@
...
@@ -519,9 +545,9 @@
}
}
for
(
i
=
0
,
l
=
documentarray
.
length
;
i
<
l
;
i
+=
1
)
{
for
(
i
=
0
,
l
=
documentarray
.
length
;
i
<
l
;
i
+=
1
)
{
priv
.
loading_object
.
remove
();
priv
.
loading_object
.
remove
();
priv
.
jio
.
removeDocument
(
{
priv
.
jio
.
removeDocument
(
name
:
documentarray
[
i
],
documentarray
[
i
],
onResponse
:
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
'
)
{
...
@@ -533,6 +559,60 @@
...
@@ -533,6 +559,60 @@
}
}
};
};
that
.
getActivity
=
function
()
{
var
activity
=
priv
.
jio
.
getJobArray
();
var
lastfailure
=
that
.
getLastFailure
();
var
res
=
[],
i
;
for
(
i
=
0
;
i
<
activity
.
length
;
i
+=
1
)
{
switch
(
activity
[
i
].
command
.
label
)
{
case
'
saveDocument
'
:
res
.
push
(
'
Saving "
'
+
activity
[
i
].
command
.
path
+
'
",
'
);
break
;
case
'
loadDocument
'
:
res
.
push
(
'
Loading "
'
+
activity
[
i
].
command
.
path
+
'
".
'
);
break
;
case
'
removeDocument
'
:
res
.
push
(
'
Removing "
'
+
activity
[
i
].
command
.
path
+
'
".
'
);
break
;
case
'
getDocumentList
'
:
res
.
push
(
'
Get document list
'
+
'
at "
'
+
activity
[
i
].
command
.
path
+
'
".
'
);
break
;
default
:
res
.
push
(
'
Unknown action.
'
);
break
;
}
}
if
(
lastfailure
.
method
)
{
switch
(
lastfailure
.
method
)
{
case
'
saveDocument
'
:
res
.
push
(
'
<span style="color:red;">LastFailure:
'
+
'
Fail to save "
'
+
lastfailure
.
path
+
'
"</span>
'
);
break
;
case
'
loadDocument
'
:
res
.
push
(
'
<span style="color:red;">LastFailure:
'
+
'
Fail to load "
'
+
lastfailure
.
path
+
'
"</span>
'
);
break
;
case
'
removeDocument
'
:
res
.
push
(
'
<span style="color:red;">LastFailure:
'
+
'
Fail to remove "
'
+
lastfailure
.
path
+
'
"</span>
'
);
break
;
case
'
getDocumentList
'
:
res
.
push
(
'
<span style="color:red;">LastFailure:
'
+
'
Fail to retreive list from
'
+
'
at "
'
+
lastfailure
.
path
+
'
"</span>
'
);
break
;
default
:
break
;
}
}
return
res
;
};
that
.
getLastFailure
=
function
()
{
return
priv
.
lastfailure
;
};
// End of class //
// End of class //
priv
.
init
();
priv
.
init
();
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