option widgets.
- Add informational type option widget
- Add password type option widget
+ - Make all submit button names unique on compose screen
Version 1.5.1 (branched on 2006-02-12)
--------------------------------------
return $oTemplate->fetch('form.tpl');
}
+/**
+ * Creates unique widget names
+ *
+ * Names are formatted as such: "send1", "send2", "send3", etc.,
+ * where "send" in this example is what was given for $base_name
+ *
+ * @param string $base_name The name upon which to base the
+ * returned widget name.
+ * @param boolean $return_count When TRUE, this function will
+ * return the last number used to
+ * create a widget name for $base_name
+ * (OPTIONAL; default = FALSE).
+ *
+ * @return mixed When $return_output is FALSE, a string containing
+ * the unique widget name; otherwise an integer with
+ * the last number used to create the last widget
+ * name for the given $base_name (where 0 (zero) means
+ * that no such widgets have been created yet).
+ *
+ * @since 1.4.18 and 1.5.2
+ *
+ */
+function unique_widget_name($base_name, $return_count=FALSE)
+{
+ static $counts = array();
+
+ if (!isset($counts[$base_name]))
+ $counts[$base_name] = 0;
+
+ if ($return_count)
+ return $counts[$base_name];
+
+ ++$counts[$base_name];
+ return $base_name . $counts[$base_name];
+}
+
$oErrorHandler->setDelayedErrors(true);
/** SESSION/POST/GET VARS */
-sqgetGlobalVar('send', $send, SQ_POST);
+sqgetGlobalVar('send_button_count', $send_button_count, SQ_POST, 1, SQ_TYPE_INT);
+for ($i = 1; $i <= $send_button_count; $i++)
+ if (sqgetGlobalVar('send' . $i, $send, SQ_POST)) break;
// Send can only be achieved by setting $_POST var. If Send = true then
// retrieve other form fields from $_POST
if (isset($send) && $send) {
?>
<tr>
<td class="bottomSend">
- <input type="submit" name="send" value="<?php echo _("Send"); ?>" />
+ <input type="submit" name="<?php echo unique_widget_name('send'); ?>" value="<?php echo _("Send"); ?>" />
</td>
</tr>
<?php
}
?>
</table>
-</div>
\ No newline at end of file
+</div>
+<input type="hidden" name="send_button_count" value="<?php echo unique_widget_name('send', TRUE); ?>" />