"Datetime", "Author" => "Text", "Tags" => "Text" ); static $casting = array( "Date" => "Date" ); static $defaults = array( "ProvideComments" => true ); static $allowed_children = "none"; /** * overload so that the default date is today. */ public function populateDefaults(){ parent::populateDefaults(); $this->Date = date("d/m/Y H:i:s",time()); } /** * Ensures the most recent article edited on the same day is shown first. */ public function setDate($val){ $datepart = date("Y-m-d",strtotime($val)); $minutepart = date("H:i:s",time()); $date = $datepart . " " . $minutepart; return $this->setField("Date",$date); } function getCMSFields() { Requirements::javascript('blog/javascript/bbcodehelp.js'); Requirements::css('blog/css/bbcodehelp.css'); $firstName = Member::CurrentMember() ? Member::currentMember()->FirstName : ''; $codeparser = new BBCodeParser(); $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); $fields->addFieldToTab("Root.Content.Main", new TextareaField("Content", "Content", 20)); $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", "Date"),"Content"); $fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $firstName),"Content"); $fields->addFieldToTab("Root.Content.Main", new LiteralField("BBCodeHelper", "
" . "BBCode help" . "
")); $fields->addFieldToTab("Root.Content.Main", new TextField("Tags", "Tags (comma sep.)"),"Content"); return $fields; } function Tags() { $theseTags = split(" *, *", trim($this->Tags)); $output = new DataObjectSet(); foreach($theseTags as $tag) { $output->push(new ArrayData(array( "Tag" => $tag, "Link" => $this->getParent()->Link() . '?tag=' . urlencode($tag) ))); } if($this->Tags){ return $output; } } function SideBar() { return $this->getParent()->SideBar(); } function ParagraphSummary(){ $content = new Text('Content'); $content->value = Convert::raw2xml($this->Content); $parser = new BBCodeParser($content->FirstParagraph()); return $parser->parse(); } function ParsedContent() { $parser = new BBCodeParser($this->Content); $content = new Text('Content'); $content->value =$parser->parse(); return $content; } function EditURL(){ return $this->getParent()->Link('post')."/".$this->ID."/"; } } class BlogEntry_Controller extends Page_Controller { function init() { parent::init(); Requirements::themedCSS("blog"); } function unpublishPost(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, "Unpublishing blogs is an administrator task. Please log in."); } else{ $SQL_id = Convert::raw2sql($this->ID); $page = DataObject::get_by_id("SiteTree", $SQL_id); $page->deleteFromStage('Live'); $page->flushCache(); $page = DataObject::get_by_id("SiteTree", $SQL_id); $page->Status = "Unpublished"; Director::redirect($this->getParent()->Link()); } } } ?> "WidgetArea" ); static $allowed_children = array( 'BlogEntry' ); function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); $fields->addFieldToTab("Root.Content.Widgets", new WidgetAreaEditor("SideBar")); return $fields; } public function BlogEntries($limit = 10) { $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; $tagCheck = ''; $dateCheck = ""; if(isset($_GET['tag'])) { $tag = addslashes($_GET['tag']); $tag = str_replace(array("\\",'_','%',"'"), array("\\\\","\\_","\\%","\\'"), $tag); $tagCheck = "AND `BlogEntry`.Tags LIKE '%$tag%'"; } if(Director::urlParams()){ $year = Director::urlParam('Action'); $month = Director::urlParam('ID'); if(is_numeric($month) && is_numeric($month)){ $dateCheck = "AND Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; } else if(isset($year)){ $dateCheck = "AND Date BETWEEN '$year-1-1' AND '$year-12-31'"; } } return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $tagCheck $dateCheck","`BlogEntry`.Date DESC",'',"$start, $limit"); } function Tag() { return isset($_GET['tag']) ? $_GET['tag'] : false; } function BlogEntryForm(){ Requirements::javascript('jsparty/behaviour.js'); Requirements::javascript('jsparty/prototype.js'); Requirements::javascript('jsparty/scriptaculous/effects.js'); Requirements::javascript('cms/javascript/PageCommentInterface.js'); Requirements::javascript('blog/javascript/bbcodehelp.js'); $id = 0; if(Director::urlParam('ID')){ $id = Director::urlParam('ID'); } $codeparser = new BBCodeParser(); $membername = Member::currentMember() ? Member::currentMember()->getName() : ""; $fields = new FieldSet( new HiddenField("ParentID", "ParentID", $this->ID), new HiddenField("ID","ID"), new HiddenField("Date","Date"), new TextField("Title","Subject"), new TextField("Author","Author",$membername), new CompositeField( new LiteralField("BBCodeHelper","BBCode help
" ), new TextareaField("Content", "Content",20), new LiteralField("BBCodeTags","") ), new TextField("Tags","Tags"), new LiteralField("Tagsnote"," ") ); $submitAction = new FormAction('postblog', 'Post blog entry'); $actions = new FieldSet($submitAction); $validator = new RequiredFields('Title','Content'); $form = new BlogEntry_Form($this, 'BlogEntryForm',$fields, $actions,$validator); if($id != 0){ $form->loadNonBlankDataFrom(DataObject::get_by_id('BlogEntry',$id)); }else{ $form->loadNonBlankDataFrom(array("Author" => Cookie::get("BlogHolder_Name"))); } return $form; } function isPost(){ return Director::urlParam('Action') == 'post'; } function postURL(){ return $this->Link('post'); } function requireDefaultRecords() { parent::requireDefaultRecords(); if(!DataObject::get_one('BlogHolder')) { $blogholder = new BlogHolder(); $blogholder->Title = "Blog"; $blogholder->URLSegment = "blog"; $blogholder->Status = "Published"; $widgetarea = new WidgetArea(); $widgetarea->write(); $blogholder->SideBarID = $widgetarea->ID; $blogholder->write(); $blogholder->publish("Stage", "Live"); $managementwidget = new BlogManagementWidget(); $managementwidget->ParentID = $widgetarea->ID; $managementwidget->write(); $tagcloudwidget = new TagCloudWidget(); $tagcloudwidget->ParentID = $widgetarea->ID; $tagcloudwidget->write(); $archivewidget = new ArchiveWidget(); $archivewidget->ParentID = $widgetarea->ID; $archivewidget->write(); $widgetarea->write(); $blog = new BlogEntry(); $blog->Title = "SilverStripe blog module successfully installed"; $blog->URLSegment = 'sample-blog-entry'; $blog->setDate(date("Y-m-d H:i:s",time())); $blog->Tags = "silverstripe, blog"; $blog->Content = "Congratulations, the SilverStripe blog module has been successfully installed. This blog entry can be safely deleted. You can configure aspects of your blog (such as the widgets displayed in the sidebar) in [url=admin]the CMS[/url]."; $blog->Status = "Published"; $blog->ParentID = $blogholder->ID; $blog->write(); $blog->publish("Stage", "Live"); Database::alteration_message("Blog page created","created"); } } } class BlogHolder_Controller extends Page_Controller { function init() { parent::init(); // This will create a tag point to the RSS feed RSSFeed::linkToFeed($this->Link() . "rss", "RSS feed of this blog"); Requirements::themedCSS("blog"); Requirements::themedCSS("bbcodehelp"); } function showarchive() { $month = addslashes($this->urlParams['ID']); return array( "Children" => DataObject::get('SiteTree', "ParentID = $this->ID AND DATE_FORMAT(`BlogEntry`.`Date`, '%Y-%M') = '$month'"), ); } function ArchiveMonths() { $months = DB::query("SELECT DISTINCT DATE_FORMAT(`BlogEntry`.`Date`, '%M') AS `Month`, DATE_FORMAT(`BlogEntry`.`Date`, '%Y') AS `Year` FROM `BlogEntry` ORDER BY `BlogEntry`.`Date` DESC"); $output = new DataObjectSet(); foreach($months as $month) { $month['Link'] = $this->Link() . "showarchive/$month[Year]-$month[Month]"; $output->push(new ArrayData($month)); } return $output; } function rss() { global $project; $rss = new RSSFeed($this->Children(), $this->Link(), $project . " blog", "", "Title", "ParsedContent"); $rss->outputToBrowser(); } function BBTags() { return BBCodeParser::usable_tags(); } function post(){ if(!Permission::check('ADMIN')){ Security::permissionFailure($this, "Posting blogs is an administrator task. Please log in."); } return array(); } } class BlogEntry_Form extends Form { function postblog($data) { Cookie::set("BlogHolder_Name", $data['Author']); $blogentry = new BlogEntry(); $this->saveInto($blogentry); if($data['ID'] != 0){ //new post $blogentry = DataObject::get_by_id("BlogEntry",$data['ID']); $this->saveInto($blogentry); $blogentry->setDate($data['Date']); }else{ $blogentry->setDate(date("Y-m-d H:i:s",time())); $blogentry->URLSegment = $data['Title']; } $blogentry->Status = "Published"; $blogentry->writeToStage("Stage"); $blogentry->publish("Stage", "Live"); Director::redirect(Director::currentURLSegment()); } } ?>removeFieldFromTab("Root.Content.Main","Content"); return $fields; } public function News($limit = 10) { $start = isset($_GET['start']) ? (int)$_GET['start'] : 0; $dateCheck = ""; if(Director::urlParams()){ $year = Director::urlParam('Action'); $month = Director::urlParam('ID'); if(is_numeric($month) && is_numeric($month)){ $dateCheck = "AND Date BETWEEN '$year-$month-1' AND '$year-$month-31'"; } else if(isset($year)){ $dateCheck = "AND Date BETWEEN '$year-1-1' AND '$year-12-31'"; } } return DataObject::get("Page","`ParentID` = $this->ID AND ShowInMenus = 1 $dateCheck","`NewsPage`.Date DESC",'',"$start, $limit"); } } class NewsHolder_Controller extends Page_Controller { } ?> 'Date', "Author" => "Text" ); static $casting = array( "Date" => "Date" ); static $has_one = array( ); /** * overload so that the default date is today. */ public function populateDefaults(){ parent::populateDefaults(); $this->Date = date("d/m/Y H:i:s",time()); } /** * Ensures the most recent article edited on the same day is shown first. */ public function setDate($val){ $datepart = date("Y-m-d",strtotime($val)); $minutepart = date("H:i:s",time()); $date = $datepart . " " . $minutepart; return $this->setField("Date",$date); } function getCMSFields() { $fields = parent::getCMSFields(); $fields->removeFieldFromTab("Root.Content.Main","Content"); $fields->addFieldToTab("Root.Content.Main", new HTMLEditorField("Content", "Content", 20)); $fields->addFieldToTab("Root.Content.Main", new CalendarDateField("Date", "Date"),"Content"); $fields->addFieldToTab('Root.Content.Main', new TextField('Author'), 'Content'); return $fields; } function ParagraphSummary(){ $content = new Text('Content'); $content->value = Convert::html2raw($this->Content); return $content->FirstParagraph(); } } class NewsPage_Controller extends GeneralPage_Controller { } ?> doc-photo_buster_cs | Digicrafts Flash Components for Carousel Menu, Cover Flow Gallery, Slideshow, FLV Player, Banner Rotator

Reference for PhotoBuster CS

Method

Description

captureToClient() Capture the target to a bitmap and send to client script which specify in the serverToClient. The bitmap will send to the script in format of string which is base64 encoded. The variable is named "fileContent". In addition, it will send a variable with name "fileType" which specify the type of the bitmap and it will send a variable with name "fileName" which defined in PhotoBuster.imageFilename.
captureToServer() Capture the target to a bitmap and send to client script which specify in the serverToServer. The bitmap will send to the script in format of string which is base64 encoded. The variable is named "fileContent". In addition, it will send a variable with name "fileType" which specify the type of the bitmap and it will send a variable with name "fileName" which defined in PhotoBuster.imageFilename.
startMove() Start the object moving mode.
stopMove() Stop the object moving mode.
startCrop() Start the croping mode.
stopCrop() Stop the croping mode.
startDraw() Start the drawing mode.
stopDraw()() Stop the drawing mode.
startDrawText() Adding text to the target.
stopDrawText() Stop the adding text mode.
clear() Clear all object on the canvas.

 

PhotoBuster.gotoItem()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.captureToClient()

Returns None

Description Method; Capture the target to a bitmap and send to client script which specify in the serverToClient.

Code Example :

photobuster_mc.scriptToClient = "saveToFile.php";   
photobuster_mc.imageType = "jpg";
photobuster_mc.captureToClient();

 

