Author: titmuss
Date: Mon Feb  4 15:34:51 2008
New Revision: 1800

URL: http://svn.slimdevices.com?rev=1800&root=Jive&view=rev
Log:
 [EMAIL PROTECTED] (orig r1790):  bklaas | 2008-02-04 21:36:32 +0000
 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:
    trunk/   (props changed)
    trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua

Propchange: trunk/
------------------------------------------------------------------------------
--- svk:merge (original)
+++ svk:merge Mon Feb  4 15:34:51 2008
@@ -1,3 +1,3 @@
-bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1789
+bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/7.0:1790
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/SN:1083
 bbe22326-0783-4b3a-ac2b-7ab96b24c8d9:/branches/scrolling:1378

Modified: 
trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL: 
http://svn.slimdevices.com/trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=1800&root=Jive&r1=1799&r2=1800&view=diff
==============================================================================
--- trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua 
(original)
+++ trunk/jive/src/pkg/jive/share/applets/SlimBrowser/SlimBrowserApplet.lua Mon 
Feb  4 15:34:51 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

Reply via email to