2012-04-05 69 views
4

我正在自定義功能區工具欄併爲其添加按鈕。每當我點擊那個按鈕,它就會打開一個aspx頁面,允許作者選擇一些數據,並將其附加到現有的RTF字段內容中。如何解決Tridion彈出頁面中的「Tridion is undefined」錯誤?

但彈出打開它是一種在瀏覽器(Internet Explorer)中下面的錯誤時。

Webpage error details 

User Agent: Mozilla/4.0 (compatible; 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 

我在指定位置找不到stringresources.js文件。請給我一個解決問題的方法。

ButtonReference.js文件: 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 componentName = $display.getView().getItem().getTitle(); 
    //alert($display.getView().getItem().getId()); 
    alert($display.getView().getItem().getTitle()); 
    var url = "Editors/RTFExtensions/Popups/PopupReference.aspx?schemaId=" + schemaId + "&componentName=" + componentName; 
    //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文件:

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 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.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:cc="http://www.sdltridion.com/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.commands</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> 

回答

5

這意味着,從外表套上JavaScript的未加載。您是否包含

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

您的彈出頁面上的UserControl?

+0

謝謝你的迴應。我沒有包含這個標籤。你能告訴我在哪裏包括這個?提前致謝。 – 2012-04-05 12:37:56

+0

將其包含在popup.aspx頁面中。如果您想要(更多)示例,請查看code.google.com上的PowerTools項目。在整個項目中搜索:TridionManager。這應該給你足夠的信息讓你開始。 – 2012-04-05 12:43:56

+0

當我嘗試添加標籤時,它會給出錯誤,如未知標籤前綴或過濾器。我需要將它作爲前綴嗎? – 2012-04-05 13:07:36

3

我可能會重複自己,但你有沒有試過以下任何可用的教程創建一個圖形用戶界面的擴展?

你能得到任何這些工作?

提示:谷歌爲「外表套上GUI擴展教程」

3

我最近得到了同樣的錯誤,但可能出於不同的原因。

  1. Robert Curlette(RCWeb)在兩個now-familiar "broken" GUI screens上有很好的指導。
  2. 我們也有從PowerTools wiki一個很好的提示,特別是從彼得·克亞爾:

訪問的資源直接 的http:// {}主機名/ Web用戶界面/編輯/ CME /瀏覽/儀表板/ Dashboard_v6 。{version number} _。aspx?mode = js

我可以在Chrome的控制檯中看到這個缺少服務的DLL。我得到了相同的Tridion is not defined錯誤,但另一個用於儀表板。您可以右鍵單擊Dashboard _...鏈接,打開一個新選項卡並獲取更多信息。

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 

在我的具體情況下,我有以下幾點。

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'. 

刪除模型配置文件中的違規文件修復了我的錯誤。雖然我們可能永遠不會知道查詢字符串中兩個項目的神祕案例中發生了什麼。

相關問題