Wiki / Pages Addon

Project:ProjectPier
Version:0.8.5.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Alex.
Status:patch - code needs review
Description

Hi,
I'm currently developing a wiki / pages addon for Projectpier, which will allow you to create pages for projects.

It's currently a little basic, but usable - you can add, edit and delete pages(Though only admins can delete pages). Each modification of a page creates a new revision.

Revisions can't be restored yet, but you can view the history for a page by clicking on the 'Page History' link.

To view a specific revision for a page, click the revision number in the page's history.

You can also create a default wiki index page, and sidebar page.

I'm not going to create a patch for it until I'm satisfied that it works ok, and that the code is up to scratch(ish).

If you want to test the code, then you can try out the demo:
http://projectpier.sigswitch.com

User / Password:
Test/test
Test2/test2

I update the demo once or twice a day, so it's pretty much always up to date.

If you could test it out and give me feedback on it then I'd be much appreciated :)

Alex

How do I get the list of the existing pages? Not implemented yet I suppose. It makes the demo a little disconcerting for now :) (nevermind, see below)

I noticed a little bug here:
http://projectpier.sigswitch.com/index.php?c=wiki&a=history&id=8&active_...
One could tell you copied your stuff from the messages pages by looking at the tabs.

You should add the Textile handling too.

I don’t think I like the fact that “Add page” is as the same level as “Edit page” and “View page history”. One is general to the Wiki module while the others are for the current page. It’s not that it doesn’t make sense and that I get confused (thanks for asking :)), just that I think they should be in different places. Maybe the add page could be in the sidebar (with the list of current pages?).

Can you explain the reasons behind allowing a page to be the sidebar?

below: Oh ok, nevermind, I just removed the wikipage as the sidebar and saw the list of pages created…


How do I get the list of the existing pages? Not implemented yet I suppose. It makes the demo a little disconcerting for now :) (nevermind, see below)

:)

I noticed a little bug here:
http://projectpier.sigswitch.com/index.php?c=wiki&a=history&id=8&active_...
One could tell you copied your stuff from the messages pages by looking at the tabs.

You have sharp eyes!
I was using the messages page as a template for the pagination ;)

You should add the Textile handling too.

In time, though my priority is to give it some more wiki functionality before the aesthetic stuff.

I don’t think I like the fact that “Add page” is as the same level as “Edit page” and “View page history”. One is general to the Wiki module while the others are for the current page.

Yeah good point. At the moment it's like that because that's the action bar, it's not a priority, but if you have a suggestion as to where it could go, I'd be more than happy to move it.

It’s not that it doesn’t make sense and that I get confused (thanks for asking :))

:p


Just that I think they should be in different places. Maybe the add page could be in the sidebar (with the list of current pages?).

Possibly, though as you can modify the sidebar, you could easily add an 'add page link'


Can you explain the reasons behind allowing a page to be the sidebar?

I wasn't sure that most companies would want a link to every single page in their sidebar (I imagine it could get quite long!), so I chose to give people the option of creating their own customised sidebar, and to keep it simple I merely made a page specifically for the sidebar.
As you've noticed, the default sidebar has a page list, and the language entries can be customised so as to make the sidebar more specific to the company.

Maybe in the future you will be able to customise the content and have an automatically generated list of pages too.


below: Oh ok, nevermind, I just removed the wikipage as the sidebar and saw the list of pages created…

:)

Ok, textile is now in there and you can now revert to revisions :)

Comparison of revisions in a diff style is now possible, though I'm having trouble getting the form on the page history page to redirect to the diff page :-/

If you want to try it out, then visit:

index.php?c=wiki&a=diff&active_project=1&id={PAGE_ID}&rev1={FIRST_REV}&rev2={SEC_REV}

Filling in the place holders with the page id etc.

Also, there is now a confirmation page to delete wiki pages

Title:Wiki / Pages Addon» Wiki / Pages Addon - Patch now released!
Status:open - assigned» patch - code needs review

