Author: bklaas
Date: Thu Jan 28 15:08:25 2010
New Revision: 8418
URL: http://svn.slimdevices.com/jive?rev=8418&view=rev
Log:
Fixed Bug: 14874
Description: allow support of an onClick tag on menu items to refresh the
current window, the parent window, or the grandparent window
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
Modified:
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua?rev=8418&r1=8417&r2=8418&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay/share/applets/SlimBrowser/SlimBrowserApplet.lua
Thu Jan 28 15:08:25 2010
@@ -356,6 +356,15 @@
end
+local function _getGrandparentStep()
+ if #_stepStack < 3 then
+ return nil
+ end
+
+ return _stepStack[#_stepStack - 2]
+end
+
+
local function _getParentStep()
if #_stepStack < 2 then
return nil
@@ -951,6 +960,18 @@
end
end
+
+local function _refreshGrandparent()
+ local step = _getGrandparentStep()
+ if step then
+ local timer = Timer(100,
+ function()
+ _refreshJSONAction(step)
+ end, true)
+ timer:start()
+ end
+end
+
local function _refreshOrigin()
local step = _getParentStep()
@@ -1658,6 +1679,10 @@
local iNextWindow
--nextWindow on the action
local aNextWindow
+
+ -- onClick handler, for allowing refreshes of this window when
using a checkbox/radio/choice item (or 1 above, or 2 steps above)
+ local iOnClick
+ local bOnClick
-- we handle no action in the case of an item telling us not to
if item['action'] == 'none' then
@@ -1667,6 +1692,10 @@
-- dissect base and item for nextWindow params
bNextWindow = _safeDeref(chunk, 'base', 'nextWindow')
iNextWindow = item['nextWindow']
+
+ bOnClick = _safeDeref(chunk, 'base', 'onClick')
+ iOnClick = item['onClick']
+ local onClick = iOnClick or bOnClick -- item onClick wins over
base onClick
local useNextWindow
local actionHandlersExist = _safeDeref(item, 'actions') or
_safeDeref(chunk, 'base', 'actions')
@@ -1849,9 +1878,11 @@
else
_hideMeAndMyDad()
end
- elseif nextWindow == 'refreshOrigin' then
+ elseif onClick == 'refreshGrandparent' then
+ _refreshGrandparent()
+ elseif nextWindow == 'refreshOrigin' or onClick
== 'refreshOrigin' then
_refreshOrigin()
- elseif nextWindow == 'refresh' then
+ elseif nextWindow == 'refresh' or onClick ==
'refreshMe' then
_refreshMe()
-- if we have a nextWindow but none of those
reserved words above, hide back to that named window
elseif nextWindow then
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins