[Pieforms-commit] SF.net SVN: pieforms: [3] pieforms/src/pieform
Status: Alpha
Brought to you by:
oracleshinoda
|
From: <ora...@us...> - 2006-11-18 09:33:09
|
Revision: 3
http://svn.sourceforge.net/pieforms/?rev=3&view=rev
Author: oracleshinoda
Date: 2006-11-18 01:33:03 -0800 (Sat, 18 Nov 2006)
Log Message:
-----------
Fixed header comments, and function names everywhere. Most elements are still
busted, but they are slowly being fixed.
Modified Paths:
--------------
pieforms/src/pieform/elements/button.php
pieforms/src/pieform/elements/cancel.php
pieforms/src/pieform/elements/checkbox.php
pieforms/src/pieform/elements/date.php
pieforms/src/pieform/elements/expiry.php
pieforms/src/pieform/elements/fieldset.php
pieforms/src/pieform/elements/file.php
pieforms/src/pieform/elements/hidden.php
pieforms/src/pieform/elements/html.php
pieforms/src/pieform/elements/password.php
pieforms/src/pieform/elements/radio.php
pieforms/src/pieform/elements/select.php
pieforms/src/pieform/elements/submit.php
pieforms/src/pieform/elements/submitcancel.php
pieforms/src/pieform/elements/text.php
pieforms/src/pieform/elements/textarea.php
pieforms/src/pieform/elements/userlist.php
pieforms/src/pieform/elements/wysiwyg.php
pieforms/src/pieform/renderers/table.php
Modified: pieforms/src/pieform/elements/button.php
===================================================================
--- pieforms/src/pieform/elements/button.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/button.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,29 +16,24 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
- * Renders a button. Custom buttons are rendered nearly the same as
- * normal submit buttons, only their name is changed (for use by the Form class
- * internally).
- *
+ * Renders an <input type="button"> element.
+ *
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-
-function form_render_button($element, $form) {
+function pieform_render_button($element, Pieform $form) {
return '<input type="button"'
- . Form::element_attributes($element)
+ . Pieform::element_attributes($element)
. ' value="' . hsc($form->get_value($element)) . '">';
}
Modified: pieforms/src/pieform/elements/cancel.php
===================================================================
--- pieforms/src/pieform/elements/cancel.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/cancel.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,27 +16,25 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Renders a "cancel" button. Custom buttons are rendered nearly the same as
- * normal submit buttons, only their name is changed (for use by the Form class
+ * normal submit buttons, only their name is changed (for use by the Pieform class
* internally).
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_cancel($element, Form $form) {
- $attributes = Form::element_attributes($element);
+function pieform_render_cancel($element, Pieform $form) {
+ $attributes = Pieform::element_attributes($element);
$attributes = preg_replace('/name="(.*)"/', 'name="cancel_$1"', $attributes);
$attributes = preg_replace('/id="(.*)"/', 'id="cancel_$1"', $attributes);
return '<input type="submit"'
@@ -46,7 +44,7 @@
// @todo how to support cancel buttons for ajax post? Possibly do a full post regardless...
// or allow the user to specify a javascript function to run... it could do document.location=
-function form_get_value_js_cancel($element, $form) {
+function pieform_get_value_js_cancel($element, Pieform $form) {
$formname = $form->get_name();
$name = $element['name'];
return " data['{$name}_cancel'] = document.forms['$formname'].elements['{$name}_cancel'].value;\n";
Modified: pieforms/src/pieform/elements/checkbox.php
===================================================================
--- pieforms/src/pieform/elements/checkbox.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/checkbox.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,24 +16,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Provides a basic checkbox input.
*
- * @param array $element The element to render
- * @param Form $form The form to render the element for
- * @return string The HTML for the element
+ * @param array $element The element to render
+ * @param Pieform $form The form to render the element for
+ * @return string The HTML for the element
*/
-function form_render_checkbox($element, Form $form) {
+function pieform_render_checkbox($element, Pieform $form) {
$checked = false;
if (!empty($element['value'])) {
$checked = true;
@@ -46,12 +44,12 @@
}
return '<input type="checkbox"'
- . Form::element_attributes($element)
+ . Pieform::element_attributes($element)
. ($checked ? ' checked="checked"' : '')
. '>';
}
-function form_get_value_js_checkbox($element, Form $form) {
+function pieform_get_value_js_checkbox($element, Pieform $form) {
$formname = $form->get_name();
$name = $element['name'];
return <<<EOF
Modified: pieforms/src/pieform/elements/date.php
===================================================================
--- pieforms/src/pieform/elements/date.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/date.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,24 +16,22 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieforms
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Provides a date picker, in the form of three dropdowns.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_date($element, Form $form) {
+function pieform_render_date($element, Pieform $form) {
$result = '';
$name = $element['name'];
$element['minyear'] = (isset($element['minyear'])) ? intval($element['minyear']) : 1950;
@@ -69,7 +67,7 @@
}
/** gets the value explicitly from the request */
-function form_get_value_date($element, Form $form) {
+function pieform_get_value_date($element, Pieform $form) {
$name = $element['name'];
$global = ($form->get_method() == 'get') ? $_GET : $_POST;
$time = mktime(0, 0, 0, $global[$name . '_month'], $global[$name . '_day'], $global[$name . '_year']);
@@ -79,7 +77,7 @@
return $time;
}
-function form_get_value_js_date($element, Form $form) {
+function pieform_get_value_js_date($element, Pieform $form) {
$formname = $form->get_name();
$name = $element['name'];
return <<<EOF
@@ -91,7 +89,7 @@
}
/** helper: used when rendering the element, to get the value for it */
-function form_render_select_get_value($timeperiod, $min, $max, $element, Form $form) {
+function pieform_render_select_get_value($timeperiod, $min, $max, $element, Pieform $form) {
static $lookup = array(
'year' => 0,
'month' => 1,
Modified: pieforms/src/pieform/elements/expiry.php
===================================================================
--- pieforms/src/pieform/elements/expiry.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/expiry.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,25 +16,23 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
- * @author Nigel McNie <ni...@ca...>
+ * @package pieform
+ * @subpackage element
+ * @author Richard Mansfield <ric...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Provides a duration chooser, with a text box for a number and a
* select box to choose the units, in days, weeks, months, years, or 'no end date'.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_expiry($element, Form $form) {
+function pieform_render_expiry($element, Pieform $form) {
$result = '';
$name = $element['name'];
if (!isset($element['defaultvalue'])) {
@@ -167,7 +165,7 @@
}
// /** gets the value explicitly from the request */
-// function form_get_value_expiry($element, Form $form) {
+// function pieform_get_value_expiry($element, Pieform $form) {
// $name = $element['name'];
// $global = ($form->get_method() == 'get') ? $_GET : $_POST;
// return $global[$name];
Modified: pieforms/src/pieform/elements/fieldset.php
===================================================================
--- pieforms/src/pieform/elements/fieldset.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/fieldset.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,25 +16,23 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieforms
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Renders a fieldset. Fieldsets contain other elements, and do not count as a
* "true" element, in that they do not have a value and cannot be validated.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_fieldset($element, Form $form) {
+function pieform_render_fieldset($element, Pieform $form) {
$result = "\n<fieldset>\n";
if (isset($element['legend'])) {
$result .= '<legend>' . hsc($element['legend']) . "</legend>\n";
@@ -42,9 +40,9 @@
foreach ($element['elements'] as $subname => $subelement) {
if ($subelement['type'] == 'hidden') {
- throw new FormError("You cannot put hidden elements in fieldsets");
+ throw new PieformError("You cannot put hidden elements in fieldsets");
}
- $result .= "\t" . form_render_element($subelement, $form);
+ $result .= "\t" . pieform_render_element($subelement, $form);
}
$result .= "</fieldset>\n";
Modified: pieforms/src/pieform/elements/file.php
===================================================================
--- pieforms/src/pieform/elements/file.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/file.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,29 +16,29 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a basic HTML <input type="file"> element.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_file($element, Form $form) {
+function pieform_render_file($element, Pieform $form) {
return '<input type="file"'
- . Form::element_attributes($element) . '>';
+ . Pieform::element_attributes($element) . '>';
}
-function form_get_value_file($element, Form $form) {
+function pieform_get_value_file($element, Pieform $form) {
if (isset($_FILES[$element['name']])) {
if (!$_FILES[$element['name']]['error']) {
return $_FILES[$element['name']];
@@ -47,7 +47,7 @@
}
}
-function form_is_empty_file($value, $element) {
+function pieform_is_empty_file($value, $element) {
if (isset($_FILES[$element['name']]) && !$_FILES[$element['name']]['error']) {
return false;
}
Modified: pieforms/src/pieform/elements/hidden.php
===================================================================
--- pieforms/src/pieform/elements/hidden.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/hidden.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,37 +16,36 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Renders a hidden element.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_hidden($element, Form $form) {
+function pieform_render_hidden($element, Pieform $form) {
+ // @todo use the exclude parameter of element_attributes for this
unset($element['tabindex']);
$value = $form->get_value($element);
if (is_array($value)) {
$result = '';
foreach ($value as $k => $v) {
- $result .= '<input type="hidden" name="' . hsc($element['name'])
- . '[' . hsc($k) . ']" value="' . hsc($v) . "\">\n";
+ $result .= '<input type="hidden" name="' . Pieform::hsc($element['name'])
+ . '[' . Pieform::hsc($k) . ']" value="' . Pieform::hsc($v) . "\">\n";
}
return $result;
}
return '<input type="hidden"'
- . Form::element_attributes($element)
- . ' value="' . hsc($form->get_value($element)) . "\">\n";
+ . Pieform::element_attributes($element)
+ . ' value="' . Pieform::hsc($form->get_value($element)) . "\">\n";
}
?>
Modified: pieforms/src/pieform/elements/html.php
===================================================================
--- pieforms/src/pieform/elements/html.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/html.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,25 +16,25 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Penny Leach <pe...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Provides a way to pass in html that gets rendered
* by the render (as opposed to the markup element)
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_html($element, $form) {
+function pieform_render_html($element, $form) {
return $element['value'];
}
Modified: pieforms/src/pieform/elements/password.php
===================================================================
--- pieforms/src/pieform/elements/password.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/password.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,30 +16,30 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a password field
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_password($element, $form) {
+function pieform_render_password($element, $form) {
return '<input type="password"'
- . Form::element_attributes($element)
+ . Pieform::element_attributes($element)
. ' value="' . hsc($form->get_value($element)) . '">';
}
-function form_get_value_password($element, Form $form) {
+function pieform_get_value_password($element, Pieform $form) {
$global = ($form->get_method() == 'get') ? $_GET : $_POST;
if (isset($global[$element['name']])) {
return $global[$element['name']];
Modified: pieforms/src/pieform/elements/radio.php
===================================================================
--- pieforms/src/pieform/elements/radio.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/radio.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,26 +16,26 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a set of radio buttons for a form
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_radio($element, Form $form) {
+function pieform_render_radio($element, Pieform $form) {
if (!isset($element['options']) || !is_array($element['options']) || count($element['options']) < 1) {
- throw new FormException('Radio elements should have at least one option');
+ throw new PieformException('Radio elements should have at least one option');
}
$result = '';
@@ -51,7 +51,7 @@
$uid = $id . substr(md5(microtime()), 0, 4);
$element['id'] = $uid;
$result .= '<input type="radio"'
- . Form::element_attributes($element)
+ . Pieform::element_attributes($element)
. ' value="' . hsc($value) . '"'
. (($form_value == $value) ? ' checked="checked"' : '')
. "> <label for=\"$uid\">" . hsc($text) . "</label>$separator";
@@ -69,7 +69,7 @@
* @todo maybe later: make the get_value_js functions return a javascript function,
* to keep their stuff in its own scope. Maybe. If js scoping rules mean this will help.
*/
-function form_get_value_js_radio($element, Form $form) {
+function pieform_get_value_js_radio($element, Pieform $form) {
$formname = $form->get_name();
$name = $element['name'];
return <<<EOF
@@ -79,7 +79,7 @@
EOF;
}
-function form_render_radio_set_attributes($element) {
+function pieform_render_radio_set_attributes($element) {
$element['nolabel'] = true;
$element['rules']['validateoptions'] = true;
return $element;
Modified: pieforms/src/pieform/elements/select.php
===================================================================
--- pieforms/src/pieform/elements/select.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/select.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,24 +16,24 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a dropdown list, including support for multiple choices.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_select($element, Form $form) {
+function pieform_render_select($element, Pieform $form) {
if (!empty($element['multiple'])) {
$element['name'] .= '[]';
}
@@ -46,7 +46,7 @@
}
$result = '<select'
- . Form::element_attributes($element)
+ . Pieform::element_attributes($element)
. (!empty($element['multiple']) ? ' multiple="multiple"' : '')
. ">\n";
if (!isset($element['options']) || !is_array($element['options']) || count($element['options']) < 1) {
@@ -85,7 +85,7 @@
return $result;
}
-function form_get_value_js_select($element, Form $form) {
+function pieform_get_value_js_select($element, Pieform $form) {
$formname = $form->get_name();
$name = $element['name'];
if ($element['collapseifoneoption']) {
@@ -98,7 +98,7 @@
EOF;
}
-function form_render_select_set_attributes($element) {
+function pieform_render_select_set_attributes($element) {
$element['collapseifoneoption'] = true;
$element['rules']['validateoptions'] = true;
return $element;
Modified: pieforms/src/pieform/elements/submit.php
===================================================================
--- pieforms/src/pieform/elements/submit.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/submit.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,30 +16,30 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a submit button
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_submit($element, $form) {
+function pieform_render_submit($element, $form) {
return '<input type="submit"'
- . Form::element_attributes($element)
+ . Pieform::element_attributes($element)
. ' value="' . hsc($form->get_value($element)) . '">';
}
-function form_render_submit_set_attributes($element) {
+function pieform_render_submit_set_attributes($element) {
$element['ajaxmessages'] = true;
return $element;
}
Modified: pieforms/src/pieform/elements/submitcancel.php
===================================================================
--- pieforms/src/pieform/elements/submitcancel.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/submitcancel.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,34 +16,34 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a submit and cancel button
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_submitcancel($element, Form $form) {
+function pieform_render_submitcancel($element, Pieform $form) {
require_once('submit.php');
require_once('cancel.php');
$submitelement = $element;
$submitelement['value'] = $element['value'][0];
$cancelelement = $element;
$cancelelement['value'] = $element['value'][1];
- return form_render_submit($submitelement, $form) . ' ' . form_render_cancel($cancelelement, $form);
+ return pieform_render_submit($submitelement, $form) . ' ' . form_render_cancel($cancelelement, $form);
}
-function form_render_submitcancel_set_attributes($element) {
+function pieform_render_submitcancel_set_attributes($element) {
$element['ajaxmessages'] = true;
return $element;
}
Modified: pieforms/src/pieform/elements/text.php
===================================================================
--- pieforms/src/pieform/elements/text.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/text.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,27 +16,25 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Provides a basic text field input.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_text($element, $form) {
+function pieform_render_text($element, $form) {
return '<input type="text"'
- . Form::element_attributes($element)
- . ' value="' . hsc($form->get_value($element)) . '">';
+ . Pieform::element_attributes($element)
+ . ' value="' . Pieform::hsc($form->get_value($element)) . '">';
}
?>
Modified: pieforms/src/pieform/elements/textarea.php
===================================================================
--- pieforms/src/pieform/elements/textarea.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/textarea.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,24 +16,24 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a basic HTML <textarea> element.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_textarea($element, $form) {
+function pieform_render_textarea($element, $form) {
$rows = $cols = $style = '';
if (isset($element['height'])) {
$style .= 'height:' . $element['height'] . ';';
@@ -60,7 +60,7 @@
return '<textarea'
. (($rows) ? ' rows="' . $rows . '"' : '')
. (($cols) ? ' cols="' . $cols . '"' : '')
- . Form::element_attributes($element, array('maxlength', 'size'))
+ . Pieform::element_attributes($element, array('maxlength', 'size'))
. '>' . hsc($form->get_value($element)) . '</textarea>';
}
Modified: pieforms/src/pieform/elements/userlist.php
===================================================================
--- pieforms/src/pieform/elements/userlist.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/userlist.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,25 +16,25 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Martyn Smith <ma...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Provides a basic text field input.
*
* @todo this is just lies ...
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_userlist($element, Form $form) {
+function pieform_render_userlist($element, Pieform $form) {
$smarty = smarty();
$smarty->left_delimiter = '{{';
@@ -65,7 +65,7 @@
return $smarty->fetch('form/userlist.tpl');
}
-function form_get_value_userlist($element, Form $form) {
+function pieform_get_value_userlist($element, Pieform $form) {
$name = $element['name'];
$global = ($form->get_method() == 'get') ? $_GET : $_POST;
@@ -81,13 +81,13 @@
return array_map('intval', explode(',', $value));
}
- throw new FormException("Invalid value for userlist form element '$name' = '$value'");
+ throw new PieformException("Invalid value for userlist form element '$name' = '$value'");
}
return null;
}
-function form_is_empty_userlist($value, $element) {
+function pieform_is_empty_userlist($value, $element) {
if (is_array($value) && count($value)) {
return false;
}
@@ -95,7 +95,7 @@
return true;
}
-function form_render_userlist_set_attributes($element) {
+function pieform_render_userlist_set_attributes($element) {
// By default, use the filter select box
if (!isset($element['filter'])) {
$element['filter'] = true;
Modified: pieforms/src/pieform/elements/wysiwyg.php
===================================================================
--- pieforms/src/pieform/elements/wysiwyg.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/elements/wysiwyg.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,16 +16,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-element
+ * @package pieform
+ * @subpackage element
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
+
/**
* Renders a textarea, but with extra javascript to turn it into a wysigyw
* textarea.
@@ -34,10 +34,10 @@
* a bit later.
*
* @param array $element The element to render
- * @param Form $form The form to render the element for
+ * @param Pieform $form The form to render the element for
* @return string The HTML for the element
*/
-function form_render_wysiwyg($element, $form) {
+function pieform_render_wysiwyg($element, $form) {
$rows = $cols = $style = '';
if (isset($element['height'])) {
$style .= 'height:' . $element['height'] . ';';
@@ -64,7 +64,7 @@
return '<textarea'
. (($rows) ? ' rows="' . $rows . '"' : '')
. (($cols) ? ' cols="' . $cols . '"' : '')
- . Form::element_attributes($element, array('maxlength', 'size'))
+ . Pieform::element_attributes($element, array('maxlength', 'size'))
. '>' . hsc($form->get_value($element)) . '</textarea>';
}
@@ -72,7 +72,7 @@
* @todo document: basically, the required rule now works better, as stripping
* tags out takes away a whole bunch of hidden stuff
*/
-function form_is_empty_wysiwyg($value, $element) {
+function pieform_is_empty_wysiwyg($value, $element) {
return strip_tags($value) === '';
}
Modified: pieforms/src/pieform/renderers/table.php
===================================================================
--- pieforms/src/pieform/renderers/table.php 2006-11-18 09:30:45 UTC (rev 2)
+++ pieforms/src/pieform/renderers/table.php 2006-11-18 09:33:03 UTC (rev 3)
@@ -1,6 +1,6 @@
<?php
/**
- * This program is part of Mahara
+ * This program is part of Pieforms
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,16 +16,14 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * @package mahara
- * @subpackage form-renderer
+ * @package pieform
+ * @subpackage renderer
* @author Nigel McNie <ni...@ca...>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
- * @copyright (C) 2006,2007 Catalyst IT Ltd http://catalyst.net.nz
+ * @copyright (C) 2006 Catalyst IT Ltd http://catalyst.net.nz
*
*/
-defined('INTERNAL') || die();
-
/**
* Renders form elements inside a <table>.
*
@@ -35,7 +33,7 @@
* @return string The element rendered inside an appropriate
* container.
*/
-function form_renderer_table($builtelement, $rawelement) {
+function pieform_renderer_table($builtelement, $rawelement) {
if ($rawelement['type'] == 'fieldset') {
// Add table tags to the build element, to preserve HTML compliance
if (0 === strpos($builtelement, "\n<fieldset>\n<legend>")) {
@@ -65,10 +63,10 @@
if (isset($rawelement['title'])) {
if (!empty($rawelement['nolabel'])) {
// Don't bother with a lable for the element
- $result .= hsc($rawelement['title']);
+ $result .= Pieform::hsc($rawelement['title']);
}
else {
- $result .= '<label for="' . $rawelement['id'] . '">' . hsc($rawelement['title']) . '</label>';
+ $result .= '<label for="' . $rawelement['id'] . '">' . Pieform::hsc($rawelement['title']) . '</label>';
}
}
$result .= "</th>\n\t\t<td>";
@@ -76,7 +74,7 @@
// Contextual help
if (!empty($rawelement['help'])) {
- $result .= ' <span class="help"><a href="#" title="' . hsc($rawelement['help']) . '">?</a></span>';
+ $result .= ' <span class="help"><a href="#" title="' . Pieform::hsc($rawelement['help']) . '">?</a></span>';
}
$result .= "</td>\n\t</tr>\n";
@@ -98,15 +96,15 @@
return $result;
}
-function form_renderer_table_header() {
+function pieform_renderer_table_header() {
return "<table cellspacing=\"0\" border=\"0\"><tbody>\n";
}
-function form_renderer_table_footer() {
+function pieform_renderer_table_footer() {
return "</tbody></table>\n";
}
-function form_renderer_table_messages_js($id, $submitid) {
+function pieform_renderer_table_messages_js($id, $submitid) {
$result = <<<EOF
// Given a message and form element name, should set an error on the element
function {$id}_set_error(message, element) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|