Re: [pmwiki-users] pmwiki and Active Directory

2009-05-14 Thread Peter & Melodye Bowers
> I have tried to do it without using the chr(39)-things, but
> unfortunately it didn't work.
> - With the chr(39)-stuff the Main.HomePage was displayed.
> - Without the chr(39)-stuff all I got was a blank page, obviously some
> sort of syntax error or something in the script.

So before you had lines that looked like this:

> >$idName = chr(39) . "id:" . $idinfo[1] . chr(39);
> >$idCode = chr(39) . $idinfo[3] . chr(39);

And after you had lines that look like this:

> >$idName = "id:" . $idinfo[1];
> >$idCode = $idinfo[3];

Is that right?  And it's still not displaying?  

You'll need to go to your PHP logs and see what error is coming up or else
turn on error reporting so it will display on the page...

error_reporting(E_ALL); // place this toward the top of your config.php

Or, alternatively, you comment out lines 1-by-1 until it starts working and
then carefully examine that line to figure out what caused the problem.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] empty vs nonexistent PTV in pagelist

2009-04-07 Thread Peter & Melodye Bowers
Is there any way to differentiate between an empty PTV and a non-existent
PTV in a pagelist?

If not, what suggestions for an appropriate syntax to differentiate?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Another stab at ratings on PmCalendar page

2009-02-28 Thread Peter & Melodye Bowers
> I forgot to mention that a while ago we discussed this format :
> * (+) Excellent, I use it. [[~Petko]] (datestamp)
> * (-) Didn't work for me, PHP 7 required. [[~Peter Bowers]] (datestamp)
> 
> That is : asterisk, (special markup keyword), optional comment, signature.
> 
> There were many messages about the keywords, should they be (+) and (-),
(+1),
> (support), (endorse), (friend), (user), and more. With (+) and (-) all
> nuances of the "friend" and "endorse" words are sipmlified, but one can
> explain his friendship, support or endorsement in the optional comment.
> 
> If we happen to agree on a simple format, then a {Recipe-Users$Votes} page
> variable can be done to count all "* (+)" and all "* (-)" in the page and
> contain something like "(+12, -3)" :
> 
>   Discussion: [[Recipe-Talk]], [[Recipe-Users]] (+12, -3)

Immediately multiple other possibilities suggest themselves to me and
probably many others to you as well:  

* What if we allowed ++ and -- as well as + and -
* What if we allowed +2
* Wouldn't it be better to put the link & numeric "rating" on its own line
in the recipe rather than with the discussion...

HOWEVER, if we all chime in with our suggestions I'm afraid we will arrive
back at square one and never arrive at a consensus.  This solution (above)
meets the functional requirement in my mind.  Any possible extension could
be discussed *after* we've agreed on this as a basic standard (i.e., allow
++ -- maybe it's a good idea, maybe it's a bad idea, but whether or not we
allow that has no bearing on the basic (+) and (-) functionality that's been
suggested.)

Unless someone has strong objections (i.e., not just a roughly equivalent
alternative that you happen to like better), can I recommend getting some
quick positive feedback and establishing a standard?  I'm not trying to
quash discussion and the tremendous benefit that comes from "group-think"
but I think this issue has been held back for way too long by the main
disadvantage of "group-think"...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Trying to add new page variable problem

2009-02-23 Thread Peter & Melodye Bowers
> Hi, I think I get that, but from a more general point of view I am
> trying to understand how to use markup like (:sitemap_priority 0.5:), ie
> like the (:title:) markup

You'll have to set up your own function in the $EditFunctions[] array which
will scan the text for this markup and set $page['sitemap_priority']
appropriately before the page is actually saved.  You'll probably also want
to set up your own Markup(...) to hide or else display more presentably the
actual markup.

That's the way I would approach the problem -- there are probably better
ways out there...

> Also if you look at the current sitemap code, it directly accesses the
> $page variable so that it can optionally bypass the page auth.  If you
> look at PageVar you can see it respects the read auth limits.  So to try
> and keep the key features of the current recipe I am trying to
> understand the PageVar function and also how the other markup function
> is weaving it's magic (I can't use PageVar directly if I want to bypass
> the read auth)

In the text file syntax of a wiki page, each line starts with some sort of
label followed by a colon followed by the relevant data.  (Note you should
look at a file and compare it to what you know about that page so that you
can see what it looks like.) It could look something like this:

version=pmwiki-2.2.0-beta37 ordered=1 urlencoded=1
agent=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR
1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; .NET CLR 2.0.50727)
author=David Smith
csum=Corrected spelling
ctime=1172845515
host=80.90.81.71
name=Expats.Expats
rev=2
targets=
text=(:title Foreigners (expats) in Albania:)%0aTirana is the capital of
Albania.  With a population of nearly a million people, Tirana holds nearly
one third of the population of the country.%0a%0aThe exact number of
expatriates is not known, but there is a significant number living here from
all over the world, whether missionary, businesspersons, embassy, or
otherwise.  This section of the CCL Wiki is intended to be a place where
expatriates can share information about living here in Tirana.  Favorite
restaurants, things to do, education opportunities for children - whatever
you would like to see in this section just go ahead and get it started and
somebody else will hopefully expand it.%0a%0a!Pages in this
section:%0a(:pagelist group=Expats:)
time=1174551769
title=Foreigners (expats) in Albania
author:1174551769=David Smith
csum:1174551769=Corrected spelling

(Names changed to protect the innocent.  Note that my email client has
wrapped at least the agent= and the text= line -- if you were reading these
in a text editor with wordwrap turned off you would see that each element
was a single line.)

When the page is read in (via ReadPage() to ignore authorizations or, if you
want to respect auth, RetrieveAuthPage()) then it creates an array out of
that file (in most contexts called $page).  The index into the array (the
key) is the label (the text before the equals) and the value of that array
element is the text to the right of the equals sign.  (This is an
over-simplification, but it will work in most cases -- I think dealing with
page history and revisions is the only time when this doesn't work.)  (All
this happens in the read() function within the PageStore class.)  Thus you
can access the $page['text'] to get the text of the page or $page['date'] to
get a date of the page, etc.  If you have created a key/label named
sitemap_priority then you could access it as $page['sitemap_priority'] if it
existed in the file before it was read into memory.

When the page is being *written* it writes out all keys followed by an
equals sign followed by all values, each on its own line.  It also does a
bit of stuff to make multi-line text go on a single line (using %0a as a
newline separator) and etc.  But what this means is that if you want to
create a new page attribute all you  have to do is set
$page['my-new-attribute'] before the actual page-post occurs.  If you get
your function into the $EditFunctions in the right order then that should
solve the problem for you.  

> >From what I can see, the the text variables are accessed via
> $page['text']['some_var'], but the markup like title/date is accessed
> via $page['date'], etc.  What I can't quite understand is how the $page
> object is built.  I think it's actually down to how the page is being
> saved, but I can't see how to inject a new variable into the page?

I'm not sure exactly what you mean with the $page['text']['some_var']...
$page['text'] is a string and can only be indexed as a string, not as an
array...

Hopefully my comments above have explained how the $page[] array is used
writing the page and how it is built as the page is read from disk.

> As an aside, I can't really see how the pagevar attributes get into the
> $page['text'] array either??

$page['text'] contains just the source of the text of your page -- just what
you would see if you edited the page

Re: [pmwiki-users] setting page attibute acording a publish/drafts ptv

2008-11-27 Thread Peter & Melodye Bowers
You can look at the function wshChmod() in wikish.php - it allows you to
change all types of attr's.

-Peter

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:pmwiki-users-
> [EMAIL PROTECTED] On Behalf Of noskule
> Sent: Thursday, November 27, 2008 2:26 PM
> To: Hans
> Cc: PmWiki Users
> Subject: Re: [pmwiki-users] setting page attibute acording a
publish/drafts ptv
> 
> Am Donnerstag 27 November 2008 12:21:06 schrieb Hans:
> > Thursday, November 27, 2008, 10:22:00 AM, noskule wrote:
> > > In my blog blog pages I have a Livecycle ptv with values "Draft" or
> > > "Publish". So I only want to show published post to the public. I use
fox
> > > to create the posts.
> > >
> > >
> > > Does anyone have an idea how I could st the read-attribute of the page
to
> > > author or public group acording to the selected Livecycle value.
> > >
> > > I'm not shure how to achive this. Could fox change the attribute, or
do I
> > > script something in config.php.
> >
> > Fox has no built-in capacity to set page attributes.
> > I suppose one could write a filter function for this.
> >
> 
> ok I try that, is there an example somwhere how to change attributes of
pages
> in php?
> 
> grz nos
> 
> ___
> pmwiki-users mailing list
> pmwiki-users@pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] PmWiki and Pagelist as report generator

2008-08-21 Thread Peter & Melodye Bowers
> Producing the individual pages manually using the ordinary pmwiki editor
> was fine when there were only two or three a week. However, we're going
> to need lots more, and it would be useful to use an input form to write
> out the individual pages.
> 
> Is there a way in PmWiki of having a form that collects values of
> variables and then writes them out, not to an email, but to a new wiki
> page whose name is constructed from variables in the form?

I'll probably later move this solution to Cookbook/WikiShExamples, but for
now there is a working prototype (purely test data - feel free to punch it
around) at 

http://www.qdk.org/pmwiki/pmwiki.php?n=WikiShForms.2008-08-21-something 

(I don't usually leave them as "live" examples -- I thought this one was
particularly cute as an example of a very simple flat-file (non-relational)
database that could be really functional and is very extensible in terms of
validations and etc...)

>From there you can edit and save the PTV values or create new pages using
the supplied field/button.  Each page kinda-sorta contains its own
"make-me-into-a-form" code so when you view the page it will view it in a
user-friendly form interface even though the page itself is basically just
data with a 1-line WikiSh function call.  You can still go to action=edit or
action=source to see the (now hidden) PTVs that it's based off of.

I followed your PTV names and etc just for consistency, but I only did a
subset of them.  Adding the rest is just a typing exercise...

If you are looking at the solution you will also be interested in these
pages:

* WikiShForms.Template  - the content that is copied into place when a new
page is created (all it does is (:include PageContent:)
* WikiShForms.PageContent - the actual content of the page that gets pulled
in -- just a function call now, but you could add something else on this
page and all "data" pages would automatically "be updated" with the "new
look"
* WikiSh.WikiShForms-GroupRC - the location of the function definition
(active for this group but nowhere else)

There's all kinds of capabilities for validating the data in the form as
well.  I haven't done anything like that because I don't know what your
requirements are...

I didn't do anything with the pagelist reports because it seemed like you
already had that going well and just needed the form solution, right?

Hope that helps!

-Peter

PS Whether you use this solution or not, I strongly recommend taking a look
at the use of (:include {$Group}.PageContent:) to bring in your view-table
from one master copy rather than having it hard-coded on each individual
page.  (Maybe you're already doing this and just didn't mention it in your
email - if so, ignore this paragraph.)  Otherwise at some inevitable point
in the future someone is going to have the unenviable task of going through
and hand-editing a bunch of pages in order to allow for an additional field
or a change in a label or something like that...  Just a tho't.


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Blank Page

2008-08-21 Thread Peter & Melodye Bowers
> ... pmwiki now prompts for username as
> well as password, but seems to ignore whatever is entered into the
> "Name" field.

This is simply due to the fact that you have partially enabled authuser.  In
your earlier email you had this:

>I looked through the error reports on pmwiki.org, and found one that
>recommended adding the following file to ~/local/config.php:
>
>include_once("$FarmD/scripts/authuser.php");

When you added that to config.php you started down the line of enabling a
particular feature, but you need to either undo it or else complete the
configuration to fully enable it.

See http://www.pmwiki.org/wiki/PmWiki/AuthUser and particularly
http://www.pmwiki.org/wiki/Cookbook/Quick%20Start%20for%20AuthUser

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] How to add a read password field to the edit form

2008-08-11 Thread Peter & Melodye Bowers
> This would be my first recipe, but I need way more code ... or someone
> to do it for me .-)

I'm afraid I can't code it for you, but you'll be looking at something like
this (I haven't even compiled this, so be aware of what level it is)...

===(snip)===
$EditFunctions[] = 'AllowPublicPage';
...
# AllowPublicPage()
function AllowPublicPage($pagename, &$page, &$new) {
  $rpw = $page['readpasswd']);
  if (@$_REQUEST['allowpublic']) {
if (!strstr($rpw, 'id:*')
  $rpw .= ($rpw?" ":"") . 'id:*';
return;
  } else {
if (strstr($rpw, 'id:*')
  $rpw = str_replace('id:*', '', $rpw);
  }
  $page['readpasswd'] = $rpw;
}
===(snip)===

This assumes you've named your checkbox field "allowpublic".

There's definitely more efficient ways to do it (I think there's some way to
combine my 2 nested if's into a single if/else).

I'm not confident at all that I've correctly handled the existing read
passwd, either appending or getting rid of the 'id:*'.

I have no idea if the order of the functions in $EditFunctions is
significant - I would guess that it is...

But this should get you further down the line...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] form to search page names - one solution

2008-08-05 Thread Peter & Melodye Bowers
> In one page I created this simple form:
> 
> (:input form method=get action={$ScriptUrl}/Main/Search_results:)
> (:input text name=search_term:)
> (:input end:)
> 
> Then, in the page /Main/Search_results, I grab the variable passed with
> the GET method (?search_term=text_entered_in_the_box) and insert it in
> the (:pagelist:) directive:
> 
> (:pagelist name=*{$?search_term}*:)
> 
> It works, but I don't know if there are better solutions. Any other idea?

You could leave it on the same page and just surround your (:pagelist ...:)
with (:if !equal {$?search_term} "":)(:pagelist ...:)(:endif:).  That would
enable to you to immediately update your search term if you came up with the
wrong list.  (You would need to get rid of the action=... in the input form
as well as adding a (:input hidden name=n value={$FullName}:) or the
equivalent...)

You could also do the same thing with markup expressions, but I don't guess
there's any need for that since it's working without them...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] How to protect against vandalism?

2008-08-05 Thread Peter & Melodye Bowers
>I now have a "please enter qdk below" on my authform.  That's great when a
>user is trying to edit an open page.  But it can be confusing when a
>particular page has a different password or if someone is trying to change
>attributes rather than edit the page.  Is there any way to put this message
>only when someone is editing an "open" page?

Is a solution like this pretty risky security-wise?

===(snip config.php)===
if ($action == 'edit') {
echo "action=edit\n";
$FmtPV['$editpass'] = '$page["passwdedit"]';
}
===(snip)===

===(snip Site.AuthForm)===
(:if [ equal {$editpass} "" && equal {$Action} "edit" ] :)Please try qdk if
you don't know the password(:ifend:)
===(snip)===

Setting my password to a pagevar seems pretty weird, even though it will be
encrypted.  However, I only do it when the action is "edit" when
(theoretically?) nobody could be doing anything to obtain it...

So, the question: is this pretty dangerous or does it seem OK from a
security standpoint?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Import existing web pages

2008-08-05 Thread Peter & Melodye Bowers
You could start with these:

http://www.pmwiki.org/wiki/Cookbook/ConvertHTML
http://search.cpan.org/src/DIBERRI/HTML-WikiConverter-PmWiki-0.51/README

I haven't done it myself, but it looks do-able...

-Peter

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:pmwiki-users-
> [EMAIL PROTECTED] On Behalf Of Jon Paris
> Sent: Tuesday, August 05, 2008 2:17 PM
> To: pmwiki-users@pmichaud.com
> Subject: [pmwiki-users] Import existing web pages
> 
> I can see that text files can be imported into PMwiki - but I can't
> find anything on importing existing web pages.  Can anybody point me
> in the right direction please.
> 
> 
> Jon Paris
> 
> www.Partner400.com
> www.SystemiDeveloper.com
> 
> 
> 
> ___
> pmwiki-users mailing list
> pmwiki-users@pmichaud.com
> http://www.pmichaud.com/mailman/listinfo/pmwiki-users


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] How to protect against vandalism?

2008-08-05 Thread Peter & Melodye Bowers
> Could someone tell me what variable needs to be changed or what page
> needs to be modified to put the message about what password to enter
> there in order to have this "open" type of password?

Sorry - I knew I would find it the moment I sent out the email, but Mr.
Murphy says I would still be looking if I hadn't sent it... :-)

The answer to my previous question is to edit the page Site.AuthForm.  There
are also some good hints about this at
http://pmwiki.org/wiki/Cookbook/CustomAuthForm, providing a per-group
auth-form, etc.

Now my next question:

I now have a "please enter qdk below" on my authform.  That's great when a
user is trying to edit an open page.  But it can be confusing when a
particular page has a different password or if someone is trying to change
attributes rather than edit the page.  Is there any way to put this message
only when someone is editing an "open" page?

-Peter



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] "sticky" checkbox

2008-07-22 Thread Peter & Melodye Bowers
I think you're going to want to set up fox forms and save the results in
PTVs.  Hope that gets you started in the right direction.

 

Obviously in addition to clicking the checkbox your users are going to have
to click on the "submit" button.

 

-Peter

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jason Dudar
Sent: Tuesday, July 22, 2008 12:01 PM
To: pmwiki-users@pmichaud.com
Subject: [pmwiki-users] "sticky" checkbox

 

I'll preface this question by saying I'm a complete newb at this, so feel
free to roll your eyes and curse me for wasting your time.

 

I've just installed, and customized the appearance of pmwiki to my liking,
and am in the process of entering a bunch of content.  This wiki is meant to
be a central repository of notes and ponderings for several engineers
working remotely on various projects.  The site is internal and only trusted
users will access it, so permissions and security is not an issue (yet).

 

One of the things I would really like to do is have "sticky" checkboxes on
tasks/action lists, or To Do lists I suppose, such that anyone can navigate
to one of these pages and check off an item, then go away without ever
actually "editing" the page.  The next time anyone else navigates to that
page, the "status" of that box reflect the previous users changes.

 

The question is: can this be easily implemented, or does a recipe already
exist?  

 

I spent a couple of hours sifting through the pmwiki site for something like
this and couldn't find anything.

 

Thanks for your time,

Jason

 

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] pmwiki forms

2008-07-08 Thread Peter & Melodye Bowers
> I want to set up a simple form, and then either compile the results on
> a web page, or have the individual form results emailed to me. 

Do you want just the most recent data on a web page?  Or do you want
subsequent datasets to be appended to the previous one?  Or do you want some
sort of averaging or other calculation to be done?  Do you want the data
saved as PTVs or just in a table or some other format?

There are examples of WikiSh doing form validation at
http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#ButtonLink and
http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#PagesFromTemplate.  I'd
be happy to put together an example matching something approximating your
specifications if that would help...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Conditional markup with multi-line page variables

2008-06-30 Thread Peter & Melodye Bowers
> That works exactly as it should, but, if ShopList has a multi-line
> value, I still get the correct output for my shopping list, but it is
> preceded on the screen by the if statement, with ShopList expanded,

The (:if ...:) regex includes a [^\n]* when it is matching the condition
which excludes any newlines being part of your condition.  I messed around
with how that regex might be changed and ran into a problem where the regex
internal to scripts/stdmarkup.php has to be changed as well (needing an s
modifier, if you're interested).  At that point it became easier in my book
to switch over to something non-core, like nested-if.

Try this code in config.php:

===(snip)===
## (:if0:)/(:else0:)/(:if0end:)
$nestedifpat = "/( \\(:if-?(\\w)\\s*\\b(.*?):\\)
 ((?:
(?:(?!\\(:(?:if|else)).)+
|(?R)
 )*?)
 (?: \\(: (?:else-?\\2) \\s* :\\)
   ((?:
  (?:(?!\\(:(?:if|else)).)+
  |(?R)
   )*?)
 )?
 (?: \\(: (?:if-?\\2-?end) \\s* :\\) )
)/seix";
Markup('nestedif', '>if', $nestedifpat, "CondText3(\$pagename, PSS('$3'),
PSS('$4'), PSS('$5'))");

function CondText3($pagename, $condspec, $condtext, $elsetext) {
  global $Conditions;
  #echo
"condspec=$condspec\ncondtext=$condtext\nelsetext=$elsetext\n";
  if (!preg_match("/^\\s*(!?)\\s*(\\S*)\\s*(.*?)\\s*$/s", $condspec,
$match)) 
  echo "ERROR: No Match on condspec \"$condspec\"\n";
  list($x, $not, $condname, $condparm) = $match;
  if (!isset($Conditions[$condname])) return $condtext;
  $tf = @eval("return ({$Conditions[$condname]});");
  if ($tf xor $not) return $condtext;
  else return $elsetext;
}
===(snip)===

And then use (:if0 ...:) instead of (:if ...:), (:else0:) instead of
(:else:) and (:if0end:) instead of (:ifend:).

Here's what my test source looked like:

===(snip)===
(:ShopList: Nuts
* bolts
* washers:)

(:if0 ! equal {$:ShopList} "":)
Shopping List:
*{$:ShopList}
(:else0:)
NO LIST
(:if0end:)

(:ShopList2::)

(:if0 ! equal {$:ShopList2} "":)
Shopping List:
*{$:ShopList2}
(:else0:)
NO LIST2
(:if0end:)
===(snip)===

The output looks like this:

===(snip)===
Shopping List:

* Nuts
* bolts
* washers 

NO LIST2
===(snip)===

Note that this is a modified version of nested-if designed to allow
multi-line values.  It seems to work fine in the quick tests I just ran...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] quirk with nested-if

2008-06-30 Thread Peter & Melodye Bowers
> > however, if i then stick (:include UDP.TestInclude:) into
> Site.SiteFooter,
> > and then load any page on the site, it malfunctions and spits out onto
> the
> > page part of the conditional (i.e. it doesn't execute it all):

OK, a different answer now that I've tested it.  I put nested-if in my
config.php and edited Site.PageFooter and it works fine (I use Triad skin).
Then I figured out where Site.SiteFooter is implemented (from
Cookbook/AllGroupHeader?) and put that on my site and it seems to work fine
with nested-if as well.  Could it be a skin-related issue...?  Or
interaction with another rule?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] quirk with nested-if

2008-06-30 Thread Peter & Melodye Bowers
> however, if i then stick (:include UDP.TestInclude:) into Site.SiteFooter,
> and then load any page on the site, it malfunctions and spits out onto the
> page part of the conditional (i.e. it doesn't execute it all):

When PM decided to put the (:if0 ...:) as a div-like feature into core I
stopped looking at Nested-If and haven't looked at it since...

(Incidentally, are features like this available in some development version
of PmWiki or from SVN or something like that?  I was looking for something
the other day and couldn't find any version since 2007, but I probably just
don't know where to look...)

However, it sounds like this is an issue of the order of rules being
evaluated.  I just pulled up a page and put ?action=ruleset on the end and I
see that the if markup rule (to which nested if is tied) occurs BEFORE the
nogroupfooter and the nogroupheader rules.  This seems to suggest that
perhaps conditionals are evaluated before headers and footers are brought
in?

Perhaps if you change the 2nd argument of the nested-if to something later
like '>directives' or something like that it might work?

However, this seems a bit strange to me, because I can't imagine that the
standard (:if:) wouldn't work in headers and footers... ?!?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Problem with $SearchPatterns

2008-06-29 Thread Peter & Melodye Bowers
> One last question: I understand that the ! is the exclude parameter, but
> I didn't find if I have to use \\ or \ behind my group?
> What's the difference between \ and \\ ? Are both wildcards? In my case
> it works and it does not find content which is e.g. in Group P0035, but
> I would like to understand it 100% ;-)
> Is there an explanation article around which explains ^, \ ?

As Petko has already documented and very helpfully explained, you're dealing
with regular expressions here.

What is not documented anywhere that I see with regard to $SearchPatterns is
that simple wildcards work fine as the values for $SearchPatterns
(optionally prefixed with a - or ! to make it an exclusive pattern rather
than an inclusive one.)

So the following 2 sets of lines are functionally identical:

 $SearchPatterns['default'][] ="/^(De|CRM|FAQ|Glossar)\\./"; # allowed
 $SearchPatterns['default'][] ="!^P.*\\.!"; # excluded

Or

 $SearchPatterns['default'][] ="De.*,CRM.*,FAQ.*,Glossar.*"; # allowed
 $SearchPatterns['default'][] ="-P*.*";  # excluded

While regular expressions are incomparable in terms of their pure power, the
wildcards in the second set of examples are a lot more readable for most...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Block Public Access to Specific Pages?

2008-06-13 Thread Peter & Melodye Bowers
> Is it possible to have a specific page require a password for display?
> Assume the whole site is set to require a password for editing.  I've
> poked around in the "Security" area of the wiki, to no avail.

http://www.pmwiki.org/wiki/PmWiki/Passwords

You're looking for read passwords.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] WikiSh - check string length

2008-06-08 Thread Peter & Melodye Bowers
This is an easy mistake to make and one I make often as well.

 

The "if" construct expects a valid MX command which in this case should be
"test".  Thus {(wikish if ${#word} -gt 10.)} should be {(wikish if test
${#word} -gt 10.)}.

 

I've placed on the development roadmap to give a helpful error message if a
non-MX token is found immediately after if.

 

-Peter

 

  _  

From: adam overton [mailto:[EMAIL PROTECTED] 
Sent: Sunday, June 08, 2008 11:46 AM
To: pmwiki-users
Cc: Peter & Melodye Bowers
Subject: WikiSh - check string length

 

 

and one more WikiSh question while we're at it:

 

and again, i'm not understanding why this won't work - i want to check the
length of a string, and if it's too long, i'd like to print something
different out... this is what i had hoped would work:

 

  {(set -s word = "blammo")}

  result: {(wikish if ${#word} -gt 10; then; echo "string too big";
else; echo "string just right"; fi)}

 

however, the result i get is

 

  result = {#word} -gt 10)

  string too big

 

 

any ideas on how i can get the string length to be treated like a number and
then successfully pushed thru the if statement?

 

thanks

adam

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] more WikiSh noob

2008-06-08 Thread Peter & Melodye Bowers
My mistake here.  I will release later tonight with a fix for this problem.
I simply neglected to allow for the fact that '0' is equivalent to a Boolean
false so it never tried to calculate a substring.

Let me know if the new release does not fix the problem.

-Peter

> -Original Message-
> From: adam overton [mailto:[EMAIL PROTECTED]
> Sent: Sunday, June 08, 2008 10:43 AM
> To: pmwiki-users
> Cc: Peter & Melodye Bowers
> Subject: more WikiSh noob
> 
> hi there
> i'm wondering why:
> 
>   {(set -s blam = "darnit")}
>   {(wikish echo "${blam:1:4}")}
> 
> ... spits out "arni" (which is correct)
> but
> 
>   {(set -s blam = "darnit")}
>   {(wikish echo "${blam:0:4}")}
> 
> ... spits out the whole string: "darnit", instead of "darn"
> ??
> am i doing something wrong?
> adam



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Markup or method to increment/decrement a PTV ("integer") variable?

2008-06-05 Thread Peter & Melodye Bowers
> Subject: [pmwiki-users] Markup or method to increment/decrement a PTV
> ("integer") variable?
> Does it exists? How could it be done?
> Kind regards,

Do you want to change the value temporarily or permanently?  Is it just for
this load of the page or are you wanting to save it back to the page so it
will load in its incremented state the next time as well?

If you just want to increment it temporarily for this load then WikiSh
contains that functionality with the {earlymx(set --ptv ...)} capability.

If you want to save the value back to the page then you're probably going to
have to come up with a quick function to do it yourself.  If you're
interested I have recently put together a "toolbox" recipe (toolbox.php)
which is still under development but it has a function writeptv() which
would make this job very easy.  It's not yet documented on the cookbook
page, but the arguments are fairly self explanatory.  This is basically what
it's going to look like for your functionality:

Function incptv($pagename, $pn, $varname)
{
   $val = PageTextVar($pn, $varname);
   $val++; // or $val--;
   writeptv($pagename, $pn, $varname, $val);
}

Then depending on what your desired functionality is you could wrap that in
an MX or some other markup or just have it in your config.php, etc.

Here's a markup definition of (:incptv page varname:) :
Markup('IncPTV', 'inline', 
'/\\(:incptv\s+(\S+)\s+(\S+)\s*:\\)/e',
'incptv(\$pagename, "$1", "$2")');

Note this has a bunch of copy/pasted sections of code without any compiling
or testing.  There will certainly be some fixes needed before any of this
will work.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] WikiSh noob - -gt & -lt

2008-06-05 Thread Peter & Melodye Bowers
The various control flow elements (conditionals, looping, etc.) within
WikiSh are implemented as part of the {(wikish .)} MX rather than being
individual MXes themselves.  Thus {(if test .)} is undefined as far as
WikiSh is concerned.  It needs to be {(wikish if test .)}

 

While developing your solution you will probably find the control panel to
be *very* helpful.  It allows you to type this:

 

if test 3 -gt 4

then

   echo YES

else

   echo NO

fi

 

And it will convert it to {(wikish if test 3 -gt 4; then; echo YES; else;
echo NO; fi;)} and show you the results.

 

If you'd like to explore other options I'm pretty sure you could fairly
easily (?) expand (:if .:) functionality to include a > or < comparison
using the $Conditions array.  I've never done it, but looking at the setting
for "equals" in pmwiki.php I think you could expand it like this:

 

$Conditions['gt'] = 'CompareArgs($condparm) > 0';

$Conditions['ge'] = 'CompareArgs($condparm) >= 0';

$Conditions['lt'] = 'CompareArgs($condparm) < 0';

$Conditions['le'] = 'CompareArgs($condparm) <= 0';

 

Or something like that.  Others who have worked with this $Condition
variable can give a more exact answer.

 

-Peter

 

  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of adam overton
Sent: Monday, June 02, 2008 1:34 PM
To: pmwiki-users
Subject: [pmwiki-users] WikiSh noob - -gt & -lt

 

 

 

hi

i'm trying out WikiSh for the first time

and am wondering why both

 

 

{(if test 3 -gt 4; then; echo YES; else; echo NO; fi)}

 

&

 

{(set Num1 = 3)}

{(set Num2 = 4)}

{(if test ${Num1} -gt ${Num2}; then; echo "YES"; else; echo "NO"; fi)}

 

 

spit out "3" instead of NO?

 

btw, is WikiSh my only option if i just want to do a > or < operation?

thanks,

adam

 

. . .

 

[EMAIL PROTECTED]

661 373 8679

 

 

 

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] calculation with time

2008-06-05 Thread Peter &amp; Melodye Bowers
> Currently I save this in unix time so I can do math operations very
> easily. Unfortunality it isn't a proper format to write time in a form
> field.

If you want the user to enter it then you are right.  However, if it's just
a display issue then strftime() should handle it nicely, right (as you've
already done with your {(timefmt ...)} MX)?  Storing in unix time gives much
greater flexibility and reliability than any other format...

> Does you know of a function that can translate date/time back to unixtime?

I haven't tried it, but strtotime() looks like it might be able to handle
it...?

-Peter 


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] calculation with time

2008-06-05 Thread Peter &amp; Melodye Bowers
If you are talking about in the underlying PHP:

> if "current time" < "current time"-"two weeks"

If (time() < (time() - (2 * 7 * 24 * 60 * 60)))

> if "current time" < "current time"-"two hours"

If (time() < (time() - (2 * 60 * 60)))

> if "current time" < "current time"-"two minutes

If (time() < (time() - (2 * 60)))

Obviously none of these will ever be true since you've specified "current
time" as both sides of the comparison, but I'm assuming that the left side
of the comparison will be some value that you will store in a variable or
something.

Seems like strftime('%u') would give similar capabilities but maybe not on
all platforms (this is available via MarkupExpression if you are doing this
within markup instead of at the PHP level)?  

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] links with mouseover titles

2008-05-28 Thread Peter &amp; Melodye Bowers
> Hans wrote:
>
> Actually, just checking the code, [[target | text |: tooltip:]] is
> evaluated before 'if' conditional markup (to allow conditionals in
> tooltips). Perhaps that does give you  a hint why it is failing.
> 
> The extra markup is being rendered before that. You could possibly
> change all these, to make it comply with (:wikilist:).

Sure enough.  I changed the order of the extra markup you gave me to
'>wlist' and that solved the problem.

It now looks like this:
===(snip)===
Markup('[[~|:+:|','>wlist',
  "/(?>\\[\\[~([^|\\]]*)\\|:)\\s*(\\+)\\s*:\\]\\]/se",
  "Keep(ToolTipLink(\$pagename, PSS('Profiles.$1'), PSS('$1'),
 PageVar(MakePageName(\$pagename,
PSS('Profiles.$1')),'\$Title'),''),'L')");
===(snip)===

Thanks!

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] links with mouseover titles

2008-05-28 Thread Peter &amp; Melodye Bowers
Is there any recipe which will give me capability of using a normal link
(without title) but when the user hovers their mouse over it then it would
give the real title?

I'm wanting to use short links to profile pages in a wikiform application so
they need to fit in a relatively narrow column.  But I want the capability
of people hovering over the link and seeing the title.

More clearly, I want to enter [[~SCB]] (or [[~SCB|^]] or something) in the
field (not [[~SCB|+]]) and then when I hover my mouse over that link I would
like to see "Stephen's Center Bookstore".

Any possibilities?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] WikiBox: assuming identity/authorization for a remote user

2008-05-27 Thread Peter &amp; Melodye Bowers
I need some input from the group while I am in the process of developing
WikiBox.  

Briefly, an idea of what the WikiBox recipe will do: 
The idea of this recipe is to allow people to access a pmwiki site by email
(either updating pages or retrieving pages or some other administrative
tasks).  They send emails in which the subject is a "command" ("append onto
[[Test.Foo]]" or "get [[Test.Foo]] source" or etc) and the body of the email
provides the text to update as well as various forms of validation.  

Now, my problem.  The user making the change or reading the page is remote -
they are not logged in.  Thus there is no $AuthList, $AuthId, etc. to use as
security to check whether he should be allowed to read that page or update
that page.  (Those identity/authorization values will by default be
whoever's process I am "piggy-backing" on via register_shutdown_function()
or an administrator doing moderating via a forms interface.)  I *could* just
bypass PmWiki security and completely replace it with a separate layer, but
I would really much prefer to build another layer of security ON TOP of
existing PmWiki security rather than replacing it.

My thought was to save off the values of $Author, $AuthList, $AuthId, and
$AuthPw (others?) at the moment when a user subscribes to WikiBox.  These
values would be stored in SiteAdmin.WikiBoxEmailAuth (in a somewhat
obfuscated manner although it's a given that if WikiBox can un-obfuscate
them and we're dealing with open source then an unkind administrator could
also see actual passwords).  These values would then be read for the given
email and that would then be their authorization level for all email
actions.

I *believe* I can get it to work, but I'm not sure it's a good idea.  I
would appreciate some feedback before I spend too much time (although the
last 4 hours analyzing PmWikiAuth(), SessionAuth(), and IsAuthorized() is
enough to already give me some grey hairs... :-) ).

(1) Does the idea of storing decrypt-able passwords on a page just sound
horrendous, even if it's in the SiteAdmin group?
(2) If that sounds mildly excusable, are there other variables you can think
of that I would need to save off and replace while processing for a given
remote user to completely assume that user's identity & authorization
levels?  I'm wondering about $_SESSION[] values in particular and (this may
be the impossible one) the static $acache in PmWikiAuth().  Are there any
other pitfalls I need to be aware of?
(3) Would I be better establishing a single "default user" for WikiBox and
having that user set up in config.php so it's not available to others?
Question #2 still stands (how do I assume the identity & authorizations of
that default user), but it would bypass the concerns of #1.  Unfortunately
it would be at the expense of no longer having equivalent authorizations as
a remote user as with a local user...