Ok, I am now going to release a patch for this PP hack.
I am not entirely happy with all of the code (mainly the wiki page url generation / wiki views), but I feel that it is sufficent for community testing.
Some parts of the files may not respect all of PP's coding guidelines (The code indentation *should* be the only problem - I have tried to use a tab size of two where possible, but there may be the odd outlier) but are good enough to use. I have also used a code beautifier on the diff files so they *should* be ok, but as we all know, beautifiers don't always do what they're supposed to do :p .
Doc comments have been added to pretty much every function, though they might need a little bit of modification

Credits:

  • phpBB / PEAR - The diff library is taken from phpBB, who borrowed it from PEAR (GNU / LGPL)

Features:

  • Can add pages
  • Can edit pages
  • Can delete pages
  • Creates a revision for each page edit
  • Can view the revision history of a page
  • Can set a page as the wiki index
  • Can create a 'sidebar' wiki page, or use the default which lists all the pages in your wiki
  • Can view individual revisions of a page
  • Can compare different revisions of a page using inline diff
  • Formats wiki pages using Textile formatting
  • Can dynamically link to pages by using the tag: [wiki:{PAGE_ID}] which will automatically be converted to a Textile link with the wiki page's name for the title
  • Project logs entries are created for editing, adding and deleting pages
  • Confirmation required to delete a page
  • Allows for revision log messages
  • The page's name should appear in the breadcrumb when you are either viewing it, its revision history, editing it or comparing two of its revisions

Permissions:

  • Project users can view pages
  • Members of owner company can edit pages
  • Admins can delete pages

Roadmap(Priority Descending):

  • Allow admins to 'lock' pages to prevent editing / changing status of wiki index / sidebar
  • Create a dynamic index of pages
  • Require password confirmation to delete a page
  • Allow wiki pages to be tagged (This functionallity is already there, but has not been tested)
  • Add hooks for the plugin system
  • Allow page titles to be used as page identifiers

As always, I appreciate ANY feedback / issues you have :)

I've uploaded this patch to the demo server, so you can try it there if you don't want to install the patch:

http://projectpier.sigswitch.com
Username / Password:
Test / test
Test2 / test2

Alex

AttachmentSize
wikipatch_r154.patch109.66 KB

This new patch fixes a few major problems with the old patch (which didn't have the Revision model or wiki helper included)

I have briefly installed & tested this patch, so it should work fine.

Feedback & issues appreciated!

Alex

AttachmentSize
wiki_200804081720_r154.patch112.24 KB

I really like your patch.

- About the sidebar page :
When adding a new page, I find the "Set as project sidebar?" option not useful as there will only be one sidebar page. When someone wants to change it, he'll just directly click on the "edit" button.

- About linking pages :
I tried to follow the syntax in your source code for Wiki-style links but it doesn't work. Is it implemented yet ? This is a pretty important feature for a Wiki.

Thanks for your work !!

Thanks for trying it out :)
- About the sidebar page :
When adding a new page, I find the "Set as project sidebar?" option not useful as there will only be one sidebar page. When someone wants to change it, he'll just directly click on the "edit" button.

