Commit Graph

42 Commits

Author SHA1 Message Date
Alex Schroeder
89fa22d1c9 Introducing @MyFormChanges
GetEditForm and GetCommentForm will now call all the subs in
@FormChanges in order to let them change the generated HTML. This is
used by all the modules that used to hook into either of these two
functions.

A typical change from questionasker.pl:

push(@MyFormChanges, \&QuestionAddTo);

sub QuestionAddTo {
  my ($form, $type, $upload) = @_;
  if (not $upload
      and not QuestionaskerException(GetId())
      and not $QuestionaskerRememberAnswer && GetParam($QuestionaskerSecretKey, 0)
      and not UserIsEditor()) {
    my $question = QuestionaskerGetQuestion();
    $form =~ s/(.*)<p>(.*?)<label for="username">/$1$question<p>$2<label for="username">/;
  }
  return $form;
}

This commit als moves from &$foo to $foo->() based on a recommendation
in Modern Perl by Conway.
2015-08-18 11:11:13 +02:00
Alex Schroeder
58e9a1e240 use v5.10 everywhere + enabled test in meta.t 2015-08-18 10:48:03 +02:00
Alex Schroeder
f98374df9b PrintFooter relies on @MyFooters
We already called all the subs on @MyFooters and printed the result,
but this commit moves all the code from PrintFooters into subs and
puts those subs on @MyFooters. This allows us to write modules that
can better control where exactly their output should appear. In this
case the change was required in order to allow the Google +1 module to
coexist with code that maybe prints the comment form for all pages.

For example, knowing that the Google +1 sub is the first on one the
list because of unshift(@MyFooters, \&GooglePlusPrintFooter), we can
now write the following:

splice(@MyFooters, 1, 0, \&MyCommentsInTheFooter);

sub MyCommentsInTheFooter {
  my ($id, $rev, $comment) = @_;
  if (not $GooglePlusThisPagePrintedJournal
      and (GetParam('action', 'browse') eq 'browse'
           and $id and $CommentsPrefix
	   and $id ne $RCName
      	   and $id !~ /^$CommentsPrefix(.*)/o)) {

    my $target = $CommentsPrefix . $id;
    my $page = '';
    $page = PageHtml($target) if $IndexHash{$target};
    return $q->div({-class=>'comment'},
		   $q->h2(T('Comments')),
		   $page)
	. GetCommentForm("$CommentsPrefix$id", $rev, $comment);
  }
}

