HomeHomeDotNetNuke Forg...DotNetNuke Forg...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIPrototype or Mootools with DNN ClientAPI?Prototype or Mootools with DNN ClientAPI?
Previous
 
Next
New Post
2/16/2007 2:36 PM
 
I'm trying to use the mootools javascript framework (whose "$()" notation is based on the prototype js framework) in my module, but having some weird issues that I believe are caused by the following code in the DNN ClientAPI javascript (dnn.js, line 895, DNN v4.3.7):

//-- prototype/atlas shorthand functions
function $()
{
  var ary = new Array();
  for (var i=0; i<arguments.length; i++)
  {
    var arg = arguments[i];
    var ctl;
    if (typeof arg == 'string')
      ctl = dnn.dom.getById(arg);
    else
      ctl = arg;

    if (ctl != null && typeof(Element) != 'undefined' && typeof(Element.extend) != 'undefined')   //if prototype loaded, we must extend the object
        Element.extend(ctl);
       
    if (arguments.length == 1)
      return ctl;

    ary[ary.length] = ctl;
  }
  return ary;
}


I am using the $('mydiv') notation to access an element on the page and change its innerHTML property.  But when I do, another div element's contents are modified (cleared).  The 2 div's have unique id's.  My reason for suspecting this function is that I can successfully do the task if I use dnn.dom.getById(arg) directly... but then I don't have access to the mootools extension methods.

Any ideas?


Charlie Solomon
Beldin Technologies
Custom Software Solutions, DotNetNuke Modules
www.beldintechnologies.com
 
New Post
2/16/2007 2:59 PM
 
Update:

I implied that the function listed above is causing my problem... I didn't mean to.  I can make my code work if I use dnn.com.getById directly, and don't use mootools/prototype notation.

So I guess my real question here is has anyone been successful using mootools or prototype in the context of a DNN installation?  I'd really like to access some of the features of the mootools framework.

Thanks.


Charlie Solomon
Beldin Technologies
Custom Software Solutions, DotNetNuke Modules
www.beldintechnologies.com
 
New Post
2/19/2007 6:06 AM
 

The whole idea of the $ function and who "owns" that "namespace" has become quite muddy.  When I first learned of the use of $ and found that MS was adopting the same notation, I decided to do it as well.  For at the time, I felt that all frameworks simply used it as a quick way to get the reference to a DOM element.  Soon afterwards I learned that frameworks like prototyle use it for much more.  Apparently, MS learned this as well, and decided to switch to $get.  What I never understood is why they went through all the trouble of creating a nice namespace hierarchy, minimizing chances to have conflicting functions, then decided to scrap the whole idea and make shortened alias' with the $.  In essence, they are saying they "own" the $ namespace.  I have commented back and forth on this issue here.

Unfortunatly, I cannot just yank my $() function since I have to worry about backwards compatibility (at the time MS did it they were in beta so they could).  My $ function should be functioning with prototype last time I checked.

Hope this gives you a little more insight.


 
New Post
7/18/2007 10:21 AM
 

I'm up against the same problem, has anyone found a fix?

 
New Post
7/18/2007 10:32 AM
 

I dropped MooTools in my module development shortly after this post because I couldn't get all the functionality to work... Jon's function above uses the Prototype ".Extend" method to access that framework's functionality if it is loaded, so like he said above, Prototype should work.



Charlie Solomon
Beldin Technologies
Custom Software Solutions, DotNetNuke Modules
www.beldintechnologies.com
 
Previous
 
Next
HomeHomeDotNetNuke Forg...DotNetNuke Forg...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIPrototype or Mootools with DNN ClientAPI?Prototype or Mootools with DNN ClientAPI?


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

Attend A Webinar
Free Demo Site
Download DotNetNuke Professional Edition Trial
Have Someone Contact Me

Like Us on Facebook Join our Network on LinkedIn Follow DNN Corporate on Twitter Follow DNN on Twitter

Advertisers

DotNetNuke Scoop!

Sponsors

DotNetNuke Corporation

DotNetNuke Corp. is the steward of the DotNetNuke open source project, the most widely adopted Web Content Management Platform for building web sites and web applications on Microsoft .NET. Organizations use DotNetNuke to quickly develop and deploy interactive and dynamic web sites, intranets, extranets and web applications. The DotNetNuke platform is available in a free Community and subscription-based Professional and Enterprise Editions with an Elite Support option. DotNetNuke Corp. also operates the DotNetNuke Store where users purchase third party apps for the platform.