<?php
/*
// "Frontpage Slideshow" Component for Joomla! 1.5.x - Version 1.7.1
// Copyright (c) 2006 - 2008 JoomlaWorks, a Komrade LLC company.
// This code cannot be redistributed without permission from JoomlaWorks - http://www.joomlaworks.gr.
// More info at http://www.joomlaworks.gr and http://www.frontpageslideshow.net
// Developers: Fotis Evangelou - George Chouliaras
// ***Last update: February 27th, 2008***
*/

// no direct access
defined('_JEXEC') or die('Restricted access');

class FpslideshowHelperToolbars
{
	var $live_site = null;

	// ACTION TOOLBAR
	function title($title='Slides') {

		$html = '<div>'.$title.'</div>';

		echo $html;
		
	}

	function startToolbar()
	{

		$this->live_site =  JURI::base();   // with trashlash in the end

		$html = '<table><tr>';

		echo $html;
	}

	function endToolbar()
	{
		$html = '</tr></table>';

		echo $html;
	}

	function publishList($task='publish', $title='Publish', $icon='') {

		$html = '<td><input type="button" onclick="javascript:if(document.adminForm.boxchecked.value==0){alert(\'Please make a selection from the list to publish\');}else{  submitbutton(\''.$task.'\')}" value="'.$title.'" /></td>';

		echo $html;

	}
	
	function addItem($task='add', $title='Add', $icon='') {
		
		$html = '<td><input type="button" onclick="javascript: submitbutton(\''.$task.'\')" value="'.$title.'" /></td>';

		echo $html;
		
	}
	
	function deleteItem($task='delete', $title='Delete', $text='Are you sure about that action?', $icon='') {
		
		$html = '<td><input type="button" onclick="javascript:if(document.adminForm.boxchecked.value==0){alert(\'Please make a selection from the list to Delete\');}else{if(confirm(\''.$text.'\')){submitbutton(\''.$task.'\');}}" value="'.$title.'" /></td>';

		echo $html;
		
	}

	function saveItem($task='save', $title='Save', $icon='') {

		$html = '<td><input type="button" onclick="javascript:submitbutton(\''.$task.'\')" value="'.$title.'" /></td>';

		echo $html;

	}
	
	function cancelItem($task='cancel', $title='Cancel', $icon='') {

		$html = '<td><input type="button" onclick="javascript:submitbutton(\''.$task.'\')" value="'.$title.'" /></td>';

		echo $html;

	}

	
	// SUBMENUS
	function startSubMenu()
	{

		$this->live_site =  JURI::base();   // with trashlash in the end

		$html = '<table><tr>';

		echo $html;
	}

	function endSubMenu()
	{

		$html = '</tr></table>';

		echo $html;
	}

	function addSubmenu($title='Categories', $link='', $active=false) {

		$html = '<td>';
		if($active) $html .= '<a href=\''.$this->live_site.$link.'\'>'.$title.'</a>'; else $html .= $title;
		$html .= '</td>';

		echo $html;

	}
	
	
	
	// ORDERS
	function orderUpIcon($i, $condition = true, $task = 'orderup', $alt = 'Move Up', $enabled = true)
	{
		$alt = JText::_($alt);

		$html = '&nbsp;';
		if (($i > 0 || ($i + $this->limitstart > 0)) && $condition)
		{
			if($enabled) {
				$html	= '<a href="#reorder" onclick="return listItemTask(\'cb'.$i.'\',\''.$task.'\')" title="'.$alt.'">';
				$html	.= '   <img src="administrator/images/uparrow.png" width="16" height="16" border="0" alt="'.$alt.'" />';
				$html	.= '</a>';
			} else {
				$html	= '<img src="administrator/images/uparrow0.png" width="16" height="16" border="0" alt="'.$alt.'" />';
			}
		}

		return $html;
	}
	
	function orderDownIcon($i, $n, $condition = true, $task = 'orderdown', $alt = 'Move Down', $enabled = true)
	{
		$alt = JText::_($alt);

		$html = '&nbsp;';
		if (($i < $n -1 || $i + $this->limitstart < $this->total - 1) && $condition)
		{
			if($enabled) {
				$html	= '<a href="#reorder" onclick="return listItemTask(\'cb'.$i.'\',\''.$task.'\')" title="'.$alt.'">';
				$html	.= '  <img src="administrator/images/downarrow.png" width="16" height="16" border="0" alt="'.$alt.'" />';
				$html	.= '</a>';
			} else {
				$html	= '<img src="administrator/images/downarrow0.png" width="16" height="16" border="0" alt="'.$alt.'" />';
			}
		}

		return $html;
	}

}
