aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-08 12:14:17 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-08-08 12:14:17 +0000
commit10f233a2e2a11416413585ceadafa0d7b07988bc (patch)
tree4dc3c0093d0c0c97cfcf88e7d89292341325350a
parentcef25136b69582dc9e6efd95284f4f3e40b7a53f (diff)
downloadelgg-10f233a2e2a11416413585ceadafa0d7b07988bc.tar.gz
elgg-10f233a2e2a11416413585ceadafa0d7b07988bc.tar.bz2
Refs #211: Two forms converted + extra functionality to input views
git-svn-id: https://code.elgg.org/elgg/trunk@1790 36083f99-b078-4883-b0ff-0f9b5a30f544
-rw-r--r--views/default/account/forms/forgotten_password.php10
-rw-r--r--views/default/account/forms/login.php21
-rw-r--r--views/default/input/access.php7
-rw-r--r--views/default/input/button.php5
-rw-r--r--views/default/input/checkboxes.php5
-rw-r--r--views/default/input/email.php6
-rw-r--r--views/default/input/file.php6
-rw-r--r--views/default/input/longtext.php7
-rw-r--r--views/default/input/password.php6
-rw-r--r--views/default/input/pulldown.php6
-rw-r--r--views/default/input/radio.php5
-rw-r--r--views/default/input/reset.php4
-rw-r--r--views/default/input/submit.php4
-rw-r--r--views/default/input/tags.php7
-rw-r--r--views/default/input/text.php11
-rw-r--r--views/default/input/url.php8
16 files changed, 83 insertions, 35 deletions
diff --git a/views/default/account/forms/forgotten_password.php b/views/default/account/forms/forgotten_password.php
index 18a9888fd..24c2df2f0 100644
--- a/views/default/account/forms/forgotten_password.php
+++ b/views/default/account/forms/forgotten_password.php
@@ -9,11 +9,11 @@
* @copyright Curverider Ltd 2008
* @link http://elgg.org/
*/
+
+ $form_body = "<p>" . elgg_echo('user:password:text') . "</p>";
+ $form_body .= "<p><b>". elgg_echo('username') . "</b> " . elgg_view('input/text', array('internalname' => 'username')) . "</p>";
+ $form_body .= "<p>" . elgg_view('input/submit', array('value' => elgg_echo('request'))) . "</p>";
?>
<div id="forgotten_box">
- <form action="<?php echo $vars['url']; ?>actions/user/requestnewpassword" method="post">
- <p><?php echo elgg_echo('user:password:text'); ?></p>
- <p><b><?php echo elgg_echo('username'); ?></b> <?php echo elgg_view('input/text', array('internalname' => 'username')); ?></p>
- <p><input type="submit" name="submit" class="submit_button" value="<?php echo elgg_echo('request'); ?>" /></p>
- </form>
+ <?php echo elgg_view('input/form', array('action' => "{$vars['url']}actions/user/requestnewpassword", 'body' => $form_body)); ?>
</div> \ No newline at end of file
diff --git a/views/default/account/forms/login.php b/views/default/account/forms/login.php
index ea37ff692..7afef1404 100644
--- a/views/default/account/forms/login.php
+++ b/views/default/account/forms/login.php
@@ -11,15 +11,20 @@
* @link http://elgg.org/
*/
- global $CONFIG;
+ global $CONFIG;
+
+ $form_body = "<p><label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'general-textarea')) . "</label>";
+ $form_body .= "<br />";
+ $form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'general-textarea')) . "</label><br />";
+ $form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))) . "</p>";
+ $form_body .= "<p>";
+ $form_body .= (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) ? "<a href=\"{$vars['url']}account/register.php\">" . elgg_echo('register') . "</a> : " : "";
+ $form_body .= "<a href=\"{$vars['url']}account/forgotten_password.php\">" . elgg_echo('user:password:lost') . "</a></p>";
+
+ //<input name=\"username\" type=\"text\" class="general-textarea" /></label>
?>
<div id="login-box"> <h2><?php echo elgg_echo('login'); ?></h2>
- <form action="<?php echo $vars['url']; ?>action/login" method="POST">
- <p><label><?php echo elgg_echo('username'); ?><br /><input name="username" type="text" class="general-textarea" /></label>
- <br />
- <label><?php echo elgg_echo('password'); ?><br /><input name="password" type="password" class="general-textarea" /></label><br />
- <input type="submit" name="submit" class="submit_button" value="<?php echo elgg_echo('login'); ?>" /></p>
- <p><?php if (!isset($CONFIG->disable_registration) || !($CONFIG->disable_registration)) { ?><a href="<?php echo $vars['url']; ?>account/register.php"><?php echo elgg_echo('register'); ?></a> : <?php } ?> <a href="<?php echo $vars['url']; ?>account/forgotten_password.php"><?php echo elgg_echo('user:password:lost'); ?></a></p>
- </form>
+ <?php echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$vars['url']}action/login")); ?>
+
</div> \ No newline at end of file
diff --git a/views/default/input/access.php b/views/default/input/access.php
index 1157e45e0..dfd23df1d 100644
--- a/views/default/input/access.php
+++ b/views/default/input/access.php
@@ -15,7 +15,10 @@
* @uses $vars['js'] Any Javascript to enter into the input tag
* @uses $vars['internalname'] The name of the input field
*
- */
+ */
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-access";
if (!is_array($vars['options']))
{
@@ -27,7 +30,7 @@
?>
-<select name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?>>
+<select name="<?php echo $vars['internalname']; ?>" <?php if (isset($vars['js'])) echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>">
<?php
foreach($vars['options'] as $key => $option) {
diff --git a/views/default/input/button.php b/views/default/input/button.php
index 2249158e6..e646998ea 100644
--- a/views/default/input/button.php
+++ b/views/default/input/button.php
@@ -20,6 +20,9 @@
*/
global $CONFIG;
+
+ $class = $vars['class'];
+ if (!$class) $class = "submit_button";
$type = strtolower($vars['type']);
switch ($type)
@@ -35,4 +38,4 @@
$src = $vars['src'];
if (strpos($src,$CONFIG->wwwroot)===false) $src = ""; // blank src if trying to access an offsite image.
?>
-<input type="<?php echo $type; ?>" class="<?php echo $type; ?>_button" <?php echo $vars['js']; ?> value="<?php echo $value; ?>" src="<?php echo $src; ?>" /> \ No newline at end of file
+<input type="<?php echo $type; ?>" class="<?php echo $type; ?>_button" <?php echo $vars['js']; ?> value="<?php echo $value; ?>" src="<?php echo $src; ?>" class="<?php echo $class; ?>" /> \ No newline at end of file
diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php
index 6d39d823d..c27a197cf 100644
--- a/views/default/input/checkboxes.php
+++ b/views/default/input/checkboxes.php
@@ -17,6 +17,9 @@
* @uses $vars['options'] An array of strings representing the options for the checkbox field
*
*/
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-checkboxes";
foreach($vars['options'] as $label => $option) {
//if (!in_array($option,$vars['value'])) {
@@ -39,7 +42,7 @@
}
if ($vars['disabled']) $disabled = ' disabled="yes" ';
- echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option)."\" {$selected} />{$label}</label><br />";
+ echo "<label><input type=\"checkbox\" $disabled {$vars['js']} name=\"{$vars['internalname']}[]\" {$selected} value=\"".htmlentities($option)."\" {$selected} class=\"$class\" />{$label}</label><br />";
}
?> \ No newline at end of file
diff --git a/views/default/input/email.php b/views/default/input/email.php
index b5c9a6e3b..bedf93e27 100644
--- a/views/default/input/email.php
+++ b/views/default/input/email.php
@@ -16,7 +16,9 @@
* @uses $vars['internalname'] The name of the input field
*
*/
-
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-text";
?>
-<input type="text" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo $vars['value']; ?>" class="input-text"/> \ No newline at end of file
+<input type="text" <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo $vars['value']; ?>" class="<?php echo $class; ?>"/> \ No newline at end of file
diff --git a/views/default/input/file.php b/views/default/input/file.php
index 5dde370a2..de0098b3e 100644
--- a/views/default/input/file.php
+++ b/views/default/input/file.php
@@ -19,6 +19,8 @@
if (!empty($vars['value'])) {
echo elgg_echo('fileexists') . "<br />";
}
-
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-file";
?>
-<input type="file" size="30" <?php echo $vars['js']; ?>name="<?php echo $vars['internalname']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> /> \ No newline at end of file
+<input type="file" size="30" <?php echo $vars['js']; ?>name="<?php echo $vars['internalname']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>" /> \ No newline at end of file
diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php
index e21c96a59..85c3f8186 100644
--- a/views/default/input/longtext.php
+++ b/views/default/input/longtext.php
@@ -16,7 +16,10 @@
* @uses $vars['internalname'] The name of the input field
*
*/
-
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-textarea";
+
?>
-<textarea class="input-textarea" name="<?php echo $vars['internalname']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo $vars['value']; ?></textarea> \ No newline at end of file
+<textarea class="<?php echo $class; ?>" name="<?php echo $vars['internalname']; ?>" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?>><?php echo $vars['value']; ?></textarea> \ No newline at end of file
diff --git a/views/default/input/password.php b/views/default/input/password.php
index 740a1a3f0..6fbd7254b 100644
--- a/views/default/input/password.php
+++ b/views/default/input/password.php
@@ -16,7 +16,9 @@
* @uses $vars['internalname'] The name of the input field
*
*/
-
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-password";
?>
-<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo $vars['value']; ?>" /> \ No newline at end of file
+<input type="password" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo $vars['value']; ?>" class="<?php echo $class; ?>" /> \ No newline at end of file
diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php
index 081dffc2a..96b4d19aa 100644
--- a/views/default/input/pulldown.php
+++ b/views/default/input/pulldown.php
@@ -18,11 +18,15 @@
* @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is
* the value displayed on the button. Replaces $vars['options'] when defined.
*/
+
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-pulldown";
?>
-<select name="<?php echo $vars['internalname']; ?>" <?php echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?>>
+<select name="<?php echo $vars['internalname']; ?>" <?php echo $vars['js']; ?> <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> class="<?php echo $class; ?>">
<?php
if ($vars['options_values'])
{
diff --git a/views/default/input/radio.php b/views/default/input/radio.php
index 6089b912f..3b367816b 100644
--- a/views/default/input/radio.php
+++ b/views/default/input/radio.php
@@ -17,6 +17,9 @@
* @uses $vars['options'] An array of strings representing the options for the radio field
*
*/
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-radio";
foreach($vars['options'] as $option => $label) {
if ($option != $vars['value']) {
@@ -26,7 +29,7 @@
}
if ($vars['disabled']) $disabled = ' disabled="yes" ';
- echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" value=\"".htmlentities($option)."\" {$selected} />{$label}</label><br />";
+ echo "<label><input type=\"radio\" $disabled {$vars['js']} name=\"{$vars['internalname']}\" value=\"".htmlentities($option)."\" {$selected} class=\"$class\" />{$label}</label><br />";
}
?> \ No newline at end of file
diff --git a/views/default/input/reset.php b/views/default/input/reset.php
index 34a50d2f5..2e0e78037 100644
--- a/views/default/input/reset.php
+++ b/views/default/input/reset.php
@@ -19,5 +19,9 @@
*/
$vars['type'] = 'reset';
+ $class = $vars['class'];
+ if (!$class) $class = "submit_button";
+ $vars['class'] = $class;
+
echo elgg_view('input/button', $vars);
?> \ No newline at end of file
diff --git a/views/default/input/submit.php b/views/default/input/submit.php
index 735130b65..83ee98f27 100644
--- a/views/default/input/submit.php
+++ b/views/default/input/submit.php
@@ -19,5 +19,9 @@
*/
$vars['type'] = 'submit';
+ $class = $vars['class'];
+ if (!$class) $class = "submit_button";
+ $vars['class'] = $class;
+
echo elgg_view('input/button', $vars);
?> \ No newline at end of file
diff --git a/views/default/input/tags.php b/views/default/input/tags.php
index 8a03759fd..09b72ac76 100644
--- a/views/default/input/tags.php
+++ b/views/default/input/tags.php
@@ -15,8 +15,11 @@
* @uses $vars['js'] Any Javascript to enter into the input tag
* @uses $vars['internalname'] The name of the input field
* @uses $vars['value'] An array of tags
- *
+ * @uses $vars['class'] Class override
*/
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-tags";
$tags = "";
if (!empty($vars['value'])) {
@@ -39,4 +42,4 @@
}
?>
-<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?><?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($tags); ?>" class="input-tags"/> \ No newline at end of file
+<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?><?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($tags); ?>" class="<?php echo $class; ?>"/> \ No newline at end of file
diff --git a/views/default/input/text.php b/views/default/input/text.php
index 6f3b6ba4b..3f7667c4f 100644
--- a/views/default/input/text.php
+++ b/views/default/input/text.php
@@ -14,9 +14,14 @@
* @uses $vars['value'] The current value, if any
* @uses $vars['js'] Any Javascript to enter into the input tag
* @uses $vars['internalname'] The name of the input field
- * @uses $vars['disabled'] If true then control is read-only
+ * @uses $vars['disabled'] If true then control is read-only
+ * @uses $vars['class'] Class override
*/
-
+
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-text";
+
?>
-<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($vars['value']); ?>" class="input-text"/> \ No newline at end of file
+<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo htmlentities($vars['value']); ?>" class="<?php echo $class ?>"/> \ No newline at end of file
diff --git a/views/default/input/url.php b/views/default/input/url.php
index f42a43a14..1247971b5 100644
--- a/views/default/input/url.php
+++ b/views/default/input/url.php
@@ -14,9 +14,11 @@
* @uses $vars['value'] The current value, if any
* @uses $vars['js'] Any Javascript to enter into the input tag
* @uses $vars['internalname'] The name of the input field
- *
+ * @uses $vars['class'] Class override
*/
-
+
+ $class = $vars['class'];
+ if (!$class) $class = "input-url";
?>
-<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo $vars['value']; ?>" class="input-url"/> \ No newline at end of file
+<input type="text" <?php if ($vars['disabled']) echo ' disabled="yes" '; ?> <?php echo $vars['js']; ?> name="<?php echo $vars['internalname']; ?>" value="<?php echo $vars['value']; ?>" class="<?php echo $class; ?>"/> \ No newline at end of file