예제 #1
0
	protected function renderInput()
	{
		$input = '<input type="'.$this->_type.'" name="'.$this->_name.'" '. 'id="'.$this->getID().'"';
		if ($this->_value)
		{
			$this->_inputAttributes->value = $this->_value;
		}
		else
		{
			// It is possible that the same inputis rendered more than once
			// (eg for the ListInput), and the value is changed to null.
			unset($this->_inputAttributes->value);
		}
		$input .= $this->renderOptions();
		$input .= '/><br />';
		if ($this->_autocomplete)
		{
			$input .= '<script>';
			if ($this->_autocomplete)
			{
				$input .= 'CoOrgAutoSuggest($("#'.$this->getID().'"), "'.CoOrg::createURL($this->_autocomplete) .'")';
			}
			$input .= '</script>';
		}
		return $input;
	}
예제 #2
0
	public function run($widgetParams,
	                    $request, $year = null, $month = null, 
	                              $day = null, $id = null)
	{
		$feeds = false;
		$controller = substr($request, 0, strpos($request, '/'));
		$admin = false;
		if ($controller == 'admin')
		{
			$admin = true;
			$subrequest = substr($request, strpos($request, '/') + 1);
			$controller = substr($subrequest, 0, strpos($subrequest, '/'));
		}
		
		$globalFeed = new stdClass;
		$globalFeed->title = t('ATOM Blog feed');
		$globalFeed->type = 'application/atom+xml';
		$globalFeed->url = CoOrg::createURL('blog.atom/latest');
		
		if ($request == 'blog/show')
		{
			$feeds = array();
			
			$feeds[] = $globalFeed;
			
			$commentsFeed = new stdClass;
			$commentsFeed->title = t('Comments');
			$commentsFeed->type = 'application/atom+xml';
			$commentsFeed->url = CoOrg::createURL(array('blog.atom/show', $year, $month, $day, $id));
			
			$feeds[] = $commentsFeed;
		}
		else if ($admin && $controller = 'blog')
		{
			$feeds = array();
			
			$feeds[] = $globalFeed;
			$commentsFeed = new stdClass;
			$commentsFeed->title = t('Unmoderated comments');
			$commentsFeed->type = 'application/atom+xml';
			$commentsFeed->url = CoOrg::createURL('blog.atom/comment/unmoderated');
			$feeds[] = $commentsFeed;
		}
		else if ($controller == 'blog' || $request == 'home/index')
		{
			$feeds = array();
			
			$feeds[] = $globalFeed;
		}
		
		if ($feeds)
		{
			$this->feeds = $feeds;
			return $this->render('widgets/feeds-links');
		}
	}
예제 #3
0
파일: menu.php 프로젝트: nathansamson/CoOrg
	public static function url($action, $language, $data)
	{
		if ($action == 'show')
		{
			return CoOrg::createURL(array('page', 'show', $data), $language);
		}
		else
		{
			return CoOrg::createURL(array('page', $action), $language);
		}
	}
예제 #4
0
function smarty_helper_pager_generateLink($params, $page)
{
	foreach ($params as &$p)
	{
		if ($p == '.*.')
		{
			$p = $page;
		}
	}
	return CoOrg::createURL(array_values($params));
}
예제 #5
0
function smarty_block_a($params, $contents, $smarty)
{
	if ($contents !== NULL)
	{
		$stock = @$params['coorgStock'];
		unset($params['coorgStock']);
		$title = @$params['coorgTitle'];
		unset($params['coorgTitle']);
		$l = @$params['coorgLanguage'];
		unset($params['coorgLanguage']);
		$anchor = array_key_exists('coorgAnchor', $params) ? $params['coorgAnchor'] : null;
		unset($params['coorgAnchor']);
		$request = $params['request'];
		if ($request[0] != '#')
		{
			$urlParams = array($request);
			unset($params['request']);
			$urlParams = array_merge($urlParams, array_values($params));
			$url = CoOrg::createURL($urlParams, $l ? $l : null, $anchor);
		}
		else
		{
			$url = $request;
		}
		
		$a = '<a href="'.htmlspecialchars($url).'"'.
		         ($title ? ' title="'.$title.'"' : '').'>';
		if ($stock)
		{
			$stockInfo = CoOrg::stocks($stock);
			$a .= '<img src="'.CoOrg::staticFile($stockInfo['img']).'"
			            alt="'.$stockInfo['alt'].'"
			            title="'.$stockInfo['title'].'"/>';
			if ($stockInfo['text'])
			{
				$a .= $stockInfo['text'];
			}
			else if ($contents)
			{
				$a .= $contents;
			}
		}
		else
		{
			$a .= $contents;
		}
		$a .= '</a>';
		return $a;
	}
}
예제 #6
0
function smarty_block_button($params, $contents, $smarty)
{
	if ($contents !== NULL)
	{
		$confirm = @$params['coorgConfirm'];
		unset($params['coorgConfirm']);
		
		if ($confirm)
		{
			$confirm = htmlspecialchars($confirm);
			$confirm = str_replace('\'', '\\\'', $confirm);
		}
		
		$form = '<form action="'.CoOrg::createURL(explode('/', $params['request'])).
		              '" method="post" class="normal-post-url"'.
		              ($confirm ? '  onsubmit="return confirm(\''.$confirm.'\');"' : '').
		              '>';
		
		foreach ($params as $key => $value)
		{
			if (strpos($key, 'param_') === 0)
			{
				$name = substr($key, 6);
				$form .= '<input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'"/>';
			}
		}
		
		$stock = @$params['coorgStock'];
		unset($params['coorgStock']);
		if ($stock)
		{
			$stockInfo = CoOrg::stocks($stock);
			$contents = '<img src="'.CoOrg::staticFile($stockInfo['img']).'"
			            alt="'.$stockInfo['alt'].'"
			            title="'.$stockInfo['title'].'"/>';
			if ($stockInfo['text'])
			{
				$contents = $stockInfo['text'];
			}
		}
		
		$form .= '<button type="submit">'.$contents.'</button>';
		$form .= '</form>';
		return $form;
	}
}
예제 #7
0
파일: menu.php 프로젝트: nathansamson/CoOrg
	public static function url($action, $language, $data)
	{
		if ($action == 'show')
		{
			$dataArray = explode('/', $data, 2);
			$dateArray = explode('-', $dataArray[0]);
			return CoOrg::createURL(array('blog', 'show', $dateArray[0],
			                               $dateArray[1], $dateArray[2],
			                               $dataArray[1]), $language);
		}
		else if ($action == 'latest')
		{
			return CoOrg::createURL(array('blog'), $language);
		}
		else
		{
			return CoOrg::createURL(array('blog', $action), $language);
		}
	}
