Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2010-04-07 14:26:32 +0400
committermatt <matt@59fd770c-687e-43c8-a1e3-f5a4ff64c105>2010-04-07 14:26:32 +0400
commit15bf1f4aa05d35a07e2514b6bf79833d1f3987fb (patch)
treec0a6e7280088800cb95fa2b1e0db6dc3a85dc8d6 /plugins/Installation
parentc05756fab526ff1d01385a45241ba18e7dc9961e (diff)
Refs #56
* Adding timezone during piwik install. Will set default timezone, and use it for the first created website. * Had to apply manual patch to QuickForm Select to handle optgroups, added unit tests to check patch is applied * Skips the Database check screen if there was no error
Diffstat (limited to 'plugins/Installation')
-rw-r--r--plugins/Installation/Controller.php20
-rw-r--r--plugins/Installation/FormFirstWebsiteSetup.php23
-rw-r--r--plugins/Installation/View.php5
-rw-r--r--plugins/Installation/templates/structure.tpl7
-rw-r--r--plugins/Installation/templates/tablesCreation.tpl2
5 files changed, 52 insertions, 5 deletions
diff --git a/plugins/Installation/Controller.php b/plugins/Installation/Controller.php
index 632fb9cc22..f64e810a4c 100644
--- a/plugins/Installation/Controller.php
+++ b/plugins/Installation/Controller.php
@@ -220,12 +220,13 @@ class Piwik_Installation_Controller extends Piwik_Controller
function databaseCheck()
{
$this->checkPreviousStepIsValid( __FUNCTION__ );
-
$view = new Piwik_Installation_View(
$this->pathView . 'databaseCheck.tpl',
$this->getInstallationSteps(),
__FUNCTION__
);
+
+ $error = false;
$this->skipThisStep( __FUNCTION__ );
if(isset($this->session->databaseVersionOk)
@@ -233,6 +234,10 @@ class Piwik_Installation_Controller extends Piwik_Controller
{
$view->databaseVersionOk = true;
}
+ else
+ {
+ $error = true;
+ }
if(isset($this->session->databaseCreated)
&& $this->session->databaseCreated === true)
@@ -241,6 +246,10 @@ class Piwik_Installation_Controller extends Piwik_Controller
$view->databaseName = $dbInfos['dbname'];
$view->databaseCreated = true;
}
+ else
+ {
+ $error = true;
+ }
$this->createDbFromSessionInformation();
$db = Zend_Registry::get('db');
@@ -249,6 +258,7 @@ class Piwik_Installation_Controller extends Piwik_Controller
$db->checkClientVersion();
} catch(Exception $e) {
$view->clientVersionWarning = $e->getMessage();
+ $error = true;
}
$this->session->charsetCorrection = false;
@@ -259,7 +269,11 @@ class Piwik_Installation_Controller extends Piwik_Controller
$view->showNextStep = true;
$this->session->currentStepDone = __FUNCTION__;
-
+
+ if($error === false)
+ {
+ $this->redirectToNextStep(__FUNCTION__);
+ }
echo $view->render();
}
@@ -411,12 +425,12 @@ class Piwik_Installation_Controller extends Piwik_Controller
$this->session->generalSetupSuccessMessage = true;
}
+ $this->initObjectsToCallAPI();
if($form->validate())
{
$name = urlencode($form->getSubmitValue('siteName'));
$url = urlencode($form->getSubmitValue('url'));
- $this->initObjectsToCallAPI();
$request = new Piwik_API_Request("
method=SitesManager.addSite
diff --git a/plugins/Installation/FormFirstWebsiteSetup.php b/plugins/Installation/FormFirstWebsiteSetup.php
index a38eae728a..9dfcb1b4e0 100644
--- a/plugins/Installation/FormFirstWebsiteSetup.php
+++ b/plugins/Installation/FormFirstWebsiteSetup.php
@@ -16,6 +16,17 @@
*/
class Piwik_Installation_FormFirstWebsiteSetup extends Piwik_Form
{
+ function validate()
+ {
+ try {
+ $timezone = $this->getSubmitValue('timezone');
+ Piwik_SitesManager_API::getInstance()->setDefaultTimezone($timezone);
+ } catch(Exception $e) {
+ $this->_errors['timezone'] = Piwik_Translate('General_NotValid', Piwik_Translate('Installation_Timezone'));
+ }
+ return parent::validate();
+ }
+
function init()
{
$urlToGoAfter = 'index.php' . Piwik_Url::getCurrentQueryString();
@@ -23,9 +34,14 @@ class Piwik_Installation_FormFirstWebsiteSetup extends Piwik_Form
$urlExample = 'http://example.org';
$javascriptOnClickUrlExample = "\"javascript:if(this.value=='$urlExample'){this.value='http://';} this.style.color='black';\"";
+ $timezones = Piwik_SitesManager_API::getInstance()->getTimezonesList();
+ $timezones = array_merge(array(Piwik_Translate('SitesManager_SelectACity')), $timezones);
+
$formElements = array(
array('text', 'siteName', Piwik_Translate('Installation_SetupWebSiteName')),
array('text', 'url', Piwik_Translate('Installation_SetupWebSiteURL'), "style='color:rgb(153, 153, 153);' value=$urlExample onfocus=".$javascriptOnClickUrlExample." onclick=".$javascriptOnClickUrlExample),
+ array('select', 'timezone', Piwik_Translate('Installation_Timezone'), $timezones),
+
);
$this->addElements( $formElements );
@@ -35,6 +51,13 @@ class Piwik_Installation_FormFirstWebsiteSetup extends Piwik_Form
$formRules[] = array($row[1], Piwik_Translate('General_Required', $row[2]), 'required');
}
+
+ $submitTimezone = $this->getSubmitValue('timezone');
+ if(!$this->isSubmitted()
+ || !empty($submitTimezone))
+ {
+ $this->setSelected('timezone', $submitTimezone);
+ }
$this->addRules( $formRules );
$this->addElement('submit', 'submit', Piwik_Translate('Installation_SubmitGo'));
diff --git a/plugins/Installation/View.php b/plugins/Installation/View.php
index 0b5e288890..7f3ae3c197 100644
--- a/plugins/Installation/View.php
+++ b/plugins/Installation/View.php
@@ -48,6 +48,11 @@ class Piwik_Installation_View extends Piwik_View
{
$this->previousModuleName = $this->steps[$this->currentStepId - 1];
}
+ $this->previousPreviousModuleName = '';
+ if(isset($this->steps[$this->currentStepId - 2]))
+ {
+ $this->previousPreviousModuleName = $this->steps[$this->currentStepId - 2];
+ }
return parent::render();
}
diff --git a/plugins/Installation/templates/structure.tpl b/plugins/Installation/templates/structure.tpl
index 4a02e3c044..9228987d53 100644
--- a/plugins/Installation/templates/structure.tpl
+++ b/plugins/Installation/templates/structure.tpl
@@ -94,13 +94,18 @@ h3 {
padding:10;
}
.warning {
+ margin:10px;
color:#ff5502;
font-size:130%;
font-weight:bold;
- padding:10;
+ padding:10px 20px 10px 30px;
border: 1px solid #ff5502;
}
+.warning ul {
+ list-style:disc;
+}
+
.success img, .warning img {
border:0;
vertical-align:bottom;
diff --git a/plugins/Installation/templates/tablesCreation.tpl b/plugins/Installation/templates/tablesCreation.tpl
index d79e4b2e3a..028799e9fd 100644
--- a/plugins/Installation/templates/tablesCreation.tpl
+++ b/plugins/Installation/templates/tablesCreation.tpl
@@ -11,7 +11,7 @@
<p>{'Installation_TablesWarningHelp'|translate}</p>
<p class="nextStep"><a href="{url action=$nextModuleName}">{'Installation_TablesReuse'|translate} &raquo;</a></p>
{else}
- <p class="nextStep"><a href="{url action=$previousModuleName}">&laquo; {'Installation_GoBackAndDefinePrefix'|translate}</a></p>
+ <p class="nextStep"><a href="{url action=$previousPreviousModuleName}">&laquo; {'Installation_GoBackAndDefinePrefix'|translate}</a></p>
{/if}
<p class="nextStep"><a href="{url deleteTables=1}" id="eraseAllTables">{'Installation_TablesDelete'|translate} &raquo;</a></p>