From 79ced60a6b320701637981fd1935ae2a8d03d19e Mon Sep 17 00:00:00 2001 From: phamt Date: Mon, 20 Dec 2010 22:25:55 +0000 Subject: [PATCH] Enable server browser for certain image attributes. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@8488 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/js/provision/images.js | 136 +++++++++++++++++++++++++++++++-- 1 file changed, 131 insertions(+), 5 deletions(-) diff --git a/xCAT-UI/js/provision/images.js b/xCAT-UI/js/provision/images.js index a76c509ab..0dd311ac0 100644 --- a/xCAT-UI/js/provision/images.js +++ b/xCAT-UI/js/provision/images.js @@ -131,9 +131,9 @@ function loadImages(data) { */ // Create copy Linux button - var copyLinuxBtn = createButton('Copy Linux'); + var copyLinuxBtn = createButton('Copy CD'); copyLinuxBtn.bind('click', function(event) { - loadCopyLinuxPage(); + loadCopyCdPage(); }); // Create edit button @@ -464,7 +464,133 @@ function loadEditImagePage(tgtImage) { // Create label and input for attribute div = $('
').css('display', 'inline'); label = $('').css('vertical-align', 'middle'); - input = $('').css('margin-top', '5px'); + input = $('').css('margin-top', '5px'); + + // Create server browser + switch (key) { + case 'pkgdir': + input.serverBrowser({ + onSelect : function(path) { + $('#pkgdir').val(path); + }, + onLoad : function() { + return $('#pkgdir').val(); + }, + knownExt : [ 'exe', 'js', 'txt' ], + knownPaths : [{ + text : 'Install', + image : 'desktop.png', + path : '/install' + }], + imageUrl : 'images/', + systemImageUrl : 'images/', + handlerUrl : 'lib/getpath.php', + title : 'Browse', + requestMethod : 'POST', + width : '500', + height : '300', + basePath : '/install' // Limit user to only install directory + }); + break; + case 'otherpkgdir': + input.serverBrowser({ + onSelect : function(path) { + $('#otherpkgdir').val(path); + }, + onLoad : function() { + return $('#otherpkgdir').val(); + }, + knownExt : [ 'exe', 'js', 'txt' ], + knownPaths : [{ + text : 'Install', + image : 'desktop.png', + path : '/install' + }], + imageUrl : 'images/', + systemImageUrl : 'images/', + handlerUrl : 'lib/getpath.php', + title : 'Browse', + requestMethod : 'POST', + width : '500', + height : '300', + basePath : '/install' // Limit user to only install directory + }); + break; + case 'pkglist': + input.serverBrowser({ + onSelect : function(path) { + $('#pkglist').val(path); + }, + onLoad : function() { + return $('#pkglist').val(); + }, + knownExt : [ 'exe', 'js', 'txt' ], + knownPaths : [{ + text : 'Install', + image : 'desktop.png', + path : '/install' + }], + imageUrl : 'images/', + systemImageUrl : 'images/', + handlerUrl : 'lib/getpath.php', + title : 'Browse', + requestMethod : 'POST', + width : '500', + height : '300', + basePath : '/opt/xcat/share' // Limit user to only install directory + }); + break; + case 'otherpkglist': + input.serverBrowser({ + onSelect : function(path) { + $('#otherpkglist').val(path); + }, + onLoad : function() { + return $('#otherpkglist').val(); + }, + knownExt : [ 'exe', 'js', 'txt' ], + knownPaths : [{ + text : 'Install', + image : 'desktop.png', + path : '/install' + }], + imageUrl : 'images/', + systemImageUrl : 'images/', + handlerUrl : 'lib/getpath.php', + title : 'Browse', + requestMethod : 'POST', + width : '500', + height : '300', + basePath : '/install' // Limit user to only install directory + }); + break; + case 'template': + input.serverBrowser({ + onSelect : function(path) { + $('#template').val(path); + }, + onLoad : function() { + return $('#template').val(); + }, + knownExt : [ 'exe', 'js', 'txt' ], + knownPaths : [{ + text : 'Install', + image : 'desktop.png', + path : '/install' + }], + imageUrl : 'images/', + systemImageUrl : 'images/', + handlerUrl : 'lib/getpath.php', + title : 'Browse', + requestMethod : 'POST', + width : '500', + height : '300', + basePath : '/opt/xcat/share' // Limit user to only install directory + }); + break; + default: + // Do nothing + } // Change border to blue onchange input.bind('change', function(event) { @@ -564,11 +690,11 @@ function loadEditImagePage(tgtImage) { } /** - * Load copy CDs page + * Load copy CD page * * @return Nothing */ -function loadCopyLinuxPage() { +function loadCopyCdPage() { // Get provision tab var tab = getProvisionTab();