Joomla! Discussion Forums



It is currently Mon Nov 23, 2009 11:34 pm (All times are UTC )

 




Post new topic Reply to topic  [ 7 posts ] 
Author Message
Posted: Sun Nov 08, 2009 1:43 am 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Dec 09, 2005 6:18 pm
Posts: 126
Location: England
Hi,

I am trying to create an editor button with lots of features and firstly i am not sure if what i want to do is possible.

I have created the button and it inserts the syntax for my plugin OK and i can use JSelectArticle to get the article id, but is there a JSelect for Banners, Banner Clients and Banner Categories or could these be easily done in JS or added to the existing element??

What i would like is:

You press the button and get a light-box screen (Have this now for JSelectArticle), you then choose from a dropdown on the function and if you choose banner id then a JSelectBanner is called (Or a button appears next to the dropdown to open this) and you can pick the banner. I then want other dropdown lists below for maybe 4 things followed by a text box you can enter text in to and then another 2 JSelect's for Banner Client and Category.

Then when OK or Save or something is pressed it adds the syntax and all the values to the content.


So:
1) Are there other JSelect functions in Joomla??
2) Can the above be achived with an Editor Button only??

Thanks

Dan

_________________
My Extensions - http://www.dysolutions.co.uk/joomla


Top
  E-mail  
 
Posted: Sun Nov 08, 2009 12:32 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7647
Location: Europe
Hi,

jselectarticle is a JavaScript function, which just gets the id of the article from the modal window, so it should work with other Tables in a similar fashion.

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Thu Nov 12, 2009 8:36 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Dec 09, 2005 6:18 pm
Posts: 126
Location: England
Hi Olaf,

Where can i find the code for it so i can see about adding other lookups such as the banners??

Dan

_________________
My Extensions - http://www.dysolutions.co.uk/joomla


Top
  E-mail  
 
Posted: Fri Nov 13, 2009 5:55 pm 
User avatar
Joomla! Exemplar
Joomla! Exemplar
Offline

Joined: Thu Jul 17, 2008 3:10 pm
Posts: 7647
Location: Europe
Did you manage to get the "light-box screen" working for the banners?

Olaf

_________________
Olaf Offick
Learn Skills - a world of learning at your fingertips
http://learn-skills.org


Top
   
 
Posted: Fri Nov 13, 2009 6:29 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Dec 09, 2005 6:18 pm
Posts: 126
Location: England
HI,

No the light-box or modal works for JSelectArticle but i need to creat JSelectBanners, JSelectBannerClients, e.t.c.

Night of ice hockey tonight so i will have a look around the JS.

Dan.

_________________
My Extensions - http://www.dysolutions.co.uk/joomla


Top
  E-mail  
 
Posted: Sat Nov 14, 2009 9:31 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Dec 09, 2005 6:18 pm
Posts: 126
Location: England
Hi,

I have done most of it now using a component part (I would like to have this in the plugin folder but not sure on how to call it then, currently called with index.php?option=com_dybanners&task=select&tmpl=component&e_name='.$name).

The last part left in completing it before i look at then using directly in a plugin is getting information from textboxes back, the drop downs are all working OK but how can i solve the textbox part:


Extract from my controller
Code:
    function selectbannerfield( $name = 'default' )
    {
   $db = &JFactory::getDBO();


      $query = "SELECT name AS text, bid AS value FROM #__banner ORDER BY bid, name";
      $db->setQuery($query);


   $options[] = JHTML::_('select.option','title','+ '.JText::_('TITLE').' +');
   $options[] = JHTML::_('select.option','random','+ '.JText::_('RANDOM').' +');

   $options = array_merge( $options, $db->loadObjectList() );

      array_unshift($options, JHTML::_('select.option', 'banner_id/title/random', '- '.JText::_('Select Banner Field').' -', 'value', 'text'));

      return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value, $name );
     
    }

    function selectbannerwindow( $name = 'default' )
    {

   $options = array();
   $options[] = JHTML::_('select.option','0',''.JText::_('Parent Window').'');
   $options[] = JHTML::_('select.option','1',''.JText::_('New Window With Browser Navigation').'');
   $options[] = JHTML::_('select.option','2',''.JText::_('Popup Window Without Browser Navigation').'');

      array_unshift($options, JHTML::_('select.option', 'window_type', '- '.JText::_('Select Banner Window').' -', 'value', 'text'));

      return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value, $name );
     
    }



    function selectbannersuffix( $name = 'default' )
    {

      return JHTML::_('select.genericlist', $options, $name, 'class="inputbox"', 'value', 'text', $value, $name );
     
    }


Extract from my view:
Code:
      $eName   = JRequest::getVar('e_name');
      $eName   = preg_replace( '#[^A-Z0-9\-\_\[\]]#i', '', $eName );
      $list1 = & $this->selectbannerfield( 'bannerfield');
      $list2 = & $this->selectbannerwindow( 'bannerwindow');

      $list5 = & $this->selectbannerclient( 'bannerclient');
          $list6 = & $this->selectbannercategory( 'bannercategory'); ?>
      <script type="text/javascript">
         function insertdybanners()
         {
            // Get the pagebreak title
            var bannerfield = document.getElementById("bannerfield").value;
            var bannerwindow = document.getElementById("bannerwindow").value;
            
//            var bannersuffix = document.getElementById("bannersuffix").value;
//            var bannerimagealt = document.getElementById("bannerimagealt").value;
            
            var bannerclient = document.getElementById("bannerclient").value;
            var bannercategory = document.getElementById("bannercategory").value;
            

            var tag1 = '{dybanners}';
            var tag2 = bannerfield;
            var tag3 = ',';
            var tag4 = bannerwindow;
//            var tag5 = ',';
//            var tag6 = bannersuffix;
//            var tag7 = ',';
//            var tag8 = bannerimagealt;
            var tag9 = ',';
            var tag10 = bannerclient;
            var tag11 = ',';
            var tag12 = bannercategory;
            var tag13 = '{/dybanners}';

            window.parent.jInsertEditorText(tag13, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag12, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag11, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag10, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag9, '<?php echo $eName; ?>');
//            window.parent.jInsertEditorText(tag8, '<?php echo $eName; ?>');
//            window.parent.jInsertEditorText(tag7, '<?php echo $eName; ?>');
//            window.parent.jInsertEditorText(tag6, '<?php echo $eName; ?>');
//            window.parent.jInsertEditorText(tag5, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag4, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag3, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag2, '<?php echo $eName; ?>');
            window.parent.jInsertEditorText(tag1, '<?php echo $eName; ?>');





            window.parent.document.getElementById('sbox-window').close();
            return false;




The textboxes are for suffix and alt (Only suffix is added in the controller above until i get that working).


Thanks

Dan

_________________
My Extensions - http://www.dysolutions.co.uk/joomla


Top
  E-mail  
 
Posted: Sun Nov 15, 2009 5:56 pm 
User avatar
Joomla! Enthusiast
Joomla! Enthusiast
Offline

Joined: Fri Dec 09, 2005 6:18 pm
Posts: 126
Location: England
Hi,

Got it all sorted in the end, i had to make a component so i could use controllers and views and call them using the ?option=com_dybanners&task=selectbanner and then use this component to install both the content plugin and the editor button and enable them so it works from the single component install straight away.

If this can be done in a plugin alone then please let me know.

Attached was the popup i wanted from the editor button (And now have).

Thanks

Dan
Attachment:
dybanners_editor_button.jpg


You do not have the required permissions to view the files attached to this post.

_________________
My Extensions - http://www.dysolutions.co.uk/joomla


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

Quick reply

 



Who is online

Users browsing this forum: becyn, defiant, ksorbo, SoujiroZ and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group