We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Hi,

    I recently discovered this error on one of my setups(2.2.5-pl (traditional))

    Fatal error: Call to undefined method modTemplateVarInputRenderDeprecated::parseInputOptions() in /home/chi/public_html/core/model/modx/processors/element/tv/renders/mgr/input/checkboxSortable.php on line 12

    Any ideas if this was fix or what is the problem?

    Thank you
      • 33976 ☆ A M B ☆
      • 571 Posts
      cipa,

      If you are still using the first release (attached to this thread) it should not be compatible with 2.2.x. You should consider grabbing the release on official provider (or download it there).

      Hope this will help
        • 5340
        • 1,624 Posts
        Hi,

        I manage to fix by changing parseInputOptions to getInputOptions and removing the params.

        My search for a new version on google returned nothing. Good to know there is a new version.

        Thank you
          • 40045
          • 534 Posts
          I just started to play around with this awesome TV type, but I have a really strange issue (though I see it work on the youtube video^^...): I can't see the checkboxes on initial load, also not the Active header.

          I tracked it down to be a css issue, the whole row elements have a far too big width (initially something over 970px), I had a look at the extJS code and saw that it should change when the window is resized...and see, it does...if I change window size the checkboxes and the header appear...I also tried around a bit in the extJS with the refreshView() function, but bc I have no clue of extJS, I wasn't successful =/. I tested and have seen this problem in chrome and firefox, I reinstalled the package and then even deleted it completely and redownloaded/reinstalled it...didn't help. I'm on Revo 2.2.6, the demo is on 2.2.5...can somebody confirm that it works on 2.2.6?

          I also installed it on another site with 2.2.5 and there it works...tried the same in another 2.2.6 install (also not clean from other extras, but much less...) and there it also shows that behavior...so I guess it's a compatibility thing in 2.2.6, but from where does it come? any ideas how to fix this would be much appreciated!
            • 40045
            • 534 Posts
            OK, i digged into the problem and I got the cause finally (f'ing extJS...)...to make it short, the problem appears when the TV's are not shown in a separate "Template Variables" tab but below the content instead (can be achieved by system setting tvs_below_content = 1)...if it's in the normal TVs tab, the checkboxSortableTV works also in 2.2.6!

            Buuut, I don't like that TVs tab, so I tried for some kind of solution...I thought first, it should be just possible to just switch around the columns, ie show the checkbox col first, then the name col...but no way...I just don't get that extJS stuff^^...tried to move around the store data but couldn't achieve anything...so after an hour of console.log'ing the different objects in the checkboxsortable.tpl file (which contains the extjs) and trying various stupid things I now have at least a better way than resizing the browser window every time I want to see which items are active =D...it just does the grid.refreshView() thing when you click the the grid header...for now that's ok for me, but I would love to see a fix for that problem (why does it even exist??? ie the table is far too big for the viewport...?) better than mine, which means, just show the columns as everybody would expect^^...

            enough speaking, here the changed checkboxsortable.tpl code, I commented where I changed, it's not a lot:

            <div id="tv{$tv->id}-checkboxsortable"></div>
            
            <script type="text/javascript">
                // <![CDATA[
                {literal}
                Ext.onReady(function() {
                    // Populate the grid store
                    var store{/literal}{$tv->id}{literal} = new Ext.data.Store({
                        autoDestroy: true
                        ,reader: new Ext.data.ArrayReader({}, [
                             {name: 'id'}
                            ,{name: 'name'}
                            ,{name: 'value'}
                            ,{name: 'label'}
                            ,{name: 'checked'}
                        ])
                        ,data: [{/literal}
                            {foreach from=$opts item=item key=k name=checkboxsortable}
                                {literal}[{/literal}
                                 'tv{$tv->id}-{$k}'
                                ,'tv{$tv->id}[]'
                                ,'{$item.value}'
                                ,'{$item.label|escape:"javascript"}'
                                ,{if $item.checked}true{else}false{/if}
                                {literal}],{/literal}
                            {/foreach}
                            {literal}]
                    });
            
                    var grid = new CheckboxSortable.TV({
                        store: store{/literal}{$tv->id}{literal}
                        ,renderTo: {/literal}'tv{$tv->id}-checkboxsortable'{literal}
                        ,autoPlace: {/literal}{$params.autoplace}{literal}
                    });
            
                    // exside: even dirtyer workaround when tvs_below_content is set to true and the existing code doesn't show the checkboxes
                    // I would rather switch the position of the active checkbox and the name fiels (ie checkbox first column), but just couldn't do it =/
                    grid.on('headerclick', function() {
                        grid.refreshView()
                    });
                    // Dirty work around to resize the grid
                    // extended by exside to avoid undefined errors when tvs_below_content is set to true! maybe fixes IE error??
                    if ( Ext.getCmp('modx-resource-tabs') !== undefined ) {
                        var tabs = Ext.getCmp('modx-resource-tabs');
                        
                        tabs.on('tabChange', function(elem, tab) {
                        {/literal}
                            {if $params.tab_ids}
                                var array = '{$params.tab_ids}'.split(',');
                                Ext.each(array, function(item, idx, list) {
                                    list[idx] = item.trim();
                                });
                                array.push('modx-panel-resource-tv');
                                
                                if (array.indexOf(tab.id) != -1) {
                                    grid.refreshView();
                                }
                            {else}
                                // Default TV panel
                                if (tab.id == 'modx-panel-resource-tv') {
                                    grid.refreshView();
                                }
                            {/if}
                        {literal}
                            if (tab.id == '{/literal}{$params.tab_ids}{literal}') {
                                grid.refreshView();
                            }
                        });
                        tabs.on('resize', function() {
                            grid.refreshView();
                        });
                    }
                });
                {/literal}
                // ]]>
            </script>
            
            


            and if somebody knows how the heck I switch around the columns, I would appreciate to be enlightened =)! [ed. note: exside last edited this post 13 years, 6 months ago.]
              • 33976 ☆ A M B ☆
              • 571 Posts
              Thank you exside,

              With your explanation i finally was able to reproduce the error (by setting tv_below_content to true).
              It's not really an ExtJS problem… rather the way it is implemented (ExtJS rendered to HTML + smarty + PHP + … well, a mess!).

              Anyway, as i like dirty workarounds, here is what i come up with :

                      // Dirty work around to resize the grid
                      if (MODx.config.tvs_below_content == 1) {
                          var panel = Ext.getCmp('modx-panel-resource-tv');
                          panel.on('afterlayout', function() {
                              grid.refreshView();
                          });
                      } else {
                          var tabs = Ext.getCmp('modx-resource-tabs');
                          tabs.on('tabChange', function(elem, tab) {
                              {/literal}
                              var array = '{$params.tab_ids}'.split(',');
                              Ext.each(array, function(item, idx, list) {
                                  list[idx] = item.trim();
                              });
                              array.push('modx-panel-resource-tv');
                              if (array.indexOf(tab.id) != -1) {
                                  grid.refreshView();
                              }
                              {literal}
                              if (tab.id == '{/literal}{$params.tab_ids}{literal}') {
                                  grid.refreshView();
                              }
                          });
                          tabs.on('resize', function() {
                              grid.refreshView();
                          });
                      }
              


              (complete file on Github if you prefer)

              If you want to change columns orders, you will have to go to checkboxsortable.js and edit the "columns" objects (just swap the label with the checkbox).

              Cheers
                • 40045
                • 534 Posts
                yess! Thanks a lot, the fix works but has some flaws sometimes (doesn't work) but couldn't find a pattern to reproduce it regularely...anyways, switched around the columns and I like it much more, like this you see first, wich entries are active then the name...

                  • 4172
                  • 5,888 Posts
                  this could also be of interest for you:
                  https://github.com/Bruno17/migxResourceRelations
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 40045
                    • 534 Posts
                    That's cool Bruno, thanks, didn't know that! Will definitely come handy in the future. I actually need the relations/defaults be generated automatically and editors should not have to change to another page to configure the relations, they should just be there ie. available as input options of that tv.

                    The whole thing is used to not have duplicate resources in a scenario like this:

                    Top Level Resource 1
                    - Articles
                    -- Article 1
                    -- Article 2
                    -- Article 3
                    Top Level Resource 2
                    - Articles
                    -- Article 4
                    -- Article 5
                    -- Article 6

                    Every article has full content and a "teasercontent" which is shown under the main content in the frontend. For example Article 5 should have Article 4 and 6 (siblings) as default (already checked in the checkboxsortableTV)

                    Top Level Resource 1 I call a "teasersharer", so it's articles can also be used as teasers by other articles, but these should not be checked by default (but available if needed).

                    The "teaser"-list in Article 5 would look like this by default:

                    (checked) Article 4
                    (checked) Article 6
                    (unchecked) Article 5
                    (unchecked) Article 1
                    (unchecked) Article 2
                    (unchecked) Article 3

                    so what I did is to write a custom getResources wrapper snippet and use it with @EVAL in the tv input options, it then sets the needed values/options with their correct status in the checkboxsortable.

                    Works great, I just can't make modx btw. the tv to show the most actual settings on initial document form load (because the wrapper snippets sets the content before the options are generated, but they are generated obviously with the "old" data...). So editors/or I have to reload the page first to see the actual data/status of the teasers...can't think of something that would change that, but I can ask anyway =)
                      • 40045
                      • 534 Posts
                      in the actual 0.3.0beta3 version I get the following error when trying to access a resource with a checkboxSortable assigned:

                      Parse error: syntax error, unexpected '[' in /home/exsidech/public_html/niciart/core/components/checkboxsortable/elements/tv/input/checkboxsortable.class.php on line 32


                      there is a line in this file which also seems to be coded for PHP 5.4, line 32 says:

                              $storeData = [];
                              // instead of the also PHP 5.3 compatible way of
                              $storeData = array();
                      


                      couldn't contribute bc there seems no repository for checkboxSortable in your github account =)...would also like to contribute the german translation (attached). Actually I translated it, but I don't get how the Tabs ID's thing is used =)...

                      The missing checkbox problems from earlier versions seem to be fixed, but I actually didn't do any hardcore cross-browser tests yet...works in most recent Firefox and Chrome, also IE9 (so I guess in IE10 too), but there the checkbox is not centered in the column, it's a bit too right...but that's a detail that can be ignored =)