javascript - How to resolve "Tridion is undefined" error in a Tridion popup page? - Stack Overflow

I am customizing the ribbon toolbar and adding a button to it. Whenever I click on that button, it will

I am customizing the ribbon toolbar and adding a button to it. Whenever I click on that button, it will open a aspx page allows authors to select some data, which gets appended to the existing RTF field content.

But when popup is opened it is having the below error in the browser (Internet Explorer).

Webpage error details

User Agent: Mozilla/4.0 (patible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0;     SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Thu, 5 Apr 2012 12:18:35 UTC


Message: 'Tridion' is undefined
Line: 1
Char: 1
Code: 0
URI: http://172.21.188.26:2694/WebUI/Core/stringresources.js

I can't find stringresources.js file in the specified location. Please suggest me a way to solve the problem.

ButtonReference.js file: Type.registerNamespace("RTFExtensions.Commands");

RTFExtensions.Commands.ButtonReference = function Commands$ButtonReference(name) { 
    Type.enableInterface(this, "RTFExtensions.Commands.ButtonReference"); 
    this.addInterface("Tridion.Cme.Command", [name || "ButtonReference"]); 
    this.addInterface("Tridion.Cme.FaCommand", [name || "ButtonReference"]); 
}; 

RTFExtensions.Commands.ButtonReference.prototype._isAvailable = function         ButtonReference$_isAvailable(target) { 
    if (target.editor.getDisposed()) { 
        return false; 
    } 

    return true; 
}; 

RTFExtensions.Commands.ButtonReference.prototype._isEnabled = function ButtonReference$_isEnabled(target) { 
    if (!Tridion.OO.implementsInterface(target.editor, "Tridion.FormatArea") ||             target.editor.getDisposed()) { 
        return false; 
    } 

    return true; 
};

RTFExtensions.Commands.ButtonReference.prototype._execute = function     ButtonReference$_execute(target) {
    if (target.item.isActivePopupOpened()) {
        return;
    }

    function ButtonReference$execute$onPopupCanceled(event) {
        target.item.closeActivePopup();
    };

    //var url = $config.expandEditorPath("/Popups/PopupReference.aspx", "RTFExtensions"); 
    var schemaId = $display.getView().getItem().getSchemaId();
    var ponentName = $display.getView().getItem().getTitle();
    //alert($display.getView().getItem().getId());
    alert($display.getView().getItem().getTitle());
    var url = "Editors/RTFExtensions/Popups/PopupReference.aspx?schemaId=" + schemaId + "&ponentName=" + ponentName;
    //var url = "Editors/RTFExtensions/Popups/PopupReference.aspx";
    alert("url is " + url);
    var dialogFeatures = $cme.Popups.ITEM_SELECT.FEATURES;
    var popup = $popup.create(url, dialogFeatures, null);

    $evt.addEventHandler(popup, "submit",
        function ButtonReference$execute$onPopupSubmitted(event) {
            // Update FA 
            var value = event.data.value;
            if (value) {
                alert("In Button Reference value:" + value);
                target.editor.applyHTML(value);
            }

            // Release 
            target.item.closeActivePopup();
        }
    );

    $evt.addEventHandler(popup, "unload", ButtonReference$execute$onPopupCanceled);

    target.item.setActivePopup(popup);
    popup.open();
}; 

PopupReference.js File:

Type.registerNamespace("RTFExtensions.Popups");

RTFExtensions.Popups.PopupReference = function (element) {
    Type.enableInterface(this, "RTFExtensions.Popups.PopupReference");
    this.addInterface("Tridion.Cme.View");
};

RTFExtensions.Popups.PopupReference.prototype.initialize = function () {
    alert("initialized");    
    $log.message("Initializing Button Reference popup...");
    this.callBase("Tridion.Cme.View", "initialize");

    var p = this.properties;
    var c = p.controls;

    p.HtmlValue = { value: null };
    c.SubmitButon = $("#Submit");   
    //asp dropdown
    //c.DropDown = $("#lookupvaluesDropdown");
    //alert($("#lookupvaluesDropdown").value + "in initialize");        
    $evt.addEventHandler(c.SubmitButon, "click", this.getDelegate(this._execute));

    //    $evt.addEventHandler(c.InsertButton, "OnSelectedIndexChanged", this.getDelegate(this._execute));
};

RTFExtensions.Popups.PopupReference.prototype._execute = function () {
    alert("executing");
    //alert($("#lookupvaluesDropdown").value);
    this.properties.HtmlValue.value = $("#lookupvaluesDropdown").value;
    alert(this.properties.HtmlValue.value + " in execute");
    this.fireEvent("submit", this.properties.HtmlValue);

    alert("after fire event");
    //$("#Submit").fireEvent("submit1", this.properties.HtmlValue);
    window.close();
};



$display.registerView(RTFExtensions.Popups.PopupReference); 

PopupReference.aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupReference.aspx.cs"
    Inherits="ButtonReference.Popups.PopupReference" %>

<%@ Import Namespace="Tridion.Web.UI.Core" %>
<%@ Import Namespace="Tridion.Web.UI" %>
<%@ Import Namespace="System.Web" %> 
<%@ Register TagPrefix="ui"  Namespace="Tridion.Web.UI.Editors.CME.Controls" Assembly="Tridion.Web.UI.Editors.CME"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ".dtd">

<html xmlns="" xmlns:cc="">
<head id="Head1" runat="server">
    <title>Reference Button Popup</title>
    <cc:tridionmanager runat="server" editor="PowerTools2011">
        <dependencies runat="server">
            <dependency runat="server">Powertools2011.Example</dependency>
            <dependency runat="server">Tridion.Web.UI.Editors.CME</dependency>
            <dependency runat="server">Tridion.Web.UI.Editors.CMEmands</dependency>
        </dependencies>
    </cc:tridionmanager>

</head>
<body>
    <form id="form1" runat="server">
    <div>        
        <h1>
            Reference Button Popup
        </h1>
        <table>        
        <tr><td><asp:DropDownList ID="lookupvaluesDropdown" runat="server"></asp:DropDownList></td></tr>
        <tr><td><asp:Button ID="Submit" runat="server" Text="Submit" /></td></tr>

        </table>
    </div>
    </form>
</body>
</html>

I am customizing the ribbon toolbar and adding a button to it. Whenever I click on that button, it will open a aspx page allows authors to select some data, which gets appended to the existing RTF field content.

But when popup is opened it is having the below error in the browser (Internet Explorer).

Webpage error details

User Agent: Mozilla/4.0 (patible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0;     SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E; InfoPath.3)
Timestamp: Thu, 5 Apr 2012 12:18:35 UTC


Message: 'Tridion' is undefined
Line: 1
Char: 1
Code: 0
URI: http://172.21.188.26:2694/WebUI/Core/stringresources.js

I can't find stringresources.js file in the specified location. Please suggest me a way to solve the problem.

ButtonReference.js file: Type.registerNamespace("RTFExtensions.Commands");

RTFExtensions.Commands.ButtonReference = function Commands$ButtonReference(name) { 
    Type.enableInterface(this, "RTFExtensions.Commands.ButtonReference"); 
    this.addInterface("Tridion.Cme.Command", [name || "ButtonReference"]); 
    this.addInterface("Tridion.Cme.FaCommand", [name || "ButtonReference"]); 
}; 

RTFExtensions.Commands.ButtonReference.prototype._isAvailable = function         ButtonReference$_isAvailable(target) { 
    if (target.editor.getDisposed()) { 
        return false; 
    } 

    return true; 
}; 

RTFExtensions.Commands.ButtonReference.prototype._isEnabled = function ButtonReference$_isEnabled(target) { 
    if (!Tridion.OO.implementsInterface(target.editor, "Tridion.FormatArea") ||             target.editor.getDisposed()) { 
        return false; 
    } 

    return true; 
};

RTFExtensions.Commands.ButtonReference.prototype._execute = function     ButtonReference$_execute(target) {
    if (target.item.isActivePopupOpened()) {
        return;
    }

    function ButtonReference$execute$onPopupCanceled(event) {
        target.item.closeActivePopup();
    };

    //var url = $config.expandEditorPath("/Popups/PopupReference.aspx", "RTFExtensions"); 
    var schemaId = $display.getView().getItem().getSchemaId();
    var ponentName = $display.getView().getItem().getTitle();
    //alert($display.getView().getItem().getId());
    alert($display.getView().getItem().getTitle());
    var url = "Editors/RTFExtensions/Popups/PopupReference.aspx?schemaId=" + schemaId + "&ponentName=" + ponentName;
    //var url = "Editors/RTFExtensions/Popups/PopupReference.aspx";
    alert("url is " + url);
    var dialogFeatures = $cme.Popups.ITEM_SELECT.FEATURES;
    var popup = $popup.create(url, dialogFeatures, null);

    $evt.addEventHandler(popup, "submit",
        function ButtonReference$execute$onPopupSubmitted(event) {
            // Update FA 
            var value = event.data.value;
            if (value) {
                alert("In Button Reference value:" + value);
                target.editor.applyHTML(value);
            }

            // Release 
            target.item.closeActivePopup();
        }
    );

    $evt.addEventHandler(popup, "unload", ButtonReference$execute$onPopupCanceled);

    target.item.setActivePopup(popup);
    popup.open();
}; 

PopupReference.js File:

Type.registerNamespace("RTFExtensions.Popups");

RTFExtensions.Popups.PopupReference = function (element) {
    Type.enableInterface(this, "RTFExtensions.Popups.PopupReference");
    this.addInterface("Tridion.Cme.View");
};

RTFExtensions.Popups.PopupReference.prototype.initialize = function () {
    alert("initialized");    
    $log.message("Initializing Button Reference popup...");
    this.callBase("Tridion.Cme.View", "initialize");

    var p = this.properties;
    var c = p.controls;

    p.HtmlValue = { value: null };
    c.SubmitButon = $("#Submit");   
    //asp dropdown
    //c.DropDown = $("#lookupvaluesDropdown");
    //alert($("#lookupvaluesDropdown").value + "in initialize");        
    $evt.addEventHandler(c.SubmitButon, "click", this.getDelegate(this._execute));

    //    $evt.addEventHandler(c.InsertButton, "OnSelectedIndexChanged", this.getDelegate(this._execute));
};

RTFExtensions.Popups.PopupReference.prototype._execute = function () {
    alert("executing");
    //alert($("#lookupvaluesDropdown").value);
    this.properties.HtmlValue.value = $("#lookupvaluesDropdown").value;
    alert(this.properties.HtmlValue.value + " in execute");
    this.fireEvent("submit", this.properties.HtmlValue);

    alert("after fire event");
    //$("#Submit").fireEvent("submit1", this.properties.HtmlValue);
    window.close();
};



$display.registerView(RTFExtensions.Popups.PopupReference); 

PopupReference.aspx page:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="PopupReference.aspx.cs"
    Inherits="ButtonReference.Popups.PopupReference" %>

<%@ Import Namespace="Tridion.Web.UI.Core" %>
<%@ Import Namespace="Tridion.Web.UI" %>
<%@ Import Namespace="System.Web" %> 
<%@ Register TagPrefix="ui"  Namespace="Tridion.Web.UI.Editors.CME.Controls" Assembly="Tridion.Web.UI.Editors.CME"  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3/1999/xhtml" xmlns:cc="http://www.sdltridion./web/ui/core/controls">
<head id="Head1" runat="server">
    <title>Reference Button Popup</title>
    <cc:tridionmanager runat="server" editor="PowerTools2011">
        <dependencies runat="server">
            <dependency runat="server">Powertools2011.Example</dependency>
            <dependency runat="server">Tridion.Web.UI.Editors.CME</dependency>
            <dependency runat="server">Tridion.Web.UI.Editors.CME.mands</dependency>
        </dependencies>
    </cc:tridionmanager>

</head>
<body>
    <form id="form1" runat="server">
    <div>        
        <h1>
            Reference Button Popup
        </h1>
        <table>        
        <tr><td><asp:DropDownList ID="lookupvaluesDropdown" runat="server"></asp:DropDownList></td></tr>
        <tr><td><asp:Button ID="Submit" runat="server" Text="Submit" /></td></tr>

        </table>
    </div>
    </form>
</body>
</html>
Share Improve this question edited Apr 9, 2012 at 15:17 Frank van Puffelen 601k85 gold badges890 silver badges860 bronze badges asked Apr 5, 2012 at 12:21 P.MuralikrishnaP.Muralikrishna 1,2899 silver badges31 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

This means that the JavaScript from Tridion is not loaded. Did you include the

<cc:tridionmanager runat="server" editor="PowerTools"> 

UserControl on your popup page?

I might be repeating myself, but have you tried following any of the available Tutorials for creating a GUI extension?

Can you get any of those to work?

Hint: google for "Tridion gui extension tutorial"

I recently got the same error, though likely for different reasons.

  1. Robert Curlette (RCWeb) has a great guide on the two now-familiar "broken" GUI screens.
  2. We also have a good tip from the PowerTools wiki, specifically from Peter Kjaer:

Visit the resource directly http://{hostname}/WebUI/Editors/CME/Views/Dashboard/Dashboard_v6.{version number}_.aspx?mode=js

I can see this in Chrome's console with a missing service dll. I get the same Tridion is not defined error, but another one for the Dashboard. You can right-click on the Dashboard_... link, open a new tab, and get more information.

Uncaught SyntaxError: Unexpected token < Dashboard_v6.1.0.55920.2_.aspx?mode=js:3
Uncaught ReferenceError: Tridion is not defined stringresources.js:1
(anonymous function) stringresources.js:1

In my specific case, I had the following.

Exception of type 'System.Web.HttpUnhandledException' was thrown.
Could not find file 'C:\Program Files (x86)\Tridion\PowerTools\Model\Services\{one of the many outstanding contributions}.svc'.

Removing the offending file in the Model configuration file fixed my error. Though we may never know what really happened in the mysterious case of the Two Items in a Query String.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745325692a4622645.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信