Changeset 4567


Ignore:
Timestamp:
02/25/14 14:40:50 (10 years ago)
Author:
andmor
Message:

Edit panels for: name, description, access, version, status and license.
Some layout changes to match bootstrap 3.1.1

Location:
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site
Files:
1 added
14 edited

Legend:

Unmodified
Added
Removed
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/completeuserdetails.html

    r4476 r4567  
    1111
    1212        <!-- Le styles -->
    13         <link href="./lib/bootstrap-3.1.0/css/bootstrap.min.css" rel="stylesheet" />
     13        <link href="./lib/bootstrap-3.1.1/css/bootstrap.min.css" rel="stylesheet" />
    1414        <link href="./styles/SCHEMAcat.min.css" rel="stylesheet" />
    1515
     
    6969        <!-- Placed at the end of the document so the pages load faster -->
    7070        <!--<script src="./lib/jQuery/1.10.2/jquery-1.10.2.min.js"></script>-->
    71         <script src="./lib/AngularJS-1.2.11/angular.min.js"></script>
    72         <script src="./lib/AngularJS-1.2.11/angular-resource.min.js"></script>
    73         <script src="./lib/AngularJS-1.2.11/angular-route.min.js"></script>
     71        <script src="./lib/AngularJS-1.2.13/angular.min.js"></script>
     72        <script src="./lib/AngularJS-1.2.13/angular-resource.min.js"></script>
     73        <script src="./lib/AngularJS-1.2.13/angular-route.min.js"></script>
    7474        <script src="./lib/UI-bootstrap/ui-bootstrap-tpls-0.10.0.min.js"></script>
    7575        <script src="./scripts/modules.min.js"></script>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/index.html

    r4476 r4567  
    1111
    1212        <!-- Le styles -->
    13         <link href="./lib/bootstrap-3.1.0/css/bootstrap.min.css" rel="stylesheet" />
     13        <link href="./lib/bootstrap-3.1.1/css/bootstrap.min.css" rel="stylesheet" />
    1414        <link href="./lib/animate_css/animate.min.css" rel="stylesheet" />
    1515        <link href="./styles/SCHEMAcat.min.css" rel="stylesheet" />
     
    9898    ================================================== -->
    9999        <!-- Placed at the end of the document so the pages load faster -->
    100         <!--<script src="./lib/jQuery/1.10.2/jquery-1.10.2.min.js"></script>-->
    101         <script src="./lib/AngularJS-1.2.11/angular.min.js"></script>
    102         <script src="./lib/AngularJS-1.2.11/angular-resource.min.js"></script>
    103         <script src="./lib/AngularJS-1.2.11/angular-route.min.js"></script>
     100        <!-- <script src="./lib/jQuery/1.10.2/jquery-1.10.2.min.js"></script> -->
     101        <script src="./lib/AngularJS-1.2.13/angular.min.js"></script>
     102        <script src="./lib/AngularJS-1.2.13/angular-resource.min.js"></script>
     103        <script src="./lib/AngularJS-1.2.13/angular-route.min.js"></script>
    104104        <script src="./lib/UI-bootstrap/ui-bootstrap-tpls-0.10.0.min.js"></script>
    105105        <script src="./lib/pretify/prettify.js"></script>
     106        <script src="./lib/TLA-generics/tla-generics.min.js"></script>
    106107        <script src="./scripts/modules.min.js"></script>
    107108        <script src="./scripts/controllers.min.js"></script>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/accountDetails.html

    r4372 r4567  
    55                <div class="schemacat-fluid-container">
    66                    <h3>Account details</h3>
    7                     <div>
    8                         <dl class="dl-horizontal small">
     7                    <div id="account-details-list">
     8                        <dl class="dl-horizontal">
    99                            <dt>Shibboleth ID:</dt>
    1010                            <dd>
    11                                 <p data-ng-bind="principal"/>
     11                                <span data-ng-bind="principal"></span>
    1212                            </dd>
    1313                            <dt>Diplay name:</dt>
    1414                            <dd>
    15                                 <p data-ng-if="!edditingDisplayName">
     15                                <span data-ng-if="!editingDisplayName">
    1616                                    <span data-ng-bind="displayName"></span>
    1717                                    <span>
    1818                                        <button data-ng-click="editDisplayName()" class="btn btn-info btn-xs" data-ng-if="displayName != 'guest'"><i class="glyphicon glyphicon-edit"></i> Edit</button>
    1919                                    </span>
    20                                 </p>
    21                                 <form data-ng-if="edditingDisplayName" name="editDisplayNameForm" class="form-horizontal" novalidate="novalidate">
     20                                </span>
     21                                <form data-ng-if="editingDisplayName" name="editDisplayNameForm" class="form-horizontal" novalidate="novalidate">
    2222                                    <div class="form-group">
    2323                                        <div class="col-md-3">
     
    2727                                        <button data-ng-click="terminateEditDisplayName()" class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-remove"></i> Cancel</button>
    2828                                        <img src="images/spinner-small.gif" alt="Loading..." data-ng-if="waitingForServerEditDisplayName"/>
    29                                         <div class="col-md-12 has-error small" data-ng-if="editDisplayNameForm.editDisplayNameInput.$dirty &amp;&amp; editDisplayNameForm.editDisplayNameInput.$invalid">
     29                                        <div class="col-md-12 has-error" data-ng-if="editDisplayNameForm.editDisplayNameInput.$dirty &amp;&amp; editDisplayNameForm.editDisplayNameInput.$invalid">
    3030                                            <small class="help-block" data-ng-if="editDisplayNameForm.editDisplayNameInput.$error.required">
    3131                                                Your display name cannot be empty.
    3232                                            </small>
    3333                                        </div>
    34                                         <div class="col-md-12 has-error small" data-ng-if="editDisplayNameAjaxError">
     34                                        <div class="col-md-12 has-error" data-ng-if="editDisplayNameAjaxError">
    3535                                            <small class="help-block">
    3636                                                <div>The server responded with an error. Please try again!</div>
     
    4545                                <dt>email:</dt>
    4646                                <dd data-ng-repeat="emailInstance in email" data-ng-controller="EmailInstanceCtrl">
    47                                     <p data-ng-if="!edditingEmail">
     47                                    <span data-ng-if="!editingEmail">
    4848                                        <span data-ng-bind="emailInstance"></span>
    4949                                        <span>
     
    5252                                            <img src="images/spinner-small.gif" alt="Loading..." data-ng-if="waitingForServerEditEmail"/>
    5353                                        </span>
    54                                     </p>
    55                                     <span class="control-group error" data-ng-if="removeEmailAjaxError">
    56                                         <small class="help-block">
    57                                             <div>The server responded with an error. Please try again!</div>
    58                                             <div>If the problem persists contact us at:</div>
    59                                             <div><a href="mailto:tla@mpi.nl">isocat@mpi.nl</a></div>
    60                                         </small>
    6154                                    </span>
    62                                     <form data-ng-if="edditingEmail" name="editEmailForm" class="form-horizontal" novalidate="novalidate">
     55                                    <form data-ng-if="editingEmail" name="editEmailForm" class="form-horizontal" novalidate="novalidate">
    6356                                        <div class="form-group">
    6457                                            <div class="col-md-3">
     
    6861                                            <button data-ng-click="cancelEditEmail(emailInstance)" class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-remove"></i> Cancel</button>
    6962                                            <img src="images/spinner-small.gif" alt="Loading..." data-ng-if="waitingForServerEditEmail"/>
    70                                             <span class="col-md-12 has-error small" data-ng-show="editEmailForm.editEmailInput.$dirty &amp;&amp; editEmailForm.editEmailInput.$invalid">
     63                                            <span class="col-md-12 has-error" data-ng-show="editEmailForm.editEmailInput.$dirty &amp;&amp; editEmailForm.editEmailInput.$invalid">
    7164                                                <small class="help-block" data-ng-if="editEmailForm.editEmailInput.$error.required">
    7265                                                    The email cannot be empty.
    7366                                                </small>
    7467                                            </span>
    75                                             <span class="col-md-12 has-error small" data-ng-if="editEmailForm.editEmailInput.$dirty &amp;&amp; editEmailForm.editEmailInput.$invalid">
     68                                            <span class="col-md-12 has-error" data-ng-if="editEmailForm.editEmailInput.$dirty &amp;&amp; editEmailForm.editEmailInput.$invalid">
    7669                                                <small class="help-block" data-ng-if="editEmailForm.editEmailInput.$error.email">
    7770                                                    Please provide a vaid email address.
    7871                                                </small>
    7972                                            </span>
    80                                             <span class="col-md-12 has-error small" data-ng-if="editEmailAjaxError">
     73                                            <span class="col-md-12 has-error" data-ng-if="editEmailAjaxError || removeEmailAjaxError">
    8174                                                <small class="help-block">
    8275                                                    <div>The server responded with an error. Please try again!</div>
     
    9891                                            <button data-ng-click="terminateAddEmail()" class="btn btn-danger btn-xs"><i class="glyphicon glyphicon-remove"></i> Cancel</button>
    9992                                            <img src="images/spinner-small.gif" alt="Loading..." data-ng-if="waitingForServer"/>
    100                                             <span class="col-md-12 has-error small" data-ng-if="newEmailForm.newEmailInput.$dirty &amp;&amp; newEmailForm.newEmailInput.$invalid">
     93                                            <span class="col-md-12 has-error" data-ng-if="newEmailForm.newEmailInput.$dirty &amp;&amp; newEmailForm.newEmailInput.$invalid">
    10194                                                <small class="help-block" data-ng-if="newEmailForm.newEmailInput.$error.required">
    10295                                                    The email cannot be empty.
    10396                                                </small>
    10497                                            </span>
    105                                             <span class="col-md-12 has-error small" data-ng-if="newEmailForm.newEmailInput.$dirty &amp;&amp; newEmailForm.newEmailInput.$invalid">
     98                                            <span class="col-md-12 has-error" data-ng-if="newEmailForm.newEmailInput.$dirty &amp;&amp; newEmailForm.newEmailInput.$invalid">
    10699                                                <small class="help-block" data-ng-if="newEmailForm.newEmailInput.$error.email">
    107100                                                    Please provide a vaid email address.
    108101                                                </small>
    109102                                            </span>
    110                                             <span class="col-md-12 has-error small" data-ng-if="ajaxError">
     103                                            <span class="col-md-12 has-error" data-ng-if="ajaxError">
    111104                                                <small class="help-block">
    112105                                                    <div>The server responded with an error. Please try again!</div>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/partials/workspace.html

    r4476 r4567  
    44            <div class="sidebar-nav-fixed">
    55                <!--<form class="form-search">
    6                     <div class="input-append">
    7                         <input type="text" class="search-query"/>
    8                         <button type="submit" class="btn">Search</button>
    9                     </div>
     6                    <div class="input-group">
     7            <input type="text" class="form-control" placeholder="Search" name="srch-term" id="srch-term">
     8            <div class="input-group-btn">
     9                <button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
     10            </div>
     11        </div>
    1012                </form>-->
    1113                <div class="panel panel-default">
     
    2123                            <tr data-ng-class="{'active': $index==selectedSchemaIndex,'cursor-pointer': $index!=selectedSchemaIndex}" data-ng-repeat="schema in schemasList" data-ng-click="selectSchema($index)">
    2224                                <td data-ng-bind="schema['sc:name']"></td>
    23                                 <td data-ng-if="schema['sc:version'] != '[object Object]'" data-ng-bind="schema['sc:version']"/>
    24                                 <td data-ng-if="schema['sc:version'] == '[object Object]'"/>
     25                                <td data-ng-if="schema['sc:version'] != ''" data-ng-bind="schema['sc:version']"/>
     26                                <td data-ng-if="schema['sc:version'] == ''"/>
    2527                                <td data-ng-bind="schema['sc:status']"/>
    2628                            </tr>
     
    2830                    </table>
    2931                </div>
    30                 <div data-ng-if="schemasResult['sc:result']['sc:total-schemas'] &gt; pageSize"  class="paginator centered">
     32                <div data-ng-if="schemasResult['sc:result']['sc:total-schemas'] &gt; pageSize"  class="paginator text-center">
    3133                    <div data-pagination="" data-page="currentPage" data-total-items="totalSchemaItems" data-items-per-page="pageSize" data-max-size="5" class="pagination-sm cursor-pointer" data-on-select-page="selectPage(page)"
    3234                        data-boundary-links="true" data-previous-text="‹" data-next-text="›" data-first-text="«" data-last-text="»"></div>
     
    3840                <div id="schema-div" data-ng-class="animateSchemaChange">
    3941                    <div class="small">
    40                         <h1 id="schema-name" data-ng-bind="selectedSchema['sc:schema']['sc:name']"></h1>
    41                         <p data-ng-if="selectedSchema['sc:schema']['sc:description'] != '[object Object]'" data-ng-bind="selectedSchema['sc:schema']['sc:description']"/>
    42                         <p data-ng-if="selectedSchema['sc:schema']['sc:description'] == '[object Object]'">--</p>
     42                        <span data-ng-controller="NamePanelCtrl">
     43                            <form name="workspace.namePanel.editForm" data-collapse="!workspace.namePanel.editForm.open" class="form-horizontal">
     44                                <div class="form-group no-bottom-margin">
     45                                    <span class="col-xs-9">
     46                                        <input name="input" class="form-control" type="text" data-ng-model="selectedSchema['sc:schema']['sc:name']" ng-trim="false"></input>                                       
     47                                    </span>
     48                                    <span class="col-xs-3">                                   
     49                                        <span data-ng-show="workspace.namePanel.editForm.$dirty &amp;&amp; !workspace.namePanel.waitingForServerUpdate">
     50                                            &nbsp;&nbsp;
     51                                            <a class="cursor-pointer" data-tooltip="Save changes" data-tooltip-popup-delay="750" data-ng-click="saveName()"><i class="glyphicon glyphicon-ok small"></i></a>
     52                                                    &nbsp;&nbsp;
     53                                            <a class="cursor-pointer" data-tooltip="Discard changes" data-tooltip-popup-delay="750" data-ng-click="toggleEditName(true)"><i class="glyphicon glyphicon-remove small"></i></a>
     54                                        </span>
     55                                        <span data-ng-show="workspace.namePanel.waitingForServerUpdate">
     56                                            &nbsp;&nbsp;&nbsp;<img src="images/spinner-small.gif" alt="Saving..."/>
     57                                        </span>
     58                                    </span>
     59                                </div>
     60                            </form>
     61                            <h1 id="schema-name" class="inline" data-ng-bind="selectedSchema['sc:schema']['sc:name']"></h1>
     62                            <span>&nbsp;</span>
     63                            <a data-ng-class="{'glow-warn': workspace.namePanel.editForm.$dirty}" data-ng-if="schemaEditable &amp;&amp; !workspace.namePanel.editForm.open" class="small cursor-pointer" data-tooltip="{{workspace.namePanel.editButtonTooltip}}" data-tooltip-popup-delay="750" data-tooltip-append-to-body="true" data-ng-click="toggleEditName(false)">
     64                                <i class="glyphicon glyphicon-edit"></i>
     65                            </a>
     66                            <a data-ng-if="schemaEditable &amp;&amp; workspace.namePanel.editForm.open" class="small cursor-pointer glow" data-tooltip="{{workspace.namePanel.editButtonTooltip}}" data-tooltip-popup-delay="750" data-tooltip-append-to-body="true" data-ng-click="toggleEditName(false)">
     67                                <i class="glyphicon glyphicon-chevron-up"></i>
     68                            </a>
     69                        </span>
     70                        <span data-ng-controller="DescriptionPanelCtrl">
     71                            <form name="workspace.descriptionPanel.editForm" data-collapse="!workspace.descriptionPanel.editForm.open" class="help-block">
     72                                <div class="form-group">
     73                                    <div class="row">
     74                                        <div class="col-xs-11">
     75                                            <textarea name="input" class="form-control vertical" data-ng-model="selectedSchema['sc:schema']['sc:description']" ng-trim="false" data-autosize-textarea=""></textarea>
     76                                        </div>
     77                                        <div class="col-xs-1 row text-center" data-ng-if="!workspace.descriptionPanel.waitingForServerUpdate &amp;&amp; workspace.descriptionPanel.editForm.$dirty">
     78                                            <div>
     79                                                <a class="cursor-pointer" data-tooltip="Save description" data-tooltip-popup-delay="750" data-ng-click="saveDescription()">
     80                                                    <i class="glyphicon glyphicon-ok small"></i>
     81                                                </a>
     82                                            </div>
     83                                            <div>
     84                                                <a class="cursor-pointer" data-tooltip="Discard changes" data-tooltip-popup-delay="750" data-ng-click="toggleEditDescription(true)">
     85                                                    <i class="glyphicon glyphicon-remove small"></i>
     86                                                </a>
     87                                            </div>
     88                                        </div>
     89                                        <div id="description-spinner" class="col-xs-1 row text-center" data-ng-if="workspace.descriptionPanel.waitingForServerUpdate">
     90                                            <img src="images/spinner.gif" alt="Loading..."/>
     91                                        </div>
     92                                    </div>
     93                                    <div class="has-error" data-collapse="!workspace.descriptionPanel.updateAjaxError">
     94                                        <span class="help-block small">
     95                                            <div>The server responded with an error. Please try again!</div>
     96                                            <div>If the problem persists contact us at:</div>
     97                                            <address><a href="mailto:tla@mpi.nl">isocat@mpi.nl</a></address>
     98                                        </span>
     99                                    </div>
     100                                </div>
     101                            </form>
     102                            <p>
     103                                <span>
     104                                    <span data-ng-if="selectedSchema['sc:schema']['sc:description'] != ''" data-ng-bind="selectedSchema['sc:schema']['sc:description']" class="pre-wrap"></span>
     105                                    <span data-ng-if="selectedSchema['sc:schema']['sc:description'] == ''">--</span>
     106                                    <span>&nbsp;</span>
     107                                    <small>
     108                                        <a data-ng-class="{'glow-warn': workspace.descriptionPanel.editForm.$dirty}" data-ng-if="schemaEditable &amp;&amp; !workspace.descriptionPanel.editForm.open" class="small cursor-pointer" data-tooltip="{{workspace.descriptionPanel.editButtonTooltip}}" data-tooltip-popup-delay="750" data-tooltip-append-to-body="true" data-ng-click="toggleEditDescription(false)">
     109                                            <i class="glyphicon glyphicon-edit"></i>
     110                                        </a>
     111                                        <a data-ng-if="schemaEditable &amp;&amp; workspace.descriptionPanel.editForm.open" class="small cursor-pointer glow" data-tooltip="{{workspace.descriptionPanel.editButtonTooltip}}" data-tooltip-popup-delay="750" data-tooltip-append-to-body="true" data-ng-click="toggleEditDescription(false)">
     112                                            <i class="glyphicon glyphicon-chevron-up"></i>
     113                                        </a>
     114                                    </small>
     115                                </span>
     116                            </p>
     117                        </span>
    43118                        <div class="row">
    44                             <div class="col-sm-2">
     119                            <div class="col-sm-3" data-ng-init="workspace.collapsibleDetailPanels.version.open = false;">
    45120                                <h4>Version:</h4>
    46                                 <p data-ng-if="selectedSchema['sc:schema']['sc:version'] != '[object Object]'" data-ng-bind="selectedSchema['sc:schema']['sc:version']"/>
    47                                 <p data-ng-if="selectedSchema['sc:schema']['sc:version'] == '[object Object]'">--</p>
    48                             </div>
    49                             <div class="col-sm-2">
     121                                <div data-collapse="workspace.collapsibleDetailPanels.version.resettingUpdate">
     122                                    <p>
     123                                        <span data-ng-if="selectedSchema['sc:schema']['sc:version'] != ''" data-ng-bind="selectedSchema['sc:schema']['sc:version']"></span>
     124                                        <span data-ng-if="selectedSchema['sc:schema']['sc:version'] == ''">&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;</span>
     125                                        <span id="version-actions">
     126                                            <span>&nbsp;</span>
     127                                            <span data-ng-if="!workspace.collapsibleDetailPanels.version.open" class="word-breaking-wraper">
     128                                                <a data-ng-class="{'glow-warn': workspace.collapsibleDetailPanels.version.editForm.$dirty}" data-tooltip="{{workspace.collapsibleDetailPanels.version.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     129                                                    data-tooltip-placement="top" data-ng-click="toggleDetailsPanel('version')" class="cursor-pointer"><i class="glyphicon glyphicon-collapse-down small"></i></a>
     130                                            </span>
     131                                            <span data-ng-if="workspace.collapsibleDetailPanels.version.open" class="word-breaking-wraper">
     132                                                <a class="glow cursor-pointer" data-tooltip="{{workspace.collapsibleDetailPanels.version.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     133                                                    data-tooltip-placement="bottom" data-ng-click="toggleDetailsPanel('version')"><i class="glyphicon glyphicon-collapse-up  small"></i></a>
     134                                            </span>
     135                                        </span>
     136                                    </p>
     137                                </div>
     138                            </div>
     139                            <div class="col-sm-3" data-ng-init="workspace.collapsibleDetailPanels.status.open = false;">
    50140                                <h4>Status:</h4>
    51                                 <p data-ng-if="selectedSchema['sc:schema']['sc:status'] != '[object Object]'" data-ng-bind="selectedSchema['sc:schema']['sc:status']"/>
    52                                 <p data-ng-if="selectedSchema['sc:schema']['sc:status'] == '[object Object]'">--</p>
    53                             </div>
    54                             <div class="col-sm-3" data-ng-init="accessDetailsPanel.open = false;">
     141                                <div>
     142                                    <p>
     143                                        <span data-ng-if="selectedSchema['sc:schema']['sc:status'] != ''" data-ng-bind="selectedSchema['sc:schema']['sc:status']"></span>
     144                                        <span data-ng-if="selectedSchema['sc:schema']['sc:status'] == ''">&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;</span>
     145                                        <span id="status-actions">
     146                                            <span>&nbsp;</span>
     147                                            <span data-ng-if="!workspace.collapsibleDetailPanels.status.open" class="word-breaking-wraper">
     148                                                <a data-tooltip="{{workspace.collapsibleDetailPanels.status.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     149                                                    data-tooltip-placement="top" data-ng-click="toggleDetailsPanel('status')" class="cursor-pointer"><i class="glyphicon glyphicon-collapse-down small"></i></a>
     150                                            </span>
     151                                            <span data-ng-if="workspace.collapsibleDetailPanels.status.open" class="word-breaking-wraper">
     152                                                <a class="glow cursor-pointer" data-tooltip="{{workspace.collapsibleDetailPanels.status.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     153                                                    data-tooltip-placement="bottom" data-ng-click="toggleDetailsPanel('status')"><i class="glyphicon glyphicon-collapse-up small"></i></a>
     154                                            </span>
     155                                        </span>
     156                                    </p>
     157                                </div>
     158                            </div>
     159                            <div class="col-sm-3" data-ng-init="workspace.collapsibleDetailPanels.access.open = false;">
    55160                                <h4>Access:</h4>
    56                                 <div data-collapse="workspace.waitingForServerAccessStatusUpdate">
     161                                <div data-collapse="workspace.collapsibleDetailPanels.access.waitingForServerUpdate">
    57162                                    <p>
    58163                                        <span data-ng-if="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">shared URL&nbsp;</span>
    59164                                        <span data-ng-if="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] != 'r'">private&nbsp;&nbsp;</span>
    60                                         <small id="access-actions">
    61                                             <span data-ng-show="!accessDetailsPanel.open" class="word-breaking-wraper">
    62                                                 <a data-tooltip="Show access policy details" data-tooltip-popup-delay="750"
    63                                                     data-tooltip-placement="top" data-ng-click="toggleAccessDetails()" class="cursor-pointer"><i class="glyphicon glyphicon-collapse-down"></i></a>
    64                                             </span>
    65                                             <span data-ng-show="accessDetailsPanel.open" class="word-breaking-wraper">
    66                                                 <a data-tooltip="Hidde access policy details" data-tooltip-popup-delay="750"
    67                                                     data-tooltip-placement="bottom" data-ng-click="toggleAccessDetails()" class="cursor-pointer"><i class="glyphicon glyphicon-collapse-up"></i></a>
    68                                             </span>
    69                                         </small>
    70                                     </p>
    71                                 </div>
    72                             </div>
    73                             <div class="col-sm-2">
     165                                        <span id="access-actions">
     166                                            <span data-ng-if="!workspace.collapsibleDetailPanels.access.open" class="word-breaking-wraper">
     167                                                <a data-tooltip="{{workspace.collapsibleDetailPanels.access.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     168                                                    data-tooltip-placement="top" data-ng-click="toggleDetailsPanel('access')" class="cursor-pointer"><i class="glyphicon glyphicon-collapse-down small"></i></a>
     169                                            </span>
     170                                            <span data-ng-if="workspace.collapsibleDetailPanels.access.open" class="word-breaking-wraper">
     171                                                <a class="glow cursor-pointer" data-tooltip="{{workspace.collapsibleDetailPanels.access.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     172                                                    data-tooltip-placement="bottom" data-ng-click="toggleDetailsPanel('access')"><i class="glyphicon glyphicon-collapse-up small"></i></a>
     173                                            </span>
     174                                        </span>
     175                                    </p>
     176                                </div>
     177                            </div>
     178                            <div class="col-sm-3" data-ng-init="workspace.collapsibleDetailPanels.license.open = false;">
    74179                                <h4>License:</h4>
    75                                 <p data-ng-if="selectedSchema['sc:schema']['sc:license'] != undefined">
    76                                     <a href="{{selectedSchema['sc:schema']['sc:license']['sc:license-text']}}" data-tooltip-append-to-body="true" data-tooltip-placement="right" data-tooltip-html-unsafe="{{selectedSchema['sc:schema']['sc:license']['sc:full-name']}}<br/><span>OSI approved: </span><span>{{selectedSchema['sc:schema']['sc:license']['sc:OSI-approved']}}</span><br/><br/><span>Click to view license text...</span>">
    77                                         <small data-ng-bind="selectedSchema['sc:schema']['sc:license']['xml:id']"></small>
    78                                     </a>
     180                                <p data-ng-if="selectedSchema['sc:schema']['sc:license'] != undefined" data-collapse="workspace.collapsibleDetailPanels.license.updatingLicense">
     181                                    <small data-ng-bind="selectedSchema['sc:schema']['sc:license']['xml:id']"></small>
     182                                    <span id="license-actions">&nbsp;
     183                                            <span data-ng-if="!workspace.collapsibleDetailPanels.license.open" class="word-breaking-wraper">
     184                                                <a data-ng-class="{'glow-warn': workspace.collapsibleDetailPanels.license.modelDirty}" data-tooltip="{{workspace.collapsibleDetailPanels.license.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     185                                                    data-tooltip-placement="top" data-ng-click="toggleDetailsPanel('license')" class="cursor-pointer"><i class="glyphicon glyphicon-collapse-down small"></i></a>
     186                                            </span>
     187                                            <span data-ng-if="workspace.collapsibleDetailPanels.license.open" class="word-breaking-wraper">
     188                                                <a class="glow cursor-pointer" data-tooltip="{{workspace.collapsibleDetailPanels.license.detailButtonTooltip}}" data-tooltip-popup-delay="750"
     189                                                    data-tooltip-placement="bottom" data-ng-click="toggleDetailsPanel('license')"><i class="glyphicon glyphicon-collapse-up  small"></i></a>
     190                                            </span>
     191                                    </span>
    79192                                </p>                           
    80193                                <p data-ng-if="selectedSchema['sc:schema']['sc:license'] == undefined">--</p>
    81194                            </div>
    82195                        </div>
    83                         <div class="row col-md-12" data-ng-controller="accessDetailsPanelCtrl">
    84                             <div class="panel panel-primary small modal-title" data-collapse="!accessDetailsPanel.open">
     196                        <div class="row col-md-12" data-ng-controller="VersionDetailsPanelCtrl">
     197                            <div class="panel panel-primary small modal-title" data-collapse="!workspace.collapsibleDetailPanels.version.open">
     198                                <div class="panel-heading">
     199                                    <label>Version details:</label>
     200                                </div>
     201                                <div class="panel-body">
     202                                    <div data-ng-if="schemaEditable">
     203                                        <div data-collapse="!workspace.collapsibleDetailPanels.version.editPanel.open">
     204                                            <form name="workspace.collapsibleDetailPanels.version.editForm" class="form-inline">
     205                                                <div class="form-group">
     206                                                    <label class="control-label">New version:&nbsp;&nbsp;</label>
     207                                                    <input name="input" class="form-control" type="text" data-ng-model="selectedSchema['sc:schema']['sc:version']"></input>
     208                                                    <span data-ng-show="workspace.collapsibleDetailPanels.version.editForm.$dirty &amp;&amp; !workspace.collapsibleDetailPanels.version.waitingForServerUpdate">
     209                                                        &nbsp;&nbsp;
     210                                                        <a class="cursor-pointer" data-tooltip="Save changes" data-tooltip-popup-delay="750" data-ng-click="saveVersion()"><i class="glyphicon glyphicon-ok small"></i></a>
     211                                                        &nbsp;&nbsp;
     212                                                        <a class="cursor-pointer" data-tooltip="Discard changes" data-tooltip-popup-delay="750" data-ng-click="toggleEditVersion(true)"><i class="glyphicon glyphicon-remove small"></i></a>
     213                                                    </span>
     214                                                    <span data-ng-show="workspace.collapsibleDetailPanels.version.waitingForServerUpdate">
     215                                                        &nbsp;&nbsp;&nbsp;<img src="images/spinner-small.gif" alt="Saving..."/>
     216                                                    </span>
     217                                                </div>
     218                                            </form>
     219                                            <div class="form-group has-error" data-collapse="!workspace.collapsibleDetailPanels.version.updateAjaxError">
     220                                                <span class="help-block">
     221                                                    <div>The server responded with an error. Please try again!</div>
     222                                                    <div>If the problem persists contact us at:</div>
     223                                                    <address><a href="mailto:tla@mpi.nl">isocat@mpi.nl</a></address>
     224                                                </span>
     225                                            </div>
     226                                            <br/>
     227                                        </div>
     228                                    </div>
     229                                    <p data-collapse="workspace.collapsibleDetailPanels.version.resettingUpdate">
     230                                        <label>
     231                                            <span data-ng-if="selectedSchema['sc:schema']['sc:version'] != ''">{{selectedSchema['sc:schema']['sc:version']}}&nbsp;&nbsp;</span>
     232                                            <span data-ng-if="selectedSchema['sc:schema']['sc:version'] == ''">--&nbsp;&nbsp;</span>
     233                                        </label>
     234                                        <a data-ng-if="schemaEditable &amp;&amp; !workspace.collapsibleDetailPanels.version.editPanel.open" data-ng-class="{'glow-warn': workspace.collapsibleDetailPanels.version.editForm.$dirty}" class="small cursor-pointer" data-tooltip="{{workspace.collapsibleDetailPanels.version.editButtonTooltip}}"data-tooltip-popup-delay="750" data-ng-click="toggleEditVersion(false)">
     235                                            <i class="glyphicon glyphicon-edit"></i>
     236                                        </a>
     237                                        <a class="small cursor-pointer glow" data-ng-if="workspace.collapsibleDetailPanels.version.editPanel.open" data-tooltip="{{workspace.collapsibleDetailPanels.version.editButtonTooltip}}" data-tooltip-popup-delay="750" data-ng-click="toggleEditVersion(false)">
     238                                            <i class="glyphicon glyphicon-chevron-up"></i>
     239                                        </a>
     240                                    </p>
     241                                    <div data-collapse="workspace.collapsibleDetailPanels.version.waitingForServerUpdate">
     242                                        <div data-ng-show="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">
     243                                            <p data-ng-if="selectedSchema['sc:schema']['sc:version'] == ''">This schema has no version number and cannot be published. Edit the field to assign a version number.</p>
     244                                        </div>
     245                                    </div>
     246                                </div>
     247                            </div>
     248                        </div>
     249                        <div class="row col-md-12" data-ng-controller="StatusDetailsPanelCtrl">
     250                            <div class="panel panel-primary small modal-title" data-collapse="!workspace.collapsibleDetailPanels.status.open">
     251                                <div class="panel-heading">
     252                                    <label>Status details:</label>
     253                                </div>
     254                                <div class="panel-body">
     255                                    <div data-ng-if="schemaEditable">
     256                                        <div data-collapse="!workspace.collapsibleDetailPanels.status.editPanel.open">
     257                                            <form name="workspace.collapsibleDetailPanels.status.editForm" class="form-inline">
     258                                                <div class="form-group small">
     259                                                    <select name="input" class="form-control" data-ng-model="selectedSchema['sc:schema']['sc:status']" data-ng-options="status for status in workspace.collapsibleDetailPanels.status.possibleStatusList" data-ng-change="saveStatus()">
     260                                                    </select>
     261                                                    <span data-ng-show="workspace.collapsibleDetailPanels.status.waitingForServerUpdate">
     262                                                        &nbsp;&nbsp;<img src="images/spinner-small.gif" alt="Saving..."/>
     263                                                    </span>
     264                                                </div>
     265                                                <br/><br/>
     266                                            </form>
     267                                            <div class="form-group has-error" data-collapse="!workspace.collapsibleDetailPanels.status.updateAjaxError">
     268                                                <span class="help-block">
     269                                                    <div>The server responded with an error. Please try again!</div>
     270                                                    <div>If the problem persists contact us at:</div>
     271                                                    <address><a href="mailto:tla@mpi.nl">isocat@mpi.nl</a></address>
     272                                                </span>
     273                                            </div>
     274                                        </div>
     275                                    </div>
     276                                    <p data-collapse="workspace.collapsibleDetailPanels.status.waitingForServerUpdate">
     277                                        <label>
     278                                            <span data-ng-if="selectedSchema['sc:schema']['sc:status'] != ''" class="capitalize">{{selectedSchema['sc:schema']['sc:status']}}&nbsp;&nbsp;</span>
     279                                            <span data-ng-if="selectedSchema['sc:schema']['sc:status'] == ''">--&nbsp;&nbsp;</span>
     280                                            <a data-ng-if="schemaEditable &amp;&amp; !workspace.collapsibleDetailPanels.status.editPanel.open" class="small cursor-pointer" data-tooltip="Change schema status" data-tooltip-popup-delay="750" data-ng-click="toggleEditStatus()">
     281                                                <i class="glyphicon glyphicon-edit"></i>
     282                                            </a>
     283                                            <a data-ng-if="schemaEditable &amp;&amp;workspace.collapsibleDetailPanels.status.editPanel.open" class="small cursor-pointer glow" data-tooltip="Hide edit panel" data-tooltip-popup-delay="750" data-ng-click="toggleEditStatus()">
     284                                                <i class="glyphicon glyphicon-chevron-up"></i>
     285                                            </a>
     286                                        </label>
     287                                    </p>
     288                                    <div data-collapse="workspace.collapsibleDetailPanels.status.waitingForServerUpdate">
     289                                        <p data-ng-if="selectedSchema['sc:schema']['sc:status'] == ''">This schema has no status information and cannot be published. Edit the field to assign a status.</p>
     290                                        <div data-ng-if="selectedSchema['sc:schema']['sc:status'] == 'production' &amp;&amp; selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">
     291                                            <p>This schema is published and in production. After publishing, the schema status can only be changed to 'deprecated' or 'superseeded'.</p>
     292                                        </div>
     293
     294                                        <div data-ng-if="selectedSchema['sc:schema']['sc:status'] == 'development' &amp;&amp; selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] != 'r'">
     295                                            <p>This schema is in development and not published yet. Before publishing, the schema status can only be changed to 'deprecated' or 'superseeded'. When publishing the schema status will be automacticaly updated to 'production'.</p>
     296                                        </div>
     297                                        <div>
     298                                            <p data-ng-if="selectedSchema['sc:schema']['sc:status'] == 'deprecated'">This schema has been deprecated.</p>
     299                                        </div>
     300                                        <div>
     301                                            <p data-ng-if="selectedSchema['sc:schema']['sc:status'] == 'superseeded'">This schema has been superseeded.</p>
     302                                        </div>
     303                                       
     304                                    </div>
     305                                </div>
     306                            </div>
     307                        </div>
     308                        <div class="row col-md-12" data-ng-controller="AccessDetailsPanelCtrl">
     309                            <div class="panel panel-primary small modal-title" data-collapse="!workspace.collapsibleDetailPanels.access.open">
    85310                                <div class="panel-heading">
    86311                                    <label>Access policy:</label>
     
    88313                                <div class="panel-body">
    89314                                    <div data-ng-if="schemaEditable">
    90                                         <div data-collapse="!editAccessPanel.open">
    91                                             <form name="workspace.editAccessForm" class="form-inline">
     315                                        <div data-collapse="!workspace.collapsibleDetailPanels.access.editPanel.open">
     316                                            <form name="workspace.collapsibleDetailPanels.access.editForm" class="form-inline">
    92317                                                <div class="form-group small">
    93318                                                    <label>Private</label>
    94                                                     <input type="radio" data-ng-change="saveAccessStatus(workspace.editAccessForm.accessPolicy)" name="accessRadios" id="accessRadios1" data-ng-model="workspace.editAccessForm.accessPolicy" value="private" ></input>
     319                                                    <input type="radio" data-ng-change="saveAccessStatus(currentAccessPolicy)" name="input" id="accessRadios1" data-ng-model="currentAccessPolicy" value="private" ></input>
    95320                                                    <span>&nbsp;</span>
    96321                                                    <label>Shared URL</label>
    97                                                     <input type="radio" data-ng-change="saveAccessStatus(workspace.editAccessForm.accessPolicy)" name="accessRadios" id="accessRadios2" data-ng-model="workspace.editAccessForm.accessPolicy" value="shareURL"></input>
    98                                                     <span data-ng-show="workspace.waitingForServerAccessStatusUpdate">
     322                                                    <input type="radio" data-ng-change="saveAccessStatus(currentAccessPolicy)" name="input" id="accessRadios2" data-ng-model="currentAccessPolicy" value="shareURL"></input>
     323                                                    <span data-ng-show="workspace.collapsibleDetailPanels.access.waitingForServerUpdate">
    99324                                                        &nbsp;&nbsp;<img src="images/spinner-small.gif" alt="Saving..."/>
    100325                                                    </span>
    101326                                                </div>
    102327                                            </form>
    103                                             <div class="form-group has-error">
    104                                                 <span class="help-block" data-collapse="!workspace.accessStatusUpdateAjaxError">
     328                                            <div class="form-group has-error" data-collapse="!workspace.collapsibleDetailPanels.access.updateAjaxError">
     329                                                <span class="help-block">
    105330                                                    <div>The server responded with an error. Please try again!</div>
    106331                                                    <div>If the problem persists contact us at:</div>
     
    110335                                        </div>
    111336                                    </div>
    112                                     <p data-collapse="workspace.waitingForServerAccessStatusUpdate">
     337                                    <p data-collapse="workspace.collapsibleDetailPanels.access.waitingForServerUpdate">
    113338                                        <label>
    114339                                            <span data-ng-hide="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] != 'r'">Shared URL&nbsp;&nbsp;</span>
    115340                                            <span data-ng-show="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] != 'r'">Private&nbsp;&nbsp;</span>
    116                                             <a class="small cursor-pointer" data-ng-show="editAccessPanel.open" data-tooltip="Hide edit panel" data-tooltip-popup-delay="750" data-ng-click="toggleEditAccess()">
     341                                            <a data-ng-if="schemaEditable &amp;&amp; !workspace.collapsibleDetailPanels.access.editPanel.open" class="small cursor-pointer" data-tooltip="Change access policy" data-tooltip-popup-delay="750" data-ng-click="toggleEditAccess()">
     342                                                <i class="glyphicon glyphicon-edit"></i>
     343                                            </a>
     344                                            <a data-ng-if="schemaEditable &amp;&amp; workspace.collapsibleDetailPanels.access.editPanel.open" class="small cursor-pointer glow" data-tooltip="Hide edit panel" data-tooltip-popup-delay="750" data-ng-click="toggleEditAccess()">
    117345                                                <i class="glyphicon glyphicon-chevron-up"></i>
    118346                                            </a>
    119                                             <a data-ng-if="schemaEditable" class="small cursor-pointer" data-ng-hide="editAccessPanel.open" data-tooltip="Change access policy" data-tooltip-popup-delay="750" data-ng-click="toggleEditAccess()">
    120                                                 <i class="glyphicon glyphicon-edit"></i>
    121                                             </a>
    122347                                        </label>
    123348                                    </p>
    124                                     <div data-collapse="workspace.waitingForServerAccessStatusUpdate">
     349                                    <div data-collapse="workspace.collapsibleDetailPanels.access.waitingForServerUpdate">
    125350                                        <div data-ng-show="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">
    126351                                            <p>This schema is shared and its files can be accessed by anyone through the following public URL(s):</p>
     
    131356                                        <div data-ng-hide="selectedSchema['sc:schema']['sc:access']['sc:all']['actions'] == 'r'">
    132357                                            <p>This schema is private to your workspace and cannot be accessed without authentication.</p>
     358                                        </div>
     359                                    </div>
     360                                </div>
     361                            </div>
     362                        </div>
     363                        <div class="row col-md-12" data-ng-controller="LicenseDetailsPanelCtrl">
     364                            <div class="panel panel-primary small modal-title" data-collapse="!workspace.collapsibleDetailPanels.license.open">
     365                                <div class="panel-heading">
     366                                    <label>License details:</label>
     367                                </div>
     368                                <div class="panel-body">
     369                                    <div data-collapse="workspace.collapsibleDetailPanels.license.updatingLicense">
     370                                        <p>
     371                                            <label>
     372                                                <span data-ng-bind="selectedSchema['sc:schema']['sc:license']['sc:full-name']"></span><span>&nbsp;&nbsp;</span>
     373                                                <a data-ng-if="schemaEditable" data-ng-class="{'glow-warn': workspace.collapsibleDetailPanels.license.modelDirty}"  class="small cursor-pointer" data-tooltip="{{workspace.collapsibleDetailPanels.license.editButtonTooltip}}" data-tooltip-popup-delay="750" data-ng-click="triggerOpenModalRoute()">
     374                                                    <i class="glyphicon glyphicon-edit"></i>
     375                                                </a>
     376                                            </label>
     377                                        </p>
     378                                        <div>
     379                                            <div>
     380                                                <p><span>OSI approved: </span><span>{{selectedSchema['sc:schema']['sc:license']['sc:OSI-approved']}}</span></p>
     381                                                <a href="{{selectedSchema['sc:schema']['sc:license']['sc:license-text']}}">
     382                                                    <p>Click to view license text...</p>
     383                                                </a>
     384                                            </div>
    133385                                        </div>
    134386                                    </div>
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.js

    r4470 r4567  
    11'use strict';
    2 
    32
    43function prepareArrayForNgRepeat(data) {
     
    1110}
    1211
     12function isEmptyObj(obj) {
     13    if (obj instanceof Object) {
     14        for (var prop in obj) {
     15            if (obj.hasOwnProperty(prop))
     16                return false;
     17        }
     18        return true;
     19    } else
     20        return false;
     21}
     22
     23function fixEmptyFields(json) {
     24    if (isEmptyObj(json))
     25        return '';
     26    for (var prop in json) {
     27        if (json.hasOwnProperty(prop)) {
     28            if (isEmptyObj(json[prop]))
     29                json[prop] = '';
     30            else if (json[prop] instanceof Object)
     31                fixEmptyFields(json[prop]);
     32        }
     33    }
     34    return json;
     35}
     36
    1337//SCHEMAcat angular controllers
    1438SCHEMAcat.controller('WorkspaceCtrl', ['$scope', '$location', '$routeParams', '$timeout', 'SchemasList', 'Schema', 'UserService', 'Settings',
     
    4670                    parentScope.totalSchemaItems = result['sc:result']['sc:total-schemas'];
    4771                    parentScope.currentPage = Number(page);
    48 
    49 
    5072                    //when there is just one element we create an array with it, so ng-repeat repeats just once
    5173                    parentScope.schemasList = prepareArrayForNgRepeat(result['sc:result']['sc:schemas']['sc:schema']);
    52 
    5374                    loadSchemaMetadata($location.search().schemaIndex);
    54 
    55                     parentScope.schemasResult = result;
     75                    parentScope.schemasResult = fixEmptyFields(result);
    5676                });
    5777        }
     
    84104                    //when there is just one element we create an array with it, so ng-repeat repeats just once
    85105                    parentScope.filesList = prepareArrayForNgRepeat(result['sc:schema']['sc:files']['sc:file']);
     106                    parentScope.selectedSchema = fixEmptyFields(result);
     107                    parentScope.schemaEditable = UserService.id === getSchemaOwnerID();
     108                    parentScope.resultHasArrived = true;
    86109
    87110                    if (Settings.getAnimationStatus()) {
     
    100123                    } else
    101124                        $scope.animateSchemaChange = '';
    102                     parentScope.selectedSchema = result;
    103                     if ($scope.animateWorkspacePageChange === '')
    104                         updateAccessDetailsPanel();
    105                     parentScope.resultHasArrived = true;
    106                 });
    107 
     125                });
    108126        }
    109127
     
    118136        }
    119137
    120 
    121         function updateAccessDetailsPanel() {
    122             $scope.schemaEditable = UserService.id === getSchemaOwnerID();
    123             if ($scope.schemaEditable)
    124                 $timeout(function() {
    125                     $scope.workspace.editAccessForm.accessPolicy = $scope.workspace.getAccessPolicy();
    126                 });
    127             $scope.workspace.updateEditAccessPanel();
    128             if ($location.search().showAccessDetails) {
    129                 $scope.accessDetailsPanel.open = true;
    130             } else
    131                 $scope.accessDetailsPanel.open = false;
     138        function updateMetadataPane() {
     139            $scope.workspace.namePanel.updateEditingName();
     140            $scope.workspace.descriptionPanel.updateEditingDescription();
     141            updateCollapsibleDetailPanels();
     142        }
     143
     144        function updateCollapsibleDetailPanels() {
     145            var detailsPanelExpanded = false;
     146            for (var panel in editPanelsRoutes) {
     147                if ($location.search().hasOwnProperty(editPanelsRoutes[panel])) {
     148                    expandDetailsPanel(panel);
     149                    detailsPanelExpanded = true;
     150                }
     151            }
     152            if (!detailsPanelExpanded) {
     153                closeOtherCollapsibleDetailPanels('');
     154            }
     155        }
     156
     157        function closeOtherCollapsibleDetailPanels(panel) {
     158            for (var pnl in $scope.workspace.collapsibleDetailPanels) {
     159                if (pnl !== panel) {
     160                    $scope.workspace.collapsibleDetailPanels[pnl].detailButtonTooltip = 'Show field details';
     161                    if ($scope.workspace.collapsibleDetailPanels[pnl].open === true) {
     162                        collapseDetailsPanel(pnl);
     163                        return true;
     164                    }
     165                }
     166            }
     167            return false;
     168        }
     169
     170        function collapseDetailsPanel(panel) {
     171            if ($scope.workspace.collapsibleDetailPanels[panel].editForm &&
     172                $scope.workspace.collapsibleDetailPanels[panel].editForm.$dirty || $scope.workspace.collapsibleDetailPanels[panel].modelDirty)
     173                $scope.workspace.collapsibleDetailPanels[panel].detailButtonTooltip += ' (there are unsaved changes in this field!)';
     174            $scope.workspace.collapsibleDetailPanels[panel].open = false;
     175        }
     176
     177        function expandDetailsPanel(panel) {
     178            if (editPanelsRoutes.hasOwnProperty(panel)) {
     179                if (closeOtherCollapsibleDetailPanels(panel)) {
     180                    //if there was other collapsible detail panel expanded, wait 350ms before expanding the clicked panel, to
     181                    //give time for the collpase animation of the previously open panel to finish.
     182                    $timeout(function() {
     183                        updateAndExpandPanel(panel);
     184                    }, 350);
     185                } else
     186                    updateAndExpandPanel(panel);
     187            }
     188
     189            function updateAndExpandPanel(panel) {
     190                if ($scope.workspace.collapsibleDetailPanels[panel] !== undefined && $scope.workspace.collapsibleDetailPanels[panel].updateEditPanel !== undefined)
     191                    $scope.workspace.collapsibleDetailPanels[panel].updateEditPanel();
     192                $scope.workspace.collapsibleDetailPanels[panel].detailButtonTooltip = 'Hide field details';
     193                $scope.workspace.collapsibleDetailPanels[panel].open = true;
     194            }
    132195        }
    133196
     
    137200        parentScope.pageSize = 10;
    138201
     202
     203        var editPanelsRoutes = {
     204            version: 'showVersionDetails',
     205            status: 'showStatusDetails',
     206            access: 'showAccessDetails',
     207            license: 'showLicenseDetails'
     208        };
     209
    139210        //these models are stored in the local $scope since they are not used across page changes
    140211        $scope.selectedSchemaIndex = $routeParams.schemaIndex;
     
    145216        $scope.workspace = {};
    146217        $scope.location = location;
     218
     219        //load the schemas page and the selected schema metadata.
     220        //if reading the workspace for the first time i.e. not due to page change click
     221        if (!parentScope.workspaceFullyLoaded)
     222            loadSchemasList($routeParams.pageNumber);
     223
     224
     225        //update the current route when user clicks in another page in the paginator.
     226        //This triggers a $routeChangeStart event since we are changing the route path part.
     227        $scope.selectPage = function(page) {
     228            $location.search().schemaIndex = '0';
     229            delete $location.search().show;
     230            $location.path('workspace.html/page/' + page + '/').search($location.search());
     231        };
     232
     233        //update the current route when the uses clicks one schema in the list. This triggers
     234        //a $routeUpdate event since we are just changing the route search part.
     235        $scope.selectSchema = function(rowIndex) {
     236            $location.search().schemaIndex = rowIndex.toString();
     237            delete $location.search().show;
     238            $location.search($location.search());
     239        };
     240
     241        $scope.toggleDetailsPanel = function(panel) {
     242            var route = editPanelsRoutes[panel];
     243            //check if we are collapsing or expanding the panel
     244            if ($location.search()[route]) {
     245                //collapsing -> delete panel route
     246                delete $location.search()[route];
     247            } else {
     248                //expanding -> 1. clean routes from other detail panels if they are open
     249                for (var prop in editPanelsRoutes) {
     250                    if (editPanelsRoutes[prop] !== route)
     251                        delete $location.search()[editPanelsRoutes[prop]];
     252                }
     253                //2. update the route to display the clicked panel
     254                $location.search()[editPanelsRoutes[panel]] = true;
     255            }
     256            //apply the new route
     257            $location.search($location.search());
     258        };
     259
     260        //listen for the $routeChangeStart event. Triggered when route path is changed (page change).
     261        $scope.$on('$routeChangeStart', function(event, next, current) {
     262            parentScope.resultHasArrived = false;
     263            if (Settings.getAnimationStatus()) {
     264                if (next.params !== undefined &&
     265                    next.params.pageNumber !== undefined &&
     266                    next.params.pageNumber > current.params.pageNumber)
     267                    parentScope.toNextPage = true;
     268                else
     269                    parentScope.toNextPage = false;
     270
     271                //slide out workspace page
     272                switch (next.templateUrl) {
     273                    case 'partials/workspace.html':
     274                        $scope.animateWorkspacePageChange =
     275                            parentScope.toNextPage ?
     276                            'animated slideOutLeft' : 'animated slideOutRight';
     277                        break;
     278                    case 'partials/contact.html':
     279                    case 'partials/about.html':
     280                        $scope.animateWorkspacePageChange = 'animated slideOutLeft';
     281                        break;
     282                    default:
     283                        $scope.animateWorkspacePageChange = 'animated fadeOutDown';
     284                }
     285            }
     286            if (next.templateUrl === 'partials/workspace.html')
     287                loadSchemasList(next.params.pageNumber);
     288            else
     289                parentScope.workspaceFullyLoaded = false;
     290        });
     291
     292        $scope.$on('$routeChangeSuccess', function(event, current, previous) {
     293            //when coming back to the workspace from other routes, the workspace should apear from the left to the right
     294            if (Settings.getAnimationStatus()) {
     295                if (previous === undefined || previous.templateUrl === undefined ||
     296                    previous.templateUrl === 'partials/accountDetails.html')
     297                    parentScope.toNextPage = undefined;
     298            }
     299        });
     300
     301        //listen for the $routeUpdate event and update the selected schema metadata.
     302        //(if not done, the selection highlight is not updated e.g. when
     303        //navigating back and forth)
     304        $scope.$on('$routeUpdate', function(event, route) {
     305            //if selected index changed, load the new schema.
     306            if (route.templateUrl === 'partials/workspace.html' && route.params.schemaIndex !== $scope.selectedSchemaIndex) {
     307                parentScope.resultHasArrived = false;
     308                if (Settings.getAnimationStatus()) {
     309                    $scope.toNextSchema =
     310                        route.params.schemaIndex > $scope.selectedSchemaIndex ?
     311                        true : false;
     312                    $scope.animateSchemaChange =
     313                        $scope.toNextSchema ?
     314                        'animated fadeOutUp' : 'animated fadeOutDown';
     315                    $timeout(function() {
     316                        loadSchemaMetadata(route.params.schemaIndex);
     317                    }, 250);
     318                } else
     319                    loadSchemaMetadata(route.params.schemaIndex);
     320
     321                //register a listener to update the metadata pane once the result has arrived
     322                var watchListener = $scope.$watch('resultHasArrived', function(newValue, oldValue) {
     323                    if (newValue) {
     324                        updateMetadataPane();
     325                        //derregister the listener since the workspace page is now loaded
     326                        watchListener();
     327                    }
     328                });
     329            } else
     330                updateMetadataPane();
     331        });
    147332
    148333
     
    171356                } else
    172357                    $scope.animateWorkspacePageChange = '';
    173                 updateAccessDetailsPanel();
     358                updateMetadataPane();
     359                parentScope.workspaceFullyLoaded = true;
    174360                //derregister the listener since the workspace page is now loaded
    175361                watchListener();
    176362            }
    177363        });
    178 
    179 
    180         //load the schemas page and the selected schema metadata.
    181         //if reading the workspace for the first time i.e. not due to page change click
    182         if (!parentScope.workspaceFirstLoaded)
    183             loadSchemasList($routeParams.pageNumber);
    184 
    185 
    186         //update the current route when user clicks in another page in the paginator.
    187         //This triggers a $routeChangeStart event since we are changing the route path part.
    188         $scope.selectPage = function(page) {
    189             $location.search().schemaIndex = '0';
    190             delete $location.search().show;
    191             $location.path('workspace.html/page/' + page + '/').search($location.search());
    192         };
    193 
    194 
    195         //update the current route when the uses clicks one schema in the list. This triggers
    196         //a $routeUpdate event since we are just changing the route search part.
    197         $scope.selectSchema = function(rowIndex) {
    198             $location.search().schemaIndex = rowIndex.toString();
    199             delete $location.search().show;
     364    }
     365]);
     366
     367SCHEMAcat.controller('NamePanelCtrl', ['$scope', '$location', '$timeout', 'Schema',
     368    function($scope, $location, $timeout, Schema) {
     369
     370        $scope.workspace.namePanel = {};
     371        var originalNameValue;
     372
     373        $scope.workspace.namePanel.updateEditingName = function() {
     374            if ($location.search().editingName) {
     375                if ($scope.schemaEditable) {
     376                    $scope.workspace.namePanel.editButtonTooltip = 'Hide edit name';
     377                    if (originalNameValue === undefined)
     378                        originalNameValue = $scope.selectedSchema['sc:schema']['sc:name'];
     379                    $scope.workspace.namePanel.editForm.open = true;
     380                } else {
     381                    delete $location.search().editingName;
     382                    $scope.workspace.namePanel.editButtonTooltip = 'Edit schema name';
     383                    if ($scope.workspace.namePanel.editForm.input.$dirty)
     384                        $scope.workspace.namePanel.editButtonTooltip += ' (there are unsaved changes in this field!)';
     385                    $location.search($location.search());
     386                }
     387            } else {
     388                $scope.workspace.namePanel.editForm.open = false;
     389                $scope.workspace.namePanel.editButtonTooltip = 'Edit schema name';
     390                if ($scope.workspace.namePanel.editForm.input.$dirty)
     391                    $scope.workspace.namePanel.editButtonTooltip += ' (there are unsaved changes in this field!)';
     392            }
     393            $scope.workspace.namePanel.updateAjaxError = false;
     394        };
     395
     396        $scope.saveName = function() {
     397            var name = $scope.selectedSchema['sc:schema']['sc:name'];
     398            var schema = new Schema();
     399            $scope.workspace.namePanel.waitingForServerUpdate = true;
     400            $scope.workspace.namePanel.updateAjaxError = false;
     401
     402            schema.name = name;
     403
     404            schema.$save({
     405                    schemaID: $scope.schemasList[$scope.selectedSchemaIndex]['xml:id'],
     406                    schemaField: 'name'
     407                },
     408                function(result) {
     409                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
     410                        $scope.selectedSchema['sc:schema']['sc:name'] = fixEmptyFields(result['sc:response']['sc:written-data']['sc:name']);
     411                        originalNameValue = result['sc:response']['sc:written-data']['sc:name'];
     412                        $scope.workspace.namePanel.waitingForServerUpdate = false;
     413                        $scope.workspace.namePanel.editForm.$setPristine();
     414                        delete $location.search().editingName;
     415                        $location.search($location.search());
     416                    } else {
     417                        //server reports an handeled error
     418                        $scope.workspace.namePanel.waitingForServerUpdate = false;
     419                        $scope.workspace.namePanel.updateAjaxError = true;
     420                    }
     421                },
     422                //no response, or response error flagged in http response headers
     423                function() {
     424                    $scope.workspace.namePanel.waitingForServerUpdate = false;
     425                    $scope.workspace.namePanel.updateAjaxError = true;
     426                });
     427        };
     428
     429        $scope.toggleEditName = function(cancel) {
     430            if ($location.search().editingName) {
     431                delete $location.search().editingName;
     432                if (cancel) {
     433                    //this timeout is so that the name does collapse abruptly
     434                    $timeout(function() {
     435                        $scope.selectedSchema['sc:schema']['sc:name'] = originalNameValue;
     436                        $scope.workspace.namePanel.editForm.$setPristine();
     437                        $scope.$apply();
     438                        $location.search($location.search());
     439                    }, 150);
     440                    return;
     441                }
     442            } else {
     443                $location.search().editingName = true;
     444            }
    200445            $location.search($location.search());
    201446        };
    202447
    203         $scope.toggleAccessDetails = function() {
    204             $scope.accessDetailsPanel.open = !$scope.accessDetailsPanel.open;
    205             if (!$scope.accessDetailsPanel.open)
    206                 delete $location.search().showAccessDetails;
     448    }
     449]);
     450
     451SCHEMAcat.controller('DescriptionPanelCtrl', ['$scope', '$location', '$timeout', 'Schema',
     452    function($scope, $location, $timeout, Schema) {
     453
     454        $scope.workspace.descriptionPanel = {};
     455        var originalDescriptionValue;
     456
     457        $scope.workspace.descriptionPanel.updateEditingDescription = function() {
     458            if ($location.search().editingDescription) {
     459                if ($scope.schemaEditable) {
     460                    //If the textarea was collapsed when its model was first changed, autosizeTextarea does not set
     461                    //the textarea height by design. Thus we resize the textarea when it is expanded.
     462                    //When reloading or loading the workspace for the first time, the resize method from autosizeTextarea
     463                    //is already trigered (for non-collapsed textareas) by the change in ngModel. So do not broadcast a autosizeTextarea.resize event.
     464                    if ($scope.workspaceFullyLoaded)
     465                        $scope.$broadcast('autosizeTextarea.resize');
     466                    $scope.workspace.descriptionPanel.editButtonTooltip = 'Hide edit description';
     467                    if (originalDescriptionValue === undefined)
     468                        originalDescriptionValue = $scope.selectedSchema['sc:schema']['sc:description'];
     469                    $scope.workspace.descriptionPanel.editForm.open = true;
     470                } else {
     471                    delete $location.search().editingDescription;
     472                    $scope.workspace.descriptionPanel.editButtonTooltip = 'Edit description';
     473                    if ($scope.workspace.descriptionPanel.editForm.input.$dirty)
     474                        $scope.workspace.descriptionPanel.editButtonTooltip += ' (there are unsaved changes in this field!)';
     475                    $location.search($location.search());
     476                }
     477            } else {
     478                $scope.workspace.descriptionPanel.editForm.open = false;
     479                $scope.workspace.descriptionPanel.editButtonTooltip = 'Edit description';
     480                if ($scope.workspace.descriptionPanel.editForm.input.$dirty)
     481                    $scope.workspace.descriptionPanel.editButtonTooltip += ' (there are unsaved changes in this field!)';
     482            }
     483            $scope.workspace.descriptionPanel.updateAjaxError = false;
     484        };
     485
     486        $scope.saveDescription = function() {
     487            var description = $scope.selectedSchema['sc:schema']['sc:description'];
     488            var schema = new Schema();
     489            $scope.workspace.descriptionPanel.waitingForServerUpdate = true;
     490            $scope.workspace.descriptionPanel.updateAjaxError = false;
     491
     492            schema.description = description;
     493
     494            schema.$save({
     495                    schemaID: $scope.schemasList[$scope.selectedSchemaIndex]['xml:id'],
     496                    schemaField: 'description'
     497                },
     498                function(result) {
     499                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
     500                        $scope.selectedSchema['sc:schema']['sc:description'] = fixEmptyFields(result['sc:response']['sc:written-data']['sc:description']);
     501                        originalDescriptionValue = result['sc:response']['sc:written-data']['sc:description'];
     502                        $scope.workspace.descriptionPanel.waitingForServerUpdate = false;
     503                        $scope.workspace.descriptionPanel.editForm.$setPristine();
     504                        delete $location.search().editingDescription;
     505                        $location.search($location.search());
     506                    } else {
     507                        //server reports an handeled error
     508                        $scope.workspace.descriptionPanel.waitingForServerUpdate = false;
     509                        $scope.workspace.descriptionPanel.updateAjaxError = true;
     510                    }
     511                },
     512                //no response, or response error flagged in http response headers
     513                function() {
     514                    $scope.workspace.descriptionPanel.waitingForServerUpdate = false;
     515                    $scope.workspace.descriptionPanel.updateAjaxError = true;
     516                });
     517        };
     518
     519        $scope.toggleEditDescription = function(cancel) {
     520            if ($location.search().editingDescription) {
     521                delete $location.search().editingDescription;
     522                if (cancel) {
     523                    //this timeout is so that the description does collapse abruptly
     524                    $timeout(function() {
     525                        $scope.selectedSchema['sc:schema']['sc:description'] = originalDescriptionValue;
     526                        $scope.workspace.descriptionPanel.editForm.$setPristine();
     527                        $scope.$apply();
     528                        $location.search($location.search());
     529                    }, 150);
     530                    return;
     531                }
     532            } else {
     533                $location.search().editingDescription = true;
     534            }
     535            $location.search($location.search());
     536        };
     537    }
     538]);
     539
     540SCHEMAcat.controller('VersionDetailsPanelCtrl', ['$scope', '$location', '$timeout', 'Schema',
     541    function($scope, $location, $timeout, Schema) {
     542
     543        $scope.workspace.collapsibleDetailPanels.version = {};
     544        $scope.workspace.collapsibleDetailPanels.version.editPanel = {};
     545        $scope.workspace.collapsibleDetailPanels.version.editPanel.open = false;
     546        var originalVersionValue;
     547
     548        $scope.toggleEditVersion = function(cancel) {
     549            if ($location.search().editingVersion) {
     550                delete $location.search().editingVersion;
     551                if (cancel) {
     552                    //this timeout is so that the description does collapse abruptly
     553                    $timeout(function() {
     554                        $scope.workspace.collapsibleDetailPanels.version.editForm.$setPristine();
     555                        $scope.$apply();
     556                        $location.search($location.search());
     557                        //after collapsing the edit panel collapse the fields displaying the old value and reexpand them after 350ms
     558                        $scope.workspace.collapsibleDetailPanels.version.resettingUpdate = true;
     559                        $timeout(function() {
     560                            $scope.selectedSchema['sc:schema']['sc:version'] = originalVersionValue;
     561                            //expand the value fiels with the original value
     562                            $scope.workspace.collapsibleDetailPanels.version.resettingUpdate = false;
     563                        }, 350);
     564                    }, 150);
     565                    return;
     566                }
     567            } else
     568                $location.search().editingVersion = true;
     569
     570            $location.search($location.search());
     571        };
     572
     573        $scope.workspace.collapsibleDetailPanels.version.updateEditPanel = function() {
     574            if ($location.search().editingVersion) {
     575                if ($scope.schemaEditable) {
     576                    $scope.workspace.collapsibleDetailPanels.version.editButtonTooltip = 'Hide edit panel';
     577                    if (originalVersionValue === undefined)
     578                        originalVersionValue = $scope.selectedSchema['sc:schema']['sc:version'];
     579                    $scope.workspace.collapsibleDetailPanels.version.editPanel.open = true;
     580                } else {
     581                    delete $location.search().editingVersion;
     582                    $scope.workspace.collapsibleDetailPanels.version.editButtonTooltip = 'Change schema version';
     583                    if ($scope.workspace.collapsibleDetailPanels.version.editForm && $scope.workspace.collapsibleDetailPanels.version.editForm.input.$dirty)
     584                        $scope.workspace.collapsibleDetailPanels.version.editButtonTooltip += ' (there are unsaved changes in this field!)';
     585                    $location.search($location.search());
     586                }
     587            } else {
     588                $scope.workspace.collapsibleDetailPanels.version.editPanel.open = false;
     589                $scope.workspace.collapsibleDetailPanels.version.editButtonTooltip = 'Change schema version';
     590                if ($scope.workspace.collapsibleDetailPanels.version.editForm && $scope.workspace.collapsibleDetailPanels.version.editForm.input.$dirty)
     591                    $scope.workspace.collapsibleDetailPanels.version.editButtonTooltip += ' (there are unsaved changes in this field!)';
     592            }
     593            $scope.workspace.collapsibleDetailPanels.version.updateAjaxError = false;
     594        };
     595
     596        $scope.saveVersion = function() {
     597            var version = $scope.selectedSchema['sc:schema']['sc:version'];
     598            var schema = new Schema();
     599            $scope.workspace.collapsibleDetailPanels.version.waitingForServerUpdate = true;
     600            $scope.workspace.collapsibleDetailPanels.version.updateAjaxError = false;
     601
     602            schema.version = version;
     603
     604            schema.$save({
     605                    schemaID: $scope.selectedSchema['sc:schema']['xml:id'],
     606                    schemaField: 'version'
     607                },
     608                function(result) {
     609                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
     610                        $scope.selectedSchema['sc:schema']['sc:version'] = fixEmptyFields(result['sc:response']['sc:written-data']['sc:version']);
     611                        originalVersionValue = $scope.selectedSchema['sc:schema']['sc:version'];
     612                        $scope.schemasList[$scope.selectedSchemaIndex]['sc:version'] = originalVersionValue;
     613                        $scope.workspace.collapsibleDetailPanels.version.waitingForServerUpdate = false;
     614                        $scope.workspace.collapsibleDetailPanels.version.editForm.$setPristine();
     615                        delete $location.search().editingVersion;
     616                        $location.search($location.search());
     617                    } else {
     618                        //server reports an handeled error
     619                        $scope.workspace.collapsibleDetailPanels.version.waitingForServerUpdate = false;
     620                        $scope.workspace.collapsibleDetailPanels.version.updateAjaxError = true;
     621                    }
     622                },
     623                //no response, or response error flagged in http response headers
     624                function() {
     625                    $scope.workspace.collapsibleDetailPanels.version.waitingForServerUpdate = false;
     626                    $scope.workspace.collapsibleDetailPanels.version.updateAjaxError = true;
     627                });
     628        };
     629    }
     630]);
     631
     632SCHEMAcat.controller('StatusDetailsPanelCtrl', ['$scope', '$location', 'Schema',
     633    function($scope, $location, Schema) {
     634        $scope.workspace.collapsibleDetailPanels.status = {};
     635        $scope.workspace.collapsibleDetailPanels.status.editPanel = {};
     636        $scope.workspace.collapsibleDetailPanels.status.editPanel.open = false;
     637        $scope.workspace.collapsibleDetailPanels.status.possibleStatusList = [];
     638
     639        var privateAccessPossibleStatusList = [
     640            'development'
     641        ];
     642
     643        var publicAccessPossibleStatusList = [
     644            'production'
     645        ];
     646
     647        var commonPossibleStatusList = [
     648            'deprecated',
     649            'superseeded'
     650        ];
     651
     652        $scope.toggleEditStatus = function() {
     653            if ($location.search().editingStatus)
     654                delete $location.search().editingStatus;
    207655            else
    208                 $location.search().showAccessDetails = true;
     656                $location.search().editingStatus = true;
    209657
    210658            $location.search($location.search());
    211659        };
    212660
    213 
    214         //listen for the $routeChangeStart event. Triggered when route path is changed (page change).
    215         $scope.$on('$routeChangeStart', function(event, next, current) {
    216             parentScope.resultHasArrived = false;
    217             if (Settings.getAnimationStatus()) {
    218                 if (next.params !== undefined &&
    219                     next.params.pageNumber !== undefined &&
    220                     next.params.pageNumber > current.params.pageNumber)
    221                     parentScope.toNextPage = true;
    222                 else
    223                     parentScope.toNextPage = false;
    224 
    225                 //slide out workspace page
    226                 switch (next.templateUrl) {
    227                     case 'partials/workspace.html':
    228                         $scope.animateWorkspacePageChange =
    229                             parentScope.toNextPage ?
    230                             'animated slideOutLeft' : 'animated slideOutRight';
    231                         break;
    232                     case 'partials/contact.html':
    233                     case 'partials/about.html':
    234                         $scope.animateWorkspacePageChange = 'animated slideOutLeft';
    235                         break;
    236                     default:
    237                         $scope.animateWorkspacePageChange = 'animated fadeOutDown';
    238                 }
    239             }
    240             if (next.templateUrl === 'partials/workspace.html')
    241                 loadSchemasList(next.params.pageNumber);
     661        $scope.workspace.collapsibleDetailPanels.status.updateEditPanel = function() {
     662            if ($location.search().editingStatus) {
     663                if ($scope.schemaEditable) {
     664                    if ($scope.selectedSchema['sc:schema']['sc:access']['sc:all'] && $scope.selectedSchema['sc:schema']['sc:access']['sc:all'].actions === 'r')
     665                        $scope.workspace.collapsibleDetailPanels.status.possibleStatusList = publicAccessPossibleStatusList.concat(commonPossibleStatusList);
     666                    else
     667                        $scope.workspace.collapsibleDetailPanels.status.possibleStatusList = privateAccessPossibleStatusList.concat(commonPossibleStatusList);
     668
     669                    $scope.workspace.collapsibleDetailPanels.status.editPanel.open = true;
     670                } else {
     671                    delete $location.search().editingStatus;
     672                    $location.search($location.search());
     673                }
     674            } else
     675                $scope.workspace.collapsibleDetailPanels.status.editPanel.open = false;
     676            $scope.workspace.collapsibleDetailPanels.status.updateAjaxError = false;
     677        };
     678
     679        $scope.saveStatus = function() {
     680            var status = $scope.selectedSchema['sc:schema']['sc:status'];
     681            var schema = new Schema();
     682            $scope.workspace.collapsibleDetailPanels.status.waitingForServerUpdate = true;
     683            $scope.workspace.collapsibleDetailPanels.status.updateAjaxError = false;
     684
     685            schema.status = status;
     686
     687            schema.$save({
     688                    schemaID: $scope.selectedSchema['sc:schema']['xml:id'],
     689                    schemaField: 'status'
     690                },
     691                function(result) {
     692                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
     693                        $scope.selectedSchema['sc:schema']['sc:status'] = fixEmptyFields(result['sc:response']['sc:written-data']['sc:status']);
     694                        $scope.schemasList[$scope.selectedSchemaIndex]['sc:status'] = $scope.selectedSchema['sc:schema']['sc:status'];
     695                        $scope.workspace.collapsibleDetailPanels.status.editForm.$setPristine();
     696                        $scope.workspace.collapsibleDetailPanels.status.waitingForServerUpdate = false;
     697                    } else {
     698                        //server reports an handeled error
     699                        $scope.workspace.collapsibleDetailPanels.status.waitingForServerUpdate = false;
     700                        $scope.workspace.collapsibleDetailPanels.status.updateAjaxError = true;
     701                    }
     702                },
     703                //no response, or response error flagged in http response headers
     704                function() {
     705                    $scope.workspace.collapsibleDetailPanels.status.waitingForServerUpdate = false;
     706                    $scope.workspace.collapsibleDetailPanels.status.updateAjaxError = true;
     707                });
     708        };
     709    }
     710]);
     711
     712SCHEMAcat.controller('AccessDetailsPanelCtrl', ['$scope', '$location', 'Schema',
     713    function($scope, $location, Schema) {
     714
     715        $scope.workspace.collapsibleDetailPanels.access = {};
     716        $scope.workspace.collapsibleDetailPanels.access.editPanel = {};
     717        $scope.workspace.collapsibleDetailPanels.access.editPanel.open = false;
     718        $scope.currentAccessPolicy = '';
     719
     720        $scope.toggleEditAccess = function() {
     721            if ($location.search().editingAccess)
     722                delete $location.search().editingAccess;
    242723            else
    243                 parentScope.workspaceFirstLoaded = false;
    244         });
    245 
    246         $scope.$on('$routeChangeSuccess', function(event, current, previous) {
    247             //when coming back to the workspace from other routes, the workspace should apear from the left to the right
    248             if (Settings.getAnimationStatus()) {
    249                 if (previous === undefined || previous.templateUrl === undefined ||
    250                     previous.templateUrl === 'partials/accountDetails.html')
    251                     parentScope.toNextPage = undefined;
    252             }
    253         });
    254 
    255         //listen for the $routeUpdate event and update the selected schema metadata.
    256         //(if not done, the selection highlight is not updated e.g. when
    257         //navigating back and forth)
    258         $scope.$on('$routeUpdate', function(event, route) {
    259             if (route.templateUrl === 'partials/workspace.html' && route.params.schemaIndex !== $scope.selectedSchemaIndex) {
    260                 parentScope.resultHasArrived = false;
    261                 if (Settings.getAnimationStatus()) {
    262                     $scope.toNextSchema =
    263                         route.params.schemaIndex > $scope.selectedSchemaIndex ?
    264                         true : false;
    265 
    266                     $scope.animateSchemaChange =
    267                         $scope.toNextSchema ?
    268                         'animated fadeOutUp' : 'animated fadeOutDown';
    269                     $timeout(function() {
    270                         loadSchemaMetadata(route.params.schemaIndex);
    271                     }, 250);
    272                 } else
    273                     loadSchemaMetadata(route.params.schemaIndex);
     724                $location.search().editingAccess = true;
     725
     726            $location.search($location.search());
     727        };
     728
     729        $scope.workspace.collapsibleDetailPanels.access.updateEditPanel = function() {
     730            if ($location.search().editingAccess) {
     731                if ($scope.schemaEditable) {
     732                    $scope.currentAccessPolicy = $scope.workspace.collapsibleDetailPanels.access.getAccessPolicy();
     733                    $scope.workspace.collapsibleDetailPanels.access.editPanel.open = true;
     734                } else {
     735                    delete $location.search().editingAccess;
     736                    $location.search($location.search());
     737                }
    274738            } else
    275                 updateAccessDetailsPanel();
    276         });
    277 
    278         parentScope.workspaceFirstLoaded = true;
    279     }
    280 ]);
    281 
    282 SCHEMAcat.controller('accessDetailsPanelCtrl', ['$scope', '$location', 'Schema',
    283     function($scope, $location, Schema) {
    284 
    285         var parentScope = $scope.$parent;
    286         $scope.editAccessPanel = {};
    287         $scope.editAccessPanel.open = true;
    288 
    289         $scope.toggleEditAccess = function() {
    290             $scope.editAccessPanel.open = !$scope.editAccessPanel.open;
    291             if (!$scope.editAccessPanel.open)
    292                 delete $location.search().edditingAccess;
    293             else
    294                 $location.search().edditingAccess = true;
    295 
    296             $location.search($location.search());
    297         };
    298 
    299         $scope.workspace.updateEditAccessPanel = function() {
    300             if ($location.search().edditingAccess) {
    301                 if (parentScope.schemaEditable)
    302                     $scope.editAccessPanel.open = true;
    303                 else {
    304                     delete $location.search().edditingAccess;
    305                     $location.search($location.search());
    306                 }
    307             } else
    308                 $scope.editAccessPanel.open = false;
    309             $scope.workspace.accessStatusUpdateAjaxError = false;
    310         };
    311 
    312         $scope.workspace.getAccessPolicy = function() {
    313             if (parentScope.selectedSchema['sc:schema']['sc:access']['sc:all'] !== undefined && parentScope.selectedSchema['sc:schema']['sc:access']['sc:all'].actions === 'r')
     739                $scope.workspace.collapsibleDetailPanels.access.editPanel.open = false;
     740            $scope.workspace.collapsibleDetailPanels.access.updateAjaxError = false;
     741        };
     742
     743        $scope.workspace.collapsibleDetailPanels.access.getAccessPolicy = function() {
     744            if ($scope.selectedSchema['sc:schema']['sc:access']['sc:all'] !== undefined && $scope.selectedSchema['sc:schema']['sc:access']['sc:all'].actions === 'r')
    314745                return 'shareURL';
    315746            else
     
    320751            var accessUser = $scope.selectedSchema['sc:schema']['sc:access']['sc:user'];
    321752            var schema = new Schema();
    322             $scope.workspace.waitingForServerAccessStatusUpdate = true;
    323             $scope.workspace.accessStatusUpdateAjaxError = false;
     753            $scope.workspace.collapsibleDetailPanels.access.waitingForServerUpdate = true;
     754            $scope.workspace.collapsibleDetailPanels.access.updateAjaxError = false;
    324755
    325756            switch (newAccessStatus) {
     
    340771
    341772            schema.$save({
    342                     schemaID: $scope.schemasList[$scope.selectedSchemaIndex]['xml:id'],
     773                    schemaID: $scope.selectedSchema['sc:schema']['xml:id'],
    343774                    schemaField: 'access'
    344775                },
    345776                function(result) {
    346                     if (result['sc:response'] !== undefined && result['sc:response'].success) {
     777                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
    347778                        $scope.selectedSchema['sc:schema']['sc:access'] = result['sc:response']['sc:written-data']['sc:access'];
    348                         $scope.workspace.waitingForServerAccessStatusUpdate = false;
     779                        $scope.workspace.collapsibleDetailPanels.access.editForm.$setPristine();
     780                        $scope.workspace.collapsibleDetailPanels.access.waitingForServerUpdate = false;
    349781                    } else {
    350782                        //server reports an handeled error
    351                         $scope.workspace.waitingForServerAccessStatusUpdate = false;
    352                         $scope.workspace.accessStatusUpdateAjaxError = true;
     783                        $scope.workspace.collapsibleDetailPanels.access.waitingForServerUpdate = false;
     784                        $scope.workspace.collapsibleDetailPanels.access.updateAjaxError = true;
    353785                    }
    354786                    //refresh the view model
    355                     $scope.workspace.editAccessForm.accessPolicy = $scope.workspace.getAccessPolicy();
     787                    $scope.currentAccessPolicy = $scope.workspace.collapsibleDetailPanels.access.getAccessPolicy();
    356788                },
    357789                //no response, or response error flagged in http response headers
    358790                function() {
    359                     $scope.workspace.waitingForServerAccessStatusUpdate = false;
    360                     $scope.workspace.accessStatusUpdateAjaxError = true;
    361                     $scope.workspace.editAccessForm.accessPolicy = $scope.workspace.getAccessPolicy();
     791                    $scope.workspace.collapsibleDetailPanels.access.waitingForServerUpdate = false;
     792                    $scope.workspace.collapsibleDetailPanels.access.updateAjaxError = true;
     793                    $scope.currentAccessPolicy = $scope.workspace.collapsibleDetailPanels.access.getAccessPolicy();
    362794                });
    363795        };
     
    365797]);
    366798
     799
     800
     801SCHEMAcat.controller('LicenseDetailsPanelCtrl', ['$scope', '$modal', '$location', '$timeout',
     802    'Schema', 'Licenses',
     803    function($scope, $modal, $location, $timeout, Schema, Licenses) {
     804
     805        $scope.workspace.collapsibleDetailPanels.license = {};
     806        $scope.input = {};
     807
     808        var originalLicenseValue;
     809        var modalInstance;
     810
     811
     812        $scope.filterLicenses = function(item) {
     813            var regex = new RegExp($scope.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue, 'i');
     814            if (item['sc:full-name'].match(regex) || item['xml:id'].match(regex) || $scope.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue === undefined) {
     815                return true;
     816            }
     817            return false;
     818        };
     819
     820        $scope.showSelectedLicense = function(license) {
     821            if ($scope.selectedSchema['sc:schema']['sc:license']['xml:id'] !== license['xml:id']) {
     822                $scope.workspace.collapsibleDetailPanels.license.modelDirty = true;
     823                $scope.workspace.collapsibleDetailPanels.license.updatingLicense = true;
     824                $timeout(function() {
     825                    $scope.selectedSchema['sc:schema']['sc:license'] = license;
     826                    $scope.workspace.collapsibleDetailPanels.license.updatingLicense = false;
     827                }, 250);
     828            }
     829        };
     830
     831        $scope.saveNewLicense = function() {
     832            var license = $scope.selectedSchema['sc:schema']['sc:license'];
     833            var schema = new Schema();
     834            $scope.workspace.collapsibleDetailPanels.license.waitingForServerUpdate = true;
     835            $scope.workspace.collapsibleDetailPanels.license.updateAjaxError = false;
     836
     837            schema.license = license['xml:id'];
     838            schema.$save({
     839                    schemaID: $scope.selectedSchema['sc:schema']['xml:id'],
     840                    schemaField: 'license'
     841                },
     842                function(result) {
     843                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success &&
     844                        result['sc:response']['sc:written-data']['sc:license'].ref === $scope.selectedSchema['sc:schema']['sc:license']['xml:id']) {
     845
     846                        originalLicenseValue = $scope.selectedSchema['sc:schema']['sc:license'];
     847                        $scope.workspace.collapsibleDetailPanels.license.modelDirty = false;
     848                        $scope.workspace.collapsibleDetailPanels.license.editForm.$setPristine();
     849                        $scope.workspace.collapsibleDetailPanels.license.waitingForServerUpdate = false;
     850                        $scope.triggerCloseModalRoute();
     851                    } else {
     852                        //server reports an handeled error
     853                        $scope.workspace.collapsibleDetailPanels.license.waitingForServerUpdate = false;
     854                        $scope.workspace.collapsibleDetailPanels.license.updateAjaxError = true;
     855                    }
     856                },
     857                //no response, or response error flagged in http response headers
     858                function() {
     859                    $scope.selectedSchema['sc:schema']['sc:license'] = originalLicenseValue;
     860                    $scope.workspace.collapsibleDetailPanels.license.waitingForServerUpdate = false;
     861                    $scope.workspace.collapsibleDetailPanels.license.updateAjaxError = true;
     862                });
     863        };
     864
     865        $scope.triggerOpenModalRoute = function() {
     866            if (!$location.search().editingLicense) {
     867                $location.search().editingLicense = true;
     868                $location.search($location.search());
     869            }
     870        };
     871
     872        $scope.triggerCloseModalRoute = function() {
     873            if ($location.search().editingLicense) {
     874                delete $location.search().editingLicense;
     875                $location.search($location.search());
     876            }
     877        };
     878
     879        //this function evaluates changes in the route to open and close the modal
     880        $scope.workspace.collapsibleDetailPanels.license.updateEditPanel = function() {
     881            if ($location.search().editingLicense) {
     882                if ($scope.schemaEditable) {
     883                    if (originalLicenseValue === undefined)
     884                        originalLicenseValue = $scope.selectedSchema['sc:schema']['sc:license'];
     885
     886                    if ($scope.workspace.collapsibleDetailPanels.license.licenseList === undefined) {
     887                        $scope.workspace.collapsibleDetailPanels.license.licensesArrived = false;
     888                        //get the list of licenses
     889                        Licenses.get(
     890                            function(result) {
     891                                $scope.workspace.collapsibleDetailPanels.license.licenseList = result;
     892                                for (var i = 0; i < result['sc:licenses']['sc:license'].length; i++) {
     893                                    if (result['sc:licenses']['sc:license'][i]['xml:id'] === $scope.selectedSchema['sc:schema']['sc:license']['xml:id'])
     894                                        $scope.input.model = $scope.workspace.collapsibleDetailPanels.license.licenseList['sc:licenses']['sc:license'][i]['xml:id'];
     895                                }
     896                                $scope.workspace.collapsibleDetailPanels.license.licensesArrived = true;
     897
     898                            });
     899                    }
     900                    openModal();
     901                } else {
     902                    $scope.workspace.collapsibleDetailPanels.license.editButtonTooltip = 'Change schema license';
     903                    if ($scope.workspace.collapsibleDetailPanels.license.editForm && $scope.workspace.collapsibleDetailPanels.license.modelDirty)
     904                        $scope.workspace.collapsibleDetailPanels.license.editButtonTooltip += ' (there are unsaved changes in this field!)';
     905                    $scope.triggerCloseModalRoute();
     906                }
     907            } else if (modalInstance !== undefined) {
     908                modalInstance.dismiss('dismiss');
     909            }
     910            $scope.workspace.collapsibleDetailPanels.license.editButtonTooltip = 'Change schema license';
     911            if ($scope.workspace.collapsibleDetailPanels.license.editForm && $scope.workspace.collapsibleDetailPanels.license.modelDirty)
     912                $scope.workspace.collapsibleDetailPanels.license.editButtonTooltip += ' (there are unsaved changes in this field!)';
     913        };
     914
     915        function openModal() {
     916            modalInstance = $modal.open({
     917                scope: $scope,
     918                templateUrl: 'partials/editLicenseModal.html',
     919            });
     920
     921            modalInstance.result.then(function() {
     922                //function runs if modal is closed with a result ($modalInstance.close(result)) i.e. click 'save'
     923                modalInstance = undefined;
     924            }, function(reason) {
     925                //function runs if modal is dismissed i.e. click 'cancel', 'x', backdrop or ESC key press
     926                modalInstance = undefined;
     927                //if backdrop click or ESC key, update route.
     928                if (reason !== 'dismiss')
     929                    $scope.triggerCloseModalRoute();
     930            });
     931        }
     932
     933        $scope.cancelEdit = function() {
     934            if ($scope.workspace.collapsibleDetailPanels.license.modelDirty) {
     935                $scope.workspace.collapsibleDetailPanels.license.updatingLicense = true;
     936                $scope.workspace.collapsibleDetailPanels.license.modelDirty = false;
     937                $timeout(function() {
     938                    $scope.selectedSchema['sc:schema']['sc:license'] = originalLicenseValue;
     939                    $scope.workspace.collapsibleDetailPanels.license.updatingLicense = false;
     940                }, 250);
     941                $scope.workspace.collapsibleDetailPanels.license.editForm.$setPristine();
     942            }
     943            $scope.triggerCloseModalRoute();
     944        };
     945    }
     946]);
    367947
    368948
     
    4741054
    4751055        $scope.updateAnimationStatus = function() {
    476             $scope.animationsChecked = !$scope.animationsChecked;
    477             if ($scope.animationsChecked)
     1056            if ($location.search().animationsDisabled)
    4781057                delete $location.search().animationsDisabled;
    4791058            else
     
    4831062
    4841063        $scope.toggleTopMenu = function() {
    485             $scope.topMenuCollapsed = !$scope.topMenuCollapsed;
    486             if ($scope.topMenuCollapsed)
     1064            if ($location.search().topMenuExpanded)
    4871065                delete $location.search().topMenuExpanded;
    4881066            else
     
    6531231            var locationSearch = $location.search();
    6541232            for (var prop in locationSearch) {
    655                 if (prop === 'edditingEmail') {
    656                     var newLocationSearchEdditingEmailArray = locationSearch[prop].split('#');
    657                     for (var i = 0; i < newLocationSearchEdditingEmailArray.length; i++) {
     1233                if (prop === 'editingEmail') {
     1234                    var newLocationSearcheditingEmailArray = locationSearch[prop].split('#');
     1235                    for (var i = 0; i < newLocationSearcheditingEmailArray.length; i++) {
    6581236                        var found = false;
    6591237                        for (var j = 0; j < UserService.email.length; j++) {
    660                             if (newLocationSearchEdditingEmailArray[i] === UserService.email[j])
     1238                            if (newLocationSearcheditingEmailArray[i] === UserService.email[j])
    6611239                                found = true;
    6621240                        }
    6631241                        if (!found)
    664                             newLocationSearchEdditingEmailArray.splice(i, 1);
    665                     }
    666                     var newLocationSearchEdditingEmailString = newLocationSearchEdditingEmailArray.join('#');
    667                     if (newLocationSearchEdditingEmailString !== '') {
    668                         locationSearch[prop] = newLocationSearchEdditingEmailString;
     1242                            newLocationSearcheditingEmailArray.splice(i, 1);
     1243                    }
     1244                    var newLocationSearcheditingEmailString = newLocationSearcheditingEmailArray.join('#');
     1245                    if (newLocationSearcheditingEmailString !== '') {
     1246                        locationSearch[prop] = newLocationSearcheditingEmailString;
    6691247                    } else
    6701248                        delete locationSearch[prop];
     
    6741252        }
    6751253
    676         function updateEdditingDisplayName() {
     1254        function updateEditingDisplayName() {
    6771255            $scope.waitingForServerEditDisplayName = false;
    6781256            $scope.editDisplayNameAjaxError = false;
    679             if ($location.search().edditingDisplayName) {
     1257            if ($location.search().editingDisplayName) {
    6801258                $scope.editDisplayNameText = $scope.displayName;
    681                 $scope.edditingDisplayName = true;
     1259                $scope.editingDisplayName = true;
    6821260            } else
    683                 $scope.edditingDisplayName = false;
     1261                $scope.editingDisplayName = false;
    6841262        }
    6851263
     
    7201298                },
    7211299                function(result) {
    722                     if (result['sc:response'] !== undefined && result['sc:response'].success) {
     1300                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
    7231301                        UserService.email.push(newEmail);
    7241302                        $scope.terminateAddEmail();
     
    7371315
    7381316        $scope.editDisplayName = function() {
    739             $location.search().edditingDisplayName = true;
     1317            $location.search().editingDisplayName = true;
    7401318            $location.search($location.search());
    7411319        };
    7421320
    7431321        $scope.terminateEditDisplayName = function() {
    744             delete $location.search().edditingDisplayName;
     1322            delete $location.search().editingDisplayName;
    7451323            $location.search($location.search());
    7461324        };
     
    7551333                },
    7561334                function(result) {
    757                     if (result['sc:response'] !== undefined && result['sc:response'].success) {
     1335                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
    7581336                        $scope.displayName = UserService.displayName = newDisplayName;
    7591337                        $scope.terminateEditDisplayName();
     
    7861364            }
    7871365            updateAddingEmail();
    788             updateEdditingDisplayName();
     1366            updateEditingDisplayName();
    7891367            cleanOutdatedSearchPathEmails();
    7901368        });
     
    7921370        $scope.$on('$routeUpdate', function(event, route) {
    7931371            updateAddingEmail();
    794             updateEdditingDisplayName();
     1372            updateEditingDisplayName();
    7951373            cleanOutdatedSearchPathEmails();
    7961374        });
     
    8011379    function($scope, $location, User, UserService) {
    8021380
    803         function updateEdditingEmail() {
     1381        function updateeditingEmail() {
    8041382            $scope.waitingForServerEditEmail = false;
    805             if ($location.search().edditingEmail !== undefined && $location.search().edditingEmail.indexOf($scope.emailInstance) !== -1) {
     1383            if ($location.search().editingEmail !== undefined && $location.search().editingEmail.indexOf($scope.emailInstance) !== -1) {
    8061384                $scope.editEmailText = $scope.emailInstance;
    807                 $scope.edditingEmail = true;
     1385                $scope.editingEmail = true;
    8081386            } else
    809                 $scope.edditingEmail = false;
    810         }
    811 
    812         updateEdditingEmail();
     1387                $scope.editingEmail = false;
     1388        }
     1389
     1390        updateeditingEmail();
    8131391
    8141392        $scope.editEmail = function(emailInstance) {
    8151393            var locationSearch = $location.search();
    8161394            $scope.removeEmailAjaxError = false;
    817             if (locationSearch.edditingEmail === undefined)
    818                 locationSearch.edditingEmail = emailInstance;
     1395            if (locationSearch.editingEmail === undefined)
     1396                locationSearch.editingEmail = emailInstance;
    8191397            else
    820                 locationSearch.edditingEmail = $location.search().edditingEmail + '#' + emailInstance;
     1398                locationSearch.editingEmail = $location.search().editingEmail + '#' + emailInstance;
    8211399
    8221400            $location.search(locationSearch);
     
    8341412                },
    8351413                function(result) {
    836                     if (result['sc:response'] !== undefined && result['sc:response'].success) {
     1414                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
    8371415                        UserService.email.splice(index, 1);
    8381416                    } else {
     
    8601438                },
    8611439                function(result) {
    862                     if (result['sc:response'] !== undefined && result['sc:response'].success) {
     1440                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success) {
    8631441                        var newEmail = $scope.editEmailText;
    8641442                        $scope.cancelEditEmail(UserService.email[index]);
     
    8831461
    8841462            for (var prop in locationSearch) {
    885                 if (prop === 'edditingEmail') {
    886                     var newLocationSearchEdditingEmailArray = locationSearch[prop].split('#');
    887                     for (var i in newLocationSearchEdditingEmailArray) {
    888                         if (newLocationSearchEdditingEmailArray[i] === emailInstance)
    889                             newLocationSearchEdditingEmailArray.splice(i, 1);
    890                     }
    891                     var newLocationSearchEdditingEmailString = newLocationSearchEdditingEmailArray.join('#');
    892                     if (newLocationSearchEdditingEmailString !== '') {
    893                         locationSearch[prop] = newLocationSearchEdditingEmailString;
     1463                if (prop === 'editingEmail') {
     1464                    var newLocationSearcheditingEmailArray = locationSearch[prop].split('#');
     1465                    for (var i in newLocationSearcheditingEmailArray) {
     1466                        if (newLocationSearcheditingEmailArray[i] === emailInstance)
     1467                            newLocationSearcheditingEmailArray.splice(i, 1);
     1468                    }
     1469                    var newLocationSearcheditingEmailString = newLocationSearcheditingEmailArray.join('#');
     1470                    if (newLocationSearcheditingEmailString !== '') {
     1471                        locationSearch[prop] = newLocationSearcheditingEmailString;
    8941472                    } else
    8951473                        delete locationSearch[prop];
     
    9001478
    9011479        $scope.$on('$routeChangeSuccess', function(event, current, previous) {
    902             updateEdditingEmail();
     1480            updateeditingEmail();
    9031481        });
    9041482
    9051483        $scope.$on('$routeUpdate', function(event, route) {
    906             updateEdditingEmail();
     1484            updateeditingEmail();
    9071485        });
    9081486    }
     
    9431521                },
    9441522                function(result) {
    945                     if (result['sc:response'] !== undefined && result['sc:response'].success)
     1523                    if (result['sc:response'] !== undefined && result['sc:response'] && result['sc:response'].success)
    9461524                        document.location.pathname = 'schemacat/site/index.html';
    9471525                    else {
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/controllers.min.js

    r4473 r4567  
    1 "use strict";function prepareArrayForNgRepeat(a){var b;return b=a instanceof Array?a:new Array(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):(m.totalSchemaItems=d["sc:result"]["sc:total-schemas"],m.currentPage=Number(c),m.schemasList=prepareArrayForNgRepeat(d["sc:result"]["sc:schemas"]["sc:schema"]),j(b.search().schemaIndex),m.schemasResult=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=m.schemasList[Number(c)];f.get({schemaID:d["xml:id"]},function(b){if(m.filesList=prepareArrayForNgRepeat(b["sc:schema"]["sc:files"]["sc:file"]),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="";m.selectedSchema=b,""===a.animateWorkspacePageChange&&l(),m.resultHasArrived=!0})}function k(){var a,b=prepareArrayForNgRepeat(m.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.schemaEditable=g.id===k(),a.schemaEditable&&d(function(){a.workspace.editAccessForm.accessPolicy=a.workspace.getAccessPolicy()}),a.workspace.updateEditAccessPanel(),a.accessDetailsPanel.open=b.search().showAccessDetails?!0:!1}var m=a.$parent;m.pageSize=10,a.selectedSchemaIndex=c.schemaIndex,a.animateWorkspacePageChange="invisible",a.workspace={},a.location=location;var n=a.$watch("resultHasArrived",function(b){if(b){if(h.getAnimationStatus()){switch(m.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(),n()}});m.workspaceFirstLoaded||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.toggleAccessDetails=function(){a.accessDetailsPanel.open=!a.accessDetailsPanel.open,a.accessDetailsPanel.open?b.search().showAccessDetails=!0:delete b.search().showAccessDetails,b.search(b.search())},a.$on("$routeChangeStart",function(b,c,d){if(m.resultHasArrived=!1,h.getAnimationStatus())switch(m.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=m.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):m.workspaceFirstLoaded=!1}),a.$on("$routeChangeSuccess",function(a,b,c){h.getAnimationStatus()&&(void 0===c||void 0===c.templateUrl||"partials/accountDetails.html"===c.templateUrl)&&(m.toNextPage=void 0)}),a.$on("$routeUpdate",function(b,c){"partials/workspace.html"===c.templateUrl&&c.params.schemaIndex!==a.selectedSchemaIndex?(m.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)):l()}),m.workspaceFirstLoaded=!0}]),SCHEMAcat.controller("accessDetailsPanelCtrl",["$scope","$location","Schema",function(a,b,c){var d=a.$parent;a.editAccessPanel={},a.editAccessPanel.open=!0,a.toggleEditAccess=function(){a.editAccessPanel.open=!a.editAccessPanel.open,a.editAccessPanel.open?b.search().edditingAccess=!0:delete b.search().edditingAccess,b.search(b.search())},a.workspace.updateEditAccessPanel=function(){b.search().edditingAccess?d.schemaEditable?a.editAccessPanel.open=!0:(delete b.search().edditingAccess,b.search(b.search())):a.editAccessPanel.open=!1,a.workspace.accessStatusUpdateAjaxError=!1},a.workspace.getAccessPolicy=function(){return void 0!==d.selectedSchema["sc:schema"]["sc:access"]["sc:all"]&&"r"===d.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.waitingForServerAccessStatusUpdate=!0,a.workspace.accessStatusUpdateAjaxError=!1,b){case"shareURL":e.access={all:{actions:"r"},user:d};break;case"private":e.access={user:d}}e.$save({schemaID:a.schemasList[a.selectedSchemaIndex]["xml:id"],schemaField:"access"},function(b){void 0!==b["sc:response"]&&b["sc:response"].success?(a.selectedSchema["sc:schema"]["sc:access"]=b["sc:response"]["sc:written-data"]["sc:access"],a.workspace.waitingForServerAccessStatusUpdate=!1):(a.workspace.waitingForServerAccessStatusUpdate=!1,a.workspace.accessStatusUpdateAjaxError=!0),a.workspace.editAccessForm.accessPolicy=a.workspace.getAccessPolicy()},function(){a.workspace.waitingForServerAccessStatusUpdate=!1,a.workspace.accessStatusUpdateAjaxError=!0,a.workspace.editAccessForm.accessPolicy=a.workspace.getAccessPolicy()})}}]),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(){a.animationsChecked=!a.animationsChecked,a.animationsChecked?delete c.search().animationsDisabled:c.search().animationsDisabled=!0,c.search(c.search())},a.toggleTopMenu=function(){a.topMenuCollapsed=!a.topMenuCollapsed,a.topMenuCollapsed?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("edditingEmail"===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().edditingDisplayName?(a.editDisplayNameText=a.displayName,a.edditingDisplayName=!0):a.edditingDisplayName=!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"].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().edditingDisplayName=!0,b.search(b.search())},a.terminateEditDisplayName=function(){delete b.search().edditingDisplayName,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"].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().edditingEmail&&-1!==b.search().edditingEmail.indexOf(a.emailInstance)?(a.editEmailText=a.emailInstance,a.edditingEmail=!0):a.edditingEmail=!1}e(),a.editEmail=function(c){var d=b.search();a.removeEmailAjaxError=!1,d.edditingEmail=void 0===d.edditingEmail?c:b.search().edditingEmail+"#"+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"].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"].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("edditingEmail"===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"].success?document.location.pathname="schemacat/site/index.html":(a.waitingForServer=!1,a.ajaxError=!0)},function(){a.waitingForServer=!1,a.ajaxError=!0})}}]);
     1"use strict";function prepareArrayForNgRepeat(e){var t;if(e instanceof Array)t=e;else t=new Array(e);return t}function isEmptyObj(e){if(e instanceof Object){for(var t in e){if(e.hasOwnProperty(t))return false}return true}else return false}function fixEmptyFields(e){if(isEmptyObj(e))return"";for(var t in e){if(e.hasOwnProperty(t)){if(isEmptyObj(e[t]))e[t]="";else if(e[t]instanceof Object)fixEmptyFields(e[t])}}return e}SCHEMAcat.controller("WorkspaceCtrl",["$scope","$location","$routeParams","$timeout","SchemasList","Schema","UserService","Settings",function(e,t,n,r,i,s,o,u){function a(n){if(isNaN(parseInt(n,10))||n<1){t.path("workspace/page/"+1+"/").search({schemaIndex:0});return}i.get({userID:o.id,startPage:n,pageSize:e.pageSize},function(r){if(n>Math.ceil(r["sc:result"]["sc:total-schemas"]/e.pageSize)){t.path("workspace/page/"+1+"/").search({schemaIndex:0});return}m.totalSchemaItems=r["sc:result"]["sc:total-schemas"];m.currentPage=Number(n);m.schemasList=prepareArrayForNgRepeat(r["sc:result"]["sc:schemas"]["sc:schema"]);f(t.search().schemaIndex);m.schemasResult=fixEmptyFields(r)})}function f(n){if(e.animateWorkspacePageChange!=="invisible")e.animateSchemaChange="invisible";if(isNaN(parseInt(n,10))||n<0||n>e.schemasList.length-1){e.selectedSchemaIndex=undefined;t.search({schemaIndex:0});return}e.selectedSchemaIndex=n;var r=m.schemasList[Number(n)];s.get({schemaID:r["xml:id"]},function(t){m.filesList=prepareArrayForNgRepeat(t["sc:schema"]["sc:files"]["sc:file"]);m.selectedSchema=fixEmptyFields(t);m.schemaEditable=o.id===l();m.resultHasArrived=true;if(u.getAnimationStatus()){switch(e.toNextSchema){case true:e.animateSchemaChange="animated fadeInUp";break;case false:e.animateSchemaChange="animated fadeInDown";break;case undefined:e.animateSchemaChange="animated fadeInDown"}}else e.animateSchemaChange=""})}function l(){var e;var t=prepareArrayForNgRepeat(m.selectedSchema["sc:schema"]["sc:access"]["sc:user"]);for(var n in t){if(t[n].role==="owner")e=t[n].ref}return e}function c(){e.workspace.namePanel.updateEditingName();e.workspace.descriptionPanel.updateEditingDescription();h()}function h(){var e=false;for(var n in g){if(t.search().hasOwnProperty(g[n])){v(n);e=true}}if(!e){p("")}}function p(t){for(var n in e.workspace.collapsibleDetailPanels){if(n!==t){e.workspace.collapsibleDetailPanels[n].detailButtonTooltip="Show field details";if(e.workspace.collapsibleDetailPanels[n].open===true){d(n);return true}}}return false}function d(t){if(e.workspace.collapsibleDetailPanels[t].editForm&&e.workspace.collapsibleDetailPanels[t].editForm.$dirty||e.workspace.collapsibleDetailPanels[t].modelDirty)e.workspace.collapsibleDetailPanels[t].detailButtonTooltip+=" (there are unsaved changes in this field!)";e.workspace.collapsibleDetailPanels[t].open=false}function v(t){function n(t){if(e.workspace.collapsibleDetailPanels[t]!==undefined&&e.workspace.collapsibleDetailPanels[t].updateEditPanel!==undefined)e.workspace.collapsibleDetailPanels[t].updateEditPanel();e.workspace.collapsibleDetailPanels[t].detailButtonTooltip="Hide field details";e.workspace.collapsibleDetailPanels[t].open=true}if(g.hasOwnProperty(t)){if(p(t)){r(function(){n(t)},350)}else n(t)}}var m=e.$parent;m.pageSize=10;var g={version:"showVersionDetails",status:"showStatusDetails",access:"showAccessDetails",license:"showLicenseDetails"};e.selectedSchemaIndex=n.schemaIndex;e.animateWorkspacePageChange="invisible";e.workspace={};e.location=location;if(!m.workspaceFullyLoaded)a(n.pageNumber);e.selectPage=function(e){t.search().schemaIndex="0";delete t.search().show;t.path("workspace.html/page/"+e+"/").search(t.search())};e.selectSchema=function(e){t.search().schemaIndex=e.toString();delete t.search().show;t.search(t.search())};e.toggleDetailsPanel=function(e){var n=g[e];if(t.search()[n]){delete t.search()[n]}else{for(var r in g){if(g[r]!==n)delete t.search()[g[r]]}t.search()[g[e]]=true}t.search(t.search())};e.$on("$routeChangeStart",function(t,n,r){m.resultHasArrived=false;if(u.getAnimationStatus()){if(n.params!==undefined&&n.params.pageNumber!==undefined&&n.params.pageNumber>r.params.pageNumber)m.toNextPage=true;else m.toNextPage=false;switch(n.templateUrl){case"partials/workspace.html":e.animateWorkspacePageChange=m.toNextPage?"animated slideOutLeft":"animated slideOutRight";break;case"partials/contact.html":case"partials/about.html":e.animateWorkspacePageChange="animated slideOutLeft";break;default:e.animateWorkspacePageChange="animated fadeOutDown"}}if(n.templateUrl==="partials/workspace.html")a(n.params.pageNumber);else m.workspaceFullyLoaded=false});e.$on("$routeChangeSuccess",function(e,t,n){if(u.getAnimationStatus()){if(n===undefined||n.templateUrl===undefined||n.templateUrl==="partials/accountDetails.html")m.toNextPage=undefined}});e.$on("$routeUpdate",function(t,n){if(n.templateUrl==="partials/workspace.html"&&n.params.schemaIndex!==e.selectedSchemaIndex){m.resultHasArrived=false;if(u.getAnimationStatus()){e.toNextSchema=n.params.schemaIndex>e.selectedSchemaIndex?true:false;e.animateSchemaChange=e.toNextSchema?"animated fadeOutUp":"animated fadeOutDown";r(function(){f(n.params.schemaIndex)},250)}else f(n.params.schemaIndex);var i=e.$watch("resultHasArrived",function(e,t){if(e){c();i()}})}else c()});var y=e.$watch("resultHasArrived",function(t,n){if(t){if(u.getAnimationStatus()){switch(m.toNextPage){case false:e.animateWorkspacePageChange="animated slideInLeft";break;case true:e.animateWorkspacePageChange="animated slideInRight";break;default:e.animateWorkspacePageChange="animated fadeInDown"}r(function(){e.animateWorkspacePageChange=""},250)}else e.animateWorkspacePageChange="";c();m.workspaceFullyLoaded=true;y()}})}]);SCHEMAcat.controller("NamePanelCtrl",["$scope","$location","$timeout","Schema",function(e,t,n,r){e.workspace.namePanel={};var i;e.workspace.namePanel.updateEditingName=function(){if(t.search().editingName){if(e.schemaEditable){e.workspace.namePanel.editButtonTooltip="Hide edit name";if(i===undefined)i=e.selectedSchema["sc:schema"]["sc:name"];e.workspace.namePanel.editForm.open=true}else{delete t.search().editingName;e.workspace.namePanel.editButtonTooltip="Edit schema name";if(e.workspace.namePanel.editForm.input.$dirty)e.workspace.namePanel.editButtonTooltip+=" (there are unsaved changes in this field!)";t.search(t.search())}}else{e.workspace.namePanel.editForm.open=false;e.workspace.namePanel.editButtonTooltip="Edit schema name";if(e.workspace.namePanel.editForm.input.$dirty)e.workspace.namePanel.editButtonTooltip+=" (there are unsaved changes in this field!)"}e.workspace.namePanel.updateAjaxError=false};e.saveName=function(){var n=e.selectedSchema["sc:schema"]["sc:name"];var s=new r;e.workspace.namePanel.waitingForServerUpdate=true;e.workspace.namePanel.updateAjaxError=false;s.name=n;s.$save({schemaID:e.schemasList[e.selectedSchemaIndex]["xml:id"],schemaField:"name"},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){e.selectedSchema["sc:schema"]["sc:name"]=fixEmptyFields(n["sc:response"]["sc:written-data"]["sc:name"]);i=n["sc:response"]["sc:written-data"]["sc:name"];e.workspace.namePanel.waitingForServerUpdate=false;e.workspace.namePanel.editForm.$setPristine();delete t.search().editingName;t.search(t.search())}else{e.workspace.namePanel.waitingForServerUpdate=false;e.workspace.namePanel.updateAjaxError=true}},function(){e.workspace.namePanel.waitingForServerUpdate=false;e.workspace.namePanel.updateAjaxError=true})};e.toggleEditName=function(r){if(t.search().editingName){delete t.search().editingName;if(r){n(function(){e.selectedSchema["sc:schema"]["sc:name"]=i;e.workspace.namePanel.editForm.$setPristine();e.$apply();t.search(t.search())},150);return}}else{t.search().editingName=true}t.search(t.search())}}]);SCHEMAcat.controller("DescriptionPanelCtrl",["$scope","$location","$timeout","Schema",function(e,t,n,r){e.workspace.descriptionPanel={};var i;e.workspace.descriptionPanel.updateEditingDescription=function(){if(t.search().editingDescription){if(e.schemaEditable){if(e.workspaceFullyLoaded)e.$broadcast("autosizeTextarea.resize");e.workspace.descriptionPanel.editButtonTooltip="Hide edit description";if(i===undefined)i=e.selectedSchema["sc:schema"]["sc:description"];e.workspace.descriptionPanel.editForm.open=true}else{delete t.search().editingDescription;e.workspace.descriptionPanel.editButtonTooltip="Edit description";if(e.workspace.descriptionPanel.editForm.input.$dirty)e.workspace.descriptionPanel.editButtonTooltip+=" (there are unsaved changes in this field!)";t.search(t.search())}}else{e.workspace.descriptionPanel.editForm.open=false;e.workspace.descriptionPanel.editButtonTooltip="Edit description";if(e.workspace.descriptionPanel.editForm.input.$dirty)e.workspace.descriptionPanel.editButtonTooltip+=" (there are unsaved changes in this field!)"}e.workspace.descriptionPanel.updateAjaxError=false};e.saveDescription=function(){var n=e.selectedSchema["sc:schema"]["sc:description"];var s=new r;e.workspace.descriptionPanel.waitingForServerUpdate=true;e.workspace.descriptionPanel.updateAjaxError=false;s.description=n;s.$save({schemaID:e.schemasList[e.selectedSchemaIndex]["xml:id"],schemaField:"description"},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){e.selectedSchema["sc:schema"]["sc:description"]=fixEmptyFields(n["sc:response"]["sc:written-data"]["sc:description"]);i=n["sc:response"]["sc:written-data"]["sc:description"];e.workspace.descriptionPanel.waitingForServerUpdate=false;e.workspace.descriptionPanel.editForm.$setPristine();delete t.search().editingDescription;t.search(t.search())}else{e.workspace.descriptionPanel.waitingForServerUpdate=false;e.workspace.descriptionPanel.updateAjaxError=true}},function(){e.workspace.descriptionPanel.waitingForServerUpdate=false;e.workspace.descriptionPanel.updateAjaxError=true})};e.toggleEditDescription=function(r){if(t.search().editingDescription){delete t.search().editingDescription;if(r){n(function(){e.selectedSchema["sc:schema"]["sc:description"]=i;e.workspace.descriptionPanel.editForm.$setPristine();e.$apply();t.search(t.search())},150);return}}else{t.search().editingDescription=true}t.search(t.search())}}]);SCHEMAcat.controller("VersionDetailsPanelCtrl",["$scope","$location","$timeout","Schema",function(e,t,n,r){e.workspace.collapsibleDetailPanels.version={};e.workspace.collapsibleDetailPanels.version.editPanel={};e.workspace.collapsibleDetailPanels.version.editPanel.open=false;var i;e.toggleEditVersion=function(r){if(t.search().editingVersion){delete t.search().editingVersion;if(r){n(function(){e.workspace.collapsibleDetailPanels.version.editForm.$setPristine();e.$apply();t.search(t.search());e.workspace.collapsibleDetailPanels.version.resettingUpdate=true;n(function(){e.selectedSchema["sc:schema"]["sc:version"]=i;e.workspace.collapsibleDetailPanels.version.resettingUpdate=false},350)},150);return}}else t.search().editingVersion=true;t.search(t.search())};e.workspace.collapsibleDetailPanels.version.updateEditPanel=function(){if(t.search().editingVersion){if(e.schemaEditable){e.workspace.collapsibleDetailPanels.version.editButtonTooltip="Hide edit panel";if(i===undefined)i=e.selectedSchema["sc:schema"]["sc:version"];e.workspace.collapsibleDetailPanels.version.editPanel.open=true}else{delete t.search().editingVersion;e.workspace.collapsibleDetailPanels.version.editButtonTooltip="Change schema version";if(e.workspace.collapsibleDetailPanels.version.editForm&&e.workspace.collapsibleDetailPanels.version.editForm.input.$dirty)e.workspace.collapsibleDetailPanels.version.editButtonTooltip+=" (there are unsaved changes in this field!)";t.search(t.search())}}else{e.workspace.collapsibleDetailPanels.version.editPanel.open=false;e.workspace.collapsibleDetailPanels.version.editButtonTooltip="Change schema version";if(e.workspace.collapsibleDetailPanels.version.editForm&&e.workspace.collapsibleDetailPanels.version.editForm.input.$dirty)e.workspace.collapsibleDetailPanels.version.editButtonTooltip+=" (there are unsaved changes in this field!)"}e.workspace.collapsibleDetailPanels.version.updateAjaxError=false};e.saveVersion=function(){var n=e.selectedSchema["sc:schema"]["sc:version"];var s=new r;e.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=true;e.workspace.collapsibleDetailPanels.version.updateAjaxError=false;s.version=n;s.$save({schemaID:e.selectedSchema["sc:schema"]["xml:id"],schemaField:"version"},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){e.selectedSchema["sc:schema"]["sc:version"]=fixEmptyFields(n["sc:response"]["sc:written-data"]["sc:version"]);i=e.selectedSchema["sc:schema"]["sc:version"];e.schemasList[e.selectedSchemaIndex]["sc:version"]=i;e.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.version.editForm.$setPristine();delete t.search().editingVersion;t.search(t.search())}else{e.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.version.updateAjaxError=true}},function(){e.workspace.collapsibleDetailPanels.version.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.version.updateAjaxError=true})}}]);SCHEMAcat.controller("StatusDetailsPanelCtrl",["$scope","$location","Schema",function(e,t,n){e.workspace.collapsibleDetailPanels.status={};e.workspace.collapsibleDetailPanels.status.editPanel={};e.workspace.collapsibleDetailPanels.status.editPanel.open=false;e.workspace.collapsibleDetailPanels.status.possibleStatusList=[];var r=["development"];var i=["production"];var s=["deprecated","superseeded"];e.toggleEditStatus=function(){if(t.search().editingStatus)delete t.search().editingStatus;else t.search().editingStatus=true;t.search(t.search())};e.workspace.collapsibleDetailPanels.status.updateEditPanel=function(){if(t.search().editingStatus){if(e.schemaEditable){if(e.selectedSchema["sc:schema"]["sc:access"]["sc:all"]&&e.selectedSchema["sc:schema"]["sc:access"]["sc:all"].actions==="r")e.workspace.collapsibleDetailPanels.status.possibleStatusList=i.concat(s);else e.workspace.collapsibleDetailPanels.status.possibleStatusList=r.concat(s);e.workspace.collapsibleDetailPanels.status.editPanel.open=true}else{delete t.search().editingStatus;t.search(t.search())}}else e.workspace.collapsibleDetailPanels.status.editPanel.open=false;e.workspace.collapsibleDetailPanels.status.updateAjaxError=false};e.saveStatus=function(){var t=e.selectedSchema["sc:schema"]["sc:status"];var r=new n;e.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=true;e.workspace.collapsibleDetailPanels.status.updateAjaxError=false;r.status=t;r.$save({schemaID:e.selectedSchema["sc:schema"]["xml:id"],schemaField:"status"},function(t){if(t["sc:response"]!==undefined&&t["sc:response"]&&t["sc:response"].success){e.selectedSchema["sc:schema"]["sc:status"]=fixEmptyFields(t["sc:response"]["sc:written-data"]["sc:status"]);e.schemasList[e.selectedSchemaIndex]["sc:status"]=e.selectedSchema["sc:schema"]["sc:status"];e.workspace.collapsibleDetailPanels.status.editForm.$setPristine();e.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=false}else{e.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.status.updateAjaxError=true}},function(){e.workspace.collapsibleDetailPanels.status.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.status.updateAjaxError=true})}}]);SCHEMAcat.controller("AccessDetailsPanelCtrl",["$scope","$location","Schema",function(e,t,n){e.workspace.collapsibleDetailPanels.access={};e.workspace.collapsibleDetailPanels.access.editPanel={};e.workspace.collapsibleDetailPanels.access.editPanel.open=false;e.currentAccessPolicy="";e.toggleEditAccess=function(){if(t.search().editingAccess)delete t.search().editingAccess;else t.search().editingAccess=true;t.search(t.search())};e.workspace.collapsibleDetailPanels.access.updateEditPanel=function(){if(t.search().editingAccess){if(e.schemaEditable){e.currentAccessPolicy=e.workspace.collapsibleDetailPanels.access.getAccessPolicy();e.workspace.collapsibleDetailPanels.access.editPanel.open=true}else{delete t.search().editingAccess;t.search(t.search())}}else e.workspace.collapsibleDetailPanels.access.editPanel.open=false;e.workspace.collapsibleDetailPanels.access.updateAjaxError=false};e.workspace.collapsibleDetailPanels.access.getAccessPolicy=function(){if(e.selectedSchema["sc:schema"]["sc:access"]["sc:all"]!==undefined&&e.selectedSchema["sc:schema"]["sc:access"]["sc:all"].actions==="r")return"shareURL";else return"private"};e.saveAccessStatus=function(t){var r=e.selectedSchema["sc:schema"]["sc:access"]["sc:user"];var i=new n;e.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=true;e.workspace.collapsibleDetailPanels.access.updateAjaxError=false;switch(t){case"shareURL":i.access={all:{actions:"r"},user:r};break;case"private":i.access={user:r};break}i.$save({schemaID:e.selectedSchema["sc:schema"]["xml:id"],schemaField:"access"},function(t){if(t["sc:response"]!==undefined&&t["sc:response"]&&t["sc:response"].success){e.selectedSchema["sc:schema"]["sc:access"]=t["sc:response"]["sc:written-data"]["sc:access"];e.workspace.collapsibleDetailPanels.access.editForm.$setPristine();e.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=false}else{e.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.access.updateAjaxError=true}e.currentAccessPolicy=e.workspace.collapsibleDetailPanels.access.getAccessPolicy()},function(){e.workspace.collapsibleDetailPanels.access.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.access.updateAjaxError=true;e.currentAccessPolicy=e.workspace.collapsibleDetailPanels.access.getAccessPolicy()})}}]);SCHEMAcat.controller("LicenseDetailsPanelCtrl",["$scope","$modal","$location","$timeout","Schema","Licenses",function(e,t,n,r,i,s){function a(){u=t.open({scope:e,templateUrl:"partials/editLicenseModal.html"});u.result.then(function(){u=undefined},function(t){u=undefined;if(t!=="dismiss")e.triggerCloseModalRoute()})}e.workspace.collapsibleDetailPanels.license={};e.input={};var o;var u;e.filterLicenses=function(t){var n=new RegExp(e.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue,"i");if(t["sc:full-name"].match(n)||t["xml:id"].match(n)||e.workspace.collapsibleDetailPanels.license.editForm.filterTerm.$modelValue===undefined){return true}return false};e.showSelectedLicense=function(t){if(e.selectedSchema["sc:schema"]["sc:license"]["xml:id"]!==t["xml:id"]){e.workspace.collapsibleDetailPanels.license.modelDirty=true;e.workspace.collapsibleDetailPanels.license.updatingLicense=true;r(function(){e.selectedSchema["sc:schema"]["sc:license"]=t;e.workspace.collapsibleDetailPanels.license.updatingLicense=false},250)}};e.saveNewLicense=function(){var t=e.selectedSchema["sc:schema"]["sc:license"];var n=new i;e.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=true;e.workspace.collapsibleDetailPanels.license.updateAjaxError=false;n.license=t["xml:id"];n.$save({schemaID:e.selectedSchema["sc:schema"]["xml:id"],schemaField:"license"},function(t){if(t["sc:response"]!==undefined&&t["sc:response"]&&t["sc:response"].success&&t["sc:response"]["sc:written-data"]["sc:license"].ref===e.selectedSchema["sc:schema"]["sc:license"]["xml:id"]){o=e.selectedSchema["sc:schema"]["sc:license"];e.workspace.collapsibleDetailPanels.license.modelDirty=false;e.workspace.collapsibleDetailPanels.license.editForm.$setPristine();e.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=false;e.triggerCloseModalRoute()}else{e.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.license.updateAjaxError=true}},function(){e.selectedSchema["sc:schema"]["sc:license"]=o;e.workspace.collapsibleDetailPanels.license.waitingForServerUpdate=false;e.workspace.collapsibleDetailPanels.license.updateAjaxError=true})};e.triggerOpenModalRoute=function(){if(!n.search().editingLicense){n.search().editingLicense=true;n.search(n.search())}};e.triggerCloseModalRoute=function(){if(n.search().editingLicense){delete n.search().editingLicense;n.search(n.search())}};e.workspace.collapsibleDetailPanels.license.updateEditPanel=function(){if(n.search().editingLicense){if(e.schemaEditable){if(o===undefined)o=e.selectedSchema["sc:schema"]["sc:license"];if(e.workspace.collapsibleDetailPanels.license.licenseList===undefined){e.workspace.collapsibleDetailPanels.license.licensesArrived=false;s.get(function(t){e.workspace.collapsibleDetailPanels.license.licenseList=t;for(var n=0;n<t["sc:licenses"]["sc:license"].length;n++){if(t["sc:licenses"]["sc:license"][n]["xml:id"]===e.selectedSchema["sc:schema"]["sc:license"]["xml:id"])e.input.model=e.workspace.collapsibleDetailPanels.license.licenseList["sc:licenses"]["sc:license"][n]["xml:id"]}e.workspace.collapsibleDetailPanels.license.licensesArrived=true})}a()}else{e.workspace.collapsibleDetailPanels.license.editButtonTooltip="Change schema license";if(e.workspace.collapsibleDetailPanels.license.editForm&&e.workspace.collapsibleDetailPanels.license.modelDirty)e.workspace.collapsibleDetailPanels.license.editButtonTooltip+=" (there are unsaved changes in this field!)";e.triggerCloseModalRoute()}}else if(u!==undefined){u.dismiss("dismiss")}e.workspace.collapsibleDetailPanels.license.editButtonTooltip="Change schema license";if(e.workspace.collapsibleDetailPanels.license.editForm&&e.workspace.collapsibleDetailPanels.license.modelDirty)e.workspace.collapsibleDetailPanels.license.editButtonTooltip+=" (there are unsaved changes in this field!)"};e.cancelEdit=function(){if(e.workspace.collapsibleDetailPanels.license.modelDirty){e.workspace.collapsibleDetailPanels.license.updatingLicense=true;e.workspace.collapsibleDetailPanels.license.modelDirty=false;r(function(){e.selectedSchema["sc:schema"]["sc:license"]=o;e.workspace.collapsibleDetailPanels.license.updatingLicense=false},250);e.workspace.collapsibleDetailPanels.license.editForm.$setPristine()}e.triggerCloseModalRoute()}}]);SCHEMAcat.controller("FileController",["$scope","$http","$timeout","$location",function(e,t,n,r){function i(){if(r.search().show!==undefined&&r.search().show.indexOf(e.file["sc:name"])!==-1){e.showSchemaBtn=true;s(e.selectedSchema["sc:schema"]["xml:id"],e.file["sc:name"])}else{e.showSchemaBtn=false;e.file.open=false}}function s(r,i){if(e.schemaFileContent===undefined){t.get("/schemacat/schemas/"+r+"/files/"+i).success(function(t,r,i,s){e.prettify="prettyprint linenums";n(function(){prettyPrint();e.file.open=true});e.schemaFileContent=t}).error(function(t,n,r,s){e.showSchemaBtn=false;e.showFile(i);e.showFileAjaxError=true})}else e.file.open=true}i();e.showFile=function(t){e.showFileAjaxError=false;n(function(){var n=r.search();if(e.showSchemaBtn===true){if(n.show===undefined)n.show="#"+t;else if(n.show.indexOf(t)===-1)n.show=n.show+"#"+t}else{for(var i in n){if(i==="show"){var s=n[i].split("#");for(var o in s){if(s[o]===t)s.splice(o,1)}var u=s.join("#");if(u!==""){n[i]=u}else delete n[i]}}}r.search(n)})};e.$on("$routeUpdate",function(t,n){if(e.resultHasArrived)i()})}]);SCHEMAcat.controller("TopMenuCtrl",["$scope","$modal","$location","UserService","Settings","ShibService",function(e,t,n,r,i,s){function o(){e.topMenuCollapsed=!n.search().topMenuExpanded;i.setAnimationStatus(!n.search().animationsDisabled);e.animationsChecked=i.getAnimationStatus()}e.displayName=r.displayName;e.shibURL=s.url;e.$watch(function(){return r.displayName},function(t,n){if(t!==n){e.displayName=t}});o();e.isActive=function(e){if(e==="/workspace.html"&&n.path().indexOf("/workspace.html/")!==-1)return true;return e===n.path()};e.updateAnimationStatus=function(){if(n.search().animationsDisabled)delete n.search().animationsDisabled;else n.search().animationsDisabled=true;n.search(n.search())};e.toggleTopMenu=function(){if(n.search().topMenuExpanded)delete n.search().topMenuExpanded;else n.search().topMenuExpanded=true;n.search(n.search())};e.animationsUrlPart=function(){if(n.search().animationsDisabled)return"animationsDisabled";else return""};e.topMenuExpandedUrlPart=function(){if(n.search().topMenuExpanded)return"topMenuExpanded";else return""};e.$on("$routeUpdate",function(e,t){o()});e.loginClick=function(){var n=t.open({scope:e,templateUrl:"partials/loginModal.html",controller:"LoginModalCtrl"});n.result.then(function(e){alert("Now set the user cookie to ["+e+"]");document.cookie="USER="+e+";domain=;path=/";document.location.hash="";document.location.reload(true)})}}]);SCHEMAcat.controller("LoginModalCtrl",["$scope","$modalInstance",function(e,t){e.loginClose=function(){t.dismiss("cancel")};e.loginSubmit=function(){t.close(this.loginNameInput.text)}}]);SCHEMAcat.controller("AboutPageCtrl",["$scope","Settings",function(e,t){e.$parent.toNextPage=false;if(t.getAnimationStatus()){e.animateInOut="animated slideInRight"}e.$on("$routeChangeStart",function(n,r,i){if(t.getAnimationStatus()){switch(r.templateUrl){case"partials/workspace.html":e.animateInOut="animated slideOutRight";break;case"partials/contact.html":e.animateInOut="animated slideOutLeft";break;default:e.animateInOut="animated fadeOutDown"}}});e.$on("$routeChangeSuccess",function(n,r,i){if(t.getAnimationStatus()){var s=i!==undefined?i.templateUrl:undefined;switch(s){case"partials/workspace.html":e.animateInOut="animated slideInRight";break;case"partials/contact.html":e.animateInOut="animated slideInLeft";break;default:e.animateInOut="animated fadeInDown"}}})}]);SCHEMAcat.controller("ContactPageCtrl",["$scope","Settings",function(e,t){e.$parent.toNextPage=false;if(t.getAnimationStatus()){e.animateInOut="animated slideInRight"}e.$on("$routeChangeStart",function(n,r,i){if(t.getAnimationStatus()){switch(r.templateUrl){case"partials/about.html":case"partials/contact.html":case"partials/workspace.html":e.animateInOut="animated slideOutRight";break;default:e.animateInOut="animated fadeOutDown"}}});e.$on("$routeChangeSuccess",function(n,r,i){if(t.getAnimationStatus()){var s=i!==undefined?i.templateUrl:undefined;switch(s){case"partials/about.html":case"partials/contact.html":case"partials/workspace.html":e.animateInOut="animated slideInRight";break;default:e.animateInOut="animated fadeInDown"}}})}]);SCHEMAcat.controller("AccountDetailsPageCtrl",["$scope","$location","User","UserService","Settings",function(e,t,n,r,i){function s(){var e=t.search();for(var n in e){if(n==="editingEmail"){var i=e[n].split("#");for(var s=0;s<i.length;s++){var o=false;for(var u=0;u<r.email.length;u++){if(i[s]===r.email[u])o=true}if(!o)i.splice(s,1)}var a=i.join("#");if(a!==""){e[n]=a}else delete e[n]}}t.search(e)}function o(){e.waitingForServerEditDisplayName=false;e.editDisplayNameAjaxError=false;if(t.search().editingDisplayName){e.editDisplayNameText=e.displayName;e.editingDisplayName=true}else e.editingDisplayName=false}function u(){e.waitingForServer=false;if(t.search().addingEmail)e.addingEmail=true;else e.addingEmail=false}e.principal=r.principal;e.displayName=r.displayName;e.email=r.email;e.addingEmail=false;e.addNewEmail=function(){t.search().addingEmail=true;t.search(t.search())};e.terminateAddEmail=function(){e.ajaxError=false;delete t.search().addingEmail;t.search(t.search())};e.addEmail=function(t){e.waitingForServer=true;var i=new n;i.emails=r.email.slice(0);i.emails.push(t);i.$save({userID:r.id},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){r.email.push(t);e.terminateAddEmail()}else{e.waitingForServer=false;e.ajaxError=true}},function(){e.waitingForServer=false;e.ajaxError=true})};e.editDisplayName=function(){t.search().editingDisplayName=true;t.search(t.search())};e.terminateEditDisplayName=function(){delete t.search().editingDisplayName;t.search(t.search())};e.updateDisplayName=function(t){e.waitingForServerEditDisplayName=true;var i=new n;i.displayName=t;i.$save({userID:r.id},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){e.displayName=r.displayName=t;e.terminateEditDisplayName()}else{e.waitingForServerEditDisplayName=false;e.editDisplayNameAjaxError=true}},function(){e.waitingForServerEditDisplayName=false;e.editDisplayNameAjaxError=true})};if(i.getAnimationStatus()){e.animateAccountDetails="animated fadeInDown"}e.$on("$routeChangeStart",function(t,n,r){if(i.getAnimationStatus()){e.animateAccountDetails="animated fadeOutUp"}});e.$on("$routeChangeSuccess",function(t,n,r){if(i.getAnimationStatus()){e.animateAccountDetails="animated fadeInDown"}u();o();s()});e.$on("$routeUpdate",function(e,t){u();o();s()})}]);SCHEMAcat.controller("EmailInstanceCtrl",["$scope","$location","User","UserService",function(e,t,n,r){function i(){e.waitingForServerEditEmail=false;if(t.search().editingEmail!==undefined&&t.search().editingEmail.indexOf(e.emailInstance)!==-1){e.editEmailText=e.emailInstance;e.editingEmail=true}else e.editingEmail=false}i();e.editEmail=function(n){var r=t.search();e.removeEmailAjaxError=false;if(r.editingEmail===undefined)r.editingEmail=n;else r.editingEmail=t.search().editingEmail+"#"+n;t.search(r)};e.removeEmail=function(t){e.waitingForServerEditEmail=true;var i=new n;i.emails=r.email.slice(0);i.emails.splice(t,1);i.$save({userID:r.id},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){r.email.splice(t,1)}else{e.waitingForServerEditEmail=false;e.removeEmailAjaxError=true}},function(){e.waitingForServerEditEmail=false;e.removeEmailAjaxError=true})};e.updateEmail=function(t){e.waitingForServerEditEmail=true;var i=new n;i.emails=r.email.slice(0);i.emails[t]=e.editEmailText;i.$save({userID:r.id},function(n){if(n["sc:response"]!==undefined&&n["sc:response"]&&n["sc:response"].success){var i=e.editEmailText;e.cancelEditEmail(r.email[t]);r.email[t]=i}else{e.waitingForServerEditEmail=false;e.editEmailAjaxError=true}},function(){e.waitingForServerEditEmail=false;e.editEmailAjaxError=true})};e.cancelEditEmail=function(n){var r=t.search();e.editEmailAjaxError=false;for(var i in r){if(i==="editingEmail"){var s=r[i].split("#");for(var o in s){if(s[o]===n)s.splice(o,1)}var u=s.join("#");if(u!==""){r[i]=u}else delete r[i]}}t.search(r)};e.$on("$routeChangeSuccess",function(e,t,n){i()});e.$on("$routeUpdate",function(e,t){i()})}]);SCHEMAcat.controller("CompleteUserDetailsCtrl",["$scope","$modal",function(e,t){e.ajaxError=false;e.waitingForServer=false;var n=t.open({scope:e,backdrop:"static",keyboard:false,templateUrl:"partials/fillDetailsModal.html",controller:"CompleteUserDetailsModalCtrl"})}]);SCHEMAcat.controller("CompleteUserDetailsModalCtrl",["$scope","$modalInstance","User","UserService",function(e,t,n,r){e.userDetailsSubmit=function(){e.waitingForServer=true;e.ajaxError=false;var t=new n;t.emails=[];t.emails[0]=this.emailInput.text;t.displayName=this.displayNameInput.text;t.$save({userID:r.id},function(t){if(t["sc:response"]!==undefined&&t["sc:response"]&&t["sc:response"].success)document.location.pathname="schemacat/site/index.html";else{e.waitingForServer=false;e.ajaxError=true}},function(){e.waitingForServer=false;e.ajaxError=true})}}])
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.js

    r4127 r4567  
    33        function() {
    44                return function(scope, element, attrs) {
    5                         scope.workspaceFirstLoaded = false;
     5                        scope.workspaceFullyLoaded = false;
    66                };
    77        }
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/directives.min.js

    r4126 r4567  
    1 "use strict";SCHEMAcat.directive("workspaceDirective",[function(){return function(a){a.workspaceFirstLoaded=!1}}]);
     1"use strict";SCHEMAcat.directive("workspaceDirective",[function(){return function(e,t,n){e.workspaceFullyLoaded=false}}])
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/modules.js

    r4300 r4567  
    22
    33//SCHEMAcat module definition
    4 var SCHEMAcat = angular.module('SCHEMAcat', ['ui.bootstrap', 'ngRoute', 'ngResource']);
     4var SCHEMAcat = angular.module('SCHEMAcat', ['ui.bootstrap', 'ngRoute', 'ngResource', 'tlaGenerics']);
    55
    66SCHEMAcat.config(['$routeProvider',
     
    1212                templateUrl: 'partials/workspace.html',
    1313
    14                 /* With this, the $routeProvider will trigger $routeChangeSuccess
    15             event if the path part (//workspace/page/:pageNumber/) is not the
    16             same as current location, causing angular to reload the controller
    17             (flickering the view).
    18             Otherwise it will trigger $routeUpdate event which does not reload
    19             the controller neither updates the view. We have to listen to this
    20             event if we need to update the view when the search part of the
    21             route changes.
    22             */
     14                /*
     15                With this, the $routeProvider will trigger $routeChangeSuccess
     16                event if the path part (//workspace/page/:pageNumber/) is not the
     17                same as current location, causing angular to reload the controller
     18                (flickering the view).
     19                Otherwise it will trigger $routeUpdate event which does not reload
     20                the controller neither updates the view. We have to listen to this
     21                event if we need to update the view when the search part of the
     22                route changes.
     23                */
    2324                reloadOnSearch: false,
    2425                resolve: {
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/modules.min.js

    r4300 r4567  
    1 "use strict";var SCHEMAcat=angular.module("SCHEMAcat",["ui.bootstrap","ngRoute","ngResource"]);SCHEMAcat.config(["$routeProvider",function(a){var b=250;a.when("/workspace.html/page/:pageNumber/",{controller:"WorkspaceCtrl",templateUrl:"partials/workspace.html",reloadOnSearch:!1,resolve:{delay:["$q","$timeout","Settings",function(a,c,d){if(d.getAnimationStatus()){var e=a.defer();return c(e.resolve,b),e.promise}}]}}).when("/about.html",{controller:"AboutPageCtrl",templateUrl:"partials/about.html",reloadOnSearch:!1,resolve:{delay:["$q","$timeout","Settings",function(a,c,d){if(d.getAnimationStatus()){var e=a.defer();return c(e.resolve,b),e.promise}}]}}).when("/contact.html",{controller:"ContactPageCtrl",templateUrl:"partials/contact.html",reloadOnSearch:!1,resolve:{delay:["$q","$timeout","Settings",function(a,c,d){if(d.getAnimationStatus()){var e=a.defer();return c(e.resolve,b),e.promise}}]}}).when("/accountDetails.html",{controller:"AccountDetailsPageCtrl",templateUrl:"partials/accountDetails.html",reloadOnSearch:!1,resolve:{delay:["$q","$timeout","Settings",function(a,c,d){if(d.getAnimationStatus()){var e=a.defer();return c(e.resolve,b),e.promise}}]}}).otherwise({redirectTo:function(){return"/workspace.html/page/1/?schemaIndex=0"}})}]);
     1"use strict";var SCHEMAcat=angular.module("SCHEMAcat",["ui.bootstrap","ngRoute","ngResource","tlaGenerics"]);SCHEMAcat.config(["$routeProvider",function(e){var t=250;e.when("/workspace.html/page/:pageNumber/",{controller:"WorkspaceCtrl",templateUrl:"partials/workspace.html",reloadOnSearch:false,resolve:{delay:["$q","$timeout","Settings",function(e,n,r){if(r.getAnimationStatus()){var i=e.defer();n(i.resolve,t);return i.promise}else return}]}}).when("/about.html",{controller:"AboutPageCtrl",templateUrl:"partials/about.html",reloadOnSearch:false,resolve:{delay:["$q","$timeout","Settings",function(e,n,r){if(r.getAnimationStatus()){var i=e.defer();n(i.resolve,t);return i.promise}else return}]}}).when("/contact.html",{controller:"ContactPageCtrl",templateUrl:"partials/contact.html",reloadOnSearch:false,resolve:{delay:["$q","$timeout","Settings",function(e,n,r){if(r.getAnimationStatus()){var i=e.defer();n(i.resolve,t);return i.promise}else return}]}}).when("/accountDetails.html",{controller:"AccountDetailsPageCtrl",templateUrl:"partials/accountDetails.html",reloadOnSearch:false,resolve:{delay:["$q","$timeout","Settings",function(e,n,r){if(r.getAnimationStatus()){var i=e.defer();n(i.resolve,t);return i.promise}else return}]}}).otherwise({redirectTo:function(e,t,n){return"/workspace.html/page/1/?schemaIndex=0"}})}])
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/services.js

    r4372 r4567  
    2929]);
    3030
     31SCHEMAcat.factory('Licenses', ['$resource',
     32    function($resource) {
     33        var licenses = $resource('/schemacat/licenses');
     34        return licenses;
     35    }
     36]);
     37
    3138SCHEMAcat.factory('Settings', ['$resource',
    3239    function() {
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/scripts/services.min.js

    r4372 r4567  
    1 "use strict";SCHEMAcat.factory("SchemasList",["$resource",function(a){var b=a("/schemacat/users/:userID/schemas/pagedlist/page/:startPage/pagesize/:pageSize",{userID:"guest"});return b}]),SCHEMAcat.factory("Schema",["$resource",function(a){var b=a("/schemacat/schemas/:schemaID/:schemaField",{schemaID:"",schemaField:""});return b}]),SCHEMAcat.factory("User",["$resource",function(a){var b=a("/schemacat/users/:userID",{userID:""});return b}]),SCHEMAcat.factory("Settings",["$resource",function(){function c(b){a=b}function d(){return a}function e(){return b}var a=!0,b={};return{getAnimationStatus:d,setAnimationStatus:c,getStore:e}}]);
     1"use strict";SCHEMAcat.factory("SchemasList",["$resource",function(e){var t=e("/schemacat/users/:userID/schemas/pagedlist/page/:startPage/pagesize/:pageSize",{userID:"guest"});return t}]);SCHEMAcat.factory("Schema",["$resource",function(e){var t=e("/schemacat/schemas/:schemaID/:schemaField",{schemaID:"",schemaField:""});return t}]);SCHEMAcat.factory("User",["$resource",function(e){var t=e("/schemacat/users/:userID",{userID:""});return t}]);SCHEMAcat.factory("Licenses",["$resource",function(e){var t=e("/schemacat/licenses");return t}]);SCHEMAcat.factory("Settings",["$resource",function(){function n(t){e=t}function r(){return e}function i(){return t}var e=true;var t={};return{getAnimationStatus:r,setAnimationStatus:n,getStore:i}}])
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/styles/SCHEMAcat.css

    r4476 r4567  
    55}
    66
    7 body {
    8     overflow-y: scroll;
    9 }
    10 
    11 .centered{
    12     text-align:center;
     7.modal {
     8    overflow-y: auto;
     9}
     10
     11body.modal-open {
     12    overflow: auto;
    1313}
    1414
     
    1717#about, #contact, #accountDetails{
    1818    -webkit-animation-duration: 0.25s;
    19     -moz-animation-duration: 0.25s;
    20     -o-animation-duration: 0.25s;
    21     animation-duration: 0.25s;
     19       -moz-animation-duration: 0.25s;
     20         -o-animation-duration: 0.25s;
     21            animation-duration: 0.25s;
    2222}
    2323
    2424#schema-background {
    2525    min-height: 350px;
     26    padding-top: 10px;
    2627}
    2728
     
    3334    border-color: #e9322d;
    3435    -webkit-box-shadow: 0 0 6px #f8b9b7;
    35     -moz-box-shadow: 0 0 6px #f8b9b7;
    36     box-shadow: 0 0 6px #f8b9b7;
     36       -moz-box-shadow: 0 0 6px #f8b9b7;
     37         -o-box-shadow: 0 0 6px #f8b9b7;
     38            box-shadow: 0 0 6px #f8b9b7;
    3739}
    3840
     
    4345.cursor-default{
    4446    cursor:default;
     47}
     48
     49.pre-wrap {
     50    white-space:pre-wrap;
    4551}
    4652
     
    6369}
    6470
     71.inline{
     72    display: inline;
     73}
     74
    6575.word-breaking-wraper{
    6676    word-wrap: break-word;
    67 }
    68 
    69 #access-actions .tooltip-inner {
    70     max-width: 350px;
    7177}
    7278
     
    7985}
    8086/*override bootstrap.css '<pre><code>' tag sequence not to use transparent
    81   background (removes lag in google Chrome) and not to wrap text on white spaces.*/
     87  background and not to wrap text on white spaces.*/
    8288pre code {
    8389    background-color: inherit;
     
    127133}
    128134
    129 #schema-div h1,
    130 #contact-div h1 {
    131     line-height: 1;
    132 }
    133 
    134135#schema-div p,
    135136#contact-div p {
     
    140141}
    141142
     143#account-details-list {
     144    margin-top: 25px;
     145    font-size: 18px;
     146    font-weight: 200;
     147}
     148
     149#account-details-list dt,
     150#account-details-list dd {
     151    margin-bottom: 5px;
     152}
     153
     154#license-description {
     155    padding-top: 65px;
     156}
     157
     158#license-select {
     159    max-height: 350px;
     160}
     161
     162/*magnifier icon inside filter box*/
     163.right-inner-addon {
     164    position: relative;
     165    width: 70%;
     166}
     167.right-inner-addon input {
     168    font-size: 85%;
     169    height: 25px;
     170    padding: 0px 30px 0px 12px;
     171    -webkit-border-radius: 20px;
     172       -moz-border-radius: 20px;
     173         -o-border-radius: 20px;
     174            border-radius: 20px;
     175}
     176.right-inner-addon i {
     177    font-size: 85%;
     178    position: absolute;
     179    right: 0px;
     180    padding: 5px 12px;
     181    pointer-events: none;
     182}
     183
     184/*different glow colour for interface icons*/
     185a.glow{
     186    -webkit-text-shadow: 0px 0px 20px #00FFFF;
     187       -moz-text-shadow: 0px 0px 20px #00FFFF;
     188         -o-text-shadow: 0px 0px 20px #00FFFF;
     189            text-shadow: 0px 0px 20px #00FFFF;     
     190}
     191a.glow-warn{
     192    color: #CFAF00;
     193    -webkit-text-shadow: 0px 0px 20px #CFAF00;
     194       -moz-text-shadow: 0px 0px 20px #CFAF00;
     195         -0-text-shadow: 0px 0px 20px #CFAF00;
     196            text-shadow: 0px 0px 20px #CFAF00;
     197}
     198
     199.capitalize {
     200    text-transform: capitalize;
     201}
     202
     203.no-bottom-margin {
     204    margin-bottom: 0px;
     205}
     206
    142207.help-block {
    143208    line-height: 1.428571429;
    144209}
    145210
     211textarea.vertical {
     212    resize: vertical;
     213    max-width: 100%;
     214    overflow: hidden;
     215    vertical-align: top;
     216}
     217
    146218#fill-details-modal-error.help-block {
    147219    padding-top: 7px;
    148220}
    149221
    150 
    151 /* FIX FOR BOOTSTRAP 3.1.0 BUG #12447. (From #12489 commit) */
    152 /* 1. override the wrong selectors to create a border */
    153 .panel > .table-bordered > tbody > tr:first-child > td {
    154   border-top: 1px solid #ddd;
    155 }
    156 
    157 .panel > .table-bordered > thead > tr:last-child > th {
    158   border-bottom: 1px solid #ddd;
    159 }
    160 /* 2. declare new fixed selectors */
    161 .panel > .table-bordered > tbody:first-child > tr:first-child > td {
    162   border-top: 0;
    163 }
    164 
    165 .panel > .table-bordered > thead:last-child > tr:last-child > th {
    166   border-bottom: 0;
    167 }
    168 /* END OF FIX FOR BOOTSTRAP 3.1.0 BUG #12447 */
    169 
    170 .modal {
    171     overflow-y: auto;
    172 }
    173 
    174 body.modal-open {
    175     overflow: scroll;
     222#description-spinner {
     223    line-height: 2.8;
    176224}
    177225
  • cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.site/site/styles/SCHEMAcat.min.css

    r4476 r4567  
    1 body,html{height:100%}body{overflow-y:scroll}.centered{text-align:center}#about,#accountDetails,#contact,#schema-div,#workspace{-webkit-animation-duration:.25s;-moz-animation-duration:.25s;-o-animation-duration:.25s;animation-duration:.25s}#schema-background{min-height:350px}input.ng-dirty.ng-invalid{color:#b94a48;border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.sidebar-nav-fixed{position:fixed;width:21.97%;min-width:246px}.paginator{white-space:nowrap;min-width:241px}.img-responsive-inline{display:inline-block;height:auto;max-width:100%}.word-breaking-wraper{word-wrap:break-word}#access-actions .tooltip-inner{max-width:350px}pre{overflow-x:auto;overflow-wrap:normal;word-wrap:normal}pre code{background-color:inherit;white-space:pre;float:left;min-width:100%}#wrap{min-height:100%;height:auto!important;height:100%;margin:0 auto -71px}#footer,#pushf,#pushh{height:71px}#footer{background-color:#f5f5f5;padding-top:20px}.schemacat-fluid-container{padding-left:15px;padding-right:15px;margin-left:auto;margin-right:auto}.schemacat-fluid-container .jumbotron{border-radius:6px}#contact-div,#schema-div{font-size:21px;font-weight:200;line-height:2.1428571435}#contact-div h1,#schema-div h1{line-height:1}#contact-div p,#schema-div p{line-height:1.4;font-size:inherit;font-weight:inherit;margin-bottom:10px}.help-block{line-height:1.428571429}#fill-details-modal-error.help-block{padding-top:7px}.panel>.table-bordered>tbody>tr:first-child>td{border-top:1px solid #ddd}.panel>.table-bordered>thead>tr:last-child>th{border-bottom:1px solid #ddd}.panel>.table-bordered>tbody:first-child>tr:first-child>td{border-top:0}.panel>.table-bordered>thead:last-child>tr:last-child>th{border-bottom:0}.modal{overflow-y:auto}body.modal-open{overflow:scroll}@media (max-width:767px){#footer{margin-left:-20px;margin-right:-20px;padding-left:20px;padding-right:20px}.navbar-fixed-top{position:relative;top:auto}#pushh{height:0}}@media (max-width:1009px){.sidebar-nav-fixed{position:static;width:auto}}
     1body,html{height:100%}.modal{overflow-y:auto}body.modal-open{overflow:auto}#about,#accountDetails,#contact,#schema-div,#workspace{-webkit-animation-duration:.25s;-moz-animation-duration:.25s;-o-animation-duration:.25s;animation-duration:.25s}#schema-background{min-height:350px;padding-top:10px}input.ng-dirty.ng-invalid{color:#b94a48;border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;-o-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.cursor-pointer{cursor:pointer}.cursor-default{cursor:default}.pre-wrap{white-space:pre-wrap}.sidebar-nav-fixed{position:fixed;width:21.97%;min-width:246px}.paginator{white-space:nowrap;min-width:241px}.img-responsive-inline{display:inline-block;height:auto;max-width:100%}.inline{display:inline}.word-breaking-wraper{word-wrap:break-word}pre{overflow-x:auto;overflow-wrap:normal;word-wrap:normal}pre code{background-color:inherit;white-space:pre;float:left;min-width:100%}#wrap{min-height:100%;height:auto!important;height:100%;margin:0 auto -71px}#footer,#pushf,#pushh{height:71px}#footer{background-color:#f5f5f5;padding-top:20px}.schemacat-fluid-container{padding-left:15px;padding-right:15px;margin-left:auto;margin-right:auto}.schemacat-fluid-container .jumbotron{border-radius:6px}#contact-div,#schema-div{font-size:21px;font-weight:200;line-height:2.1428571435}#contact-div p,#schema-div p{line-height:1.4;font-size:inherit;font-weight:inherit;margin-bottom:10px}#account-details-list{margin-top:25px;font-size:18px;font-weight:200}#account-details-list dd,#account-details-list dt{margin-bottom:5px}#license-description{padding-top:65px}#license-select{max-height:350px}.right-inner-addon{position:relative;width:70%}.right-inner-addon input{font-size:85%;height:25px;padding:0 30px 0 12px;-webkit-border-radius:20px;-moz-border-radius:20px;-o-border-radius:20px;border-radius:20px}.right-inner-addon i{font-size:85%;position:absolute;right:0;padding:5px 12px;pointer-events:none}a.glow{-webkit-text-shadow:0 0 20px #0FF;-moz-text-shadow:0 0 20px #0FF;-o-text-shadow:0 0 20px #0FF;text-shadow:0 0 20px #0FF}a.glow-warn{color:#CFAF00;-webkit-text-shadow:0 0 20px #CFAF00;-moz-text-shadow:0 0 20px #CFAF00;-0-text-shadow:0 0 20px #CFAF00;text-shadow:0 0 20px #CFAF00}.capitalize{text-transform:capitalize}.no-bottom-margin{margin-bottom:0}.help-block{line-height:1.428571429}textarea.vertical{resize:vertical;max-width:100%;overflow:hidden;vertical-align:top}#fill-details-modal-error.help-block{padding-top:7px}#description-spinner{line-height:2.8}@media (max-width:767px){#footer{margin-left:-20px;margin-right:-20px;padding-left:20px;padding-right:20px}.navbar-fixed-top{position:relative;top:auto}#pushh{height:0}}@media (max-width:1009px){.sidebar-nav-fixed{position:static;width:auto}}
Note: See TracChangeset for help on using the changeset viewer.