Пример #1
0
 /**
  * Override the default index method of the settings controller in the
  * dashboard application to render new statistics.
  */
 public function StatsDashboard($Sender)
 {
     $StatsUrl = $this->AnalyticsServer;
     if (!StringBeginsWith($StatsUrl, 'http:')) {
         $StatsUrl = "http://{$StatsUrl}";
     }
     // Tell the page where to find the Vanilla Analytics provider
     $Sender->AddDefinition('VanillaStatsUrl', $StatsUrl);
     $Sender->SetData('VanillaStatsUrl', $StatsUrl);
     // Load javascript & css, check permissions, and load side menu for this page.
     $Sender->AddJsFile('settings.js');
     $Sender->Title(T('Dashboard'));
     $Sender->RequiredAdminPermissions[] = 'Garden.Settings.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Routes.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Applications.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Plugins.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Themes.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Registration.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Applicants.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Roles.Manage';
     $Sender->RequiredAdminPermissions[] = 'Garden.Users.Add';
     $Sender->RequiredAdminPermissions[] = 'Garden.Users.Edit';
     $Sender->RequiredAdminPermissions[] = 'Garden.Users.Delete';
     $Sender->RequiredAdminPermissions[] = 'Garden.Users.Approve';
     $Sender->FireEvent('DefineAdminPermissions');
     $Sender->Permission($Sender->RequiredAdminPermissions, '', FALSE);
     $Sender->AddSideMenu('dashboard/settings');
     if (!Gdn_Statistics::CheckIsEnabled() && Gdn_Statistics::CheckIsLocalhost()) {
         $Sender->Render('dashboardlocalhost', '', 'plugins/VanillaStats');
     } else {
         $Sender->AddJsFile('plugins/VanillaStats/js/vanillastats.js');
         $Sender->AddJsFile('plugins/VanillaStats/js/picker.js');
         $Sender->AddCSSFile('plugins/VanillaStats/design/style.css');
         $Sender->AddCSSFile('plugins/VanillaStats/design/picker.css');
         $this->ConfigureRange($Sender);
         $VanillaID = Gdn::InstallationID();
         $Sender->SetData('VanillaID', $VanillaID);
         $Sender->SetData('VanillaVersion', APPLICATION_VERSION);
         $Sender->SetData('SecurityToken', $this->SecurityToken());
         // Render the custom dashboard view
         $Sender->Render('dashboard', '', 'plugins/VanillaStats');
     }
 }
Пример #2
0
    #Content form .StatsDisabled input.Button {
        margin: 20px 0 0 0;
    }
</style>
<div class="StatsDisabled">
    <strong><?php 
echo t("Vanilla Statistics are currently disabled");
?>
</strong>
    <?php 
if (!c('Garden.Analytics.Enabled', true)) {
    echo $this->Form->Hidden('Allow', array('value' => 1));
    echo "<p>" . t("Garden.StatisticsDisabled", "You have specifically disabled Vanilla Statistics in your configuration file.") . "</p>";
    echo $this->Form->button("Enable", array('class' => 'Button SliceSubmit'));
} else {
    if (Gdn_Statistics::CheckIsLocalhost() && !c('Garden.Analytics.AllowLocal', false)) {
        echo $this->Form->Hidden('AllowLocal', array('value' => 1));
        echo "<p>" . t("Garden.StatisticsLocal.Explain", "This forum appears to be running in a test environment, or is otherwise reporting a private IP. By default, forums running on private IPs are not tracked.") . "</p>";
        echo "<p>" . t("Garden.StatisticsLocal.Resolve", "If you're sure your forum is accessible from the internet you can force it to report statistics here:") . "</p>";
        echo $this->Form->button("Enable", array('class' => 'Button SliceSubmit'));
    } else {
        if (!$this->data('ConfWritable')) {
            echo "<p>" . t("Garden.StatisticsReadonly.Explain", "Your config.php file appears to be read-only. This means that Vanilla will be unable to automatically register your forum's InstallationID and InstallationSecret.") . "</p>";
            echo "<p>" . t("Garden.StatisticsReadonly.Resolve", "To solve this problem, assign file mode 777 to your conf/config.php file.") . "</p>";
        }
    }
}
?>
    <p></p>

</div>
Пример #3
0
   #Content form .StatsDisabled input.Button {
      margin: 20px 0 0 0;
   }
</style>
<div class="StatsDisabled">
   <strong><?php 
echo T("Vanilla Statistics are currently disabled");
?>
</strong>
   <?php 
if (!C('Garden.Analytics.Enabled', TRUE)) {
    echo $this->Form->Hidden('Allow', array('value' => 1));
    echo "<p>" . T("Garden.StatisticsDisabled", "You have specifically disabled Vanilla Statistics in your configuration file.") . "</p>";
    echo $this->Form->Button("Enable", array('class' => 'Button SliceSubmit'));
} else {
    if (Gdn_Statistics::CheckIsLocalhost() && !C('Garden.Analytics.AllowLocal', FALSE)) {
        echo $this->Form->Hidden('AllowLocal', array('value' => 1));
        echo "<p>" . T("Garden.StatisticsLocal.Explain", "This forum appears to be running in a test environment, or is otherwise reporting a private IP. By default, forums running on private IPs are not tracked.") . "</p>";
        echo "<p>" . T("Garden.StatisticsLocal.Resolve", "If you're sure your forum is accessible from the internet you can force it to report statistics here:") . "</p>";
        echo $this->Form->Button("Enable", array('class' => 'Button SliceSubmit'));
    } else {
        if (!$this->Data('ConfWritable')) {
            echo "<p>" . T("Garden.StatisticsReadonly.Explain", "Your config.php file appears to be read-only. This means that Vanilla will be unable to automatically register your forum's InstallationID and InstallationSecret.") . "</p>";
            echo "<p>" . T("Garden.StatisticsReadonly.Resolve", "To solve this problem, assign file mode 777 to your conf/config.php file.") . "</p>";
        }
    }
}
?>
   <p></p>
   
</div>