semediawiki-devel

Hi there -
A strange problem is cropping up when I use v 0.5, or even the latest
version from SVN. When I try to edit a page on my site, the header
line for the factbox appears multiple times (six times, in fact).
You can see the problem here:
http://discoursedb.org/w/index.php?title=Hammerin%27_Hank&action=edit
This issue is resolved if I change the settings so that the factbox is
never displayed, but that is just a workaround.
I don't think this issue has been raised in the email lists or the bug
tracker - my apologies if I've missed it.
Any ideas what is going on?
Thanks,
Nick

Nick Grandy wrote:
> Hi there -
>
> A strange problem is cropping up when I use v 0.5, or even the latest
> version from SVN. When I try to edit a page on my site, the header
> line for the factbox appears multiple times (six times, in fact).
> You can see the problem here:
> http://discoursedb.org/w/index.php?title=Hammerin%27_Hank&action=edit
>
I see it five times, but you shouldn't see it at all in editing.
> Any ideas what is going on?
>
I recall seeing factbox bits while editing a while ago.
SMWSemanticData->printFactBox() prints the factbox header, and is only
called from smwfParserHook().
I put some debugging echo statements in smwfParserHook(), and on my
installation it really is called **six times** while editing and seven
times while previewing and first displaying! (I haven't made the change
for "Enabling support for templates".) We're lucky to have gigahertz
processors :-)
I filed bug 1556698 on SourceForge that smwfParserHook() should somehow
test and return early. I lack hooker experience to fix it properly.
Anyway, printFactbox() outputs nothing in my installation because its
test for SMW facts
$boxSize = count(SMWSemanticData::$attribArray) +
count(SMWSemanticData::$relArray) + count(SMWSemanticData::$specaArray)
+ count(SMWSemanticData::$specrArray);
is 0 in all six invocation while editing. I guess somehow in your
installation, one of those arrays is non-empty so printFactbox() prints
the factbox header; and then the methods that print relations,
attributes and special properties print nothing.
Could you make a backup of SMW_SemanticData.php, then add the following
to printFactbox() in SMW_SemanticData.php, after it computes boxSize and
before it checks it?
echo "in SMWSemanticData->printFactbox, boxSize=$boxSize<br />\n";
if ($boxSize != 0) {
echo "DEBUG in SMWSemanticData->printFactbox...<br />\n";
echo 'attribArray: ';
debug_zval_dump(SMWSemanticData::$attribArray);
echo 'relArray: '; debug_zval_dump(SMWSemanticData::$relArray);
echo 'specaArray: '; debug_zval_dump(SMWSemanticData::$specaArray);
echo 'specrArray: '; debug_zval_dump(SMWSemanticData::$specrArray);
echo "<br /><br />\n";
}
--
=S

S Page noted:
> I put some debugging echo statements in smwfParserHook(), and on my
> installation it really is called **six times** while editing and seven
> times while previewing and first displaying!
MediaWiki calls smwfParserHook() for several pieces of text:
"This is a minor edit"
"Watch this page"
"Cancel"
"This is only a preview..."
[The actual wiki page text] <== only this matters!?
"Please note that all contributions..." copyright warning
<!-- Text here will be shown below edit and upload forms. -->
I don't see an easy way to determine what text is being parsed in
smwfParserHook(), even with its full access to MediaWiki's Parser object.
--
=S

Nick Grandy wrote:
> When I try to edit a page on my site, the header
> line for the factbox appears multiple times (six times, in fact).
>
> This issue is resolved if I change the settings so that the factbox is
> never displayed, but that is just a workaround.
>
Did you set $smwgShowFactbox in SMW_Settings.php to SMW_FACTBOX_SHOWN ?
That makes printFactbox() always print the header, and so you'll see one
for all the multiple invocations of smwfParseHook().
If so, change it back to SMW_FACTBOX_NONEMPTY. And don't bother with
the debug code I sent you.
--
=S

Hi -
Thanks for the rapid response! Yes, I have $smwgShowFactbox =
SMW_FACTBOX_SHOWN . Changing back to SMW_FACTBOX_NONEMPTY resolves
the problem, and works fine for now. It sounds like the bug report
you filed is still a necessary fix though, in case anybody really
wants the factbox always shown on the article page.
yes, good thing we have fast processors. It does seem a little
strange that the factbox code is executed so often when the page is
being rendered for editing - but I understand the SMW code is hooking
into the mediawiki base and there might not be a lot of flexibility in
how it's done.
I am actually planning to work on a javascript collapsible /
expandable factbox, as mentioned previously on the list. I'll send a
separate email about the proposed design.
Thanks!
Nick
On 9/12/06, S Page <skierpage@...> wrote:
> Nick Grandy wrote:
> > When I try to edit a page on my site, the header
> > line for the factbox appears multiple times (six times, in fact).
> >
> > This issue is resolved if I change the settings so that the factbox is
> > never displayed, but that is just a workaround.
> >
> Did you set $smwgShowFactbox in SMW_Settings.php to SMW_FACTBOX_SHOWN ?
> That makes printFactbox() always print the header, and so you'll see one
> for all the multiple invocations of smwfParseHook().
>
> If so, change it back to SMW_FACTBOX_NONEMPTY. And don't bother with
> the debug code I sent you.
>
> --
> =S
>
--
Nick Grandy
mobile: (+44) 07973 601 114

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details