[pmwiki-users] two sources for the 'password required' page

Dominique Faure dominique.faure at gmail.com
Tue May 16 03:46:47 CDT 2006


On 5/15/06, Tegan Dowling <tmdowling at gmail.com> wrote:
> On 5/15/06, Ben Wilson <dausha at gmail.com> wrote:
> > On 5/15/06, Tegan Dowling <tmdowling at gmail.com> wrote:
> > > There are two sources for the 'password required' page - the first
> > > one, the full-screen page, comes from the pmwiki.php file itself, and
> > > the other is the wiki page Site/AuthForm.  I'd like to be able to
> > > customize the first one - is there anything I can do to tell the wiki
> > > to get that content from the wiki page Site/AuthForm as well?
> > >
> > > OR,
> > >
> > > If that screen must be generated by pmwiki.php, then I'll edit
> > > pmwiki.php, although I don't like to do that, since I'll have to
> > > remember to do it again with each upgrade.  If I do, though, is there
> > > a way to embed a link in the text I enter there?  I tried
> > > [[http://example.com | example]] and I tried <a
> > > href="http://example.com">example</a>, and both rendered as plaintext
> > > instead of becoming links.
> > >
> > > Thanks!
> > >
> > > Tegan
> >
> > Don't you just have to set $AuthPromptFmt to effect the change you want?
> >
> > Ben
>
> Yay:  http://www.pmwiki.org/wiki/Cookbook/MakingPasswordRequestsExplicit
> Thanks!
>

An other (cleanest?) way could be to fill dynamically some text into
the (:messages:) markup already present in the Site/AuthForm wiki
page:

function SetAuthMessage($pagename) {
  global $MessagesFmt, $action;
  $actionText = array(
  'attr' => 'administer',
  'upload' => 'upload files related to',
  );
  $handle = @$actionText[$action];
  if(!$handle) $handle = $action;
  $MessagesFmt[] =
  "<p><i>You need to authenticate yourself to $handle this page.</i></p>";
}
$AuthPromptFmt = array(&$PageStartFmt,
  'function:SetAuthMessage',
  'page:{$SiteGroup}.AuthForm',
  "<script language='javascript' type='text/javascript'><!--
    try { document.authform.authid.focus(); }
    catch(e) { document.authform.authpw.focus(); } //--></script>",
  &$PageEndFmt);

Regards,
Dom




More information about the pmwiki-users mailing list