Skip to content

Commit

Permalink
Version 3.6.3
Browse files Browse the repository at this point in the history
  • Loading branch information
luigifab committed Apr 1, 2018
1 parent f9d8ca2 commit 90a8821
Show file tree
Hide file tree
Showing 47 changed files with 372 additions and 336 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ For more information, go to https://www.luigifab.fr/magento/versioning (IPv6 is

This repository is a mirror. To install the module, please use the extension key available in the documentation. If you like, take some of your time to improve the translations, go to https://bit.ly/2HyCCEc.

Version 3.6.2 released on 21/01/2018.
Version 3.6.3 released on 01/04/2018.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created J/07/02/2013
* Updated V/19/01/2018
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand All @@ -17,8 +17,8 @@
* GNU General Public License (GPL) for more details.
*/

class Luigifab_Versioning_Block_Adminhtml_Config_Heading extends Mage_Adminhtml_Block_Abstract
implements Varien_Data_Form_Element_Renderer_Interface {
use Varien_Data_Form_Element_Renderer_Interface as Varien_DFER_Interface;
class Luigifab_Versioning_Block_Adminhtml_Config_Heading extends Mage_Adminhtml_Block_Abstract implements Varien_DFER_Interface {

public function render(Varien_Data_Form_Element_Abstract $element) {

Expand All @@ -40,13 +40,14 @@ public function render(Varien_Data_Form_Element_Abstract $element) {
if ($element->getHtmlId() == 'versioning_downtime_report')
$url = str_replace('?lang', '?demo=1&amp;lang', $url);

return sprintf('<tr class="system-fieldset-sub-head"><td colspan="5"><h4>%s <a href="%s">%s</a></h4></td></tr>', $element->getData('label'), $url, $this->__('Preview in %s', $this->getLocaleName($lang)));
return sprintf('<tr class="system-fieldset-sub-head"><td colspan="5"><h4>%s <a href="%s">%s</a></h4></td></tr>',
$element->getData('label'), $url, $this->__('Preview in %s', $this->getLocaleName($lang)));
}

private function getStoreId() {

$website = $this->getRequest()->getParam('website');
$store = $this->getRequest()->getParam('store');
$store = $this->getRequest()->getParam('store');

if (!empty($store))
$storeId = Mage::getModel('core/store')->load($store)->getId();
Expand All @@ -63,7 +64,6 @@ private function getLocaleName($lang) {
$locales = Mage::getSingleton('core/locale')->getOptionLocales();

foreach ($locales as $locale) {

if ($locale['value'] == $lang)
return $locale['label'];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/04/02/2017
* Updated M/28/02/2017
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand All @@ -20,6 +20,6 @@
class Luigifab_Versioning_Block_Adminhtml_Config_Ip extends Mage_Adminhtml_Block_System_Config_Form_Field {

protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) {
return sprintf('<span id="%s">%s</span>', $element->getHtmlId(), getenv('REMOTE_ADDR'));
return sprintf('<span id="%s">%s</span>', $element->getHtmlId(), $this->helper('versioning')->getIpAddr());
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created V/06/04/2012
* Updated D/29/10/2017
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand Down Expand Up @@ -46,7 +46,7 @@ public function __construct() {

public function getGridHtml() {
$file = $this->helper('versioning')->getLastLog();
return '<pre lang="mul">'.((is_file($file) && is_readable($file)) ? file_get_contents($file) : '')."\n".'</pre> '.$this->getChildHtml('grid');
return '<pre lang="mul">'.((is_file($file) && is_readable($file)) ? file_get_contents($file) : '').'</pre> '.$this->getChildHtml('grid');
}

public function getHeaderCssClass() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created V/06/04/2012
* Updated J/07/12/2017
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand Down Expand Up @@ -48,7 +48,7 @@ protected function _prepareColumns() {
'header' => $this->__('Current revision'),
'index' => 'from',
'align' => 'center',
'width' => '110px',
'width' => '130px',
'sortable' => false,
'filter' => false
));
Expand All @@ -57,7 +57,7 @@ protected function _prepareColumns() {
'header' => $this->__('Requested revision'),
'index' => 'to',
'align' => 'center',
'width' => '110px',
'width' => '130px',
'sortable' => false,
'filter' => false
));
Expand Down Expand Up @@ -111,7 +111,6 @@ protected function _prepareColumns() {
$this->addColumn('status', array(
'header' => $this->__('Status'),
'index' => 'status',
'align' => 'status',
'width' => '125px',
'filter' => false,
'sortable' => false,
Expand Down Expand Up @@ -140,37 +139,21 @@ public function getRowUrl($row) {
return false;
}


public function decorateStatus($value, $row, $column, $isExport) {

$status = (in_array($row->getData('status'), array('Update completed', 'Upgrade completed'))) ?
'success' : 'error'; // il y avait Upgrade avant 3.4.2
$text = ($status == 'success') ? $this->helper('versioning')->_('Success') : $this->__('Error');
$status = (in_array($row->getData('status'), array('Update completed', 'Upgrade completed'))) ? 'success' : 'error';
$text = ($status == 'success') ? $this->helper('versioning')->_('Success') : $this->helper('versioning')->_('Error');

return sprintf('<span class="grid-%s">%s</span>', $status, $text);
return sprintf('<span class="versioning-status grid-%s">%s</span>', $status, $text);
}

public function decorateDuration($value, $row, $column, $isExport) {

$data = $row->getData('duration');
$minutes = intval($data / 60);
$seconds = intval($data % 60);

if ($data > 599)
$data = '<strong>'.(($seconds > 9) ? $minutes.':'.$seconds : $minutes.':0'.$seconds).'</strong>';
else if ($data > 59)
$data = '<strong>'.(($seconds > 9) ? '0'.$minutes.':'.$seconds : '0'.$minutes.':0'.$seconds).'</strong>';
else if ($data > 1)
$data = ($seconds > 9) ? '00:'.$data : '00:0'.$data;
else
$data = '⩽ 1';

return $data;
return $this->helper('versioning')->getHumanDuration($row);
}

public function decorateLink($value, $row, $column, $isExport) {

return sprintf('<button type="button" onclick="versioning.history(this, \'%s\');">%s</button>',
addslashes(base64_encode($row->getData('details'))),
$this->__('View'));
addslashes(base64_encode($row->getData('details'))), $this->__('View'));
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/03/12/2011
* Updated S/06/01/2018
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand Down Expand Up @@ -62,7 +62,7 @@ public function __construct() {
else {
$this->_addButton('maintenance_flag', array(
'label' => $this->__('Enable the maintenance page'),
'onclick' => "versioning.confirmFlag('".$this->getUrl('*/*/addMaintenanceFlag')."', this.textContent, '".$this->helper('versioning')->getMaintenanceInfo(true)."', '".$this->__('Martian sunset seen by Spirit.')."');"
'onclick' => "versioning.confirmFlag('".$this->getUrl('*/*/addMaintenanceFlag')."', this.textContent, '".$this->helper('versioning')->getMaintenanceInfo()."');"
));
}

Expand All @@ -76,38 +76,40 @@ public function __construct() {
else {
$this->_addButton('upgrade_flag', array(
'label' => $this->__('Enable the update page'),
'onclick' => "versioning.confirmFlag('".$this->getUrl('*/*/addUpgradeFlag')."', this.textContent, '".$this->helper('versioning')->getUpgradeInfo(true)."', '".$this->__('Martian sunset seen by Spirit.')."');"
'onclick' => "versioning.confirmFlag('".$this->getUrl('*/*/addUpgradeFlag')."', this.textContent, '".$this->helper('versioning')->getUpgradeInfo()."');"
));
}
}

public function getGridHtml() {

$commits = Mage::registry('versioning')->getCommitCollection();
$count = count($commits) - 1;
$cols = 0;
$hash = '';
$commits = Mage::registry('versioning')->getCommitsCollection();
$columns = $commits->getColumnValues('column'); sort($columns);
$total = count($commits) - 1;
$hash = '';

// comptage dans l'ordre inverse
// le commit le plus récent = count($commits) - 1
// le commit le plus ancien = 0
foreach ($commits as $commit) {

$hash .= "\n";
$hash .= '"'.$commit->getData('revision').'": {';
$hash .= '"revision": "'.$commit->getData('revision').'",';
$hash .= '"parents": ["'.implode('","', $commit->getData('parents')).'"],';
$hash .= '"branch": "'.$commit->getData('branch').'",';
$hash .= '"col": '.$commit->getData('column').',';
$hash .= '"row": '.$count--;
$hash .= '"row": '.$total--;
$hash .= '},';

$cols = ($commit->getData('column') > $cols) ? $commit->getData('column') : $cols;
}

return $this->getChildHtml('grid')."\n".
'<script type="text/javascript">'."\n".
'var versioningIds = {'.substr($hash, 0, -1).'}, versioningCols = '.$cols.';'."\n".
'window.versioningIds = {'.substr($hash, 0, -1).'};'."\n".
'window.versioningCols = '.array_pop($columns).';'."\n".
'window.versioningConfirm = ['."\n".
'"'.$this->helper('versioning')->getFields().'", '."\n".
'"'.$this->__('Martian sunset seen by Spirit.').'" '."\n".
'];'."\n".
'</script>';
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created S/03/12/2011
* Updated V/19/01/2018
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __construct() {
}

protected function _prepareCollection() {
$this->setCollection(Mage::registry('versioning')->getCommitCollection());
$this->setCollection(Mage::registry('versioning')->getCommitsCollection());
return parent::_prepareCollection();
}

Expand Down Expand Up @@ -99,15 +99,7 @@ protected function _prepareColumns() {
));

$this->addColumn('action', array(
'type' => 'action',
'getter' => 'getRevision',
'actions' => array(
array(
'caption' => $this->__('Deliver'),
'url' => array('base' => '*/*/upgrade'),
'field' => 'revision'
)
),
'type' => 'action',
'align' => 'center',
'width' => '85px',
'filter' => false,
Expand Down Expand Up @@ -136,43 +128,37 @@ public function getMessagesBlock() {
return Mage::getBlockSingleton('core/template');
}


public function decorateRevision($value, $row, $column, $isExport) {
return ($value == $row->getData('current_revision')) ? sprintf('<strong>%s</strong>', $value) : $value;
}

public function decorateDiff($value, $row, $column, $isExport) {
return sprintf('<input type="radio" name="diff1" value="%s" /> <input type="radio" name="diff2" value="%1$s" />',
$row->getData('revision'));
return sprintf('<input type="radio" name="d1" value="%s" /> <input type="radio" name="d2" value="%1$s" />', $row->getData('revision'));
}

public function decorateDescription($value, $row, $column, $isExport) {

$bugtracker = Mage::getStoreConfig('versioning/scm/bugtracker');
$bugtracker = Mage::getStoreConfig('versioning/scm/bugtracker');
$description = nl2br($row->getData('description'));

if (!empty($bugtracker)) {
$description = preg_replace('/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/', '<a href="$1">$1</a>', $description);
$description = preg_replace('/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/', '<a href="$1" class="linkext">$1</a>', $description);
$description = preg_replace('#\#([0-9]+)#', '<a href="'.$bugtracker.'$1" class="issue">$1</a>', $description);
}
else {
$description = preg_replace('/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/', '<a href="$1">$1</a>', $description);
$description = preg_replace('/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/', '<a href="$1" class="linkext">$1</a>', $description);
}

return $description;
}

public function decorateLink($value, $row, $column, $isExport) {

$link = array();
preg_match('#href="([^"]+)"#', $value, $link);
$url = $this->getUrl('*/*/upgrade', array('revision' => $row->getData('revision')));

return sprintf('<button type="button" onclick="versioning.confirmUpgrade(\'%s\', \'%s\', \'%s\', \'%s\');">%s</button>',
array_pop($link),
$this->__('Update to revision %s', '§'),
$this->helper('versioning')->getFields(true),
$this->__('Martian sunset seen by Spirit.'),
$this->__('Deliver')
);
return sprintf('<button type="button" onclick="versioning.confirmUpgrade(\'%s\', \'%s\');">%s</button>',
$url, $this->__('Update to revision %s', '§'), $this->__('Deliver'));
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
* Created L/13/02/2012
* Updated J/07/12/2017
* Updated M/27/02/2018
*
* Copyright 2011-2018 | Fabrice Creuzot (luigifab) <code~luigifab~info>
* https://www.luigifab.info/magento/versioning
Expand Down Expand Up @@ -55,7 +55,7 @@ public function __construct() {
'class' => 'go'
));

if ($from && $to) {
if (!empty($from) && !empty($to)) {
$this->_addButton('status', array(
'label' => $this->__('Repository status'),
'onclick' => "setLocation('".$this->getUrl('*/*/status')."');",
Expand All @@ -67,8 +67,8 @@ public function __construct() {
public function getGridHtml() {

$model = Mage::getSingleton('versioning/scm_'.Mage::getStoreConfig('versioning/scm/type'));
$from = $this->getRequest()->getParam('from');
$to = $this->getRequest()->getParam('to');
$from = $this->getRequest()->getParam('from');
$to = $this->getRequest()->getParam('to');

if (!empty($from) && !empty($to))
return '<pre lang="mul">'.$model->getCurrentDiffStatus($from, $to).'</pre>'.
Expand Down
Loading

0 comments on commit 90a8821

Please sign in to comment.