예제 #8
0
	public function createURL($request)
	{
		$params = func_get_args();
		return CoOrg::createURL($params);
	}
예제 #9
0
	public static function redirect($to)
	{
		$args = func_get_args();
		self::$redirect = CoOrg::createURL($args);
	}
예제 #10
0
	public function __construct()
	{
		$this->name = t('Manage menus');
		$this->url = CoOrg::createURL(array('admin', 'menu'));
		$this->priority = 1;
	}
예제 #11
0
function smarty_function_url($params, $smarty)
{
	return htmlspecialchars(CoOrg::createURL(array_values($params)));
}
예제 #12
0
파일: menu.php 프로젝트: nathansamson/CoOrg
	public static function url($action, $data, $language)
	{
		return CoOrg::createURL(array(), $language);
	}
예제 #13
0
	public function __construct()
	{
		$this->name = t('Manage users');
		$this->url = CoOrg::createURL('admin/user');
		$this->priority = 1;
	}
예제 #14
0
	public function __construct()
	{
		$this->name = t('Mollom');
		$this->priority = 3;
		$this->url = CoOrg::createURL('admin/mollom');
	}
예제 #15
0
	public function __construct()
	{
		$this->url = CoOrg::createURL('admin/system');
		$this->priority = 1;
		$this->name = t('General Configuration');
	}
예제 #16
0
	public function testCreateURLWithoutPrefixToRoot()
	{
		CoOrg::config()->set('urlPrefix', '');
		CoOrg::config()->set('path', '/');
		$this->assertEquals('/', CoOrg::createURL(array('')));
	}
예제 #17
0
	public function render()
	{
		$noscript = '<noscript>';
		$i = 1;
		$input = $this->_textInput;
		foreach ($this->_value as $listValue)
		{
			$input->setName($this->_name . $i . '[]');
			$input->setValue($listValue);
			$noscript .= $input->render();
			$i++;
		}
		
		$input->setValue(null);
		for ($j = 1; $j < $this->_initialInputs; $j++) // Start from one, the javascript version adds one to
		{	
			$input->setName($this->_name . $i . '[]');
			$noscript .= $input->render();
			$i++;
		}
		$noscript .= '</noscript>';
		
		$input->setName($this->_name . '[]');
		$script = $input->render();
		
		$script .= '<script>';
		$script .= '$(window).ready(function() {
					CoOrgList("'.$input->getID().'", "'.$this->_name.'", 
					               Array("'.implode('","', $this->_value).'"),
					               ' . ($this->_autocomplete ? 'false' : 'true') . ', 
					               "'. $this->_listClass .'");
					});';
		if ($this->_autocomplete)
		{
			$script .= 'CoOrgAutoSuggest($("#'.$this->getID().'"), "'.CoOrg::createURL($this->_autocomplete) .'", true)';
		}
		$script .= '</script>';
		
		return $noscript.$script;
	}
예제 #18
0
	public static function redirect($to)
	{
		$args = func_get_args();
		$full = CoOrg::createURL($args);
		header('Location: '.$full);
	}
예제 #19
0
	public function __construct()
	{
		$this->name = t('blog|Moderate comments');
		$this->url = CoOrg::createURL(array('admin/blog/comment'));
		$this->priority = 3;
	}
예제 #20
0
	function url()
	{
		return CoOrg::createURL('admin');
	}
예제 #21
0
	public function __construct()
	{
		$this->name = t('Create page');
		$this->url = CoOrg::createURL('admin/page/create');
		$this->priority = 2;
	}