Ver código fonte

Bug fix

Existing canvas sometimes replaced by new empty canvas
Unknown 7 anos atrás
pai
commit
d67947eeb8
2 arquivos alterados com 31 adições e 5 exclusões
  1. 14 1
      canvas/index.php
  2. 17 4
      canvas/js/canvas.js

+ 14 - 1
canvas/index.php

@@ -776,12 +776,25 @@
                             Owner of the Canvas
                         </h2>
                         <p id="canvas-owner">
-                            
+                            <?php echo $email; ?>
                         </p>
                         <h2>
                             List of Collaborators
                         </h2>
                         <table>
+                            <tr>
+                                <th>Active</th>
+                                <th>Name</th>
+                                <th>Username</th>
+                                <th>Remove</th>
+                            </tr>
+                            <tr>
+                                <td class='collaborators-active'><span class='glyphicon glyphicon-ok-sign'></span></td>
+                                <td><?php echo $name; ?></td>
+                                <td><?php echo $email; ?></td>
+                                <td>
+                                </td>
+                            </tr>
                         </table>
                         <label><input type="checkbox" name="show-only-active" /> Show only active collaborators</label><br />
                         <h2>

+ 17 - 4
canvas/js/canvas.js

@@ -325,6 +325,15 @@ $(document).ready(function() {
         // Show the collaborators window
         $("div#shadow").css("display", "block");
         $("div#collaborators-window").css("display", "block");
+        
+        // In 1.5 seconds
+        window.setTimeout(function() {
+            // If the canvas is new
+            if(canvasIsNew === true) {
+                // Save the canvas
+                prepareSaveCanvas();
+            }
+        }, 1500);
     });
     
     // Close the collaborators window
@@ -616,7 +625,11 @@ $(document).ready(function() {
         });
     }
     
-    updateCollaborators();
+    // If the canvas is new
+    if(canvasIsNew === false) {
+        // Update the collaborators
+        updateCollaborators();
+    }
     
     // Post typing information
     function postTyping(typingId) {
@@ -2941,15 +2954,15 @@ $(document).ready(function() {
     
     // Prepare to save the canvas
     function prepareSaveCanvas() {
-        // If the user is a user
+        // If the viewer of the canvas is a logged in user
         if($("input[name='username']").val() != "") {
             // Save the canvas
             saveCanvas();
         }
     }
     
-    // Save the project on load
-    prepareSaveCanvas();
+    // Save the canvas on load
+    // prepareSaveCanvas();
     
     /* ================================================
     Create and remove hidden copies of every list item.