diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-06-10 15:01:20 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-06-10 15:01:20 +0000 |
commit | d397bbe93587f015cd8db0dbf16ef6d1c1aef78b (patch) | |
tree | 82b3b8dc63b04c11aeadd5b18cee796e4da43144 /modules/poll | |
parent | 6b34310626b960a18646259d8d7caa1b6b2da1da (diff) | |
download | brdo-d397bbe93587f015cd8db0dbf16ef6d1c1aef78b.tar.gz brdo-d397bbe93587f015cd8db0dbf16ef6d1c1aef78b.tar.bz2 |
This a rather large commit that needs a lot of fine-tuning. If you
update, you'll break your site as you need switching from structure
to index.module: so this can be considered an intermediate commit.
If you upgrade, and you are welcome to, just create a collection
called "section" (for now) and assign your nodes some attributes
in the described format.
Feedback and bugreports are welcomed. Questions will be answered.
CHANGES:
- comment system:
+ when replying to a node (rather then to a comment), that
node is displayed above the reply form.
+ when replying to a comment (rather then to a node), that
comment is displayd above the reply form.
- removed structure.inc, removed structure.module.
- node.inc:
+ added 2 new node functions called 'node_attribute_edit()' and
'node_attribute_save()' used to 'hook in' any indexing system
including your home-brewed stuff if you'd want to. Currently,
index.module is the facto default index system.
See story.module for usage.
- book.module, story.module, poll.module, page.module, forum.module:
+ added preview functionality to administration section (via node
module).
+ removed all references to structure.inc (category, topic).
- moderate.module:
+ removed all references to structure.inc (category, topic).
- book.module, story.module, page.module, forum.module:
+ increased the sizes of some textareas.
- submit.php:
+ removed all references to structure.inc (category, topic).
- marvin.theme:
+ removed dead code: function story() was depricated.
- unconed.theme:
+ removed hardcoded references to drop.org.
- marvin.theme, unconed.theme, jeroen.theme, yaroon.theme, example.theme:
+ removed all references to structure.inc (category, topic).
TODO:
- file.module, trip_link.module:
+ update preview functionality:
see story.module for example.
+ remove references to 'cid' and 'tid', use 'attribute' instead:
see story.module for example.
- extend and build upon index.module as well as making it configurable
Diffstat (limited to 'modules/poll')
-rw-r--r-- | modules/poll/poll.module | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/modules/poll/poll.module b/modules/poll/poll.module index ba6a0250a..cd9e0e306 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -28,7 +28,7 @@ function poll_delete($node) { if ($node->nid) { db_query("DELETE FROM poll_choices WHERE nid='" . $node->nid . "'"); - } + } } function poll_get_choices_array($poll) { @@ -87,7 +87,7 @@ function poll_help() { ?> <p>Poll.module allows you to run simple multiple choice polls on your site. After creating the necessary categories, you can add a poll through this administration interface.</p> <p>The poll.module also has a block to show the latest poll. If you combine it with a poll category that doesn't promote to the mainpage, you'll get a side-block only poll system.</p> - <p>If you want to set a limit on the duration of a poll, use the <i>Poll Duration</i> setting. After the specified interval, the poll will automatically be closed, preventing anymore voting.</p> + <p>If you want to set a limit on the duration of a poll, use the <i>Poll Duration</i> setting. After the specified interval, the poll will automatically be closed, preventing anymore voting.</p> <?php } @@ -175,9 +175,13 @@ function poll_form($edit = array(), $nocheck = 0) { 10713600 => t("4 months"), 31536000 => t("1 year")); $active = array(0 => "Closed", 1 => "Active"); - + $admin = ($edit[nid] && user_access($user,"poll")) ? 1 : 0; - + + if ($edit[title]) { + $form .= poll_view(new Poll(node_preview($edit))); + } + if ($admin && !is_array($edit[choices])) $edit = poll_get_choices_array($edit); /* Mini-form for number of choiceboxes */ @@ -198,15 +202,14 @@ function poll_form($edit = array(), $nocheck = 0) { $form .= form_select(t("Poll duration"), "runtime", $edit[runtime] ? $edit[runtime] : t("1 week"), $duration, t("After this period, the poll will automatically be closed.")); if ($admin) $form .= form_select(t("Poll status"), "active", $edit[active], $active); - $form .= structure_form("poll", $edit); - + $form .= node_attributes_edit($edit); // hidden fields: if ($edit[nid] > 0) { $form .= form_hidden("nid", $edit[nid]); } - if ((!$edit) || ($nocheck)) { + if ($nocheck) { $form .= form_submit(t("Preview")); } else if (!$edit[title]) { @@ -229,10 +232,10 @@ function poll_save($edit) { global $status, $user; if (!$edit[nid]) { - $nid = node_save($edit, array(active => 1, author => $user->id, cid, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), tid, timestamp => time(), title, type => "poll", votes => 0, voters => "")); + $nid = node_save($edit, array(active => 1, attribute => node_attributes_save($edit), author => $user->id, cid, comment => variable_get("poll_comment", 0), moderate => variable_get("poll_moderate", ""), promote => variable_get("poll_promote", 0), runtime, score => 0, status => variable_get("poll_status", $status[queued]), tid, timestamp => time(), title, type => "poll", votes => 0, voters => "")); } else if (user_access($user)) { - $nid = node_save($edit, array(active, cid, tid, runtime, title, type => "poll")); + $nid = node_save($edit, array(active, attribute => node_attributes_save($edit), cid, tid, runtime, title, type => "poll")); db_query("DELETE FROM poll_choices WHERE nid='" . $nid . "'"); } if ($nid) { @@ -270,7 +273,6 @@ function poll_user() { case t("Refresh"): $refresh = 1; case t("Preview"): - poll_view(new Poll(node_preview($edit))); $theme->box(t("Submit"), poll_form($edit, $refresh)); break; case t("Submit"): |