Wiki Bug Fix

Somebody needs to fix the vassalengine.org/wiki/Template:ModuleFile. No matter what you enter for the “size” field, it always shows “0”. I can’t believe someone hasn’t at least tried to fix this before.

Here is the current code:

|- | [[media:{{{filename}}}|{{{filename}}}]] | {{{description|}}} | class="module_file_size" | {{PAGESIZE:{{{filename}}}}} | class="module_file_date" | {{{date|}}} | class="module_file_compat" | {{{compatibility|unknown}}}

I don’t know much about wiki template coding, so I didn’t want to make a change that would mess everything up, but here is my suggested code:

|- | [[media:{{{filename}}}|{{{filename}}}]] | {{{description|}}} | class="module_file_size" | {{{filename|}}} | class="module_file_date" | {{{date|}}} | class="module_file_compat" | {{{compatibility|unknown}}}

Is there a way to test this and see if it would work? It can’t get any worse than it is now. If this won’t work, please leave some suggestions. This seems like it should work, since it would act the same way as the date entry. In my opinion, the code that is causing this problem is: {{PAGESIZE:{{{filename}}}}}

BTW, if it’s just my computer, please let me know. :stuck_out_tongue:

Thus spake IanSan5653:

Somebody needs to fix the
vassalengine.org/wiki/Template:ModuleFile[1]. No matter what
you enter for the “size” field, it always shows “0”. I can’t believe
someone hasn’t at least tried to fix this before.

This is Bug 2928:

vassalengine.org/tracker/sho … gi?id=2928

I think what your change will do is print the filename again in the
size column if no size is explicitly given. This is wrong, because
you’re not supposed to enter anything for the size field—it’s intended
to be filled in automatically from the actual size of the file.

If you see a way to do this, we’d happily fix it.


J.

I know nothing about Mediawiki, so I apologize if this is naive, but it looked promising at a very casual glance:
mediawiki.org/wiki/Extension:MediaFunctions

So if it’s supposed to be automatic, then why is there a place to enter the size in the template available at vassalengine.org/wiki/How_to … odule_Page?

Here is that code:

== Files ==
{{ModuleFilesTable}}
{{ModuleVersion|version=}}
{{ModuleFile|filename=|description=|date=|size=|compatibility=}}
|}

I mean, obviously the automatic part isn’t working, so let’s make it manual.

The code I gave above uses the same format as the date function. If I don’t enter a date, then it doesn’t show the filename again. Why would it with this? I’m not very advanced with wiki coding, but the general idea is similar to other codes. Please explain to me why this wouldn’t work, that might help.

Also, is there anything you do with mediawiki.org/wiki/Extension:MediaFunctions? It does look promising, but I have no idea.

In the meantime, I will copy the code and make a test template/page.

NOTE: There was a mistake in my code, I had meant to say size|, not filename|. Sorry about that. Please sisregard what I had said about that in my last post.

Here is the code I meant to do:

|- | [[media:{{{filename}}}|{{{filename}}}]] | {{{description|}}} | class="module_file_size" | {{{size|}}} | class="module_file_date" | {{{date|}}} | class="module_file_compat" | {{{compatibility|unknown}}}

I created a test page here: vassalengine.org/wiki/Test:M … le_Bug_Fix

And a test template here: vassalengine.org/wiki/Templa … ModuleFile

The template is already implemented on the page; I will tell you if I come up with a solution.

Alright, so I used the code above, and it worked. As long as you don’t mind manually entering the file size, this should work fine. Please see the test page.

Do you think I should change the template? I don’t want to if that isn’t correct.

No - please don’t. I would rather have this fixed with a script or the plug in
that has been brought up and implement that instead


From: IanSan5653 iansan5653+vassal@gmail.com
To: messages@vassalengine.org
Sent: Thu, February 2, 2012 9:59:26 AM
Subject: [messages] [Module General Discussion] Re: Wiki Bug Fix

Do you think I should change the template? I don’t want to if that isn’t
correct.


Read this topic online here:
https://forum.vassalengine.org/t/wiki-bug-fix/4650/7

This should work perfectly - we can alter the template and set the module file size class to look at the media filename in its row

Thus spake irishwulf:

I know nothing about Mediawiki, so I apologize if this is naive, but it
looked promising at a very casual glance:
mediawiki.org/wiki/Extension:MediaFunctions[1]

I didn’t know that existed. It looks like what we need. Thanks!


J.

Did you take a look at the test pages I made? By all means, try and implement those codes. I’d love to see it work. :smiley:

Again, not very advanced, but isn’t this the basic code that we would need? It will show the file size if entered (before the |) and calculate it if it wasn’t (after the |).

We would still need to get that plugin.

|-
| [[media:{{{filename}}}|{{{filename}}}]]
| {{{description|}}}
| class="module_file_size" | {{{size|{{#mediasize:Image:filename}}}}}
| class="module_file_date" | {{{date|}}}
| class="module_file_compat" | {{{compatibility|unknown}}}

I have no idea if it really would do that, but it seems like it would since it follows the same syntax as the compatibility entry. I’m sure that the size code I entered is wrong, though, because the file isn’t an image. I have no idea how that works. Please correct my coding.

Thus spake IanSan5653:

Did you take a look at the test pages I made? By all means, try and
implement those codes. I’d love to see it work. :smiley:

I’ll see about installing the MediaFunctions extension tomorrow. It’s
too late for me to start doing any sysadminning tonight.


J.

Cool, that sounds great. Please let me know how it goes. :smiley:

Thus spake irishwulf:

I know nothing about Mediawiki, so I apologize if this is naive, but it
looked promising at a very casual glance:
mediawiki.org/wiki/Extension:MediaFunctions[1]

[1] mediawiki.org/wiki/Extension:MediaFunctions

It’s installed, and appears to be working.


J.

Yes, it’s working great! Sorry it took me so long to reply, I didn’t see your post.

I just saw that this worked. Great job! :smiley: