Commit 36452b93 authored by Sebastien Robin's avatar Sebastien Robin

keep minimum needed code

parent 67c6485f
...@@ -3,8 +3,6 @@ ...@@ -3,8 +3,6 @@
*/ */
(function($) { (function($) {
var routes = { var routes = {
"/service" : "displayForm",
"/service/:id" : "displayData",
"/image/:id" : "displayData", "/image/:id" : "displayData",
"image/:id" : "displayData", "image/:id" : "displayData",
} }
...@@ -24,28 +22,17 @@ ...@@ -24,28 +22,17 @@
var methods = { var methods = {
init: function() { init: function() {
// Initialize slapos in this context // Initialize in this context
var $this = $(this); var $this = $(this);
// Bind to urlChange event // Bind to urlChange event
return this.each(function(){ return this.each(function(){
$.subscribe("urlChange", function(e, d){ $.subscribe("urlChange", function(e, d){
router.call($this, e, d); router.call($this, e, d);
}); });
$.subscribe("auth", function(e, d){
$(this).form("authenticate", d);
});
}); });
}, },
authenticate: function(data) {
for (var d in data) {
if (data.hasOwnProperty(d)) {
}
}
},
displayData: function(id){ displayData: function(id){
console.log('displayData, id', id);
if (map !== undefined){ if (map !== undefined){
map.destroy(); map.destroy();
} }
...@@ -62,51 +49,6 @@ ...@@ -62,51 +49,6 @@
$(loadOpenLayerZoomedImage); $(loadOpenLayerZoomedImage);
}, },
displayForm: function() {
console.log('form.displayForm');
$(this).form('render', 'form.new.instance');
var data = {};
$(this).find("form").submit(function(){
$(this).find('input').serializeArray().map(function(elem){
data[elem["name"]] = elem["value"];
});
$(this).form('displayAsking', data);
return false;
});
},
displayAsking: function(data){
var request = {
software_type: "type_provided_by_the_software",
slave: false,
status: "started",
parameter: {
Custom1: "one string",
Custom2: "one float",
Custom3: ["abc", "def"],
},
sla: {
computer_id: "COMP-0",
}
};
var redirect = function(){
$(this).form('render', 'auth', {
'host':'t139:12002/erp5/web_site_module/hosting/request-access-token',
'client_id': 'client',
'redirect':escape(window.location.href)
})
};
var statusCode = {
401: redirect
};
$.extend(request, data);
$(this).html("<p>Requesting a new instance "+request["title"]+" ...</p>")
.slapos('newInstance', request, function(data){
$(this).html(data);},
statusCode
);
},
render: function(template, data){ render: function(template, data){
$(this).html(ich[template](data, true)); $(this).html(ich[template](data, true));
} }
...@@ -123,4 +65,4 @@ ...@@ -123,4 +65,4 @@
}; };
})(jQuery); })(jQuery);
$("#main").form(); $("#main").form();
\ No newline at end of file
...@@ -5,7 +5,6 @@ var zoomify_url = "image/hs-2007-16-a-full_jpg/"; ...@@ -5,7 +5,6 @@ var zoomify_url = "image/hs-2007-16-a-full_jpg/";
var map, zoomify; var map, zoomify;
function loadOpenLayerZoomedImage(){ function loadOpenLayerZoomedImage(){
console.log('iniside init of custom', zoomify_url)
/* First we initialize the zoomify pyramid (to get number of tiers) */ /* First we initialize the zoomify pyramid (to get number of tiers) */
var zoomify = new OpenLayers.Layer.Zoomify( "Zoomify", zoomify_url, var zoomify = new OpenLayers.Layer.Zoomify( "Zoomify", zoomify_url,
new OpenLayers.Size( zoomify_width, zoomify_height ) ); new OpenLayers.Size( zoomify_width, zoomify_height ) );
...@@ -23,6 +22,4 @@ function loadOpenLayerZoomedImage(){ ...@@ -23,6 +22,4 @@ function loadOpenLayerZoomedImage(){
map.setBaseLayer(zoomify); map.setBaseLayer(zoomify);
map.zoomToMaxExtent(); map.zoomToMaxExtent();
}; };
\ No newline at end of file
console.log('foo');
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment