]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1629] Add a configuration field for the application url.
authorOlivier Lamy <olamy@apache.org>
Thu, 24 May 2012 22:00:11 +0000 (22:00 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 24 May 2012 22:00:11 +0000 (22:00 +0000)
add form to setup data.

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1342458 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/general-admin.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/archiva/main.js
archiva-modules/archiva-web/archiva-webapp-js/src/main/webapp/js/templates/archiva/general-admin.html

index 877b447dd93289ee40c2d3fdc4bfa26569821d47..c35a2d37254eeb67faa51c637737dd97bea189f1 100644 (file)
@@ -561,7 +561,59 @@ define("archiva.general-admin",["jquery","i18n","order!utils","order!jquery.tmpl
   }
 
   //---------------------------
-  // system status part
+  // UiConfiguration part
+  //---------------------------
+
+  displayUiConfiguration=function(){
+    screenChange();
+    var mainContent=$("#main-content");
+    mainContent.html(mediumSpinnerImg());
+    $.ajax("restServices/archivaServices/archivaAdministrationService/getNetworkConfiguration", {
+        type: "GET",
+        dataType: 'json',
+        success: function(data){
+          mainContent.html($("#ui-configuration-screen").tmpl());
+          var uiConfiguration=new UiConfiguration(data.showFindArtifacts,data.appletFindEnabled,data.disableEasterEggs,data.applicationUrl);
+          var uiConfigurationViewModel=new UiConfigurationViewModel(uiConfiguration);
+          ko.applyBindings(uiConfigurationViewModel,mainContent.get(0));
+          /*var validator = mainContent.find("#network-configuration-edit-form").validate({
+            showErrors: function(validator, errorMap, errorList) {
+             customShowError(mainContent.find("#network-configuration-edit-form" ).get(0),validator,errorMap,errorMap);
+            }
+          });*/
+        }
+    });
+  }
+
+  UiConfiguration=function(showFindArtifacts,appletFindEnabled,disableEasterEggs,applicationUrl){
+    this.showFindArtifacts = ko.observable(showFindArtifacts);
+
+    this.appletFindEnabled = ko.observable(appletFindEnabled);
+
+    this.disableEasterEggs = ko.observable(disableEasterEggs);
+
+    this.applicationUrl = ko.observable(applicationUrl);
+  }
+
+  UiConfigurationViewModel=function(uiConfiguration){
+    this.uiConfiguration=ko.observable(uiConfiguration);
+    var self=this;
+    save=function(){
+      $.ajax("restServices/archivaServices/archivaAdministrationService/setUiConfiguration", {
+        type: "POST",
+        contentType: 'application/json',
+        data: ko.toJSON(self.uiConfiguration),
+        dataType: 'json',
+        success: function(data){
+          displaySuccessMessage( $.i18n.prop("ui-configuration.updated"));
+        }
+      });
+    }
+  }
+
+
+  //---------------------------
+  // System status part
   //---------------------------
 
   QueueEntry=function(key,entriesNumber){
index bb99f2c9f51682b9165caaae960c06f6f97c971e..fc47abaa1f8876485a6363d8650dacb2ae940f22 100644 (file)
@@ -124,6 +124,10 @@ function() {
         displayRepositoriesGrid();
         return;
       }
+      if (screen=='ui-configuration'&& hasKarma('archiva-manage-configuration')){
+        displayUiConfiguration();
+        return;
+      }
 
       if (screen=="browse"){
         displayBrowse(true);
index f19635cdb2a7d301d483f012aa072e5f0a66eabc..67236a7e49943d37a86f39bce4db64afb440b9c1 100644 (file)
     </form>
 </script>
 
+<script id="ui-configuration-screen" type="text/html">
+  <div class="page-header">
+    <h4>${$.i18n.prop('ui-configuration.header')}</h4>
+  </div>
+  <div id="ui-configuration-form" data-bind='template: {name:"ui-configuration-form-tmpl"}'></div>
+</script>
+
+<script id="ui-configuration-form-tmpl" type="text/html">
+    <form id="ui-configuration-edit-form" class="well form-horizontal">
+      <fieldset id="ui-configuration-edit-fieldset">
+        <div class="control-group">
+          <label class="control-label" for="maxTotal">${$.i18n.prop('ui-configuration.applicationUrl')}</label>
+          <div class="controls">
+            <input type="text" class="xlarge required digits" id="applicationUrl" name="applicationUrl" size="8"
+                   data-bind="value: uiConfiguration().applicationUrl"/>
+          </div>
+        </div>
+      </fieldset>
+      <button id="ui-configuration-btn-save" data-bind="click: save" class="btn">${$.i18n.prop('save')}</button>
+    </form>
+</script>
+
 <script id="system-status-main" type="text/html">
   <div class="page-header">
     <h4>${$.i18n.prop('system-status.header.version.info')}</h4>