Sep 30, 2010, 3:20 PM
[CLOSED] Add close (hide) tool button and event to Portlet
How do I add a close button and associated event to the following javascript?
function duplicatePortlet(e) {
// don't allow duplicates to create in originating portal
if ((e.panel.ownerCt.ownerCt.id == 'ContentPH_ptl1') || (e.panel.ownerCt.ownerCt.id == 'ContentPH_ptl2')) {
//if (e.panel.ownerCt.ownerCt.id.substring(0,9) == 'ContentPH') {
return true;
}
if (e.portal == e.panel.ownerCt.ownerCt) {
return true;
}
//create a new id for the duplicate
var q = parseInt(document.getElementById('ContentPH_hidHighPortletVar').value);
q++;
document.getElementById('ContentPH_hidHighPortletVar').value = q;
var newId = e.panel.id + 'QZ' + q.toString();
//create duplicate portlet
var id = newId,
imageTag = "<image src='" + e.panel.imageUrl + "'/>",
panel = Ext.ComponentMgr.create({ id: id, xtype: "portlet", title: id, html: imageTag }),
pos = e.position,
c = e.column,
portal = e.portal;
//drop portlet into new position
if (pos !== false) {
c.insert(pos, panel);
} else {
c.add(panel);
}
c.doLayout();
portal.fireEvent('drop', e);
var st = portal.dd.scrollPos.top;
if (st) {
var d = portal.body.dom;
setTimeout(function() {
d.scrollTop = st;
}, 10);
}
playsound('sounds/Blood_Hitting_Window.wav')
return false;
}
Last edited by Daniil; Oct 01, 2010 at 3:34 PM.
Reason: [CLOSED]