Index: /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/editLicenseModal.html
===================================================================
--- /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/editLicenseModal.html	(revision 4586)
+++ /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/editLicenseModal.html	(revision 4587)
@@ -6,5 +6,5 @@
     </div>
     <div class="modal-body">
-        <div class="row" data-ng-if="workspace.collapsibleDetailPanels.license.licensesArrived &amp;&amp; !workspace.collapsibleDetailPanels.license.waitingForServerUpdate">
+        <div class="row" data-ng-if="workspace.licenseList != undefined &amp;&amp; !workspace.collapsibleDetailPanels.license.waitingForServerUpdate">
             <div class="col-sm-6">
                 <form name="workspace.collapsibleDetailPanels.license.editForm">
@@ -19,6 +19,6 @@
                             </p>
                             <div>
-                                <select id="license-select" name="input" class="form-control" data-ng-attr-size="{{((workspace.collapsibleDetailPanels.license.licenseList['sc:licenses']['sc:license'] | filter:filterLicenses).length) &lt; 2 ? 2 : ((workspace.collapsibleDetailPanels.license.licenseList['sc:licenses']['sc:license'] | filter:filterLicenses).length) + 1}}" data-ng-model="input.model" required="required">
-                                    <option ng-selected="license['xml:id'] == selectedSchema['sc:schema']['sc:license']['xml:id']" data-ng-repeat="license in workspace.collapsibleDetailPanels.license.licenseList['sc:licenses']['sc:license'] | filter:filterLicenses" value="{{license['xml:id']}}"  data-ng-bind="license['sc:full-name']" data-ng-click="showSelectedLicense(license)" title="{{license['sc:full-name']}}">
+                                <select id="license-select" name="input" class="form-control" data-ng-attr-size="{{((workspace.licenseList['sc:licenses']['sc:license'] | filter:filterLicenses).length) &lt; 2 ? 2 : ((workspace.licenseList['sc:licenses']['sc:license'] | filter:filterLicenses).length) + 1}}" data-ng-model="input.model" required="required">
+                                    <option ng-selected="license['xml:id'] == selectedSchema['sc:schema']['sc:license']['xml:id']" data-ng-repeat="license in workspace.licenseList['sc:licenses']['sc:license'] | filter:filterLicenses" value="{{license['xml:id']}}"  data-ng-bind="license['sc:full-name']" data-ng-click="showSelectedLicense(license)" title="{{license['sc:full-name']}}">
                                     </option>
                                 </select>
@@ -44,5 +44,5 @@
             </div>
         </div>
-        <div class="text-center" data-ng-if="!workspace.collapsibleDetailPanels.license.licensesArrived || workspace.collapsibleDetailPanels.license.waitingForServerUpdate">
+        <div class="text-center" data-ng-if="workspace.licenseList == undefined || workspace.collapsibleDetailPanels.license.waitingForServerUpdate">
             <div class="hidden-phone"><br/><br/></div>
             <img src="images/spinner.gif" alt="Loading..."/>
Index: /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.js
===================================================================
--- /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.js	(revision 4586)
+++ /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.js	(revision 4587)
@@ -34,4 +34,8 @@
     return json;
 }
+
+RegExp.escape = function(s) {
+    return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+};
 
 //SCHEMAcat angular controllers
@@ -214,5 +218,4 @@
         $scope.animateWorkspacePageChange = 'invisible';
 
-        $scope.workspace = {};
         $scope.location = location;
 
@@ -797,6 +800,4 @@
 ]);
 
