PDA

View Full Version : adding panel to buttons



SAP
24 Feb 2011, 9:08 PM
I am trying to add panel to buttons. but everytime I do so I get error.list of buttons are show,delete,renew and install



var docCertList;
Application.ManageCertificatesForm = Ext.extend(Ext.form.FormPanel, {
border: false,
initComponent: function () {
var xmlCertData = '<dataset>' + '<row>' + '<id>1</id>' + '<name>Anand27</name>' + '<type>SelfSigned</type>' + '</row>' +
'<row>' + '<id>2</id>' + '<name>Final30</name>' + '<type>Pending</type>' + '</row>' +
'</dataset>';
if (window.ActiveXObject) {
docCertList = new ActiveXObject("MSXML.DOMDocument");
docCertList.async = "false";
docCertList.loadXML(xmlCertData);
} else {
docCertList = new DOMParser().parseFromString(xmlCertData, "text/xml");
}
var storeList = new Ext.data.Store({
autoDestroy: false,
data: docCertList,
reader: new Ext.data.XmlReader({
record: 'row',
fields: [{
name: 'id',
type: 'number'
}, {
name: 'name',
type: 'string'
}]
})
});
var colModel = new Ext.grid.ColumnModel([{
sortable: true,
dataIndex: 'name'
}]);
var config = {
layout: 'form',
url: '../jnAdvCertMgmt.htm<#SessionID>',
width: '100%',
bodyStyle: 'padding:25px',
defaults: {
width: 640
},
labelWidth: 70,
defaultType: 'textfield',
labelAlign: 'top',
errorReader: {
read: function (response) {
return {
records: [],
success: true
};
}
},

items: [{
xtype: 'label',
html: '<div class="gradientV"><font size="2" face="Arial"><b>Manage Certificates </b></font></div>'
,anchor:'99.8%'
}, {
xtype: 'fieldset',
title: 'Title Here',
anchor: '99.87%',
style: 'margin-bottom:-10;',
items: [{
xtype: 'combo',
fieldLabel: 'Select Certificate to manage',
store: storeList,
name: 'ACM_Certificate',
id: 'cmbCert',
width: 175,
height: 300,
forceSelection: true,
displayField: 'name',
valueField: 'name',
mode: 'local',
triggerAction: 'all',
value: ''
}, {
xtype: 'textarea',
fieldLabel: 'To install a certificate paste certificate text below & click Install',
displayField: 'Protocol2',
width: '400px',
height: '200px',
flex: 1,
name: 'ACM_CertificateText'
}, {
xtype: 'hidden',
id: 'ACM_CertRenewx',
disabled: true,
name: 'ACM_CertRenew.x',
value: '47'
}, {
xtype: 'hidden',
id: 'ACM_CertRenewy',
disabled: true,
name: 'ACM_CertRenew.y',
value: '12'
}, {
xtype: 'hidden',
id: 'ACM_CertShowx',
disabled: true,
name: 'ACM_CertShow.x',
value: '47'
}, {
xtype: 'hidden',
id: 'ACM_CertShowy',
disabled: true,
name: 'ACM_CertShow.y',
value: '12'
}, {
xtype: 'hidden',
id: 'ACM_CertDeletex',
disabled: true,
name: 'ACM_CertDelete.x',
value: '47'
}, {
xtype: 'hidden',
id: 'ACM_CertDeletey',
disabled: true,
name: 'ACM_CertDelete.y',
value: '12'
}, {
xtype: 'hidden',
id: 'ACM_CertInstallx',
disabled: true,
name: 'ACM_CertInstall.x',
value: '47'
}, {
xtype: 'hidden',
id: 'ACM_CertInstally',
disabled: true,
name: 'ACM_CertInstall.y',
value: '12'
}]
}], {
xtype: 'panel',
//title: 'Default Route',
anchor: '99.8%',
border:false,
items: [ {
buttonAlign: 'right',
buttons: [{
text: 'Renew',
formBind: true,
icon: 'images/addition/renew.png',
scope: this,
handler: Renew,
text: 'Renew',
width: 60,
//style: 'margin-left:75%;margin-top:15;',
cls: 'x-btn-left1'
}, {
text: 'Show',
xtype: 'button',
formBind: true,
scope: this,
handler: Show,
text: 'Show',
icon: 'images/addition/show.png',
// style: 'margin-left:81.5%;margin-top:-22;',
width: 60
}, {
text: 'Delete',
xtype: 'button',
formBind: true,
icon: 'images/addition/delete.png',
scope: this,
handler: Delete,
text: 'Delete',
//style: 'margin-left:88%;margin-top:-22;',
width: 60
//cls: 'x-btn-left1'
}, {
text: 'Install',
xtype: 'button',
formBind: true,
scope: this,
handler: Install,
text: 'Install',
icon: 'images/addition/install.png',
//style: 'margin-left:94.5%;margin-top:-22;',
style: 'margin-right:15;',
width: 60
//cls: 'x-btn-left2'
}]}]}


};

Ext.apply(this, Ext.apply(this.initialConfig, config));
Application.ManageCertificatesForm.superclass.initComponent.apply(this, arguments);
}
,
onRender: function () {
Application.ManageCertificatesForm.superclass.onRender.apply(this, arguments);
}
,
submit: function () {
this.getForm().submit({
standardSubmit: true,
url: this.url,
success: this.onSuccess,
failure: this.onFailure
});
}
,
onSuccess: function (form, action) {
Ext.MessageBox.alert("Success", "certificate has been renewed.");
}
,
onFailure: function (form, action) {
Ext.MessageBox.alert("Failure", "Form could not be Submitted.");
}
});

