usergrid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject [40/58] [abbrv] [partial] moving files to new dist directory
Date Tue, 01 Apr 2014 18:21:43 GMT
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/helpers.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/helpers.js b/portal/dist/appsvc-ui/archive/js/app/helpers.js
deleted file mode 100644
index 7e1d0f7..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/helpers.js
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * This file contains helper functions: Stuff used all over the application but not necessarily part of a module/object/paradigm/something.
- *
- * If your can't find where a function is defined, it's probably here. :)
- *
- * They need to be cleaned up. SOON!
- *
- */
-
-var onIE = navigator.userAgent.indexOf("MSIE") >= 0;
-
-function indexOfFirstType(type, args) {
-  for (var i = 0; i < args.length; i++) {
-    if (!args[i]) return - 1;
-    if (typeof args[i] == type) return i;
-  }
-  return - 1;
-}
-
-function getByType(type, i, args) {
-  var j = indexOfFirstType(type, args);
-  if (j < 0) return null;
-  var k = 0;
-  while ((j < args.length) && (k <= i)) {
-    if (type == "object") {
-      if (args[j].constructor != Object) return null;
-    } else if (typeof args[j] != type) return null;
-    if (k == i) return args[j];
-    j++;
-    k++;
-  }
-  return null;
-}
-
-function countByType(type, args) {
-  var c = 0;
-  var j = indexOfFirstType(type, args);
-  if (j < 0) return c;
-  while (j < args.length) {
-    if (type == "object") {
-      if (args[j].constructor != Object) return c;
-    } else if (typeof args[j] != type) return c;
-    j++;
-    c++;
-  }
-  return null;
-}
-
-function encodeParams(params) {
-  tail = [];
-  if (params instanceof Array) {
-    for (i in params) {
-      var item = params[i];
-      if ((item instanceof Array) && (item.length > 1)) {
-        tail.push(item[0] + "=" + encodeURIComponent(item[1]));
-      }
-    }
-  } else {
-    for (var key in params) {
-      if (params.hasOwnProperty(key)) {
-        var value = params[key];
-        if (value instanceof Array) {
-          for (i in value) {
-            var item = value[i];
-            tail.push(key + "=" + encodeURIComponent(item));
-          }
-        } else {
-          tail.push(key + "=" + encodeURIComponent(value));
-        }
-      }
-    }
-  }
-  return tail.join("&");
-}
-
-function encodePathString(path, returnParams) {
-
-  var i = 0;
-  var segments = new Array();
-  var payload = null;
-  while (i < path.length) {
-    var c = path.charAt(i);
-    if (c == '{') {
-      var bracket_start = i;
-      i++;
-      var bracket_count = 1;
-      while ((i < path.length) && (bracket_count > 0)) {
-        c = path.charAt(i);
-        if (c == '{') {
-          bracket_count++;
-        } else if (c == '}') {
-          bracket_count--;
-        }
-        i++;
-      }
-      if (i > bracket_start) {
-        var segment = path.substring(bracket_start, i);
-        segments.push(JSON.parse(segment));
-      }
-      continue;
-    } else if (c == '/') {
-      i++;
-      var segment_start = i;
-      while (i < path.length) {
-        c = path.charAt(i);
-        if ((c == ' ') || (c == '/') || (c == '{')) {
-          break;
-        }
-        i++;
-      }
-      if (i > segment_start) {
-        var segment = path.substring(segment_start, i);
-        segments.push(segment);
-      }
-      continue;
-    } else if (c == ' ') {
-      i++;
-      var payload_start = i;
-      while (i < path.length) {
-        c = path.charAt(i);
-        i++;
-      }
-      if (i > payload_start) {
-        var json = path.substring(payload_start, i).trim();
-        payload = JSON.parse(json);
-      }
-      break;
-    }
-    i++;
-  }
-
-  var newPath = "";
-  for (i = 0; i < segments.length; i++) {
-    var segment = segments[i];
-    if (typeof segment === "string") {
-      newPath += "/" + segment;
-    } else {
-      if (i == (segments.length - 1)) {
-        if (returnParams) {
-          return {path : newPath, params: segment, payload: payload};
-        }
-        newPath += "?";
-      } else {
-        newPath += ";";
-      }
-      newPath += encodeParams(segment);
-    }
-  }
-  if (returnParams) {
-    return {path : newPath, params: null, payload: payload};
-  }
-  return newPath;
-}
-
-function getQueryParams() {
-  var query_params = {};
-  if (window.location.search) {
-    // split up the query string and store in an associative array
-    var params = window.location.search.slice(1).split("&");
-    for (var i = 0; i < params.length; i++) {
-      var tmp = params[i].split("=");
-      query_params[tmp[0]] = unescape(tmp[1]);
-    }
-  }
-
-  return query_params;
-}
-
-function prepareLocalStorage() {
-  if (!Storage.prototype.setObject) {
-    Storage.prototype.setObject = function(key, value) {
-      this.setItem(key, JSON.stringify(value));
-    };
-  }
-  if (!Storage.prototype.getObject) {
-    Storage.prototype.getObject = function(key) {
-      try {
-        return this.getItem(key) && JSON.parse(this.getItem(key));
-      } catch(err) {
-      }
-      return null;
-    };
-  }
-}
-
-// if all of our vars are in the query string, grab them and save them
-function parseParams() {
-  var query_params = {};
-  if (window.location.search) {
-    // split up the query string and store in an associative array
-    var params = window.location.search.slice(1).split("&");
-    for (var i = 0; i < params.length; i++) {
-      var tmp = params[i].split("=");
-      query_params[tmp[0]] = unescape(tmp[1]);
-    }
-  }
-
-  if (query_params.access_token && query_params.admin_email && query_params.uuid) {
-    Usergrid.userSession.setAccessToken(query_params.access_token);
-    Usergrid.userSession.setUserEmail(query_params.admin_email);
-    Usergrid.userSession.setUserUUID(query_params.uuid);
-    //then send the user to the parent
-    var new_target = window.location.host + window.location.pathname;
-
-    var separatorMark = '?';
-    if (query_params.api_url) {
-      new_target = new_target + separatorMark + 'api_url=' + query_params.api_url;
-      separatorMark = '&';
-    }
-
-    if (query_params.use_sso) {
-      new_target = new_target + separatorMark + 'use_sso=' + query_params.use_sso;
-      separatorMark = '&';
-    }
-
-    window.location = window.location.protocol + '//' + new_target;
-    throw "stop!";
-  }
-}
-
-function dateToString(numberDate){
-  var date = new Date(numberDate);
-  return date.toString('dd MMM yyyy - h:mm tt ');
-}
-
-/* move toggleablesections to console? */
-function toggleableSections() {
-  $(document).on('click', '.title', function() {
-    $(this).parent().parent().find('.hideable').toggle();
-  })
-}
-
-function selectFirstElement(object) {
-  var first = null;
-  for (first in object) {
-    break
-  }
-  return first
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/navigation.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/navigation.js b/portal/dist/appsvc-ui/archive/js/app/navigation.js
deleted file mode 100644
index 8d2bcb1..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/navigation.js
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
-  * Usergrid.Navigation
-  *
-  * Functions to control the navigation of the Console client
-  *
-  * Uses:  Backbone.router
-  *
-  * Requires: Backbonejs, Underscore.js
-  *
-  */
-Usergrid.Navigation = Backbone.Router.extend({
-    routes: {
-      ":organization/:application/organization": "home",
-      ":organization/:application/dashboard": "dashboard",
-      ":organization/:application/users": "users",
-      ":organization/:application/groups": "groups",
-      ":organization/:application/roles": "roles",
-      ":organization/:application/activities": "activities",
-      ":organization/:application/collections": "collections",
-      ":organization/:application/notifications": "notifications",
-      ":organization/:application/sendNotification": "sendNotification",
-      ":organization/:application/messageHistory": "messageHistory",
-      ":organization/:application/notificationsReceipt": "notificationsReceipt",
-      ":organization/:application/configuration": "configuration",
-      ":organization/:application/getStarted": "getStarted",
-      ":organization/:application/analytics": "analytics",
-      ":organization/:application/properties": "properties",
-      ":organization/:application/shell": "shell",
-      ":organization/:application/account": "account",
-      ":organization/home": "home",
-      ":organization": "home",
-      "": "home"
-    },
-    //Router Methods
-    home: function(organization, application) {
-      $('body').scrollTop(0);
-      if(organization) {
-        this.checkOrganization(organization);
-      }
-      this.checkApplication(application);
-      Pages.SelectPanel('organization');
-      $('#left2').hide();
-    },
-    dashboard: function(organization,application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Usergrid.console.pageSelect(application);
-      Pages.SelectPanel('dashboard');
-      $('#left2').hide();
-    },
-    users: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('users');
-      this.showAppUserContent();
-    },
-    groups: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('groups');
-      this.showAppUserContent();
-    },
-    roles: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('roles');
-      this.showAppUserContent();
-    },
-    activities: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('activities');
-      $('#left2').hide();
-    },
-    collections: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.ActivatePanel("collections");
-      Pages.SelectPanel('collections');
-      this.showAppDataContent();
-    },
-    notifications: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Usergrid.console.getNotifiers();
-    },
-    sendNotification: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.ActivatePanel('notifications');
-      Pages.SelectPanel('notifications');
-      Usergrid.console.getNotifiers();
-    },
-    messageHistory: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.ActivatePanel('messageHistory');
-      Pages.SelectPanel('messageHistory');
-      Usergrid.console.bindPagingEvents('notifications-history');
-      Usergrid.console.getNotifications();
-      this.showAppNotificationsContent();
-    },
-    notificationsReceipt: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      if (Usergrid.console.checkForSelectedNotification()) {
-        Pages.ActivatePanel('notificationsReceipt');
-        Pages.SelectPanel('notificationsReceipt');
-        Usergrid.console.bindPagingEvents('notification-receipt');
-      } else {
-        Pages.ActivatePanel('messageHistory');
-        Pages.SelectPanel('messageHistory');
-        Usergrid.console.bindPagingEvents('notifications-history');
-        Usergrid.console.getNotifications();
-      }
-      this.showAppNotificationsContent();
-    },
-    configuration: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.ActivatePanel("configuration");
-      Pages.SelectPanel('configuration');
-      Usergrid.console.getCertList();
-      this.showAppNotificationsContent();
-    },
-    getStarted: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.ActivatePanel("getStarted");
-      Pages.SelectPanel('getStarted');
-      this.showAppNotificationsContent();
-    },
-    analytics: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('analytics');
-      $('#left2').hide();
-    },
-    properties: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('properties');
-      $('#left2').hide();
-    },
-    shell: function(organization, application) {
-      $('body').scrollTop(0);
-      this.checkOrganization(organization);
-      this.checkApplication(application);
-      Pages.SelectPanel('shell');
-      $('#left2').hide();
-    },
-    account: function(organization, application) {
-      $('body').scrollTop(0);
-      Pages.SelectPanel('account');
-      $('#left2').hide();
-    },
-    //Utils
-    checkOrganization: function(org) {
-      if(!this.isActiveOrganization(org)) {
-        Usergrid.console.selectOrganization(org);
-      }
-    },
-    isActiveOrganization: function(org) {
-      if(org) {
-        if(Usergrid.ApiClient.getOrganizationName() === org ) {
-          return true
-        }
-      }
-      return false
-    },
-    checkApplication: function(app) {
-      if(app){
-        if(!this.isActiveApplication(app)) {
-          Usergrid.console.pageSelect(app);
-        }
-      }
-    },
-    isActiveApplication: function(app) {
-      if(app) {
-        if(Usergrid.ApiClient.getApplicationName() === app) {
-          return true
-        }
-      }
-      return false
-    },
-    getAppNameFromURL: function(){
-      name = '';
-      try  {
-        name = window.location.hash.split('/')[1];
-      } catch (e) {}
-      return name;
-    },
-    getOrgNameFromURL: function(){
-      name = '';
-      try  {
-        name = window.location.hash.split('/')[0];
-        name = name.replace("#","");
-      } catch (e) {}
-      return name;
-    },
-    showAppUserContent: function(){
-      $('#left2').show();
-      $('#sidebar-menu2').show();
-      $('#left-collections-menu').hide();
-      $('#left-notifications-menu').hide();
-    },
-    showAppDataContent: function(){
-      $('#left2').show();
-      $('#sidebar-menu2').hide();
-      $('#left-collections-menu').show();
-      $('#left-notifications-menu').hide();
-    },
-    showAppNotificationsContent: function(){
-      $('#left2').show();
-      $('#sidebar-menu2').hide();
-      $('#left-collections-menu').hide();
-      $('#left-notifications-menu').show();
-      $('#notifications-link').parent().addClass('active');
-    },
-
-    navigateTo: function(address) {
-      var url;
-      url = Usergrid.ApiClient.getOrganizationName();
-      url += "/" + Usergrid.ApiClient.getApplicationName();
-      url += "/" + address;
-      // Backbone navigate only triggers page loading if url changes
-      // loading manually if the url hasn't changed is necessary.
-      if(Backbone.history.fragment === url) {
-        Backbone.history.loadUrl(url);
-      } else {
-        this.navigate(url, {trigger: true});
-      }
-    }
-  });
-
-Usergrid.Navigation.router = new Usergrid.Navigation();
-_.bindAll(Usergrid.Navigation.router);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/pages.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/pages.js b/portal/dist/appsvc-ui/archive/js/app/pages.js
deleted file mode 100644
index 9d8468b..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/pages.js
+++ /dev/null
@@ -1,161 +0,0 @@
-function ApigeePages() {
-  var self = {
-    pages: {},
-    panels: {},
-    resetPasswordUrl: ''
-    };
-
-  self.clearPage = function(){
-    $("#pages > div").hide();
-  };
-
-  self.ShowPage = function(pageName){
-    // console.log('showing ' + pageName);
-    $("#pages > div").hide();
-    var page = self.pages[pageName];
-    page.box.show();
-    $(".navbar li.active").removeClass('active');
-    $(".navbar .navbar-inner").hide();
-
-    if(page.link.parent().parent().hasClass("dropdown-menu")) {
-      page.link.parent().parent().parent().addClass('active');
-    } else {
-      page.menu.show();
-    }
-
-    if(page.showFunction) {
-      page.showFunction();
-    }
-
-    if(Usergrid.userSession.getBannerState() == 'true'){
-      this.showBanner();
-    }
-
-    if (pageName == 'login') {
-      Usergrid.console.clearBackgroundImage();
-    } else {
-      Usergrid.console.setColumnBackgroundImage();
-    }
-
-  };
-  self.showBanner = function(){
-    Usergrid.userSession.showBanner();
-    $('#banner').show();
-  };
-
-  self.hideBanner = function(){
-    Usergrid.userSession.hideBanner();
-    $("#banner").hide();
-  };
-
-  self.AddPage = function(page) {
-    if(!page.link)
-      page.link = $("#" + page.name + '-link');
-
-    if(!page.box)
-      page.box = $("#" + page.name + '-page');
-
-    page.link.click(function(e) {
-      e.preventDefault();
-      if(!page.link.hasClass("dropdown-toggle"))
-        self.ShowPage(page.name);
-    });
-
-    LoadPage(page);
-    self.pages[page.name] = page;
-  };
-
-  self.AddPanel = function(panelName, linkSelector, sublinkSelector,boxSelector,initFunction,showFunction, buttonHandler) {
-    if (!linkSelector) {
-      //linkSelector = "#sidebar-menu a[href='#" + panelName + "']";
-      linkSelector = "#" + panelName  + '-link';
-    }
-    if (!sublinkSelector) {
-      sublinkSelector = "#" + panelName  + '-sublink';
-    }
-
-    if (!boxSelector) {
-      boxSelector = "#" + panelName + '-panel';
-    }
-
-    var panel = {
-      name: panelName,
-      link: $(linkSelector),
-      sublink: $(sublinkSelector),
-      box: $(boxSelector),
-      initFunction: initFunction,
-      showFunction: showFunction
-    };
-
-    if(!buttonHandler) {
-      buttonHandler = function(e) {
-        e.preventDefault();
-        redrawBox(panel.box);
-        if(panel.name == "query") {
-          Usergrid.Navigation.router.navigateTo("collections");
-        } else {
-          Usergrid.Navigation.router.navigateTo(panel.name);
-        }
-      }
-    }
-    panel.link.click(buttonHandler);
-    panel.sublink.click(buttonHandler);
-
-    self.panels[panel.name] = panel;
-
-    if (panel.initFunction) {
-      panel.initFunction();
-    }
-  };
-
-  self.ActivatePanel = function(panelName){
-    var panel = self.panels[panelName];
-    $("#sidebar-menu li.active").removeClass('active');
-    $("#"+panelName+"-link").parent().addClass('active');
-
-    $("#left-notifications-menu li.active").removeClass('active');
-
-  }
-
-  self.SelectPanel = function (panelName){
-    var panel = self.panels[panelName];
-
-    $("#sidebar-menu li.active").removeClass('active');
-    $("#sidebar-menu2 li.active").removeClass('active');
-    panel.link.parent().addClass('active');
-    panel.sublink.parent().addClass('active');
-
-    Usergrid.console.setupMenu();
-    Usergrid.console.requestApplications();
-    if (panel.showFunction) {
-      panel.showFunction();
-    }
-
-    redrawBox(panel.box);
-
-  };
-
-  function LoadPage(page){
-
-    if (page.name=='forgot-password') {
-      $("#forgot-password-page iframe").attr("src", self.resetPasswordUrl);
-    } else if(page.name=='console-frame') {
-      $("#console-frame-page iframe").attr("src", "consoleFrame.html");
-    } else {
-      if (window.location.pathname.indexOf('app') > 0) {
-        $.ajaxSetup ({cache: false});
-        page.box.load(page.name + '.html',page.initFunction);
-        $.ajaxSetup ({cache: true});
-      } else if(page.initFunction) {
-        page.initFunction();
-      }
-    }
-  }
-
-  function redrawBox(box) {
-    $("#console-panels > div").hide();
-    box.show();
-
-  }
-  return self;
-}

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/params.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/params.js b/portal/dist/appsvc-ui/archive/js/app/params.js
deleted file mode 100644
index 16feeba..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/params.js
+++ /dev/null
@@ -1,30 +0,0 @@
-
-(function (){
-  Usergrid.Params = function(){};
-
-  Usergrid.Params.prototype = {
-    queryParams : {},
-    parseParams : function(){
-      if (window.location.search) {
-        // split up the query string and store in an associative array
-        var params = window.location.search.slice(1).split("&");
-        for (var i = 0; i < params.length; i++) {
-          var tmp = params[i].split("=");
-          this.queryParams[tmp[0]] = unescape(tmp[1]);
-        }
-      }
-    },
-    getParsedParams : function(queryString){
-      var retParams = {};
-      var params = queryString.slice(0).split("&");
-      for (var i = 0; i < params.length; i++) {
-        var tmp = params[i].split("=");
-        retParams[tmp[0]] = unescape(tmp[1]);
-      }
-      return retParams;
-    }
-  };
-
-})(Usergrid);
-
-Usergrid.Params = new Usergrid.Params();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/quickLogin.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/quickLogin.js b/portal/dist/appsvc-ui/archive/js/app/quickLogin.js
deleted file mode 100644
index 6b239a1..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/quickLogin.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
-  This file enables the page to quickly redirect the user to the SSO login page.
-  Requires:
-  Usergrid.Params - params.js
-  Usergrid.userSession -session.js
-
-  Its prefered that Usergrid.Params loads parameters before QuickLogin.init() is called.
- */
-
-(function(){
-  Usergrid.QuickLogin = function(){};
-
-  Usergrid.QuickLogin.prototype = {
-    init : function(queryParams, sessionExists, useSSO){
-      if(this.credentialsInParams(queryParams)){
-        Usergrid.userSession.setUserUUID(queryParams.uuid);
-        Usergrid.userSession.setUserEmail(queryParams.admin_email);
-        Usergrid.userSession.setAccessToken(queryParams.access_token);
-      }
-      else if (!sessionExists && useSSO){
-        Usergrid.SSO.sendToSSOLoginPage();
-      }
-    },
-    credentialsInParams : function(params){
-      return(params.access_token && params.admin_email && params.uuid);
-    }
-  };
-})(Usergrid);
-
-Usergrid.QuickLogin = new Usergrid.QuickLogin();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/session.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/session.js b/portal/dist/appsvc-ui/archive/js/app/session.js
deleted file mode 100644
index 0907da1..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/session.js
+++ /dev/null
@@ -1,176 +0,0 @@
-
-window.Usergrid = window.Usergrid || {};
-Usergrid = Usergrid || {};
-(function() {
-  /**
-   *  Application is a class for holding application info
-   *
-   *  @class Application
-   *  @param {string} name the name of the application
-   *  @param {string} uuid the uuid of the application
-   */
-  Usergrid.Application = function(name, uuid) {
-    this._name = name;
-    this._uuid = uuid;
-  };
-  Usergrid.Application.prototype = {
-    getName: function() {
-      return this._name;
-    },
-    setName: function(name) {
-      this._name = name;
-    },
-    getUUID: function() {
-      return this._uuid;
-    },
-    setUUID: function(uuid) {
-      this._uuid = uuid;
-    },
-    setCurrentApplication: function(app) {
-      this.setName(app.getName());
-      this.setUUID(app.getUUID());
-    }
-  };
-
-
-  /**
-   *  Organization is a class for holding application info
-   *
-   *  @class Organization
-   *  @param {string} name organization's name
-   *  @param {string} organization's uuid
-   *  @param {string} list organization's applications
-   */
-  Usergrid.Organization = function(name, uuid) {
-    this._name = name;
-    this._uuid = uuid;
-    this._list = [];
-  };
-
-  Usergrid.Organization.prototype = {
-    getName: function() {
-      return this._name;
-    },
-    setName: function(name) {
-      this._name = name;
-    },
-    getUUID: function() {
-      return this._uuid;
-    },
-    setUUID: function(uuid) {
-      this._uuid = uuid;
-    },
-    setCurrentOrganization: function(org) {
-      this._name = org.getName();
-      this._uuid = org.getUUID();
-      this._list = org.getList();
-    },
-    addItem: function(item) {
-      var count = this._list.length;
-      this._list[count] = item;
-    },
-    getItemByName: function(name) {
-      var count = this._list.length;
-      var i=0;
-      if(name){
-          for (i=0; i<count; i++) {
-            if (this._list[i].getName().toLowerCase() == name.toLowerCase()) {
-              return this._list[i];
-            }
-          }
-      }
-      return null;
-    },
-    getItemByUUID: function(UUID) {
-      var count = this._list.length;
-      var i=0;
-      for (i=0; i<count; i++) {
-        if (this._list[i].getUUID() == UUID) {
-          return this._list[i];
-        }
-      }
-      return null;
-    },
-    getFirstItem: function() {
-      var count = this._list.length;
-      if (count > 0) {
-        return this._list[0];
-      }
-      return null;
-    },
-    getList: function() {
-      return this._list;
-    },
-    setList: function(list) {
-      this._list = list;
-    },
-    clearList: function() {
-      this._list = [];
-    }
-  };
-
-  /**
-    *  Standardized methods for maintaining user and authentication state in the Application
-    *  @class UserSession
-    */
-  Usergrid.userSession = function(){};
-
-  Usergrid.userSession.prototype = {
-    //access token access and setter methods
-    getAccessToken: function() {
-      var accessToken = localStorage.getItem('accessToken');
-      return accessToken;
-    },
-    setAccessToken: function setAccessToken(accessToken) {
-      localStorage.setItem('accessToken', accessToken);
-      localStorage.setItem('apigee_token', accessToken);
-    },
-    //logged in user access and setter methods
-    getUserUUID: function () {
-      return localStorage.getItem('userUUID');
-    },
-    setUserUUID: function (uuid) {
-      localStorage.setItem('userUUID', uuid);
-    },
-    getUserEmail: function () {
-      return localStorage.getItem('userEmail');
-    },
-    setUserEmail: function (email) {
-      localStorage.setItem('userEmail', email);
-      localStorage.setItem('apigee_email', email);
-    },
-    hideBanner: function(){
-      localStorage.setItem('showBanner', 'false');
-    },
-    showBanner: function(){
-      localStorage.setItem('showBanner', 'true');
-    },
-    getBannerState: function(){
-      return localStorage.getItem('showBanner');
-    },
-    //convenience method to verify if user is logged in
-    loggedIn: function () {
-      var token = this.getAccessToken();
-      var email = this.getUserEmail();
-      return (token && email);
-    },
-
-    //convenience method for saving all active user vars at once
-    saveAll: function (uuid, email, accessToken) {
-      this.setUserUUID(uuid);
-      this.setUserEmail(email);
-      this.setAccessToken(accessToken);
-    },
-
-    //convenience method for clearing all active user vars at once
-    clearAll: function () {
-      localStorage.removeItem('userUUID');
-      localStorage.removeItem('userEmail');
-      localStorage.removeItem('accessToken');
-      localStorage.removeItem('apigee_oken');
-      localStorage.removeItem('apigee_email');
-    }
-  };
-})(Usergrid);
-
-Usergrid.userSession = new Usergrid.userSession();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/sso.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/sso.js b/portal/dist/appsvc-ui/archive/js/app/sso.js
deleted file mode 100644
index ca46e08..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/sso.js
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Usergrid.SSO
- * SSO functions apigee specific
- *
- * Requires:
- * Usergrid.ApiClient
- */
-(function () {
-  Usergrid.SSO = function () {
-  };
-
-  Usergrid.SSO.prototype = {
-
-    default : {
-    top_level_domain: "apigee.com",
-    test_top_level_domain: "appservices.apigee.com",
-    local_domain: "localhost",
-    use_sso: true, // flag to override use SSO if needed set to ?use_sso=no
-    login_url: "https://accounts.apigee.com/accounts/sign_in",
-    profile_url: "https://accounts.apigee.com/accounts/my_account",
-    logout_url: "https://accounts.apigee.com/accounts/sign_out",
-    api_url: "https://api.usergrid.com/"
-    },
-
-    isTopLevelDomain:function () {
-      if ( window.location.hostname === this.default.top_level_domain ||
-           window.location.hostname === this.default.test_top_level_domain ||
-           window.location.hostname === this.default.local_domain ||
-           location.pathname.indexOf('/dit') >= 0 ||
-           location.pathname.indexOf('/mars') >= 0
-         )
-      {
-        return true;
-      }else{
-        return false;
-      }
-
-    },
-
-    usingSSO:function () {
-      return this.getSSO() && this.isTopLevelDomain();
-    },
-
-    getSSO:function (){
-      return this.default.use_sso;
-    },
-
-    getSSOCallback:function (urlCallback) {
-
-       var url = this.buildBaseUrl();
-
-      if(urlCallback) {
-        url += "#" + urlCallback;
-      }
-
-
-      if (Usergrid.ApiClient.getApiUrl() !== undefined && (Usergrid.ApiClient.getApiUrl() !== this.default.api_url)) {
-        var separatorMark = '&';
-        url += separatorMark + 'api_url=' + Usergrid.ApiClient.getApiUrl();
-      }
-      console.log(url);
-      //url = encodeURIComponent(url);
-      return'?callback=' + url;
-    },
-
-    buildBaseUrl:function () {
-      var baseUrl = window.location.protocol + '//' + window.location.host + window.location.pathname;
-      return baseUrl;
-    },
-
-    sendToSSOLogoutPage:function (callbackUrl) {
-      var url = this.default.logout_url;
-      if(window.location.host === 'localhost'){
-        //DIT
-        url = 'https://accounts.jupiter.apigee.net/accounts/sign_out';
-      }if(window.location.host === 'appservices.apigee.com' && location.pathname.indexOf('/dit') >= 0){
-        //DIT
-        url = 'https://accounts.jupiter.apigee.net/accounts/sign_out';
-      }else if(window.location.host === 'appservices.apigee.com' && location.pathname.indexOf('/mars') >= 0 ){
-        //staging
-        url = 'https://accounts.mars.apigee.net/accounts/sign_out';
-      }else{
-        url = this.default.logout_url;
-      }
-      url = url + this.getSSOCallback();
-      window.location = url;
-    },
-
-    sendToSSOLoginPage:function () {
-      var url = this.default.login_url;
-      if(window.location.host === 'localhost'){
-        //DIT
-        url = 'https://accounts.jupiter.apigee.net/accounts/sign_in';
-      }else if(window.location.host === 'appservices.apigee.com' && location.pathname.indexOf('/dit') >= 0){
-        //DIT
-        url = 'https://accounts.jupiter.apigee.net/accounts/sign_in';
-      }else if(window.location.host === 'appservices.apigee.com' && location.pathname.indexOf('/mars') >= 0 ){
-        //staging
-        url = 'https://accounts.mars.apigee.net/accounts/sign_in';
-      }else{
-        url = this.default.login_url;
-      }
-      url = url + this.getSSOCallback();
-      window.location = url;
-    },
-
-    sendToSSOProfilePage:function (callbackUrl) {
-      var url = this.default.profile_url;
-      if(window.location.host === 'localhost'){
-        //DIT
-        url = 'https://accounts.jupiter.apigee.net/accounts/my_account';
-      } else if(window.location.host === 'appservices.apigee.com' && location.pathname.indexOf('/dit') >= 0){
-        //DIT
-        url = 'https://accounts.jupiter.apigee.net/accounts/my_account';
-      } else if(window.location.host === 'appservices.apigee.com' && location.pathname.indexOf('/mars') >= 0 ){
-        //staging
-        url = 'https://accounts.mars.apigee.net/accounts/my_account';
-      }else{
-        url = this.default.profile_url;
-      }
-      url = url + this.getSSOCallback();
-      window.location = url;
-    },
-
-    setUseSSO:function (sso) {
-      if (sso == 'yes' || sso == 'true') {
-        this.default.use_sso = true;
-      } else if (sso == 'no' || sso == 'false') {
-        this.default.use_sso = false;
-      }
-    }
-  };
-})(Usergrid);
-
-Usergrid.SSO = new Usergrid.SSO();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/status.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/status.js b/portal/dist/appsvc-ui/archive/js/app/status.js
deleted file mode 100644
index 20a18a1..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/status.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * User: David S
- * Date: 17/02/12
- * Time: 12:43 PM
- */
-var StatusBar = function () {
-  var self = {
-    box: null
-  };
-
-  self.Init = function(boxSelector){
-    self.box = $(boxSelector);
-  };
-
-  self.showAlert = function (msg, type) {
-    if (!type) {
-      type = 'info';
-    }
-
-    var closebutton = '<a onclick="closeErrorMessage();" class="close">&times;</a>'
-    var item = $('<div class="alert span3 alert-' + type + ' ">' + msg + closebutton + '</div>');
-    self.box.find(".alert").remove();
-    self.box.show().prepend(item);
-    item.show();
-
-  };
-
-  self.hideAlert = function () {
-    self.box.hide();
-  };
-
-  closeErrorMessage = function() {
-    self.box.hide();
-  };
-
-  return self;
-}();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/ui/collections.entity.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/ui/collections.entity.js b/portal/dist/appsvc-ui/archive/js/app/ui/collections.entity.js
deleted file mode 100644
index 83bc8e0..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/ui/collections.entity.js
+++ /dev/null
@@ -1,320 +0,0 @@
-window.Usergrid = window.Usergrid || {};
-Usergrid.console = Usergrid.console || {};
-Usergrid.console.ui = Usergrid.console.ui || { };
-Usergrid.console.ui.collections = Usergrid.console.ui.collections || { };
-
-(function() {
-  // This code block *WILL* load before the document is complete
-
-  var entity_list_item = {
-    options: {
-    },
-
-    _create: function() {
-
-      var self = this;
-      var o = self.options;
-      var el = self.element;
-
-      var entity_id = el.dataset('entity-id');
-      var entity_type = el.dataset('entity-type');
-      var entity = Usergrid.console.getQueryResultEntity(entity_id);
-      if (!entity) return;
-      o.entity = entity;
-      o.path = el.dataset('collection-path');
-
-      o.header = self.getHeader();
-      o.collections = self.getCollections();
-      o.contents = self.getContents();
-      o.metadata = self.getMetadata();
-      o.json = self.getJson();
-
-      o.header.appendTo(el);
-      o.collections.appendTo(el);
-      o.contents.appendTo(el);
-      o.metadata.appendTo(el);
-      o.json.appendTo(el);
-
-      o.header.find(".button").button();
-
-      var contents_button = o.header.find(".query-result-header-toggle-contents");
-      contents_button.click(function() {
-        if (o.contents.css('display') == 'none') {
-          o.contents.show();
-          o.json.hide();
-          o.collections.hide();
-        } else {
-          o.contents.hide();
-        }
-        return false;
-      });
-
-      var json_button = o.header.find(".query-result-header-toggle-json");
-      json_button.click(function() {
-        if (o.json.css('display') == 'none') {
-          o.json.show();
-          o.contents.hide();
-          o.collections.hide();
-        } else {
-          o.json.hide();
-        }
-        return false;
-      });
-
-      var collections_button = o.header.find(".query-result-header-toggle-collections");
-      collections_button.click(function() {
-        if (o.collections.css('display') == 'none') {
-          o.collections.show();
-          o.contents.hide();
-          o.json.hide();
-        } else {
-          o.collections.hide();
-        }
-        return false;
-      });
-
-      var metadata_button = o.header.find(".query-result-header-toggle-metadata");
-      metadata_button.click(function() {
-        o.metadata.toggle();
-        return false;
-      });
-
-      var link_button = o.header.find(".query-result-header-link");
-    },
-
-    getHeader : function() {
-      var entity = this.options.entity,
-         name = entity.uuid + " : " + entity.type;
-
-      if (entity.name) {
-        name = name + " : " + entity.name;
-      } else if (entity.username) {
-        name = name + " : " + entity.username;
-      } else if (entity.title) {
-        name = name + " : " + entity.title;
-      }
-
-      var collections = {
-        entity : entity,
-        name : name,
-        path : this.options.path,
-        collections : !$.isEmptyObject((entity.metadata || { }).collections || (entity.metadata || { }).connections),
-        uri : (entity.metadata || { }).uri
-      }
-
-      if(entity.type === 'user' || entity.picture){
-        if (!entity.picture) {
-          entity.picture = "/images/user-photo.png"
-        } else {
-          entity.picture = entity.picture + "?d=http://" + window.location.host + window.location.pathname + "images/user-photo.png"
-        }
-        collections['picture'] = entity.picture;
-      }
-
-      return $.tmpl("apigee.ui.collections.entity.header.html",
-        collections);
-
-    },
-
-    getCollections : function() {
-      var entity = this.options.entity;
-
-      var collections = $.extend({ }, (entity.metadata || { }).collections, (entity.metadata || { }).connections);
-
-      if (!$.isEmptyObject(collections)) {
-        return $.tmpl("apigee.ui.collections.entity.collections.html", {
-          collections : collections
-        }, {
-          makeObjectTable : Usergrid.console.ui.makeObjectTable,
-          tableOpts : Usergrid.console.ui.standardTableOpts
-        });
-      }
-      return $("");
-    },
-
-    getContents : function() {
-      var entity_contents = $.extend( false, { }, this.options.entity);
-      try { // metadata may or may not be present
-        var path = entity_contents['metadata']['path'];
-        entity_contents = $.extend( false, entity_contents, {'path': path});
-        var sets = entity_contents['metadata']['sets'];
-        entity_contents = $.extend( false, entity_contents, {'sets': sets});
-        var collections = entity_contents['metadata']['collections'];
-        entity_contents = $.extend( false, entity_contents, {'collections': collections});
-        delete entity_contents['metadata'];
-      } catch(e) {}
-      return $.tmpl("apigee.ui.collections.entity.contents.html", {
-        entity : entity_contents
-      }, {
-        makeObjectTable : Usergrid.console.ui.makeObjectTable,
-        tableOpts : Usergrid.console.ui.standardTableOpts
-      });
-    },
-
-    getMetadata : function() {
-      var entity = this.options.entity;
-      if (!$.isEmptyObject(entity.metadata)) {
-        return $.tmpl("apigee.ui.collections.entity.metadata.html", {
-          metadata : entity.metadata
-        }, {
-          makeObjectTable : Usergrid.console.ui.makeObjectTable,
-          tableOpts : Usergrid.console.ui.metadataTableOpts
-        });
-      }
-      return $("");
-    },
-
-    getJson : function() {
-      return $.tmpl("apigee.ui.collections.entity.json.html", {
-        entity : this.options.entity
-      }, {
-        makeObjectTable : Usergrid.console.ui.makeObjectTable,
-        tableOpts : Usergrid.console.ui.standardTableOpts
-      });
-    },
-
-    destroy: function() {
-      this.element.html("");
-      this.options.entity = null;
-      this.options.header = null;
-      this.options.contents = null;
-      this.options.metadata = null;
-      this.options.collections = null;
-      this.options.json = null;
-    }
-
-  }
-  Usergrid.console.ui.collections.entity_list_item = entity_list_item;
-
-  var entity_detail = {
-    options: {
-    },
-
-    _create: function() {
-
-      var self = this;
-      var o = self.options;
-      var el = self.element;
-
-      var entity_id = el.dataset('entity-id');
-      var entity_type = el.dataset('entity-type');
-      var entity = Usergrid.console.getQueryResultEntity(entity_id);
-      if (!entity) return;
-      o.entity = entity;
-      o.path = el.dataset('collection-path');
-
-      o.details = self.getDetails();
-
-      o.details.appendTo(el);
-
-      o.collections = el.find(".query-result-collections");
-      o.details.find(".button").button();
-      o.contents = el.find(".query-result-contents");
-      o.json = el.find(".query-result-json");
-      o.formDiv = el.find(".query-result-form");
-
-      var content_button = o.details.find(".query-result-header-toggle-contents");
-      content_button.click(function() {
-        if (o.contents.css('display') == 'none') {
-          o.contents.show();
-          o.json.hide();
-          o.collections.hide();
-        } else {
-          o.contents.hide();
-        }
-        return false;
-      });
-
-      var collections_button = o.details.find(".query-result-header-toggle-collections");
-      collections_button.click(function() {
-        if (o.collections.css('display') == 'none') {
-          o.collections.show();
-          o.contents.hide();
-          o.json.hide();
-        } else {
-          o.collections.hide();
-        }
-        return false;
-      });
-
-      var json_button = o.details.find(".query-result-header-toggle-json");
-      json_button.click(function() {
-        if (o.json.css('display') == 'none') {
-          o.json.show();
-          o.contents.hide();
-          o.collections.hide();
-        } else {
-          o.json.hide();
-        }
-        return false;
-      });
-
-      var link_button = o.details.find(".query-result-header-link");
-    },
-
-    getDetails : function() {
-      var entity = this.options.entity,
-        name = entity.uuid + " : " + entity.type,
-        collections,
-        connections;
-
-      if (entity.name) {
-        name = name + " : " + entity.name;
-      } else if (entity.username) {
-        name = name + " : " + entity.username;
-      } else if (entity.title) {
-        name = name + " : " + entity.title;
-      }
-
-      if(entity.metadata.collections){
-        collections = entity.metadata.collections;
-      }
-
-      if(entity.metadata.connections){
-        connections = entity.metadata.connections;
-      }
-
-      var entity_contents = $.extend( false, { }, this.options.entity);
-      var path = entity_contents['metadata']['path'];
-      entity_contents = $.extend( false, entity_contents, {'path': path});
-      delete entity_contents['metadata'];
-
-      var metadata = entity.metadata;
-      if ($.isEmptyObject(metadata)) metadata = null;
-
-      return $.tmpl("apigee.ui.collections.entity.detail.html", {
-        entity : entity_contents,
-        name : name,
-        path : this.options.path,
-        collections : collections,
-        connections : connections,
-        metadata : metadata,
-        uri : (entity.metadata || { }).uri
-      }, {
-        makeObjectTable : Usergrid.console.ui.makeObjectTable,
-        tableOpts : Usergrid.console.ui.standardTableOpts,
-        metadataTableOpts : Usergrid.console.ui.metadataTableOpts
-      });
-
-    },
-
-    destroy: function() {
-      this.element.html("");
-      this.options.entity = null;
-      this.options.details.header = null;
-      this.options.json = null;
-      this.options.formDiv = null;
-    }
-
-  };
-  Usergrid.console.ui.collections.entity_detail = entity_detail;
-
-  (function($) {
-    // This code block *WILL NOT* load before the document is complete
-
-    $.widget("ui.apigee_collections_entity_list_item", entity_list_item);
-    $.widget("ui.apigee_collections_entity_detail", entity_detail);
-
-  })(jQuery);
-
-})();

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/ui/collections.user.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/ui/collections.user.js b/portal/dist/appsvc-ui/archive/js/app/ui/collections.user.js
deleted file mode 100644
index 5b2c561..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/ui/collections.user.js
+++ /dev/null
@@ -1,120 +0,0 @@
-window.Usergrid = window.Usergrid || {};
-Usergrid.console = Usergrid.console || {};
-Usergrid.console.ui = Usergrid.console.ui || { };
-Usergrid.console.ui.collections = Usergrid.console.ui.collections || { };
-
-(function($) {
-  //This code block *WILL NOT* load before the document is complete
-
-  // Simplified vcard in JSON Schema for demonstration purposes
-  // Every collection will have a JSON Schema available and downloadable from the server
-  // Empty collections will have a minimal schema that only contains the basic required entity properties
-  // Developers will be able to upload schemas to collections as well
-  var vcard_schema = {
-    "description":"A representation of a person, company, organization, or place",
-    "type":"object",
-    "properties":{
-      "username":{
-        "type":"string",
-        "optional": true,
-        "title" : "Username"
-      },
-      "name":{
-        "description":"Formatted Name",
-        "type":"string",
-        "optional":true,
-        "title" : "Full Name"
-      },
-      "title":{
-        "description":"User Title",
-        "type":"string",
-        "optional": true,
-        "title":"Title"
-      },
-      "url":{
-        "type":"string",
-        "format":"url",
-        "optional":true,
-        "title" : "Home Page"
-      },
-      "email":{
-        "type":"string",
-        "format":"email",
-        "optional":true,
-        "title" : "Email"
-      },
-      "tel":{
-        "type":"string",
-        "format":"phone",
-        "optional":true,
-        "title" : "Telephone"
-      },
-      "picture":{
-        "type":"string",
-        "format":"image",
-        "optional":true,
-        "title" : "Picture URL"
-      },
-      "bday":{
-        "type":"string",
-        "format":"date",
-        "optional":true,
-        "title" : "Birthday"
-      },
-      "adr":{
-        "type":"object",
-        "properties":{
-          "id":{
-            "type":"integer"
-          },
-          "addr1":{
-            "type":"string",
-            "title" : "Street 1"
-          },
-          "addr2":{
-            "type":"string",
-            "title" : "Street 2"
-          },
-          "city":{
-            "type":"string",
-            "title" : "City"
-          },
-          "state":{
-            "type":"string",
-            "title" : "State"
-          },
-          "zip":{
-            "type":"string",
-            "title" : "Zip"
-          },
-          "country":{
-            "type":"string",
-            "title" : "Country"
-          }
-        },
-        "optional":true,
-        "title" : "Address"
-      }
-    }
-  };
-  Usergrid.console.ui.collections.vcard_schema = vcard_schema;
-
-  var group_schema = {
-    "description":"A representation of a group",
-    "type":"object",
-    "properties":{
-      "path":{
-        "type":"string",
-        "optional": true,
-        "title" : "Group Path"
-      },
-      "title":{
-        "type":"string",
-        "optional":true,
-        "title" : "Display Name"
-      }
-    }
-  };
-  Usergrid.console.ui.collections.group_schema = group_schema;
-
-})(jQuery);

