Hi,

>
>> As for registering for tourney start events, I am still planning on
>> doing it (even with a multi page display). When a tourney to which
>> the user is registered starts, I am simply going to redirect the
>> page to the relevant game table page.
>
> I'm not sure I understand what you intend to do. Could you please
> elaborate ?

Since I am going to do multi-page approach, I will have a separate page
for the actual game table. So if the user is in the tourney list page,  
and
we receive the tourney start event, then I will redirect the user to  
the page
where he can join and play the game (assuming s/he is registered in  
the tourney)

>
>
>> Loic, I am assuming you reviewed my code for
>> templateTourneyDetails. Do you have any comments/suggestions
>> regarding this code ?
>
> I'm unable to comment because it's an isolated call that is basically
> the same as
> http://upstream.jspoker.pokersource.info/file/tip/jpoker/JpokerPlugin/JpokerPlugin.tiddler

Not sure I know what that file is, but this my code:

hg diff -r 16 website/webroot/jpoker/js/
diff -r 88737d9b1b05 website/webroot/jpoker/js/jquery.jpoker.js
--- a/website/webroot/jpoker/js/jquery.jpoker.js        Sat Sep 20 02:44:28  
2008 +0000
+++ b/website/webroot/jpoker/js/jquery.jpoker.js        Mon Sep 22 13:38:41  
2008 +0000
@@ -2079,6 +2079,84 @@
      };

      //
+    // templateTourneyDetails
+    //
+    jpoker.plugins.templateTourneyDetails = function(url, options) {
+        var templateTourneyDetails =  
jpoker.plugins.templateTourneyDetails;
+        var opts = $.extend({}, templateTourneyDetails.defaults,  
options);
+        var server = jpoker.url2server({ url: url });
+
+               /* A set of elements are passed as templates */
+               var $templates = this;
+
+        var updated = function(server, what, packet) {
+            if(packet && packet.type == 'PacketPokerTourneyList') {
+                               /* We match each packet with a corresponding 
template:
+                   TODO: Filter/sort the packets and match the  
template with the right packet.
+                 */
+                               for (var idx = 0; idx < packet.packets.length; 
idx++) {
+                                       var this_packet = packet.packets[idx];
+
+                                       /* Ignore packets without templates */
+                                       if ($templates.length <= idx) {
+                                               break;
+                                       }
+
+                                       /* Within the template, populate fields 
from the tourney details  
into elements
+                       identified by class 'var-<attrname>'
+                    */
+                                       var template = $($templates[idx]);
+                                       // Re-format the packet to make it 
suitable for display
+                                       this_packet['breaks'] = 
(this_packet['breaks_interval']/60) + '  
x ' +
+                                               
(this_packet['breaks_duration']/60);
+                                       var date = new Date(1000 * 
this_packet['start_time']);
+
+                                       var curr_hour = date.getHours();
+                                       var curr_min = date.getMinutes();
+                                       var a_p  = '';
+                                       if (curr_hour < 12)
+                                               a_p = "AM";
+                                       else
+                                               a_p = "PM";
+
+                                       if (curr_hour == 0)
+                                               curr_hour = 12;
+
+                                       if (curr_hour > 12)
+                                               curr_hour = curr_hour - 12;
+
+                                       curr_min = curr_min + "";
+                                       
+                                       if (curr_min.length == 1)
+                                               curr_min = "0" + curr_min;
+
+                                       
+                                       this_packet['start_time'] = curr_hour + 
':' + curr_min + ' ' +  
a_p;
+
+                                       for (var attr in this_packet) {
+                                               try {
+                                                       var field = $(".var-" + 
attr, template)
+                                                       field.each(function() {
+                                                               this.innerHTML 
= this_packet[attr]
+                                                       });
+                                               } catch(e) {
+                                               }
+                                       }
+                               }
+                       }
+            return true;
+               };
+
+        var id = jpoker.uid();
+        server.registerUpdate(updated, null, 'regularTourneyList' +  
id);
+        server.refreshTourneys(opts.string, opts);
+    };
+
+    jpoker.plugins.templateTourneyDetails.defaults = $.extend({
+        string: ''
+        }, jpoker.refresh.defaults, jpoker.defaults);
+
+    //
      // sitngoTourneyList
      //
      jpoker.plugins.sitngoTourneyList = function(url, options) {



_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to