[pmwiki-users] PmForms for populating a PmWiki page with an archive of papers

Oliver Betz list_ob at gmx.net
Fri Jul 3 03:04:08 CDT 2009


Karl Schilke wrote:

>Hi, I have set up a PmWiki instance for a group of engineers working  
>on a research and development project. They have collected ~100 papers  
>that they would like to index on a page. They want a structured system  
>where each paper is in its own "section", with a standard format  
>consisting of:
>
>     Article title (italics) -> PDF of the paper
>     Author list
>     Journal citation / DOI:xxx or URL
>     Description or abstract (free-text notes or a copy of the abstract)
>
>I handled this for my personal use by simply writing the markup, but  

so did I.

>they are, ah, somewhat less than enthusastic about copying and  
>modifying a bunch of markup text. I was thinking that this would be a  

I know... These days, people want fancy user interfaces.

>good use for page includes and forms.
>
>I'm envisioning a main page (Papers.Main) that (:include:)'s a series  
>of short pages (e.g. Papers.Johnson2002) to create the master index.  
>Each subpage would have the above text, ideally marked up and viewable  
>as a separate entity. A page template would be used to pre-populate  
>the markup for pages upon creation.
>
>It seems to me that a form-based approach would be ideal. I'm thinking  
>of a "Add paper" link from the main page that creates each of the  
>sub-pages based on four textboxes and a file upload for the PDF  
>version. I haven't had an opportunity to explore the PmForm  
>extensions. Is this the right tool for the job?

That's exactly what I used for a club's address list.

I made a form using PmForm, and a GroupHeader displaying the
structured data on a member's page, a link to pagename.jpg and to the
form page.

Now they have address lists sorted by position, with pictures (using
"mini") and so on.

I used some tweaks in the groupname.php:

$FmtPV['$useform'] = '$_GET["useform"]'; # used by group header to
decide whether to display form

# revert form action if cancel button has been pressed:
if(@$_REQUEST['action']=='pmform' && @$_REQUEST['cancel']>''){
  $action='browse';
}

GroupHeader uses then (:if ! equal {$useform} '':) (:pmform adrform:)
(:else:) ...display data... (:ifend:)

For the picture gallery, I use the following check:

# check whether a specific attachment exists
$Conditions['attachexists'] =
"AttachFileExists(\$pagename,\$condparm)";
function AttachFileExists( $pagename, $path ) {
  global $UploadFileFmt;
  if (preg_match('!^(.*)/([^/]+)$!', $path, $match)) {
    $pagename = MakePageName($pagename, $match[1]);
    $path = $match[2];
  }
  $upname = MakeUploadName($pagename,$path);
  $filepath = FmtPageName("$UploadFileFmt/$upname", $pagename);
  return file_exists($filepath);
}

To avoid listing people without picture.

>Would a PTV approach make sense here? Does anyone know of a similar  

For me, it was the right solution.

But there is an alternative: With Cookbook/EditAttributes, you can
embed structured data in pages, as PTV and/or as page attributes. You
have to extend the edit form.

I used the PmForms solution because it seemed to be less intrusive.

>system that I could look at as a starting point for my application?  

I will send you all the page sources.

>I'd be happy to "donate" a version as an example for pmwiki.org, once  
>I get it working.

it would be great if you reviewed my solution, debugged and stripped
it and made a nice documenting Cookbook page.

Oliver




More information about the pmwiki-users mailing list