The Google +1 extension was also fixed to not triger the EFF's Privacy
Badger. This is OK because we're using a two step button: The user
needs to click a button before we're loading the script from Google.
2015-08-17 13:39:34 +02:00
Aleks-Daniel Jakimenko
6ccf5b7c14 Getting rid of %InvisibleCookieParameters
This is no longer required because we don't print cookies nowadays.
2015-08-08 03:40:23 +03:00
Alex Schroeder
dfa71cb2e3 Revert "Changed EN DASH to - in copyright lines"
This reverts commit 06c7fedec0.
2015-07-28 22:44:53 +02:00
Alex Schroeder
06c7fedec0 Changed EN DASH to - in copyright lines
The EN DASH is not really required in year ranges such as 2012–2015 when
we're talking about comments in source code that is probably being
displayed in a fixed font anyway. Changing back to an ordinary hypen
allows us to make a meaningful test for use utf8.
2015-07-28 22:14:37 +02:00
Aleks-Daniel Jakimenko
40ec24349a No more "*Sub = *NewSub", \&NewSub used instead. (Partial progress) 2015-04-11 23:41:33 +03:00
Aleks-Daniel Jakimenko
6f8d281d79 No more "use vars"! 2015-04-10 13:31:28 +03:00
Alex Schroeder
19d0a2a2df questionasker.pl ready for use strict
GetEditForm uses the second parameter to indicate that it's an upload.
We need to pass it via to QuestionAddTo if we want to use it there.
2015-03-29 23:21:14 +02:00
Aleks-Daniel Jakimenko
4492ede096 "use strict;" in modules (some modules have problems) 2015-03-27 03:01:01 +02:00
Alex Schroeder
5aba2ae56f Fixed typo in AddModuleDescription sub name 2014-08-21 22:23:23 +02:00
Alex Jakimenko
ee932dee37 Automatically reformatted modules 2014-08-21 07:29:46 +03:00
Alex Schroeder
62b2e22da8 Questionasker: encoding issue with hidden fields
We need to get rid of $q->hidden when using Unicode, as suggested by
tyatsumi on the wiki.
2014-06-03 11:19:50 +02:00
Alex Schroeder
cd2b4d624e Remove $HttpCharset and moved everything to UTF-8
This also required some changes to the tests where explicit UTF-8
encoding had been used in the past.
2012-05-22 11:50:23 +02:00
Alex Schroeder
f11e2a8731 getting rid of $Id$ tags in $WikiDescription
Replaced the $Id$ tags in $WikiDescription for all the modules and wiki.pl itself with a link to the source and an appropriate wiki page, if possible. This is shown in action=version and should help users figure out what another wiki has installed.
2012-04-19 02:18:45 +02:00
Alex Schroeder
2eabfb9d83 (QuestionAddTo): Trying to fix a
surprising Perl regular expression feature.
2009-05-25 11:40:46 +00:00
Alex Schroeder
64ab4ef4c6 (QuestionAddTo): Adapted to changes in
GetCommentForm.
2009-05-22 19:26:28 +00:00
Alex Schroeder
eb5eeafda7 (NewQuestionaskerDoPost): Only reveal
the secret key when a question has been asked (and not after a
simple preview).
2008-06-11 13:05:48 +00:00
Alex Schroeder
b224f97e28 (QuestionAddTo): Use
$QuestionaskerSecretKey instead of the hard-coded 'question'.
2008-04-14 11:25:23 +00:00
Alex Schroeder
c1c283e0ce (NewQuestionaskerDoPost,
QuestionAddTo): Editor password is good enough as suggested by
Weakish Jiang.
2008-02-19 09:07:26 +00:00
Alex Schroeder
64f0343054 (NewQuestionaskerGetEditForm): Moved
code to QuestionAddTo.
(QuestionAddTo): New.
(NewQuestionaskerGetCommentForm): Do the same thing for comments.
2008-01-28 16:01:24 +00:00
Alex Schroeder
ad0c8d4d08 (NewQuestionaskerDoPost): Pass
aftertext through.
2007-11-11 10:25:29 +00:00
Alex Schroeder
d7101def71 (NewQuestionaskerGetEditForm): Fix argument list for
OldQuestionaskerGetEditForm.
2007-10-07 20:19:02 +00:00
Alex Schroeder
a1c4b8ea4f (NewQuestionaskerDoPost): Call QuestionaskerGetQuestion with
parameter.
(QuestionaskerGetQuestion): Add submit button with parameter.
2007-10-07 20:13:10 +00:00
Alex Schroeder
cd2481c985 (NewQuestionaskerDoPost): Pass on
parameters and ask another question if the question has not been
answered.
(NewQuestionaskerGetFormStart, NewQuestionaskerGetEditForm): Hook
into GetEditForm instead of GetFormStart.
2007-10-07 20:00:08 +00:00
Alex Schroeder
e68da7f19c ($QuestionaskerSecretKey): New option.
(QuestionaskerInit, NewQuestionaskerDoPost): Use it.
2007-10-01 00:17:32 +00:00
Alex Schroeder
46c98aa5cf Switch to GPLv3 2007-08-17 00:30:31 +00:00
Alex Schroeder
7689b3f636 Allow seven lives for cats. 2007-08-17 00:26:35 +00:00
Alex Schroeder
e9b7971daa updated copyright year 2007-01-12 02:00:44 +00:00
Alex Schroeder
48688c9896 (NewQuestionaskerDoPost): Added 'Use
the back button to return the previous page and try again.'
2007-01-04 10:51:11 +00:00
Alex Schroeder
c6f6e3d0d4 (QuestionaskerInit): Replaced
@AdminPages with %AdminPages.
2006-07-15 23:14:02 +00:00
Alex Schroeder
efb6b7c5cf (NewQuestionaskerDoPost): No more
logging of Q&A.
($QuestionaskerRememberAnswer): New option.
(QuestionaskerInit): Add question parameter to cookie.
(NewQuestionaskerDoPost): Set question parameter in cookie if
answered correctly.
(NewQuestionaskerDoPost, NewQuestionaskerGetFormStart): Use new
option and parameter from cookie.
2006-06-05 21:28:14 +00:00
Alex Schroeder
5e868e0409 (NewQuestionaskerDoPost): No more
logging of Q&A.
2006-06-05 20:21:35 +00:00
Alex Schroeder
72f573e465 (NewQuestionaskerDoPost): No answer
required for previews. Log all questions and answers. Print
footer.
(@QuestionaskerQuestions): Make default questions harder to answer
such that pasting spam into the answer field does not have a high
chance of answering the question.
2006-05-30 20:05:14 +00:00
Alex Schroeder
2fce63f6c7 (QuestionaskerInit): New sub to add $QuestionaskerRequiredList to
@AdminPages.
2006-05-28 22:28:48 +00:00
Alex Schroeder
f03ff473de Simplified code.
(NewQuestionaskerDoPost): Extract id from the title parameter.
(%QuestionaskerProtectedForms): New option.
(NewQuestionaskerGetFormStart): Use it.
(QuestionaskerGetQuestion): Use CGI.pm functions to create HTML.
Make valid HTML.
2006-05-28 22:20:21 +00:00
Alex Schroeder
6bfcd6dae8 (QuestionaskerException): Invert some tests. 2006-05-26 23:18:16 +00:00
Alex Schroeder
e2619e890c (QuestionaskerException): Check $QuestionaskerRequiredList. 2006-05-26 23:13:55 +00:00
Alex Schroeder
ad55a826dd ($QuestionaskerBypass): Undocumented
option removed.
(NewQuestionaskerDoPost): Removed bypass.
(@QuestionaskerQuestions): Uncommented some questions, removed
some others.
(QuestionaskerException): New.
(NewQuestionaskerGetFormStart): No questions asked for admins.
Check for exceptions.
2006-05-26 23:08:16 +00:00
Alex Schroeder
79df8bab52 *** empty log message *** 2005-12-18 00:07:53 +00:00
Alex Schroeder
70d9d21f7b new version awwaiid 2005-12-18 00:07:36 +00:00
Brock Wilcox
c3fd5288a0 added questionasker module 2004-12-16 04:34:07 +00:00