Giter VIP home page Giter VIP logo

dashboard's Introduction

Dashboard

Purpose

To provide a Dashboard summary screen for users. Dashboard "panels" can contain any information. This extension provides the framework for building a Dashboard, and provides four basic panel types. Other extensions can provide their own panel types.

Installation

  1. Upload the 'dashboard' folder in this archive to your Symphony 'extensions' folder
  2. Enable it by selecting "Dashboard" in the list, choose Enable from the with-selected menu, then click Apply
  3. Navigate to the Dashboard from the "Dashboard" link in the primary navigation

Setting the Dashboard as the user's default

Once installed "Dashboard" will appear in the "Default area" dropdown when you create a new author. If you choose this, the author will be shown the dashboard when they log in.

Core panel types

There are five core panel types:

  • Datasource to Table takes a Symphony Data Source and attempts to render it as an HTML table. This works best with basic fields such as Text Input, Checkboxes and Dates. The first column will link to the entry itself.
  • HTML Block allows you to specify the URL of a page that outputs a chunk of HTML (a <div /> perhaps) to include in the panel.
  • Markdown Text Block allows you to add Markdown-formatted text to include in the panel.
  • RSS Feed Reader parses an RSS feed and renders the summary. Useful for latest news or updates.
  • Symphony Overview renders basic statistics about your installation such as version number and total number of entries.

Extensions that provide panels

The delegates that Dashboard provides means that other extensions can supply their own dashboard panels. These include:

  • Tracker panel shows summary of all author and developer activity within Symphony
  • Search Index panel shows a list of recent searches
  • Sections Panel shows latest entries from a section (without creating a data source)
  • Health Check shows test results against your server to determine the best permissions for your environment.
  • Google Analytics allows you to create panels that displays Google Analytics Charts.

Creating your own panel types

To provide panels your extension needs to implement (subscribe to) two delegates:

public function getSubscribedDelegates() {
	return array(
		array(
			'page'		=> '/backend/',
			'delegate'	=> 'DashboardPanelRender',
			'callback'	=> 'render_panel'
		),
		array(
			'page'		=> '/backend/',
			'delegate'	=> 'DashboardPanelTypes',
			'callback'	=> 'dashboard_panel_types'
		),
	);
}

There are two additional delegates to provide UI for panel settings, and its validation:

array(
	'page'		=> '/backend/',
	'delegate'	=> 'DashboardPanelOptions',
	'callback'	=> 'dashboard_panel_options'
),
array(
	'page'		=> '/backend/',
	'delegate'	=> 'DashboardPanelValidate',
	'callback'	=> 'dashboard_panel_validate'
),

These are optional unless your panel configuration requires user input.

DashboardPanelTypes

The callback function should return the handle and name of your panel(s) by adding a new key to the types array:

public function dashboard_panel_types($context) {
	$context['types']['my_dashboard_panel'] = 'My Amazing Dashboard Panel';
}

This will define a panel of type my_dashboard_panel. Make this name as unique as possible so it doesn't conflict with others.

DashboardPanelOptions

Each panel has a configuration screen. There are default options for all panels ("Label" and "Position"), but you can add additional elements to the configuration form using the DashboardPanelOptions delegate:

public function dashboard_panel_options($context) {
	// make sure it's your own panel type, as this delegate fires for all panel types!
	if ($context['type'] != 'my_dashboard_panel') return;
	
	$config = $context['existing_config'];

	$fieldset = new XMLElement('fieldset', NULL, array('class' => 'settings'));
	$fieldset->appendChild(new XMLElement('legend', 'My Panel Options'));

	$label = Widget::Label('Option 1', Widget::Input('config[option-1]', $config['option-1']));
	$fieldset->appendChild($label);

	$context['form'] = $fieldset;

}

The above code creates a fieldset which will be appended to the panel configuration form. The fieldset contains a single textfield with the label "Option 1". The $config array contains existing saved options, so you can pre-populate your form fields when editing an existing panel.

