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
fd120a1c
Commit
fd120a1c
authored
Jul 10, 2014
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved upload files
parent
37945473
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
76 additions
and
47 deletions
+76
-47
src/audioplayer/audioPlayer.appcache
src/audioplayer/audioPlayer.appcache
+25
-0
src/audioplayer/audioplayer.js
src/audioplayer/audioplayer.js
+14
-8
src/audioplayer/index.html
src/audioplayer/index.html
+1
-1
src/audioplayer_bridge/audiogadget.js
src/audioplayer_bridge/audiogadget.js
+8
-8
src/audioplayer_control/control.js
src/audioplayer_control/control.js
+2
-1
src/audioplayer_playlist/playlist.js
src/audioplayer_playlist/playlist.js
+1
-1
src/audioplayer_upload/upload.js
src/audioplayer_upload/upload.js
+25
-28
No files found.
src/audioplayer/audioPlayer.appcache
0 → 100644
View file @
fd120a1c
CACHE MANIFEST
# v1
CACHE:
audioplayer.css
audioplayer.js
../audioplayer_bridge/index.html
../audioplayer_bridge/audiogadget.js
../audioplayer_control/index.html
../audioplayer_control/control.js
../audioplayer_control/control.css
../audioplayer_playlist/index.html
../audioplayer_playlist/playlist.js
../audioplayer_upload/upload.js
../audioplayer_upload/index.js
../lib/URI.js
../lib/handlebars.min.js
../lib/jio.js
../lib/jquery.js
../lib/jquerymobile.css
../lib/jquerymobile.js
../lib/renderjs.min.js
../lib/rsvp.min.js
../lib/uritemplate.min.js
\ No newline at end of file
src/audioplayer/audioplayer.js
View file @
fd120a1c
...
...
@@ -83,19 +83,25 @@
});
})
.
allowPublicAcquisition
(
"
jio_post
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
))
var
type
;
if
(
param_list
[
1
]
===
0
)
{
type
=
0
;
}
else
{
type
=
this
.
storageType
;
}
return
this
.
getDeclaredGadget
(
storageType
(
type
))
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
post
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
invalideJioSave
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
))
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
invalideJioSave
.
apply
(
jio_gadget
,
param_list
);
});
})
.
allowPublicAcquisition
(
"
jio_putAttachment
"
,
function
(
param_list
)
{
return
this
.
getDeclaredGadget
(
storageType
(
this
.
storageType
))
var
type
;
if
(
param_list
[
1
]
===
0
)
{
type
=
0
;
}
else
{
type
=
this
.
storageType
;
}
return
this
.
getDeclaredGadget
(
storageType
(
type
))
.
push
(
function
(
jio_gadget
)
{
return
jio_gadget
.
putAttachment
.
apply
(
jio_gadget
,
param_list
);
});
...
...
src/audioplayer/index.html
View file @
fd120a1c
<!DOCTYPE html>
<html
lang=
"en
"
>
<html
manifest=
"audioPlayer.appcache
"
>
<head>
<!-- renderjs -->
<script
src=
"../<%= copy.rsvp.relative_dest %>"
type=
"text/javascript"
></script>
...
...
src/audioplayer_bridge/audiogadget.js
View file @
fd120a1c
/*global rJS, jIO, console, RSVP */
/*global rJS, jIO, console, RSVP
, encodeURI
*/
/*jslint nomen: true*/
(
function
(
rJS
,
jIO
)
{
"
use strict
"
;
...
...
@@ -13,15 +13,12 @@
.
declareMethod
(
'
createJio
'
,
function
(
jio_options
)
{
this
.
state_parameter_dict
.
jio_storage
=
jIO
.
createJIO
(
jio_options
);
})
.
declareMethod
(
'
invalideJioSave
'
,
function
(
jio_options
)
{
this
.
save
=
{};
})
.
declareMethod
(
'
allDocs
'
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
,
that
=
this
;
if
(
that
.
save
.
data
!==
undefined
)
{
/*
if (that.save.data !== undefined) {
return that.save;
}
}
*/
return
storage
.
allDocs
.
apply
(
storage
,
arguments
)
.
then
(
function
(
result
)
{
that
.
save
=
result
;
...
...
@@ -36,8 +33,7 @@
if
(
result
.
data
!==
undefined
)
{
length
=
result
.
data
.
rows
.
length
;
for
(
i
=
0
;
i
<
length
;
i
+=
1
)
{
if
((
result
.
data
.
rows
[
i
].
doc
.
title
===
param
.
_id
)
||
(
result
.
data
.
rows
[
i
].
id
===
param
.
_id
))
{
//xxx
if
(
result
.
data
.
rows
[
i
].
id
===
encodeURI
(
param
.
_id
))
{
//xxx
return
({
"
data
"
:
{
"
title
"
:
result
.
data
.
rows
[
i
].
doc
.
title
}});
}
}
...
...
@@ -65,6 +61,10 @@
.
declareMethod
(
'
post
'
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
post
.
apply
(
storage
,
arguments
);
})
.
declareMethod
(
'
put
'
,
function
()
{
var
storage
=
this
.
state_parameter_dict
.
jio_storage
;
return
storage
.
put
.
apply
(
storage
,
arguments
);
});
}(
rJS
,
jIO
));
src/audioplayer_control/control.js
View file @
fd120a1c
...
...
@@ -216,7 +216,8 @@
g
.
url
=
URL
.
createObjectURL
(
blob
);
})
.
push
(
undefined
,
function
(
error
)
{
throw
error
;
window
.
location
=
g
.
__element
.
getElementsByClassName
(
"
next
"
)[
0
].
href
;
});
}
})
...
...
src/audioplayer_playlist/playlist.js
View file @
fd120a1c
...
...
@@ -68,7 +68,7 @@
})
.
fail
(
function
(
error
)
{
document
.
getElementsByTagName
(
'
body
'
)[
0
].
textContent
=
"
network error: ip maybe not
set
"
;
"
network error: ip maybe not
defined
"
;
});
})
.
declareMethod
(
'
startService
'
,
function
()
{
...
...
src/audioplayer_upload/upload.js
View file @
fd120a1c
/*global window, rJS, RSVP, jIO, JSON, promiseEventListener, console, Error*/
/*global window, rJS, RSVP, jIO, JSON, promiseEventListener, console,
Error*/
/*jslint nomen: true*/
(
function
(
window
,
jIO
,
rJS
)
{
"
use strict
"
;
...
...
@@ -10,7 +11,6 @@
.
declareAcquiredMethod
(
"
displayThisTitle
"
,
"
displayThisTitle
"
)
.
declareAcquiredMethod
(
"
plEnablePage
"
,
"
plEnablePage
"
)
.
declareAcquiredMethod
(
"
plDisablePage
"
,
"
plDisablePage
"
)
.
declareAcquiredMethod
(
"
invalideJioSave
"
,
"
invalideJioSave
"
)
.
declareMethod
(
"
render
"
,
function
()
{
return
this
.
displayThisTitle
(
"
upload
"
);
})
...
...
@@ -20,41 +20,43 @@
g
.
__element
.
getElementsByTagName
(
'
input
'
)[
0
],
info_context
=
g
.
__element
.
getElementsByClassName
(
'
info
'
)[
0
],
i
,
queue
,
uploaded
=
0
,
length
;
function
post
(
index
)
{
function
post
()
{
if
(
uploaded
===
length
)
{
return
;
}
var
now
=
new
Date
();
return
g
.
jio_post
({
"
title
"
:
input_context
.
files
[
index
].
name
,
"
type
"
:
"
file
"
,
"
format
"
:
input_context
.
files
[
index
].
type
,
"
size
"
:
input_context
.
files
[
index
].
size
,
"
modified
"
:
now
.
toUTCString
(),
"
date
"
:
now
.
getFullYear
()
+
"
-
"
+
(
now
.
getMonth
()
+
1
)
+
"
-
"
+
now
.
getDate
()
})
.
push
(
function
(
res
)
{
return
g
.
jio_post
({
"
title
"
:
input_context
.
files
[
uploaded
].
name
,
"
type
"
:
"
file
"
,
"
format
"
:
input_context
.
files
[
uploaded
].
type
,
"
size
"
:
input_context
.
files
[
uploaded
].
size
,
"
modified
"
:
now
.
toUTCString
(),
"
date
"
:
now
.
getFullYear
()
+
"
-
"
+
(
now
.
getMonth
()
+
1
)
+
"
-
"
+
now
.
getDate
()
}
,
0
)
.
then
(
function
(
res
)
{
return
g
.
jio_putAttachment
({
"
_id
"
:
res
.
id
,
"
_attachment
"
:
"
enclosure
"
,
"
_blob
"
:
input_context
.
files
[
index
]
});
"
_blob
"
:
input_context
.
files
[
uploaded
]
}
,
0
);
})
.
push
(
function
()
{
.
then
(
function
()
{
uploaded
+=
1
;
info_context
.
innerHTML
+=
"
<li>
"
+
input_context
.
files
[
index
].
name
info_context
.
innerHTML
+=
"
<li>
"
+
input_context
.
files
[
uploaded
-
1
].
name
+
"
uploaded
"
+
uploaded
+
"
/
"
+
length
+
"
</li>
"
;
if
(
uploaded
===
length
)
{
return
g
.
plEnablePage
();
}
queue
.
push
(
post
);
})
.
fail
(
function
(
e
)
{
document
.
getElementsByTagName
(
'
body
'
)[
0
].
textContent
=
JSON
.
stringify
(
e
);
uploaded
+=
1
;
console
.
log
(
"
error
"
);
return
post
();
});
}
queue
=
new
RSVP
.
Queue
();
...
...
@@ -67,14 +69,9 @@
.
push
(
function
()
{
return
g
.
plDisablePage
();
})
.
push
(
function
()
{
return
g
.
invalideJioSave
();
})
.
push
(
function
()
{
length
=
input_context
.
files
.
length
;
for
(
i
=
0
;
i
<
length
;
i
+=
1
)
{
queue
.
push
(
post
(
i
));
}
queue
.
push
(
post
);
});
return
queue
;
});
...
...
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