Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Update editor to match changes to API

  • Loading branch information...
commit 9e70d22cf606405372ecb29bea39b2bbf116042c 1 parent c2e3e83
Brian Birtles authored March 19, 2013
2  wall/lib/utils.inc
@@ -12,7 +12,7 @@ function wtrim($str) {
12 12
 
13 13
 // Convert something that should be numerical to an integer whilst preserving
14 14
 // null values
15  
-function toId($idLike) {
  15
+function toIntOrNull($idLike) {
16 16
   return is_null($idLike) ? null : intval($idLike);
17 17
 }
18 18
 
20  wall/lib/walls.inc
@@ -106,8 +106,8 @@ function getWallIdFromPath($path) {
106 106
 
107 107
 function startNewSession($wallId, $sessionId, $datetime) {
108 108
   // Sanitize input
109  
-  $wallId = toId($wallId);
110  
-  $sessionId = toId($sessionId);
  109
+  $wallId = toIntOrNull($wallId);
  110
+  $sessionId = toIntOrNull($sessionId);
111 111
 
112 112
   // Work out the latest session and if it needs closing
113 113
   $latestSession = getLatestSession($wallId);
@@ -142,8 +142,8 @@ function startNewSession($wallId, $sessionId, $datetime) {
142 142
 
143 143
 function closeLastSession($wallId, $sessionId, $datetime) {
144 144
   // Sanitize input
145  
-  $wallId = toId($wallId);
146  
-  $sessionId = toId($sessionId);
  145
+  $wallId = toIntOrNull($wallId);
  146
+  $sessionId = toIntOrNull($sessionId);
147 147
 
148 148
   // Check if the passed in sessionID actually matches the latest session (and 
149 149
   // that session is not already closed)
@@ -321,6 +321,8 @@ class Wall {
321 321
     // Associative keys map the regular value name used by users of this class 
322 322
     // to another more export-friendly value.
323 323
     $keys = array('id' => 'wallId', 'name',
  324
+                  'eventLocation',
  325
+                  'eventDescr',
324 326
                   'wallUrl', 'wallShortUrl',
325 327
                   'editorUrl', 'editorShortUrl',
326 328
                   'duration', 'defaultDuration',
@@ -340,7 +342,7 @@ class Wall {
340 342
 
341 343
   public function startSession($sessionId, $datetime) {
342 344
     // Sanitize input
343  
-    $sessionId = toId($sessionId);
  345
+    $sessionId = toIntOrNull($sessionId);
344 346
 
345 347
     // Check authorisation
346 348
     if (!$this->canAdminister()) {
@@ -386,7 +388,7 @@ class Wall {
386 388
 
387 389
   public function endSession($sessionId, $datetime) {
388 390
     // Sanitize input
389  
-    $sessionId = toId($sessionId);
  391
+    $sessionId = toIntOrNull($sessionId);
390 392
 
391 393
     // Check authorisation
392 394
     if (!$this->canAdminister()) {
@@ -595,7 +597,7 @@ class Walls {
595 597
     $metadata["eventLocation"] = $row['eventlocation'];
596 598
     $metadata["eventType"]     = $row['eventtype'];
597 599
     $metadata["eventFinish"]   = $row['eventfinish'];
598  
-    $metadata["designId"]      = $row['designid'];
  600
+    $metadata["designId"]      = toIntOrNull($row['designid']);
599 601
     $metadata["urlPath"]       = $row['urlpath'];
600 602
 
601 603
     // Privileged information
@@ -621,8 +623,8 @@ class Walls {
621 623
     }
622 624
 
623 625
     // Duration information
624  
-    $metadata["duration"]        = $row['duration'];
625  
-    $metadata["defaultDuration"] = $row['defaultduration'];
  626
+    $metadata["duration"] = toIntOrNull($row['duration']);
  627
+    $metadata["defaultDuration"] = toIntOrNull($row['defaultduration']);
626 628
 
627 629
     return new Wall($id, $email, $metadata);
628 630
   }
2  wall/public/wall-maker/js/create-wall.js
@@ -113,7 +113,7 @@ var CreateWallForm =
113 113
 
114 114
   getFormValues: function() {
115 115
     var result = {};
116  
-    result.title = this.form.eventName.value;
  116
+    result.name = this.form.eventName.value;
117 117
     result.design = this.getRadioValue('design');
118 118
     return result;
119 119
   },
2  wall/public/wall-maker/js/manage-wall.js
@@ -149,7 +149,7 @@ var ManageWallController =
149 149
     $("manage-eventDescr").value = response.eventDescr;
150 150
 
151 151
     // Sessions
152  
-    this.updateSessionInfo(response.session);
  152
+    this.updateSessionInfo(response.latestSession);
153 153
 
154 154
     // Design
155 155
     var designRadios =
2  wall/public/wall-maker/js/user-data.js
@@ -237,7 +237,7 @@ var DesignSelection = function(container, designs) {
237 237
       var radio = document.createElement('input');
238 238
       radio.setAttribute("type", "radio");
239 239
       radio.setAttribute("name", "design");
240  
-      radio.setAttribute("value", design['id']);
  240
+      radio.setAttribute("value", design['designId']);
241 241
       radio.setAttribute("required", "required");
242 242
       label.appendChild(radio);
243 243
 

0 notes on commit 9e70d22

Please sign in to comment.
Something went wrong with that request. Please try again.