Upon saving, all form fields named in the config[...] array will be saved with this panel instance, and provided to the panel as an array when it renders.

DashboardPanelRender

Subscribe to the DashboardPanelRender delegate to render your panel on the dashboard.

public function render_panel($context) {
	if ($context['type'] != 'my_dashboard_panel') return;
	
	$config = $context['config'];
	$context['panel']->appendChild(new XMLElement('div', 'The value of Option 1 is: ' . $config['option-1']));
}

First check that you should output your own panel. $context['panel'] contains an XMLElement that is an empty panel container to which you can append children. The saved configuration for the panel is presented in the $context['config'] array.


Known issues

  • adding Markdown panels using different versions of the Markdown formatter will cause an error. Be sure to always use the same Markdown formatter for all panels

dashboard's People

Contributors

alexbirukov avatar bernardodiasc avatar brendo avatar brockpetrie avatar bzerangue avatar chobohub avatar lewiswharf avatar nickdunn avatar nilshoerrmann avatar nitriques avatar tiloschroeder avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dashboard's Issues

Dashboard on 2.2.5 - Major bug - Broken extension

Github API v2 now returns 404 since it has been replaced by v3.

Now the dashboard is broken on every v2.2.x site I have in production.

What approach do you want to use to fix this?
I may be able to commit a patch tonite.

Trying to access page with admin type via HTML Block - forbidden error

I would like to create a calendar view of entries to include in the dashboard. In order to do this I thought I could create a page in symphony, which is linked to the required datasource, use xslt to create the calendar and then include it in the dashboard using the HTML block.

However I have one major issue; the content on the calendar needs to be kept confidential. I thought I could set the page type to 'admin' so only logged in users can view it. However when I come to add it in the HTML block I just get the forbidden message, even though I am logged into Symphony....

Is what I am trying to do possible or do you know of another way I can achieve this?

Many thanks

Dashboard and html pages

Hi Nick!
I install this extension on symphony 2.3.1 and I try to insert an "HTML block". For testing, I insert "www.facebook.com" in the url field, and a new panel with facebook is created.
I know, it's a good idea, but I only try to do it!
Now I want to delete this panel, so I enabled changes and click on "modify" button.
When I click on it, a new page is opened (not with symphony styles) and there are all buttons to modify my panel, but if I try to delete this panel, nothing happens!!

Typo on Line 273 of extension.driver.php (HTML Block section of the code)

When selecting HTML Block, it says RSS Reader instead of HTML Block. This is easily fixed by updating the extension.driver.php where the typo is on line 273 (in the HTML Block section of the code)...

$fieldset->appendChild(new XMLElement('legend', __('RSS Reader')));

It should be...

$fieldset->appendChild(new XMLElement('legend', __('HTML Block')));

RSS Reader? Doesn't seem to be working

Hey Nick! First off, this is a wonderful extension.

I've upgraded my Symphony installation to 2.2 and then added this extension, version 1.3.1.

When, I'm on the Dashboard page, I click on Create New and click on RSS Reader nothing happens. Is this portion of the extension not available yet?

Also, when I click on the HTML Block, it says RSS Reader, but I think that is mislabeled... because it gives you the options Page URL and Cache which sounds like the HTML block.

Dashboard fails on first call after installation

I just installed dashboard (via git master).
My environment is:

Symphony 2.2.3

PHP 5.3.2-1ubuntu4.9 with Suhosin-Patch (cli) (built: May 3 2011 00:45:52)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH

Symphony runs as php-fastcgi behind nginx. Up to now without issues.
DB is 5.1.41

After successful installation/activation i selected Dashboard from the main menu and got following trace:

Invalid argument supplied for foreach()
/home/andi/xomo/symphony2-test/extensions/dashboard/extension.driver.php line 491

486             // tags request found
487             if($repo_tags) {
488                 $repo_tags = json_decode($repo_tags);
489                 $tags = array();
490
491                 foreach($repo_tags->tags as $tag => $ref) {
492                     // remove tags that contain strings
493                     if(preg_match('/[a-zA]/i', $tag)) continue;
494                     $tags[] = $tag;
495                 }

Backtrace:

[/home/andi/xomo/symphony2-test/extensions/dashboard/extension.driver.php:491] GenericErrorHandler::handler();
[/home/andi/xomo/symphony2-test/symphony/lib/toolkit/class.extensionmanager.php:559] Extension_Dashboard->render_panel();
[/home/andi/xomo/symphony2-test/extensions/dashboard/extension.driver.php:186] ExtensionManager->notifyMembers();
[/home/andi/xomo/symphony2-test/extensions/dashboard/content/content.index.php:82] Extension_Dashboard::buildPanelHTML();
[/home/andi/xomo/symphony2-test/symphony/lib/toolkit/class.administrationpage.php:440] contentExtensionDashboardIndex->__viewIndex();
[/home/andi/xomo/symphony2-test/symphony/lib/toolkit/class.administrationpage.php:397] AdministrationPage->__switchboard();
[/home/andi/xomo/symphony2-test/symphony/lib/toolkit/class.administrationpage.php:260] AdministrationPage->view();
[/home/andi/xomo/symphony2-test/symphony/lib/core/class.administration.php:230] AdministrationPage->build();
[/home/andi/xomo/symphony2-test/symphony/lib/core/class.administration.php:383] Administration->__buildPage();
[/home/andi/xomo/symphony2-test/index.php:25] Administration->display();

Database Query Log:

SET character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'; [0.0001]
SET CHARACTER SET 'utf8'; [0.0001]
SELECT SQL_CACHE `session_data` FROM `sym_sessions` WHERE `session` = '4u8v7t71ivk7uqk2b5hofl1ob1' LIMIT 1; [0.0003]
SELECT SQL_CACHE `name` FROM `sym_extensions` WHERE `status` = 'enabled'; [0.0001]
SELECT SQL_CACHE `id` FROM `sym_authors` WHERE `username` = 'andi' AND `password` = '46d31bfac7db6a0e608e9ab4dc0c486c8e779c66' LIMIT 1; [0.0003]
UPDATE sym_authors SET `last_seen` = '2011-09-01 20:14:40' WHERE `id` = '1'; [0.0002]
SELECT SQL_CACHE * FROM `sym_authors` WHERE `id` IN (1) ORDER BY id ASC; [0.0002]
SELECT SQL_CACHE * FROM `sym_extensions`; [0.0002]
SELECT SQL_CACHE * FROM `sym_sections` ORDER BY `sortorder` ASC; [0.0002]
SELECT SQL_CACHE t1.name, t2.page, t2.delegate, t2.callback FROM `sym_extensions` as t1 INNER JOIN `sym_extensions_delegates` as t2 ON t1.id = t2.extension_id WHERE t1.status = 'enabled'; [0.0002]
SELECT SQL_CACHE * FROM sym_dashboard_panels ORDER BY sort_order ASC; [0.0003]

I get an error after enabling an Overview Panel on 2.3, 1.6.0

Symphony Warning: Invalid argument supplied for foreach()

An error occurred in /Applications/MAMP/htdocs/new-site/extensions/dashboard/extension.driver.php around line 489

484 // tags request found
485 if($repo_tags) {
486 $repo_tags = json_decode($repo_tags);
487 $tags = array();
488
489 foreach($repo_tags->tags as $tag => $ref) {
490 // remove tags that contain strings
491 if(preg_match('/[a-zA]/i', $tag)) continue;
492 $tags[] = $tag;
493 }

Error when Github is offline

Hi Nick, today Github was offline, then I get an error on line 489 in extension.driver.php where $repo_tags arent null, because it have all 404 Gihtub html inside.

I've changed this line to if(is_array($repo_tags)) { and thats work fine. Check if this is a good solution please.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.