Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin reorganization #75

Merged
merged 4 commits into from
Jun 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ documentation
favicon.ico
logs
plugins/*.zip
themes/logo-header.png
themes/logo.png
misc/user/logo-header.png
misc/user/logo.png
misc/user/logo.svg
piwik-min.js
robots.txt
tmp
Expand Down
2 changes: 1 addition & 1 deletion core/Piwik.php
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ static public function createHtAccessFiles()
'/js' => $allowAny,
'/libs' => $denyDirectPhp . $allowStaticAssets,
'/plugins' => $denyDirectPhp . $allowStaticAssets,
'/themes' => $denyDirectPhp . $allowStaticAssets,
'/misc/user' => $denyDirectPhp . $allowStaticAssets,
);
foreach ($directoriesToProtect as $directoryToProtect => $content) {
Piwik_Common::createHtAccess(PIWIK_INCLUDE_PATH . $directoryToProtect, $overwrite = true, $content);
Expand Down
6 changes: 3 additions & 3 deletions core/ReportRenderer/Html.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ public function getRenderedReport()

private function epilogue()
{
$view = new Piwik_View('@CoreHome/html_report_footer');
$view = new Piwik_View('@CoreHome/ReportRenderer/_htmlReportFooter');
$this->rendering .= $view->render();
}

public function renderFrontPage($reportTitle, $prettyDate, $description, $reportMetadata)
{
$frontPageView = new Piwik_View('@CoreHome/html_report_header');
$frontPageView = new Piwik_View('@CoreHome/ReportRenderer/_htmlReportHeader');
$this->assignCommonParameters($frontPageView);

// todo rename 'websiteName' to 'reportTitle' once branch twig is merged
Expand Down Expand Up @@ -114,7 +114,7 @@ private function assignCommonParameters(Piwik_View $view)

public function renderReport($processedReport)
{
$reportView = new Piwik_View('@CoreHome/html_report_body');
$reportView = new Piwik_View('@CoreHome/ReportRenderer/_htmlReportBody');
$this->assignCommonParameters($reportView);

$reportMetadata = $processedReport['metadata'];
Expand Down
2 changes: 1 addition & 1 deletion core/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ static public function clearCompiledTemplates()
*/
static public function singleReport($title, $reportHtml, $fetch = false)
{
$view = new Piwik_View('@CoreHome/single_report');
$view = new Piwik_View('@CoreHome/_singleReport');
$view->title = $title;
$view->report = $reportHtml;

Expand Down
4 changes: 2 additions & 2 deletions core/View/ReportsByDimension.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* A facade that makes it easier to use the 'reports_by_dimension.tpl' template.
* A facade that makes it easier to use the '_reportsByDimension.twig' template.
*
* This view will output HTML that displays a list of report names by category and
* loads them by AJAX when clicked. The loaded report is displayed to the right
Expand All @@ -23,7 +23,7 @@ class Piwik_View_ReportsByDimension extends Piwik_View
*/
public function __construct()
{
parent::__construct('@CoreHome/reports_by_dimension');
parent::__construct('@CoreHome/ReportsByDimension/_reportsByDimension');
$this->dimensionCategories = array();
}

Expand Down
2 changes: 1 addition & 1 deletion core/ViewDataTable/Cloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function init($currentControllerName,
$currentControllerAction,
$apiMethodToRequestDataTable,
$controllerActionCalledWhenRequestSubTable);
$this->dataTableTemplate = '@CoreHome/cloud';
$this->dataTableTemplate = '@CoreHome/_dataTableCloud';
$this->disableOffsetInformation();
$this->disableExcludeLowPopulation();
}
Expand Down
2 changes: 1 addition & 1 deletion core/ViewDataTable/GenerateGraphHTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function init($currentControllerName,
$apiMethodToRequestDataTable,
$controllerActionCalledWhenRequestSubTable);

$this->dataTableTemplate = '@CoreHome/graph';
$this->dataTableTemplate = '@CoreHome/_dataTableGraph';

$this->disableOffsetInformationAndPaginationControls();
$this->disableExcludeLowPopulation();
Expand Down
2 changes: 1 addition & 1 deletion core/ViewDataTable/HtmlTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function init($currentControllerName,
$currentControllerAction,
$apiMethodToRequestDataTable,
$controllerActionCalledWhenRequestSubTable);
$this->dataTableTemplate = '@CoreHome/datatable';
$this->dataTableTemplate = '@CoreHome/_dataTable';
$this->variablesDefault['enable_sort'] = '1';
$this->setSortedColumn('nb_visits', 'desc');
$this->setLimit(Piwik_Config::getInstance()->General['datatable_default_limit']);
Expand Down
4 changes: 2 additions & 2 deletions core/testMinimumPhpVersion.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ function Piwik_ExitWithMessage($message, $optionalTrace = false, $optionalLinks
<li><a target="_blank" href="http://demo.piwik.org">Piwik Online Demo</a></li>
</ul>';
}
$headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simple_structure_header.tpl');
$footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simple_structure_footer.tpl');
$headerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simpleLayoutHeader.tpl');
$footerPage = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Zeitgeist/templates/simpleLayoutFooter.tpl');

$headerPage = str_replace('{$HTML_TITLE}', 'Piwik &rsaquo; Error', $headerPage);
$content = '<p>' . $message . '</p>
Expand Down
2 changes: 1 addition & 1 deletion lang/de.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@
'CoreAdminHome_UseCustomLogo' => 'Eigenes Logo verwenden',
'CoreAdminHome_LogoUpload' => 'Wählen Sie ein Logo für den Upload',
'CoreAdminHome_LogoUploadDescription' => 'Es werden Logos in %s Formaten, ohne Transparenz und mit einer minimalen Höhe von %s Pixeln unterstützt.',
'CoreAdminHome_LogoNotWriteable' => 'Um ein eigenes Logo in Piwik verwenden zu können, wird Schreibzugriff auf die Logo Dateien im themes Ordner benötigt: %s',
'CoreAdminHome_LogoNotWriteable' => 'Um ein eigenes Logo in Piwik verwenden zu können, wird Schreibzugriff auf die Logo Dateien im "misc" Ordner benötigt: %s',
'CoreAdminHome_TrustedHostSettings' => 'Vertrauter Piwik Hostname',
'CoreAdminHome_TrustedHostConfirm' => 'Wollen Sie wirklich den Vertrauten Piwik Hostnamen ändern?',
'CoreAdminHome_PiwikIsInstalledAt' => 'Piwik ist installiert unter',
Expand Down
2 changes: 1 addition & 1 deletion lang/en.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@
'CoreAdminHome_UseCustomLogo' => 'Use a custom logo',
'CoreAdminHome_LogoUpload' => 'Select a Logo to upload',
'CoreAdminHome_LogoUploadDescription' => 'Please upload a file in %s formats, no transparent background, with a minimum height of %s pixels.',
'CoreAdminHome_LogoNotWriteable' => 'To use a custom logo Piwik requires write access to the logo files within the themes directory: %s',
'CoreAdminHome_LogoNotWriteable' => 'To use a custom logo Piwik requires write access to the logo files within the "misc" directory: %s',
'CoreAdminHome_TrustedHostSettings' => 'Trusted Piwik Hostname',
'CoreAdminHome_TrustedHostConfirm' => 'Are you sure you want to change the trusted Piwik hostname?',
'CoreAdminHome_PiwikIsInstalledAt' => 'Piwik is installed at',
Expand Down
2 changes: 1 addition & 1 deletion lang/hu.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
'CoreAdminHome_CustomLogoFeedbackInfo' => 'A Piwik logó konfigurálása esetén érdekes lehet a felső menüben található %s link eltávolítása is. Ehhez a %sBővítmények%s oldalon ki kell kapcsolni a Feedback bővítményt.',
'CoreAdminHome_LogoUpload' => 'Feltölteni kívánt logó:',
'CoreAdminHome_LogoUploadDescription' => 'Kérlek %s formátumú, nem átlátszó hátterű és legfeljebb %s pixel magas képet tölts fel.',
'CoreAdminHome_LogoNotWriteable' => 'Egyéni logó használatához a Piwiknek írási jogra van szüksége a \'themes\' mappában a logó fájlokhoz: %s',
'CoreAdminHome_LogoNotWriteable' => 'Egyéni logó használatához a Piwiknek írási jogra van szüksége a "misc" mappában a logó fájlokhoz: %s',
'CoreHome_PluginDescription' => 'Webanalitikai jelentések struktúrája',
'CoreHome_WebAnalyticsReports' => 'Webanalitikai jelentések',
'CoreHome_NoPrivilegesAskPiwikAdmin' => '\'%s\' felhasználóként léptél be, de úgy tűnik, hogy nem rendelkezel semmilyen jogosultsággal. %s Kérd meg a Piwik adminisztrátorod (kattints ide egy email írásához)%s, hogy adjon számodra \'megtekintési\' jogosultságot a webhelyhez.',
Expand Down
2 changes: 1 addition & 1 deletion lang/nl.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@
'CoreAdminHome_UseCustomLogo' => 'Gebruik een aangepast logo',
'CoreAdminHome_LogoUpload' => 'Selecteer een logo om te uploaden',
'CoreAdminHome_LogoUploadDescription' => 'Upload een bestand in de formaten %s, geen transparante achtergrond, met een minimum hoogte van %s pixels.',
'CoreAdminHome_LogoNotWriteable' => 'Voor het gebruik van een aangepast logo heeft Piwik schrijfrechten nodig in de map met de logo-bestanden in de themes map: %s',
'CoreAdminHome_LogoNotWriteable' => 'Voor het gebruik van een aangepast logo heeft Piwik schrijfrechten nodig in de map met de logo-bestanden in de "misc" map: %s',
'CoreAdminHome_TrustedHostSettings' => 'Toegestane Piwik hostnaam',
'CoreAdminHome_PiwikIsInstalledAt' => 'Piwik is geïnstalleerd in',
'CoreAdminHome_JavaScriptTracking' => 'JavaScript Tracking',
Expand Down
Empty file added misc/user/.gitkeep
Empty file.
14 changes: 7 additions & 7 deletions plugins/API/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ public function getLogoUrl($pathOnly = false)
{
$logo = 'plugins/Zeitgeist/images/logo.png';
if (Piwik_Config::getInstance()->branding['use_custom_logo'] == 1
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/themes/logo.png')
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/misc/user/logo.png')
) {
$logo = 'themes/logo.png';
$logo = 'misc/user/logo.png';
}
if (!$pathOnly) {
return Piwik::getPiwikUrl() . $logo;
Expand All @@ -466,9 +466,9 @@ public function getHeaderLogoUrl($pathOnly = false)
{
$logo = 'plugins/Zeitgeist/images/logo-header.png';
if (Piwik_Config::getInstance()->branding['use_custom_logo'] == 1
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/themes/logo-header.png')
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/misc/user/logo-header.png')
) {
$logo = 'themes/logo-header.png';
$logo = 'misc/user/logo-header.png';
}
if (!$pathOnly) {
return Piwik::getPiwikUrl() . $logo;
Expand All @@ -487,9 +487,9 @@ public function getSVGLogoUrl($pathOnly = false)
{
$logo = 'plugins/Zeitgeist/images/logo.svg';
if (Piwik_Config::getInstance()->branding['use_custom_logo'] == 1
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/themes/logo.svg')
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/misc/user/logo.svg')
) {
$logo = 'themes/logo.svg';
$logo = 'misc/user/logo.svg';
}
if (!$pathOnly) {
return Piwik::getPiwikUrl() . $logo;
Expand All @@ -508,7 +508,7 @@ public function hasSVGLogo()
/* We always have our application logo */
return true;
} else if (Piwik_Config::getInstance()->branding['use_custom_logo'] == 1
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/themes/logo.svg')
&& file_exists(Piwik_Common::getPathToPiwikRoot() . '/misc/user/logo.svg')
) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/API/templates/listAllAPI.twig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{% block content %}
<div class="page_api">
<div class="top_controls_inner">
{% include "@CoreHome/period_select.twig" %}
{% include "@CoreHome/_periodSelect.twig" %}
</div>

<h2>{{ 'API_QuickDocumentationTitle'|translate }}</h2>
Expand Down
6 changes: 3 additions & 3 deletions plugins/Actions/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ protected function configureViewOutlinks($view)
*/
protected function configureGenericViewActions($view)
{
$view->setTemplate('@CoreHome/datatable_actions');
$view->setTemplate('@CoreHome/_dataTableActions');
if (Piwik_Common::getRequestVar('idSubtable', -1) != -1) {
$view->setTemplate('@CoreHome/datatable_actions_subdatable');
$view->setTemplate('@CoreHome/_dataTableActions_subDataTable');
}
$currentlySearching = $view->setSearchRecursive();
if ($currentlySearching) {
$view->setTemplate('@CoreHome/datatable_actions_recursive');
$view->setTemplate('@CoreHome/_dataTableActions_recursive');
}
// disable Footer icons
$view->disableShowAllViewsIcons();
Expand Down
6 changes: 3 additions & 3 deletions plugins/Annotations/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getAnnotationManager($fetch = false, $date = false, $period = fa
}

// create & render the view
$view = new Piwik_View('@Annotations/annotationManager');
$view = new Piwik_View('@Annotations/getAnnotationManager');

$allAnnotations = Piwik_API_Request::processRequest(
'Annotations.getAll', array('date' => $date, 'period' => $period, 'lastN' => $lastN));
Expand Down Expand Up @@ -103,7 +103,7 @@ public function saveAnnotation()
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$this->checkTokenInUrl();

$view = new Piwik_View('@Annotations//annotation');
$view = new Piwik_View('@Annotations/saveAnnotation');

// NOTE: permissions checked in API method
// save the annotation
Expand Down Expand Up @@ -208,7 +208,7 @@ public function getEvolutionIcons()
"Annotations.getAnnotationCountForDates", array('getAnnotationText' => 1));

// create & render the view
$view = new Piwik_View('@Annotations/evolutionAnnotations');
$view = new Piwik_View('@Annotations/getEvolutionIcons');
$view->annotationCounts = reset($annotationCounts); // only one idSite allowed for this action

echo $view->render();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<table>
{% for annotation in annotations %}
{% include "@Annotations/annotation.twig" %}
{% include "@Annotations/_annotation.twig" %}
{% endfor %}
<tr class="new-annotation-row" style="display:none" data-date="{{ startDate }}">
<td class="annotation-meta">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="annotation-list-range">{{ startDatePretty }}{% if startDate != endDate %} &mdash; {{ endDatePretty }}{% endif %}</div>

<div class="annotation-list">
{% include "@Annotations/annotations.twig" %}
{% include "@Annotations/_annotationList.twig" %}

<span class="loadingPiwik" style="display:none"><img src="plugins/Zeitgeist/images/loading-blue.gif"/>{{ 'General_Loading_js'|translate }}</span>

Expand Down
1 change: 1 addition & 0 deletions plugins/Annotations/templates/saveAnnotation.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{% include "@Annotations/_annotation.twig" %}
12 changes: 7 additions & 5 deletions plugins/CoreAdminHome/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ public function generalSettings()

$view->branding = $config->branding;

$directoryWritable = is_writable(PIWIK_DOCUMENT_ROOT . '/themes/');
$logoFilesWriteable = is_writeable(PIWIK_DOCUMENT_ROOT . '/themes/logo.png') && is_writeable(PIWIK_DOCUMENT_ROOT . '/themes/logo-header.png');
$directoryWritable = is_writable(PIWIK_DOCUMENT_ROOT . '/misc/user/');
$logoFilesWriteable = is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo.png')
&& is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo.svg')
&& is_writeable(PIWIK_DOCUMENT_ROOT . '/misc/user/logo-header.png');;
$view->logosWriteable = ($logoFilesWriteable || $directoryWritable) && ini_get('file_uploads') == 1;

$trustedHosts = array();
Expand Down Expand Up @@ -127,7 +129,7 @@ public function setGeneralSettings()
*/
public function trackingCodeGenerator()
{
$view = new Piwik_View('@CoreAdminHome/jsTrackingGenerator');
$view = new Piwik_View('@CoreAdminHome/trackingCodeGenerator');
$this->setBasicVariablesView($view);
$view->topMenu = Piwik_GetTopMenu();
$view->menu = Piwik_GetAdminMenu();
Expand Down Expand Up @@ -224,8 +226,8 @@ public function uploadCustomLogo()
imagecopyresized($logo, $image, 0, 0, 0, 0, $widthExpected, self::LOGO_HEIGHT, $width, $height);
imagecopyresized($logoSmall, $image, 0, 0, 0, 0, $smallWidthExpected, self::LOGO_SMALL_HEIGHT, $width, $height);

imagepng($logo, PIWIK_DOCUMENT_ROOT . '/themes/logo.png', 3);
imagepng($logoSmall, PIWIK_DOCUMENT_ROOT . '/themes/logo-header.png', 3);
imagepng($logo, PIWIK_DOCUMENT_ROOT . '/misc/user/logo.png', 3);
imagepng($logoSmall, PIWIK_DOCUMENT_ROOT . '/misc/user/logo-header.png', 3);
echo '1';
return;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/CoreAdminHome/templates/generalSettings.twig
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,11 @@
</td>
<td style='width:200px'>
<input name="customLogo" type="file" id="customLogo"/>
<img src="themes/logo.png?r={math equation='rand(10,1000)'}" id="currentLogo" height="150"/>
<img src="misc/user/logo.png?r={math equation='rand(10,1000)'}" id="currentLogo" height="150"/>
</td>
{% else %}
<td>
<span class="ajaxSuccess">{{ 'CoreAdminHome_LogoNotWriteable'|translate("<ul style='list-style: disc inside;'><li>/themes/</li><li>/themes/logo.png</li><li>/themes/logo-header.png</li></ul>")|raw }}</span>
<span class="ajaxSuccess">{{ 'CoreAdminHome_LogoNotWriteable'|translate("<ul style='list-style: disc inside;'><li>/misc/user/</li><li>/misc/user/logo.png</li><li>/misc/user/logo-header.png</li></ul>")|raw }}</span>
</td>
{% endif %}
</tr>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div>
{# website #}
<label class="website-label"><strong>{{ 'General_Website'|translate }}</strong></label>
{% include "@CoreHome/sites_selection.twig" with {'siteName':defaultReportSiteName, 'idSite':idSite, 'showAllSitesItem':false, 'switchSiteOnSelect':false,
{% include "@CoreHome/_siteSelect.twig" with {'siteName':defaultReportSiteName, 'idSite':idSite, 'showAllSitesItem':false, 'switchSiteOnSelect':false,
'siteSelectorId':"js-tracker-website", 'showSelectedSite':true} %}

<br/><br/><br/>
Expand Down Expand Up @@ -193,7 +193,7 @@
<div>
{# website #}
<label class="website-label"><strong>{{ 'General_Website'|translate }}</strong></label>
{% include "@CoreHome/sites_selection.twig" with {
{% include "@CoreHome/_siteSelect.twig" with {
'siteName': defaultReportSiteName, 'idSite': idSite, 'showAllSitesItem': false,
'switchSiteOnSelect': false, 'showSelectedSite': true, 'siteSelectorId':"image-tracker-website"
} %}
Expand Down