Viewing 15 posts - 1 through 15 (of 25 total)
  • Author
    Posts
  • suelasrotas Friend
    #1015324

    Hi there,

    I am trying to use your extension to show their own private documents to each user. Your filter will make it really easy for them to find their documents but…

    The component menu item shows nothing. My template is based on Gantry but I have tried using Beez with the same results.

    Any ideas?

    The Captain Moderator
    #1015463

    Hi Suelasrotas,

    I can’t access your administrator site to see the issue closely, please check again.

    Regards

    suelasrotas Friend
    #1015742
    This reply has been marked as private.
    The Captain Moderator
    #1015822

    I have checked your issue, You may be miss the json file on the : [YOUR_SITE]/media/jamegafilter/. You can send the FTP info in private message for me. I need check some code on your site.

    suelasrotas Friend
    #1016016
    This reply has been marked as private.
    The Captain Moderator
    #1016232

    Hi, In the file plugins/jamegafilter/docman/tmpl/default.php: I added the code:

    /*
    ExtendJS 0.2.3
    More info at http://extendjs.org
    
    Copyright (c) 2013+ ChrisBenjaminsen.com
    
    Distributed under the terms of the MIT license.
    http://extendjs.org/licence.txt
    
    This notice shall be included in all copies or substantial portions of the Software.
    */
    !function(a){"use strict";function b(a){a.parent instanceof Function&&(b.apply(this,[a.parent]),this.super=c(this,d(this,this.constructor))),a.apply(this,arguments)}function c(a,b){for(var c in a)"super"!==c&&a[c]instanceof Function&&!(a[c].prototype instanceof Class)&&(b[c]=a[c].super||d(a,a[c]));return b}function d(a,b){var c=a.super;return b.super=function(){return a.super=c,b.apply(a,arguments)}}a.Class=function(){},a.Class.extend=function e(a){function d(){b!==arguments[0]&&(b.apply(this,[a]),c(this,this),this.initializer instanceof Function&&this.initializer.apply(this),this.constructor.apply(this,arguments))}return d.prototype=new this(b),d.prototype.constructor=d,d.toString=function(){return a.toString()},d.extend=function(b){return b.parent=a,e.apply(d,arguments)},d},a.Class=a.Class.extend(function(){this.constructor=function(){}})}(this);

    after the code:

    The menu items show the docman files for filter, now. Regards.

    suelasrotas Friend
    #1016292

    Hi there!

    Thanks for your fix. Unfortunately, my web page seems to be really slow due to the filter.

    Another problem is that it shows every document in Docman, although it is extremely important for me to show just the documents they own.

    Any ideas?

    Kind regards

    The Captain Moderator
    #1016952

    Hi,
    To resolve your problems. I edited the code on some files.

    1. in the path: plugins/jamegafilter/docman/tmpl/default.php. I added the code :
      $userID = JFactory::getUser()->id;

      after the code:

      $json = @file_get_contents(JPATH_SITE.$this->config->json);

      and Replace the snippet of code :

      function afterGetData(item) {
      //  console.log(item.id)
          item.url = sefUrl[item.id].replace(new RegExp(/(&)/, 'g'),'&');
          item.url_download = dUrl[item.id].replace(new RegExp(/(&)/, 'g'),'&');
      }
      }

      By the code:

      function afterGetData(item) {
      //  console.log(item.id)
      if (item.created_by == '<?php echo $userID ?>') {
          item.available = true;
          item.url = sefUrl[item.id].replace(new RegExp(/(&amp;)/, 'g'),'&');
          item.url_download = dUrl[item.id].replace(new RegExp(/(&amp;)/, 'g'),'&');
      } else {
          item.available = false;
      }
      }
    2. In the path: plugins/jamegafilter/docman/helper.php.
      I added the code:

      $item->created_by = $baseItem->created_by;

      After the code:

      $item->desc = !empty($desc) ? substr($desc,0,100).'...' : $desc;
    3. In the path : components/com_jamegafilter/assets/js/main.js.
      I replaced the code:

      item.setData(itemdata);
      lnmain.addItem(item, 'k' + itemdata.id);

      By the code :

      if (itemdata.available != 'undefined') {
      if (itemdata.available) {
          item.setData(itemdata);
          lnmain.addItem(item, 'k' + itemdata.id);
      }
      } else {
      item.setData(itemdata);
      lnmain.addItem(item, 'k' + itemdata.id);
      }

      Please check again, and confirm the result for me.
      Regards.

    suelasrotas Friend
    #1017195

    Thumbs up to that!!!! There are just a few things I would like to adjust but it might be better to open a new thread.

    Super good job!

    suelasrotas Friend
    #1017197

    One last thing…

    Do I have to upgrade the component now that version 1.0.6?

    Kind regards

    suelasrotas Friend
    #1018707

    Hi there!

    I just need to know whether it is OK to upgrade the component to new version or not.

    Any ideas?

    The Captain Moderator
    #1019298

    Hi,
    Please wait till the next release version. At the moment, we are updating some feature for other extensions on the Megafilter Component
    Regards.

    suelasrotas Friend
    #1021894

    Aye Captain!

    I am afraid I have discovered a bug related to this topic.

    When a user with special privileges logs in, he/she is not going to be able to see all of the documents on Docman.

    I think the code you applied restricts the filter to show just the documents you own without checking privileges. The way Docman works restricts the documents you can see very easily but not very visually.

    Do you think is possible that Megafilter can show all the documents when a Superadmin or administrator logs in?

    Kind regards

    The Captain Moderator
    #1022001

    Hi, Yes, all the documents should show when a SuperAdmin or Administrator logs in. Please follow steps below, In the path : plugins/jamegafilter/docman/default.php, insert the snippet of code:

    $groups = JFactory::getUser()->get('groups');
    $isAdmin = count(array_intersect($groups, array('7','8'))) ? true : false;

    after :

    $userID = JFactory::getUser()->id;

    and replace the snippet of code :

    function afterGetData(item) {
        //  console.log(item.id)
        if (item.created_by == '<?php echo $userID ?>') {
            item.available = true;
            item.url = sefUrl[item.id].replace(new RegExp(/(&amp;)/, 'g'),'&');
            item.url_download = dUrl[item.id].replace(new RegExp(/(&amp;)/, 'g'),'&');
        } else {
            item.available = false;
        }
    }

    by the code :

    function afterGetData(item) {
        <?php if ($this->item['type'] == 'docman') : 
            if ($userID) :
                if (!$isAdmin) :
        ?>
                    if (item.created_by == '<?php echo $userID ?>') {
                        item.available = true;
                    } else {
                        item.available = false;
                    }
        <?php 
                else : ?>
                    item.available = true;
        <?php   endif;
            else : ?>
                item.available = false;
        <?php 
            endif;
        endif; ?>
        item.url = sefUrl[item.id].replace(new RegExp(/(&amp;)/g),'&');
        item.url_download = dUrl[item.id].replace(new RegExp(/(&amp;)/g),'&');
    }

    Please try this and confirm the result for me.
    Regards

    suelasrotas Friend
    #1022033
    This reply has been marked as private.
Viewing 15 posts - 1 through 15 (of 25 total)

This topic contains 24 replies, has 4 voices, and was last updated by  Mo0nlight 6 years, 9 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum