aboutsummaryrefslogtreecommitdiff
path: root/views/installation/input
diff options
context:
space:
mode:
Diffstat (limited to 'views/installation/input')
-rw-r--r--views/installation/input/access.php38
-rw-r--r--views/installation/input/button.php40
-rw-r--r--views/installation/input/checkbox.php24
-rw-r--r--views/installation/input/combo.php19
-rw-r--r--views/installation/input/dropdown.php36
-rw-r--r--views/installation/input/form.php30
-rw-r--r--views/installation/input/password.php17
-rw-r--r--views/installation/input/submit.php11
-rw-r--r--views/installation/input/text.php20
9 files changed, 235 insertions, 0 deletions
diff --git a/views/installation/input/access.php b/views/installation/input/access.php
new file mode 100644
index 000000000..c3d4713bc
--- /dev/null
+++ b/views/installation/input/access.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Elgg access level input
+ * Displays a dropdown input field
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['name'] The name of the input field
+ *
+ */
+
+$class = "elgg-input-access";
+
+if ((!isset($vars['options'])) || (!is_array($vars['options']))) {
+ $vars['options'] = array();
+ $vars['options'] = get_write_access_array();
+}
+
+if (is_array($vars['options']) && sizeof($vars['options']) > 0) {
+
+ ?>
+
+ <select name="<?php echo $vars['name']; ?>" class="<?php echo $class; ?>">
+ <?php
+
+ foreach($vars['options'] as $key => $option) {
+ if ($key != $vars['value']) {
+ echo "<option value=\"{$key}\">{$option}</option>";
+ } else {
+ echo "<option value=\"{$key}\" selected=\"selected\">{$option}</option>";
+ }
+ }
+
+ ?>
+ </select>
+
+ <?php
+
+}
diff --git a/views/installation/input/button.php b/views/installation/input/button.php
new file mode 100644
index 000000000..ec90fed9d
--- /dev/null
+++ b/views/installation/input/button.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Create a input button
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['type'] submit or button.
+ */
+
+if (isset($vars['class'])) {
+ $class = $vars['class'];
+} else {
+ $class = "elgg-button-submit";
+}
+
+if (isset($vars['name'])) {
+ $name = $vars['name'];
+} else {
+ $name = '';
+}
+
+if (isset($vars['type'])) {
+ $type = strtolower($vars['type']);
+} else {
+ $type = 'submit';
+}
+
+switch ($type) {
+ case 'button' :
+ $type='button';
+ break;
+ case 'submit':
+ default:
+ $type = 'submit';
+}
+
+$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
+
+?>
+<input type="<?php echo $type; ?>" value="<?php echo $value; ?>" class="<?php echo $class; ?>" /> \ No newline at end of file
diff --git a/views/installation/input/checkbox.php b/views/installation/input/checkbox.php
new file mode 100644
index 000000000..6fbe25169
--- /dev/null
+++ b/views/installation/input/checkbox.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg checkbox input
+ * Displays a checkbox input tag
+ *
+ * @uses $var['name']
+ * @uses $vars['value']
+ * @uses $vars['class']
+ */
+
+
+if (isset($vars['class'])) {
+ $id = "class=\"{$vars['class']}\"";
+} else {
+ $id = '';
+}
+
+if (!isset($vars['value'])) {
+ $vars['value'] = $vars['name'];
+}
+
+?>
+
+<input type="checkbox" <?php echo $class; ?> name="<?php echo $vars['name']; ?>" value="<?php echo $vars['value']; ?>" /> \ No newline at end of file
diff --git a/views/installation/input/combo.php b/views/installation/input/combo.php
new file mode 100644
index 000000000..508dbcd01
--- /dev/null
+++ b/views/installation/input/combo.php
@@ -0,0 +1,19 @@
+<?php
+/**
+ * Combination of text box and check box. When the checkbox is checked, the
+ * text field is cleared and disabled.
+ *
+ */
+
+$label = elgg_echo('install:label:combo:' . $vars['name']);
+
+$vars['class'] = "elgg-combo-text";
+echo elgg_view('input/text', $vars);
+
+$vars['class'] = "elgg-combo-checkbox";
+$vars['value'] = "{$vars['name']}-checkbox";
+echo elgg_view('input/checkbox', $vars);
+
+echo "<label class=\"elgg-combo-label\">$label</label>";
+
+echo '<div class="clearfloat"></div>'; \ No newline at end of file
diff --git a/views/installation/input/dropdown.php b/views/installation/input/dropdown.php
new file mode 100644
index 000000000..cf875492e
--- /dev/null
+++ b/views/installation/input/dropdown.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * Elgg dropdown input
+ * Displays a dropdown input field
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['options'] An array of strings representing the options for the dropdown field
+ * @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 = "elgg-input-dropdown";
+
+?>
+<select name="<?php echo $vars['name']; ?>" class="<?php echo $class; ?>">
+<?php
+if (isset($vars['options_values'])) {
+ foreach ($vars['options_values'] as $value => $option) {
+ if ($value != $vars['value']) {
+ echo "<option value=\"$value\">{$option}</option>";
+ } else {
+ echo "<option value=\"$value\" selected=\"selected\">{$option}</option>";
+ }
+ }
+} else {
+ foreach ($vars['options'] as $option) {
+ if ($option != $vars['value']) {
+ echo "<option>{$option}</option>";
+ } else {
+ echo "<option selected=\"selected\">{$option}</option>";
+ }
+ }
+}
+?>
+</select>
diff --git a/views/installation/input/form.php b/views/installation/input/form.php
new file mode 100644
index 000000000..3556413a8
--- /dev/null
+++ b/views/installation/input/form.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Create a form for data submission.
+ *
+ * @uses $vars['body'] The body of the form (made up of other input/xxx views and html
+ * @uses $vars['action'] URL of the action being called
+ * @uses $vars['method'] Method (default POST)
+ * @uses $vars['name'] Form name
+ */
+
+if (isset($vars['name'])) {
+ $name = "name=\"{$vars['name']}\"";
+} else {
+ $name = '';
+}
+
+$body = $vars['body'];
+$action = $vars['action'];
+if (isset($vars['method'])) {
+ $method = $vars['method'];
+} else {
+ $method = 'POST';
+}
+
+$method = strtolower($method);
+
+?>
+<form <?php echo $name; ?> action="<?php echo $action; ?>" method="<?php echo $method; ?>">
+<?php echo $body; ?>
+</form> \ No newline at end of file
diff --git a/views/installation/input/password.php b/views/installation/input/password.php
new file mode 100644
index 000000000..2265ab117
--- /dev/null
+++ b/views/installation/input/password.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Elgg password input
+ * Displays a password input field
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['name'] The name of the input field
+ *
+ */
+
+$class = "input-password";
+
+$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
+
+?>
+
+<input type="password" name="<?php echo $vars['name']; ?>" value="<?php echo $value; ?>" class="<?php echo $class; ?>" />
diff --git a/views/installation/input/submit.php b/views/installation/input/submit.php
new file mode 100644
index 000000000..5d891c380
--- /dev/null
+++ b/views/installation/input/submit.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Create a submit input button
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['name'] The name of the input field
+ */
+
+$vars['type'] = 'submit';
+
+echo elgg_view('input/button', $vars); \ No newline at end of file
diff --git a/views/installation/input/text.php b/views/installation/input/text.php
new file mode 100644
index 000000000..375b91c44
--- /dev/null
+++ b/views/installation/input/text.php
@@ -0,0 +1,20 @@
+<?php
+/**
+ * Elgg text input
+ * Displays a text input field
+ *
+ * @uses $vars['value'] The current value, if any
+ * @uses $vars['name'] The name of the input field
+ * @uses $vars['class'] CSS class
+ */
+
+if (isset($vars['class'])) {
+ $class = "class=\"{$vars['class']}\"";
+} else {
+ $class = "elgg-input-text";
+}
+
+$value = htmlentities($vars['value'], ENT_QUOTES, 'UTF-8');
+
+?>
+<input type="text" name="<?php echo $vars['name']; ?>" value="<?php echo $value; ?>" <?php echo $class; ?> /> \ No newline at end of file