In any event I am implementing an additional layer of security which will
allow administrators to limit which pages/groups can be read/edited by
WikiBox, so this capability will be there.  I've just really been pushing
hard to get the full "assumed identity" capability and before I actually
begin coding it I wanted to get some thoughts from this group...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Silly, silly newbie question - Table of Contents

2008-05-26 Thread Peter &amp; Melodye Bowers
The list=normal gets rid of pages like RecentChanges, AllRecentChanges,
GroupFooter, PageFooter, etc.
 
-Peter


  _  

From: Jesse Reisman [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 26, 2008 3:07 PM
To: Peter & Melodye Bowers
Cc: pmwiki-users@pmichaud.com
Subject: Re: [pmwiki-users] Silly, silly newbie question - Table of Contents


The first still gave me everything (to include the default wiki stuff) but
the second was just what I was looking for and works perfectly. Many thanks
:)


-j

On Sun, May 25, 2008 at 11:54 PM, Peter & Melodye Bowers <[EMAIL PROTECTED]>
wrote:


Try (:pagelist list=normal:) to exclude all the stuff you usually don't want
to see.
 
I believe you can also explicitly exclude multiple groups like this:
 
(:pagelist group=-pmwiki,-groupa,-groupb,-groupc:)
 
-Peter


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jesse Reisman
Sent: Sunday, May 25, 2008 10:43 PM
To: pmwiki-users@pmichaud.com
Subject: [pmwiki-users] Silly, silly newbie question - Table of Contents


I'm trying to get a "table of contents" type page up. I have the groups (I
think I created them correctly by creating the links as Item.baseball,
Item.baseball_bat, Location.Dugout, Location.Pitchers_mound, etc.) and I can
get a full pagelist but I'd like to omit the PmWiki, recently updated, etc.
pages (i.e. the ones that are more of the wiki system pages instead of the
content I've created.) I'm not very good with regular expressions (I think
those are what the samples are using) and can't figure our what to do.  I've
successfully eliminated a single internal page with (:pagelist
group=-PmWiki:) but can't figure out if I can add multiple exclusions to the
"group" variable.) Any help is really, really appreciated. Thanks! :) 


-j


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Silly, silly newbie question - Table of Contents

2008-05-25 Thread Peter &amp; Melodye Bowers
Try (:pagelist list=normal:) to exclude all the stuff you usually don't want
to see.
 
I believe you can also explicitly exclude multiple groups like this:
 
(:pagelist group=-pmwiki,-groupa,-groupb,-groupc:)
 
-Peter


  _  

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jesse Reisman
Sent: Sunday, May 25, 2008 10:43 PM
To: pmwiki-users@pmichaud.com
Subject: [pmwiki-users] Silly, silly newbie question - Table of Contents


I'm trying to get a "table of contents" type page up. I have the groups (I
think I created them correctly by creating the links as Item.baseball,
Item.baseball_bat, Location.Dugout, Location.Pitchers_mound, etc.) and I can
get a full pagelist but I'd like to omit the PmWiki, recently updated, etc.
pages (i.e. the ones that are more of the wiki system pages instead of the
content I've created.) I'm not very good with regular expressions (I think
those are what the samples are using) and can't figure our what to do.  I've
successfully eliminated a single internal page with (:pagelist
group=-PmWiki:) but can't figure out if I can add multiple exclusions to the
"group" variable.) Any help is really, really appreciated. Thanks! :) 


-j

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] page inclution problem

2008-05-22 Thread Peter &amp; Melodye Bowers
> So is there a way that I get the page included even if I use anchors?

It works for me without any problems.  See 

http://www.ccl-al.org/pmwiki/pmwiki.php?n=Test.Include

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Protecting text from ROS/ROE

