[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: Re: Favorites



Here's the table design I used to implement menu favorites:

CREATE TABLE menu_favs
(
  id serial NOT NULL,
  user_id integer NOT NULL,
  node_id integer NOT NULL,
  label text
)
WITH (
  OIDS=FALSE
);
ALTER TABLE menu_favs
  OWNER TO postgres;
GRANT ALL ON TABLE menu_favs TO postgres;

Thanks.
Brian

Activus Technologies
Brian Wolf
Phone: 410.367.2958
Email: ..hidden..
  • LedgerSMB Accounting Software Integrated with Amazon Marketplace
  • Integrated Payment Solutions


-------- Original Message --------
Subject: Re: [Ledger-smb-devel] Favorites
Date: Thu, 12 Sep 2013 16:06:01 -0400
From: Brian Wolf <..hidden..>
Reply-To: ..hidden..
Organization: Activus Technologies
To: Development discussion for LedgerSMB <..hidden..>


I implemented it as a combination of perl, _javascript_, a stored procedure called custom_menu_favorites(), a Python module and a Mako template.  It required adding table menu_favs to the database to store favorites for each user.  It probably would not be that hard to port Python to Perl and Mako template to Template Toolkit.

There are two aspects to implementing favorites: storing them and showing them.

Showing favorites:
-----------------------
Stored procedure custom_menu_favorites() returns a list of favorites for the current user.  I added these lines to /scripts/menu.pl to call custom_menu_favorites() to call the stored procedure:

    my @favs = $menu->exec_method(funcname => 'custom_menu_favorites');
    #my @favs = $request->call_procedure(procname => 'custom_menu_favorites');
    $menu->{'favorites'} = \@favs;
    $template->render($menu);

I added a couple of _javascript_ functions to /UI/menu/expanding.html  to show/hide favorites and these lines to display favorites:
  <ul>
    <li class="menu_closed">
      <a href="" _onclick_="ShowFavs();">Favorites</a>
      <ul id="favorites" class="submenu" style = "display: none;">
        <li><a target="main_window" href="">Select Favorites</a></li>
        <?lsmb FOREACH fav IN favorites ?>
          <li><a target="main_window" href=""><?lsmb fav.label ?></a></li>
        <?lsmb END ?>
      </ul>
    </li>
  </ul>


Storing favorites:
---------------------

Storing favorites starts with a new database table menu_favs.  This line in expanding.html produces an anchor which, when clicked, displays each menu item as a checkbox + textbox. 

<li><a target="main_window" href="">Select Favorites</a></li>

The user checks any checkboxes desired as a favorite and fills in the textbox with the name of the favorite.  For example, "Parts Report".  The user clicks Save button, and selections are saved to menu_favs table.

Thanks.
Brian

Activus Technologies
Brian Wolf
Phone: 410.367.2958
Email: ..hidden..
  • LedgerSMB Accounting Software Integrated with Amazon Marketplace
  • Integrated Payment Solutions
On 09/12/2013 02:57 PM, Erik Huelsmann wrote:
Hi Brian,

Did you implement the favorites as PHP or did you dive into Perl? In case of the latter, is there an option for donating the code? I was thinking of doing a "login dashboard" kind of thing which sounds an awful lot like your favorates.

If you did PHP, please describe your solution. Maybe it's easy to code in Perl as well.


Bye,

Erik.


On Tue, Sep 10, 2013 at 5:59 AM, Brian Wolf <..hidden..> wrote:
I've implemented "favorites" functionality for a client, and they seem to like it very much.  If others would like it, I can describe how I implemented it.

Thanks.
Brian

Activus Technologies
Brian Wolf
Email: ..hidden..
  • LedgerSMB Accounting Software Integrated with Amazon Marketplace
  • Integrated Payment Solutions

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel




--
Bye,

Erik.

http://efficito.com -- Hosted accounting and ERP.
Robust and Flexible. No vendor lock-in.


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk


_______________________________________________
Ledger-smb-devel mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-devel