Results 1 to 7 of 7
Like Tree1Likes
  • 1 Post By guilty

Thread: Use Lightbox to get info from another page,of the contact we're looking. [SOLVED]

  1. #1
    guilty is offline Member
    Join Date
    Sep 2009
    Posts
    12

    Lightbulb Use Lightbox to get info from another page,of the contact we're looking. [SOLVED]

    I've been fighting with sugar to be able to show information that is not managed with sugar but is relative to a contact.

    The idea is that when a contact calls, I'd like to be able to see all the information of the contact, also the info that is not inside sugar.

    based on the Cookbook from Josh Sweeney, I got it.

    Here is how.

    1. In Studio -> Contacts add a link box called accountlink with a label of Account Link.
    2. Add the Account Link field to the Detail View then Save and Deploy
    3. Create a folder <install dir>/myscripts
    4. Create a file in <install dir>/myscripts/contact_info.php
    5. In that file add the following code:
      Code:
      <?php
      $contact_id = $_GET['contact_id'];
      $account_id = $_GET['account_id'];
      echo "<br/><br/><br/><br/>";
      echo "Contact ID:" . $contact_id."</br>";
      echo "Account ID:" . $account_id."</br>";
      echo "aqui posarem tot el que ha comprat el contacte / client"; 
      echo '</br></br><div style="padding:3px;"><a href="#" class="lbAction" rel="deactivate">Close Lightbox</a></div>';
      ?>
    6. Open <install dir>/custom/modules/Contacts and copy the scripts and css folders from the lightbox.zip file into the contacts directory.
    7. Edit <install dir>/custom/modules/Contacts/metadata/editdetailviewdefs.php
    8. Find the array where accountlink_c is declared and add the line highlighted in blue
      Code:
                  'name' => 'accountlink_c',
                  'customCode' => '<a href="/myscripts/contact_info.php?contact_id={$fields.id.value}&account_id={$fields.account_id.value}" class="lbOn">Show related information</a>',
                  'label' => 'LBL_ACCOUNTLINK',
    9. Next we have add a new detail view to override the base detail view.
    10. Open <install dir>/custom/modules/Contacts and create a new folder named views]
    11. In view create a file called view.detail.php
    12. Add the following code:
      Code:
      <?php
      require_once('include/MVC/View/views/view.detail.php');
      class ContactsViewDetail extends ViewDetail
      {
          function ContactsViewDetail()
          {
              parent::ViewDetail();
          }
          function display()
          {
              echo '<link rel="stylesheet" href="/myscripts/lightbox/css/lightbox.css" type="text/css" media="screen" />';
              echo '<script type="text/javascript" src="/myscripts/lightbox/scripts/prototype.js"></script>';
                      echo '<script type="text/javascript" src="/myscripts/lightbox/scripts/lightbox.js"></script>';
      
              parent::display();
          }
      }
      ?>
    13. Save and go to a contact record in Sugar.
    14. Click the link and view the lightbox action.


    remember to change script's ownership if needed.
    Code:
    chown -R www-data:www-data <install dir>/myscripts

    attached zip file with lightbox,prototype and contact_info.php

    P.D: I'm pretty new on sugar, is this the cleanest way of doing it?

    I'd rather put the info in a new tab instead of using a lightbox, anyone has a clue, how to do this?
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by guilty; 2009-09-28 at 01:33 AM. Reason: minor changes
    cjohnston likes this.

  2. #2
    mjoyner is offline Sugar Community Member
    Join Date
    Oct 2009
    Posts
    19

    Default Re: Use Lightbox to get info from another page,of the contact we're looking. [SOLVED]

    This works!!!!!!!!!


    Thanks I can now popup XFORMS from Sugar Modules


    THANKS THANKS THANKS THANKS!!!!

  3. #3
    dorasdr is offline Junior Member
    Join Date
    Oct 2011
    Posts
    5

    Smile Re: Use Lightbox to get info from another page,of the contact we're looking. [SOLVED]

    Hi guilty,

    I'm new to sugarcrm

    i implemented the same lightbox code on Accounts Module.

    But i'm getting below error

    "Not Found

    The requested URL /myscripts/contact_info.php was not found on this server."

    Please help me
    Attached Images Attached Images  

  4. #4
    dorasdr is offline Junior Member
    Join Date
    Oct 2011
    Posts
    5

    Smile Re: Use Lightbox to get info from another page,of the contact we're looking. [SOLVED]

    Hi guilty,

    I'm new to sugarcrm

    I implemented the light box code on Account Module but when i click on the link it is showing

    "Not Found

    The requested URL /myscripts/contact_info.php was not found on this server."

    Find the attachment for clear view

    Please help me
    Attached Images Attached Images  

  5. #5
    tobydz is offline Sugar Community Member
    Join Date
    Mar 2011
    Location
    Las Vegas, NV
    Posts
    144

    Default 403 Error

    I set the permissions and ownership the same as all my sugar files, but my "contact_info.php" keeps throwing a 403 Forbidden. I don't have any problems with any of my custom code.

  6. #6
    tobydz is offline Sugar Community Member
    Join Date
    Mar 2011
    Location
    Las Vegas, NV
    Posts
    144

    Default Re: 403 Error [SOLVED (sort of)]

    Quote Originally Posted by tobydz View Post
    I set the permissions and ownership the same as all my sugar files, but my "contact_info.php" keeps throwing a 403 Forbidden. I don't have any problems with any of my custom code.
    I just renamed the .htaccess file (I'm going to contact Sugar and see what's going on)

  7. #7
    tobydz is offline Sugar Community Member
    Join Date
    Mar 2011
    Location
    Las Vegas, NV
    Posts
    144

    Default Re: Use Lightbox to get info from another page,of the contact we're looking. [SOLVED]

    Has anyone been able to implement this since 2009???

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How do you put text fields in a PHP lightbox?
    By rampar in forum Developer Help
    Replies: 0
    Last Post: 2009-05-21, 05:11 PM
  2. Replies: 2
    Last Post: 2008-03-10, 05:25 PM
  3. Timeout problem solved (sort of!)
    By al3 in forum Help
    Replies: 0
    Last Post: 2007-09-13, 02:52 AM
  4. Drop down problem solved (4.2.0a -> 4.5.0b)
    By w_h_harper in forum Help
    Replies: 0
    Last Post: 2006-09-28, 12:59 AM
  5. Replies: 0
    Last Post: 2004-12-21, 05:31 PM

Tags for this Thread

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
  •