diff options
Diffstat (limited to 'demos/quickstart/protected/controls')
| -rw-r--r-- | demos/quickstart/protected/controls/Comments/CommentBlock.php | 212 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/Comments/comments.js | 412 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/DocLink.php | 60 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/Layout.php | 94 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/RequiresVersion.php | 30 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/RunBar.php | 44 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/SampleLayout.php | 24 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/SearchBox.php | 80 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/SinceVersion.php | 30 | ||||
| -rw-r--r-- | demos/quickstart/protected/controls/TopicList.php | 14 | 
10 files changed, 500 insertions, 500 deletions
diff --git a/demos/quickstart/protected/controls/Comments/CommentBlock.php b/demos/quickstart/protected/controls/Comments/CommentBlock.php index 9c008491..ebb82a0f 100644 --- a/demos/quickstart/protected/controls/Comments/CommentBlock.php +++ b/demos/quickstart/protected/controls/Comments/CommentBlock.php @@ -1,107 +1,107 @@ -<?php
 -
 -Prado::using('System.Data.*');
 -Prado::using('System.Web.UI.ActiveControls.*');
 -Prado::using('System.Data.ActiveRecord.TActiveRecordManager');
 -
 -$db = new TDbConnection('mysql:host=localhost;dbname=xxxx', 'yyyy', 'zzzz');
 -$manager = TActiveRecordManager::getInstance();
 -$manager->setDbConnection($db);
 -
 -class CommentRecord extends TActiveRecord
 -{
 -	const TABLE='qs_comments';
 -
 -	public $id;
 -	public $username;
 -	public $date_added;
 -	public $page;
 -	public $block_id;
 -	public $content;
 -
 -	public static function finder($className=__CLASS__)
 -	{
 -		return parent::finder($className);
 -	}
 -}
 -
 -class CommentBlock extends TTemplateControl
 -{
 -	private $_page;
 -
 -	function onLoad($param)
 -	{
 -		if(!$this->Page->IsCallBack)
 -		{
 -			$count = array();
 -			$data = $this->getCommentData();
 -			foreach($data as $r)
 -			{
 -				if(!isset($count[$r->block_id]))
 -					$count[$r->block_id]=0;
 -				$count[$r->block_id]++;
 -			}
 -			$js = "var comment_count = ".TJavascript::encode($count).";\n";
 -			$this->Page->ClientScript->registerBeginScript('count',$js);
 -			$this->comments->dataSource = $data;
 -			$this->comments->dataBind();
 -		}
 -	}
 -
 -	function getCommentData()
 -	{
 -		return CommentRecord::finder()->findAllByPage($this->getCurrentPagePath());
 -	}
 -
 -	function add_comment($sender, $param)
 -	{
 -		if(!$this->Page->IsValid)
 -			return;
 -		$record = new CommentRecord;
 -		$record->username = $this->username->Text;
 -		$record->date_added = date('Y-m-d h:i:s');
 -		$record->page = $this->getCurrentPagePath();
 -		$record->block_id = $this->block_id->Value;
 -		$record->content = $this->content->Text;
 -		$record->save();
 -
 -		$this->content->Text = '';
 -		$this->password->Text = '';
 -		$cc = $this->Page->CallbackClient;
 -		$cc->appendContent('comment-list', $this->format_message($record));
 -		$cc->callClientFunction('hide_add_comment');
 -		$cc->callClientFunction('increment_count_tag', $record->block_id);
 -		if(!$this->Page->IsCallBack)
 -		{
 -			$this->comments->dataSource = $this->getCommentData();
 -			$this->comments->dataBind();
 -		}
 -	}
 -
 -	protected function getCurrentPagePath()
 -	{
 -		if(is_null($this->_page))
 -		{
 -			$page = str_replace($this->Service->BasePath, '', $this->Page->Template->TemplateFile);
 -			$this->_page = str_replace('\\', '/', $page);
 -		}
 -		return $this->_page;
 -	}
 -
 -	function validate_credential($sender, $param)
 -	{
 -		$param->IsValid = $this->password->Text == 'Prado';
 -	}
 -
 -	protected function format_message($record)
 -	{
 -		$username=htmlspecialchars($record->username);
 -		$content=nl2br(htmlspecialchars($record->content));
 -		return <<<EOD
 -	<div class="comment c-{$record->block_id}">
 -		<span><strong>{$username}</strong> on {$record->date_added}.</span>
 -		<div>{$content}</div>
 -	</div>
 -EOD;
 -	}
 +<?php + +Prado::using('System.Data.*'); +Prado::using('System.Web.UI.ActiveControls.*'); +Prado::using('System.Data.ActiveRecord.TActiveRecordManager'); + +$db = new TDbConnection('mysql:host=localhost;dbname=xxxx', 'yyyy', 'zzzz'); +$manager = TActiveRecordManager::getInstance(); +$manager->setDbConnection($db); + +class CommentRecord extends TActiveRecord +{ +	const TABLE='qs_comments'; + +	public $id; +	public $username; +	public $date_added; +	public $page; +	public $block_id; +	public $content; + +	public static function finder($className=__CLASS__) +	{ +		return parent::finder($className); +	} +} + +class CommentBlock extends TTemplateControl +{ +	private $_page; + +	function onLoad($param) +	{ +		if(!$this->Page->IsCallBack) +		{ +			$count = array(); +			$data = $this->getCommentData(); +			foreach($data as $r) +			{ +				if(!isset($count[$r->block_id])) +					$count[$r->block_id]=0; +				$count[$r->block_id]++; +			} +			$js = "var comment_count = ".TJavascript::encode($count).";\n"; +			$this->Page->ClientScript->registerBeginScript('count',$js); +			$this->comments->dataSource = $data; +			$this->comments->dataBind(); +		} +	} + +	function getCommentData() +	{ +		return CommentRecord::finder()->findAllByPage($this->getCurrentPagePath()); +	} + +	function add_comment($sender, $param) +	{ +		if(!$this->Page->IsValid) +			return; +		$record = new CommentRecord; +		$record->username = $this->username->Text; +		$record->date_added = date('Y-m-d h:i:s'); +		$record->page = $this->getCurrentPagePath(); +		$record->block_id = $this->block_id->Value; +		$record->content = $this->content->Text; +		$record->save(); + +		$this->content->Text = ''; +		$this->password->Text = ''; +		$cc = $this->Page->CallbackClient; +		$cc->appendContent('comment-list', $this->format_message($record)); +		$cc->callClientFunction('hide_add_comment'); +		$cc->callClientFunction('increment_count_tag', $record->block_id); +		if(!$this->Page->IsCallBack) +		{ +			$this->comments->dataSource = $this->getCommentData(); +			$this->comments->dataBind(); +		} +	} + +	protected function getCurrentPagePath() +	{ +		if(is_null($this->_page)) +		{ +			$page = str_replace($this->Service->BasePath, '', $this->Page->Template->TemplateFile); +			$this->_page = str_replace('\\', '/', $page); +		} +		return $this->_page; +	} + +	function validate_credential($sender, $param) +	{ +		$param->IsValid = $this->password->Text == 'Prado'; +	} + +	protected function format_message($record) +	{ +		$username=htmlspecialchars($record->username); +		$content=nl2br(htmlspecialchars($record->content)); +		return <<<EOD +	<div class="comment c-{$record->block_id}"> +		<span><strong>{$username}</strong> on {$record->date_added}.</span> +		<div>{$content}</div> +	</div> +EOD; +	}  }
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/Comments/comments.js b/demos/quickstart/protected/controls/Comments/comments.js index ca3f54fb..44464689 100644 --- a/demos/quickstart/protected/controls/Comments/comments.js +++ b/demos/quickstart/protected/controls/Comments/comments.js @@ -1,207 +1,207 @@ -var currentCommentID;
 -
 -function show_comment_list()
 -{
 -	$('comment-list').show();
 -	$('add-comment').hide();
 -	$('show-comment-link').addClassName("active");
 -	$('add-comment-link').removeClassName("active");
 -	$('all-comments-link').removeClassName("active");
 -	show_comments_in_list(currentCommentID);
 -}
 -
 -function show_all_comments()
 -{
 -	$('comment-list').show();
 -	$('add-comment').hide();
 -	$('show-comment-link').removeClassName("active");
 -	$('add-comment-link').removeClassName("active");
 -	$('all-comments-link').addClassName("active");
 -	show_comments_in_list();
 -}
 -
 -
 -function show_add_comment()
 -{
 -	$('comment-list').hide();
 -	$('add-comment').show();
 -	$('show-comment-link').removeClassName("active");
 -	$('add-comment-link').addClassName("active");
 -	$('all-comments-link').removeClassName("active");
 -}
 -
 -function hide_add_comment()
 -{
 -	$('user-comments').hide();
 -	$('modal-background').hide();
 -	$(content_textare_id).value = '';
 -	$(currentCommentID).style.zIndex = 0;
 -}
 -
 -function show_comments_in_list(id)
 -{
 -	var list = $('comment-list');
 -	var count=0;
 -	for(var i=0, k=list.childNodes.length; i < k; i++)
 -	{
 -		var node = list.childNodes[i];
 -		if(node.nodeType == 1) //an element node
 -		{
 -			if(typeof(id) == "undefined" || node.className.indexOf(id) >= 0)
 -			{
 -				node.style.display="block"
 -				count++;
 -			}
 -			else
 -				node.style.display="none";
 -		}
 -	}
 -	return count;
 -}
 -
 -function show_comments(block)
 -{
 -	var id = block.id
 -	currentCommentID = id;
 -	$(hidden_block_id).value = id;
 -	var commentBlock = $('user-comments');
 -	var pos = Position.cumulativeOffset(block);
 -	var top = pos[1] + block.offsetHeight;
 -	commentBlock.style.top = top+"px";
 -	commentBlock.style.width = (block.offsetWidth-22)+"px";
 -
 -	commentBlock.show();
 -
 -	var count = show_comments_in_list(id);
 -
 -	$('comment-list').show();
 -	if(count > 0)
 -		show_comment_list();
 -	else
 -		show_add_comment();
 -
 -	var background = $('modal-background');
 -	background.style.top="0px";
 -	background.style.left="0px";
 -	background.style.opacity="0.5";
 -	background.style.width = document.body.offsetWidth+"px";
 -	background.style.height = document.body.offsetHeight+"px";
 -	background.show();
 -	block.style.zIndex = 100;
 -	block.style.paddingRight="9px";
 -	block.style.marginRight="-9px";
 -
 -}
 -
 -function show_block(block)
 -{
 -	while(block && (!block.className || block.className.indexOf("block-content") < 0))
 -		block = block.parentNode;
 -	if(block && block.className.indexOf("block-content") >= 0)
 -	{
 -		block.addClassName('block-hover');
 -		var tag = $('tag-'+block.id);
 -//		if(tag.className.indexOf("tag-shown")<=0)
 -			tag.firstChild.style.visibility="visible"
 -	}
 -}
 -
 -function hide_block(block)
 -{
 -	while(block && (!block.className || block.className.indexOf("block-content") < 0))
 -		block = block.parentNode;
 -	if(block && block.className.indexOf("block-hover") >= 0)
 -	{
 -		block.removeClassName('block-hover');
 -		var tag = $('tag-'+block.id);
 -		if(tag.className.indexOf("tag-shown")<=0)
 -			tag.firstChild.style.visibility="hidden"
 -	}
 -}
 -
 -function add_comment_tag(el)
 -{
 -	var dim = Element.getDimensions(el);
 -	var comments = get_comment_count(el.id);
 -	var style = "height:"+(dim.height > 35 ? dim.height : 35)+"px;";
 -	var cssClass = dim.height ? "block-comment-tag" : "block-comment-tag-ie";
 -	var title = "View "+comments+" comments"
 -	var innerStyle="";
 -	if(comments <= 0)
 -	{
 -		innerStyle = " visibility:hidden;";
 -		comments = "add";
 -		title = "Add new comment";
 -	}
 -	else
 -		cssClass += " tag-shown";
 -	var id = "tag-"+el.id;
 -	var tag = "<div id='"+id+"' class='"+cssClass+"' style='"+style+"'><div style='"+innerStyle+"' title='"+title+"'>"+comments+"</div> </div>";
 -	new Insertion.Before(el, tag);
 -	var tag_div = $(id);
 -	Event.observe(tag_div, "mouseover", function(e){ if(typeof(show_block)!="undefined") show_block(el); });
 -	Event.observe(tag_div, "mouseout", function(e){ if(typeof(hide_block) !="undefined") hide_block(el); });
 -	Event.observe(tag_div, "click", function(e) { if(typeof(show_comments) !="undefined") show_comments(el); Event.stop(e); });
 -}
 -
 -function increment_count_tag(id)
 -{
 -	var tag = $('tag-'+id);
 -	if(tag && tag.firstChild)
 -	{
 -		if(tag.className.indexOf("tag-shown") >= 0)
 -		{
 -			var count = Number(tag.firstChild.innerHTML);
 -			tag.firstChild.innerHTML = (++count)+"";
 -			tag.firstChild.style.visibility="visible";
 -		}
 -		else
 -		{
 -			tag.firstChild.innerHTML = "1";
 -			tag.addClassName("tag-shown");
 -			tag.firstChild.style.visibility="visible";
 -		}
 -	}
 -}
 -
 -function get_comment_count(id)
 -{
 -	return comment_count[id] ? comment_count[id] : 0;
 -}
 -
 -//initialize the comment js
 -
 -if(!Prado.Browser.ie) //not IE 4,5,6
 -{
 -	(function()
 -	{
 -		var userComments = $('user-comments');
 -		userComments.style.position="absolute";
 -		userComments.style.marginRight="80px";
 -		var commentList = $('comment-list');
 -		commentList.style.height="320px";
 -		$('add-comment').style.height="320px";
 -		commentList.style.overflow="auto";
 -		$('show-comment-link').style.display="";
 -		$('to-top').hide();
 -		$('close-comments').show();
 -		$('all-comments-link').show();
 -		userComments.hide();
 -		$('comments-header').hide();
 -
 -		$$('#comment-list .source-link').each(function(el){ el.hide(); });
 -
 -		$$('#content .block-content').each(function(el)
 -		{
 -			Event.observe(el, 'mouseover', function(e){ if(typeof(show_block)!="undefined") show_block(Event.element(e)); });
 -			Event.observe(el, 'mouseout', function(e){ if(typeof(hide_block)!="undefined") hide_block(Event.element(e)); });
 -			add_comment_tag(el);
 -		});
 -
 -		Event.observe($('show-comment-link'), "click", function(e) { show_comment_list(); Event.stop(e); });
 -		Event.observe($('add-comment-link'), "click", function(e) { show_add_comment();	Event.stop(e); });
 -		Event.observe($('all-comments-link'), "click", function(e) { show_all_comments();	Event.stop(e); });
 -		Event.observe($('close-comments'), "click", function(e) { hide_add_comment(); Event.stop(e); });
 -
 -	})();
 +var currentCommentID; + +function show_comment_list() +{ +	$('comment-list').show(); +	$('add-comment').hide(); +	$('show-comment-link').addClassName("active"); +	$('add-comment-link').removeClassName("active"); +	$('all-comments-link').removeClassName("active"); +	show_comments_in_list(currentCommentID); +} + +function show_all_comments() +{ +	$('comment-list').show(); +	$('add-comment').hide(); +	$('show-comment-link').removeClassName("active"); +	$('add-comment-link').removeClassName("active"); +	$('all-comments-link').addClassName("active"); +	show_comments_in_list(); +} + + +function show_add_comment() +{ +	$('comment-list').hide(); +	$('add-comment').show(); +	$('show-comment-link').removeClassName("active"); +	$('add-comment-link').addClassName("active"); +	$('all-comments-link').removeClassName("active"); +} + +function hide_add_comment() +{ +	$('user-comments').hide(); +	$('modal-background').hide(); +	$(content_textare_id).value = ''; +	$(currentCommentID).style.zIndex = 0; +} + +function show_comments_in_list(id) +{ +	var list = $('comment-list'); +	var count=0; +	for(var i=0, k=list.childNodes.length; i < k; i++) +	{ +		var node = list.childNodes[i]; +		if(node.nodeType == 1) //an element node +		{ +			if(typeof(id) == "undefined" || node.className.indexOf(id) >= 0) +			{ +				node.style.display="block" +				count++; +			} +			else +				node.style.display="none"; +		} +	} +	return count; +} + +function show_comments(block) +{ +	var id = block.id +	currentCommentID = id; +	$(hidden_block_id).value = id; +	var commentBlock = $('user-comments'); +	var pos = Position.cumulativeOffset(block); +	var top = pos[1] + block.offsetHeight; +	commentBlock.style.top = top+"px"; +	commentBlock.style.width = (block.offsetWidth-22)+"px"; + +	commentBlock.show(); + +	var count = show_comments_in_list(id); + +	$('comment-list').show(); +	if(count > 0) +		show_comment_list(); +	else +		show_add_comment(); + +	var background = $('modal-background'); +	background.style.top="0px"; +	background.style.left="0px"; +	background.style.opacity="0.5"; +	background.style.width = document.body.offsetWidth+"px"; +	background.style.height = document.body.offsetHeight+"px"; +	background.show(); +	block.style.zIndex = 100; +	block.style.paddingRight="9px"; +	block.style.marginRight="-9px"; + +} + +function show_block(block) +{ +	while(block && (!block.className || block.className.indexOf("block-content") < 0)) +		block = block.parentNode; +	if(block && block.className.indexOf("block-content") >= 0) +	{ +		block.addClassName('block-hover'); +		var tag = $('tag-'+block.id); +//		if(tag.className.indexOf("tag-shown")<=0) +			tag.firstChild.style.visibility="visible" +	} +} + +function hide_block(block) +{ +	while(block && (!block.className || block.className.indexOf("block-content") < 0)) +		block = block.parentNode; +	if(block && block.className.indexOf("block-hover") >= 0) +	{ +		block.removeClassName('block-hover'); +		var tag = $('tag-'+block.id); +		if(tag.className.indexOf("tag-shown")<=0) +			tag.firstChild.style.visibility="hidden" +	} +} + +function add_comment_tag(el) +{ +	var dim = Element.getDimensions(el); +	var comments = get_comment_count(el.id); +	var style = "height:"+(dim.height > 35 ? dim.height : 35)+"px;"; +	var cssClass = dim.height ? "block-comment-tag" : "block-comment-tag-ie"; +	var title = "View "+comments+" comments" +	var innerStyle=""; +	if(comments <= 0) +	{ +		innerStyle = " visibility:hidden;"; +		comments = "add"; +		title = "Add new comment"; +	} +	else +		cssClass += " tag-shown"; +	var id = "tag-"+el.id; +	var tag = "<div id='"+id+"' class='"+cssClass+"' style='"+style+"'><div style='"+innerStyle+"' title='"+title+"'>"+comments+"</div> </div>"; +	new Insertion.Before(el, tag); +	var tag_div = $(id); +	Event.observe(tag_div, "mouseover", function(e){ if(typeof(show_block)!="undefined") show_block(el); }); +	Event.observe(tag_div, "mouseout", function(e){ if(typeof(hide_block) !="undefined") hide_block(el); }); +	Event.observe(tag_div, "click", function(e) { if(typeof(show_comments) !="undefined") show_comments(el); Event.stop(e); }); +} + +function increment_count_tag(id) +{ +	var tag = $('tag-'+id); +	if(tag && tag.firstChild) +	{ +		if(tag.className.indexOf("tag-shown") >= 0) +		{ +			var count = Number(tag.firstChild.innerHTML); +			tag.firstChild.innerHTML = (++count)+""; +			tag.firstChild.style.visibility="visible"; +		} +		else +		{ +			tag.firstChild.innerHTML = "1"; +			tag.addClassName("tag-shown"); +			tag.firstChild.style.visibility="visible"; +		} +	} +} + +function get_comment_count(id) +{ +	return comment_count[id] ? comment_count[id] : 0; +} + +//initialize the comment js + +if(!Prado.Browser.ie) //not IE 4,5,6 +{ +	(function() +	{ +		var userComments = $('user-comments'); +		userComments.style.position="absolute"; +		userComments.style.marginRight="80px"; +		var commentList = $('comment-list'); +		commentList.style.height="320px"; +		$('add-comment').style.height="320px"; +		commentList.style.overflow="auto"; +		$('show-comment-link').style.display=""; +		$('to-top').hide(); +		$('close-comments').show(); +		$('all-comments-link').show(); +		userComments.hide(); +		$('comments-header').hide(); + +		$$('#comment-list .source-link').each(function(el){ el.hide(); }); + +		$$('#content .block-content').each(function(el) +		{ +			Event.observe(el, 'mouseover', function(e){ if(typeof(show_block)!="undefined") show_block(Event.element(e)); }); +			Event.observe(el, 'mouseout', function(e){ if(typeof(hide_block)!="undefined") hide_block(Event.element(e)); }); +			add_comment_tag(el); +		}); + +		Event.observe($('show-comment-link'), "click", function(e) { show_comment_list(); Event.stop(e); }); +		Event.observe($('add-comment-link'), "click", function(e) { show_add_comment();	Event.stop(e); }); +		Event.observe($('all-comments-link'), "click", function(e) { show_all_comments();	Event.stop(e); }); +		Event.observe($('close-comments'), "click", function(e) { hide_add_comment(); Event.stop(e); }); + +	})();  }
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/DocLink.php b/demos/quickstart/protected/controls/DocLink.php index e8ca7dfa..12b8e898 100644 --- a/demos/quickstart/protected/controls/DocLink.php +++ b/demos/quickstart/protected/controls/DocLink.php @@ -1,31 +1,31 @@ -<?php
 -
 -class DocLink extends THyperLink
 -{
 -	const BASE_URL='http://www.pradosoft.com/docs/manual';
 -
 -	public function getClassPath()
 -	{
 -		return $this->getViewState('ClassPath','');
 -	}
 -
 -	public function setClassPath($value)
 -	{
 -		$this->setViewState('ClassPath',$value,'');
 -	}
 -
 -	public function onPreRender($param)
 -	{
 -		parent::onPreRender($param);
 -		$paths=explode('.',$this->getClassPath());
 -		if(count($paths)>1)
 -		{
 -			$classFile=array_pop($paths).'.html';
 -			$this->setNavigateUrl(self::BASE_URL . '/' . implode('.',$paths) . '/' . $classFile);
 -			if($this->getText() === '')
 -				$this->setText('API Manual');
 -		}
 -	}
 -}
 -
 +<?php + +class DocLink extends THyperLink +{ +	const BASE_URL='http://www.pradosoft.com/docs/manual'; + +	public function getClassPath() +	{ +		return $this->getViewState('ClassPath',''); +	} + +	public function setClassPath($value) +	{ +		$this->setViewState('ClassPath',$value,''); +	} + +	public function onPreRender($param) +	{ +		parent::onPreRender($param); +		$paths=explode('.',$this->getClassPath()); +		if(count($paths)>1) +		{ +			$classFile=array_pop($paths).'.html'; +			$this->setNavigateUrl(self::BASE_URL . '/' . implode('.',$paths) . '/' . $classFile); +			if($this->getText() === '') +				$this->setText('API Manual'); +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/Layout.php b/demos/quickstart/protected/controls/Layout.php index 3973db8f..5106a72b 100644 --- a/demos/quickstart/protected/controls/Layout.php +++ b/demos/quickstart/protected/controls/Layout.php @@ -1,48 +1,48 @@ -<?php
 -
 -class Layout extends TTemplateControl
 -{
 -	public function __construct()
 -	{
 -		if(isset($this->Request['notheme']))
 -			$this->Service->RequestedPage->EnableTheming=false;
 -		parent::__construct();
 -	}
 -
 -	public function onLoad($param)
 -	{
 -		parent::onLoad($param);
 -		$url=$this->Request->RequestUri;
 -		if(strpos($url,'?')===false)
 -			$url.='?notheme=true';
 -		else
 -			$url.='&notheme=true';
 -		$this->PrinterLink->NavigateUrl=$url;
 -
 -		if(isset($this->Request['notheme']))
 -		{
 -			$this->MainMenu->Visible=false;
 -			$this->TopicPanel->Visible=false;
 -		}
 -
 -		$this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']);
 -		$this->languages->dataBind();
 -	}
 -
 -	public function languageLinkCreated($sender, $param)
 -	{
 -		$item = $param->Item;
 -		if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem)
 -		{
 -			$params = $this->Request->toArray();
 -			$params['lang'] = $sender->DataKeys[$item->ItemIndex];
 -			unset($params[$this->Request->ServiceID]);
 -			$url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params);
 -			$item->link->NavigateUrl = $url;
 -			if($this->Application->Globalization->Culture == $params['lang'])
 -				$item->link->CssClass="active";
 -		}
 -	}
 -}
 -
 +<?php + +class Layout extends TTemplateControl +{ +	public function __construct() +	{ +		if(isset($this->Request['notheme'])) +			$this->Service->RequestedPage->EnableTheming=false; +		parent::__construct(); +	} + +	public function onLoad($param) +	{ +		parent::onLoad($param); +		$url=$this->Request->RequestUri; +		if(strpos($url,'?')===false) +			$url.='?notheme=true'; +		else +			$url.='&notheme=true'; +		$this->PrinterLink->NavigateUrl=$url; + +		if(isset($this->Request['notheme'])) +		{ +			$this->MainMenu->Visible=false; +			$this->TopicPanel->Visible=false; +		} + +		$this->languages->DataSource = TPropertyValue::ensureArray($this->Application->Parameters['languages']); +		$this->languages->dataBind(); +	} + +	public function languageLinkCreated($sender, $param) +	{ +		$item = $param->Item; +		if($item->ItemType == TListItemType::Item || $item->ItemType == TListItemType::AlternatingItem) +		{ +			$params = $this->Request->toArray(); +			$params['lang'] = $sender->DataKeys[$item->ItemIndex]; +			unset($params[$this->Request->ServiceID]); +			$url = $this->Service->ConstructUrl($this->Service->RequestedPagePath, $params); +			$item->link->NavigateUrl = $url; +			if($this->Application->Globalization->Culture == $params['lang']) +				$item->link->CssClass="active"; +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/RequiresVersion.php b/demos/quickstart/protected/controls/RequiresVersion.php index 9e598d3a..c5dc37ec 100644 --- a/demos/quickstart/protected/controls/RequiresVersion.php +++ b/demos/quickstart/protected/controls/RequiresVersion.php @@ -1,16 +1,16 @@ -<?php
 -
 -class RequiresVersion extends TTemplateControl
 -{
 -	public function setVersion($value)
 -	{
 -		$this->setViewState('Version',$value);
 -	}
 -
 -	public function getVersion()
 -	{
 -		return $this->getViewState('Version');
 -	}
 -}
 -
 +<?php + +class RequiresVersion extends TTemplateControl +{ +	public function setVersion($value) +	{ +		$this->setViewState('Version',$value); +	} + +	public function getVersion() +	{ +		return $this->getViewState('Version'); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/RunBar.php b/demos/quickstart/protected/controls/RunBar.php index 8990c4c3..4db016be 100644 --- a/demos/quickstart/protected/controls/RunBar.php +++ b/demos/quickstart/protected/controls/RunBar.php @@ -1,23 +1,23 @@ -<?php
 -
 -class RunBar extends TTemplateControl
 -{
 -	public function getPagePath()
 -	{
 -		return $this->getViewState('PagePath','');
 -	}
 -
 -	public function setPagePath($value)
 -	{
 -		$this->setViewState('PagePath',$value,'');
 -	}
 -
 -	public function onPreRender($param)
 -	{
 -		$pagePath=$this->getPagePath();
 -		$this->RunButton->NavigateUrl="?page=$pagePath";
 -		$this->ViewSourceButton->NavigateUrl="?page=ViewSource&path=/".strtr($pagePath,'.','/').'.page';
 -	}
 -}
 -
 +<?php + +class RunBar extends TTemplateControl +{ +	public function getPagePath() +	{ +		return $this->getViewState('PagePath',''); +	} + +	public function setPagePath($value) +	{ +		$this->setViewState('PagePath',$value,''); +	} + +	public function onPreRender($param) +	{ +		$pagePath=$this->getPagePath(); +		$this->RunButton->NavigateUrl="?page=$pagePath"; +		$this->ViewSourceButton->NavigateUrl="?page=ViewSource&path=/".strtr($pagePath,'.','/').'.page'; +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/SampleLayout.php b/demos/quickstart/protected/controls/SampleLayout.php index a89b905d..a2d6f658 100644 --- a/demos/quickstart/protected/controls/SampleLayout.php +++ b/demos/quickstart/protected/controls/SampleLayout.php @@ -1,13 +1,13 @@ -<?php
 -
 -class SampleLayout extends TTemplateControl
 -{
 -	public function __construct()
 -	{
 -		if(isset($this->Request['notheme']))
 -			$this->Service->RequestedPage->EnableTheming=false;
 -		parent::__construct();
 -	}
 -}
 -
 +<?php + +class SampleLayout extends TTemplateControl +{ +	public function __construct() +	{ +		if(isset($this->Request['notheme'])) +			$this->Service->RequestedPage->EnableTheming=false; +		parent::__construct(); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/SearchBox.php b/demos/quickstart/protected/controls/SearchBox.php index 2e74ae31..e13d5e46 100644 --- a/demos/quickstart/protected/controls/SearchBox.php +++ b/demos/quickstart/protected/controls/SearchBox.php @@ -1,41 +1,41 @@ -<?php
 -
 -class SearchBox extends TTemplateControl
 -{
 -	public function getText()
 -	{
 -        $this->ensureChildControls();
 -        return $this->getRegisteredObject('search')->getText();
 -    }
 -
 -    public function getTextBox()
 -    {
 -        $this->ensureChildControls();
 -        return $this->getRegisteredObject('search');
 -    }
 -
 -	public function getButton()
 -	{
 -		$this->ensureChildControls();
 -        return $this->getRegisteredObject('find');
 -	}
 -
 -	public function onInit($param)
 -	{
 -		parent::onInit($param);
 -		if(strlen($q = $this->Page->Request['q']) > 0)
 -			$this->search->setText($q);
 -	}
 -
 -	public function doSearch($sender, $param)
 -	{
 -		if(strlen($query = $this->search->getText()) >0)
 -		{
 -			$ps = $this->getApplication()->getService();
 -			$page = $ps->constructUrl('Search', array('q' => $query), false);
 -			$this->getApplication()->getResponse()->redirect($page);
 -		}
 -	}
 -}
 -
 +<?php + +class SearchBox extends TTemplateControl +{ +	public function getText() +	{ +        $this->ensureChildControls(); +        return $this->getRegisteredObject('search')->getText(); +    } + +    public function getTextBox() +    { +        $this->ensureChildControls(); +        return $this->getRegisteredObject('search'); +    } + +	public function getButton() +	{ +		$this->ensureChildControls(); +        return $this->getRegisteredObject('find'); +	} + +	public function onInit($param) +	{ +		parent::onInit($param); +		if(strlen($q = $this->Page->Request['q']) > 0) +			$this->search->setText($q); +	} + +	public function doSearch($sender, $param) +	{ +		if(strlen($query = $this->search->getText()) >0) +		{ +			$ps = $this->getApplication()->getService(); +			$page = $ps->constructUrl('Search', array('q' => $query), false); +			$this->getApplication()->getResponse()->redirect($page); +		} +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/SinceVersion.php b/demos/quickstart/protected/controls/SinceVersion.php index cfeeffbb..db73275b 100644 --- a/demos/quickstart/protected/controls/SinceVersion.php +++ b/demos/quickstart/protected/controls/SinceVersion.php @@ -1,16 +1,16 @@ -<?php
 -
 -class SinceVersion extends TTemplateControl
 -{
 -	public function setVersion($value)
 -	{
 -		$this->setViewState('Version',$value);
 -	}
 -
 -	public function getVersion()
 -	{
 -		return $this->getViewState('Version');
 -	}
 -}
 -
 +<?php + +class SinceVersion extends TTemplateControl +{ +	public function setVersion($value) +	{ +		$this->setViewState('Version',$value); +	} + +	public function getVersion() +	{ +		return $this->getViewState('Version'); +	} +} +  ?>
\ No newline at end of file diff --git a/demos/quickstart/protected/controls/TopicList.php b/demos/quickstart/protected/controls/TopicList.php index ce827cc0..eb5976a9 100644 --- a/demos/quickstart/protected/controls/TopicList.php +++ b/demos/quickstart/protected/controls/TopicList.php @@ -1,8 +1,8 @@ -<?php
 -
 -class TopicList extends TTemplateControl
 -{
 -
 -}
 -
 +<?php + +class TopicList extends TTemplateControl +{ + +} +  ?>
\ No newline at end of file  | 
