Files
nextcloud-analytics/analyticshub/templates/admin.php
WLTBAgent 730e576ead Fix: Simplify integration and fix admin template
- Removed settings/navigation from appinfo/info.xml
  - These sections can cause routing conflicts
  - App now relies purely on routes.php
- Simplified Application.php
  - Removed manual service/controller registration
  - Let Nextcloud DI framework handle it automatically
- Fixed admin template to use Nextcloud standards
  - Removed non-standard style() call
  - Added proper l10n support with p($l->t(...))
  - Clean template structure
- Created css/admin.css
  - Nextcloud-compatible styling
  - Matches design language
- Created js/admin.js
  - Handles Save Configuration button
  - Handles Test Connection button
  - Uses OC, OC.Notification APIs

This should fix admin page not appearing issue.
Users can access via: Settings → Administration → Additional Settings
2026-02-13 19:06:07 +00:00

79 lines
2.9 KiB
PHP

<?php
declare(strict_types=1);
?>
<div id="analytics-hub-settings" class="section">
<h2><?php p($l->t('Mini-CMO Analytics Hub')); ?></h2>
<p><?php p($l->t('AI-powered Google Analytics 4 reporting with automated daily reports.')); ?></p>
<div class="analytics-hub-settings__section">
<h3><?php p($l->t('Google Analytics Configuration')); ?></h3>
<div class="analytics-hub-settings__field">
<label for="google_client_id"><?php p($l->t('Google Client ID')); ?></label>
<input
type="text"
id="google_client_id"
name="google_client_id"
placeholder="123456789.apps.googleusercontent.com"
autocomplete="off"
/>
</div>
<div class="analytics-hub-settings__field">
<label for="google_client_secret"><?php p($l->t('Google Client Secret')); ?></label>
<input
type="password"
id="google_client_secret"
name="google_client_secret"
placeholder="GOCSPX-..."
autocomplete="off"
/>
</div>
<div class="analytics-hub-settings__field">
<label for="google_refresh_token"><?php p($l->t('Refresh Token')); ?></label>
<input
type="password"
id="google_refresh_token"
name="google_refresh_token"
placeholder="1//..."
autocomplete="off"
/>
<p class="analytics-hub-settings__hint">
<?php p($l->t('After OAuth consent, paste only the refresh token here. The access token is refreshed automatically each run.')); ?>
</p>
</div>
</div>
<div class="analytics-hub-settings__section">
<h3><?php p($l->t('Anthropic Claude API')); ?></h3>
<div class="analytics-hub-settings__field">
<label for="anthropic_api_key"><?php p($l->t('API Key')); ?></label>
<input
type="password"
id="anthropic_api_key"
name="anthropic_api_key"
placeholder="sk-ant-..."
autocomplete="off"
/>
<p class="analytics-hub-settings__hint">
<?php p($l->t('Enter your Anthropic API key for AI-powered report generation. Model: claude-sonnet-4-5-20250929 (cost-effective)')); ?>
</p>
<p class="analytics-hub-settings__hint">
<?php p($l->t('Cost: ~$0.015 per report (3K tokens)')); ?>
</p>
</div>
</div>
<div class="analytics-hub-settings__actions">
<button id="analytics-hub-save" class="primary">
<?php p($l->t('Save Configuration')); ?>
</button>
<button id="analytics-hub-test" class="secondary">
<?php p($l->t('Test Connection')); ?>
</button>
</div>
</div>