Author: bklaas
Date: Mon Feb 4 13:36:32 2008
New Revision: 1790
URL: http://svn.slimdevices.com?rev=1790&root=Jive&view=rev
Log:
Bug: 6818
Description: Refresh parent window after adding/deleting favorite
pass step to performJSONAction so request table can be stored in it
add _refreshJSONAction function for refreshing a menu that has a stored cli call
I had to put the cli request on a 1 sec timer because otherwise the cli command
in _actionHandler was called *after* the menu was already refreshed.
Also note: the stored request will be the *last* request used to construct a
menu. This has implications for menus that are constructed with multiple
chunked requests.
Modified:
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
Modified:
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL:
http://svn.slimdevices.com/branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1790&root=Jive&r1=1789&r2=1790&view=diff
==============================================================================
---
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
(original)
+++
branches/7.0/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
Mon Feb 4 13:36:32 2008
@@ -230,7 +230,6 @@
step.cancelled = true
end)
end
-
step.loaded = function()
if _curStep.menu then
_curStep.menu:unlock()
@@ -425,9 +424,8 @@
-- _performJSONAction
-- performs the JSON action...
-local function _performJSONAction(jsonAction, from, qty, sink)
+local function _performJSONAction(jsonAction, from, qty, step, sink)
log:debug("_performJSONAction(from:", from, ", qty:", qty, "):")
-
local cmdArray = jsonAction["cmd"]
-- sanity check
@@ -478,11 +476,35 @@
table.insert(request, v)
end
end
-
+
+ if step then
+ step.jsonAction = request
+ end
+
-- send the command
_server:request(sink, playerid, request)
end
+-- for a given step, rerun the json request that created that slimbrowser menu
+local function _refreshJSONAction(step)
+ if not _player then
+ return
+ end
+
+ if not step.jsonAction then
+ log:warn('No jsonAction request defined for this step')
+ return
+ end
+
+ local playerid = _player:getId()
+ if not playerid then
+ log:warn('no player!')
+ return
+ end
+
+ _server:request(step.sink, playerid, step.jsonAction)
+
+end
-- _getStepSink
-- returns a closure to a sink embedding step
@@ -585,6 +607,14 @@
local function _hideMe(step)
Framework:playSound("WINDOWHIDE")
step.window:hide()
+ if step.origin then
+ _curStep = step.origin
+ local timer = Timer(1000,
+ function()
+ _refreshJSONAction(_curStep)
+ end, true)
+ timer:start()
+ end
end
-- _goNowPlaying
@@ -680,7 +710,7 @@
local from, qty =
step.db:missing(step.menu:isAccelerated())
if from then
- _performJSONAction(step.data, from, qty,
step.sink)
+ _performJSONAction(step.data, from, qty, step,
step.sink)
end
end
@@ -754,7 +784,7 @@
v.choiceStrings,
function(obj, selectedIndex)
local jsonAction =
v.actions['do'].choices[selectedIndex]
- _performJSONAction(jsonAction,
nil, nil, nil)
+ _performJSONAction(jsonAction,
nil, nil, nil, nil)
end,
selectedIndex
)
@@ -814,7 +844,7 @@
end
end
- _performJSONAction(jsonAction,
from, qty, sink)
+ _performJSONAction(jsonAction,
from, qty, step, sink)
end
_playerMenus[item.id] = item
@@ -1142,7 +1172,7 @@
_pushToNewWindow(step)
-- send the command
- _performJSONAction(jsonAction, from, qty, sink)
+ _performJSONAction(jsonAction, from, qty,
step, sink)
return EVENT_CONSUME
end
@@ -1684,7 +1714,7 @@
-- send the command
local from, qty
- _performJSONAction(jsonAction, 0, 200, sink)
+ _performJSONAction(jsonAction, 0, 200, step, sink)
end
-- showEmptyPlaylist
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins