JCC : Some kind of bug in addToolbar function after the category issue and in -_assets table

Hello again sir,

Thank you a lot for your super fast response by fixing the issue with the "missing" category permissions. I appreciate a lot your efforts so I m trying to contribute as I can from my side, by testing your component creator. This time I found that after the fixed category permissions issue, now another small problem raised when someone is trying to create a new item which has a "category field" in its' database table. In this case the toolbar in admin back end won't appear and only the "cancel" button is there.

The problem- if it is a problem and has not to do with the fact that i m choosing wrong table names - seems to be related with the addToolbar function inside admin/components/com_name/views/viewname/view.html.php (e.g administrator/components/com_videos/views/video/view.html.php ) file and has to do with the parameters passed to the $canDo variable ( e.g $canDo = VideosHelper::getActions($this->item->category, 'video'); )
Until now I 've worked around it changing a bit the code from :

  1. <?php    
  2. /** 
  3.      * Add the page title and toolbar. 
  4.      * 
  5.      * @since   1.6 
  6.      */ 
  7.     protected function addToolbar(){ 
  8.         JFactory::getApplication()->input->set('hidemainmenu'true); 
  9.  
  10.         $user        JFactory::getUser(); 
  11.         $userId        $user->get('id'); 
  12.         $isNew        = ($this->item->id == 0); 
  13.         $checkedOut    = !($this->item->checked_out == || $this->item->checked_out == $userId); 
  14.         // Since we don't track these assets at the item level, use the category id. 
  15.              $canDo        VideosHelper::getActions($this->item->category'video'); 
  16.         JToolbarHelper::title($isNew JText::_('COM_VIDEOS_MANAGER_VIDEO_NEW') : JText::_('COM_VIDEOS_MANAGER_VIDEO_EDIT'), 'Video.png'); 


    to :

    1. <?php    
    2. /** 
    3.      * Add the page title and toolbar. 
    4.      * 
    5.      * @since   1.6 
    6.      */ 
    7.     protected function addToolbar(){ 
    8.         JFactory::getApplication()->input->set('hidemainmenu'true); 
    9.  
    10.         $user        JFactory::getUser(); 
    11.         $userId        $user->get('id'); 
    12.         $isNew        = ($this->item->id == 0); 
    13.         $checkedOut    = !($this->item->checked_out == || $this->item->checked_out == $userId); 
    14.         // Since we don't track these assets at the item level, use the category id. 
    15.         if ($isNew) { $canDo        VideosHelper::getActions($this->item->category'0'); 
    16.         } else { 
    17.              $canDo        VideosHelper::getActions($this->item->category'video');  
    18.             } 
    19.  
    20.         JToolbarHelper::title($isNew JText::_('COM_VIDEOS_MANAGER_VIDEO_NEW') : JText::_('COM_VIDEOS_MANAGER_VIDEO_EDIT'), 'Video.png'); 


      but now I do worry about the 0 value -zero- that I m passing as the second parameter for the $sublevel variable in the getActions function of the helper file , placed inside/administrator/components/com_videos/helpers/component_name_helper_file.php , whenever I create a new record.

      1. <?php  public static function getActions($categoryId 0$sublevel='')  {   ...}     



        Another small issue that I ve noticed is that every record created for an item which belongs to a category and has an asset_id column in its table, gets a "level" value in the #_assets table lower than 3 (in my case their value is set to 1 even if they belong to a category with a higher "level" value )
        So, in my #_assets table it is possible to have categories with a level value lower than 2 and items with a level value lower than 3 ...

        For the time I am fixing the values manually but I d appreciate if you could provide me with some guidance..which part of the code should I try to fix in my local copy, maybe inside the helper or the tables php fiel..I dont know...

        Thanks in advance !
        ADDTOLLBAR FUNCTION ISSUES __ASSET TABLE LEVEL VALUES

        Submitted by Keclimparis sakis On Wednesday, 29 July 2015.
        Category: Joomla Component Creator

        [RESOLVED]

        0
        1 Answers.
         
        Super User
        laser

        Re:JCC : Some kind of bug in addToolbar function after the category issue and in -_assets table

        addToolbar bug and asset level issue fixed,

        our team working for record specific permissions/rules, as u will see "rules" field will be empty in assets table for record,
        if you want to show rules editor in form do the followings

        add tab in form
        <ul class="nav nav-tabs"> 
        .... 
        ..... 
        <li><a href="#permissions" data-toggle ="tab"><?php echo JText::_( 'Permissions' ); ?></a></li> 
        ..... 
        </ul>


        add field
        <div class="tab-pane" id="permissions"> 
        	<?php echo $this->form->getInput('rules'); ?> 
        </div>



        above code will start filling "rules" field in asset table, but these fields permissions will not effect the records edit/delete/edit-state permissions, JCC team working on it, may be you will get update on this in coming months
        Submitted by Super User On Thursday, 30 July 2015
        1
        This Answer has been Chosen as Best Answer
        Question is marked as resolved.