aboutsummaryrefslogtreecommitdiff
path: root/views/installation
diff options
context:
space:
mode:
Diffstat (limited to 'views/installation')
-rw-r--r--views/installation/forms/install/template.php30
-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
-rw-r--r--views/installation/install/js_rewrite_check.php12
-rw-r--r--views/installation/install/nav.php35
-rw-r--r--views/installation/install/pages/admin.php17
-rw-r--r--views/installation/install/pages/complete.php16
-rw-r--r--views/installation/install/pages/database.php26
-rw-r--r--views/installation/install/pages/requirements.php39
-rw-r--r--views/installation/install/pages/settings.php14
-rw-r--r--views/installation/install/pages/welcome.php8
-rw-r--r--views/installation/page/default.php57
-rw-r--r--views/installation/page/elements/footer.php10
-rw-r--r--views/installation/page/elements/header.php8
-rw-r--r--views/installation/page/elements/messages.php21
-rw-r--r--views/installation/page/elements/sidebar.php26
23 files changed, 554 insertions, 0 deletions
diff --git a/views/installation/forms/install/template.php b/views/installation/forms/install/template.php
new file mode 100644
index 000000000..a01914f12
--- /dev/null
+++ b/views/installation/forms/install/template.php
@@ -0,0 +1,30 @@
+<?php
+/**
+ * Generic form template for install forms
+ *
+ * @uses $vars['variables']
+ * @uses $vars['type'] Type of form: admin, database, settings
+ */
+
+$variables = $vars['variables'];
+$type = $vars['type'];
+
+$form_body = '';
+foreach ($variables as $field => $params) {
+ $label = elgg_echo("install:$type:label:$field");
+ $help = elgg_echo("install:$type:help:$field");
+ $params['name'] = $field;
+
+ $form_body .= '<div>';
+ $form_body .= "<label>$label</label>";
+ $form_body .= elgg_view("input/{$params['type']}", $params);
+ $form_body .= "<span class=\"install-help\">$help</span>";
+ $form_body .= '</div>';
+}
+
+$submit_params = array(
+ 'value' => elgg_echo('install:next'),
+);
+$form_body .= elgg_view('input/submit', $submit_params);
+
+echo $form_body;
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
diff --git a/views/installation/install/js_rewrite_check.php b/views/installation/install/js_rewrite_check.php
new file mode 100644
index 000000000..04d81171d
--- /dev/null
+++ b/views/installation/install/js_rewrite_check.php
@@ -0,0 +1,12 @@
+<?php
+/**
+ * Some servers don't allow PHP to check the rewrite, so try via AJAX
+ */
+?>
+<script type="text/javascript">
+ elgg.installer.rewriteTest(
+ '<?php echo $vars['url'];?>',
+ '<?php echo elgg_echo('install:check:rewrite:success'); ?>',
+ '<?php echo $vars['config']->wwwroot; ?>install.php?step=database'
+ );
+</script> \ No newline at end of file
diff --git a/views/installation/install/nav.php b/views/installation/install/nav.php
new file mode 100644
index 000000000..c150cb2cb
--- /dev/null
+++ b/views/installation/install/nav.php
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Navigation for installation pages
+ *
+ * @uses $vars['url'] base url of site
+ * @uses $vars['next_step'] next step as string
+ * @uses $vars['refresh'] should refresh button be shown?
+ * @uses $vars['advance'] should the next button be active?
+ */
+
+
+// has a refresh button been requested
+$refresh = '';
+if (isset($vars['refresh']) && $vars['refresh']) {
+ $refresh_text = elgg_echo('install:refresh');
+ $refresh = "<a href=\"\">$refresh_text</a>";
+}
+
+// create next button and selectively disable
+$next_text = elgg_echo('install:next');
+$next_link = elgg_get_site_url()."install.php?step={$vars['next_step']}";
+$next = "<a href=\"$next_link\">$next_text</a>";
+if (isset($vars['advance']) && !$vars['advance']) {
+ // disable the next button
+ $next = "<a class=\"elgg-state-disabled\">$next_text</a>";
+}
+
+
+echo <<<___END
+<div class="elgg-install-nav">
+ $next
+ $refresh
+</div>
+
+___END;
diff --git a/views/installation/install/pages/admin.php b/views/installation/install/pages/admin.php
new file mode 100644
index 000000000..e810aa701
--- /dev/null
+++ b/views/installation/install/pages/admin.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Install create admin account page
+ */
+
+echo elgg_autop(elgg_echo('install:admin:instructions'));
+
+$vars['type'] = 'admin';
+
+$url = current_page_url();
+
+$form_vars = array(
+ 'action' => $url,
+ 'disable_security' => TRUE,
+);
+
+echo elgg_view_form('install/template', $form_vars, $vars);
diff --git a/views/installation/install/pages/complete.php b/views/installation/install/pages/complete.php
new file mode 100644
index 000000000..80f8e7434
--- /dev/null
+++ b/views/installation/install/pages/complete.php
@@ -0,0 +1,16 @@
+<?php
+/**
+ * Install completion page
+ */
+
+echo elgg_autop(elgg_echo('install:complete:instructions'));
+
+?>
+
+<div class="elgg-install-nav">
+<?php
+ $url = elgg_get_site_url() . $vars['destination'];
+ $text = elgg_echo('install:complete:gotosite');
+ echo "<a href=\"$url\">$text</a>";
+?>
+</div>
diff --git a/views/installation/install/pages/database.php b/views/installation/install/pages/database.php
new file mode 100644
index 000000000..d24b4f57b
--- /dev/null
+++ b/views/installation/install/pages/database.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Install database page
+ *
+ * @uses $vars['failure'] Settings file exists but something went wrong
+ */
+
+if (isset($vars['failure']) && $vars['failure']) {
+ echo elgg_autop(elgg_echo('install:database:error'));
+ $vars['refresh'] = TRUE;
+ $vars['advance'] = FALSE;
+ echo elgg_view('install/nav', $vars);
+} else {
+ echo elgg_autop(elgg_echo('install:database:instructions'));
+
+ $vars['type'] = 'database';
+
+ $url = current_page_url();
+
+ $form_vars = array(
+ 'action' => $url,
+ 'disable_security' => TRUE,
+ );
+
+ echo elgg_view_form('install/template', $form_vars, $vars);
+} \ No newline at end of file
diff --git a/views/installation/install/pages/requirements.php b/views/installation/install/pages/requirements.php
new file mode 100644
index 000000000..3f0941c95
--- /dev/null
+++ b/views/installation/install/pages/requirements.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Install requirements checking page
+ *
+ * @uses $vars['num_failures] Number of requirements failures
+ * @uses $vars['num_warnings] Number of recommendation warnings
+ */
+
+if ($vars['num_failures'] != 0) {
+ $instruct_text = elgg_echo('install:requirements:instructions:failure');
+} elseif ($vars['num_warnings'] != 0) {
+ $instruct_text = elgg_echo('install:requirements:instructions:warning');
+} else {
+ $instruct_text = elgg_echo('install:requirements:instructions:success');
+}
+
+echo elgg_autop($instruct_text);
+
+$report = $vars['report'];
+foreach ($report as $category => $checks) {
+ $title = elgg_echo("install:require:$category");
+ echo "<h3>$title</h3>";
+ echo "<ul class=\"elgg-require-$category\">";
+ foreach ($checks as $check) {
+ echo "<li class=\"{$check['severity']}\">";
+ echo elgg_autop($check['message']);
+ echo "</li>";
+ }
+ echo "</ul>";
+}
+
+$vars['refresh'] = true;
+
+// cannot advance to next step with a failure
+if ($vars['num_failures'] != 0) {
+ $vars['advance'] = false;
+}
+
+echo elgg_view('install/nav', $vars);
diff --git a/views/installation/install/pages/settings.php b/views/installation/install/pages/settings.php
new file mode 100644
index 000000000..04f23c0ea
--- /dev/null
+++ b/views/installation/install/pages/settings.php
@@ -0,0 +1,14 @@
+<?php
+
+echo elgg_autop(elgg_echo('install:settings:instructions'));
+
+$vars['type'] = 'settings';
+
+$url = current_page_url();
+
+$form_vars = array(
+ 'action' => $url,
+ 'disable_security' => TRUE,
+);
+
+echo elgg_view_form('install/template', $form_vars, $vars);
diff --git a/views/installation/install/pages/welcome.php b/views/installation/install/pages/welcome.php
new file mode 100644
index 000000000..f370c15f3
--- /dev/null
+++ b/views/installation/install/pages/welcome.php
@@ -0,0 +1,8 @@
+<?php
+/**
+ * Install welcome page
+ */
+
+echo elgg_autop(elgg_echo('install:welcome:instructions'));
+
+echo elgg_view('install/nav', $vars);
diff --git a/views/installation/page/default.php b/views/installation/page/default.php
new file mode 100644
index 000000000..662e8206e
--- /dev/null
+++ b/views/installation/page/default.php
@@ -0,0 +1,57 @@
+<?php
+/**
+ * Elgg install pageshell
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['title'] The page title
+ * @uses $vars['body'] The main content of the page
+ * @uses $vars['sysmessages'] Array of system status messages
+ */
+
+$title = elgg_echo('install:title');
+$title .= " : {$vars['title']}";
+
+// we won't trust server configuration but specify utf-8
+header('Content-type: text/html; charset=utf-8');
+
+// turn off browser caching
+header('Pragma: public', TRUE);
+header("Cache-Control: no-cache, must-revalidate", TRUE);
+header('Expires: Fri, 05 Feb 1982 00:00:00 -0500', TRUE);
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title><?php echo $title; ?></title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <link rel="SHORTCUT ICON" href="<?php echo elgg_get_site_url(); ?>_graphics/favicon.ico" />
+ <link rel="stylesheet" href="<?php echo elgg_get_site_url(); ?>install/css/install.css" type="text/css" />
+ <script type="text/javascript" src="<?php echo elgg_get_site_url(); ?>vendors/jquery/jquery-1.6.4.min.js"></script>
+ <script type="text/javascript" src="<?php echo elgg_get_site_url(); ?>install/js/install.js"></script>
+ </head>
+ <body>
+ <div class="elgg-page">
+ <div class="elgg-page-header">
+ <?php echo elgg_view('page/elements/header', $vars); ?>
+ </div>
+ <div class="elgg-page-body">
+ <div class="elgg-layout">
+ <div class="elgg-sidebar">
+ <?php echo elgg_view('page/elements/sidebar', $vars); ?>
+ </div>
+ <div class="elgg-body">
+ <h2><?php echo $vars['title']; ?></h2>
+ <?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?>
+ <?php echo $vars['body']; ?>
+ </div>
+ </div>
+ </div>
+ <div class="elgg-page-footer">
+ <?php echo elgg_view('page/elements/footer'); ?>
+ </div>
+ </div>
+ </body>
+</html>
diff --git a/views/installation/page/elements/footer.php b/views/installation/page/elements/footer.php
new file mode 100644
index 000000000..d6a755fba
--- /dev/null
+++ b/views/installation/page/elements/footer.php
@@ -0,0 +1,10 @@
+<?php
+/**
+ * Install footer - offers help links
+ */
+?>
+<ul>
+ <li><a href="http://docs.elgg.org/wiki/Installation" target="_blank">Install instructions</a></li>
+ <li><a href="http://docs.elgg.org/wiki/Install_Troubleshooting" target="_blank">Install troubleshooting</a></li>
+ <li><a href="http://community.elgg.org/pg/groups/world" target="_blank">Elgg community forums</a></li>
+</ul> \ No newline at end of file
diff --git a/views/installation/page/elements/header.php b/views/installation/page/elements/header.php
new file mode 100644
index 000000000..8c18dbffd
--- /dev/null
+++ b/views/installation/page/elements/header.php
@@ -0,0 +1,8 @@
+<?php
+/**
+ * Install header
+ */
+
+$url = elgg_get_site_url()."_graphics/elgg_logo.png";
+?>
+<img src="<?php echo $url; ?>" alt="Elgg" />
diff --git a/views/installation/page/elements/messages.php b/views/installation/page/elements/messages.php
new file mode 100644
index 000000000..46261dca4
--- /dev/null
+++ b/views/installation/page/elements/messages.php
@@ -0,0 +1,21 @@
+<?php
+/**
+ * Lists all system messages
+ *
+ * @uses $vars['object'] The array of message registers
+ */
+
+if (isset($vars['object']) && is_array($vars['object']) && sizeof($vars['object']) > 0) {
+
+ echo '<ul class="elgg-system-messages">';
+
+ foreach ($vars['object'] as $type => $list ) {
+ foreach ($list as $message) {
+ echo "<li class=\"elgg-state-$type\">";
+ echo elgg_autop($message);
+ echo '</li>';
+ }
+ }
+
+ echo '</ul>';
+}
diff --git a/views/installation/page/elements/sidebar.php b/views/installation/page/elements/sidebar.php
new file mode 100644
index 000000000..8136cd898
--- /dev/null
+++ b/views/installation/page/elements/sidebar.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Install sidebar
+ *
+ * @uses $vars['step'] Current step
+ * @uses $vars['steps'] Array of steps
+ */
+
+$current_step = $vars['step'];
+$steps = $vars['steps'];
+
+$current_step_index = array_search($current_step, $steps);
+
+echo '<ol>';
+foreach ($steps as $index => $step) {
+ if ($index < $current_step_index) {
+ $class = 'past';
+ } elseif ($index == $current_step_index) {
+ $class = 'present';
+ } else {
+ $class = 'future';
+ }
+ $text = elgg_echo("install:$step");
+ echo "<li class=\"$class\">$text</li>";
+}
+echo '</ol>';