By default there isn't a wiki sidebar in the DB, so to make one you have to create a new page hence the option.
It also gives people the option of switching between different pages for the sidebar(Not quite sure why they'd want to do it though..)


- About linking pages :
I tried to follow the syntax in your source code for Wiki-style links but it doesn't work. Is it implemented yet ? This is a pretty important feature for a Wiki.

I was discussing this problem with some people in IRC the other day.
The actual making the link part works perfectly(afaik). It's just that the url is escaped twice (by escaped I mean, & => &) so instead of a url looking like this:

http://www.site.com/index.php?c=wiki&c=view&id=1

Like it is supposed to, it looks like this:

http://www.site.com/index.php?c=wiki&c=view&id=1

I'll put up a new patch when I get some time

Thanks for your work !!
Thanks, I'm glad I can give something back :)

Version:» 0.8.5.x-dev

The patch has now been updated:

This release fixes the following issues

  • Wiki links do not work properly
  • When comparing two identical versions, all you see is a blank screen
  • Wiki allows you to compare two instances of the same version
  • Some parts of the edit page aren't localised
  • There are a few typo's in the edit view
  • Undefined index 'tags' when editing
  • New features in this update:

  • Wiki pages can now be locked to prevent editing
  • Wiki pages are now searchable
  • New Permissions in this update:

  • Administrators can (un)lock pages
  • AttachmentSize
    wiki_b200804271405_r154.patch119.64 KB
Title:Wiki / Pages Addon - Patch now released!» [Urgent] Wiki / Pages Addon - Security patch released

The patch has now been updated:
This patch fixes the following issues:

  • Users could view the wiki index page of projects they weren't assigned to
  • Calling none static method as static in add()
AttachmentSize
wiki_b200805031736_r154.patch119.91 KB

The latest patch needs to be generated with the --strip-trailing-cr option.

First - thank you! Great add-on. Couldn't do without it.

A few problems (using the latest patch with projectpier svn r159):

* If I create a page, add a link to it in another page (using [wiki:n]) and then change the name of the first page, the name shown in the link doesn't change.

* When creating a new page I always get an error. Hitting "Back" takes me to the edit view for the new page.

Warning: Missing argument 1 for ProjectDataObject::setTagsFromCSV(), called in .../projectpier/application/controllers/WikiController.class.php on line 260 and defined in .../projectpier/application/models/ProjectDataObject.class.php on line 305

Notice: Undefined variable: input in .../projectpier/application/models/ProjectDataObject.class.php on line 307

Warning: Cannot modify header information - headers already sent by (output started at .../projectpier/application/models/ProjectDataObject.class.php:305) in .../projectpier/environment/functions/general.php on line 323

* This may not be strictly a problem with the Wiki plugin, but anyway... The Textile renderer is broken. It fails to recognize many valid Textile tags. Using the same markup at http://textism.com/tools/textile/index.php results in a perfect rendering.

Correction to my last post...

The Textile renderer isn't at fault - the problem is that symbols in the text are quoted before the markup is processed, and this disables a lot of tags.

Is there anything that can be done about this?

The latest patch needs to be generated with the --strip-trailing-cr option.
I've tried to do this but I'm getting an error (can't remember it off the top of my head). Please can you give me an example of the syntax?

First - thank you! Great add-on. Couldn't do without it.
I'm glad you like it :)

* If I create a page, add a link to it in another page (using [wiki:n]) and then change the name of the first page, the name shown in the link doesn't change.
Thanks for reporting this, I'll fix it when I get home

* When creating a new page I always get an error. Hitting "Back" takes me to the edit view for the new page.
I thought I'd commented it out - I'll fix that when I get home too.

The Textile renderer isn't at fault - the problem is that symbols in the text are quoted before the markup is processed, and this disables a lot of tags.
I'm not sure why this is happening - I'm pretty sure textile works fine on my dev copy.

Please can you paste here / email me the page you are trying to post, as well as a screenshot of what the 'garbled' page looks like.

Alex

Title:[Urgent] Wiki / Pages Addon - Security patch released» Wiki / Pages Addon

This release fixes the following issues:

  • #15 Error while trying to create a page
  • #15 Wiki links do not reflect title changes

Sorry if I confused / annoyed some folks with the [Urgent] tag - it seemed pretty urgent at the time!

Alex

AttachmentSize
wiki_200805211941_159.patch120.24 KB

Great work Alex and thanks again for the contribution. It would be nice to get this into the core release soon.

FYI:
the base URL into your test site is presenting a db error, after login.
http://projectpier.sigswitch.com/

However, the direct links work ok, for example:
http://projectpier.sigswitch.com/index.php?c=wiki&a=view&active_project=1&id=1

-- Dan

Thanks for trying it out - it's always nice to get feedback :)
I have not got round to updating the demo, so it's still a few versions behind, and the db itself is a version or two behind the code.

I'll try and update it today if I get time