2008-05-20 Thread Peter &amp; Melodye Bowers
I use the E-Protect recipe to allow email addresses to be obfuscated.
However, I have to explain to users with no experience how to create a
[[mailto:[EMAIL PROTECTED] link.  E-Protect changes this to look like
[[hidden-email:[EMAIL PROTECTED]  So if I put in a comment like this in a
template page:

(:comment please enter your email below in the form
[[mailto:[EMAIL PROTECTED] :)

Then when someone comes in to look at it they see this:

(:comment please enter your email below in the form
[[hidden-email:[EMAIL PROTECTED] :)

Which obviously is not too helpful.  Any ideas how I can protect some text
from ROS/ROE patterns at the source level?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Fox mail features: feedback invited

2008-05-19 Thread Peter &amp; Melodye Bowers
> > I don't know if Pm ever added the pop3 mail checking capabilities...
> > [...]
> > ...you could have your site actually process some of the bounced
> > mail to keep your lists clean
> 
> Does it help?
> http://www.pmwiki.org/wiki/Cookbook/WikiBox

I certainly welcome anyone testing this out, but just remember that the
status ("testing prior to alpha") should be taken literally.  I just
uploaded it yesterday and the "to-do" list is still longer than the "done"
list...  I'll make a formal announcement when I move it to alpha status.  It
works now insofar as the functionality I've documented (retrieve pop3 email
and have the plaintext body replace/append/prepend/insert into a given
page), but probably most people will want to wait for attachment support and
some level of validation/security before putting it on a live system.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Session difficulties

2008-05-15 Thread Peter &amp; Melodye Bowers
Does anybody have any idea why this code:

===(snip)===
\n"; 
$_SESSION["foo"] = $s; 
echo "AFTER: " . $_SESSION["foo"] . "\n";
}
===(snip)===

With the (:setsess 111:) on Page1 and (:setsess 222:) on Page2 would result
in this on the FIRST entry into Page1:

===(snip Page1)===
BEFORE:
AFTER: 111
===(snip)===

And this on every other browse of Page1 or upon browsing Page2:

===(snip Page2)===
BEFORE: 111
AFTER: 111
===(snip Page2)===

Note the "AFTER" value on Page2 even though Page2 explicitly set it to 222
-- once the value is set on page1 then it never gets changed again...

Any ideas?  It works on other servers so I'm thinking it's a setup issue,
but I don't have a clue where to look...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Farms: per-wiki config

2008-05-11 Thread Peter &amp; Melodye Bowers
> Is it possible for skins and other per-wiki configs to be managed (ie 
> changed) by each wiki's individual admin via a passworded web interface?

It's still more a proof-of-concept and needs more thought/design and lots
more testing, but check out this new recipe:

http://www.pmwiki.org/wiki/Cookbook/PageConfig

As a markup-based method of solving the problem listed above.

Instead of having an administrator use FTP or command line to edit
config.php to place this:

===(snip)===
include_once('cookbook/foo.php');
if ($pagename == 'MyGroup.Xyz') {
   include_once('cookbook/bar.php');
   $Bar_Var = 23;
}
===(snip)===

An author/administrator with edit privileges to SiteAdmin.PageConfig can now
place this markup on that page to do the same thing:

===(snip)===
include(foo.php)
(:if name 'MyGroup.Xyz':)
   include(bar.php)
   set(Bar_Var, 23)
(:ifend:)
===(snip)===

-Peter

FUTURE THOUGHTS -- INPUT WELCOMED...

Eventually I will include a security configuration variable like 

$PCValidIncludes = array('foo.php', 'bar.php')

As a way to limit what PHP scripts can be included.  (Or maybe use a
"PageCookbook" directory as an alternate to the standard "Cookbook"
directory with links back to Cookbook?)

Maybe something similar for variables:

$PCValidGlobals = array('foo' => '/[0-9]*/', 'bar' =>
'/"(?:abc|def)"/')


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Copy and paste do not work properly with MS office 2007

2008-05-08 Thread Peter &amp; Melodye Bowers
> What browser are you using?  Can you identify exactly what
> text you're attempting to copy and paste so I can try to duplicate
> the problem on my system?

I can confirm that on Frank's link (below) using FireFox 2.0.0.14 and MSWord 
2003 when I copy/pasted the first text below it messed up the order of words in 
the sentence.  When I copy/pasted it into my text editor (gvim) the order of 
the text is maintained. 

When I viewed source and copy/pasted the whole page into my local system the 
problem goes away.  

All quite mystifying to me.  For those of you who haven't looked at the page 
there are all kinds of special characters littered around.  Lots of  and 
 and % and [ and  and stuff like that.  I note in particular that 
double-quotes are not converted into smart-quotes and that seems to be the 
character around which the first issue revolves.  The 2nd issue revolves around 
the % at the beginning of the line...

Here's some of the HTML source surrounding each problem:

===(snip)===
<<< 
 
 
The Library should help to let all studens feel as one the p[ecknology and 
the personnel. No question is too small or no challange too big. A respect for 
all and ideas and  "things" shared.Free access to faculty . The Library shoud 
be in on all new ideas and have access to the newest technology at close hand. 
A free exchange of feelings and ideas .
===
 
===(snip)===
(The paragraph starting "The Library" is all one line in the HTML source)

===(snip)===
===
<<< 
>
>> 
%study .looking for books .  looking for dvds.
===
>>> 
>>> 
<<< 
===(snip)===

I think the next step is to simplify the page until you are down to a minimal 
example that reproduces the issue.  (I.e., cut the first half of the page, then 
half of what remains, etc and check after each edit to make sure that the 
problem continues -- when the problem goes away then paste back the 
just-deleted text and delete the other half and by means of this method try to 
get it down to just a few lines with the problem reproduced.

-Peter

> > >>> "Frank Scaturro" <[EMAIL PROTECTED]> 5/6/2008 7:38 AM >>>
> > 
> > Sorry, I forgot to include the web page that this is 
> happening on. The first problem (ideas and "things"...) is 
> near the bottom of this web page:
> > http://web.adelphi.edu/fs/index.php?n=Main.APLACEWHERE 
> > >
> > > Copy and past does not seem to work with this line of text
> > >  ideas and"things" shared.Free access to faculty . 
> > > 
> > > I get this when I past it into MSword...
> > > "things" shared.Free access to faculty .ideas and
> > > 
> > > ___
> > > SAME THING...for this...
> > >  %study .looking for books .looking for dvds. 
> > > 
> > > turns out to be
> > > looking for dvds.looking for books .%study .


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] how to use WikiForms

2008-05-07 Thread Peter &amp; Melodye Bowers
 >  where do i put the form definition?  (like in the sample code from the
WikiFormSample page)  
 
See http://www.pmwiki.org/wiki/Cookbook/WikiForms immediately following the
"Discussion" header. 
 
> what's the name of the page/link the users than use to create pages? 
 
You create your own link on any page you like using (:wikiform:).  This is
documented on  http://www.pmwiki.org/wiki/PITS/00756 (referenced at the
bottom of the main page listed above.  This page should be considered
required reading for WikiForms.
 
If you want to look at a live example using WikiForms feel free to check out
http:// 
www.ccl-al.org/pmwiki/pmwiki.php?n=Alb.BookCatalog.  NOTE THAT IS LIVE -
please do not add/delete any pages nor make any changes to data.  Use
?action=source to view things to avoid making unintentionaly changes.
 
-Peter
___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] cookbook security advide needed

2008-05-06 Thread Peter &amp; Melodye Bowers
> What is the best way to prevent submitting malicious code like 
> javascript. Is there a standard or  common used filter function for 
> that.  The filter should accept the css syntax bot nothing 
> more. Example:
> 
> #123456
> 1px solid red
> 0.8em
> url(http://domain.net/img.jpg)

It's kind of "brute force" and lacking elegance, but something like this
might be a start in the right direction:

===(snip)===
$ValidCSSPatterns = array('/#[0-9]+/', '/[0-9]+px\b/', '/\bsolid\b/',
'/\bred\b/', '/\b[0-9.]+em\b/', '/\burl\(http:[a-zA-Z.\/0-9-]+\)/');
$Result = trim(preg_replace($ValidCSSPatterns, '', $TextFromMarkup))
If ($Result) // if anything is left after stripping all valid CSS
   echo "ERROR - this CSS was not valid: $Result\n";
Else {
   (process the $TextFromMarkup, feeling fairly confident that it's valid
CSS)
}
===(snip)===

Obviously the difficulty is to get a fairly complete "definition" of CSS in
an array of regexes.  Sounds kind of daunting...  On the other hand you
probably (?) don't need *all* of CSS and presumably could handle 80% of use
by getting the 20% of most common syntactical terms...?  I'm really out of
my element with CSS so I can't say, but this is *a* way that the problem
could be approached.

-Peter

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] New Recipe: EditMX

2008-05-04 Thread Peter &amp; Melodye Bowers
>> I wondered if you might want to do an ROE (replace on edit) cousin?
>>
>> http://www.pmwiki.org/wiki/PmWiki/EditVariables#ROEPatterns
>>
>> (useful for first time page load of templates, I would think).

Henrik had an excellent idea of extending this to the $ROEPatterns as well,
so I've released EditMX (http://www.pmwiki.org/wiki/Cookbook/EditMX) again
with this ROE capability. 

Note the slight change in the installation instructions so that template
editing will be effective.

This new capability gives the capability for any Markup Expression to be
used as a sort of "macro" in your templates, making them dynamic templates
instead of static templates.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] New Recipe: EditMX

2008-05-04 Thread Peter &amp; Melodye Bowers
http://www.pmwiki.org/wiki/Cookbook/EditMX

This recipe is of primary use to relatively experienced authors who want to
leverage the computer to make the most of their time.  It provides a way for
an author to use MarkupExpressions as ROS (Replace On Save) patterns, thus
inserting the return value of the MX as text/source in the page being
edited.

Basically you insert an MX into your text but you use the special "ROS" text
as part of the MX markup:

   {ROS(MX-command)}

The command will be replaced in your actual source by the results of the
MX-command when you save.

It's not the kind of thing you'll use on a daily basis and anything you can
do here could be done just as well with copy/paste and putting a little more
work into your editing.  What can I say?  I'm lazy and I want the computer
to do my work for me... :-)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Value saved in $_SESSION is inconsistent

2008-05-01 Thread Peter &amp; Melodye Bowers
When I started saving semi-permanent information in my session I was
prepared for all kinds of complications and a steep learning curve.  I
found, to my pleasant surprise, that all I had to do was make an assignment
to the $_SESSION[] array and it would automatically be saved from one
page-load to another.  

Time passes.

Now someone else is using my code and finding that variables saved like that
are only sometimes "sticky" and other times the assigned value disappears on
the next page-load.

Did I just get lucky in my personal testing environment and my web-site?
Are there settings that control this?  Is there some step I should be doing
besides simply assigning a value to the $_SESSION variable?  I checked and
the system with the problem does keep authorizations from one page-load to
another, so I don't think it's something as simple as not having the right
session directory or something...

Since it works fine on my system it makes it much more difficult to debug -
that's why I'm appealing to the list for any insights you can give me...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Formatting in lists

2008-04-30 Thread Peter &amp; Melodye Bowers
> My problem here is that the blipp blipp item starts with 1 
> instead of continuing with n+1. Is it not possible to have 
> source block like this in a list or am I missing something.

http://www.pmwiki.org/wiki/PITS/00194 - Petko has a solution that might help
you.
http://www.pmwiki.org/wiki/PmWiki/ListStyles - how to specify a restart
value after the pre block (%item value=n%)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] InitialPasswords

2008-04-30 Thread Peter &amp; Melodye Bowers
>How can I set a complete site back to "Initial passwords" as they are at
installation time.
>That is: clear all special passwords related to pages, groups, etc. that
have been added by different users.
 
To get rid of page-specific passwords you've got to get rid of lines in any
page-file (wiki.d/MyGroup.MyPage) that start with "passwd" -- i.e.,
passwdedit=encryptedvalue, passwdread=encryptedvalue, etc.
 
(I just tried this on a test page and it successfully got rid of the
password -- whether it has other undesired side effects I don't know.)
 
If you are on a linux-based host you could do it on the command line like
this:
 
(untested)
$ cd wiki.d
$ grep -l '^passwd' * | xargs sed -i '/^passwd/d'
 
or, if you don't have command line you could do the same sort of thing with
WikiSh in the Control Panel:
 
(untested)
grep -l '^passwd' TEXTFILE--wiki.d/* | while read fn
do
   grep -v '^passwd' TEXTFILE--${fn} >TEXTFILE--${fn}
done
 
Either of these are kind of "big" and non-standard automatic edits, so
obviously appropriate care should be taken in backups and etc. ahead of time
and validating the change before accepting it straight-out.
 
It would be safer to simply use grep to identify which pages have a
page-specific password and then go in and manually remove them...  This
could be done with this MX on any page:
 
{(grep -l '^passwd' TEXTFILE--wiki.d/*)}
 
If your site is too large to process in one fell swoop you may need to break
it down into groups or something in the wildcard specification.
 
-Peter
 
___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] restrict page creation to contain some necessary fields

2008-04-29 Thread Peter &amp; Melodye Bowers
> (1) guest users should be only allowed to add pages with some 
> fixed parts 
> (like categories for country, etc). i do know hoe to restrict 
> theer editing 
> to a group, but in this group they can create whatever page 
> they want. 
> however i need to force/guide users to create pages 
> containing fixed fields. 
> how can i restrict user to this?
> 
> (2) and how can i give them a set choice for the country 
> field via drop down 
> or so?

Some possible options, in order of difficulty from easiest to most difficult
(?):
(1) Create templates for the group so when they go to edit they have a
template to fill out.  They can erase the template if they choose to do so,
but at least you've got a better chance of having more consistently
formatted pages.
(2) WikiForms would give you a database-like ability to create pages with
limited fields and you can define what you want to appear (like a drop-down
for country, etc.)
(3) You could code your own using something like Fox
(4) You could code your own using out-of-the-box pmwiki forms

It may be that the fox solution would be easier than the wikiforms - not
sure on that.

Based on your brief description I would probably lean towards wikiforms.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Ticketing system

2008-04-28 Thread Peter &amp; Melodye Bowers
> Is there a ticketing system/helpdesk recipe for pmwiki? If not, is
> there an Open Source one which anybody can recommend which might even
> integrate with pmwiki? 

Although WikiForms has much broader application it appears from most
examples in the documentation that it was initially planned in this
direction.  Definitely worth a 2nd look.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Custom markup - where to begin?

2008-04-26 Thread Peter &amp; Melodye Bowers
> +   Where can I find the documentation for how to write one? I 
> tried finding
>  something but apparently didn't manage to find it.

This is a question which causes difficulties because it's hard to put a
boundary around the answer.  I'll try to be brief with the understanding
that there are others out there with a much broader understanding of all the
ways a "plugin" can occur in PmWiki.

The most typical kind of "plugin" (I'll call it a "recipe" from here on out
because that's how they're named in the PmWiki world) is to establish some
kind of markup.  This means you are creating some particular "pattern" of
text in your page which will cause some action and cause that particular
text to be replaced with something else.

You're on the correct page at PmWiki/CustomMarkup to read more about this.
Basically creating a new markup involves first (and perhaps only?) a call to
the PHP Markup() function (usually in your config.php, but alternately in a
custom group or custom page PHP file -- you can read about those at
http://www.pmwiki.org/wiki/PmWiki/LocalCustomizations).

This Markup() function takes 4 arguments:

1: The arbitrary name you are going to give your new markup.  It should be
short but descriptive.  Be careful you don't use the same name as another
markup out there or that markup will no longer be active.  (You can see most
markup definitions in scripts/stdmarkup.php.)  An example for you might be
"MyPics" or "ApertureTags" or something that refers to how the pattern of
text might look - it's arbitrary, so it's your call.

2: An indicator of WHEN you want this to occur.  PmWiki has dozens of these
markup rules and it makes a big difference in what order they occur.  If one
markup rules (#1) changes all occurrences of "a" into "b" and another markup
(#2) changes all occurrences of "az" into "zz" it obviously makes a big
difference in what order they occur.  If #1 occurs before #2 on the text
"azazaz" then you will end up with "bzbzbz".  But if #2 occurs before #1
then you will end up with "zz".  This argument is normally specified as
a left-angle bracket ("before") or a right-angle bracket ("after") followed
by the name of another rule.  In my experience the most significant rule in
terms of ordering is "{$var}" which substitutes variables -- if you say
"<{$var}" then your markup will be processed before variables are
substituted whereas if you say ">{$var}" then your markup will be processed
after variables are substituted.  But there are lots of other places in the
whole order of rules -- someone else will have to go into more detail if you
need it.  That CustomMarkup page gives some good pointers there.

Arguments 3 and 4 are simply arguments which will be passed to preg_replace.
You search for argument #3 and you replace it with argument #4.

3: This is a regular expression.  It can be as simple as "/a/" (match every
occurrence of the character "a") up to very complicated and intricate
patterns.  Every time this pattern matches in your text it will be replaced
with argument #4.  Note that your pattern is always surrounded by forward
slashes and there can be modifiers after the closing forward slash.  These
modifiers are single characters which you can read more about them at
http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php.  The key
ones are "i" (ignore case), "s" (allow dot to match newlines), "m" (allow ^
and $ to match before/after newlines as well as begin/end of strings), and
[perhaps most importantly in this context] "e" (evaluate the replacement
text as a PHP expression - this allows you to call functions to do much more
complicated things than a simple search/replace).

4: This is the replacement text.  It can be a simple string or it can
include things like $1, $2, etc if you have parenthesized groups in argument
#3 (you've got to be careful to put backslashes in front of the $ or else
surround it in single-quotes, etc to delay the interpolation of those
variables).  Or it can be a call to a PHP function if you included the /e
modifier in argument #3.

Having said all that, the single best way to learn how to write your own
recipe or markup is to look at examples of what other people have done.
Start with something simple and just try to figure out what it's doing.
Then save it off (!) and change it in some way to see how it changes things.
Then move off into your own stuff (although probably most recipe authors
routinely start with some other similar recipe and modify it -- if for
nothing else than to save the typing!)

This may be way too basic or it may be way too theoretical, but hopefully
it'll help get you started in the right direction.

I would be happy to add this to the PmWiki/CustomMarkup page if I were
fairly confident that someone with broader PmWiki experience would go in and
correct my oversights and errors that I'm sure I've made here...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud

Re: [pmwiki-users] Indenting an entire table to line up with text.

2008-04-24 Thread Peter &amp; Melodye Bowers
>>  1. as a wikistyle - put 
>> $WikiStyle['indent2']['margin-left'] = '80px'; to your config.php
>>  
>>  or
>>  
>>  2. as a CSS style - put .indent2 { margin-left:80px; } 
>> to your CSS (pmwiki.css or other file depending on your skin)
>>  
>>  I prefer second option.
>>
>Thank you.  The "... class=indent ..." worked and helps!  
> However, I have no clue how to "add a class" and a 15 minute 
> effort searching the PmWiki mail archives and PmWiki 
> documentation rendered zero useful information.  

I, too, have watched with amazement and envy (wink) as people have solved
problems with CSS.  It seems to be some kind of black box which those who
have the key are able to do marvelous things with...

Would it be possible for some of you in possession of this "key" to put
together a cookbook page with just some brief practical examples of how to
use CSS (Cookbook/Styles, perhaps)?  The examples would need to start at a
pretty basic level (i.e., "look for the pmwiki.css file in the
pub/skins/pmwiki directory and look for the line that looks like this and
add a line underneath" kind of thing).  I'm not thinking a 20-page tutorial,
but rather some practical examples (indenting a table, etc) with brief
explanations of things that can be accomplished with these styles...

A 20-minute "making a copy of the key" would be invaluable to those of us
keyless (clueless?) ones...

Thanks!

-Peter

PS Within pmwiki.org there are some pages that provide valuable portions of
what I'm looking for.  A partial list:
http://www.pmwiki.org/wiki/Cookbook/OverrideCSS
http://www.pmwiki.org/wiki/Cookbook/CSSInWikiPages
http://www.pmwiki.org/wiki/Cookbook/WikiStylesPlus (I believe some of this
has moved into core?)
http://www.pmwiki.org/wiki/PmWiki/WikiStyles (Maybe this just needs to be
expanded?)

PPS Broadening my search outside pmwiki.org brought me these which are at
least a partial answer to what I was looking for, but I still think it ought
to be a cookbook...
http://etc.nkadesign.com/Programming/PmWikiCSS
https://cs.stanford.edu/doc/PmWiki/WikiStyles


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Look-and-feel

2008-04-24 Thread Peter &amp; Melodye Bowers
I am going to try to "sell" pmwiki to my faculty as a better way to handle
our whole web-site (rather than just an add-on wiki section) at an upcoming
meeting.  One of the most important issues for them is the "look and feel"
of it.  Understanding that this is a very subjective issue, would it be
possible to get a few examples of web-sites from you on this list -- those
sites that really have worked on the aesthetics side of things with pmwiki?

I would like to get at least a couple examples where it is "locked down" (is
that called a CMS?) rather than an open wiki.  Sorry about the whole
philosophy thing... ;-)

I'm definitely not going to increase traffic on your site or anything -- I'm
talking 4-5 people that will probably look at a few pages on each site just
to get an idea...

Probably easier to send me off-list rather than increase traffic on the
pmwiki-users list?

Thanks!

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Nested IF

2008-04-24 Thread Peter &amp; Melodye Bowers
> ...I'm now adopting this markup and approach as a PmWiki 
> CoreCandidate and planning to add it into the core.  I will
> probably try to do this today or over the weekend.  Others are 
> welcome to implement something like it in recipes, but just be 
> aware that PmWiki should have its own implementation soon 
> so it may be best to avoid conflicts.

I think there should be an award or something for the shortest-lived recipe
ever.  Good-bye, NestedIf... :-)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Nested IF

2008-04-24 Thread Peter &amp; Melodye Bowers
> Thursday, April 24, 2008, 2:24:43 PM, Peter & Melodye Bowers wrote:
> 
> > PS I don't think much of the way this looks in terms of being
> understandable
> > and intuitive.  ...
> 
> Would it be possible to create if markup similar to the div markup,
> which accepts digits after the 'if' which act as identifier, to help
> identify beginning and end of a conditional?
> Example:
> 
> (:if1 :)
>   ...
> (:if2 :)
>   
> 
> (:elseif2 :)
>   ...
> (:if2end:)
> (:elseif1 ...:)
>   ...
> (:if1end:)
> 
> This will make it much clearer from where to where a 'nesting' goes.

Would the number need to be prescriptive or just descriptive?  In other
words, if someone wrote (:if1 ...:) ... (:if2end:) then should there be an
error?  Or should it not match the markup at all (thus leaving it verbatim
without replacing anything)?  Or should the difference in numbers just be
ignored?

I like the idea of a number because it differentiates from a normal
if/else/ifend markup while still looking like "if" ("if0" looks more like
"if" than "nested-if" or the other options).  Also it does help since a
wiki-page doesn't usually allow for nicely indented code to help you find
your way through the nesting, so these numbers could be very valuable...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Nested IF

2008-04-24 Thread Peter &amp; Melodye Bowers
I don't know how often people have need for a nested conditional, but I've
put together a recipe that supports it.  You can find it here:

http://www.pmwiki.org/wiki/Cookbook/NestedIf

It uses markup in this form:

(:n-if true:)it is true(:n-if false:)it is false(:n-else:)it is not
false(:n-ifend:)(:n-else:)it is not true(:n-ifend:)

Or, placed on multiple lines and formatted for easier reading:

(:n-if true:)
   it is true
   (:n-if false:)
  it is false
   (:n-else:)
  it is not false
   (:n-ifend:)
(:n-else:)
   it is not true
(:n-ifend:)

All conditions are identical to the existing (:if ...:) conditions - same
code is used, so any extensions you've made should also work.

This is probably obvious, but just to be sure... Note that (:n-if:) does NOT
end the previous if-block as (:if:) does in normal pmwiki conditionals.

The "n-" prefix to each of the if, else, ifend can actually be several
different things:

n (:nif ...:)
n- (:n-if ...:)
nest (:nestif ...:)
nest- (:nest-if ...:)
nested (:nestedif ...:)
nested- (:nested-if ...:)

(I've illustrated each with the if, but the same prefixes can be affixed to
the "else" or the "ifend".)

Hope this helps.

-Peter

PS I don't think much of the way this looks in terms of being understandable
and intuitive.  (That's why I've offered so many alternatives - in hopes of
finding one that looks right.)  If somebody has a better idea on the markup
I'd be all ears...  The recipe could actually over-ride the existing (:if
...:) markup, but then most existing conditionals would have to be altered
and existing sites would be unable to use it.


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Markup for Page Text Variables

2008-04-24 Thread Peter &amp; Melodye Bowers
> Is it possible to either alter markup or create new markup 
> for PTV's. It would
> suit my purposes if I could define a PTV thus:
> PTV (Value)
> {$:PTV} would then display Value?

There is currently a definition of $PageTextVarPatterns like this in
pmwiki.php:

===(snip)===
$PageTextVarPatterns = array(
  'var:'=> '/^(:*\\s*(\\w[-\\w]*)\\s*:[ \\t]?)(.*)($)/m',
  '(:var:...:)' => '/(\\(: *(\\w[-\\w]*) *:(?!\\))\\s?)(.*?)(:\\))/s'
  );
===(snip)===

I believe you could just put this line in your config.php and it would work:

$PageTextVarPatterns['var()'] = '/^((\\w[-\\w]*)\\s+\\()([^)]*)(\\))/m';

I assume you've already thought through the ramifications in terms of not
being able to have a close-parenthesis in the value of the variable, etc...

This will allow multi-line values in PTVs as well.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Unit testing pmwiki markup code

2008-04-24 Thread Peter &amp; Melodye Bowers
> Has anyone out there figured out a way to do unit testing for your  
> pmwiki markup code? If so, what tool do you use?

I would be *VERY* interested in something like this.  Currently I just have
dozens of pages in a wikitrail with expected output hardcoded followed by
the actual markup.  I have to go through by hand and examine each one line
by line, character by character. It is very time-consuming to do final
testing in preparation for a release and very prone to human error.

At one point I was thinking of using one of the HTML caching recipes and
then doing a comparison on that, but I believe that HTML can vary pretty
significantly (code-wise) while still appearing on the screen to be
identical.  Thus any update to PmWiki itself or even a recipe could result
in needing to regenerate each and every page and examine them by hand again.
Maybe there's no way around that?

If anyone has a better approach (or, better, a tool as suggested above) I
would be very grateful.  

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Unit testing pmwiki markup code

2008-04-24 Thread Peter &amp; Melodye Bowers
> Has anyone out there figured out a way to do unit testing for your  
> pmwiki markup code? If so, what tool do you use?

I would be *VERY* interested in something like this.  Currently I just have
dozens of pages in a wikitrail with expected output hardcoded followed by
the actual markup.  I have to go through by hand and examine each one line
by line, character by character. It is very time-consuming to do final
testing in preparation for a release and very prone to human error.

At one point I was thinking of using one of the HTML caching recipes and
then doing a comparison on that, but I believe that HTML can vary pretty
significantly (code-wise) while still appearing on the screen to be
identical.  Thus any update to PmWiki itself or even a recipe could result
in needing to regenerate each and every page and examine them by hand again.
Maybe there's no way around that?

If anyone has a better approach (or, better, a tool as suggested above) I
would be very grateful.  

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Emailform receipe

2008-04-23 Thread Peter &amp; Melodye Bowers
> How to set global setting from the local/config.php file into 
> the actual
> page, so the settings can be customized on the page itself?
> 
> I am using the emailform receipe and it works great, but I'd 
> like to set
> the:
> 
> $EMailFormAddresses['feedback'] = '[EMAIL PROTECTED]';
> $EMailFormDefaultSender = '[EMAIL PROTECTED]';
> 
> on the page itself instead of local/config.php

You could create your own markup which you would use like this:

(:setupmail [EMAIL PROTECTED]
[EMAIL PROTECTED]:)

markup("setupmail", "<_end", "/\\(:setupmail\s+(.*?):\\)/ie", 
"MySetupMail(\$pagename, \"\$1\")");  

function MySetupMail($pagename, $opt)
{
   global $EMailFormAddresses, $EMailFormDefaultSender;
   $opt = ParseArgs($opt);
   #echo "Setting...\n";
   $EMailFormAddresses['feedback'] = ($opt['feedback'] ? $opt['feedback'] :
'[EMAIL PROTECTED]');
   $EMailFormDefaultSender = ($opt['sender'] ? $opt['sender'] :
'[EMAIL PROTECTED]');
}

I don't have emailform installed so I can't test the functionality, but it
calls the function properly so from their on you can hopefully figure out
where it's going.

Do note that your email addresses will be in cleartext if anyone looks at
the source on this page.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] summing variables

2008-04-23 Thread Peter &amp; Melodye Bowers
> > WikiSh has this capability using a syntax like 
> {$:var${counter}} to work
> > with "pseudo-arrays".  If you think you would be interested 
> in this I can
> > code it up for you and put it out on the WikiShExamples page.
> 
> This looks like what I'm looking for. It would be very kind 
> from you to
> code it up. I see I should go for studying using wikish recipe. My
> commandline knowlegde  is also veryvery bssics as my php 
> knowledge isn't
> even that. This recipe looks very useful.

See http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#SummingVars

Also note if you have an existing WikiSh downloaded you should get the most
recent update (just placed out there).  The example script referenced will
not work without this most recent version.

Let me know if you have any questions/problems...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] summing variables

2008-04-22 Thread Peter &amp; Melodye Bowers
> I have variables like this (:var1:2,5:) (:var2:3,4:)
> (:var3:23,78:) ...
> (:var35:0,45:). I'd like to know is there an easy way to sum all 35
> variables together? So that I don't need to use for example 
> {(add {$:var1}
> an then all those 35 variables.

WikiSh has this capability using a syntax like {$:var${counter}} to work
with "pseudo-arrays".  If you think you would be interested in this I can
code it up for you and put it out on the WikiShExamples page.

It would look *something* like this:

===(snip)===
Set i = 1
Set --pv total = 0
While test ${i} -le 35
Do
   set --pv total += {$:var${counter}}
Done
===(snip)===

That would be placed in a page somewhere (Mygroup.Totalcode, for instance)
and then run from your page via {earlymx(wikish source Mygroup.Totalcode)}.
Then you could access the variable as {$total} elsewhere within your page.  

No guarantees on this - I haven't actually run it and so I might have typos
causing syntax problems or something.  

This is a case where WikiSh works just fine entirely in "read-only" mode
which is the default.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] custom markup q.

2008-04-20 Thread Peter &amp; Melodye Bowers
> I'v got a problem with a custom markup. It renders the function 
> ("MakeCont) instead of executing it it:
...
> Rule:
> Markup('contentbox', ' '/\\(:contentbox\\s+(.*?)\\s*:\\)(.*?)\\(:contentboxend:\\)/s',
>   "MakeContentbox(\$pagename, ParseArgs(PSS('$1')))");

I think you need a /e instead of a /s on your 3rd argument to Markup() in
order to make it evaluate the PHP expression.

Also I'm thinking you are going to need to include the $2 as an additional
argument to your MakeContentbox() rather than just using it within
MakeContentbox and assuming it will somehow be available.  

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] LinkCSSToolTip + Pagelist by Title takes long to parse...

2008-04-17 Thread Peter &amp; Melodye Bowers
> >  You could create a static pagelist (or static pagelists) 
> for quick viewing.
> >  Obviously the problem is if you change a title or delete 
> or add a page then
> >  you've got to remember to regenerate the lists.
> 
> I've read and re-read that page.
> On one hand it looks interesting, as it seems to solve the long
> processing time issues.
> On the other hand I cannot yet figure it out: it is all quite
> technical, and I really did not understand how things would work.

I've put together another example here:

http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#StaticPageListB

It does pretty much exactly what I *think* you want to do and gives
instructions on how to generate the (:pagelist ...:) based on the starting
letter of the title.  Getting it to show in a popup is something I've
watched the discussion with interest but haven't had opportunity to play
with, so you can work with that yourself or get help from others on the list
here.  But this new example should be hopefully worded a little less
technically and also should require virtually no modification...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] change/delete "HomePage"

2008-04-16 Thread Peter &amp; Melodye Bowers
 > redirect does work, but can i hide the line that displays above the page
content that says "(redirected from Main.HomePage
 )"?

 See http://www.pmwiki.org/wiki/Cookbook/CustomRedirects and also the
"Notes" at the bottom and the "See Also" -- several different ways to solve
the same problem...
 
-Peter 

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] LinkCSSToolTip + Pagelist by Title takes long to parse...

2008-04-16 Thread Peter &amp; Melodye Bowers
> Very smart, it would seem, but I run into a problem: I need to select
> pages by *title* (not name of the page), and it seems that the
> pagelist function takes 10 to 20 seconds to parse those 150 pages in
> the group, which is far too long as it happens at *every* page load.
> Actually, there are not thousands of pages. Nevertheless I noted a
> sheer increase in page loading time.
> 
> Is there any way to circumvent such an issue?

You could create a static pagelist (or static pagelists) for quick viewing.
Obviously the problem is if you change a title or delete or add a page then
you've got to remember to regenerate the lists.

If that might be an acceptable compromise you can look at
http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#StaticPageListA

Presumably you would do 1 of 3 things to solve your specific difficulty
moving from this example:
(1) Create 26 different pages, each containing a list of the pages with a
title starting with the appropriate letter
(2) Create a list of the titles & pagenames of all pages on the system and
then parse that list with grep & cut

Then you would probably want to create some sort of administrative page with
some wikish_button calls which would regenerate the various pages.

If this is of interest and if the static solution is acceptable I can expand
the example on the WikiShExamples page to come closer to what you need.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] WikiSh Shopping Cart recipe

2008-04-16 Thread Peter &amp; Melodye Bowers
> Peter & Melodye Bowers wrote:
> > Here's a very rough proof-of-concept idea using WikiSh
> 
> 1) The generate form button, which would be the link to the 
> order page 
> in a real shop, does not redirect to Shop.Form. How do you 
> add that? I 

{(wikish_form QUICKFORM PROCESS)} will almost never be called at the same
time as {(wikish_form REDIRECT)} -- the one is setting up a form while the
other is saying to go to a different page.  I'll go in and take a look at my
documentation to make sure I've been clear in how it's supposed to be used.
The one with the REDIRECT option is meant to be called separately from the
form setup stuff, in the code for validating or processing a form:

In the Shop.Code#GenerateForm code (I've inserted the very last line) it
will look like this:

echo "${openparen}:if false:${closeparen}\n{${openparen}wikish source
Code#ValidateForm${closeparen}}\n${openparen}:if:${closeparen}"
>>${formpage}
wikish_form REDIRECT target=Shop.Form # I INSERTED THIS LINE TO DO THE
REDIRECT
[[#genformend]]

Basically "wikish_form REDIRECT" does an immediate redirection, so you
usually will surround it in control structures (if/then, etc.) so that it
will only be executed when you really want to do a redirect right then.  If
it is at the top of the form (with the QUICKFORM and PROCESS) then nothing
on your page will ever be done because the first thing the page will do is
redirect to another page.  (This would be a nice addition to PowerTools,
Hans?  Just a simple {(redirect MyGroup.MyPage)} or maybe with some of those
other options that are in the (:redirect ...:) markup?  My preference would
be a silent, simple redirect by default (just a straight call to
Redirect(PSS($target[0]))), but you know this stuff better than me...)

(QUICKFORM just generates the standard (:input ...:) things you will usually
want when making a form and PROCESS looks for $_POST or $_GET settings and
puts them in variables for use.)

In terms of the specific problem, I was not assuming that the form would be
regenerated each time.  I was assuming that the administrator would generate
the form once and then there would be a simple link to the page.  That's why
I didn't put a redirect attached to that button.  But I can see that most of
the time you would want the redirect there.

> 2) The Shop.Order page is not created at all. Shop.Form was, 
> so it's not 
> a write permissions issue. The same redirect question as above too 
> because Shop.Form would need to redirect to Shop.Order.

So you went to Shop.Form, put in a quantity in one or more fields, pressed
"Check Out" and the Shop.Order was not generated?  And no error message?

Strange...  I copied the code into the example page immediately after
successfully testing the snippet successfully in a couple different ways...

Could you send me (offlist) a copy of your Shop.Code page and Shop.Form page
-- I'll see if anything rings a bell...

I've already got the Shop.Form redirecting to Shop.Order when you press
"Check Out", so there shouldn't be any need to change anything there.  (Look
for the "wikish_form target=${orderpage} REDIRECT" in
Shop.Code#ValidateForm.)

> - How should permissions be set so that any visitor can create/modify 
> only the order page?
> 
> $WikiShWriteList = array('Shop.Order')?

Yes, that should do it, although your comment below is absolutely correct -
it will need to be visitor specific.  Either we need to be creating the
orders in Shop.Order-0001 style pages or else we need to use sessions as you
mentioned below.

> Btw, the order page would be visitor specific. Don't we need sessions 
> for this? Should it be a session page URL like 
> Shop.Order-3h7ft219IJH5656dddgyg? I don't know how pmwiki 
> handles sessions.

Hmmm...  There's a recipe out there called httpvariables that allows
interaction with SESSION variables - don't remember the exact details and I
don't know if it allows setting of SESSION variables or only reading of the
same...

I could easily create a --session option for the {(set ...)} MX which would
save to a session variable rather than to a PHP variable.  Or, with a little
more work, I could create capability of having all files in a certain group
(i.e., "Session.PageA") be created as virtual pages saved in your session.
Would either of those be of interest?  I would think much better from a
security perspective...

> I downloaded WikiSh a few hours ago, is that the latest? I'm 
> running the 
> latest pmwiki (...beta65).

I released last night so if you've got the 2008-04-15 version then you've
got the latest.  You can check by looking at the source (line 12:
$RecipeInfo['WikiSh']['Version'] = '2008-04-15';) or by running {(echo
${WIKISH_VERSION})}

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Shopping Cart recipe?

2008-04-15 Thread Peter &amp; Melodye Bowers
> Is there a working shopping cart recipe?

Purely proof-of-concept implementation via WikiSh is documented at
http://www.pmwiki.org/wiki/Cookbook/WikiShExamples#ShoppingCart

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Pagelist and whole directory

2008-04-15 Thread Peter &amp; Melodye Bowers
> I am trying to make a pagelist of the pages in a directory/group About
> 
> config.php: $WikiDir = new PageStore('wiki.d/$Group/$Name');
> 
> How do I make a pagelist that shows all the "About" directory 
> pmwiki pages

I've never put groups in separate directories like this so I may be going in
the wrong direction, but it seems like this should work:

(:pagelist group=About:)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Subject: link image to obfuscated mailto:

2008-04-15 Thread Peter &amp; Melodye Bowers

>   This question below was never answered, but i'm searching for the 
>   same solution.  i want to protect email addresses on our wiki from 
>   spam-bots, and i see in the Cookbook the following options:
>   
>   Cookbook.Eprotect
>   Cookbook.ObfuscateEmail
>   Cookbook.ProtectEmail
>   
>   is anyone using any of these?  any preference?
 
I'm using e-protect and am happy with it...  No known spam and I've got my
email address littered around with it.  I also like it that the email
address is not available in the source view as well.
 
-Peter
 



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Security via PmWiki

2008-04-12 Thread Peter &amp; Melodye Bowers
I've got a friend looking for recommendations for secure web forms.  He's
pretty concerned that the security be pretty high for his company.

My only experience in web stuff is PmWiki in the last few months.  I believe
what he's trying to do from a functional standpoint could be easily done
from within PmWiki, but I don't know if there are ways to tighten it up to
be a really secure environment.

Can it be set up to use https or some other way of up'ing security?  Are
wikis inherently less secure than other types of web technology?  Is PmWiki
in use in any environments that require significant security that I could
use as a recommendation for this guy?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Categories

2008-04-11 Thread Peter &amp; Melodye Bowers
> I have looked at: http://www.pmwiki.org/wiki/PmWiki/Categories and
> many other categories pages. I don't seem to find a way of
> displaying [dynamically] the list of the categories in the left
> sidebar?

In Site.SideBar:

(:pagelist group=Category list=normal:)

Obviously you can change the pagelist to be a different format and etc...  

Also note that categories work fine without any category page, but obviously
PmWiki is only going to display the categories that have an existing page...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Using the cgi-bin directory

2008-04-09 Thread Peter &amp; Melodye Bowers
>But if you are concerned about security, encrypt your password - then  
>it doesn't matter if others can see it. Just add "?action=crypt" to  
>the URL of any page on any pmwiki website to get a form to generate an  
>encrypted version of your password.
>
>Use encrypted passwords in your config.php and anywhere else that you  
>need to put a password.

Just to set my mind at ease...  The only way someone could get access to the
text within config.php is if they have physical access to the server or in
some other way have compromised the overall security of the server, right?
I mean, nobody with a browser could somehow look at the *contents* of a PHP
source, filee, could they?

I saw the instructions with ?action=crypt when installing but figured they
were optional.  If they are an essential part of security then I need to get
moving...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] PopUp from Search Results?

2008-04-07 Thread Peter &amp; Melodye Bowers
> When I get the search results back they are in "camelcode" 
> form which I 
> would like to change but The part I really want to change 
> is to make 
> those links "popwin" window links also.  Right now they open 
> as a normal 
> page.

Check out http://www.pmwiki.org/wiki/PmWiki/PageListTemplates.  I believe
you could look at the fmt definition of #simplename in
Site.PageListTemplates and copy/modify it with your %popwin...% code.  You
could also append the "|+" to the end of your link to get titles instead of
camelcase names... I believe the preferred place to put your new fmt
definitions is in Site.LocalTemplates.

You can see a bunch of other examples of fmt definitions on
http://www.pmwiki.org/wiki/Cookbook/PagelistTemplateSamples.  That will be
helpful in figuring out how to construct your own.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Documentation of built-in forms markup

2008-04-06 Thread Peter &amp; Melodye Bowers
>It happened to me several times that I could not find link to built-in 
>forms markup at http://www.pmwiki.org/wiki/PmWiki/DocumentationIndex 
>page. So I edited that page and added link to 
>http://www.pmwiki.org/wiki/PmWiki/Forms. Later I noticed that there is 
>another page with almost identical content - 
>http://www.pmwiki.org/wiki/Cookbook/Input. It looks like predecessor of 
>PmWiki/Forms. Does anyone know more about history of these pages (I only 
>know that input markup was originally available as a recipe)? I think 
>that content Cookbook/Input page could be deleted and replaced with 
>redirect to PmWiki/Forms. 
 
I agree -- I just did a fairly quick run-through comparing the 2 pages and
it appears that everything that is in the Cookbook/Input is also in the
PmWiki/Forms page but the PmWiki/Forms is more complete.  By all means let's
simplify...
 
-Peter 


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] How to feed MakePageList() with my own list of pages?

2008-04-05 Thread Peter &amp; Melodye Bowers
> and I want (:pagelist:) to use the list I generated as it's starting
> point, not to filter results of ListPages() executed in the
> PageListSources() step of $PageListFilters - also because one of my
> main goals here is speed.

This is well out of the areas of pmwiki I've played in before, but couldn't
you just set $PageListFilters to the set of functions that works for you?
Save off the old values and reset them after your stuff has run if you want
to keep other (:pagelist:) stuff working as normal...

$OrigPageListFilters = $PageListFilters;
unset($PageListFilters['PageListSources']);
DoMyRecipe();
$PageListFilters = $OrigPageListFilters;

Again, I don't know enuf to know if this is workable or not, but it looks
like pagelist.php is set up fairly flexibly to allow this kind of thing...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] UpdatePage processing markup again

2008-04-03 Thread Peter &amp; Melodye Bowers
> > My problem is in my specific situation I could very easily 
> end up with a
> > race condition where PageA contains an MX that writes to 
> PageB and PageB
> > contains an MX that writes to PageA.
> 
> I think you mean a "recursive condition" as opposed to a "race
> condition"?  PmWiki normally avoids race conditions by calling 
> Lock(2) prior to any transaction that involves updating
> a page or file.

So now we not only have to find words that sounds intelligent but we're also
supposed to find words that mean the right thing?!?  I think we're raising
the bar too high here... ;-)

You're exactly right - it's not a locking issue at all but rather unintended
recursion without an exit plan...  

> SaveAttributes is responsible for setting a variety of attributes
> within pages.  In particular, it's the thing that creates the
> targets, title, description, and keywords attributes in a page.
> We compute these attributes at the time the page is saved so that
> we don't have to try to figure them out whenever the page is
> read later.

I think after looking at it some more I've figured out what was confusing to
me.  Nothing is being done with the $html variable after it is set because
you aren't interested in the *results* of MarkupToHTML() -- you are
interested in the side effects of that process in getting the page cache
updated.  Is that correct?

> $EnablePost says whether or not posts are allowed, not whether
> one is occurring.
> ...
> global $action;
> if ($action != 'browse') return;

PERFECT!  Exactly what I was looking for.  It's now in code and will be part
of the next release...

Do I need to be concerned that if a WikiSh MX was being used, for instance,
to create a link to another page (or to create some other attribute that
SaveAttributes() was computing), that then the targets (or other attribute)
would not be correct and there could be problems in future searches?  I'm
thinking of something like this:

{(wikish if test -z "{$MyPTV}"; then; echo "[[MyPage]]"; fi)}

Thanks!

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] index.php question

2008-04-02 Thread Peter &amp; Melodye Bowers
>When you edit index.php is it suppose to make the exact same
>edit on pmwiki.php?? If not how to fix it.

See http://www.pmwiki.org/wiki/PmWiki/Installation at the bottom in the
question/answer as well as
http://www.pmwiki.org/wiki/Cookbook/CleanUrls#index_file.  
 
If I'm understanding your question correctly it seems to imply that you've
got a copy of pmwiki.php placed in index.php.  This is not recommended.
Instead include pmwiki.php from within a wrapper index.php that you create
from scratch.  (Make sure there are no spaces before the opening Also if it is suppose to edit the pmwiki.php, how are we
>suppose to keep the existing data, just copy right back over after it is
>updated??
 
This question seems to imply that changes are needed to pmwiki.php for a
given site.  Making changes to the actual source code in pmwiki.php should
be a *very* rare occurrence.  Just about anything imaginable in pmwiki can
be configured via setting configuration variables and including other php
recipes within local/config.php.
 
If in the very rare occurrence you do need to make a change to pmwiki.php
then updates in the future are going to be more complicated.  The change
would need to be clearly documented so that you can copy in the new version
and then make the same change again -- updates will no longer be a question
of simply copying in the new files but will be a more complicated process
due to having to keep the changes in the file.
 
You should really work hard to figure out how the same job might be done by
changes to config.php before considering making changes to pmwiki.php.  

I hope I've correctly understood your questions and this is of some help...
If you post back to the list with a more functional description of the
problem you're trying to solve then perhaps someone will be able to point
you to existing recipes that can be installed in the more standard approach
through changes to config.php rather than changes to pmwiki.php...

-Peter



Thank you in advance




Going green? See the top 12 foods to eat organic.
  



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] UpdatePage processing markup again

2008-04-02 Thread Peter &amp; Melodye Bowers
I just discovered that one of the $EditFunctions within UpdatePage()
(SaveAttributes() to be specific) calls MarkupToHTML() as part of the
process of saving a page.

Obviously all markup expressions get processed along with all other markup
within MarkupToHTML().

My problem is in my specific situation I could very easily end up with a
race condition where PageA contains an MX that writes to PageB and PageB
contains an MX that writes to PageA.

I can either suppress writing to pages while an UpdatePage() is running.

Or I can simply stop all WikiSh functions from doing anything if an
UpdatePage() is running.

The completely "do-nothing-while-UpdatePage-is-running" solution is easier
to implement, but I don't know what implications this might have.  I'm
afraid SaveAttributes() gets into some stuff I haven't adequately explored
and I simply can't figure out what it's doing.  To be honest it looks like a
"write-only" setting of the $html variable, but maybe there's some PHP
subtlety that I'm not catching here...  (If it is "write only" there could
potentially be a noticeable performance gain by removing it...)

Also, is there any good, standard way to know whether I am in the context of
a page being posted or in a normal context?  Is there some global variable
or something that is set when a page is being posted that is not set
otherwise?  I tried $EnablePost but it seems to be set always...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Execute & render markup from a php function

2008-04-02 Thread Peter &amp; Melodye Bowers
> I'm looking for a function to execute & render markup.
> ie : I would like to run {(plist groups=* -Site*.* 
> sep=\n)}and get the 
> result in a variable, ..
> 
> Today, I need to execute 'powertools' markup, but markup 
> could be anything 
> else
> something like :
> 
> $mymarkup= '{(plist groups=* -Site*.* sep=\n)}';
> 
> $page['text'] =ExecuteMarkup($mymarkup);
> ...
> ...

The function you are looking for is in scripts/markupexpr.php and is called
MarkupExpression().

You would use it like this (note that you do not include the curly braces --
just the parentheses):

$mymarkup= '(plist groups=* -Site*.* sep=\n)';
$tmp = MarkupExpression($pagename, '(' . $e . ')');

Hope that helps.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] httpvariables & markupexpressions

2008-04-02 Thread Peter &amp; Melodye Bowers
> hi list
> I try to use getvars within markup expressions. This seams 
> not to work: 
> See: 
> http://netstreams.org/devel/cms/pmwiki/pmwiki.php?n=Main.WikiSandbox
> 
> Anyone an idea what's the problem here?

I'm afraid this may be of limited help -- but at least it may put the
information in front of people who will be able to see more quickly where
the problem lies.  Looking at your Sandbox I immediately thought it must be
some issue with the order of markup processing and so looked up the various
Markup() rules which follow:

===(snip from httpvariables - yes there are 2 almost identical rules)===
# {$?!|@~var} http variable substitutions before {$var}
Markup('{$?|[EMAIL PROTECTED]', '<{$var}',
  '/\\{\\$([\\?\\!\\|@~])(\\w+)\\}/e',
  "HttpVariables(\$pagename, PSS('$1'), PSS('$2'))");

# {$?!|@~var} http variable substitutions after {$var}
Markup('{$?|[EMAIL PROTECTED]', '>{$var}',
  '/\\{\\$([\\?\\!\\|@~])(\\w+)\\}/e',
  "HttpVariables(\$pagename, PSS('$1'), PSS('$2'))");
===(snip)===

===(snip from markupexpr)===
Markup('{(', '>{$var}',
  '/\\{(\\(\\w+\\b.*?\\))\\}/e',
  "MarkupExpression(\$pagename, PSS('$1'))");
===(snip)===

I'm not familiar with having 2 rules like this in httpvariables...  In fact,
the more I look at it (noting that the name is identical) I'm wondering if
the 2nd doesn't overwrite the 1st?  That's a wild guess...  If that's the
case then they both have their markup order specified as '>{$var}' and I
don't know how pmwiki decides the order between the 2 -- probably something
to do with when they are defined?

I would be very tempted to comment out the 2nd Markup() call (the one that
has '>{$var}' as the 2nd argument) and see if that doesn't solve the
problem.

It's a shot in the dark, probably completely off the mark, but perhaps it
will help...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] [powertools] questions, ...

2008-03-30 Thread Peter &amp; Melodye Bowers
> > and do we need both LF and CRLF?
> 
> I was running into LF and CRLF problems a few weeks ago and 
> found a PHP
> constant PHP_EOL which I've found to be very helpful.  

I take back what I said.  It appears that PmWiki never (?) puts CRLF into a
page (or more specifically never replaces the %x0a with CRLF upon reading a
page?) and so the PHP_EOL may be useful in pre-processing, but once you've
written to a page and read it again it causes more pain than it helps.

Sorry for the bad suggestion.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] anti-spam multi-page-restore tool

2008-03-30 Thread Peter &amp; Melodye Bowers
> Just because this bugs me a bit... I have trouble imagining
> using WikiSh on any site that allows a substantial number of
> non-admins to edit pages.  I think it's just far too easy for
> someone to inadvertently or maliciously exploit WikiSh and
> cause serious damage to the site (or server).
> 
> For a site that has a very small number of highly trusted
> authors and where the entire site is locked down, WikiSh might
> be okay.  But for any site where editing is distributed,
> I'd be really concerned about (inadvertently) making WikiSh 
> capabilities available to them.

I fully agree that there is cause for concern -- WikiSh is a sharp tool and
sharp tools can do good work but they can also cut the user if they aren't
used carefully.  This is why in the installation and security sections I
strongly recommend giving write privileges to the WikiSh recipe only on
groups/pages which are password protected and that warning is not a "don't
cut the tag off your pillow" kind of a warning -- it really needs to be
observed.

To help avoid potential problems there are 3 primary levels of protection
built in to any edit of any page within WikiSh.  (1) Regular pmwiki auth
restrictions are always upheld, (2) $EnableWikiShWritePage must be true
before any write can occur, and (3) only pages/groups explicitly allowed
through $WikiShWriteList can be written to.  Having #2 & #3 restrictions
significantly cuts down on the usefulness of WikiSh in general, but there
obviously needs to be some security mechanism and it needs to default to
being tight.  The default installation of WikiSh allows pages to be written
*only* in the WikiSh group on the assumption that probably very few sites
have a group with that name already so there's no danger to existing pages.

If people have thoughts on how security could be tightened or alternate
mechanisms for allowing/disallowing writing to various pages I am wide open
to suggestions.  For instance, perhaps the default installation perhaps be
to not allow any writes and then the administrator can explicitly give them
out as needed?

If you look at the actual code you will see that I have carefully limited
ALL writes to going through a single function and a single call to
UpdatePage() in order to be sure that there is no inconsistency allowing an
unauthorized write.  But, again, I am very open to suggestions, on- or
off-list.

If there are security concerns beyond page-writes I'd be interested in those
as well -- I observe pmwiki auth restrictions in all reads (the only
function I use to read a page is RetrieveAuthPage() with either 'read' or
'edit') so I kind of assume there's not a lot of danger there...

The idea of WikiSh, as I envision it, is a tool generally open to the
administrator (with appropriate write permissions given through
$WikiShWriteList within a carefully password protected group, normally
WikiSh.*) and then available on other pages only with read privileges.  If
it was installed with full write privileges on a page or group without
password protection then there is significant danger from a malicious user -
no doubt about that -- but I would think that almost any recipe with write
capabilities would have potential security problems if it was incorrectly
administered...

Even if an administrator simply set $EnableWikiShWritePage to false for
everyone it would still be a potentially valuable tool for form validation
and other applications, so I'm not sure it's fair to say that sites with
non-admin editors shouldn't use it.  The non-admin editors should certainly
not have global write privilege, but I think the tool itself can be valuable
if correctly administered.  Let's not throw the baby out with the
bathwater...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] anti-spam multi-page-restore tool

2008-03-30 Thread Peter &amp; Melodye Bowers
>For example -- suppose I'm webmaster for a soccer club and want to be 
>able to offer team websites to the teams of the club.  I create a 
>GenericTeam group with a couple basic pages to get them started.  
>Then when the 'SpeedyDemons' want a team site, all I do is go to 
>the WikiMaster utility, and create SpeedyDemons team site from 
>GenericTeam, done deal, the Speedy Demons have their team web site...   
>Ideally, one could perhaps even automate a variant of WikiMaster so 
>SpeedyDemons could sign up for their own team site, with the proper
password. 
 
There are tools out there that can already do this ( i.e.,  I'm pretty sure
I've read that fox  has significant template file capabilities)...  Here's
how you would do it with WikiSh:
 
Create your templates in some (presumably protected) group.  Let's say
GenericTeam.Page1 and GenericTeam.Page2.  Then on GenericTeam.Admin you
would put this markup:
 
===(snip GenericTeam.Admin)===
{(wikish_form QUICKFORM PROCESS)}
New Group: 
(:input text name=GroupName:)\\
(:input submit name=submit value=Create:)
 
{(wikish source {$FullName}#validate)}
 
(:if false:)
[[#validate]]
if test -n "${submit}"
then
   if ! test -n "${GroupName}"
   then
  echo "ERROR: Must specify the new group name."
   else
  if test -f ${GroupName}.Page1 || test -f ${GroupName}.Page2
  then
 echo "ERROR: ${GroupName} already exists."
  else
 echo "Creating New Team Page...\\\n\\\n"
 cp GenericTeam.Page1 GenericTeam.Page2 ${GroupName}
 echo "\\\n\\\n...DONE!"
  fi
   fi
fi
[[#validateend]]
(:if:)
 
(:messages:)
===(snip)===
 
If you are going to let other people create the groups then you might want
to do some other validations on the group name (no disallowed characters,
etc), but this will get you the basic operation and you can fine-tune it
from there.
 
-Peter
 
PS If you use this to test a bunch of times and if you don't have command
line access to your server then you are also going to want to use the {(rm
...)} command which comes with WikiSh to get rid of all your new test pages
at the end.  For instance, I created a Lions, Lion2, Lion3, etc group during
my testing.  When I was done I went to the control panel and ran the command
"ls Lion?.*" to see which files would be affected by that wildcard pattern
-- it was right so I changed the "ls" to "rm" and ran "rm Lion?.*" and that
deleted them all.  If you don't want the backup files
(Lion2.Page1,del-123456123) then use "rm -f Lion?.*" instead.


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] anti-spam multi-page-restore tool

2008-03-29 Thread Peter &amp; Melodye Bowers
I am envisioning an anti-spam tool to help restore pages after an attack.
I'm wondering if someone else has already done something similar.

 

My thought is to specify a starting/ending date/time (a range) and have all
pages modified during that time display their text on a single page.  Each
page would be preceded by a checkbox or something indicating whether you
wanted them to be included in the "global restore".  Then you press "submit"
and it would go back one restore-point on each of the selected pages.  (If
the page was newly created then it would delete it)

 

Does this sound like a workable tool?  If so, has anybody done something
similar?  Do you see potential problems with this approach?

 

* Would require some password

* Do spammers often write multiple versions of the page out there?

 

-Peter

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] [powertools] questions, ...

2008-03-28 Thread Peter &amp; Melodye Bowers
> and do we need both LF and CRLF?

I was running into LF and CRLF problems a few weeks ago and found a PHP
constant PHP_EOL which I've found to be very helpful.  It takes care of this
issue entirely.  Just use it in place of "\n" and the code then ports nicely
between linux boxes and windows boxes without worries.  (However, they were
only defined as of PHP 5.02 and 4.3.10 so that might be a factor if
backwards compatibility is needed -- would imply checking the PHP_OS and
defining it if it wasn't defined.)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:pagelist ...:) returning plain text result like "?action=source" does

2008-03-27 Thread Peter &amp; Melodye Bowers
> > {(wikish pagelist group=Alb name=0100* wrap=inline 
> fmt=#bygroup | cat
> >>GroupA.Foo)}
> 
> is Wikish compatible with both windows & unix ?

Yes.  WikiSh is a recipe like any other, written in PHP.  It uses the usual
pmwiki functions to maintain consistency with reading, writing, enforcing
authorizations, etc.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:pagelist ...:) returning plain text result like "?action=source" does

2008-03-27 Thread Peter &amp; Melodye Bowers
> > Would like to play with (:pagelist:) but want the result to 
> > be returned as 
> > "plain text" like "?action=source" does produce a "pure" 
> text result.
> 
...
> markup.  So unless there's some way to get inside pagelist 
> itself and convince it to output markup (maybe something with 
> fmt?) I'm afraid it's not going to happen...

Pressed "send" too soon.  The wrap=inline option will give the results
needed for my solution to work.

Using {(pagelist ...)} from PowerTools (it's necessary to have it in
MarkupExpression rather than straight (:pagelist ...:) markup) and {(wikish
...)} and {(cat ...)} from WikiSh you can do this:

{(wikish pagelist group=Alb name=0100* wrap=inline fmt=#bygroup | cat
>GroupA.Foo)}

Then you can go to GroupA.Foo and either edit it or see it with
?action=source to view the markup directly.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] back to an old story : conditional for attachments (fwd)

2008-03-27 Thread Peter &amp; Melodye Bowers
> Try this: add to config file:
> 
> $Conditions['attachexists'] = 'UploadFileExist($pagename, $condparm)';

Hans's solution is now documented in Cookbook/ConditionalMarkupSamples.

However, I'm thinking that page may be out of date.  Isn't (:if exists ...:)
and some of the others part of core now?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] (:pagelist ...:) returning plain text result like "?action=source" does

2008-03-27 Thread Peter &amp; Melodye Bowers
> Would like to play with (:pagelist:) but want the result to 
> be returned as 
> "plain text" like "?action=source" does produce a "pure" text result.

It appears that pagelist outputs straight html rather than an intermediate
markup (I'm testing this from the powertools pagelist, but I'm thinking the
usual (:pagelist:) would do the same thing).  I took the output and directly
wrote it to another page and it was just html code rather than "readable"
markup.  So unless there's some way to get inside pagelist itself and
convince it to output markup (maybe something with fmt?) I'm afraid it's not
going to happen...

If the HTML output is of interest (questionable) I can describe my process.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] Totalcounter freeze

2008-03-27 Thread Peter &amp; Melodye Bowers
I periodically get totalcounter freezing up on me (exceeding the 30 second
execution timeout while at line 1136 in totalcounter.php).  This seems to
happen every couple months (this could be way off - just a gut feel).
Getting rid of the wiki.d/totalcounter.stat file solves the problem but also
loses the historical stats.

Any ideas?  Are others having this or is it something specific to my
host/environment?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Reorganising our PMWiki?

2008-03-24 Thread Peter &amp; Melodye Bowers
> > Is there an easy way of moving pages from one
> > group/category to another?  Can we just rename the
> > files? eg GroupA.Page1 to GroupB.Page1
> 
> There once was a recipe, which I didn't try myself, for 
> renaming pages, 
> which would also do all the links.

I believe the recipe you are referring to is Cookbook/RenamePage.

You can also rename multiple pages (including entire groups) using the
WikiSh command "mv GroupA.* GroupB".  Note that links are *not* updated (as
they are with RenamePage), but you also have search/replace capability with
"sed -i 's/searchfor/replacewith/' pages" and so you could presumably fix
links generically in that manner.

A WikiSh script like this *might* do what you want (you would copy this into
the WikiSh control panel and modify it from there):

for page in GroupA.*
do
   mv ${page} GroupB
   set newpage = `echo {$page} | sed 's/GroupA/GroupB'`
   sed -i 's/\[\[${page}(?=[\|\]])/${newpage}/' *.*
done

Or, more selectively on the search/replace (grep is a more efficient tool
for finding a regex):

for page in GroupA.*
do
   mv ${page} GroupB
   set newpage = `echo {$page} | sed 's/GroupA/GroupB'`
   sed -i 's/\[\[${page}(?=[\|\]])/${newpage}/' (grep -l
'\[\[${page}(?=[\|\]])' *.*)
done

Note I haven't tested that at all so you might want to work with it on a
page or 2 (for page in GroupA.Page1 GroupB.Page2) and check the results
before applying it to the whole group...

Are there other forms of links that need to be searched for besides
[[GroupA.Page1]] and [[GroupA.Page1|Display text]]?  Probably...

Note that mv loses all history in a page as it just moves the current text
of the page into the new page.

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] MatchPagenames() usage

2008-03-23 Thread Peter &amp; Melodye Bowers
> Is this by design or by accident?  Why would you ever want 2 inclusive
> patterns combined by boolean "and"?

I think I answered my own question via pagelist.php and notify.php.  It
seems that the "and" is used when someone specifies group and name
separately.  The group inclusion becomes "GroupA.*" and the page inclusion
becomes "*.Page1" - when they are combined you end up with just
GroupA.Page1.

So I guess it is by design...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] MatchPagenames() usage

2008-03-23 Thread Peter &amp; Melodye Bowers
I just added a comment to the Cookbook/Functions page regarding the
MatchPagenames(), but I want to confirm it and then see if it's by design or
a bug...

Here's the entire entry for MatchPageNames() - my comment is the 2nd
paragraph:

===(snip)===
MatchPageNames($list, $patterns)
Returns a matched new list of page names. $list is a pagename or array
of pagenames, and $patterns is an array of patterns to be matched. If a
pattern starts with a slash, the pagename must match the pattern, else if
the pattern starts with an exclamation point, the pagename must not match
the pattern, else the pagename must match the wildcard pattern. Mixed use of
regex pattern and wildcards possible. 

Note that individual elements of the $patterns array can consist of
comma-separated wildcard patterns. This (or regex with |) is the way to
accomplish inclusive "or" conditions. Each element of the $patterns array is
combined with the others by boolean "and". For inclusion this can be
confusing since 2 elements of the array holding "GroupA.*" and then
"GroupB.*" respectively will mean that no page is ever matched. GroupA.Page1
will match and so be included by the 1st element but will not match the 2nd
element of the array and so will not be included.  If you want all pages in
both GroupA and GroupB then your array must include a SINGLE array element
containing the string 'GroupA.*,GroupB.*'.
===(snip)===

I had been assuming that this setting:

$patterns[]='GroupA.*';
$patterns[]='GroupB.*';

was the way to specify multiple groups that could match - when I do this I
end up with EVERYTHING being excluded, much to my surprise.  The
multi-element inclusion gives nice functionality in my context, but maybe
not in other contexts where only a single inclusive element would ever be
used.

Is this by design or by accident?  Why would you ever want 2 inclusive
patterns combined by boolean "and"?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Error encountered with upgrade to 2.2 beta 65

2008-03-23 Thread Peter &amp; Melodye Bowers
> So suddenly none of my websites can post external links (with 
> the string 
> "http://"; anywhere in the page), and hundreds if not 
> thousands of pages 
> that have this protocol embedded are suddenly uneditable.

Obviously this is a hosting problem and they should fix it, but a workaround
is possible if the (http:)//www.example.com syntax works.  This WikiSh
script would replace all occurrences of http:// with (http:)// in all pages
in the group Test.

sed -i 's/http:\/\//(http:)\/\//' (grep -l 'http:\/\/' Test.*)

(This would be put directly into the control panel)

Presumably you could do the same with *.*, but you may want to test it out a
bit at a time.  You can do a single file or 2 or 3 like this:

sed -i 's/http:\/\//(http:)\/\//' (grep -l 'http:\/\/' Test.Page1
Test.Page2)

If you want to do several groups at a time you could do this:

sed -i 's/http:\/\//(http:)\/\//' (grep -l 'http:\/\/' GroupA.* GroupB.*)

If you want to see which files are going to be changed ahead of time you
could do this:

grep -l 'http:\/\/' Test.Page1 Test.Page2

Hopefully that gives enough examples to get things started in the right
direction.  Obviously a search/replace on potentially every page in the
entire site is a *big* deal and whether that's the right move for you is
your decision.  I'm just giving you a way to do it if it works for you...

(As usual the most recent version of WikiSh.php is necessary -- I discovered
some inconsistencies in the way I was handling escaped slashes with
search/replace and so that is fixed only in version 2008-03-23.)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] wiki page creation

2008-03-22 Thread Peter &amp; Melodye Bowers
> Is there an easy way to automatically create a bunch of
> wiki pages from a text file, which consists of a list of sections,
> and each section shall become a new wiki page?
> 
> The sections are mainly of plain text with some wiki markup,
> the beginning of each section is determined by some text marker
> string, the end of each section by the beginning of the next.
> The wiki page name needs to be determined by a string in each section.

Another WikiSh solution, this time more efficient (only writes to each file
one time).  Note that you need the most up-to-date version of WikiSh.php for
this to work - I fixed a couple bugs while working through this solution.
Same assumptions as before regarding file location and format...

===(snip)===
set -s outfile = preval
while read --stdin:TEXTFILE--foo.txt line
do
   if test "${line}" ~= "/^===.*===$/"
   then
  if test "${outfile}" != "preval"
  then
 echo "Outputting to ${outfile}"
 echo ${filetext} >${outfile}
  fi
  set -s filetext = ""
  set -s outfile = `echo ${line} | sed 's/^===(.*)===$/$1/'`
   else
  set -s filetext .= "\n${line}"
   fi
done
if test -n "${filetext}" && test ${outfile} != preval
then
   echo "Outputting to ${outfile}"
   echo "${filetext}" >${outfile}
fi
===(snip)===

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] wiki page creation

2008-03-22 Thread Peter &amp; Melodye Bowers
> Is there an easy way to automatically create a bunch of
> wiki pages from a text file, which consists of a list of sections,
> and each section shall become a new wiki page?
> 
> The sections are mainly of plain text with some wiki markup,
> the beginning of each section is determined by some text marker
> string, the end of each section by the beginning of the next.
> The wiki page name needs to be determined by a string in each section.

This is exactly the kind of thing WikiSh can do very nicely...

Here is roughly the script I would put into the (:wikish_controlpanel:)
window (no need to put it on another page since presumably it is a once-off
activity...) (I am assuming a textfile called foo.txt in your "pmwiki root"
directory and "===Group.Pagename===" as the section delimiter - you would
need to modify the 2 regexes to fit your actual pattern):

===(snip)===
set -s outfile = NotAPage
cat TEXTFILE--foo.txt | while read line
do
   if test "${line}" ~= "/^===.*===$/"
   then
  set -s outfile = `echo ${line} | sed 's/^===(.*)===$/$1/'`
  echo "Outputting to ${outfile}"
  if test -f ${outfile}
  then
 rm ${outfile}
  fi
   else
  echo ${line} >>${outfile}
   fi
done
===(snip)===

Note that if you are dealing with thousands of lines of text this is not
going to be the most efficient processor.  For each line it's going to have
to re-read and re-write the outfile since there's no optimization that I
know of to simply append a line of text to a page.  But if you're OK with a
slight delay this should do the trick...

(You could get fancier and save up the lines in a variable and write out to
the page only once, but that is more complicated and something you'd
probably only want to do if you were dealing with significant performance
issues...)

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Validating and appending data from Forms and Displaying

2008-03-21 Thread Peter &amp; Melodye Bowers
>if test ${address} ~= /[EMAIL PROTECTED]/
>then
>   echo "Yep, looks like an email address"

Note that the regex above to validate the email address form is not even
close to what it needs to be.  If you're going to use it "live" it would
need to be significantly more robust...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Validating and appending data from Forms and Displaying

2008-03-21 Thread Peter &amp; Melodye Bowers
> I would like to create a sign-up sheet for an event. Before moving to
> PmWiki I used a perl script for this form with a simple csv file
> containing all the allowed emails. I simply recorded the registered
> emails in another csv file and dynamically generated a page listing
> those registered.
> 
> I would like to recreate this system within PmWiki.

Here's how it would look with WikiSh:

===(snip the-page-with-the-form)===
{(wikish_form QUICKFORM PROCESS)}
(:input text name=address:)
(:input submit name=b value="Sign Up":)
(:linebreaks:)
{(wikish source WikiSh.Validate#A)}
===(snip)===

That's the entire form -- the QUICKFORM argument is a shorthand for the rest
of the input directives.

The validation script has been put in WikiSh.Validate#A just for
readability.  It could have been placed in the form itself as well, but
since MarkupExpressions don't support multi-lines it is kind of hard to read
- the following line would substitute for the {(wikish source ...)} line:

{(wikish if test -n ${address}; then; if test ${address} ~=
/[EMAIL PROTECTED]/; then; echo "Yep, got a match"; if grep -q
"^${address}$" WikiSh.Attendees; then; echo "You are already signed up";
else; if grep -q "^${address}$" WikiSh.MemberAddresses; then; echo
${address} >>WikiSh.Attendees; echo "You are now on the list."; else; echo
"Sorry, you are not a member."; fi; fi; else; echo "No, that does not look
like an email address"; fi; fi;)}

Since that is headache-inducing to read in a single line, the original form
above sources the script from a different page in multi-line form and that
section from that page follows:

===(snip WikiSh.Validate)===
[[#A]]
if test -n ${address} # if there's no value then don't bother giving any
messages
then
   if test ${address} ~= /[EMAIL PROTECTED]/
   then
  echo "Yep, looks like an email address"
  if grep -q "^${address}$" WikiSh.Attendees
  then
 echo "You are already signed up"
  else
 if grep -q "^${address}$" WikiSh.MemberAddresses
 then
echo ${address} >>WikiSh.Attendees   # Here the address is
actually added
echo "You are now on the list."
 else
echo "Sorry, you are not a member."
 fi
  fi
   else
  echo "No, that does not look like an email address"
   fi
fi;
[[#ENDA]]
===(snip)===

Hope that helps.

-Peter

PS Make sure you've got an updated version of WikiSh as getting code from an
anchored section within a page is something just implemented.


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Validating and appending data from Forms and Displaying

2008-03-20 Thread Peter &amp; Melodye Bowers
> I would like to create a sign-up sheet for an event. Before moving to
> PmWiki I used a perl script for this form with a simple csv file
> containing all the allowed emails. I simply recorded the registered
> emails in another csv file and dynamically generated a page listing
> those registered.
>...
> I believe a form simple fields would suffice for input. I would want
> to at least validate the email (i.e. match the regexp /[EMAIL PROTECTED]/ ),
> or preferably verify it with a list of acceptable emails (this is a
> members club where everyone has an email already). I would also like
> to be able to generate a page listing those already registered.

If your familiarity with perl means that you are also familiar with shell
scripting (bash) then WikiSh can handle this for you relatively easily.
You'd need to put together some simple forms (using either httpvariables or
ProcessForms recipes to get access to the field values on your page) but
then you could do all the rest of the validating, processing, etc. through
WikiSh.

If you're not familiar with shell scripting then the learning curve is
probably more pain than it's worth to you.

You might look at Fox Forms as another alternative.

-Peter 



___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Putting a Colon in a Definition List?

2008-03-14 Thread Peter &amp; Melodye Bowers
But I'm still curious as to whether one can define entities or not.

I tried using the HTML entity: &58; (if your email program parses that in to
an actual colon... I wrote "ampersand 58 semicolon") but it merely output
the code (i.e. it literally output "&58;") 
 
Try putting a pound (hash) symbol after the & and before the #.  Thus :
(ampersand pound 58 semicolon).  
 
-Peter 

___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Diff/merge-friendly PageStore format (linebreaks)

2008-03-13 Thread Peter &amp; Melodye Bowers
> > > But a few months ago someone posted a script on this list 
> > that they used to
> > > move page text into text files for shell-tool processing.  
> > I just took a
> > 
> > This would be interesting as a filter for the diff tool to be at 
> > least able to compare data.

FYI I've put some links and scripts connected to administrating pmwiki via
linux shell here:

   http://www.pmwiki.org/wiki/Cookbook/AdminByShell

Those of you that use shell, feel free to add to, update, fix, etc

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Diff/merge-friendly PageStore format (linebreaks)

2008-03-12 Thread Peter &amp; Melodye Bowers
> > But a few months ago someone posted a script on this list 
> that they used to
> > move page text into text files for shell-tool processing.  
> I just took a
> 
> This would be interesting as a filter for the diff tool to be at 
> least able to compare data.

Try this:

===(snip - wiki2txt - snip)===
for i in "$@"
do
grep '^text=' "$i" | sed -e 's/^text=//' -e 's/%0a/\n/g' -e
's/%25/%/g' >text/${i}.txt
done
===(snip)===

I've only tried it in a cygwin context and only tested it on a few pages,
but it should be pretty close to what you're looking for...  You can run it
over many files at once like this:

$ cd wiki.d
$ mkdir text
$ /path/to/wiki2txt GroupA.*

It will create a bunch of files in the text/ directory called
GroupA.Page1.txt and etc.

This is very similar to the script that was posted before IFIRC but you'd
still be better off with a tested and proven solution...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


Re: [pmwiki-users] Diff/merge-friendly PageStore format (linebreaks)

2008-03-12 Thread Peter &amp; Melodye Bowers
> Compare/merge of page data files can be very useful after PmWiki
> updates to track changes in wikilib.d and merge them with local
> customizations. The same applies for maintaining multiple wikis.
> 
> There are great visual diff tools like KDiff3, Meld, Beyond Compare,
> WinMerge, CSDiff..., but without linebreaks, they much less useful.
>...

WikiSh provides a {(diff ...)} markup, but it's not going to be mature
enough to do what you're hoping for.

But a few months ago someone posted a script on this list that they used to
move page text into text files for shell-tool processing.  I just took a
quick look around to try to find it and couldn't lay hands on it, but
perhaps the original poster could repost?  Sorry for my inability to find
it...  It'd be a worthwhile thing to have on the pmwiki site as some kind of
administrative tool recipe...

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


[pmwiki-users] order of initializing

2008-03-10 Thread Peter &amp; Melodye Bowers
I was trying to run a function (not just define it but actually run it) at
the time my recipe is being loaded via include_once() from config.php.  My
function required scripts/markupexpr.php to be loaded and apparently
config.php gets loaded ahead of that.  Is there any way to get a recipe
loaded later on during the initialization process?

-Peter


___
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users


  1   2   >