ioguix <ioguix@free.fr>.
/**
* Class to hold various commonly used functions
*
- * $Id: Misc.php,v 1.130 2006/06/17 21:50:06 xzilla Exp $
+ * $Id: Misc.php,v 1.131 2006/06/23 00:57:37 xzilla Exp $
*/
class Misc {
* 'openIcon' - an alternative icon when the node is expanded
* 'toolTip' - tool tip text for the node
* 'action' - URL to visit when single clicking the node
+ * 'iconAction' - URL to visit when single clicking the icon node
* 'branch' - URL for child nodes (tree XML)
* 'expand' - the action to return XML for the subtree
* 'nodata' - message to display when node has no children
$icon = $this->icon(value($attrs['icon'], $rec));
echo value_xml_attr('icon', $icon, $rec);
+ echo value_xml_attr('iconAction', $attrs['iconAction'], $rec);
if (!empty($attrs['openIcon'])) {
$icon = $this->icon(value($attrs['openIcon'], $rec));
/**
* List tables in a database
*
- * $Id: tables.php,v 1.78 2006/06/21 18:02:51 xzilla Exp $
+ * $Id: tables.php,v 1.79 2006/06/23 00:57:37 xzilla Exp $
*/
// Include application functions
$attrs = array(
'text' => field('relname'),
'icon' => 'Table',
+ 'iconAction' => url('display.php',
+ $reqvars,
+ array('table' => field('relname'))
+ ),
'toolTip'=> field('relcomment'),
'action' => url('redirect.php',
$reqvars,
/**
* Manage views in a database
*
- * $Id: views.php,v 1.56 2006/06/17 12:57:37 xzilla Exp $
+ * $Id: views.php,v 1.57 2006/06/23 00:57:37 xzilla Exp $
*/
// Include application functions
$attrs = array(
'text' => field('relname'),
'icon' => 'View',
+ 'iconAction' => url('display.php',
+ $reqvars,
+ array('view' => field('relname'))
+ ),
'toolTip'=> field('relcomment'),
'action' => url('redirect.php',
$reqvars,
|-----------------------------------------------------------------------------|\r
| Created 2003-??-?? | All changes are in the log above. | Updated 2004-06-06 |\r
\----------------------------------------------------------------------------*/\r
-\r
+| Note local changes have been made to allow Icons to have different links |\r
+| than thier text label counterparts. Thanks to JGuillaume de Rorthais |\r
+|-----------------------------------------------------------------------------|\r
\r
webFXTreeConfig.loadingText = "Loading...";\r
webFXTreeConfig.loadingIcon = "images/loading.gif";\r
webFXTreeConfig.reloadText = "Click to reload";\r
\r
\r
-function WebFXLoadTree(sText, sXmlSrc, oAction, sBehavior, sIcon, sOpenIcon) {\r
- WebFXTree.call(this, sText, oAction, sBehavior, sIcon, sOpenIcon);\r
+function WebFXLoadTree(sText, sXmlSrc, oAction, sBehavior, sIcon, oIconAction, sOpenIcon) {\r
+ WebFXTree.call(this, sText, oAction, sBehavior, sIcon, oIconAction, sOpenIcon);\r
\r
// setup default property values\r
this.src = sXmlSrc;\r
}\r
};\r
\r
-function WebFXLoadTreeItem(sText, sXmlSrc, oAction, eParent, sIcon, sOpenIcon) {\r
- WebFXTreeItem.call(this, sText, oAction, eParent, sIcon, sOpenIcon);\r
+function WebFXLoadTreeItem(sText, sXmlSrc, oAction, eParent, sIcon, oIconAction, sOpenIcon) {\r
+ WebFXTreeItem.call(this, sText, oAction, eParent, sIcon, oIconAction, sOpenIcon);\r
\r
// setup default property values\r
this.src = sXmlSrc;\r
action = jsAttrs.action;\r
}\r
var jsNode = new WebFXLoadTreeItem(jsAttrs.html || "", jsAttrs.src, action,\r
- null, jsAttrs.icon, jsAttrs.openIcon);\r
+ null, jsAttrs.icon, jsAttrs.iconAction, jsAttrs.openIcon);\r
if (jsAttrs.text) {\r
jsNode.setText(jsAttrs.text);\r
}\r
// WebFXTreeAbstractNode
///////////////////////////////////////////////////////////////////////////////
-function WebFXTreeAbstractNode(sText, oAction) {
+function WebFXTreeAbstractNode(sText, oAction, oIconAction) {
this.childNodes = [];
if (sText) this.text = sText;
if (oAction) this.action = oAction;
+ if (oIconAction) this.iconAction = oIconAction;
this.id = webFXTreeHandler.getUniqueId();
if (webFXTreeConfig.usePersistence) {
this.open = webFXTreeHandler.persistenceManager.getExpanded(this);
_p.open = false;
_p.text = webFXTreeConfig.defaultText;
_p.action = null;
+_p.iconAcion = null;
_p.target = null;
_p.toolTip = null;
_p._focused = false;
return "#";
};
+_p._getIconHref = function () {
+ if (typeof this.iconAction == "string")
+ return this.iconAction;
+ else
+ return this._getHref();
+}
+
_p.getEventHandlersHtml = function () {
return "";
};
_p.getIconHtml = function () {
// here we are not using textToHtml since the file names rarerly contains
// HTML...
- return "<img class=\"webfx-tree-icon\" src=\"" + this.getIconSrc() + "\">";
+ return "<a href=\"" + webFXTreeHandler.textToHtml(this._getIconHref()) +
+ "\"><img class=\"webfx-tree-icon\" src=\"" + this.getIconSrc() + "\"></a>";
};
_p.getIconSrc = function () {
return this.action;
};
+_p.setIconAction = function (oAction) {
+ this.iconAction = oAction;
+ var el = this.getIconElement();
+ if (el) {
+ el.href = this._getIconHref();
+ }
+}
+
+_p.getIconAction = function () {
+ if (this.iconAction)
+ return this.iconAction;
+ return _p.getAction();
+};
+
// update methods
_p.update = function () {
return false;
}
- if (typeof this.action == "function") {
- this.action();
- } else if (this.action != null) {
- window.open(this.action, this.target || "_self");
+ var doAction = null;
+ if (/webfx-tree-icon/.test(el.className) && this.iconAction) {
+ doAction = this.iconAction;
+ } else {
+ doAction = this.action;
+ }
+
+ if (typeof doAction == "function") {
+ doAction();
+ } else if (doAction != null) {
+ window.open(doAction, this.target || "_self");
}
return false;
};
// WebFXTree
///////////////////////////////////////////////////////////////////////////////
-function WebFXTree(sText, oAction, sBehavior, sIcon, sOpenIcon) {
- WebFXTreeAbstractNode.call(this, sText, oAction);
+function WebFXTree(sText, oAction, sBehavior, sIcon, oIconAction, sOpenIcon) {
+ WebFXTreeAbstractNode.call(this, sText, oAction, oIconAction);
if (sIcon) this.icon = sIcon;
if (sOpenIcon) this.openIcon = sOpenIcon;
if (sBehavior) this.behavior = sBehavior;
// WebFXTreeItem
///////////////////////////////////////////////////////////////////////////////
-function WebFXTreeItem(sText, oAction, eParent, sIcon, sOpenIcon) {
- WebFXTreeAbstractNode.call(this, sText, oAction);
+function WebFXTreeItem(sText, oAction, eParent, sIcon, oIconAction, sOpenIcon) {
+ WebFXTreeAbstractNode.call(this, sText, oAction, oIconAction);
if (sIcon) this.icon = sIcon;
if (sOpenIcon) this.openIcon = sOpenIcon;
if (eParent) eParent.add(this);