Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Missing "Please first make a selection..." (front) 19 Aug 2013 11:19 #10817

Missing the alert "Please first make a selection from the list" in the frontend list view on any TOOLBAR BUTTON TASK.

fix on file ROOT\administrator\components\com_component\dom\html.php:

find: /* hack */
	protected function jsCommand()
	{
		//When a static link is set : No JS execution
		if (!empty($this->route))
			return;
		
		$cmd = '';
		$version = new JVersion;
		
		if ($this->jVersion('2.5'))
			$jinput = JFactory::getApplication()->input;		
		else		
			$jinput = new JInput;
		
		$task = $this->getTaskExec();

		$checkList = false;
		//Grid task
		if (is_numeric($this->num))
		{
			$cmd = "listItemTask('cb" . (int)$this->num . "', '" . $this->getTaskExec(true) . "')";
		
			//Embed in a test to check if an item is checked
			if (isset($this->list) && $this->list)
				$checkList = true;
		}
		
		//Toolbar task button
		else if (!empty($task))
		{
			$taskCtrl = $this->getTaskExec(true);
			
			$cmd = "Joomla.";
			
			//Check if opened in modal
			if ($jinput->get('tmpl') == 'component')
				$cmd .= "submitformAjax";
			else
				$cmd .= "submitform";
			
				
			$cmd = "return " . $cmd . "('" . $taskCtrl . "');";
			
			/* hack */
			$excludedTasks = array('cancel', 'add', 'save', 'save2new', 'save2copy', 'apply');
			if(!in_array($task, $excludedTasks)){
				$checkList = true;
			}
			/* hack */
			
			//Because there is no other place for it...
			switch($task)
			{
				case 'delete':
					$this->alertConfirm = JText::_('JDOM_ALERT_ASK_BEFORE_REMOVE');
					break;
	
				case 'trash':
					$this->alertConfirm = JText::_('JDOM_ALERT_ASK_BEFORE_TRASH');
					break;
			}
			
		}
		
		if (empty($cmd))
			return;
		
		//Embed in a confirmation alert box
		if (isset($this->alertConfirm) && $this->alertConfirm)
		{
			$cmd = "if (window.confirm('" . addslashes($this->JText($this->alertConfirm)) . "')){"
					. 		$cmd
					. 	"}";
		}
		
		//Embed in a test to check if an item is checked
		if ($checkList)
		{
			$msgList = JText::sprintf('JLIB_HTML_PLEASE_MAKE_A_SELECTION_FROM_THE_LIST', $task);
			
			$cmd = 	"if (document.adminForm.boxchecked.value==0){"
				.		"alert('" . addslashes($msgList)  ."');"
				.	"}else{"
				. 		$cmd
				. 	"}";
		}
		
		$this->link_js = $cmd;
	}
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by Tomaselli.

Missing "Please first make a selection..." (front) 19 Aug 2013 13:17 #10819

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Fixed.

K++

Well, I need to explain the changes :
The JDom:: toolbar receives now the list of items when it is related to a list.

It is important to make the difference because for instance, publish task can be both in list or in item.
So, then the only one excluded task for checking in the list is 'add'

Changed files :
- tmpl files (lists)
- dom/html.php
- dom/html/toolbar.php
- dom/link/button/toolbar.php
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.094 seconds

Just wanted to congratulate you on the J-Cook website / web development tool. In a couple of visits I've had a play around with Cook and have to say I think it is fantastic.  I've played with a number of component builders in the past and yours is certainly looking like the best so far. I'd also like to help you spread the word - I'm really surprised more people aren't excited about this tool. Good luck with the project.
Dean

Get Started