Permalink
Browse files

Simplify tags used in wiki.

Separate title from body field in wiki.
  • Loading branch information...
1 parent ae8b200 commit d02fb92f4f7071a7fdcfe62dc393c1520c52544b frabcus committed Apr 5, 2006
Showing with 32 additions and 28 deletions.
  1. +11 −0 todo.txt
  2. +16 −25 website/account/wiki.php
  3. +2 −2 website/pretty.inc
  4. +3 −1 website/wiki.inc
View
@@ -1,3 +1,7 @@
+1999 -- put date lords goes back to now
+check all appear in div listing page
+
+Sign up to email list from top of page form while logged in and doesn't work
- when succeeded in signing up for newsletter, should advertise full login
- instead of screen name AND real name just have "name". let people change it.
@@ -91,9 +95,16 @@ Backup dynamic database on cron job
When counts mismatch between list of names and Hansard's totals,
automatically say it is suspicious
+Make pretty table instead of equation for division comparison
+http://www.publicwhip.org.uk/division.php?date=2005-12-02&number=114&date2=2004-07-16&number2=229
+
+& isn't escaped to & in URLs
+
Future
------
+"Publish the whip" campaign - get people to sign up to it
+
Show on division listing page where Lib Dem voted with Tory, where with Labour
Mark completely uncontentious divisions (nobody opposed) in some special way.
View
@@ -1,5 +1,5 @@
<?php require_once "../common.inc";
-# $Id: wiki.php,v 1.29 2006/03/06 19:09:56 frabcus Exp $
+# $Id: wiki.php,v 1.30 2006/04/05 05:08:49 frabcus Exp $
# vim:sw=4:ts=4:et:nowrap
# The Public Whip, Copyright (C) 2003 Francis Irving and Julian Todd
@@ -30,6 +30,8 @@
trigger_error("Unknown wiki type " . htmlspecialchars($type), E_USER_ERROR);
$newtext = $_POST["newtext"];
+ $newtitle = $_POST["newtitle"];
+ $newdescription = $_POST["newdescription"];
$submit = db_scrub($_POST["submit"]);
$rr = db_scrub($_GET["rr"]);
@@ -39,17 +41,19 @@
$prettydate = date("j M Y", strtotime($params[0]));
$title = "Edit division description - " . $division_details['division_name'] . " - $prettydate - Division No. $params[1]";
$debate_gid = str_replace("uk.org.publicwhip/debate/", "", $division_details['debate_gid']);
+
+ if ($type == "motion") {
+ $motion_data = get_wiki_current_value("motion", array($params[0], $params[1], $params[2]));
+ $prev_name = extract_title_from_wiki_text($motion_data['text_body']);
+ $prev_description = extract_motion_text_from_wiki_text($motion_data['text_body']);
+ }
if ($submit && (!$just_logged_in))
{
if ($submit == "Save") {
- if ($type == "motion") {
- $motion_data = get_wiki_current_value("motion", array($params[0], $params[1], $params[2]));
- $prev_name = extract_title_from_wiki_text($motion_data['text_body']);
- $prev_description = extract_motion_text_from_wiki_text($motion_data['text_body']);
- }
-
if ($type == 'motion') {
+ $newtext = add_motion_missing_wrappers($newdescription, $newtitle);
+
$curr_name = extract_title_from_wiki_text($newtext);
$curr_description = extract_motion_text_from_wiki_text($newtext);
$name_diff = format_linediff(trim($prev_name), trim($curr_name), false); # always have link
@@ -118,25 +122,20 @@
<tr>
<td width="64%" valign="top">
- <p><b>Edit division title and description:</b>
-<?
- }
-?>
<P>
<FORM ACTION="<?=$REQUEST_URI?>" METHOD="POST">
- <textarea name="newtext" style="width: 100%" rows="25" cols="45"><?=html_scrub($values['text_body'])?></textarea>
+ <B>Division title:</b> <BR><INPUT TYPE="TEXT" NAME="newtitle" VALUE="<?=html_scrub($prev_name)?>" SIZE="40" MAXLENGTH="50">
+ <P><B>Division description:</b> <textarea name="newdescription" style="width: 100%" rows="25" cols="45"><?=html_scrub($prev_description)?></textarea>
<p>
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Save" accesskey="S">
<INPUT TYPE="SUBMIT" NAME="submit" VALUE="Cancel">
</FORM>
</P>
-<?
- if ($type == 'motion') {
-?>
<p><a href="<?=get_wiki_history_link($type, $params)?>">View change history</a>
-
<?
+ } else {
+ trigger_error("Unknown type for wiki", E_USER_ERROR);
}
?>
</td>
@@ -145,23 +144,15 @@
<td width="33%" valign="top">
- <p><b>Editing tips:</b></p>
-
- <p><span class="ptitle">Separators</span>. Leave the "DIVISION TITLE", "MOTION EFFECT" and "COMMENTS AND NOTES"
- in place, so our computer knows how to break it up.
- If you don't want to delete text, move it out of the way below "COMMENTS AND NOTES"
- where it will be hidden.</p>
-
<p><span class="ptitle">Questions, thoughts?</span>
<a href="/forum/viewforum.php?f=2">Discuss</a>
with other motion researchers on our special forum. (especially when we get the deep link working).
<p><span class="ptitle">Allowable HTML tags</span>. You can use the following:
<ul>
<li>&lt;p&gt; - begin paragraph
- <li>&nbsp;&lt;p class="italic"&gt; - begin italic paragraph
- <li>&nbsp;&lt;p class="indent"&gt; - begin indented paragraph
<li>&lt;/p&gt; - end paragraph
+ <li>&lt;blockquote&gt;, &lt;/blockquote&gt; - quoted paragraph
<li>&lt;i&gt; &lt;/i&gt; - italic
<li>&lt;b&gt; &lt;/b&gt; - bold
<li>&lt;a href="http://..."&gt; &lt;/a&gt; - link
View
@@ -1,6 +1,6 @@
<?php
-# $Id: pretty.inc,v 1.38 2006/03/14 11:03:26 publicwhip Exp $
+# $Id: pretty.inc,v 1.39 2006/04/05 05:08:48 frabcus Exp $
# The Public Whip, Copyright (C) 2003 Francis Irving and Julian Todd
# This is free software, and you are welcome to redistribute it under
@@ -306,7 +306,7 @@ $guy_c['quot']),array('&lt;','&gt;','&quot;'),$str);
/* Used upon submission; only keeps allowed HTML (see array below) */
function guy_strip_bad($str, $mode='') {
global $guy_c;
- $html_allowed = array('a', 'b', 'i', 'p', 'ol', 'ul', 'li');
+ $html_allowed = array('a', 'b', 'i', 'p', 'ol', 'ul', 'li', 'blockquote');
$html_allowed_regexp = join('|',$html_allowed);
$html_allowed_striptags = '<'.join('><',$html_allowed).'>';
$str = strip_tags($str,$html_allowed_striptags);
View
@@ -1,5 +1,5 @@
<?php
-# $Id: wiki.inc,v 1.9 2005/11/28 15:38:23 frabcus Exp $
+# $Id: wiki.inc,v 1.10 2006/04/05 05:08:48 frabcus Exp $
# vim:sw=4:ts=4:et:nowrap
# Editable text with history
@@ -89,6 +89,8 @@ function extract_motion_text_from_wiki_text($text)
if (preg_match("/--- MOTION EFFECT ---(.*)--- COMMENT/s", $text, $matches)) {
$motion = $matches[1];
}
+ $motion = preg_replace("/<p\b.*?class=\"italic\".*?>(.*)<\/p>/",'<p><i>\\1</i></p>',$motion);
+ $motion = preg_replace("/<p\b.*?class=\"indent\".*?>(.*)<\/p>/",'<blockquote>\\1</blockquote>',$motion);
$motion = guy2html(guy_strip_bad($motion));
return $motion;

0 comments on commit d02fb92

Please sign in to comment.