Shape tracing with the Orchard 1.2.41

Topics: Customizing Orchard, Writing themes
Jul 27, 2011 at 8:57 PM

 

Hello,

I was using the Shape tracing with the Orchard 1.2.41.

For some reason, whenever I click on the shape menu tap, I get a jQuery error.

Any help would be appreciated.

 

Microsoft JScript runtime error: '$value' is null or not an object

.

The script where this happen is in Pink:

var

 

 

$=jQuery,call,__=[],$data=$item.data;with($data){__.push('<div class="shape grid-display"> <ul class="properties"> <li class="sgd-s"><div class="name">Shape</div><div class="value">');if(typeof(shape.type)!=='undefined' && (shape.type)!=null){__.push($.encode((typeof(shape.type)==='function'?(shape.type).call($item):(shape.type))));}__.push('</div></li> <li class="sgd-t"><div class="name">Active Template</div><div class="value"><a id="activeTemplate" href="#">');if(typeof(shape.template)!=='undefined' && (shape.template)!=null){__.push($.encode((typeof(shape.template)==='function'?(shape.template).call($item):(shape.template))));}__.push('</a></div></li> ');if((typeof(shape.template != shape.originalTemplate)!=='undefined' && (shape.template != shape.originalTemplate)!=null) && (typeof(shape.template != shape.originalTemplate)==='function'?(shape.template != shape.originalTemplate).call($item):(shape.template != shape.originalTemplate))){__.push(' <li class="sgd-ot"><div class="name">Original Template Template</div><div class="value">');if(typeof(shape.originalTemplate)!=='undefined' && (shape.originalTemplate)!=null){__.push($.encode((typeof(shape.originalTemplate)==='function'?(shape.originalTemplate).call($item):(shape.originalTemplate))));}__.push('</div></li> ');}__.push(' <li class="sgd-d"><div class="name">Display Type</div><div class="value">');if(typeof(shape.displayType)!=='undefined' && (shape.displayType)!=null){__.push($.encode((typeof(shape.displayType)==='function'?(shape.displayType).call($item):(shape.displayType))));}__.push('</div></li> <li class="sgd-a"><div class="name">Alternate (');if(typeof(shape.alternates.length)!=='undefined' && (shape.alternates.length)!=null){__.push($.encode((typeof(shape.alternates.length)==='function'?(shape.alternates.length).call($item):(shape.alternates.length))));}__.push(')</div> <div class="value">&nbsp;</div> <ul> ');if(typeof(shape.alternates)!=='undefined' && (shape.alternates)!=null){$.each((typeof(shape.alternates)==='function'?(shape.alternates).call($item):(shape.alternates)),function($index, $value){with(this){__.push(' <li> <div class="name"> <form action="/OrchardLocal/Orchard.DesignerTools/Alternate/Create" class="inline link" method="post"><input id="Alternate" name="Alternate" type="hidden" value="');if(typeof($value.alternate)!=='undefined' && ($value.alternate)!=null){__.push($.encode((typeof($value.alternate)==='function'

?($value.alternate).call($item):($value.alternate))));}

Coordinator
Jul 27, 2011 at 8:59 PM

It's probably that theme including jQuery directly instead of going through Script.Require like it should. Please contact the developers of that theme.

Jul 27, 2011 at 9:22 PM

Thanks for your quick response.

I have included the following in the Layout.cshtml for my theme.

Script.Require(

"jQueryUI_Core"

);

Script.Include(

"modernizr-latest.js"

).AtHead();

Script.Include(

"nav.js"

).AtFoot();

 Did I miss a script? I am using the Designer Tool 1.2.41 module.

 

Coordinator
Jul 27, 2011 at 9:26 PM

It's not that you missed a script, it's that the authors of that theme are probably hard-coding the jquery script tag in their document.cshtml. You need to remove something, not add. (I'm speculating here, I didn't check yet).

Jul 27, 2011 at 10:20 PM

I have one line of javascript in the document.cshtml.  (see below.) Do you think that it causes the problem?

@

using Orchard.Mvc.Html;

@

using Orchard.UI.Resources;

@{RegisterLink(

 

new LinkEntry {Type = "image/x-icon", Rel = "shortcut icon", Href = Url.Content("../Content/favicon.ico")});

 

//a bit opinionated - only the site name on the homepage
 

 

var title = (Context.Request.Path.TrimEnd('/') != Context.Request.ApplicationPath && HasText(Model.Title)

? Model.Title + WorkContext.CurrentSite.PageTitleSeparator

<!

DOCTYPE html> <html lang="en" class="static @Html.ClassForPage()"> <head> <meta charset="utf-8" /><title>@title</title>

</

head> <body >

@*

Layout (template) is in the Body zone @ the default position (nothing, zero, zilch) *@

@Display(Model.Body)

@Display(Model.Tail)

</

body > </html >

WorkContext.CurrentSite.SiteName;}

@Display(Model.Head)

 

<script type="text/javascript">(function(d){d.className="dyn"+d.className.substring(6,d.className.length);})(document.documentElement);</script>

:"") +

Coordinator
Jul 27, 2011 at 10:24 PM

No, that looks fine. Time to open Firebug and see what's loading and what's not.

Jul 27, 2011 at 11:30 PM

The shape tracing UI has 6 taps ( Shape, Model, Placement, Template, HTML).  All taps except Shape are working. 

I am using the 1.2.41 source code in the VS2010. I use SQL Compact Edition.  My browser is IE and I have not used a firebug.   I also disabled a debug mode. 

I also noticed a empty Model folder in the Designer Tool Module. 

Coordinator
Jul 27, 2011 at 11:33 PM

Can you try switching to a different theme such as TheThemeMachine just to check if it really comes from the theme?

Jul 27, 2011 at 11:49 PM

I switched the theme but I have the same probelm.  I am guessing that it may have someting to do with IE security setting. Any possibilities therre.  I used modernizr_latest.js.

Coordinator
Jul 27, 2011 at 11:52 PM

Maybe. What do you see in developer tools in IE, in the network tab?

Jul 28, 2011 at 12:23 AM

I discovered that designertools module has couple scripts that require jquery 1.4.2.

They are in Orchard.Source.1.2.41\src\Orchard.Web\Modules\Orchard.DesignerTools\Scripts. (  jquery.tmpl.js, jquery.tmpl.min.js)

Could it be a conflict between jQuery versions?

Coordinator
Jul 28, 2011 at 12:35 AM

Yes. But all jQuery should be included using Script.Require.

Jul 28, 2011 at 1:36 AM

I noticed that jquery 1.4.2 was loaded from the google CDN but the jquesy 1.6.1 was loaded from Core/Scripts.

How does the extention module choose which version to use? 

Coordinator
Jul 28, 2011 at 1:37 AM

What includes each? There should be only one.

Jul 28, 2011 at 1:49 AM

When I look at anonymous code tab at the Developer Tool, it looks like that both versions were loaded.

 IE seems to create many anonymous functions and I am not sure which funtion uses which version.

Coordinator
Jul 28, 2011 at 2:50 AM

Again, there should be only one. You need to find what includes each and fix one of them. A search on "1.4.2" and "1.6.1" should do the trick.

Jul 28, 2011 at 7:57 AM

I do not think that it is caused by whay I did.  I downloaded and unziped the Orchard.Source.1.2.41.zip. Then I opened it with VS2010.

Only thing I did was to install the following extention module using the dashboard menu, Module, and Gallery tap.

Designer Tools - Version: 1.2.41

Contains designer tools to ease the Themes development process

The shape tracing UI has 6 taps ( Shape, Model, Placement, Template, HTML).  All taps except Shape are working. 

I used SQL Compact Edition.  My browser is IE8.

I have used MVC for a while but I am just trying out the Orchard now.

 I'd really like to use it as one of the main software frameworks for building real work business apps.

Designer Tools are the key extentions I need to use.  Your help in resolving this issue will be highly appreciated. 

Is this related to full trust? In think that VS2010 defult not a full-trust mode.

Coordinator
Jul 29, 2011 at 1:47 AM

Here's the thing: higher up on the thread, you said that you could see two versions of jQuery being included. This is not right, and it's not going to work. You *need* to find what is including a second copy of jQuery. I'm 99% positive that is your problem from what I see. As I already said, you can do a search on "1.4.2" and "1.6.1" through the site's directory, and it should be a matter of seconds for you to find the guilty module or theme.

Jul 29, 2011 at 3:59 AM

I was just guessing about the two versions of jQuery since I kept getting a script error.  (Microsoft JScript runtime error: '$value' is null or not an object)

(I sad it "looks like"...)

In any case,  here is exactly what I did:

1) I downloaded and unziped the Orchard.Source.1.2.41.zip.

2) Then I opened the solution in the src folder with VS2010.

3) Then I chose all the default options and started the web site.

4) I enabled the shape and url alternate modules using the Admin Dashboard.

5) I opened default website and started the shape tracing UI .

6)  I chose the date field in the default website. The shape tracing UI has 6 taps ( Shape, Model, Placement, Template, HTML).  All taps except Shape are working. 

Everytime I hit the Shape tab, I get the script error I metioned.  (Microsoft JScript runtime error: '$value' is null or not an object)

I did not add a single line of script or code to the orchard project.  How can I resolve this script error.

I am not interested in criticing your project. I am interested in utilizing this great project.  I really appreciate your help.

Thanks.

Jul 29, 2011 at 1:52 PM

It's a bug! Only IE(8) has this problem. I used it in Chrome and Firefox and both works fine. Only IE8 gives me an error.

'$value' is empty or not an object
Line: 16
Character: 12187
Code: 0
URI: http://localhost:48145/Modules/Orchard.jQuery/scripts/jquery-1.6.1.min.js

Jul 29, 2011 at 6:30 PM

Thank you for your information.  Many people still use the IE8.  Is there any work around or fix for this problem? 

Coordinator
Jul 29, 2011 at 7:47 PM

I'm sorry, you confused me in a mojor way when you said "I noticed that jquery 1.4.2 was loaded from the google CDN but the jquesy 1.6.1 was loaded from Core/Scripts". I'm still struggling to figure out what you meant by that or what you were referring to.

For the IE8 bug, please file it in the issue tracker.

Jul 30, 2011 at 4:37 PM

I was trying the orchard out first time and I was confused. about the what I was looking at.  (sorry for causing the confusion.)

This was confusing at first but  I learned a lot about all the freatures on the dashboard.   

I just down;loaded IE9 and this issue is now resolved..

However, I have another problem.  I could not display video in IE9 using the HTML5 video tag.   

I was using the Media Picker Field and HTML5 video tag.

I will search for an resolution from the existing discussion. If no resolution, I will start a new thread on this video problem.

Thanks.

Coordinator
Aug 3, 2011 at 1:14 AM

Is there something that would work outside of Orchard and that doesn't otherwise? Can you provide reproduction steps?