Guest User

http://stackoverflow.com/posts/11952051

a guest
Aug 14th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3.  "http://www.w3.org/TR/xhtml1/DTD/xhtml-strict.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" xmlns:frog="http://fdp.frogtrade.com/ns/">
  5.     <head>
  6.         <meta name="frogLib" content="1.1" />
  7.         <title>My Widget</title>
  8.        
  9.         <style type="text/css">
  10.             body
  11.             { min-height: 1250px; }
  12.             p, div, ul, li, h1, h2, h3, h4, span
  13.             { margin: 0; padding: 0; line-height:15px; }
  14.             p
  15.             { margin: 6px 0; }
  16.             ul
  17.             { padding: 5px; }
  18.             li
  19.             { padding: 1px 10px; }
  20.             h2
  21.             { margin: 10px 1px 5px 1px; padding: 5px 0 5px 8px; border-top: 3px solid #ccc; border-bottom: 1px dotted #ccc; }
  22.             h3
  23.             { margin: 6px 0 2px 0; font-size: 125%; }
  24.         </style>
  25.        
  26.         <frog:roles>
  27.             <role name="api.users.getinfo" />
  28.             <role name="group.view.self" />
  29.             <role name="group.view.all" />
  30.             <role name="group.view.self.members" />
  31.             <role name="api.users.search" />
  32.             <role name="user.view.skeleton" />
  33.             <role name="group.view.all.members" />
  34.             <role name="api.timetable.getclasses" />
  35.             <role name="timetable.view.any" />
  36.             <role name="api.groups.getall" />
  37.             <role name="user.image.view" />
  38.         </frog:roles>
  39.        
  40.         <script src="/js/jquery.min.js"></script>
  41.         <script src="/user/74/169314.js"></script> // jqimpromptu
  42.        
  43.         <script type="text/javascript">
  44.         //<![CDATA[
  45.        
  46.     var TutorGroupPoints = {
  47.         URL: 'http://staff.curriculum.local/frog/rewards.php',
  48.         CurrentUser: UWA.Environment.user.id,
  49.         Groups: { },
  50.         Sorted: [ ],
  51.        
  52.         init: function() {
  53.             var that = this; // <-- caching outer this
  54.            
  55.             /* retrieve all of the groups from Frog and store them in a variable */
  56.             Frog.API.get('groups.getAll',
  57.             {
  58.                 'onSuccess': function (data) { that.Groups = data; },
  59.                 'onError': function(err) { alert(err); }
  60.             });        
  61.         },
  62.        
  63.         yearClick: function(year) {
  64.             for (var i = 0; i < this.Groups.length; i++) {
  65.                
  66.                 if (this.Groups[i].name.indexOf(year) == 0 && this.Groups[i].name.indexOf('/Tp') != -1) {
  67.                     var arrayToPush = { 'id': this.Groups[i].id, 'name': this.Groups[i].name };
  68.                     this.Sorted.push(arrayToPush);
  69.                 }
  70.             }
  71.            
  72.             console.log( this.Sorted );
  73.            
  74.             $('#nav').empty();
  75.            
  76.             for (var i = 0; i < this.Sorted.length; i++) {
  77.                 $('#nav ul').append('<li id="' + this.Sorted[i].id + '">' + this.Sorted[i].name + '</li>');
  78.                 console.log('<li id="' + this.Sorted[i].id + '">' + this.Sorted[i].name + '</li>');
  79.             }
  80.         }
  81.        
  82.     };
  83.  
  84.     widget.onLoad = function(){
  85.         TutorGroupPoints.init();
  86.        
  87.         $('#nav li a').click(function() {
  88.             TutorGroupPoints.yearClick($(this).attr("id"));
  89.         });
  90.     }
  91.            
  92.         //]]>
  93.         </script>
  94.  
  95.         <style>
  96.  
  97.         </style>
  98.     </head>
  99.     <body>
  100.         <div id="wrapper">
  101.             <div id="nav">
  102.                 <h2>Tutor Groups</h2>
  103.                 <ul>
  104.                     <li><a class="year" href="javascript:void(0);" title="Year 9" id="9">Year 9</a></li>
  105.                     <li><a class="year" href="javascript:void(0);" title="Year 10" id="10">Year 10</a></li>
  106.                     <li><a class="year" href="javascript:void(0);" title="Year 11" id="11">Year 11</a></li>
  107.                     <li><a class="year" href="javascript:void(0);" title="Year 12" id="12">Year 12</a></li>
  108.                     <li><a class="year" href="javascript:void(0);" title="Year 13" id="13">Year 13</a></li>
  109.                 </ul>
  110.             </div>
  111.             <div id="content">
  112.            
  113.             </div>
  114.         </div>
  115.     </body>
  116. </html>
Advertisement
Add Comment
Please, Sign In to add comment