Results 1 to 5 of 5

Thread: check role

  1. #1
    hoang is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    51

    Default check role

    Hi,

    Which are the possible ways can i check for user role in 5.1?
    edit:
    I managed to extend the editview and check for user role but don't know how to include my javascript file. I actually included the js file in editviewdefs.php but somehow it didn't work
    How do i include the js file? which file/location?
    Also Is it possible to check for user role in editviewdefs?

    thank you very much
    Last edited by hoang; 2008-10-10 at 05:22 AM.
    Many thanks
    Hoang

    Sugarcrm 5.1 RC
    XAMPP 1.6.6a

  2. #2
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: check role

    Hi Hoang

    Take a loot at the file modules/Accounts/metadata/editviewdefs.php
    There is a section to include javascript:

    PHP Code:
                                'includes'=> array(
                                                array(
    'file'=>'modules/Accounts/Account.js'),
                                             ), 
    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  3. #3
    hoang is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    51

    Default Re: check role

    Initially when i include my js file in editviewdefs, it works fine.
    Now i wish to extend the view in view.edit.php and thats working fine except that all my validation in the js file is not included.
    So my question is how to include the js file in view.edit.php if it's possible.
    thank you
    Many thanks
    Hoang

    Sugarcrm 5.1 RC
    XAMPP 1.6.6a

  4. #4
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: check role

    Hi Hoang

    This is the content of a view.edit.php of a good js implementation that I´ll share to community this week.

    PHP Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    require_once(
    'include/MVC/View/views/view.edit.php');

    class 
    AccountsViewEdit extends ViewEdit {
        function 
    display() {
            require_once(
    'custom/modules/' $this->bean->module_dir '/metadata/toggle_required_fieldsdefs.php');

            
    $javascript json_encode($toggle_required_fieldsdefs);

            echo 
    '<script type="text/javascript" src="custom/include/javascript/lgs_utils.js"></script>';
            echo 
    '<script>var requiredFieldsDefs = ' $javascript ';</script>';

            
    parent::display();
        }
    }
    ?>
    Enjoy it
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  5. #5
    hoang is offline Sugar Community Member
    Join Date
    Oct 2007
    Posts
    51

    Default Re: check role

    Hi Andopes,

    Many thanks for that! Your contribution to the forum has been top notch!!
    I actually managed to fix that problem. There was a problem with my js file that's why it didnt execute. Anyway, just include the js file in editviewdefs as per normal and it will still work

    Cheers
    Many thanks
    Hoang

    Sugarcrm 5.1 RC
    XAMPP 1.6.6a

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Custom validation based on role
    By Snook in forum Help
    Replies: 4
    Last Post: 2008-08-13, 09:38 AM
  2. Missing security check on ListView buttons.
    By kenneth.thorman in forum Developer Help
    Replies: 0
    Last Post: 2008-07-11, 01:38 PM
  3. IMPORTANT: Entry point check has changed
    By julian in forum Developer Help
    Replies: 25
    Last Post: 2008-03-02, 03:11 AM
  4. Replies: 0
    Last Post: 2005-09-24, 10:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •