Results 1 to 8 of 8

Thread: Help On Ajax On Case Module

  1. #1
    afidegnum is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    11

    Default Help On Ajax On Case Module


    Good morning, Please I would like to customize the case module located on the module list. and want to take that example to customers other module I am going to install.

    what let's say, I click on create new case, I would like the form to load in a DIV panel without the entire site refreshing. or a different way. and once I submit it, the form will also go without the entire page being refreshing. Looking forward to hear from you. Thanks

  2. #2
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Help On Ajax On Case Module

    This would certainly be possible with enough code. You would have to code a custom editview for the cases module. It's a pretty big project, and I'm not really sure what you are looking for from the forums. It's a bit too big of a project to describe exactly how to do it here.

    You don't say in your message if you know how to program in PHP and Javascript or not. I assume that you must, which means that the first thing you need to do is look at the current EditView.php and html in the cases module and see how it is done now, then just rewrite what is needed to make it look like you want.

    Why would you want such an animal anyway?
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

  3. #3
    afidegnum is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    11

    Default Re: Help On Ajax On Case Module

    well, I am also a php programmer, and also some of my clients want a page without refreshes especially when clicking on creating a new case. I am doing this in connection with a new module we built ourselves through the module maker. we already writing the AJAX script that will load the content to a DIV panel, but now what is left is where to put the onlick event when creating a new case, and where to put the javascript code in such a way it does not interfere with other code?
    I am currently using sugar CRM5.0
    thanks inadvance for your assistance

  4. #4
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Help On Ajax On Case Module

    I am not sure there is anywhere you can put code like this that won't interfere. What you are going to have to do is write a new case module editview.html and editview.php yourself that would add the code needed for the ajax transfer of data.

    From what you said it would act exactly the same except when they hit save, i guess, it would just go back to a blank form without refreshing. Not sure what you would gain from this other than the aesthetics of it.
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

  5. #5
    afidegnum is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    11

    Default Re: Help On Ajax On Case Module

    Dear Sir, I have posted another enhance thread to better explain the situation. this is what I posted but please, can you check if you have any idea>?

    Sugar CRM5.0
    Hi, I posted a thread on needing assistance on the Case Module, and I am reposting it with a sample code that I need to customize. as already said this is what I need to do. Some members due to their slow response of their internet connection speed, come up with an option of customizing the script in such a way, the form will load into a div tab, you quickly fill and submit it live without the whole page refreshes. I tried hard to figure out how best can I do that for more than 4 days, but since I do not have a full documentation at hand, I am perplexed.

    now let's start I am starting with the case module. specially create case. normally, when you hover the mouse over the link create new case, you will see this:index.php?module=Cases&action=EditView&return _module=Cases&return_action=DetailView

    which I found in menu.php in the case module. unfortunately for me, I search for "a href" so I can incorporate the new Ajax code, but I ended up having head ache.

    Below is the script I think will work and I copied it from Dynamic drive.

    <script type="text/javascript">

    /***********************************************
    * Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/

    var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
    var loadedobjects=""
    var rootdomain="http://"+window.location.hostname
    var bustcacheparameter=""

    function ajaxpage(url, containerid){
    var page_request = false
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    page_request = new XMLHttpRequest()
    else if (window.ActiveXObject){ // if IE
    try {
    page_request = new ActiveXObject("Msxml2.XMLHTTP")
    }
    catch (e){
    try{
    page_request = new ActiveXObject("Microsoft.XMLHTTP")
    }
    catch (e){}
    }
    }
    else
    return false
    page_request.onreadystatechange=function(){
    loadpage(page_request, containerid)
    }
    if (bustcachevar) //if bust caching of external page
    bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
    page_request.open('GET', url+bustcacheparameter, true)
    page_request.send(null)
    }

    function loadpage(page_request, containerid){
    if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
    document.getElementById(containerid).innerHTML=pag e_request.responseText
    }

    function loadobjs(){
    if (!document.getElementById)
    return
    for (i=0; i<arguments.length; i++){
    var file=arguments[i]
    var fileref=""
    if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
    if (file.indexOf(".js")!=-1){ //If object is a js file
    fileref=document.createElement('script')
    fileref.setAttribute("type","text/javascript");
    fileref.setAttribute("src", file);
    }
    else if (file.indexOf(".css")!=-1){ //If object is a css file
    fileref=document.createElement("link")
    fileref.setAttribute("rel", "stylesheet");
    fileref.setAttribute("type", "text/css");
    fileref.setAttribute("href", file);
    }
    }
    if (fileref!=""){
    document.getElementsByTagName("head").item(0).appe ndChild(fileref)
    loadedobjects+=file+" " //Remember this object as being already added to page
    }
    }
    }

    </script>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <a href="javascript:ajaxpage('test.htm', 'contentarea');">test</a>
    <div id="contentarea"></div>
    <body>
    </body>
    </html>

    I will be grateful if you can direct me where should I put the Javascript code, and the module link so it will automatically hook and load the content into a DIV layer so I can update the form there. I will be glad if you can also direct me in case I might need to add something else to the script.

    Sincerely,

    NB: I learnt in sugar 5.0, edit view is not activated again, pls what will be the other alternative?

  6. #6
    scheinarts is offline Sugar Community Member
    Join Date
    Feb 2007
    Location
    Panama City, Panama
    Posts
    151

    Default Re: Help On Ajax On Case Module

    i agree with kbrill that it would take a LOT of work to make this happen, and in the end in wont be that "pretty". I mean, Sugar 5.0 runs really fast when saving a new record, compared to the previous versions of Sugar.

    If you where to create a new record with a fancy ajax box, you would still have to go to the View mode the actually "view" the data. I dont think this will improve the functionality of sugar, but just make you hate sugar.

    I can help you if you need the functionality to upload any type of file to and relate it to a record or to auto populate fields, but for something like I wouldnt even know where to start.

  7. #7
    kbrill's Avatar
    kbrill is offline SugarCRM PS Engineer
    Join Date
    Jul 2004
    Location
    St Louis, MO
    Posts
    3,183

    Default Re: Help On Ajax On Case Module

    Because of the architecture of SugarCRM in order to this this you are going to have to create your own case module that bypasses the current index.php based path.

    You would have to create your own EditView.html, EditView.php and a php to accept the data from the form and post it to the database. This is not an easy project at all. And I doubt the cookie cutter code you found will be much use either. You will have to add error checking to it at the least. Unless you really understand how that code works, and what changes would have to be made to make it work with SugarCRM this project may be a little above you. This is not a case where you would just plug that code in somewhere and poof the form would be ajax enabled. ALOT of the background code in SugarCRM would have to be altered as well.
    Kenneth Brill - Help Forum Moderator

    I do not respond to 'Private Messages'. Please email me directly instead

    When asking for help, PLEASE give us your Server Information and Version Numbers as asked for on the 'Post New Message' screen as well as any JavaScript errors shown at the bottom of the browser window.
    Help us Help You

  8. #8
    afidegnum is offline Sugar Community Member
    Join Date
    Nov 2007
    Posts
    11

    Default Re: Help On Ajax On Case Module

    hello, thanks for your supports in advance. but I refer to my project manager and I came up with more clarifications.

    actually this is what is happening. first, it s not the menu of the new case module we are focusing on. we have created a new modules that is allocation modules, consultant module. and after creating them, those new modules do not have the ajax functionality as it is on case module. you can see in the case module, especially after you create new case, you can lively mane editing, saving ... without the page refreshing. anyway I jsut noticed few things such as subpaneldefs located in metadata folder in Cases module, as well as dashlet folder located in case module. but the new one that has been created with Module Studtion, gives you the page. it is up to us to do the actual modufication. and I noticed that functionality lies in a subpanels and subpaneldefs gives you array of what needed to be done for that functionality to be effective. how can I do the same with the new modules I have created and where do I get the variable list. or something that will guide me to configure them.

    thanks once again for your support.

    sincerely,

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Module Builder
    By Olavo in forum Downloads
    Replies: 418
    Last Post: 2009-02-26, 06:36 AM
  2. Help On Ajax On Case Module
    By afidegnum in forum Developer Help
    Replies: 2
    Last Post: 2007-11-23, 07:17 PM
  3. Replies: 1
    Last Post: 2006-09-11, 03:38 PM
  4. Effective use of Case Module
    By Aggy in forum Help
    Replies: 0
    Last Post: 2006-05-16, 01:18 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
  •