Skip to content

Commit

Permalink
Added support for Master Config. Thanks Mike.
Browse files Browse the repository at this point in the history
  • Loading branch information
siffring committed Aug 7, 2013
1 parent 8f21702 commit b1e76ac
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions sh_environment/acc.sh_environment.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,36 @@
*/

class Sh_environment_acc {

public $name = 'SH Environment';
public $id = 'sh_environment';
public $version = '1.0';
public $version = '1.1';
public $description = 'Display which environment you are on at all times in the CP. Fork from https://github.com/davist11/Environment-EE-Addon';
public $sections = array();

/**
* Set Sections
*/
public function set_sections()
{
$EE =& get_instance();
$js = '';

if ($EE->session->userdata('group_id') == 1 && defined('NSM_ENV')) {

// FocusLab Master Config uses the ENV constant
// If that's not set check for NSM Bootstrap NSM_ENV
if( !defined('ENV') && defined('NSM_ENV'))
{
define('ENV', NSM_ENV);
}

if ($EE->session->userdata('group_id') == 1 && defined('ENV')) {
$js = 'var $body = $("body");
var $siteName = $("#navigationTabs").find(".msm_sites");
var siteNameOffset = $siteName.offset();
var rightPos = $body.width() - siteNameOffset.left + 20;
$body.append("<div class=\"environment-label\" style=\"right: " + rightPos + "px;\">' . NSM_ENV . ' <small>environment</small></div>");';
$body.append("<div class=\"environment-label\" style=\"right: " + rightPos + "px;\">' . ENV . ' <small>environment</small></div>");';

$css = '<style type="text/css" media="screen">
.environment-label {
background: #1f2b33;
Expand All @@ -72,16 +79,16 @@ public function set_sections()
text-transform: uppercase;
}
</style>';

$EE->cp->add_to_head($css);
}

$this->sections[] = '<script type="text/javascript">$("#accessoryTabs a.' . $this->id . '").parent().remove();' . $js . '</script>';

}

// ----------------------------------------------------------------

}

/* End of file acc.environment.php */
Expand Down

0 comments on commit b1e76ac

Please sign in to comment.