NEW Making widgets dependency optional

This commit is contained in:
Ingo Schommer 2013-04-11 12:35:22 +02:00
parent 966d168119
commit ee532292d2
6 changed files with 265 additions and 268 deletions

View File

@ -14,7 +14,7 @@ The blog module allows you to post blogs on your SilverStripe. It includes the a
## Requirements
* Silverstripe 3.0
* silverstripe-widgets module
* (Optional) silverstripe-widgets module
## Feature Overview
@ -76,10 +76,6 @@ or: mysite/blog/2007 would show blog entries for 2007
See [:pagecomment](/pagecomment) for creating Askimet-protected comments for every page.
## Widgets
See [widgets](/widgets)
## Working with the theme

View File

@ -1,11 +1,12 @@
<?php
/**
if(class_exists('Widget')) {
/**
* Shows a widget with viewing blog entries
* by months or years.
*
* @package blog
*/
class ArchiveWidget extends Widget {
class ArchiveWidget extends Widget {
static $db = array(
'DisplayMode' => 'Varchar'
);
@ -106,6 +107,6 @@ class ArchiveWidget extends Widget {
return $results;
}
}
}
?>
}

View File

@ -1,9 +1,11 @@
<?php
/**
if(class_exists('Widget')) {
/**
* Blog Management Widget
* @package blog
*/
class BlogManagementWidget extends Widget implements PermissionProvider {
class BlogManagementWidget extends Widget {
static $db = array();
static $has_one = array();
@ -45,13 +47,9 @@ class BlogManagementWidget extends Widget implements PermissionProvider {
}
}
function providePermissions() {
return array("BLOGMANAGEMENT" => "Blog management");
}
}
class BlogManagementWidget_Controller extends Widget_Controller {
class BlogManagementWidget_Controller extends Widget_Controller {
function WidgetHolder() {
if(Permission::check("BLOGMANAGEMENT")) {
@ -63,5 +61,6 @@ class BlogManagementWidget_Controller extends Widget_Controller {
$container = BlogTree::current();
return ($container && $container->ClassName != "BlogTree") ? $container->Link('post') : false;
}
}
}
?>

View File

@ -1,6 +1,6 @@
<?php
class RSSWidget extends Widget {
if(class_exists('Widget')) {
class RSSWidget extends Widget {
static $db = array(
"RSSTitle" => "Text",
"RssUrl" => "Text",
@ -91,6 +91,6 @@ class RSSWidget extends Widget {
return $output;
}
}
}
}
?>
}

View File

@ -1,13 +1,13 @@
<?php
/**
if(class_exists('Widget')) {
/**
* A simple widget that just shows a link
* to this website's blog RSS, with an RSS
* icon.
*
* @package blog
*/
class SubscribeRSSWidget extends Widget {
class SubscribeRSSWidget extends Widget {
static $title = 'Subscribe via RSS';
@ -26,6 +26,6 @@ class SubscribeRSSWidget extends Widget {
$container = BlogTree::current();
if ($container) return $container->Link('rss');
}
}
}
?>
}

View File

@ -14,9 +14,10 @@
}
],
"require":
{
"silverstripe/cms": "3.0.*",
"require": {
"silverstripe/cms": "3.0.*"
},
"suggests": {
"silverstripe/widgets": "0.1.*"
}
}