PhotoBuster.captureToServer()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.captureToServer()

Returns None

Description Method; Capture the target to a bitmap and send to client script which specify in the serverToServer.

Code Example :

photobuster_mc.scriptToServer = "sendToEmail.php";   
photobuster_mc.imageType = "jpg";
photobuster_mc.scriptParameter = "email=abc@xyz.com";
photobuster_mc.captureToServer();

 

PhotoBuster.startMove()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.startMove()

Returns None

Description Method; Start the object moving mode.

Code Example :

photobuster_mc.startMove();

 

PhotoBuster.stopMove()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.stopMove()

Returns None

Description Method; Add an item into the menu with specified index.

Code Example :

photobuster_mc.stopMove();

 

PhotoBuster.startCrop()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.startCrop()

Returns None

Description Method; Start the croping mode.

Code Example :

photobuster_mc.startCrop();

 

PhotoBuster.stopCrop()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.stopCrop()

Returns None

Description Method; Stop the croping mode.

Code Example :

  photobuster_mc.stopCrop();

 

PhotoBuster.startDraw()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.startDraw()

Returns None

Description Method; Start the drawing mode.

Code Example :

photobuster_mc.startDraw();

 

PhotoBuster.stopDraw()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.stopDraw()

Returns None

Description Method; Stop the drawing mode.

