Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard
erp5
Commits
e2ada530
Commit
e2ada530
authored
Apr 27, 2018
by
Mukul
Committed by
Vincent Bechu
Apr 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Adds functionality to reuse child gadget.
/reviewed-on
nexedi/erp5!653
parents
94df7891
7e6d2192
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
59 additions
and
29 deletions
+59
-29
bt5/erp5_multimedia/SkinTemplateItem/portal_skins/erp5_multimedia/gadget_custom_player.js.js
...m/portal_skins/erp5_multimedia/gadget_custom_player.js.js
+33
-14
bt5/erp5_multimedia/SkinTemplateItem/portal_skins/erp5_multimedia/gadget_custom_player_controller.js.js
...ins/erp5_multimedia/gadget_custom_player_controller.js.js
+11
-8
bt5/erp5_multimedia/SkinTemplateItem/portal_skins/erp5_multimedia/gadget_custom_player_controller_fallback.js.js
...multimedia/gadget_custom_player_controller_fallback.js.js
+2
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
...e_module/gadget_officejs_controller_page_controller_js.js
+10
-2
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
..._module/gadget_officejs_controller_page_controller_js.xml
+3
-3
No files found.
bt5/erp5_multimedia/SkinTemplateItem/portal_skins/erp5_multimedia/gadget_custom_player.js.js
View file @
e2ada530
...
...
@@ -45,7 +45,7 @@
play_button
.
classList
.
add
(
'
ui-icon-play
'
);
play_button
.
classList
.
remove
(
'
ui-icon-pause
'
);
}
return
gadget
.
getDeclaredGadget
(
'
controller
'
)
return
gadget
.
getDeclaredGadget
(
gadget
.
params
.
scope
)
.
push
(
function
(
controller
)
{
return
controller
.
handlePlayPause
(
gadget
.
state
.
play
);
});
...
...
@@ -62,7 +62,7 @@
volume_button
.
classList
.
remove
(
'
ui-icon-volume-off
'
);
volume_button
.
classList
.
add
(
'
ui-icon-volume-up
'
);
}
return
gadget
.
getDeclaredGadget
(
'
controller
'
)
return
gadget
.
getDeclaredGadget
(
gadget
.
params
.
scope
)
.
push
(
function
(
controller
)
{
return
controller
.
handleSound
(
gadget
.
state
.
mute
);
});
...
...
@@ -75,14 +75,24 @@
var
name_array
=
doc
.
title
.
split
(
'
.
'
),
type
=
name_array
[
name_array
.
length
-
1
];
if
(
type
===
'
mp3
'
&&
MediaSource
.
isTypeSupported
(
'
audio/mpeg
'
))
{
gadget
.
params
.
scope
=
'
controller
'
;
if
(
gadget
.
params
.
controller
)
{
return
gadget
.
getDeclaredGadget
(
'
controller
'
);
}
gadget
.
params
.
controller
=
true
;
return
gadget
.
declareGadget
(
'
gadget_custom_player_controller.html
'
,
{
element
:
gadget
.
element
.
querySelector
(
'
.controller
'
),
scope
:
'
controller
'
});
}
gadget
.
params
.
scope
=
'
controller_fallback
'
;
if
(
gadget
.
params
.
contoller_fallback
)
{
return
gadget
.
getDeclaredGadget
(
'
controller_fallback
'
);
}
gadget
.
params
.
controller_fallback
=
true
;
return
gadget
.
declareGadget
(
'
gadget_custom_player_controller_fallback.html
'
,
{
element
:
gadget
.
element
.
querySelector
(
'
.controller
'
),
scope
:
'
controller
'
scope
:
'
controller
_fallback
'
});
})
.
push
(
function
(
controller
)
{
...
...
@@ -93,18 +103,21 @@
})
.
push
(
function
()
{
if
(
params
.
auto_play
)
{
return
gadget
.
changeState
({
play
:
true
,
auto_play
:
true
});
return
gadget
.
changeState
({
play
:
true
,
auto_play
:
true
});
}
}).
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
togglePlayPause
(
gadget
.
state
.
play
),
gadget
.
toggleSound
(
gadget
.
state
.
mute
)
]);
});
})
.
onStateChange
(
function
(
modification_dict
)
{
if
(
modification_dict
.
hasOwnProperty
(
'
play
'
))
{
return
this
.
togglePlayPause
(
modification_dict
.
play
);
}
if
(
modification_dict
.
hasOwnProperty
(
'
mute
'
))
{
return
this
.
toggleSound
(
modification_dict
.
mute
);
}
.
ready
(
function
()
{
this
.
params
=
{
controller
:
false
,
controller_fallback
:
false
};
})
.
declareService
(
function
()
{
...
...
@@ -114,7 +127,10 @@
'
click
'
,
false
,
function
()
{
return
gadget
.
changeState
({
play
:
!
gadget
.
state
.
play
});
return
gadget
.
changeState
({
play
:
!
gadget
.
state
.
play
})
.
push
(
function
()
{
return
gadget
.
togglePlayPause
(
gadget
.
state
.
play
);
});
},
true
);
...
...
@@ -127,7 +143,10 @@
'
click
'
,
false
,
function
()
{
return
gadget
.
changeState
({
mute
:
!
gadget
.
state
.
mute
});
return
gadget
.
changeState
({
mute
:
!
gadget
.
state
.
mute
})
.
push
(
function
()
{
return
gadget
.
toggleSound
(
gadget
.
state
.
mute
);
});
},
true
);
...
...
bt5/erp5_multimedia/SkinTemplateItem/portal_skins/erp5_multimedia/gadget_custom_player_controller.js.js
View file @
e2ada530
...
...
@@ -49,8 +49,8 @@
return
buffer
;
},
function
(
error
)
{
if
((
error
.
constructor
.
name
===
'
jIOError
'
&&
error
.
status_code
===
404
)
||
(
error
.
target
&&
error
.
target
.
result
===
undefined
))
{
return
gadget
.
notifySubmitted
({
message
:
error
.
message
||
error
.
target
.
error
,
status
:
'
fail
'
});
(
error
.
target
&&
error
.
target
.
error
.
name
===
"
NotReadableError
"
))
{
return
gadget
.
notifySubmitted
({
message
:
error
.
message
||
error
.
target
.
error
.
message
,
status
:
'
fail
'
});
}
throw
error
;
});
...
...
@@ -97,10 +97,16 @@
.
declareMethod
(
'
render
'
,
function
(
params
)
{
var
gadget
=
this
,
audio
=
this
.
element
.
querySelector
(
'
audio
'
),
queue
=
new
RSVP
.
Queue
();
gadget
.
params
.
id
=
params
.
id
;
gadget
.
params
.
name
=
params
.
name
;
gadget
.
params
.
end
=
false
;
gadget
.
params
.
index
=
0
;
gadget
.
time_offset
=
0
;
gadget
.
params
.
mediaSource
=
new
MediaSource
();
audio
.
src
=
URL
.
createObjectURL
(
gadget
.
params
.
mediaSource
);
return
queue
.
push
(
function
()
{
...
...
@@ -126,15 +132,12 @@
var
audioContext
=
new
AudioContext
(),
audio
=
this
.
element
.
querySelector
(
'
audio
'
),
gain
=
audioContext
.
createGain
(),
source
=
audioContext
.
createMediaElementSource
(
audio
),
mediaSource
=
new
MediaSource
();
source
=
audioContext
.
createMediaElementSource
(
audio
);
audio
.
src
=
URL
.
createObjectURL
(
mediaSource
);
this
.
params
=
{
audioContext
:
audioContext
,
gain
:
gain
,
source
:
source
,
mediaSource
:
mediaSource
source
:
source
};
})
...
...
@@ -171,7 +174,7 @@
'
timeupdate
'
,
false
,
function
()
{
if
((
gadget
.
params
.
sourceBuffer
.
timestampOffset
-
audio
.
currentTime
)
<
10
&&
!
gadget
.
params
.
requested
)
{
if
((
(
gadget
.
params
.
sourceBuffer
.
timestampOffset
+
gadget
.
params
.
time_offset
)
-
audio
.
currentTime
)
<
10
&&
!
gadget
.
params
.
requested
)
{
gadget
.
params
.
requested
=
true
;
return
gadget
.
requestChunk
();
}
...
...
bt5/erp5_multimedia/SkinTemplateItem/portal_skins/erp5_multimedia/gadget_custom_player_controller_fallback.js.js
View file @
e2ada530
...
...
@@ -33,8 +33,8 @@
})
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
constructor
.
name
===
'
jIOError
'
&&
error
.
status_code
===
404
)
||
(
error
.
target
&&
error
.
target
.
result
===
undefined
))
{
return
gadget
.
notifySubmitted
({
message
:
error
.
message
||
error
.
target
.
error
,
status
:
'
fail
'
});
(
error
.
target
&&
error
.
target
.
error
.
name
===
"
NotReadableError
"
))
{
return
gadget
.
notifySubmitted
({
message
:
error
.
message
||
error
.
target
.
error
.
message
,
status
:
'
fail
'
});
}
throw
error
;
});
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.js
View file @
e2ada530
...
...
@@ -60,10 +60,18 @@
});
});
})
.
onStateChange
(
function
()
{
.
onStateChange
(
function
(
modification_dict
)
{
var
fragment
=
document
.
createElement
(
'
div
'
),
gadget
=
this
;
if
(
!
modification_dict
.
hasOwnProperty
(
'
child_gadget_url
'
))
{
return
gadget
.
getDeclaredGadget
(
'
fg
'
)
.
push
(
function
(
child_gadget
)
{
return
child_gadget
.
render
({
jio_key
:
modification_dict
.
jio_key
,
doc
:
modification_dict
.
doc
});
});
}
// Clear first to DOM, append after to reduce flickering/manip
while
(
this
.
element
.
firstChild
)
{
this
.
element
.
removeChild
(
this
.
element
.
firstChild
);
...
...
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_controller_page_controller_js.xml
View file @
e2ada530
...
...
@@ -213,7 +213,7 @@
</item>
<item>
<key>
<string>
actor
</string>
</key>
<value>
<string>
vincent
</string>
</value>
<value>
<string>
zope
</string>
</value>
</item>
<item>
<key>
<string>
comment
</string>
</key>
...
...
@@ -227,7 +227,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
96
4.45561.47559.9591
</string>
</value>
<value>
<string>
96
7.6014.60137.10240
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -245,7 +245,7 @@
</tuple>
<state>
<tuple>
<float>
15
15602403.02
</float>
<float>
15
24650935.99
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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