-
-
 SCHEMAcat.controller('LicenseDetailsPanelCtrl', ['$scope', '$modal', '$location', '$timeout',
     'Schema', 'Licenses',
@@ -811,9 +812,19 @@
 
         $scope.filterLicenses = function(item) {
-            var regex = new RegExp($scope.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue, 'i');
-            if (item['sc:full-name'].match(regex) || item['xml:id'].match(regex) || $scope.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue === undefined) {
+            var filterTerm = $scope.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue;
+            if (filterTerm === undefined || filterTerm !== filterTerm) { //hack!! In javascript NaN is an object that is never equal to itself, so we use this to detect if an object is NaN. 
+                                                                         //Note that, despite the name, isNaN() function in javascript is meant to check whether a value cannot be coerced 
+                                                                         //to a number, thus it will always return 'true' for strings, which is not what we want. Use 'instanceof' doesn't 
+                                                                         //work since 'filterTerm' is mainly filled with javascript primitive types thus always returning 'false'.
+                                                                         //Another working possibility is 'typeof(NaN) === typeof(filterTerm)'
+                                                                         //For ECMAScript6 just use Number.isNaN(filterTerm) which checks if the variable is NaN. 
                 return true;
-            }
-            return false;
+            } else {
+                var regex = new RegExp(RegExp.escape(filterTerm), 'i');
+                if (item['sc:full-name'].match(regex) || item['xml:id'].match(regex)) {
+                    return true;
+                } else
+                    return false;
+            }
         };
 
@@ -884,16 +895,13 @@
                         originalLicenseValue = $scope.selectedSchema['sc:schema']['sc:license'];
 
-                    if ($scope.workspace.collapsibleDetailPanels.license.licenseList === undefined) {
-                        $scope.workspace.collapsibleDetailPanels.license.licensesArrived = false;
+                    if ($scope.workspace.licenseList === undefined) {
                         //get the list of licenses
                         Licenses.get(
                             function(result) {
-                                $scope.workspace.collapsibleDetailPanels.license.licenseList = result;
+                                $scope.workspace.licenseList = result;
                                 for (var i = 0; i < result['sc:licenses']['sc:license'].length; i++) {
                                     if (result['sc:licenses']['sc:license'][i]['xml:id'] === $scope.selectedSchema['sc:schema']['sc:license']['xml:id'])
-                                        $scope.input.model = $scope.workspace.collapsibleDetailPanels.license.licenseList['sc:licenses']['sc:license'][i]['xml:id'];
+                                        $scope.input.model = $scope.workspace.licenseList['sc:licenses']['sc:license'][i]['xml:id'];
                                 }
-                                $scope.workspace.collapsibleDetailPanels.license.licensesArrived = true;
-
                             });
                     }
Index: /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.min.js
===================================================================
--- /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.min.js	(revision 4586)
+++ /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.min.js	(revision 4587)
@@ -1,1 +1,1 @@
-"use strict";function prepareArrayForNgRepeat(a){var b;return b=a instanceof Array?a:new Array(a)}function isEmptyObj(a){if(a instanceof Object){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}return!1}function fixEmptyFields(a){if(isEmptyObj(a))return"";for(var b in a)a.hasOwnProperty(b)&&(isEmptyObj(a[b])?a[b]="":a[b]instanceof Object&&fixEmptyFields(a[b]));return a}SCHEMAcat.controller("WorkspaceCtrl",["$scope","$location","$routeParams","$timeout","SchemasList","Schema","UserService","Settings",function(a,b,c,d,e,f,g,h){function i(c){return isNaN(parseInt(c,10))||1>c?(b.path("workspace/page/1/").search({schemaIndex:0}),void 0):(e.get({userID:g.id,startPage:c,pageSize:a.pageSize},function(d){return c>Math.ceil(d["sc:result"]["sc:total-schemas"]/a.pageSize)?(b.path("workspace/page/1/").search({schemaIndex:0}),void 0):(q.totalSchemaItems=d["sc:result"]["sc:total-schemas"],q.currentPage=Number(c),q.schemasList=prepareArrayForNgRepeat(d["sc:result"]["sc:schemas"]["sc:schema"]),j(b.search().schemaIndex),q.schemasResult=fixEmptyFields(d),void 0)}),void 0)}function j(c){if("invisible"!==a.animateWorkspacePageChange&&(a.animateSchemaChange="invisible"),isNaN(parseInt(c,10))||0>c||c>a.schemasList.length-1)return a.selectedSchemaIndex=void 0,b.search({schemaIndex:0}),void 0;a.selectedSchemaIndex=c;var d=q.schemasList[Number(c)];f.get({schemaID:d["xml:id"]},function(b){if(q.filesList=prepareArrayForNgRepeat(b["sc:schema"]["sc:files"]["sc:file"]),q.selectedSchema=fixEmptyFields(b),q.schemaEditable=g.id===k()||-1!==g.roles.indexOf("admin"),q.resultHasArrived=!0,h.getAnimationStatus())switch(a.toNextSchema){case!0:a.animateSchemaChange="animated fadeInUp";break;case!1:a.animateSchemaChange="animated fadeInDown";break;case void 0:a.animateSchemaChange="animated fadeInDown"}else a.animateSchemaChange=""})}function k(){var a,b=prepareArrayForNgRepeat(q.selectedSchema["sc:schema"]["sc:access"]["sc:user"]);for(var c in b)"owner"===b[c].role&&(a=b[c].ref);return a}function l(){a.workspace.namePanel.updateEditingName(),a.workspace.descriptionPanel.updateEditingDescription(),m()}function m(){var a=!1;for(var c in r)b.search().hasOwnProperty(r[c])&&(p(c),a=!0);a||n("")}function n(b){for(var c in a.workspace.collapsibleDetailPanels)if(c!==b&&(a.workspace.collapsibleDetailPanels[c].detailButtonTooltip="Show field details",a.workspace.collapsibleDetailPanels[c].open===!0))return o(c),!0;return!1}function o(b){(a.workspace.collapsibleDetailPanels[b].editForm&&a.workspace.collapsibleDetailPanels[b].editForm.$dirty||a.workspace.collapsibleDetailPanels[b].modelDirty)&&(a.workspace.collapsibleDetailPanels[b].detailButtonTooltip+=" (there are unsaved changes in this field!)"),a.workspace.collapsibleDetailPanels[b].open=!1}function p(b){function c(b){void 0!==a.workspace.collapsibleDetailPanels[b]&&void 0!==a.workspace.collapsibleDetailPanels[b].updateEditPanel&&a.workspace.collapsibleDetailPanels[b].updateEditPanel(),a.workspace.collapsibleDetailPanels[b].detailButtonTooltip="Hide field details",a.workspace.collapsibleDetailPanels[b].open=!0}r.hasOwnProperty(b)&&(n(b)?d(function(){c(b)},350):c(b))}var q=a.$parent;q.pageSize=10;var r={version:"showVersionDetails",status:"showStatusDetails",access:"showAccessDetails",license:"showLicenseDetails"};a.selectedSchemaIndex=c.schemaIndex,a.animateWorkspacePageChange="invisible",a.workspace={},a.location=location,q.workspaceFullyLoaded||i(c.pageNumber),a.selectPage=function(a){b.search().schemaIndex="0",delete b.search().show,b.path("workspace.html/page/"+a+"/").search(b.search())},a.selectSchema=function(a){b.search().schemaIndex=a.toString(),delete b.search().show,b.search(b.search())},a.toggleDetailsPanel=function(a){var c=r[a];if(b.search()[c])delete b.search()[c];else{for(var d in r)r[d]!==c&&delete b.search()[r[d]];b.search()[r[a]]=!0}b.search(b.search())},a.$on("$routeChangeStart",function(b,c,d){if(q.resultHasArrived=!1,h.getAnimationStatus())switch(q.toNextPage=void 0!==c.params&&void 0!==c.params.pageNumber&&c.params.pageNumber>d.params.pageNumber?!0:!1,c.templateUrl){case"partials/workspace.html":a.animateWorkspacePageChange=q.toNextPage?"animated slideOutLeft":"animated slideOutRight";break;case"partials/contact.html":case"partials/about.html":a.animateWorkspacePageChange="animated slideOutLeft";break;default:a.animateWorkspacePageChange="animated fadeOutDown"}"partials/workspace.html"===c.templateUrl?i(c.params.pageNumber):q.workspaceFullyLoaded=!1}),a.$on("$routeChangeSuccess",function(a,b,c){h.getAnimationStatus()&&(void 0===c||void 0===c.templateUrl||"partials/accountDetails.html"===c.templateUrl)&&(q.toNextPage=void 0)}),a.$on("$routeUpdate",function(b,c){if("partials/workspace.html"===c.templateUrl&&c.params.schemaIndex!==a.selectedSchemaIndex){q.resultHasArrived=!1,h.getAnimationStatus()?(a.toNextSchema=c.params.schemaIndex>a.selectedSchemaIndex?!0:!1,a.animateSchemaChange=a.toNextSchema?"animated fadeOutUp":"animated fadeOutDown",d(function(){j(c.params.schemaIndex)},250)):j(c.params.schemaIndex);var e=a.$watch("resultHasArrived",function(a){a&&(l(),e())})}else l()});var s=a.$watch("resultHasArrived",function(b){if(b){if(h.getAnimationStatus()){switch(q.toNextPage){case!1:a.animateWorkspacePageChange="animated slideInLeft";break;case!0:a.animateWorkspacePageChange="animated slideInRight";break;default:a.animateWorkspacePageChange="animated fadeInDown"}d(function(){a.animateWorkspacePageChange=""},250)}else a.animateWorkspacePageChange="";l(),q.workspaceFullyLoaded=!0,s()}})}]),SCHEMAcat.controller("NamePanelCtrl",["$scope","$location","$timeout","Schema",function(a,b,c,d){a.workspace.namePanel={};var e;a.workspace.namePanel.updateEditingName=function(){b.search().editingName?a.schemaEditable?(a.workspace.namePanel.editButtonTooltip="Hide edit name",void 0===e&&(e=a.selectedSchema["sc:schema"]["sc:name"]),a.workspace.namePanel.editForm.open=!0):(delete b.search().editingName,a.workspace.namePanel.editButtonTooltip="Edit schema name",a.workspace.namePanel.editForm.input.$dirty&&(a.workspace.namePanel.editButtonTooltip+=" (there are unsaved changes in this field!)"),b.search(b.search())):(a.workspace.namePanel.editForm.open=!1,a.workspace.namePanel.editButtonTooltip="Edit schema name",a.workspace.namePanel.editForm.input.$dirty&&(a.workspace.namePanel.editButtonTooltip+=" (there are unsaved changes in this field!)")),a.workspace.namePanel.updateAjaxError=!1},a.saveName=function(){var c=a.selectedSchema["sc:schema"]["sc:name"],f=new d;a.workspace.namePanel.waitingForServerUpdate=!0,a.workspace.namePanel.updateAjaxError=!1,f.name=c,f.$save({schemaID:a.schemasList[a.selectedSchemaIndex]["xml:id"],schemaField:"name"},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:name"]=fixEmptyFields(c["sc:response"]["sc:written-data"]["sc:name"]),e=c["sc:response"]["sc:written-data"]["sc:name"],a.workspace.namePanel.waitingForServerUpdate=!1,a.workspace.namePanel.editForm.$setPristine(),delete b.search().editingName,b.search(b.search())):(a.workspace.namePanel.waitingForServerUpdate=!1,a.workspace.namePanel.updateAjaxError=!0)},function(){a.workspace.namePanel.waitingForServerUpdate=!1,a.workspace.namePanel.updateAjaxError=!0})},a.toggleEditName=function(d){if(b.search().editingName){if(delete b.search().editingName,d)return c(function(){a.selectedSchema["sc:schema"]["sc:name"]=e,a.workspace.namePanel.editForm.$setPristine(),a.$apply(),b.search(b.search())},150),void 0}else b.search().editingName=!0;b.search(b.search())}}]),SCHEMAcat.controller("DescriptionPanelCtrl",["$scope","$location","$timeout","Schema",function(a,b,c,d){a.workspace.descriptionPanel={};var e;a.workspace.descriptionPanel.updateEditingDescription=function(){b.search().editingDescription?a.schemaEditable?(a.workspaceFullyLoaded&&a.$broadcast("autosizeTextarea.resize"),a.workspace.descriptionPanel.editButtonTooltip="Hide edit description",void 0===e&&(e=a.selectedSchema["sc:schema"]["sc:description"]),a.workspace.descriptionPanel.editForm.open=!0):(delete b.search().editingDescription,a.workspace.descriptionPanel.editButtonTooltip="Edit description",a.workspace.descriptionPanel.editForm.input.$dirty&&(a.workspace.descriptionPanel.editButtonTooltip+=" (there are unsaved changes in this field!)"),b.search(b.search())):(a.workspace.descriptionPanel.editForm.open=!1,a.workspace.descriptionPanel.editButtonTooltip="Edit description",a.workspace.descriptionPanel.editForm.input.$dirty&&(a.workspace.descriptionPanel.editButtonTooltip+=" (there are unsaved changes in this field!)")),a.workspace.descriptionPanel.updateAjaxError=!1},a.saveDescription=function(){var c=a.selectedSchema["sc:schema"]["sc:description"],f=new d;a.workspace.descriptionPanel.waitingForServerUpdate=!0,a.workspace.descriptionPanel.updateAjaxError=!1,f.description=c,f.$save({schemaID:a.schemasList[a.selectedSchemaIndex]["xml:id"],schemaField:"description"},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:description"]=fixEmptyFields(c["sc:response"]["sc:written-data"]["sc:description"]),e=c["sc:response"]["sc:written-data"]["sc:description"],a.workspace.descriptionPanel.waitingForServerUpdate=!1,a.workspace.descriptionPanel.editForm.$setPristine(),delete b.search().editingDescription,b.search(b.search())):(a.workspace.descriptionPanel.waitingForServerUpdate=!1,a.workspace.descriptionPanel.updateAjaxError=!0)},function(){a.workspace.descriptionPanel.waitingForServerUpdate=!1,a.workspace.descriptionPanel.updateAjaxError=!0})},a.toggleEditDescription=function(d){if(b.search().editingDescription){if(delete b.search().editingDescription,d)return c(function(){a.selectedSchema["sc:schema"]["sc:description"]=e,a.workspace.descriptionPanel.editForm.$setPristine(),a.$apply(),b.search(b.search())},150),void 0}else b.search().editingDescription=!0;b.search(b.search())}}]),SCHEMAcat.controller("VersionDetailsPanelCtrl",["$scope","$location","$timeout","Schema",function(a,b,c,d){a.workspace.collapsibleDetailPanels.version={},a.workspace.collapsibleDetailPanels.version.editPanel={},a.workspace.collapsibleDetailPanels.version.editPanel.open=!1;var e;a.toggleEditVersion=function(d){if(b.search().editingVersion){if(delete b.search().editingVersion,d)return c(function(){a.workspace.collapsibleDetailPanels.version.editForm.$setPristine(),a.$apply(),b.search(b.search()),a.workspace.collapsibleDetailPanels.version.resettingUpdate=!0,c(function(){a.selectedSchema["sc:schema"]["sc:version"]=e,a.workspace.collapsibleDetailPanels.version.resettingUpdate=!1},350)},150),void 0}else b.search().editingVersion=!0;b.search(b.search())},a.workspace.collapsibleDetailPanels.version.updateEditPanel=function(){b.search().editingVersion?a.schemaEditable?(a.workspace.collapsibleDetailPanels.version.editButtonTooltip="Hide edit panel",void 0===e&&(e=a.selectedSchema["sc:schema"]["sc:version"]),a.workspace.collapsibleDetailPanels.version.editPanel.open=!0):(delete b.search().editingVersion,a.workspace.collapsibleDetailPanels.version.editButtonTooltip="Change schema version",a.workspace.collapsibleDetailPanels.version.editForm&&a.workspace.collapsibleDetailPanels.version.editForm.input.$dirty&&(a.workspace.collapsibleDetailPanels.version.editButtonTooltip+=" (there are unsaved changes in this field!)"),b.search(b.search())):(a.workspace.collapsibleDetailPanels.version.editPanel.open=!1,a.workspace.collapsibleDetailPanels.version.editButtonTooltip="Change schema version",a.workspace.collapsibleDetailPanels.version.editForm&&a.workspace.collapsibleDetailPanels.version.editForm.input.$dirty&&(a.workspace.collapsibleDetailPanels.version.editButtonTooltip+=" (there are unsaved changes in this field!)")),a.workspace.collapsibleDetailPanels.version.updateAjaxError=!1},a.saveVersion=function(){var c=a.selectedSchema["sc:schema"]["sc:version"],f=new d;a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.version.updateAjaxError=!1,f.version=c,f.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"version"},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:version"]=fixEmptyFields(c["sc:response"]["sc:written-data"]["sc:version"]),e=a.selectedSchema["sc:schema"]["sc:version"],a.schemasList[a.selectedSchemaIndex]["sc:version"]=e,a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.version.editForm.$setPristine(),delete b.search().editingVersion,b.search(b.search())):(a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.version.updateAjaxError=!0)},function(){a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.version.updateAjaxError=!0})}}]),SCHEMAcat.controller("StatusDetailsPanelCtrl",["$scope","$location","Schema",function(a,b,c){a.workspace.collapsibleDetailPanels.status={},a.workspace.collapsibleDetailPanels.status.editPanel={},a.workspace.collapsibleDetailPanels.status.editPanel.open=!1,a.workspace.collapsibleDetailPanels.status.possibleStatusList=[];var d=["development"],e=["production"],f=["deprecated","superseeded"];a.toggleEditStatus=function(){b.search().editingStatus?delete b.search().editingStatus:b.search().editingStatus=!0,b.search(b.search())},a.workspace.collapsibleDetailPanels.status.updateEditPanel=function(){b.search().editingStatus?a.schemaEditable?(a.workspace.collapsibleDetailPanels.status.possibleStatusList=a.selectedSchema["sc:schema"]["sc:access"]["sc:all"]&&"r"===a.selectedSchema["sc:schema"]["sc:access"]["sc:all"].actions?e.concat(f):d.concat(f),a.workspace.collapsibleDetailPanels.status.editPanel.open=!0):(delete b.search().editingStatus,b.search(b.search())):a.workspace.collapsibleDetailPanels.status.editPanel.open=!1,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!1},a.saveStatus=function(){var b=a.selectedSchema["sc:schema"]["sc:status"],d=new c;a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!1,d.status=b,d.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"status"},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:status"]=fixEmptyFields(b["sc:response"]["sc:written-data"]["sc:status"]),a.schemasList[a.selectedSchemaIndex]["sc:status"]=a.selectedSchema["sc:schema"]["sc:status"],a.workspace.collapsibleDetailPanels.status.editForm.$setPristine(),a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!1):(a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!0)},function(){a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!0})}}]),SCHEMAcat.controller("AccessDetailsPanelCtrl",["$scope","$location","Schema",function(a,b,c){a.workspace.collapsibleDetailPanels.access={},a.workspace.collapsibleDetailPanels.access.editPanel={},a.workspace.collapsibleDetailPanels.access.editPanel.open=!1,a.currentAccessPolicy="",a.toggleEditAccess=function(){b.search().editingAccess?delete b.search().editingAccess:b.search().editingAccess=!0,b.search(b.search())},a.workspace.collapsibleDetailPanels.access.updateEditPanel=function(){b.search().editingAccess?a.schemaEditable?(a.currentAccessPolicy=a.workspace.collapsibleDetailPanels.access.getAccessPolicy(),a.workspace.collapsibleDetailPanels.access.editPanel.open=!0):(delete b.search().editingAccess,b.search(b.search())):a.workspace.collapsibleDetailPanels.access.editPanel.open=!1,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!1},a.workspace.collapsibleDetailPanels.access.getAccessPolicy=function(){return void 0!==a.selectedSchema["sc:schema"]["sc:access"]["sc:all"]&&"r"===a.selectedSchema["sc:schema"]["sc:access"]["sc:all"].actions?"shareURL":"private"},a.saveAccessStatus=function(b){var d=a.selectedSchema["sc:schema"]["sc:access"]["sc:user"],e=new c;switch(a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!1,b){case"shareURL":e.access={all:{actions:"r"},user:d};break;case"private":e.access={user:d}}e.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"access"},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:access"]=b["sc:response"]["sc:written-data"]["sc:access"],a.workspace.collapsibleDetailPanels.access.editForm.$setPristine(),a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!1):(a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!0),a.currentAccessPolicy=a.workspace.collapsibleDetailPanels.access.getAccessPolicy()},function(){a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!0,a.currentAccessPolicy=a.workspace.collapsibleDetailPanels.access.getAccessPolicy()})}}]),SCHEMAcat.controller("LicenseDetailsPanelCtrl",["$scope","$modal","$location","$timeout","Schema","Licenses",function(a,b,c,d,e,f){function i(){h=b.open({scope:a,templateUrl:"partials/editLicenseModal.html"}),h.result.then(function(){h=void 0},function(b){h=void 0,"dismiss"!==b&&a.triggerCloseModalRoute()})}a.workspace.collapsibleDetailPanels.license={},a.input={};var g,h;a.filterLicenses=function(b){var c=new RegExp(a.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue,"i");return b["sc:full-name"].match(c)||b["xml:id"].match(c)||void 0===a.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue?!0:!1},a.showSelectedLicense=function(b){a.selectedSchema["sc:schema"]["sc:license"]["xml:id"]!==b["xml:id"]&&(a.workspace.collapsibleDetailPanels.license.modelDirty=!0,a.workspace.collapsibleDetailPanels.license.updatingLicense=!0,d(function(){a.selectedSchema["sc:schema"]["sc:license"]=b,a.workspace.collapsibleDetailPanels.license.updatingLicense=!1},250))},a.saveNewLicense=function(){var b=a.selectedSchema["sc:schema"]["sc:license"],c=new e;a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.license.updateAjaxError=!1,c.license=b["xml:id"],c.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"license"},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success&&b["sc:response"]["sc:written-data"]["sc:license"].ref===a.selectedSchema["sc:schema"]["sc:license"]["xml:id"]?(g=a.selectedSchema["sc:schema"]["sc:license"],a.workspace.collapsibleDetailPanels.license.modelDirty=!1,a.workspace.collapsibleDetailPanels.license.editForm.$setPristine(),a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!1,a.triggerCloseModalRoute()):(a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.license.updateAjaxError=!0)},function(){a.selectedSchema["sc:schema"]["sc:license"]=g,a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.license.updateAjaxError=!0})},a.triggerOpenModalRoute=function(){c.search().editingLicense||(c.search().editingLicense=!0,c.search(c.search()))},a.triggerCloseModalRoute=function(){c.search().editingLicense&&(delete c.search().editingLicense,c.search(c.search()))},a.workspace.collapsibleDetailPanels.license.updateEditPanel=function(){c.search().editingLicense?a.schemaEditable?(void 0===g&&(g=a.selectedSchema["sc:schema"]["sc:license"]),void 0===a.workspace.collapsibleDetailPanels.license.licenseList&&(a.workspace.collapsibleDetailPanels.license.licensesArrived=!1,f.get(function(b){a.workspace.collapsibleDetailPanels.license.licenseList=b;for(var c=0;c<b["sc:licenses"]["sc:license"].length;c++)b["sc:licenses"]["sc:license"][c]["xml:id"]===a.selectedSchema["sc:schema"]["sc:license"]["xml:id"]&&(a.input.model=a.workspace.collapsibleDetailPanels.license.licenseList["sc:licenses"]["sc:license"][c]["xml:id"]);a.workspace.collapsibleDetailPanels.license.licensesArrived=!0})),i()):(a.workspace.collapsibleDetailPanels.license.editButtonTooltip="Change schema license",a.workspace.collapsibleDetailPanels.license.editForm&&a.workspace.collapsibleDetailPanels.license.modelDirty&&(a.workspace.collapsibleDetailPanels.license.editButtonTooltip+=" (there are unsaved changes in this field!)"),a.triggerCloseModalRoute()):void 0!==h&&h.dismiss("dismiss"),a.workspace.collapsibleDetailPanels.license.editButtonTooltip="Change schema license",a.workspace.collapsibleDetailPanels.license.editForm&&a.workspace.collapsibleDetailPanels.license.modelDirty&&(a.workspace.collapsibleDetailPanels.license.editButtonTooltip+=" (there are unsaved changes in this field!)")},a.cancelEdit=function(){a.workspace.collapsibleDetailPanels.license.modelDirty&&(a.workspace.collapsibleDetailPanels.license.updatingLicense=!0,a.workspace.collapsibleDetailPanels.license.modelDirty=!1,d(function(){a.selectedSchema["sc:schema"]["sc:license"]=g,a.workspace.collapsibleDetailPanels.license.updatingLicense=!1},250),a.workspace.collapsibleDetailPanels.license.editForm.$setPristine()),a.triggerCloseModalRoute()}}]),SCHEMAcat.controller("FileController",["$scope","$http","$timeout","$location",function(a,b,c,d){function e(){void 0!==d.search().show&&-1!==d.search().show.indexOf(a.file["sc:name"])?(a.showSchemaBtn=!0,f(a.selectedSchema["sc:schema"]["xml:id"],a.file["sc:name"])):(a.showSchemaBtn=!1,a.file.open=!1)}function f(d,e){void 0===a.schemaFileContent?b.get("/schemacat/schemas/"+d+"/files/"+e).success(function(b){a.prettify="prettyprint linenums",c(function(){prettyPrint(),a.file.open=!0}),a.schemaFileContent=b}).error(function(){a.showSchemaBtn=!1,a.showFile(e),a.showFileAjaxError=!0}):a.file.open=!0}e(),a.showFile=function(b){a.showFileAjaxError=!1,c(function(){var c=d.search();if(a.showSchemaBtn===!0)void 0===c.show?c.show="#"+b:-1===c.show.indexOf(b)&&(c.show=c.show+"#"+b);else for(var e in c)if("show"===e){var f=c[e].split("#");for(var g in f)f[g]===b&&f.splice(g,1);var h=f.join("#");""!==h?c[e]=h:delete c[e]}d.search(c)})},a.$on("$routeUpdate",function(){a.resultHasArrived&&e()})}]),SCHEMAcat.controller("TopMenuCtrl",["$scope","$modal","$location","UserService","Settings","ShibService",function(a,b,c,d,e,f){function g(){a.topMenuCollapsed=!c.search().topMenuExpanded,e.setAnimationStatus(!c.search().animationsDisabled),a.animationsChecked=e.getAnimationStatus()}a.displayName=d.displayName,a.shibURL=f.url,a.$watch(function(){return d.displayName},function(b,c){b!==c&&(a.displayName=b)}),g(),a.isActive=function(a){return"/workspace.html"===a&&-1!==c.path().indexOf("/workspace.html/")?!0:a===c.path()},a.updateAnimationStatus=function(){c.search().animationsDisabled?delete c.search().animationsDisabled:c.search().animationsDisabled=!0,c.search(c.search())},a.toggleTopMenu=function(){c.search().topMenuExpanded?delete c.search().topMenuExpanded:c.search().topMenuExpanded=!0,c.search(c.search())},a.animationsUrlPart=function(){return c.search().animationsDisabled?"animationsDisabled":""},a.topMenuExpandedUrlPart=function(){return c.search().topMenuExpanded?"topMenuExpanded":""},a.$on("$routeUpdate",function(){g()}),a.loginClick=function(){var c=b.open({scope:a,templateUrl:"partials/loginModal.html",controller:"LoginModalCtrl"});c.result.then(function(a){alert("Now set the user cookie to ["+a+"]"),document.cookie="USER="+a+";domain=;path=/",document.location.hash="",document.location.reload(!0)})}}]),SCHEMAcat.controller("LoginModalCtrl",["$scope","$modalInstance",function(a,b){a.loginClose=function(){b.dismiss("cancel")},a.loginSubmit=function(){b.close(this.loginNameInput.text)}}]),SCHEMAcat.controller("AboutPageCtrl",["$scope","Settings",function(a,b){a.$parent.toNextPage=!1,b.getAnimationStatus()&&(a.animateInOut="animated slideInRight"),a.$on("$routeChangeStart",function(c,d){if(b.getAnimationStatus())switch(d.templateUrl){case"partials/workspace.html":a.animateInOut="animated slideOutRight";break;case"partials/contact.html":a.animateInOut="animated slideOutLeft";break;default:a.animateInOut="animated fadeOutDown"}}),a.$on("$routeChangeSuccess",function(c,d,e){if(b.getAnimationStatus()){var f=void 0!==e?e.templateUrl:void 0;switch(f){case"partials/workspace.html":a.animateInOut="animated slideInRight";break;case"partials/contact.html":a.animateInOut="animated slideInLeft";break;default:a.animateInOut="animated fadeInDown"}}})}]),SCHEMAcat.controller("ContactPageCtrl",["$scope","Settings",function(a,b){a.$parent.toNextPage=!1,b.getAnimationStatus()&&(a.animateInOut="animated slideInRight"),a.$on("$routeChangeStart",function(c,d){if(b.getAnimationStatus())switch(d.templateUrl){case"partials/about.html":case"partials/contact.html":case"partials/workspace.html":a.animateInOut="animated slideOutRight";break;default:a.animateInOut="animated fadeOutDown"}}),a.$on("$routeChangeSuccess",function(c,d,e){if(b.getAnimationStatus()){var f=void 0!==e?e.templateUrl:void 0;switch(f){case"partials/about.html":case"partials/contact.html":case"partials/workspace.html":a.animateInOut="animated slideInRight";break;default:a.animateInOut="animated fadeInDown"}}})}]),SCHEMAcat.controller("AccountDetailsPageCtrl",["$scope","$location","User","UserService","Settings",function(a,b,c,d,e){function f(){var a=b.search();for(var c in a)if("editingEmail"===c){for(var e=a[c].split("#"),f=0;f<e.length;f++){for(var g=!1,h=0;h<d.email.length;h++)e[f]===d.email[h]&&(g=!0);g||e.splice(f,1)}var i=e.join("#");""!==i?a[c]=i:delete a[c]}b.search(a)}function g(){a.waitingForServerEditDisplayName=!1,a.editDisplayNameAjaxError=!1,b.search().editingDisplayName?(a.editDisplayNameText=a.displayName,a.editingDisplayName=!0):a.editingDisplayName=!1}function h(){a.waitingForServer=!1,a.addingEmail=b.search().addingEmail?!0:!1}a.principal=d.principal,a.displayName=d.displayName,a.email=d.email,a.addingEmail=!1,a.addNewEmail=function(){b.search().addingEmail=!0,b.search(b.search())},a.terminateAddEmail=function(){a.ajaxError=!1,delete b.search().addingEmail,b.search(b.search())},a.addEmail=function(b){a.waitingForServer=!0;var e=new c;e.emails=d.email.slice(0),e.emails.push(b),e.$save({userID:d.id},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(d.email.push(b),a.terminateAddEmail()):(a.waitingForServer=!1,a.ajaxError=!0)},function(){a.waitingForServer=!1,a.ajaxError=!0})},a.editDisplayName=function(){b.search().editingDisplayName=!0,b.search(b.search())},a.terminateEditDisplayName=function(){delete b.search().editingDisplayName,b.search(b.search())},a.updateDisplayName=function(b){a.waitingForServerEditDisplayName=!0;var e=new c;e.displayName=b,e.$save({userID:d.id},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.displayName=d.displayName=b,a.terminateEditDisplayName()):(a.waitingForServerEditDisplayName=!1,a.editDisplayNameAjaxError=!0)},function(){a.waitingForServerEditDisplayName=!1,a.editDisplayNameAjaxError=!0})},e.getAnimationStatus()&&(a.animateAccountDetails="animated fadeInDown"),a.$on("$routeChangeStart",function(){e.getAnimationStatus()&&(a.animateAccountDetails="animated fadeOutUp")}),a.$on("$routeChangeSuccess",function(){e.getAnimationStatus()&&(a.animateAccountDetails="animated fadeInDown"),h(),g(),f()}),a.$on("$routeUpdate",function(){h(),g(),f()})}]),SCHEMAcat.controller("EmailInstanceCtrl",["$scope","$location","User","UserService",function(a,b,c,d){function e(){a.waitingForServerEditEmail=!1,void 0!==b.search().editingEmail&&-1!==b.search().editingEmail.indexOf(a.emailInstance)?(a.editEmailText=a.emailInstance,a.editingEmail=!0):a.editingEmail=!1}e(),a.editEmail=function(c){var d=b.search();a.removeEmailAjaxError=!1,d.editingEmail=void 0===d.editingEmail?c:b.search().editingEmail+"#"+c,b.search(d)},a.removeEmail=function(b){a.waitingForServerEditEmail=!0;var e=new c;e.emails=d.email.slice(0),e.emails.splice(b,1),e.$save({userID:d.id},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?d.email.splice(b,1):(a.waitingForServerEditEmail=!1,a.removeEmailAjaxError=!0)},function(){a.waitingForServerEditEmail=!1,a.removeEmailAjaxError=!0})},a.updateEmail=function(b){a.waitingForServerEditEmail=!0;var e=new c;e.emails=d.email.slice(0),e.emails[b]=a.editEmailText,e.$save({userID:d.id},function(c){if(void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success){var e=a.editEmailText;a.cancelEditEmail(d.email[b]),d.email[b]=e}else a.waitingForServerEditEmail=!1,a.editEmailAjaxError=!0},function(){a.waitingForServerEditEmail=!1,a.editEmailAjaxError=!0})},a.cancelEditEmail=function(c){var d=b.search();a.editEmailAjaxError=!1;for(var e in d)if("editingEmail"===e){var f=d[e].split("#");for(var g in f)f[g]===c&&f.splice(g,1);var h=f.join("#");""!==h?d[e]=h:delete d[e]}b.search(d)},a.$on("$routeChangeSuccess",function(){e()}),a.$on("$routeUpdate",function(){e()})}]),SCHEMAcat.controller("CompleteUserDetailsCtrl",["$scope","$modal",function(a,b){a.ajaxError=!1,a.waitingForServer=!1,b.open({scope:a,backdrop:"static",keyboard:!1,templateUrl:"partials/fillDetailsModal.html",controller:"CompleteUserDetailsModalCtrl"})}]),SCHEMAcat.controller("CompleteUserDetailsModalCtrl",["$scope","$modalInstance","User","UserService",function(a,b,c,d){a.userDetailsSubmit=function(){a.waitingForServer=!0,a.ajaxError=!1;var b=new c;b.emails=[],b.emails[0]=this.emailInput.text,b.displayName=this.displayNameInput.text,b.$save({userID:d.id},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success?document.location.pathname="schemacat/site/index.html":(a.waitingForServer=!1,a.ajaxError=!0)},function(){a.waitingForServer=!1,a.ajaxError=!0})}}]);
+"use strict";function prepareArrayForNgRepeat(a){var b;return b=a instanceof Array?a:new Array(a)}function isEmptyObj(a){if(a instanceof Object){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}return!1}function fixEmptyFields(a){if(isEmptyObj(a))return"";for(var b in a)a.hasOwnProperty(b)&&(isEmptyObj(a[b])?a[b]="":a[b]instanceof Object&&fixEmptyFields(a[b]));return a}RegExp.escape=function(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},SCHEMAcat.controller("WorkspaceCtrl",["$scope","$location","$routeParams","$timeout","SchemasList","Schema","UserService","Settings",function(a,b,c,d,e,f,g,h){function i(c){return isNaN(parseInt(c,10))||1>c?(b.path("workspace/page/1/").search({schemaIndex:0}),void 0):(e.get({userID:g.id,startPage:c,pageSize:a.pageSize},function(d){return c>Math.ceil(d["sc:result"]["sc:total-schemas"]/a.pageSize)?(b.path("workspace/page/1/").search({schemaIndex:0}),void 0):(q.totalSchemaItems=d["sc:result"]["sc:total-schemas"],q.currentPage=Number(c),q.schemasList=prepareArrayForNgRepeat(d["sc:result"]["sc:schemas"]["sc:schema"]),j(b.search().schemaIndex),q.schemasResult=fixEmptyFields(d),void 0)}),void 0)}function j(c){if("invisible"!==a.animateWorkspacePageChange&&(a.animateSchemaChange="invisible"),isNaN(parseInt(c,10))||0>c||c>a.schemasList.length-1)return a.selectedSchemaIndex=void 0,b.search({schemaIndex:0}),void 0;a.selectedSchemaIndex=c;var d=q.schemasList[Number(c)];f.get({schemaID:d["xml:id"]},function(b){if(q.filesList=prepareArrayForNgRepeat(b["sc:schema"]["sc:files"]["sc:file"]),q.selectedSchema=fixEmptyFields(b),q.schemaEditable=g.id===k()||-1!==g.roles.indexOf("admin"),q.resultHasArrived=!0,h.getAnimationStatus())switch(a.toNextSchema){case!0:a.animateSchemaChange="animated fadeInUp";break;case!1:a.animateSchemaChange="animated fadeInDown";break;case void 0:a.animateSchemaChange="animated fadeInDown"}else a.animateSchemaChange=""})}function k(){var a,b=prepareArrayForNgRepeat(q.selectedSchema["sc:schema"]["sc:access"]["sc:user"]);for(var c in b)"owner"===b[c].role&&(a=b[c].ref);return a}function l(){a.workspace.namePanel.updateEditingName(),a.workspace.descriptionPanel.updateEditingDescription(),m()}function m(){var a=!1;for(var c in r)b.search().hasOwnProperty(r[c])&&(p(c),a=!0);a||n("")}function n(b){for(var c in a.workspace.collapsibleDetailPanels)if(c!==b&&(a.workspace.collapsibleDetailPanels[c].detailButtonTooltip="Show field details",a.workspace.collapsibleDetailPanels[c].open===!0))return o(c),!0;return!1}function o(b){(a.workspace.collapsibleDetailPanels[b].editForm&&a.workspace.collapsibleDetailPanels[b].editForm.$dirty||a.workspace.collapsibleDetailPanels[b].modelDirty)&&(a.workspace.collapsibleDetailPanels[b].detailButtonTooltip+=" (there are unsaved changes in this field!)"),a.workspace.collapsibleDetailPanels[b].open=!1}function p(b){function c(b){void 0!==a.workspace.collapsibleDetailPanels[b]&&void 0!==a.workspace.collapsibleDetailPanels[b].updateEditPanel&&a.workspace.collapsibleDetailPanels[b].updateEditPanel(),a.workspace.collapsibleDetailPanels[b].detailButtonTooltip="Hide field details",a.workspace.collapsibleDetailPanels[b].open=!0}r.hasOwnProperty(b)&&(n(b)?d(function(){c(b)},350):c(b))}var q=a.$parent;q.pageSize=10;var r={version:"showVersionDetails",status:"showStatusDetails",access:"showAccessDetails",license:"showLicenseDetails"};a.selectedSchemaIndex=c.schemaIndex,a.animateWorkspacePageChange="invisible",a.location=location,q.workspaceFullyLoaded||i(c.pageNumber),a.selectPage=function(a){b.search().schemaIndex="0",delete b.search().show,b.path("workspace.html/page/"+a+"/").search(b.search())},a.selectSchema=function(a){b.search().schemaIndex=a.toString(),delete b.search().show,b.search(b.search())},a.toggleDetailsPanel=function(a){var c=r[a];if(b.search()[c])delete b.search()[c];else{for(var d in r)r[d]!==c&&delete b.search()[r[d]];b.search()[r[a]]=!0}b.search(b.search())},a.$on("$routeChangeStart",function(b,c,d){if(q.resultHasArrived=!1,h.getAnimationStatus())switch(q.toNextPage=void 0!==c.params&&void 0!==c.params.pageNumber&&c.params.pageNumber>d.params.pageNumber?!0:!1,c.templateUrl){case"partials/workspace.html":a.animateWorkspacePageChange=q.toNextPage?"animated slideOutLeft":"animated slideOutRight";break;case"partials/contact.html":case"partials/about.html":a.animateWorkspacePageChange="animated slideOutLeft";break;default:a.animateWorkspacePageChange="animated fadeOutDown"}"partials/workspace.html"===c.templateUrl?i(c.params.pageNumber):q.workspaceFullyLoaded=!1}),a.$on("$routeChangeSuccess",function(a,b,c){h.getAnimationStatus()&&(void 0===c||void 0===c.templateUrl||"partials/accountDetails.html"===c.templateUrl)&&(q.toNextPage=void 0)}),a.$on("$routeUpdate",function(b,c){if("partials/workspace.html"===c.templateUrl&&c.params.schemaIndex!==a.selectedSchemaIndex){q.resultHasArrived=!1,h.getAnimationStatus()?(a.toNextSchema=c.params.schemaIndex>a.selectedSchemaIndex?!0:!1,a.animateSchemaChange=a.toNextSchema?"animated fadeOutUp":"animated fadeOutDown",d(function(){j(c.params.schemaIndex)},250)):j(c.params.schemaIndex);var e=a.$watch("resultHasArrived",function(a){a&&(l(),e())})}else l()});var s=a.$watch("resultHasArrived",function(b){if(b){if(h.getAnimationStatus()){switch(q.toNextPage){case!1:a.animateWorkspacePageChange="animated slideInLeft";break;case!0:a.animateWorkspacePageChange="animated slideInRight";break;default:a.animateWorkspacePageChange="animated fadeInDown"}d(function(){a.animateWorkspacePageChange=""},250)}else a.animateWorkspacePageChange="";l(),q.workspaceFullyLoaded=!0,s()}})}]),SCHEMAcat.controller("NamePanelCtrl",["$scope","$location","$timeout","Schema",function(a,b,c,d){a.workspace.namePanel={};var e;a.workspace.namePanel.updateEditingName=function(){b.search().editingName?a.schemaEditable?(a.workspace.namePanel.editButtonTooltip="Hide edit name",void 0===e&&(e=a.selectedSchema["sc:schema"]["sc:name"]),a.workspace.namePanel.editForm.open=!0):(delete b.search().editingName,a.workspace.namePanel.editButtonTooltip="Edit schema name",a.workspace.namePanel.editForm.input.$dirty&&(a.workspace.namePanel.editButtonTooltip+=" (there are unsaved changes in this field!)"),b.search(b.search())):(a.workspace.namePanel.editForm.open=!1,a.workspace.namePanel.editButtonTooltip="Edit schema name",a.workspace.namePanel.editForm.input.$dirty&&(a.workspace.namePanel.editButtonTooltip+=" (there are unsaved changes in this field!)")),a.workspace.namePanel.updateAjaxError=!1},a.saveName=function(){var c=a.selectedSchema["sc:schema"]["sc:name"],f=new d;a.workspace.namePanel.waitingForServerUpdate=!0,a.workspace.namePanel.updateAjaxError=!1,f.name=c,f.$save({schemaID:a.schemasList[a.selectedSchemaIndex]["xml:id"],schemaField:"name"},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:name"]=fixEmptyFields(c["sc:response"]["sc:written-data"]["sc:name"]),e=c["sc:response"]["sc:written-data"]["sc:name"],a.workspace.namePanel.waitingForServerUpdate=!1,a.workspace.namePanel.editForm.$setPristine(),delete b.search().editingName,b.search(b.search())):(a.workspace.namePanel.waitingForServerUpdate=!1,a.workspace.namePanel.updateAjaxError=!0)},function(){a.workspace.namePanel.waitingForServerUpdate=!1,a.workspace.namePanel.updateAjaxError=!0})},a.toggleEditName=function(d){if(b.search().editingName){if(delete b.search().editingName,d)return c(function(){a.selectedSchema["sc:schema"]["sc:name"]=e,a.workspace.namePanel.editForm.$setPristine(),a.$apply(),b.search(b.search())},150),void 0}else b.search().editingName=!0;b.search(b.search())}}]),SCHEMAcat.controller("DescriptionPanelCtrl",["$scope","$location","$timeout","Schema",function(a,b,c,d){a.workspace.descriptionPanel={};var e;a.workspace.descriptionPanel.updateEditingDescription=function(){b.search().editingDescription?a.schemaEditable?(a.workspaceFullyLoaded&&a.$broadcast("autosizeTextarea.resize"),a.workspace.descriptionPanel.editButtonTooltip="Hide edit description",void 0===e&&(e=a.selectedSchema["sc:schema"]["sc:description"]),a.workspace.descriptionPanel.editForm.open=!0):(delete b.search().editingDescription,a.workspace.descriptionPanel.editButtonTooltip="Edit description",a.workspace.descriptionPanel.editForm.input.$dirty&&(a.workspace.descriptionPanel.editButtonTooltip+=" (there are unsaved changes in this field!)"),b.search(b.search())):(a.workspace.descriptionPanel.editForm.open=!1,a.workspace.descriptionPanel.editButtonTooltip="Edit description",a.workspace.descriptionPanel.editForm.input.$dirty&&(a.workspace.descriptionPanel.editButtonTooltip+=" (there are unsaved changes in this field!)")),a.workspace.descriptionPanel.updateAjaxError=!1},a.saveDescription=function(){var c=a.selectedSchema["sc:schema"]["sc:description"],f=new d;a.workspace.descriptionPanel.waitingForServerUpdate=!0,a.workspace.descriptionPanel.updateAjaxError=!1,f.description=c,f.$save({schemaID:a.schemasList[a.selectedSchemaIndex]["xml:id"],schemaField:"description"},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:description"]=fixEmptyFields(c["sc:response"]["sc:written-data"]["sc:description"]),e=c["sc:response"]["sc:written-data"]["sc:description"],a.workspace.descriptionPanel.waitingForServerUpdate=!1,a.workspace.descriptionPanel.editForm.$setPristine(),delete b.search().editingDescription,b.search(b.search())):(a.workspace.descriptionPanel.waitingForServerUpdate=!1,a.workspace.descriptionPanel.updateAjaxError=!0)},function(){a.workspace.descriptionPanel.waitingForServerUpdate=!1,a.workspace.descriptionPanel.updateAjaxError=!0})},a.toggleEditDescription=function(d){if(b.search().editingDescription){if(delete b.search().editingDescription,d)return c(function(){a.selectedSchema["sc:schema"]["sc:description"]=e,a.workspace.descriptionPanel.editForm.$setPristine(),a.$apply(),b.search(b.search())},150),void 0}else b.search().editingDescription=!0;b.search(b.search())}}]),SCHEMAcat.controller("VersionDetailsPanelCtrl",["$scope","$location","$timeout","Schema",function(a,b,c,d){a.workspace.collapsibleDetailPanels.version={},a.workspace.collapsibleDetailPanels.version.editPanel={},a.workspace.collapsibleDetailPanels.version.editPanel.open=!1;var e;a.toggleEditVersion=function(d){if(b.search().editingVersion){if(delete b.search().editingVersion,d)return c(function(){a.workspace.collapsibleDetailPanels.version.editForm.$setPristine(),a.$apply(),b.search(b.search()),a.workspace.collapsibleDetailPanels.version.resettingUpdate=!0,c(function(){a.selectedSchema["sc:schema"]["sc:version"]=e,a.workspace.collapsibleDetailPanels.version.resettingUpdate=!1},350)},150),void 0}else b.search().editingVersion=!0;b.search(b.search())},a.workspace.collapsibleDetailPanels.version.updateEditPanel=function(){b.search().editingVersion?a.schemaEditable?(a.workspace.collapsibleDetailPanels.version.editButtonTooltip="Hide edit panel",void 0===e&&(e=a.selectedSchema["sc:schema"]["sc:version"]),a.workspace.collapsibleDetailPanels.version.editPanel.open=!0):(delete b.search().editingVersion,a.workspace.collapsibleDetailPanels.version.editButtonTooltip="Change schema version",a.workspace.collapsibleDetailPanels.version.editForm&&a.workspace.collapsibleDetailPanels.version.editForm.input.$dirty&&(a.workspace.collapsibleDetailPanels.version.editButtonTooltip+=" (there are unsaved changes in this field!)"),b.search(b.search())):(a.workspace.collapsibleDetailPanels.version.editPanel.open=!1,a.workspace.collapsibleDetailPanels.version.editButtonTooltip="Change schema version",a.workspace.collapsibleDetailPanels.version.editForm&&a.workspace.collapsibleDetailPanels.version.editForm.input.$dirty&&(a.workspace.collapsibleDetailPanels.version.editButtonTooltip+=" (there are unsaved changes in this field!)")),a.workspace.collapsibleDetailPanels.version.updateAjaxError=!1},a.saveVersion=function(){var c=a.selectedSchema["sc:schema"]["sc:version"],f=new d;a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.version.updateAjaxError=!1,f.version=c,f.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"version"},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:version"]=fixEmptyFields(c["sc:response"]["sc:written-data"]["sc:version"]),e=a.selectedSchema["sc:schema"]["sc:version"],a.schemasList[a.selectedSchemaIndex]["sc:version"]=e,a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.version.editForm.$setPristine(),delete b.search().editingVersion,b.search(b.search())):(a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.version.updateAjaxError=!0)},function(){a.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.version.updateAjaxError=!0})}}]),SCHEMAcat.controller("StatusDetailsPanelCtrl",["$scope","$location","Schema",function(a,b,c){a.workspace.collapsibleDetailPanels.status={},a.workspace.collapsibleDetailPanels.status.editPanel={},a.workspace.collapsibleDetailPanels.status.editPanel.open=!1,a.workspace.collapsibleDetailPanels.status.possibleStatusList=[];var d=["development"],e=["production"],f=["deprecated","superseeded"];a.toggleEditStatus=function(){b.search().editingStatus?delete b.search().editingStatus:b.search().editingStatus=!0,b.search(b.search())},a.workspace.collapsibleDetailPanels.status.updateEditPanel=function(){b.search().editingStatus?a.schemaEditable?(a.workspace.collapsibleDetailPanels.status.possibleStatusList=a.selectedSchema["sc:schema"]["sc:access"]["sc:all"]&&"r"===a.selectedSchema["sc:schema"]["sc:access"]["sc:all"].actions?e.concat(f):d.concat(f),a.workspace.collapsibleDetailPanels.status.editPanel.open=!0):(delete b.search().editingStatus,b.search(b.search())):a.workspace.collapsibleDetailPanels.status.editPanel.open=!1,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!1},a.saveStatus=function(){var b=a.selectedSchema["sc:schema"]["sc:status"],d=new c;a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!1,d.status=b,d.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"status"},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:status"]=fixEmptyFields(b["sc:response"]["sc:written-data"]["sc:status"]),a.schemasList[a.selectedSchemaIndex]["sc:status"]=a.selectedSchema["sc:schema"]["sc:status"],a.workspace.collapsibleDetailPanels.status.editForm.$setPristine(),a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!1):(a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!0)},function(){a.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.status.updateAjaxError=!0})}}]),SCHEMAcat.controller("AccessDetailsPanelCtrl",["$scope","$location","Schema",function(a,b,c){a.workspace.collapsibleDetailPanels.access={},a.workspace.collapsibleDetailPanels.access.editPanel={},a.workspace.collapsibleDetailPanels.access.editPanel.open=!1,a.currentAccessPolicy="",a.toggleEditAccess=function(){b.search().editingAccess?delete b.search().editingAccess:b.search().editingAccess=!0,b.search(b.search())},a.workspace.collapsibleDetailPanels.access.updateEditPanel=function(){b.search().editingAccess?a.schemaEditable?(a.currentAccessPolicy=a.workspace.collapsibleDetailPanels.access.getAccessPolicy(),a.workspace.collapsibleDetailPanels.access.editPanel.open=!0):(delete b.search().editingAccess,b.search(b.search())):a.workspace.collapsibleDetailPanels.access.editPanel.open=!1,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!1},a.workspace.collapsibleDetailPanels.access.getAccessPolicy=function(){return void 0!==a.selectedSchema["sc:schema"]["sc:access"]["sc:all"]&&"r"===a.selectedSchema["sc:schema"]["sc:access"]["sc:all"].actions?"shareURL":"private"},a.saveAccessStatus=function(b){var d=a.selectedSchema["sc:schema"]["sc:access"]["sc:user"],e=new c;switch(a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!1,b){case"shareURL":e.access={all:{actions:"r"},user:d};break;case"private":e.access={user:d}}e.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"access"},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:access"]=b["sc:response"]["sc:written-data"]["sc:access"],a.workspace.collapsibleDetailPanels.access.editForm.$setPristine(),a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!1):(a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!0),a.currentAccessPolicy=a.workspace.collapsibleDetailPanels.access.getAccessPolicy()},function(){a.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.access.updateAjaxError=!0,a.currentAccessPolicy=a.workspace.collapsibleDetailPanels.access.getAccessPolicy()})}}]),SCHEMAcat.controller("LicenseDetailsPanelCtrl",["$scope","$modal","$location","$timeout","Schema","Licenses",function(a,b,c,d,e,f){function i(){h=b.open({scope:a,templateUrl:"partials/editLicenseModal.html"}),h.result.then(function(){h=void 0},function(b){h=void 0,"dismiss"!==b&&a.triggerCloseModalRoute()})}a.workspace.collapsibleDetailPanels.license={},a.input={};var g,h;a.filterLicenses=function(b){var c=a.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue;if(void 0===c||c!==c)return!0;var d=new RegExp(RegExp.escape(c),"i");return b["sc:full-name"].match(d)||b["xml:id"].match(d)?!0:!1},a.showSelectedLicense=function(b){a.selectedSchema["sc:schema"]["sc:license"]["xml:id"]!==b["xml:id"]&&(a.workspace.collapsibleDetailPanels.license.modelDirty=!0,a.workspace.collapsibleDetailPanels.license.updatingLicense=!0,d(function(){a.selectedSchema["sc:schema"]["sc:license"]=b,a.workspace.collapsibleDetailPanels.license.updatingLicense=!1},250))},a.saveNewLicense=function(){var b=a.selectedSchema["sc:schema"]["sc:license"],c=new e;a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!0,a.workspace.collapsibleDetailPanels.license.updateAjaxError=!1,c.license=b["xml:id"],c.$save({schemaID:a.selectedSchema["sc:schema"]["xml:id"],schemaField:"license"},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success&&b["sc:response"]["sc:written-data"]["sc:license"].ref===a.selectedSchema["sc:schema"]["sc:license"]["xml:id"]?(g=a.selectedSchema["sc:schema"]["sc:license"],a.workspace.collapsibleDetailPanels.license.modelDirty=!1,a.workspace.collapsibleDetailPanels.license.editForm.$setPristine(),a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!1,a.triggerCloseModalRoute()):(a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.license.updateAjaxError=!0)},function(){a.selectedSchema["sc:schema"]["sc:license"]=g,a.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=!1,a.workspace.collapsibleDetailPanels.license.updateAjaxError=!0})},a.triggerOpenModalRoute=function(){c.search().editingLicense||(c.search().editingLicense=!0,c.search(c.search()))},a.triggerCloseModalRoute=function(){c.search().editingLicense&&(delete c.search().editingLicense,c.search(c.search()))},a.workspace.collapsibleDetailPanels.license.updateEditPanel=function(){c.search().editingLicense?a.schemaEditable?(void 0===g&&(g=a.selectedSchema["sc:schema"]["sc:license"]),void 0===a.workspace.licenseList&&f.get(function(b){a.workspace.licenseList=b;for(var c=0;c<b["sc:licenses"]["sc:license"].length;c++)b["sc:licenses"]["sc:license"][c]["xml:id"]===a.selectedSchema["sc:schema"]["sc:license"]["xml:id"]&&(a.input.model=a.workspace.licenseList["sc:licenses"]["sc:license"][c]["xml:id"])}),i()):(a.workspace.collapsibleDetailPanels.license.editButtonTooltip="Change schema license",a.workspace.collapsibleDetailPanels.license.editForm&&a.workspace.collapsibleDetailPanels.license.modelDirty&&(a.workspace.collapsibleDetailPanels.license.editButtonTooltip+=" (there are unsaved changes in this field!)"),a.triggerCloseModalRoute()):void 0!==h&&h.dismiss("dismiss"),a.workspace.collapsibleDetailPanels.license.editButtonTooltip="Change schema license",a.workspace.collapsibleDetailPanels.license.editForm&&a.workspace.collapsibleDetailPanels.license.modelDirty&&(a.workspace.collapsibleDetailPanels.license.editButtonTooltip+=" (there are unsaved changes in this field!)")},a.cancelEdit=function(){a.workspace.collapsibleDetailPanels.license.modelDirty&&(a.workspace.collapsibleDetailPanels.license.updatingLicense=!0,a.workspace.collapsibleDetailPanels.license.modelDirty=!1,d(function(){a.selectedSchema["sc:schema"]["sc:license"]=g,a.workspace.collapsibleDetailPanels.license.updatingLicense=!1},250),a.workspace.collapsibleDetailPanels.license.editForm.$setPristine()),a.triggerCloseModalRoute()}}]),SCHEMAcat.controller("FileController",["$scope","$http","$timeout","$location",function(a,b,c,d){function e(){void 0!==d.search().show&&-1!==d.search().show.indexOf(a.file["sc:name"])?(a.showSchemaBtn=!0,f(a.selectedSchema["sc:schema"]["xml:id"],a.file["sc:name"])):(a.showSchemaBtn=!1,a.file.open=!1)}function f(d,e){void 0===a.schemaFileContent?b.get("/schemacat/schemas/"+d+"/files/"+e).success(function(b){a.prettify="prettyprint linenums",c(function(){prettyPrint(),a.file.open=!0}),a.schemaFileContent=b}).error(function(){a.showSchemaBtn=!1,a.showFile(e),a.showFileAjaxError=!0}):a.file.open=!0}e(),a.showFile=function(b){a.showFileAjaxError=!1,c(function(){var c=d.search();if(a.showSchemaBtn===!0)void 0===c.show?c.show="#"+b:-1===c.show.indexOf(b)&&(c.show=c.show+"#"+b);else for(var e in c)if("show"===e){var f=c[e].split("#");for(var g in f)f[g]===b&&f.splice(g,1);var h=f.join("#");""!==h?c[e]=h:delete c[e]}d.search(c)})},a.$on("$routeUpdate",function(){a.resultHasArrived&&e()})}]),SCHEMAcat.controller("TopMenuCtrl",["$scope","$modal","$location","UserService","Settings","ShibService",function(a,b,c,d,e,f){function g(){a.topMenuCollapsed=!c.search().topMenuExpanded,e.setAnimationStatus(!c.search().animationsDisabled),a.animationsChecked=e.getAnimationStatus()}a.displayName=d.displayName,a.shibURL=f.url,a.$watch(function(){return d.displayName},function(b,c){b!==c&&(a.displayName=b)}),g(),a.isActive=function(a){return"/workspace.html"===a&&-1!==c.path().indexOf("/workspace.html/")?!0:a===c.path()},a.updateAnimationStatus=function(){c.search().animationsDisabled?delete c.search().animationsDisabled:c.search().animationsDisabled=!0,c.search(c.search())},a.toggleTopMenu=function(){c.search().topMenuExpanded?delete c.search().topMenuExpanded:c.search().topMenuExpanded=!0,c.search(c.search())},a.animationsUrlPart=function(){return c.search().animationsDisabled?"animationsDisabled":""},a.topMenuExpandedUrlPart=function(){return c.search().topMenuExpanded?"topMenuExpanded":""},a.$on("$routeUpdate",function(){g()}),a.loginClick=function(){var c=b.open({scope:a,templateUrl:"partials/loginModal.html",controller:"LoginModalCtrl"});c.result.then(function(a){alert("Now set the user cookie to ["+a+"]"),document.cookie="USER="+a+";domain=;path=/",document.location.hash="",document.location.reload(!0)})}}]),SCHEMAcat.controller("LoginModalCtrl",["$scope","$modalInstance",function(a,b){a.loginClose=function(){b.dismiss("cancel")},a.loginSubmit=function(){b.close(this.loginNameInput.text)}}]),SCHEMAcat.controller("AboutPageCtrl",["$scope","Settings",function(a,b){a.$parent.toNextPage=!1,b.getAnimationStatus()&&(a.animateInOut="animated slideInRight"),a.$on("$routeChangeStart",function(c,d){if(b.getAnimationStatus())switch(d.templateUrl){case"partials/workspace.html":a.animateInOut="animated slideOutRight";break;case"partials/contact.html":a.animateInOut="animated slideOutLeft";break;default:a.animateInOut="animated fadeOutDown"}}),a.$on("$routeChangeSuccess",function(c,d,e){if(b.getAnimationStatus()){var f=void 0!==e?e.templateUrl:void 0;switch(f){case"partials/workspace.html":a.animateInOut="animated slideInRight";break;case"partials/contact.html":a.animateInOut="animated slideInLeft";break;default:a.animateInOut="animated fadeInDown"}}})}]),SCHEMAcat.controller("ContactPageCtrl",["$scope","Settings",function(a,b){a.$parent.toNextPage=!1,b.getAnimationStatus()&&(a.animateInOut="animated slideInRight"),a.$on("$routeChangeStart",function(c,d){if(b.getAnimationStatus())switch(d.templateUrl){case"partials/about.html":case"partials/contact.html":case"partials/workspace.html":a.animateInOut="animated slideOutRight";break;default:a.animateInOut="animated fadeOutDown"}}),a.$on("$routeChangeSuccess",function(c,d,e){if(b.getAnimationStatus()){var f=void 0!==e?e.templateUrl:void 0;switch(f){case"partials/about.html":case"partials/contact.html":case"partials/workspace.html":a.animateInOut="animated slideInRight";break;default:a.animateInOut="animated fadeInDown"}}})}]),SCHEMAcat.controller("AccountDetailsPageCtrl",["$scope","$location","User","UserService","Settings",function(a,b,c,d,e){function f(){var a=b.search();for(var c in a)if("editingEmail"===c){for(var e=a[c].split("#"),f=0;f<e.length;f++){for(var g=!1,h=0;h<d.email.length;h++)e[f]===d.email[h]&&(g=!0);g||e.splice(f,1)}var i=e.join("#");""!==i?a[c]=i:delete a[c]}b.search(a)}function g(){a.waitingForServerEditDisplayName=!1,a.editDisplayNameAjaxError=!1,b.search().editingDisplayName?(a.editDisplayNameText=a.displayName,a.editingDisplayName=!0):a.editingDisplayName=!1}function h(){a.waitingForServer=!1,a.addingEmail=b.search().addingEmail?!0:!1}a.principal=d.principal,a.displayName=d.displayName,a.email=d.email,a.addingEmail=!1,a.addNewEmail=function(){b.search().addingEmail=!0,b.search(b.search())},a.terminateAddEmail=function(){a.ajaxError=!1,delete b.search().addingEmail,b.search(b.search())},a.addEmail=function(b){a.waitingForServer=!0;var e=new c;e.emails=d.email.slice(0),e.emails.push(b),e.$save({userID:d.id},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(d.email.push(b),a.terminateAddEmail()):(a.waitingForServer=!1,a.ajaxError=!0)},function(){a.waitingForServer=!1,a.ajaxError=!0})},a.editDisplayName=function(){b.search().editingDisplayName=!0,b.search(b.search())},a.terminateEditDisplayName=function(){delete b.search().editingDisplayName,b.search(b.search())},a.updateDisplayName=function(b){a.waitingForServerEditDisplayName=!0;var e=new c;e.displayName=b,e.$save({userID:d.id},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?(a.displayName=d.displayName=b,a.terminateEditDisplayName()):(a.waitingForServerEditDisplayName=!1,a.editDisplayNameAjaxError=!0)},function(){a.waitingForServerEditDisplayName=!1,a.editDisplayNameAjaxError=!0})},e.getAnimationStatus()&&(a.animateAccountDetails="animated fadeInDown"),a.$on("$routeChangeStart",function(){e.getAnimationStatus()&&(a.animateAccountDetails="animated fadeOutUp")}),a.$on("$routeChangeSuccess",function(){e.getAnimationStatus()&&(a.animateAccountDetails="animated fadeInDown"),h(),g(),f()}),a.$on("$routeUpdate",function(){h(),g(),f()})}]),SCHEMAcat.controller("EmailInstanceCtrl",["$scope","$location","User","UserService",function(a,b,c,d){function e(){a.waitingForServerEditEmail=!1,void 0!==b.search().editingEmail&&-1!==b.search().editingEmail.indexOf(a.emailInstance)?(a.editEmailText=a.emailInstance,a.editingEmail=!0):a.editingEmail=!1}e(),a.editEmail=function(c){var d=b.search();a.removeEmailAjaxError=!1,d.editingEmail=void 0===d.editingEmail?c:b.search().editingEmail+"#"+c,b.search(d)},a.removeEmail=function(b){a.waitingForServerEditEmail=!0;var e=new c;e.emails=d.email.slice(0),e.emails.splice(b,1),e.$save({userID:d.id},function(c){void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success?d.email.splice(b,1):(a.waitingForServerEditEmail=!1,a.removeEmailAjaxError=!0)},function(){a.waitingForServerEditEmail=!1,a.removeEmailAjaxError=!0})},a.updateEmail=function(b){a.waitingForServerEditEmail=!0;var e=new c;e.emails=d.email.slice(0),e.emails[b]=a.editEmailText,e.$save({userID:d.id},function(c){if(void 0!==c["sc:response"]&&c["sc:response"]&&c["sc:response"].success){var e=a.editEmailText;a.cancelEditEmail(d.email[b]),d.email[b]=e}else a.waitingForServerEditEmail=!1,a.editEmailAjaxError=!0},function(){a.waitingForServerEditEmail=!1,a.editEmailAjaxError=!0})},a.cancelEditEmail=function(c){var d=b.search();a.editEmailAjaxError=!1;for(var e in d)if("editingEmail"===e){var f=d[e].split("#");for(var g in f)f[g]===c&&f.splice(g,1);var h=f.join("#");""!==h?d[e]=h:delete d[e]}b.search(d)},a.$on("$routeChangeSuccess",function(){e()}),a.$on("$routeUpdate",function(){e()})}]),SCHEMAcat.controller("CompleteUserDetailsCtrl",["$scope","$modal",function(a,b){a.ajaxError=!1,a.waitingForServer=!1,b.open({scope:a,backdrop:"static",keyboard:!1,templateUrl:"partials/fillDetailsModal.html",controller:"CompleteUserDetailsModalCtrl"})}]),SCHEMAcat.controller("CompleteUserDetailsModalCtrl",["$scope","$modalInstance","User","UserService",function(a,b,c,d){a.userDetailsSubmit=function(){a.waitingForServer=!0,a.ajaxError=!1;var b=new c;b.emails=[],b.emails[0]=this.emailInput.text,b.displayName=this.displayNameInput.text,b.$save({userID:d.id},function(b){void 0!==b["sc:response"]&&b["sc:response"]&&b["sc:response"].success?document.location.pathname="schemacat/site/index.html":(a.waitingForServer=!1,a.ajaxError=!0)},function(){a.waitingForServer=!1,a.ajaxError=!0})}}]);
Index: /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.js
===================================================================
--- /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.js	(revision 4586)
+++ /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.js	(revision 4587)
@@ -1,6 +1,8 @@
 'use strict';
 SCHEMAcat.directive('workspaceDirective', [
+
 	function() {
 		return function(scope, element, attrs) {
+			scope.workspace = {};
 			scope.workspaceFullyLoaded = false;
 		};
Index: /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.min.js
===================================================================
--- /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.min.js	(revision 4586)
+++ /cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.min.js	(revision 4587)
@@ -1,1 +1,1 @@
-"use strict";SCHEMAcat.directive("workspaceDirective",[function(){return function(e,t,n){e.workspaceFullyLoaded=false}}])
+"use strict";SCHEMAcat.directive("workspaceDirective",[function(){return function(a){a.workspace={},a.workspaceFullyLoaded=!1}}]);
