Has anyone tried (better still succeeded in) creating an in-line override to adjust "list_max_entries_per_page" in config.php ON THE FLY?
If not, any thoughts on how to accomplish???
Has anyone tried (better still succeeded in) creating an in-line override to adjust "list_max_entries_per_page" in config.php ON THE FLY?
If not, any thoughts on how to accomplish???
Surely somebody has done this???
I can’t believe no one has done this but... here’s what I’ve come up with -- so far.
Adding this to config.php... and replacing:PHP Code:$display_selection_count = 20;
if(isset($_GET['user_display_selection_count']) && preg_replace("/\D/","",$_GET['user_display_selection_count'])!="") {
$display_selection_count = $_GET['user_display_selection_count'];
}
...withPHP Code:'list_max_entries_per_page' => 20,
Then altering contacts.html as follows:PHP Code:'list_max_entries_per_page' => $display_selection_count,
I am able to change list_max_entries_per_page value on the fly, but only from Contacts/ListView.html.HTML Code:<!-- BEGIN: main --> <table cellpadding="0" cellspacing="0" width="100%" border="0" class="listView"> <tr><td colspan="10" align="right">Show <a href="index.php?module=Contacts&action=index&user_display_selection_count=10&module=Contacts&action=index">[10]</a> <a href="index.php?module=Contacts&action=index&user_display_selection_count=20&module=Contacts&action=index">[20]</a> <a href="index.php?module=Contacts&action=index&user_display_selection_count=50&module=Contacts&action=index">[50]</a> <a href="index.php?module=Contacts&action=index&user_display_selection_count=100&module=Contacts&action=index">[100]</a> <a href="index.php?module=Contacts&action=index&user_display_selection_count=200&module=Contacts&action=index">[200]</a> </td></tr> <!-- BEGIN: list_nav_row -->
What I can’t figure out, is how to set it up so that it will work for all ListViews in the header/footer
( |<<Start <Previous (count) Next> End>>| Show [10] [20] [50] [100] [200] )
...for ALL lists INCLUDING sub-panels???
This would be especially useful in the creation of Target Lists for Campaigns. No?
Can any of you hard-core programmer types (Ajay, Chris, Ken???) offer any insight.
Please Advise
simply override by using
$GLOBALS['sugar_config']['list_max_entries_per_page'] = $num;
for subpanels it is a different parameter:
$GLOBALS['sugar_config']['list_max_entries_per_subpanel'] = $num;
this is before any of the core listview code is called.
Wayne Pan
Software Eng.
Thanks Wayne,
Wish I understood that. Could you clarify a bit for me please? Editing which files specifically?
I think Wayne has left the building. Anybody else have any idea what he meant by:Originally Posted by WayneSugar
Last edited by tj@estreet.com; 2006-09-26 at 05:55 PM.
Come on folks. Somebody jump on this please.
Putting the code samples together, you get something like this:
I'm not too familiar with 4.5 architecture yet, but under 4.2 you could add that to the processListViewTwo method of the ListView class (include/ListView/ListView.php). Alternatively, and maybe easier, you could just add this to index.php, somewhere after the inclusion of config.php. That would affect every single page.PHP Code:if(! empty($_REQUEST['user_display_selection_count']) && is_numeric($_REQUEST['user_display_selection_count'])) {
$GLOBALS['sugar_config']['list_max_entries_per_page'] = $_REQUEST['user_display_selection_count'];
}
I believe Wayne means that to add the reassignment of $GLOBALS['sugar_config']['list_max_entries_per_page'] should be made in the ListView.php file for the appropriate module neaer the beginning of the file.
Similarly, put the new value for $GLOBALS['sugar_config']['list_max_entries_per_subpanel'] near the begining of the parent module's DetailView.php file.
What would be a useful trick is to be able to set this override individually for users.
Thanks Andrew and Steve,
When I implemented the code originally offered above (Contacts/ListView only), I was surpised to find it functioned on a per user basis, as it was my intent that it would be per view.
Plugging in only one option purely as a test:
I was surpised -- after a successful test -- when I returned later to contacts/list view to find it stuck returning only ten records in the list. I logged out (user Admin) and back in again and still only 10 results in list. I logged out, and back in as user TJ, and sure enough, I was back to the default of 20. Hmmm, I thought to myself. Not what I intended, but not a bad thing. In fact... I think I like it!<a href="index.php?module=Contacts&action=index&user_ display_selection_count=10&module=Contacts&action= index">[10]</a>
As user TJ I clicked my new "display_selection_count" link, and returned only10 results, Logged out, back in as Admin and sure enough, only 10 results. Gee, I had better add the remaining options [20][50][100][200] so I'm not stuck viewing only 10 results in my contacts list, then I'll present this in the Sugar Forums and see if we can't get it working for ALL lists.
That was days ago, many and various modifications to other modules, Admin/Repair database etc. waiting for some movement on this thread/topic, and now, as I prepare to respond to Steve that it works on a per user basis as is, much to my surprise I find it now only works on a per view basis. Go Figure!
Still, in my vast ignorance, I have no clue how to apply this, in a sweeping fashion to all lists. Tried Andrew's suggestion, (adding the code he offered to index.php) but to no effect. Surely all approaches suggested require creation of a set of linkswhatever list is being viewed to set desired value ????![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks