Author: jmorliaguet
Date: Fri Jan  6 15:24:21 2006
New Revision: 2157

Modified:
   cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
Log:

- implemented ../../ navigation (will need some refactoring)



Modified: cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js
==============================================================================
--- cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js (original)
+++ cpsskins/branches/jmo-perspectives/ui/framework/cpsskins.js Fri Jan  6 
15:24:21 2006
@@ -65,29 +65,46 @@
     return this.Controllers[controller].handlers;
   },
 
-  switchPerspective: function(perspective) {
-    var to_show = [];
-    var to_hide = [];
-
+  _resolvePerspective: function(perspective) {
     var path = CPSSkins.CurrentPerspective.split("/");
+    var base = perspective;
+    var ext = "";
+
     if (perspective == '..') {
       if (path.length > 0) {
-        perspective = path.slice(0, path.length-1).join("/");
+        base = path.slice(0, path.length-1).join("/");
       }
     }
 
     if (perspective.substr(0,2) == "./") {
-      var base = CPSSkins.CurrentPerspective;
+      base = CPSSkins.CurrentPerspective;
+      if (base) {
+        base += "/";
+      }
+      ext = perspective.substr(2);
+    }
+
+    var up = perspective.match(new RegExp(/\.\.\//g));
+    if (up && (up.length <= path.length)) {
+      base = path.slice(0, path.length - up.length).join("/");
       if (base) {
         base += "/";
       }
-      perspective = base + perspective.substr(2);
+      ext = perspective.substr(up.length*3);
     }
 
     if (perspective == '-') {
-      perspective = CPSSkins.PreviousPerspective;
+      base = CPSSkins.PreviousPerspective;
     }
 
+    return base + ext;
+  },
+
+  switchPerspective: function(perspective) {
+    var to_show = [];
+    var to_hide = [];
+
+    perspective = CPSSkins._resolvePerspective(perspective);
     CPSSkins.Perspectives.each(function(s) {
       var elements = s[1];
       var path = perspective.split("/");
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to