Maybe i'am offtopic but it's a big problem for my users and me.
I'am using an Plugin to create Tables. The Plugin (RichTable.php) works fine for me, but there is a big problem: links within the table are not shown as BackLinks to the corresponding page. If i save a page with this plugin, the links within the table are not stored as Links bt shown as.
What can i do to make it work? Did not find the code where the links are inserted or what i have to change to make the plugin work with BackLinks.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
I noticed a mess of commits in the plugins directory and think a casual glance at the notes may be your solution:
<i>added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...)</i>
Hence that would explain why it may fail since InterWikiSearch was borked.
Solution? Update to CVS version if you need it fixed now (at high risk!) or wait for 1.3.8 (Moderate risk)
-Elec
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The new InlineParser.php stops execution of RichTable.php. Only a part of the page is shown now.
Is there an other table plugin which i can use?
OldStylePlugin is borring for my use and hasn't enough features. RichTable.php with PhpWiki 1.3.4 has the ability to nest other plugins and color change and ....
But with higher Versions of PhpWiki the plugin did'nt show links as links and so i have changed it from TransformText to TransFormInline but i did not really know what i'am doing :-( so the links now work (with no BackLinks) and the nested plugins did'nt function anymore.
It's really sad. There are so much documents to change and the users use this new plugin very much.
Thank you
Stefan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have changed the code to the code for the 1.3.4 Version. Now i think to know where the problem is.
function LinkBracketLink($bracketlink) { ...
now in InlineParser.php (Wiki 1.3.7)
before in stdlib.php (Wiki 1.3.4)
Can't find this code again in the function from 1.3.7
$wikipage = new WikiPageName($request, $link);
if ($wikipage->exists()) {
return WikiLink($wikipage, 'known', $label);
}
elseif (preg_match("#^($AllowedProtocols):#", $link)) { ...
Seems for me that the class
Cached_WikiLink extends Cached_Link { ....
in CachedMarkup.php
has something todo with the problem ... The Link name without brackets is sent to the class and only "Object" ist returned.
but i do not understand the code really it's only try and error what a mess ....
Regards again
Stefan
Here is the old code seems to work a little bit better
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Hallo,
Maybe i'am offtopic but it's a big problem for my users and me.
I'am using an Plugin to create Tables. The Plugin (RichTable.php) works fine for me, but there is a big problem: links within the table are not shown as BackLinks to the corresponding page. If i save a page with this plugin, the links within the table are not stored as Links bt shown as.
What can i do to make it work? Did not find the code where the links are inserted or what i have to change to make the plugin work with BackLinks.
PhpWiki 1.3.7
Here is an Example Page to test:
http://www.mineralienatlas.de/phpwiki/index.php/BugReportPage
Here is the plugin code:
<?php
/*
RichTablePlugin
A PhpWiki plugin that allows insertion of tables using a richer syntax
http://www.it.iitb.ac.in/~sameerds/phpwiki/index.php/RichTablePlugin
Copyright (C) 2003 Sameer D. Sahasrabuddhe
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
rcs_id('$Id: RichTable.php,v 1.7 2003/10/21 06:42:48 sameerds Exp sameerds $');
include_once('lib/BlockParser.php');
error_reporting (E_ALL & ~E_NOTICE);
class WikiPlugin_RichTable
extends WikiPlugin
{
function getName() {
return _("RichTable");
}
function getDescription() {
return _("Layout tables using a very rich markup style.");
}
function getDefaultArguments() {
return array();
}
function getVersion() {
return preg_replace("/[Revision: $]/", '',
"\$Revision: 1.7 $");
}
function run($dbi, $argstr, $request, $basepage) {
global $Theme;
// Eingefuegt von Stefan Schorn
include_once('lib/InlineParser.php');
$lines = preg_split('/\n/', $argstr);
$table = HTML::table();
if ($lines[0][0] == '*') {
$line = substr(array_shift($lines),1);
$attrs = $this->_parse_attr($line);
foreach ($attrs as $key => $value) {
if (in_array ($key, array("id", "class", "title", "style",
"bgcolor", "frame", "rules", "border",
"cellspacing", "cellpadding",
"summary", "align", "width"))) {
$table->setAttr($key, $value);
}
}
}
foreach ($lines as $line){
if ($line[0] == "-") {
if (isset($row)) {
if (isset($cell)) {
if (isset($content)) {
$content = TransformInline($content, 2.0, $basepage);
$cell->pushContent($content);
unset($content);
}
$row->pushContent($cell);
unset($cell);
}
$table->pushContent($row);
}
$row = HTML::tr();
$attrs = $this->_parse_attr(substr($line,1));
foreach ($attrs as $key => $value) {
if (in_array ($key, array("id", "class", "title", "style",
"bgcolor", "align", "valign"))) {
$row->setAttr($key, $value);
}
}
continue;
}
if ($line[0] == "|" and isset($row)) {
if (isset($cell)) {
if (isset ($content)) {
$content = TransformInline($content, 2.0, $basepage);
$cell->pushContent($content);
unset($content);
}
$row->pushContent($cell);
}
$cell = HTML::td();
$line = substr($line, 1);
if ($line[0] == "*" ) {
$attrs = $this->_parse_attr(substr($line,1));
foreach ($attrs as $key => $value) {
if (in_array ($key, array("id", "class", "title", "style",
"colspan", "rowspan", "width", "height",
"bgcolor", "align", "valign"))) {
$cell->setAttr($key, $value);
}
}
continue;
}
}
if (isset($row) and isset($cell)) {
$line = str_replace("?\>", "?>", $line);
$line = str_replace("\~", "~", $line);
$content .= $line . "\n";
}
}
if (isset($row)) {
if (isset($cell)) {
if (isset($content))
$content = TransformInline($content, 2.0, $basepage);
$cell->pushContent($content);
$row->pushContent($cell);
}
$table->pushContent($row);
}
return $table;
}
function _parse_attr($line) {
$attr_chunks = preg_split("/\s*,\s*/", strtolower($line));
foreach ($attr_chunks as $attr_pair) {
$key_val = preg_split("/\s*=\s*/", $attr_pair);
$options[trim($key_val[0])] = trim($key_val[1]);
}
return $options;
}
};
?>
I noticed a mess of commits in the plugins directory and think a casual glance at the notes may be your solution:
<i>added missing 4th basepage arg at plugin->run() to almost all plugins. This caused no harm so far, because it was silently dropped on normal usage. However on plugin internal ->run invocations it failed. (InterWikiSearch, IncludeSiteMap, ...)</i>
Hence that would explain why it may fail since InterWikiSearch was borked.
Solution? Update to CVS version if you need it fixed now (at high risk!) or wait for 1.3.8 (Moderate risk)
-Elec
The new InlineParser.php stops execution of RichTable.php. Only a part of the page is shown now.
Is there an other table plugin which i can use?
OldStylePlugin is borring for my use and hasn't enough features. RichTable.php with PhpWiki 1.3.4 has the ability to nest other plugins and color change and ....
But with higher Versions of PhpWiki the plugin did'nt show links as links and so i have changed it from TransformText to TransFormInline but i did not really know what i'am doing :-( so the links now work (with no BackLinks) and the nested plugins did'nt function anymore.
It's really sad. There are so much documents to change and the users use this new plugin very much.
Thank you
Stefan
I'll look into this soon, but after the 1.3.8 release :(
I have changed the code to the code for the 1.3.4 Version. Now i think to know where the problem is.
function LinkBracketLink($bracketlink) { ...
now in InlineParser.php (Wiki 1.3.7)
before in stdlib.php (Wiki 1.3.4)
Can't find this code again in the function from 1.3.7
$wikipage = new WikiPageName($request, $link);
if ($wikipage->exists()) {
return WikiLink($wikipage, 'known', $label);
}
elseif (preg_match("#^($AllowedProtocols):#", $link)) { ...
Seems for me that the class
Cached_WikiLink extends Cached_Link { ....
in CachedMarkup.php
has something todo with the problem ... The Link name without brackets is sent to the class and only "Object" ist returned.
but i do not understand the code really it's only try and error what a mess ....
Regards again
Stefan
Here is the old code seems to work a little bit better
<?php
/*
RichTablePlugin
A PhpWiki plugin that allows insertion of tables using a richer syntax
http://www.it.iitb.ac.in/~sameerds/phpwiki/index.php/RichTablePlugin
Copyright (C) 2003 Sameer D. Sahasrabuddhe
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
rcs_id('$Id: RichTable.php,v 1.7 2003/10/21 06:42:48 sameerds Exp sameerds $');
include_once('lib/BlockParser.php');
error_reporting (E_ALL & ~E_NOTICE);
class WikiPlugin_RichTable
extends WikiPlugin
{
function getName() {
return _("RichTable");
}
function getDescription() {
return _("Layout tables using a very rich markup style.");
}
function getDefaultArguments() {
return array();
}
function getVersion() {
return preg_replace("/[Revision: $]/", '',
"\$Revision: 1.7 $");
}
function run($dbi, $argstr, $request, $basepage) {
global $Theme;
// Eingefuegt von Stefan Schorn
include_once('lib/InlineParser.php');
$lines = preg_split('/\n/', $argstr);
$table = HTML::table();
if ($lines[0][0] == '*') {
$line = substr(array_shift($lines),1);
$attrs = $this->_parse_attr($line);
foreach ($attrs as $key => $value) {
if (in_array ($key, array("id", "class", "title", "style",
"bgcolor", "frame", "rules", "border",
"cellspacing", "cellpadding",
"summary", "align", "width"))) {
$table->setAttr($key, $value);
}
}
}
foreach ($lines as $line){
if ($line[0] == "-") {
if (isset($row)) {
if (isset($cell)) {
if (isset($content)) {
// $content = TransformInline($content, 2.0, $basepage);
// $cell->pushContent($content);
include_once('lib/BlockParser.php');
$cell->pushContent(TransformText($content));
unset($content);
}
$row->pushContent($cell);
unset($cell);
}
$table->pushContent($row);
}
$row = HTML::tr();
$attrs = $this->_parse_attr(substr($line,1));
foreach ($attrs as $key => $value) {
if (in_array ($key, array("id", "class", "title", "style",
"bgcolor", "align", "valign"))) {
$row->setAttr($key, $value);
}
}
continue;
}
if ($line[0] == "|" and isset($row)) {
if (isset($cell)) {
if (isset ($content)) {
// gendert von Stefan Schorn wegen fehlernder Linkanzeige
include_once('lib/BlockParser.php');
$cell->pushContent(TransformText($content));
// $content = TransformInline($content, 2.0, $basepage);
// $cell->pushContent($content);
unset($content);
}
$row->pushContent($cell);
}
$cell = HTML::td();
$line = substr($line, 1);
if ($line[0] == "*" ) {
$attrs = $this->_parse_attr(substr($line,1));
foreach ($attrs as $key => $value) {
if (in_array ($key, array("id", "class", "title", "style",
"colspan", "rowspan", "width", "height",
"bgcolor", "align", "valign"))) {
$cell->setAttr($key, $value);
}
}
continue;
}
}
if (isset($row) and isset($cell)) {
$line = str_replace("?\>", "?>", $line);
$line = str_replace("\~", "~", $line);
$content .= $line . "\n";
}
}
if (isset($row)) {
if (isset($cell)) {
if (isset($content))
// gendert von Stefan Schorn wegen fehlernder Linkanzeige
include_once('lib/BlockParser.php');
$cell->pushContent(TransformText($content));
$row->pushContent($cell);
// $content = TransformInline($content, 2.0, $basepage);
// $cell->pushContent($content);
// unset($content);
}
$table->pushContent($row);
}
return $table;
}
function _parse_attr($line) {
$attr_chunks = preg_split("/\s*,\s*/", strtolower($line));
foreach ($attr_chunks as $attr_pair) {
$key_val = preg_split("/\s*=\s*/", $attr_pair);
$options[trim($key_val[0])] = trim($key_val[1]);
}
return $options;
}
};
?>