var sXmlData;
function Renew()
{
sXmlData = 'ACM_CertificateText=' + Ext.getCmp('cmbCert').el.dom.value + '&' +
'ACM_CertRenew.x=38&ACM_CertRenew.y=16';
Ext.Ajax.request({
method: 'POST',
xmlData: sXmlData,
url: "..//EXTJS//GetConfigureInfo.htm<#SessionID>",
success: function (response, options)
{
var result;
result = Ext.decode(response.responseText);
Ext.getCmp('statustext').getEl().update('<div id="status" align="center">' + result.StatusText + '</div>');
}
});
}
function Install() {
var sName = "'" + Ext.getCmp('cmbCert').getValue() + "'";
var sType;
var xpath = "/dataset/row[name=" + sName + "]";
if (window.ActiveXObject)
{
node = docCertList.selectSingleNode(xpath);
sType = node.childNodes[2].text;
}
else
{
var xpe = new XPathEvaluator();
var nsResolver = xpe.createNSResolver(doc.ownerDocument == null ? doc.documentElement : xmlDoc.ownerDocument.documentElement);
var results = xpe.evaluate(xpath, doc, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
node = results.singleNodeValue;
sType = node.childNodes[2].textContent;
}
sXmlData = 'ACM_CertificateText=' + sName + '&' +
'ACM_CertInstall.x=50&ACM_CertInstall.y=12';
Ext.Ajax.request({
method: 'POST',
xmlData: sXmlData,
url: "..//EXTJS//GetConfigureInfo.htm<#SessionID>",
success: function (response, options)
{
var result;
result = Ext.decode(response.responseText);
Ext.getCmp('statustext').getEl().update('<div id="Div1" align="center">' + result.StatusText + '</div>');
}
});
}
function Delete()
{
sXmlData = 'ACM_CertificateText=' + Ext.getCmp('cmbCert').el.dom.value + '&' +
'ACM_CertDelete.x=45&ACM_CertDelete.y=17';
Ext.Ajax.request({
method: 'POST',
xmlData: sXmlData,
url: "..//EXTJS//GetConfigureInfo.htm<#SessionID>",
success: function (response, options)
{
var result;
result = Ext.decode(response.responseText);
Ext.getCmp('statustext').getEl().update('<div id="Div2" align="center">' + result.StatusText + '</div>');
}
});
}
function Show()
{
sXmlData = 'ACM_CertificateText=' + Ext.getCmp('cmbCert').el.dom.value + '&' +
'ACM_CertShow.x=51&ACM_CertShow.y=10';
Ext.Ajax.request({
method: 'POST',
xmlData: sXmlData,
url: "..//EXTJS//GetConfigureInfo.htm<#SessionID>",
success: function (response, options)
{
var result;
result = Ext.decode(response.responseText);
Ext.getCmp('statustext').getEl().update('<div id="Div3" align="center">' + result.StatusText + '</div>');
}
});

window.open('https://' + window.location.host + '/config/jnAdvCertShow.htm<#SessionID>&CertRequest=' + Ext.getCmp('cmbCert').getValue(), null, "height=400,width=600,status=yes,toolbar=no,menubar=no,location=no");
}
function Installed() {
Ext.MessageBox.alert("JetNexus", "Certificate has been installed.");
}
function Deleted() {
Ext.MessageBox.alert("JetNexus", "Certificate has been deleted.");
}
Ext.reg('ManageCertificates', Application.ManageCertificatesForm);