http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/bd74da42/portal/dist/appsvc-ui/archive/js/app/ui/ui.js
----------------------------------------------------------------------
diff --git a/portal/dist/appsvc-ui/archive/js/app/ui/ui.js b/portal/dist/appsvc-ui/archive/js/app/ui/ui.js
deleted file mode 100644
index 089bb92..0000000
--- a/portal/dist/appsvc-ui/archive/js/app/ui/ui.js
+++ /dev/null
@@ -1,415 +0,0 @@
-window.Usergrid = window.Usergrid || {};
-Usergrid.console = Usergrid.console || {};
-Usergrid.console.ui = Usergrid.console.ui || { };
-
-(function() {
-  //This code block *WILL* load before the document is complete
-
-  function loadTemplate(name) {
-    $.ajax({
-      type: "GET",
-      url: "templates/" + name,
-      complete: function(jqXHR, textStatus){
-        var html = jqXHR.responseText;
-        if (html) {
-          $.template(name, html);
-        }
-      }
-    });
-  }
-  Usergrid.console.ui.loadTemplate = loadTemplate;
-
-  var standardTableOpts = {
-    "base_css" : "query-result-table",
-    "links" : {
-      "metadata.collections*" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "metadata.connections*" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "all_collections*" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "metadata.path" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "*uri" : "<a href=\"${value}\">${value}</a>",
-      "*link" : "<a href=\"${value}\">${value}</a>"
-    }
-  };
-  Usergrid.console.ui.standardTableOpts = standardTableOpts;
-
-  var metadataTableOpts = {
-    "base_css" : "query-result-table",
-    "links" : {
-      "collections*" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "connections*" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "path" : "<a href=\"#\" onclick=\"Usergrid.console.pageOpenQueryExplorer('${value}'); return false;\">${value}</a>",
-      "uri" : "<a href=\"${value}\">${value}</a>"
-    }
-  };
-  Usergrid.console.ui.metadataTableOpts = metadataTableOpts;
-
-  var re1 = /[^a-zA-Z0-9-]/g;
-  var re2 = /--*/g;
-  var re3 = /\${value}/g;
-  function makeObjectTable(obj, opts, parent_k) {
-    var base_css = opts.base_css;
-    var doArray = ($.type(obj) == "array");
-
-    var t = "<table class=\"" + base_css + " " + base_css + "-obj\">";
-    if (doArray) {
-      t = "<table class=\"" + base_css + " " + base_css + "-list\">";
-    }
-
-    for (var k in obj) {
-      var v = obj[k];
-      var full_k = parent_k ? parent_k + "." + k : k;
-
-      var cs = k.replace(re1, "-").replace(re2, "-");
-
-      var vType = $.type(v);
-      if ((vType  == "object") || (vType  == "array")) {
-        v = makeObjectTable(v, opts, full_k);
-      }
-
-      if (vType  == "object") {
-        t += "<tr class=\"" + base_css + "-row-obj\">";
-      }
-      else if (vType  == "array") {
-        t += "<tr class=\"" + base_css + "-row-array\">";
-      }
-      else {
-        t += "<tr class=\"" + base_css + "-row-line\">";
-
-        var links = opts.links;
-        var link_href = links[full_k];
-        if (!link_href) {
-          link_href = links[parent_k + "*"];
-        }
-        if (!link_href) {
-          link_href = links["*" + k];
-        }
-        if (link_href) {
-          v = link_href.replace(re3, v);
-        }
-        v = "<div>" + v + "</div>";
-      }
-
-      if (doArray) {
-        t += "<td class=\"" + base_css + "-item\"><div>" + v + "</div></td>";
-      }
-      else {
-        t += "<td class=\"" + base_css + "-name\"><div data-path=\"" + full_k + "\">" + k + "</div></td>";
-        t += "<td class=\"" + base_css + "-value " + base_css + "-name-" + cs + "\">" + v + "</td>";
-      }
-
-      t += "</tr>";
-    }
-
-    t += "</table>";
-    return t;
-  }
-  Usergrid.console.ui.makeObjectTable = makeObjectTable;
-
-  function makeTableFromList(list, width, options) {
-    var getListItem = null;
-    var getListItemTemplateOptions = null;
-    var listItemTemplate = null;
-
-    var onRender = null;
-    var output = null;
-
-    var tableId = null;
-
-    var tableClass = null;
-    var rowClass = null;
-    var cellClass = null;
-
-    var tableStyle = null;
-    var rowStyle = null;
-    var cellStyle = null;
-
-    if (options) {
-      getListItem = options.getListItem;
-      getListItemTemplateOptions = options.getListItemTemplateOptions;
-      listItemTemplate = options.listItemTemplate;
-
-      onRender = options.onRender;
-      output = options.output;
-
-      tableId = options.tableId;
-
-      tableClass = options.tableClass;
-      rowClass = options.rowClass;
-      cellClass = options.cellClass;
-
-      tableStyle = options.tableStyle;
-      rowStyle = options.rowStyle;
-      cellStyle = options.cellStyle;
-    }
-
-    tableId = tableId ? " id=\"" + tableId + "\" " : "";
-
-    tableClass = tableClass ? " class=\"" + tableClass + "\" " : "";
-    rowClass = rowClass ? " class=\"" + rowClass + "\" " : "";
-    cellClass = cellClass ? " class=\"" + cellClass + "\" " : "";
-
-    tableStyle = tableStyle ? " style=\"" + tableStyle + "\" " : "";
-    rowStyle = rowStyle ? " style=\"" + rowStyle + "\" " : "";
-    cellStyle = cellStyle ? " style=\"" + cellStyle + "\" " : "";
-
-    var t = "<table" + tableId + tableClass + tableStyle + ">\n";
-    var i = 0;
-    if (!width || (width < 1)) width = 1;
-    var count = (Math.floor((list.length - 1) / width) + 1) * width;
-    while (i < count) {
-      if ((i % width) == 0) {
-        t += "<tr" + rowClass + rowStyle + ">\n";
-      }
-      t += "<td" + cellClass + cellStyle + ">";
-      if (i < list.length) {
-        if (getListItem) {
-          t += getListItem(i, i % count, Math.floor(i / count));
-        }
-        else {
-          t += list[i];
-        }
-      }
-      t += "</td>\n";
-      if (((i + 1) % width) == 0) {
-        t += "</tr>\n";
-      }
-      i++;
-    }
-    t += "</table>\n";
-    return t;
-  }
-  Usergrid.console.ui.makeTableFromList = makeTableFromList;
-
-  function jsonSchemaToDForm(schema, obj) {
-    var dform = { elements : [] };
-
-    for (var propName in schema.properties) {
-      var property = schema.properties[propName];
-      var type = property.type;
-      if (type == "string") {
-        var value = '';
-        try {
-          var value = obj[propName];
-        } catch (e) {}
-        if (!value) value = "";
-        var element = {
-          "name" : "ui-form-" + propName,
-          "id" : "ui-form-" + propName,
-          "caption" : property.title,
-          "type" : "text",
-          "value" : value
-        };
-        dform.elements.push(element);
-        dform.elements.push({
-          "type" : "br"
-        });
-      } else if (type == "object") {
-        var element = jsonSchemaToDForm(property, obj[propName]);
-        element.type = "fieldset";
-        element.caption = property.title;
-        dform.elements.push(element);
-      }
-    }
-    return dform;
-  }
-  Usergrid.console.ui.jsonSchemaToDForm = jsonSchemaToDForm;
-
-  function jsonSchemaToPayload(schema){
-    var payloadData = new Object();
-    var payload = '';
-    for (var propName in schema.properties) {
-      var property = schema.properties[propName];
-      var type = property.type;
-      if (type == "string") {
-        var value = $('#ui-form-'+propName).val();
-        if (!value) value = "";
-        payloadData[propName] = value;
-
-      } else if (type == "object") {
-        payloadData[propName] = {};
-        for (var propName2 in schema.properties[propName].properties) {
-          var property2 = schema.properties[propName].properties[propName2];
-          var type2 = property2.type;
-          if (type2 == "string") {
-            var value2 = $('#ui-form-'+propName2).val();
-            if (!value) value = "";
-            payloadData[propName][propName2] = value2;
-
-          }
-        }
-      }
-    }
-    return payloadData;
-  }
-  Usergrid.console.ui.jsonSchemaToPayload = jsonSchemaToPayload;
-
-  function displayEntityListResponse(query_results, options, response) {
-
-    query_results = query_results || {};
-
-    var getListItem = null;
-    var getListItemTemplateOptions = null;
-    var listItemTemplate = null;
-
-    var output = null;
-    var prevButton = null;
-    var nextButton = null;
-    var nextPrevDiv = null;
-
-    var noEntitiesMsg = "";
-
-    var onRender = null;
-    var onNoEntities = null;
-    var onError = null;
-    var onRawJson = null;
-
-    if (options) {
-      getListItem = options.getListItem;
-      getListItemTemplateOptions = options.getListItemTemplateOptions;
-      listItemTemplate = options.listItemTemplate;
-
-      output = options.output;
-
-      prevButton = options.prevButton;
-      nextButton = options.nextButton;
-      nextPrevDiv = options.nextPrevDiv;
-
-      noEntitiesMsg = options.noEntitiesMsg;
-
-      onRender = options.onRender;
-      onNoEntities = options.onNoEntities;
-      onError = options.onError;
-      onRawJson = options.onRawJson;
-    }
-
-    query_results.entities = null;
-    query_results.entities_by_id = null;
-    query_results.query = query_results.query || { };
-
-    var t = "";
-    if (response.entities && (response.entities.length > 0)) {
-
-      query_results.entities = response.entities;
-      query_results.entities_by_id = {};
-
-      // collections is the only one that uses this lower level item, and can't be trusted to be here
-      // so hardcoding this check for that type and loading it in a try to make sure we don't error out
-      // in other cases
-      try {
-        if (response.entities[0].metadata.collections &&
-            options.output == "#collections-response-table") {
-          query_results.entities = response.entities[0].metadata.collections;
-        }
-      } catch (e) {
-        //do nothing, this is only to trap errors
-      }
-
-      if (listItemTemplate) {
-        $(output).html("");
-      }
-
-      var path = response.path || "";
-      path = "" + path.match(/[^?]*/);
-
-      for (i in query_results.entities) {
-        var entity = query_results.entities[i];
-        query_results.entities_by_id[entity.uuid] = entity;
-
-        var entity_path = (entity.metadata || {}).path;
-        if ($.isEmptyObject(entity_path)) {
-          entity_path = path + "/" + entity.uuid;
-        }
-
-        if (getListItem) {
-          t += getListItem(entity, entity_path);
-        }
-        else if (listItemTemplate) {
-          var options = null;
-          if (getListItemTemplateOptions) {
-            options = getListItemTemplateOptions(entity, entity_path);
-          }
-          if (!options) {
-            options = {entity: entity, path: entity_path};
-          }
-          $.tmpl(listItemTemplate, options).appendTo(output);
-        }
-      }
-
-      if (!listItemTemplate) {
-        $(output).html(t);
-      }
-
-      if (onRender) {
-        onRender();
-      }
-
-      if (prevButton) {
-        if (query_results.query.hasPrevious && query_results.query.hasPrevious()) {
-          $(prevButton).click(query_results.query.getPrevious);
-          $(prevButton).show();
-        }
-        else {
-          $(prevButton).hide();
-        }
-      }
-
-      if (nextButton) {
-        if (query_results.query.hasNext && query_results.query.hasNext()) {
-          $(nextButton).click(query_results.query.getNext);
-          $(nextButton).show();
-        }
-        else {
-          $(nextButton).hide();
-        }
-      }
-
-      if (nextPrevDiv) {
-        if (query_results.query.hasPrevious && query_results.query.hasNext && (query_results.query.hasPrevious() || query_results.query.hasNext())) {
-          $(nextPrevDiv).show();
-        }
-        else {
-          $(nextPrevDiv).hide();
-        }
-      }
-
-    } else if (response.entities && (response.entities.length == 0)) {
-      if (nextPrevDiv) {
-        $(nextPrevDiv).hide();
-      }
-      var s = null;
-      if (onNoEntities) {
-        s = onNoEntities();
-      }
-      $(output).html("<div class=\"query-response-empty\">" + (s ? s : noEntitiesMsg) + "</div>");
-      // This is a hack, will be fixed in API
-    } else if (response.error && (
-      (response.error.exception == "org.usergrid.services.exceptions.ServiceResourceNotFoundException: Service resource not found") ||
-        (response.error.exception == "java.lang.IllegalArgumentException: Not a valid entity value type or null: null"))) {
-      if (nextPrevDiv) {
-        $(nextPrevDiv).hide();
-      }
-      var s = null;
-      if (onError) {
-        s = onError();
-      }
-      $(output).html("<div class=\"query-response-empty\">" + (s ? s : noEntitiesMsg) + "</div>");
-
-    } else {
-      $(output).html(
-        "<pre class=\"query-response-json\">"
-          + JSON.stringify(response, null, "  ") + "</pre>");
-      if (nextPrevDiv) {
-        $(nextPrevDiv).hide();
-      }
-      if (onRawJson) {
-        onRawJson();
-      }
-    }
-
-    $(output).find(".button").button();
-
-    return query_results;
-  }
-  Usergrid.console.ui.displayEntityListResponse = displayEntityListResponse;
-
-})();


Mime
View raw message