Code Example :

photobuster_mc.stopDraw();

 

PhotoBuster.startDrawText()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.startDrawText()

Returns None

Description Method; Adding text to the target.

Code Example :

photobuster_mc.startDrawText();

 

PhotoBuster.stopDrawText()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.stopDrawText()

Returns None

Description Method; Stop the adding text mode.

Code Example :

photobuster_mc.stopDrawText();

 

PhotoBuster.clear()

Availability Flash Player 9.

Edition Flash CS3.

Usage PhotoBuster.clear()

Returns None

Description Method; Clear all object on the canvas.

Code Example :

  photobuster_mc.clear();

Event

Description

complete

Broadcast when complete loading the external server script.


Code Example :

function eventHandle(event:Event):void {
switch(event.type) {
//Complete Event
case Event.COMPLETE:
//do something when complete loading the script
var loader:URLLoader = URLLoader(event.target);
trace("completeHandler: " + loader.data);
break;
} }
photobuster_mc.addEventListener(Event.COMPLETE,eventHandle);

Property

Type

Description

Default Value

Possible Value

target String The target for capturing. Must be instance name of movieclip. Any instance name of movieclip.
trigger Object Specify the button for trigger the action for save,move,crop,draw and text.

Object with format:
{save:"",move:"", crop:"",draw:"",text:""}

scriptToClient String The script speicfy for output the captured bitmap to client side. Relative path or absolute path to the script. e.g. saveToFile.php
scriptToServer String The script speicfy for output the captured bitmap to server side. Relative path or absolute path to the script. e.g. sendToEmail.php
scriptParameter String Addition parameter send to the script specify in scriptToClient or scriptToServer. The format should be look like var1=value,var2=value2... Any string format with:
var1=value, var2=value2...
sendToServer Boolean Enable/disable to use scriptToServer script.
true
true/false
toolbarVisible Boolean Enable/disable the visibility of internal toolbar.
true
true/false
toolbarShadow Boolean Enable/disable the shadow effect of internal toolbar.
true
true/false
toolbarDragDrop Boolean Enable/disable the ability for dragging of internal toolbar.
true
true/false
penColor uint Default color of the drawing tool.
0x000000
_blank, _self, _parent, or other name
penWidth Number Default pen width of the drawing tool.
2
top / middle / bottom
waterMark String The class name specify for use as a watermark. When filled in with a class name, the ouput bitmap will apply with the watermark. Any string
waterMarkPosition String Set the water mark position.
Top Left
Top Left,Top Right, Bottom Left, Bottom Right,Center
imageFilename String The default image filename send to the script.
imagename
Any string
imageType String The type of the image output to the script.
true
jpg/png
jpgQuality Number The quality of the output image ( for jpg only).
80
1-100
 
Item Parameter Name Description
1 target The target for capturing. Must be instance name of movieclip.
2 toolbarDragDrop Enable/disable the ability for dragging of internal toolbar.
3 toolbarShadow Enable/disable the shadow effect of internal toolbar.
4 toolbarVisible Enable/disable the visibility of internal toolbar.
5 penColor Default color of the drawing tool.
6 penWidth Default pen width of the drawing tool.
7 waterMark The class name specify for use as a watermark. When filled in with a class name, the ouput bitmap will apply with the watermark.
8 waterMarkPosition Set the water mark position.
     
 
Item Parameter Name Description
1 scriptToClient The script speicfy for output the captured bitmap to client side.
2 sendToServer Enable/disable to use scriptToServer script.
3 scriptToServer The script speicfy for output the captured bitmap to server side.
4 scriptParameter Addition parameter send to the script specify in scriptToClient or scriptToServer. The format should be look like var1=value,var2=value2...
     
 
Item Parameter Name Description
1 imageType The type of the image output to the script.
2 jpgQuality The quality of the output image ( for jpg only).
3 imageFilename The default image filename send to the script.
     
 
Item Parameter Name Description
1 trigger Specify the button for trigger the action for save,move,crop,draw and text.
2
3
4
5