logo       

CVS: phpwiki/lib Theme.php,1.122,1.123: msg#00142

web.wiki.phpwiki.checkins

Subject: CVS: phpwiki/lib Theme.php,1.122,1.123

Update of /cvsroot/phpwiki/phpwiki/lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30104/lib

Modified Files:
Theme.php
Log Message:
change addMoreAttr() to support named attr, to remove DoubleClickEdit for
htmldumps

Index: Theme.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/Theme.php,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -2 -b -p -d -r1.122 -r1.123
--- Theme.php 21 Jan 2005 11:51:22 -0000 1.122
+++ Theme.php 25 Jan 2005 07:03:02 -0000 1.123
@@ -1094,25 +1094,27 @@ class Theme {

var $_MoreAttr = array();
- function addMoreAttr ($id, $element) {
+ // new arg: named elements to be able to remove them. such as
DoubleClickEdit for htmldumps
+ function addMoreAttr ($tag, $name, $element) {
// protect from duplicate attr (body jscript: themes, prefs, ...)
static $_attr_cache = array();
- $hash = md5($id."/".$element);
+ $hash = md5($tag."/".$element);
if (!empty($_attr_cache[$hash])) return;
$_attr_cache[$hash] = 1;

- if (empty($this->_MoreAttr) or !is_array($this->_MoreAttr[$id]))
- $this->_MoreAttr[$id] = array($element);
+ if (empty($this->_MoreAttr) or !is_array($this->_MoreAttr[$tag]))
+ $this->_MoreAttr[$tag] = array($name => $element);
else
- array_push($this->_MoreAttr[$id],$element);
+ $this->_MoreAttr[$tag][$name] = $element;
}
- function getMoreAttr ($id) {
- if (empty($this->_MoreAttr[$id]))
+
+ function getMoreAttr ($tag) {
+ if (empty($this->_MoreAttr[$tag]))
return '';
$out = '';
- foreach ($this->_MoreAttr[$id] as $h) {
- if (is_object($h))
- $out .= printXML($h);
+ foreach ($this->_MoreAttr[$tag] as $name => $element) {
+ if (is_object($element))
+ $out .= printXML($element);
else
- $out .= "$h";
+ $out .= "$element";
}
return $out;
@@ -1152,5 +1154,6 @@ class Theme {
// define ENABLE_DOUBLECLICKEDIT
function initDoubleClickEdit() {
- $this->addMoreAttr('body', HTML::Raw(" ondblclick=\"url =
document.URL; url2 = url; if (url.indexOf('?') != -1) url2 = url.slice(0,
url.indexOf('?')); if ((url.indexOf('action') == -1) ||
(url.indexOf('action=browse') != -1)) document.location = url2 +
'?action=edit';\""));
+ if (!$this->HTML_DUMP_SUFFIX)
+ $this->addMoreAttr('body', 'DoubleClickEdit', HTML::Raw("
ondblclick=\"url = document.URL; url2 = url; if (url.indexOf('?') != -1) url2 =
url.slice(0, url.indexOf('?')); if ((url.indexOf('action') == -1) ||
(url.indexOf('action=browse') != -1)) document.location = url2 +
'?action=edit';\""));
}
};
@@ -1399,4 +1402,7 @@ function listAvailableLanguages() {

// $Log$
+// Revision 1.123 2005/01/25 07:03:02 rurban
+// change addMoreAttr() to support named attr, to remove DoubleClickEdit for
htmldumps
+//
// Revision 1.122 2005/01/21 11:51:22 rurban
// changed (c)



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise