Calling function if the site changes

Ask a Question related to Macromedia Exchange Dreamweaver Extensions, Design and Development.

  1. #1

    Default Calling function if the site changes

    I am making an extension that gets information from the current site, so if you
    change the selected site the extension must refresh it's content, is there any
    way to call a function when the current site changes? Thanks.

    Clukey Guest

  2. Similar Questions and Discussions

    1. Calling a function within a function registered to an event
      Hey, Just registered and tried to search through the forum for a solution to my problem, but I haven't found anything that could help me. I've...
    2. Function calling from url
      Good morning! I would like to call a function from a <FORM>'s ACTION attribute. This is what I'm trying to do: <FORM...
    3. [PHP] Function calling from url
      > I would like to call a function from a <FORM>'s ACTION attribute. This Well, you're not going to call a function that way, but you will submit...
    4. Function/Global var to return name of calling function?
      I'm sure I saw this somewhere but can't remember where and can't find it now... Is there a PHP function or global variable that will return name...
    5. calling c function from php app
      Did you get vertex tax integrated? I am trying to implement that for a client right now. Any help would be great. Thanks, Chris ...
  3. #2

    Default Re: Calling function if the site changes

    The user can not change sites in the sites panel if the extension UI is open
    so whenever the extension UI is opened it should get the current sites info.
    If you are changing the site from within your extension code you can
    re-initialize your functions that get the info after the site has been
    changed.


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]





    "Clukey" <webforumsuser@macromedia.com> wrote in message
    news:drc0ib$a56$1@forums.macromedia.com...
    >I am making an extension that gets information from the current site, so if
    >you
    > change the selected site the extension must refresh it's content, is there
    > any
    > way to call a function when the current site changes? Thanks.
    >

    T.Pastrana - 4Level Guest

  4. #3

    Default Re: Calling function if the site changes

    I do not want to change the site information, I just want my extension to realize, then call a function, when the sites panel changes sites. Thanks
    Clukey Guest

  5. #4

    Default Re: Calling function if the site changes

    What kind of extension are you building? Does it have a launchable interface
    from which to make selections?


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]


    "Clukey" <webforumsuser@macromedia.com> wrote in message
    news:dret54$63u$1@forums.macromedia.com...
    >I do not want to change the site information, I just want my extension to
    >realize, then call a function, when the sites panel changes sites. Thanks

    T.Pastrana - 4Level Guest

  6. #5

    Default Re: Calling function if the site changes

    I'm making a floater that has a list of specific files from the current site, so when the site changes I need to refresh the list of files.
    Clukey Guest

  7. #6

    Default Re: Calling function if the site changes

    Clukey,

    You can't capture when a user actually changes the site selection but you
    can look to see if the site "has been changed". Since your using a Floater
    you can use the selectionChanged() function that will take an action
    whenever focus switches to a new document or the cursor moves to a new
    location of the open document.

    Knowing this you can set a global variable when the floater is initialized.
    This global var will be the current site that is open. The
    selectionChanged() function will check to see if the site that was defined
    matches the actual site selected and do 1 of 2 things...

    [1] Take action if the site "has been changed"
    or
    [2] Do nothing if it is the same ( return )

    Here is the code that will do this for you... Note however that you must
    initialize the global var when the floater is launched so you need to use
    the setCurrentSite(); on an onload event of the body of the Floater HTML
    document.

    <body onLoad="setCurrentSite()">


    var gCurrentSite;
    function setCurrentSite(){
    var siteList = site.getSites();
    if(siteList.length > 0){
    gCurrentSite = site.getCurrentSite();
    }
    }
    function selectionChanged(){
    if(site.getCurrentSite() == gCurrentSite){
    return
    }else{
    setCurrentSite();
    // reinitialize your floater here //
    }
    }



    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]





    "Clukey" <webforumsuser@macromedia.com> wrote in message
    news:drg4d4$kk0$1@forums.macromedia.com...
    > I'm making a floater that has a list of specific files from the current
    > site, so when the site changes I need to refresh the list of files.

    T.Pastrana - 4Level Guest

  8. #7

    Default Re: Calling function if the site changes

    I should have stated that the onLoad event is optional. It really isn't
    needed since you are using the selectionChanged() function which initiates
    automatically.

    <body onLoad="setCurrentSite()">


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]


    T.Pastrana - 4Level Guest

  9. #8

    Default Re: Calling function if the site changes

    That works great, thanks.
    Clukey Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139