Tables in Wikka




Table markup
(copied from WikkaDevelopment --NilsLindenberg)

Richard Berg has provided code for very simple table code that could be placed in formatters/wakka.php. I think that one weakness that wikka has is the lack of support for any tables. Sure, I know people are thinking about syntax & extended features etc etc (I've contributed to that discussion) but I'd like to suggest that "simple" table support should be provided now if possible. Richard's code builds a table (and keep wikka links and formatting) using....
which is a basal example of code formatting we were thinking of using anyways, so when we do end up supporting tables in a more complex fashion, it should be reasonably simple for users with tables to adapt their previous code to the new code base. Anyways, I'd like to suggest that we add this code into the next release to provide basic table support. --
cell1cell2boldcell3
cell4cell5italicscell6
GmBowen
    1. this table "markup" (action) is basic, but at the same time very difficult to use (because it's really an action, and also because it's different from the common approach to table markup in many Wikis)
    1. the table "markup" (action) does not support Wikka markup within its cells
    1. it does not actually produce data table markup (which it should)

Editable tables
I don't know if this goes against the Wiki way of doing things, but it would be nice to configure a table in which users could enter data into and then 'submit' (click a submit button I suppose) and have it saved to the page without having to 'edit page'.
--ArisStathakis

Can you post a link to a site where you can enter data without editing the page? I'm not sure what that would look like. - JsnX

GmBowen had something related (I've inserted a link to a screen capture of it in action). I can't seem to get his page to load, therefore I've linked it to its google-cache. Basically, it's a form input thing that allows you to create tables row by row and edit data cell by cell. Very tedious to initialise, (not really, just {{spreadsheet}} starts it, and then you enter rows and columns of data almost like you would in a spreadsheet -- Mike) but i suppose it could be handy just to click on celldata to edit it (and view data if the user has readonly access). This method is a lot more intuitive than the current method of creating tables, but it would involve flatdb (or a new/seperate mysql schema). Just adding to the discussion, I don't believe that this suggestion is the ultimate solution. -- Sam .....this is coming along, but having issues with re-saving with a different name. Functions all work now & refresh automatically. Script works well with individual spreadsheet. Right now, working on it so that user can have one page where all spreadsheets can be managed, and then a user can insert any of their spreadsheets anywhere using an {{inserttable}} action (and you can set function results on or off).....

http://gmbowen.educ.unb.ca/wikitest/inserttable.jpg

The "spreadsheet" (or, interactive table if you want) script uses a MYSQL table with the spreadsheet assigned by default to the page name & owner (which has to match the logged in user), although the logged in user can "force" another table name. Another "action" script allows just showing the table without the interactive nature. So the user can enter the table components using the "spreadsheet", and then show it on the page using the "showtable name=" script. The spreadsheet script allows one to calculate sum, average, count, and frequency (at this point only on the columns) and is intended to provide simple on-line spreadsheet functions for kids working on science projects which they can then embed in a written report. I'm moving the server right now which is why it isn't up. It will be in the next week. The script is a (greatly) modified version of one available from this site...http://www.ka.sara.nl/home/boven/ .... Because it's intended for kids it is reasonably user friendly, although lacking many formatting abilities that "adult" users are used to -- Mike Bowen

My 2 cents on tables. I think we should consider in the long run the possibility of a major refactoring of the syntax for tabular data. The current table action is extremely user-unfriendly (just have a look at the source of ConfigurationOptions). Moreover, the table action does not convert wikka-formatted strings, which in some cases is a little annoying. It think a nice idea would be to have tables directly handled in the formatter, instead of using an action. I like very much the wacko approach to tables, maybe we could do even better and find a more intuitive syntax. -- DarTar

I haven't checked this out yet, but doesn't UsingHTML pretty much solve the problem on table syntax? Now it's just figuring out how to edit a cell without editting a page. --Sam

If you want to work with individual cells, it sounds like you're thinking about something like this.... http://www.ycode.com/SpreadSheet/Latest/yCode_spreadSheet_simple.htm ... although it is not open source. Just providing the link for discussion purposes. -- Mike B

Tables were one of the biggest reasons for us wanting to go with Wikka over our existing WakkaWiki. However the syntax as it is right now is pretty unintuitive. Having one giant string of comma separated values just doesn't work for me. It would be nice to at least make it so you can add line breaks between rows. -- Justin F

FlexWiki* has a rich table markup that seems fairly easy to use. See FormattingRules for the basics and TableFormattingRules for the details. I'd like us to adopt at least the basics, and maybe add some of the extended possibilities gradually.
* (MS open source! And with Ward Cunningham apparently working for MS now...)
--JavaWoman


Picking up on Sam's point....perhaps code written for wikka that does something like this.....
http://131.202.167.33/wiki/wakka.php?wakka=TableMaker -- GmBowen [note: This is a modified version of the linked page which replaces Dave's tablemaking code with the nice blue colors (see comments at bottom of page) with the "freely available" code from http://javascript.internet.com/ without the nice blue colors....and which describes it's code as "The script is yours!" when you access the source code....so shouldn't be any problems now folks]

All that to generate a very basic HTML table (not even a data table)? A good Wiki syntax would probably be easier to understand as well as more efficient for the basics. -- JavaWoman

Like JavaWoman, I use tables frequently, to the point that ugly is better than nothing. I upgraded to Wikka for the inline images...as a longtime user of Wakka, I had concocted just such an ugly hack:

    if( !function_exists('tableize') )
    {
        function tableize($txt)
        {
            $rows = preg_replace('/\|\|(.*)\|\|/', '<tr><td>\1</td></tr>', $txt[0]);
            return '<table border="1">'.str_replace('||', '</td><td>', $rows).'</table>';
        }
    }

    $text = preg_replace_callback("/((?>(?=^\|\|.*?\|\|$)^.*?$\n?)+)/sm", 'tableize', $text);

Unfortunately, inserting it near the bottom of /formatters/wakka.php doesn't seem to work as it did in Wakka, and since I only wrote this with the aid of PHP-literate friends, I have no Wikka solution at this time. A simple regex like this isn't sufficient to develop the extensible syntax seen in FlexWiki, but I have a feeling if someone noticed the (probably obvious) incompatibility that it would be a nice holdover for JW and myself. For the future, I definitely agree that a FW-style syntax is necessary; spreadsheet abilities like in Mike B's link would be orgasmic, even if they represented a completely different feature from regular tables. -- RichardBerg

I've tried inserting this also with no luck. However, it now seems to work quite nicely at Richard's home site. For me, simple to use tables now are much more useful/important than much better tables later (I've got a class using this that I want tabularized time-trial information posted bi-weekly). Can any of the guru's here take a stab at getting this simple approach to tables working...at least "for now"? Thanks. -- GmBowen

It does not actually work at my site either, G. That page was rendered in the Wakka days; if you edited it and clicked 'store,' it would fail just like all my more recent pages. Good news, however -- while the regex above is still illegible to me, I decided to see if I could write my own. Here's a first effort (stick it right before the main preg_replace_callback):
(removed, see below)
The good: it works.
The bad: $wakka->SafeHTML doesn't like it. I'm not sure why -- W3C's validator says the output has no errors -- but for now you have to turn it off.

Also, you must have a blank line after a table!!! (very important)

(I forget whether the previous code had this limitation). I'll see if I can fix these things, but I know GmBowen wanted something quickly. -- RichardBerg

Update: here's a version that goes after the main regex. That makes it even uglier and less extensible, but you can use it without raw HTML (or any HTML setting at all; no safety checks, though it does pass W3C).
// horrible ugly table hack v2.0
if( !function_exists('quicktable') )
{
function quicktable($txt)
{        
    $temp = $txt[0];
    $temp = "<table border='1'>\n".$temp;
    $temp = preg_replace("/^\|\|(.*?)\|\|\<br \/\>$/m", "<tr><td>$1</td></tr>", $temp);
    $temp = str_replace("||", "</td><td>", $temp);
    $temp = str_replace("<br />", "", $temp);
    $temp = $temp."</table>\n<br />";
    return $temp;
}
}

$text = preg_replace_callback("/^\|\|(.*?)\|\|\<br \/\>\n\<br \/\>$/sm", "quicktable", $text);

Hi Richard. Thanks for posting this. Sadly :( I still can't get it working. (i) Do you still have to "turn off" $this->safehtml. If so, how? (ii) could you be more specific wrt where to put the code? I'm assuming formatters/wakka.php is the file to modify, and I tried it in several places at the end of the file, but no luck. Do you have to comment out any other lines? Thanks. -- GmBowen (aka Mike).

Mike, here's the file: http://richardberg.net/bin/temp/wakka.php.txt - you'll see that safehtml is still enabled (my previous short-circuit is commented out) --RichardBerg
Thanks Richard, works like a charm. What's weird, is I cannot see what is any different than what I did. Oh well, it's working now at least.

For a further addition to the resources here for table markup.....there is a code contribution at http://www.wikini.net/wakka.php?wiki=ReglesFormatageTableau by DavidDecotigny that works quite well in wikka (tested in both an earlier and the most recent version) IF $wiki->Format is changed to $wakka->Format in the code....and it's quite easy to add the code to wikka (it took me 10 minutes to install it and get it working, and that includes figuring out the small code change necessary). (Note: David didn't leave any instructions for copyright in his code, so I'm not comfortable posting it here.) -- GmBowen


CategoryDevelopmentFormatters
Comments
Comment by cs24174166-40.satx.rr.com
2004-11-24 23:05:08
The table maker which GMBowen has on his page is stolen. I am currently working with him and his site owner to have it removed. If it is not completely removed soon I will have to take other actions. Dave
Comment by GmBowen
2004-11-24 23:56:59
Harsh Dave. First, I should explain to everybody that his comment refers to scripts which generated pop-up html code that could be embedded in a wiki page with double quotes, NOT the references above to an interactive data table script....THOSE are open source (not to mention 80% written by a student for me). I sent a detailed letter to "Dave" (as both the "him" and the site and the server owner) apologizing profusely and asking permission to use his code .....describing the whole context of its use......if he wants it down rather than talking about selling it, leasing it.......or donating a modified version of it (see comment below) to support an educational non-profit site for kids WITH attribution (read, "advertising" for his commercial site) (all of which I believe I suggested in the email)......well hey, it's "down"....and since I didn't remove the copywrite info from the code, well....sheesh. You want it gone Dave, it's completely gone....don't worry about it. And my apologies for even thinking about using it. Oh, and the code it produced didn't work when it was put on a wiki page and had to be tweaked so that it would work (don't know whether that was your coding Dave or the wikka html code interpreter). My apologies for all on here....I shouldn't've posted the link to an "idea" for what might work for wikka without having heard back from "Dave" and just plain forgot to remove the link from this page. ....and if you didn't want the link to my wiki here on this wiki page Dave, you just coulda registered and removed them yourself rather than leaving the above note.....rather than trying to embarass me (which is obviously the intention of your note) all you did was guarantee that you wouldn't make any money off or from me with your product....a strange business choice indeed.
Comment by JsnX
2004-11-25 05:02:59
Don't sweat it, Mike. You have a history of crediting the source of code that you bring to Wikka. There's no question in my mind -- I'm sure you were trying to be fair and on the level with this guy.

I'd also like to add that you were one of the very first people to take an interest in Wikka and contribute ideas.... and you're still here today contributing ideas and feedback. I appreciate your involvement.
Comment by GmBowen
2004-11-25 21:10:48
Ya, thanks Jason. What I found galling about his note here was that I wasn't even considering providing the code to you folks developing the wikka....I *knew* it was Dave's (well, a commercial sites) code and I knew THEY could tell I was using it because the html code accessed a CSS file on THEIR site which I figured they could trace; I wasn't trying to hide that I was trying out the functionality of it....if I was doing that I would've written my own CSS code so it didn't access their site. I was in the process of trying to get permission to use it for my site...and my site only. I only put the link to my test of it up here so that the conversation on how to provide simple tables in wikka was enriched....that we could consider supporting the use of tables in a different way (or both ways even) than had been discussed to that point. I was by no means suggesting that we "copy" Dave's code (in fact, my comments regarding the CitiWiki/ComaWiki table code in the above block clearly indicate my thoughts on looking at someone else's code before one tries to emulate functionality). Cheers all.
Comment by GmBowen
2004-11-25 21:43:05
Oh this **IS** funny. I trolled around the web more looking for other table making software. I now suspect I know why Dave didn't reply to my written interest in arranging to use "his" code. If you check out the tablemaker at this FREE script source site (http://javascript.internet.com/miscellaneous/table-maker.html) and compare it to the table maker at Dave's site (http://www.ahfb2000.com/tablemakertool.php) you'll find almost identical functionality and design....only the "look" is a wee bit different. If you use a file comparer on the codes you'll find they're REMARKABLY similar to each other....functions defined identically and in the same order etc etc....in fact almost the only real substantive difference I could find was the use of the CSS file. Apparently what I "stole" is the "look" that site developed.....which I didn't actually care about anyways. Should've just offered me the code for a fee Dave, or for free advertising of your site, now I can use the code I care about (for generating tables) for free eh?? And, really, in my view it's not playing nice to use the word "stolen" to describe somebody using code which is available for free. Further, if you don't want somebody using code you claim to have written....try sticking a copywrite statement in it eh?? Then the rest of the world knows that you care enough about what you wrote that they'll ask permission to use it. If you stick stuff out on the web without copywriting it, well...... (My comment 3 notes above about not removing Dave's copywrite was done without checking FOR a copywrite statement....I don't remove other people's copywrite info so I made the comment from that basis. Dave didn't have any IN his pages.) Nice crossing paths with you Dave...thanks for making me persist in finding code that I can use for free.
Comment by JavaWoman
2004-11-26 01:28:54
Mike,
It's obvious to me that you haven't "stolen" anything. But I have to correct you on one point: one doesn't have to "copyright something" by adding a copyright statement - unless the work is paid for by someone else, the creator of a work HAS copyright, period - copyright statement or no.
IOW, if a creation doesn't have a copyright statement, you MUST assume it IS protected by copyright. Look up the Berne convention some time.
(And, BTW, it's "copyright" not "copywrite" :))
Comment by GmBowen
2004-11-26 15:05:40
Hiya JW,
Um, ya, I take your point....although in this case if you're mostly using someone else's code, how can you implicitly claim copyright to all of it in that way?? My argument is that in a "mix" of who did what you should specifically identify your parts if you care about those. Dave is implicitly and explicitly claiming ALL of the code as his, when it clearly is only a minority of the code that is actually his....because he's doing what you suggest (I'm inferring this of course). I'm not at all suggesting that Dave doesn't "own copyright" on what coding he did, but his note states that it is ALL his ("the tablemaker software is stolen"), and I feel that is a dishonest portrayal of where the copyright lays as for the most part the actual tablemaking part of the software in fact is not Dave's to claim as his own (unless I'm missing something).
So it boils down to what is a "work" doesn't it?? So a question for you....if code on a page is 90% from someone else then what does one have copyright to on one's page? If you're using somebody else's code through most of your coding where does your copyright start? I think this is part of what has yet to be clearly resolved in the web world. In a related issue, my understanding is that one cannot copyright a "look"....which is why some bulletin boards are complete clones of others wrt their "look", but not their actual code and there's no legal recourse (I've read some quite bitterly phrased commentary from creators of commercial bulletin boards about the skins available for some "free" ones about this issue). In other words, my understanding is that I could completely copy Dave's "look" of the tablemaking interface by altering the code myself (for instance, by not using a css file and programming the look directly) and there's diddly he could do about that (don't worry Dave, I have no interest in doing that).
One issue in Canada about creative works is specifically ABOUT the look. In one case, an artist, under direction, created an artwork for a public space under contract (in fact, a collection of pretty boring in-air flying Canada geese) and then successfully sued the owners because they decided to put red ribbons around the neck of the geese at Christmas time. The courts decided that the purchasers owned the objects, but the artist maintained creative control over the appearance and the owners had violated that and could not, for instance, tie red bows around the necks of the geese at Christmas time. This has, I think, interesting implications for web development.....even the "paid for by someone else" seems to have confusingly weird limitations. Does this mean that re-designing the css file provided by a designer/programmer of a web site would violate his/her ownership of the "look"??? Hmmm....
And I agree with your point (the one WAAAYYY above) that doing tables this way is an awkward way of generating tables in wikka and that a clear wikka markup syntax would probably be better....although the wysiwyg approach of Victor Manuel Varela using htmlarea *really* solves the issue (and, if security issues could be resolved, that's where I'd REALLY like to see the editing interface go).
(and I'm ALWAYS spelling that word incorrectly....feel free to keep correcting me ;-) ) cheers, m
Comment by NilsLindenberg
2004-11-26 18:04:56
"a clear wikka markup syntax would probably be better"

It definitly would be! (My only comment after creating the tables on WikkaTableStructure ;-)
Comment by cs24174166-40.satx.rr.com
2004-11-27 18:02:03
Point 1: the HTML table maker which you are now pointing to is not the table maker which you took. I have 2 table makers on ahfb2000, if it was the one you are now mentioning I would/could have no problems. The second table maker, which is the one you took is proprietary.

Point 2:You cannot get the source code by simply viewing the page and clicking view source, it takes some type of backdoor underhanded method. This is enough to have me question your motives.

_________________________________________________________________

Head cleared
__________________________________________________________________

I would like to offer my sincere apologies, it was infact the javacript version of the table maker which you had up. and not my other version http://www.ahfb2000.com/tablemakertool2.php?sub=gen_form

I hope you and your community can accept my apologies and understand my frustration when I thought it was the proprietary version which as stated above takes underhanded methods to get the source.

I will also email the admin that I had notified previously of infringement to explain that it is all my fault and that you have done nothing wrong morally or legally.

In an effort to extend an olive branch, I would like to offer myself up to discussions so that maybe you can use my other table maker in your project.

My apologies,
Dave
Comment by GeorgePetsagourakis
2004-12-14 21:58:15
I did a slight mod of the table.php file .. I needed the separate border and celpadding attributes ...

changed this :

if ($param == 'style') {$style=$value;}
if ($param == 'columns') {$columns=$value;}
if ($param == 'cellpadding')
{
$cellpadding=$value;
$border=$value;
}
if ($param == 'cells') $cells = split($delimiter, $value);

to this :
if ($param == 'style') {$style=$value;}
if ($param == 'columns') {$columns=$value;}
if ($param == 'cellpadding') { $cellpadding=$value; }
if ($param == 'border'){$border=$value; }
if ($param == 'cells') $cells = split($delimiter, $value);

hoping its usefull ..
Comment by LocK
2005-03-07 01:28:06
I've seen several way to dual w/ table from this site, but honestly, I don't think those are good choices, :(. Hmm... One of the selling point of wiki is user-friendly+easy to edit, but those solutions seem more complicated than I hard code HTML... The first example is better, but I have seen a better solution in dokuwiki, <a href="http://wiki.splitbrain.org/wiki:syntax">. I hope you guys like it. :) And I already merge it in my wiki.;-> It's not complicated to replace the orig. one, since I don't want to add code to the core, it 's a ugly hack, Haha. You know, I don't want to move around when upgrading, so I just replace the action/table.php. If u guys interested, I can post my table.php in here.
Comment by JavaWoman
2005-03-07 12:49:50
LocK,
The *choices* you've seen so far are all temporary solutions - until we have a proper table markup syntax. About which we are having these discussions.
The problem is that *good* XHTML table syntax isn't simple - and a wiki table syntax to support what's necessary for data tables consequently isn't simple either. Rather that force backwards compatibility problems by hastily picking a syntax that would have to changed again later, we prefer doing a careful design - while providing temporary solutions to not leave everyone out in the cold.

The choices (what's currently available) you've seen are good choices only in that perspective: as temporary solutions.

As to the dokuwiki table markup syntax - it's simple but not enough to support all elements that are needed for proper data tables - and the syntax doesn't seem to be easily extensible either. There's no provision for a caption or a table summary for instance, and it's not obvious how to add that given the current syntax. So I'm not in favor of adopting that.
Comment by LocK
2005-03-08 04:24:29
Jw,
I know ur concern in backwards compaitbility, but where can I found any glues of our directions will go to? It seems the progress takes forever, though I understand the neccessary of careful in here. But I do pefer some well-organized temp. table syntax for my site, since It should not be hard to write a perl script to transform to new syntax later. Otherwise, I don't know where should I put my table-needed data. At least, if u guys adopt a new syntax, I don't have to key-in the header data and cell data in those table at once. I just have to add some useful and neccessary information into it, liked the caption u mentioned before. Besides, I noticed our table syntax used currently mixed with interface and data. Don't we goto the direction of seperation between them? Liked XML & XSLT, Wiki & CSS. That's why I think the temp. syntax I adopted is more simple to transform because I just care the data. I put the interface in CSS. Or can we have a simple version of table syntax? In fact, most of us don't need so much function. Just liked the relationship between open and fopen in C, with limited function, have default value, easier to handle. Most people don't care/touch the powerful function. Is it a good choice for that kind of wrapper function?
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki