news ext was just a subset of blocks ext
This commit is contained in:
parent
02dff7fc12
commit
d3967e5938
@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* Name: News
|
|
||||||
* Author: Shish <webmaster@shishnet.org>
|
|
||||||
* Link: http://code.shishnet.org/shimmie2/
|
|
||||||
* License: GPLv2
|
|
||||||
* Description: Show a short amount of text in a block on the post list
|
|
||||||
* Documentation:
|
|
||||||
* Any HTML is allowed
|
|
||||||
*/
|
|
||||||
|
|
||||||
class News extends Extension {
|
|
||||||
public function onPostListBuilding(PostListBuildingEvent $event) {
|
|
||||||
global $config, $page;
|
|
||||||
if(strlen($config->get_string("news_text")) > 0) {
|
|
||||||
$this->theme->display_news($page, $config->get_string("news_text"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onSetupBuilding(SetupBuildingEvent $event) {
|
|
||||||
$sb = new SetupBlock("News");
|
|
||||||
$sb->add_longtext_option("news_text");
|
|
||||||
$event->panel->add_block($sb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,25 +0,0 @@
|
|||||||
<?php
|
|
||||||
class NewsTest extends SCoreWebTestCase {
|
|
||||||
function testNews() {
|
|
||||||
$this->log_in_as_admin();
|
|
||||||
|
|
||||||
$this->get_page("setup");
|
|
||||||
$this->set_field("_config_news_text", "kittens");
|
|
||||||
$this->click("Save Settings");
|
|
||||||
|
|
||||||
$this->get_page("post/list");
|
|
||||||
$this->assert_text("Note");
|
|
||||||
$this->assert_text("kittens");
|
|
||||||
|
|
||||||
$this->get_page("setup");
|
|
||||||
$this->set_field("_config_news_text", "");
|
|
||||||
$this->click("Save Settings");
|
|
||||||
|
|
||||||
$this->get_page("post/list");
|
|
||||||
$this->assert_no_text("Note");
|
|
||||||
$this->assert_no_text("kittens");
|
|
||||||
|
|
||||||
$this->log_out();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
class NewsTheme extends Themelet {
|
|
||||||
/*
|
|
||||||
* Show $text on the $page
|
|
||||||
*/
|
|
||||||
public function display_news(Page $page, $text) {
|
|
||||||
$page->add_block(new Block("Note", $text, "left", 5));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
|
Loading…
x
Reference in New Issue
Block a user