Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit cdbb837

Browse files
committed
Add a "wizard mode" in FormManager for installer dialog.
Rewrok the whole boot.conf installer with that.
1 parent f453007 commit cdbb837

File tree

10 files changed

+407
-213
lines changed

10 files changed

+407
-213
lines changed

core/src/plugins/boot.conf/class.AjxpInstaller.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ Class.create("AjxpInstaller", AjxpPane, {
5454
connexion.setParameters(params);
5555
connexion.onComplete = function(transport){
5656
var params = this.formManager.parseParameters(transport.responseXML, "//global_param");
57-
this.formManager.createParametersInputs(this.formElement, params, true, false, false, false, false, true);
58-
this.formElement.SF_accordion.observe("animation-finished", function(){
57+
this.formManager.createParametersInputs(this.formElement, params, true, false, false, "wizard", false, true);
58+
var saveButton = this.htmlElement.select('.SF_inlineButton').last();
59+
this.formElement.observe("wizard:refreshed", function(event){
5960
modal.refreshDialogPosition();
60-
});
61+
if(event.memo && event.memo.isLast){
62+
this.formElement.down(".wizard_buttons").insert({bottom:saveButton});
63+
}else{
64+
this.htmlElement.insert({bottom:saveButton});
65+
}
66+
}.bind(this));
6167
this.formElement.select("select").invoke("observe", "change", function(){
6268
modal.refreshDialogPosition();
6369
});
@@ -79,7 +85,7 @@ Class.create("AjxpInstaller", AjxpPane, {
7985
}
8086

8187
var missing = this.formManager.serializeParametersInputs(this.formElement, new Hash(), '', true);
82-
missing = (missing > 0 || !this.formElement.down('select[name="STORAGE_TYPE"]').getValue() || !passValidating);
88+
missing = (missing > 0 || !passValidating);
8389

8490
if(!missing){
8591
this.htmlElement.select('.SF_inlineButton').last().removeClassName("disabled");
@@ -91,29 +97,28 @@ Class.create("AjxpInstaller", AjxpPane, {
9197
this.formElement.select('select').invoke("observe", "change", function(){
9298
this.formManager.observeFormChanges(this.formElement, observer, 50);
9399
}.bind(this));
94-
this.updateAndBindButton(this.htmlElement.select('.SF_inlineButton').last());
95-
this.bindPassword(this.formElement.down('input[name="ADMIN_USER_PASS"]').up('div.accordion_content'));
100+
saveButton.hide();
101+
this.updateAndBindButton(saveButton);
102+
this.bindPassword(this.formElement.down('input[name="ADMIN_USER_PASS"]').up('div.wizard-pane'));
96103
this.formElement.ajxpPaneObject.observe("after_replicate_row", function(newRow){
97104
this.bindPassword(newRow);
98105
}.bind(this));
99106
this.htmlElement.down("#start_button").observe("click", function(){
100-
new Effect.Morph(this.htmlElement.down(".install_pydio_logo"), {
101-
style:'height:60px',
102-
duration:0.5
103-
});
107+
this.htmlElement.down(".install_pydio_logo").hide();
104108
this.htmlElement.down(".installerLang").hide();
105-
this.htmlElement.down(".installerWelcome").update(MessageHash["installer.8"]);
109+
this.htmlElement.down(".installerWelcome").hide();
106110
new Effect.Appear(this.formElement, {afterFinish : function(){
107-
this.formElement.SF_accordion.activate(this.formElement.down('.accordion_toggle'));
111+
modal.refreshDialogPosition();
108112
}.bind(this)});
109113
}.bind(this));
114+
document.fire("ajaxplorer:installer_loaded");
110115
}.bind(this);
111116
connexion.sendAsync();
112117
},
113118

114119
bindPassword : function(contentDiv){
115120
var passes = contentDiv.select('input[type="password"]');
116-
var container = new Element("div", {className:'SF_element'});
121+
var container = new Element("div", {className:'SF_element passStrengthContainer'});
117122
passes[1].up('div.SF_element').insert({after:container});
118123
var p = new Protopass(passes[0], {
119124
barContainer:container,

core/src/plugins/boot.conf/class.BootConfLoader.php

Lines changed: 53 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,9 @@ public function loadManifest()
6969
}
7070
}
7171

72-
/**
73-
* Transmit to the ajxp_conf load_plugin_manifest action
74-
* @param $action
75-
* @param $httpVars
76-
* @param $fileVars
77-
*/
78-
public function loadInstallerForm($action, $httpVars, $fileVars)
79-
{
80-
if(isSet($httpVars["lang"])){
81-
ConfService::setLanguage($httpVars["lang"]);
82-
}
72+
public function printFormFromServerSettings($fullManifest){
73+
8374
AJXP_XMLWriter::header("admin_data");
84-
$fullManifest = $this->getManifestRawContent("", "xml");
8575
$xPath = new DOMXPath($fullManifest->ownerDocument);
8676
$addParams = "";
8777
$pInstNodes = $xPath->query("server_settings/global_param[contains(@type, 'plugin_instance:')]");
@@ -126,6 +116,21 @@ public function loadInstallerForm($action, $httpVars, $fileVars)
126116

127117
}
128118

119+
/**
120+
* Transmit to the ajxp_conf load_plugin_manifest action
121+
* @param $action
122+
* @param $httpVars
123+
* @param $fileVars
124+
*/
125+
public function loadInstallerForm($action, $httpVars, $fileVars)
126+
{
127+
if(isSet($httpVars["lang"])){
128+
ConfService::setLanguage($httpVars["lang"]);
129+
}
130+
$fullManifest = $this->getManifestRawContent("", "xml");
131+
$this->printFormFromServerSettings($fullManifest);
132+
}
133+
129134
/**
130135
* Transmit to the ajxp_conf load_plugin_manifest action
131136
* @param $action
@@ -145,51 +150,37 @@ public function applyInstallerForm($action, $httpVars, $fileVars)
145150
if(!isSet($coreAuth["MASTER_INSTANCE_CONFIG"])) $coreAuth["MASTER_INSTANCE_CONFIG"] = array();
146151
$coreConf["AJXP_CLI_SECRET_KEY"] = AJXP_Utils::generateRandomString(24, true);
147152

148-
$storageType = $data["STORAGE_TYPE"]["type"];
149-
if ($storageType == "db") {
150-
// REWRITE BOOTSTRAP.JSON
151-
$coreConf["DIBI_PRECONFIGURATION"] = $data["STORAGE_TYPE"]["db_type"];
152-
if (isSet($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_driver"])) {
153-
$dbFile = AJXP_VarsFilter::filter($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_database"]);
154-
if (!file_exists(dirname($dbFile))) {
155-
mkdir(dirname($dbFile), 0755, true);
156-
}
153+
// REWRITE BOOTSTRAP.JSON
154+
$coreConf["DIBI_PRECONFIGURATION"] = $data["db_type"];
155+
if (isSet($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_driver"])) {
156+
$dbFile = AJXP_VarsFilter::filter($coreConf["DIBI_PRECONFIGURATION"]["sqlite3_database"]);
157+
if (!file_exists(dirname($dbFile))) {
158+
mkdir(dirname($dbFile), 0755, true);
157159
}
158-
$coreConf["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreConf["UNIQUE_INSTANCE_CONFIG"], array(
159-
"instance_name"=> "conf.sql",
160-
"group_switch_value"=> "conf.sql",
161-
"SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")
162-
));
163-
$coreAuth["MASTER_INSTANCE_CONFIG"] = array_merge($coreAuth["MASTER_INSTANCE_CONFIG"], array(
164-
"instance_name"=> "auth.sql",
165-
"group_switch_value"=> "auth.sql",
166-
"SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")
167-
));
168-
169-
// DETECT REQUIRED SQL TABLES AND INSTALL THEM
170-
$registry = AJXP_PluginsService::getInstance()->getDetectedPlugins();
171-
$driverData = array("SQL_DRIVER" => $data["STORAGE_TYPE"]["db_type"]);
172-
foreach($registry as $type => $plugins){
173-
foreach($plugins as $plugObject){
174-
if($plugObject instanceof SqlTableProvider){
175-
$plugObject->installSQLTables($driverData);
176-
}
160+
}
161+
$coreConf["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreConf["UNIQUE_INSTANCE_CONFIG"], array(
162+
"instance_name"=> "conf.sql",
163+
"group_switch_value"=> "conf.sql",
164+
"SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")
165+
));
166+
$coreAuth["MASTER_INSTANCE_CONFIG"] = array_merge($coreAuth["MASTER_INSTANCE_CONFIG"], array(
167+
"instance_name"=> "auth.sql",
168+
"group_switch_value"=> "auth.sql",
169+
"SQL_DRIVER" => array("core_driver" => "core", "group_switch_value" => "core")
170+
));
171+
172+
// DETECT REQUIRED SQL TABLES AND INSTALL THEM
173+
$registry = AJXP_PluginsService::getInstance()->getDetectedPlugins();
174+
$driverData = array("SQL_DRIVER" => $data["db_type"]);
175+
foreach($registry as $type => $plugins){
176+
foreach($plugins as $plugObject){
177+
if($plugObject instanceof SqlTableProvider){
178+
$plugObject->installSQLTables($driverData);
177179
}
178180
}
179-
180-
} else {
181-
182-
$coreConf["UNIQUE_INSTANCE_CONFIG"] = array_merge($coreConf["UNIQUE_INSTANCE_CONFIG"], array(
183-
"instance_name"=> "conf.serial",
184-
"group_switch_value"=> "conf.serial"
185-
));
186-
$coreAuth["MASTER_INSTANCE_CONFIG"] = array_merge($coreAuth["MASTER_INSTANCE_CONFIG"], array(
187-
"instance_name"=> "auth.serial",
188-
"group_switch_value"=> "auth.serial"
189-
));
190-
191181
}
192182

183+
193184
$oldBoot = $this->getPluginWorkDir(true)."/bootstrap.json";
194185
if (is_file($oldBoot)) {
195186
copy($oldBoot, $oldBoot.".bak");
@@ -200,10 +191,9 @@ public function applyInstallerForm($action, $httpVars, $fileVars)
200191

201192

202193
// Write new bootstrap and reload conf plugin!
203-
if ($storageType == "db") {
204-
$coreConf["UNIQUE_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
205-
$coreAuth["MASTER_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
206-
}
194+
$coreConf["UNIQUE_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
195+
$coreAuth["MASTER_INSTANCE_CONFIG"]["SQL_DRIVER"] = $coreConf["DIBI_PRECONFIGURATION"];
196+
207197
$newConfigPlugin = ConfService::instanciatePluginFromGlobalParams($coreConf["UNIQUE_INSTANCE_CONFIG"], "AbstractConfDriver");
208198
$newAuthPlugin = ConfService::instanciatePluginFromGlobalParams($coreAuth["MASTER_INSTANCE_CONFIG"], "AbstractAuthDriver");
209199

@@ -224,14 +214,12 @@ public function applyInstallerForm($action, $httpVars, $fileVars)
224214
$htAccessToUpdate = AJXP_INSTALL_PATH."/.htaccess";
225215
}
226216

227-
if ($storageType == "db") {
228-
$sqlPlugs = array(
229-
"core.notifications/UNIQUE_FEED_INSTANCE" => "feed.sql",
230-
"core.log/UNIQUE_PLUGIN_INSTANCE" => "log.sql",
231-
"core.mq/UNIQUE_MS_INSTANCE" => "mq.sql"
232-
);
233-
$data["ENABLE_NOTIF"] = $data["STORAGE_TYPE"]["notifications"];
234-
}
217+
$sqlPlugs = array(
218+
"core.notifications/UNIQUE_FEED_INSTANCE" => "feed.sql",
219+
"core.log/UNIQUE_PLUGIN_INSTANCE" => "log.sql",
220+
"core.mq/UNIQUE_MS_INSTANCE" => "mq.sql"
221+
);
222+
$data["ENABLE_NOTIF"] = true;
235223

236224

237225
// Prepare plugins configs
@@ -328,7 +316,7 @@ public function testConnexions($action, $httpVars, $fileVars)
328316

329317
if ($action == "boot_test_sql_connexion") {
330318

331-
$p = AJXP_Utils::cleanDibiDriverParameters($data["STORAGE_TYPE"]["db_type"]);
319+
$p = AJXP_Utils::cleanDibiDriverParameters($data["db_type"]);
332320
if ($p["driver"] == "sqlite3") {
333321
$dbFile = AJXP_VarsFilter::filter($p["database"]);
334322
if (!file_exists(dirname($dbFile))) {

core/src/plugins/boot.conf/i18n/conf/en.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,16 @@
2020
*/
2121

2222
$mess = array(
23-
"Admin access" => "<span class='icon-key'></span> Admin access",
24-
"Global options" => "<span class='icon-cogs'></span> Global options",
25-
"Configurations storage" => "<span class='icon-save'></span> Configurations storage",
26-
"Add some users" => "<span class='icon-group'></span> Add some users",
23+
"Admin access" => "Admin access",
24+
"Global options" => "Global options",
25+
"Configurations storage" => "Configurations storage",
26+
"Add some users" => "Add some users",
2727
"Please set up a login and password for the administrator user. This step is necessary to let you login the first time. You can create more administrators later by going to the 'Settings' workspace." => "Please set up a login and password for the administrator user. This step is necessary to let you login the first time. You can create more administrators later by going to the 'Settings' workspace.",
28-
"Admin Login" => "Admin Login",
28+
"Admin Login" => "Administrator Login",
2929
"Alphanumeric login" => "Alphanumeric login",
30-
"Admin Display Name" => "Admin Display Name",
30+
"Admin Display Name" => "Administrator Full Name",
3131
"Name that users will see" => "Name that users will see",
32-
"Admin Password" => "Admin Password",
32+
"Admin Password" => "Administrator Password",
3333
"Use a strong password (more than 8 characters, complicated ones." => "Use a strong password (more than 8 characters, complicated ones.",
3434
"Confirm" => "Confirm",
3535
"Confirm password" => "Confirm password",
@@ -45,7 +45,7 @@
4545
"Set up the correct value to send emails" => "Set up the correct value to send emails",
4646
"Administrator Email" => "Administrator Email",
4747
"Default 'From' email used to send emails." => "Default 'From' email used to send emails.",
48-
"How the application configuration data will be stored (users, plugins, etc. not how your actual documents are managed). To get started rapidly, select No Database. To enable more advanced features, configure a database connection." => "How the application configuration data will be stored (users, plugins, etc. <b>not</b> how your actual documents are managed). 'No DB' mode can be suited for a quick test of the system, but it's not suited for production and you should always prefer a db-based setup (sqlite does not require any additional service).",
48+
"How the application configuration data will be stored (users, plugins, etc. not how your actual documents are managed). To get started rapidly, select No Database. To enable more advanced features, configure a database connection." => "Database where the application configuration data will be stored (users, parameters, etc). This is <b>not</b> the place where your actual documents are managed. Use the 'Test Connexion' button to check the parameters before going to next step.",
4949
"Storage Type" => "Storage Type",
5050
"Select how the configurations will be stored" => "Select how the configurations will be stored",
5151
"No Database (Quick Start)" => "No DB (Deprecated, use sqlite instead!)",

core/src/plugins/boot.conf/i18n/en.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
$mess = array(
2323
"1" => "Pydio Setup Wizard",
2424
"2" => "Welcome in the Pydio Setup Wizard",
25-
"3" => "Thank you for installing Pydio!<br> This tool will make sure your new sharing platform is up and running in no time: browse through the various sections to set up the general behaviour of the application. You can fly over the fields labels with your mouse to get more information. <br>Are you ready ? ",
26-
"4" => "Start Wizard!",
25+
"3" => "Thank you for installing Pydio. <br/> Please follow this installation wizard to start sharing and syncing files across all of your devices in no time. Make sure to create a database and prepare your SQL credentials before starting. You can hover over the field labels for more information. <br/> Press start when you are ready",
26+
"4" => "Start Wizard",
2727
"5" => "Please wait while Pydio is being configured! It will be up and running in a couple of seconds...",
28-
"6" => "Install Pydio Now",
28+
"6" => "Install Pydio",
2929
"7" => "Language",
3030
"8" => "Click on each section to edit parameters",
3131
);
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#installer_form #save_button{
2+
font-size: 17px;
3+
clear: left;
4+
width: 220px !important;
5+
padding: 5px !important;
6+
margin: 5px 126px !important;
7+
}
8+
#installer_form #save_button.disabled{
9+
color: rgba(255,255,255,0.5);
10+
cursor: default;
11+
}
12+
#installer_form .installerWelcome{
13+
font-size: 13px;
14+
line-height: initial;
15+
padding: 7px 15px;
16+
padding-bottom: 0;
17+
}
18+
#installer_form div.wizard_progress{
19+
position: absolute;
20+
width: 100%;
21+
left: 0;
22+
top: 0;
23+
}
24+
#installer_form div.wizard_buttons{
25+
position: absolute;
26+
bottom: 0;
27+
left: 0;
28+
right: 0;
29+
background-color: white;
30+
border-top: 3px solid #D8D7D7;
31+
text-align: right;
32+
padding: 10px 20px;
33+
margin-top: 0;
34+
z-index: 7;
35+
}
36+
37+
#installer_form #the_form{
38+
margin-top:70px !important;
39+
padding-bottom: 70px !important;
40+
}
41+
.form-installer_form > .dialogTitle {
42+
display: none !important;
43+
}
44+
.form-installer_form > .dialogContent {
45+
border-radius: 3px !important;
46+
}
47+
#installer_form .SF_element.form-element-ADMIN_USER_PASS, .SF_element.form-element-ADMIN_USER_PASS2{
48+
float: left;
49+
clear: none;
50+
width: 50% !important;
51+
}
52+
#installer_form .SF_element.passStrengthContainer{
53+
position: relative;
54+
}
55+
#installer_form .SF_element.passStrengthContainer .password-strength-bar-container{
56+
margin-top: -6px !important;
57+
z-index: 6 !important;
58+
position: absolute !important;
59+
width: 205px !important;
60+
}
61+
#installer_form .SF_element.passStrengthContainer .password-strength-bar{
62+
height: 2px !important;
63+
transition: width 550ms cubic-bezier(0.23, 1, 0.32, 1) 0ms;
64+
margin-top:0 !important;
65+
}
66+
#installer_form .SF_element.passStrengthContainer .password-strength-info{
67+
text-align:left !important;
68+
padding-top:0 !important;
69+
}
70+
#installer_form .form-element-TEST_SQL .SF_inlineButton {
71+
width: auto;
72+
position: absolute;
73+
bottom: 10px;
74+
left: 20px;
75+
z-index: 8;
76+
}
77+
#installer_form .form-element-TEST_SQL .SF_label {
78+
display: none !important;
79+
}

0 commit comments

Comments
 (0)