このようにJavaScriptで標準の'InsertCpDialog$ initialize()'を使用して、初期化されたら他の関数を呼び出すことができますか?以下のコードのように使用しましたが、機能していません。:(
Type.registerNamespace("Extensions");
Extensions.InsertCpDialog.prototype.initialize = function InsertCpDialog$initialize()
{
alert('hi inside insert');
var p = this.properties;
if(window.document.nameProp == "Name" || window.document.title == "Name") {
var browserName=navigator.appName; // Get the Browser Name
if(browserName=="Microsoft Internet Explorer") // For IE
{
alert('hi inside IE');
//window.onload=init(); // Call init function in IE
}
else
{
if (document.addEventListener) // For Firefox
{
alert('hi inside firefox');
//document.addEventListener("DOMContentLoaded", init(), false); // Call init function in Firefox
}
}
}
}
オリジナル(標準)のものは次のようなものです:
Type.registerNamespace ("Tridion.Cme.Views");
Tridion.Cme.Views.InsertCpDialog = function InsertCpDialog()
{
Type.enableInterface(this, "Tridion.Cme.Views.InsertCpDialog");
this.addInterface("Tridion.Cme.Views.DashboardBase");
};
Tridion.Cme.Views.InsertCpDialog.prototype.initialize = function InsertCpDialog$initialize()
{
}
編集
こんにちは率直に言ってありがとう、しかし私はすでに私のコードで同じものを使用して、CPタブの下のページにリストされているコンポーネントとテンプレートのリストを取得しています。
function getbtn() {
//alert('inside getbtn');
var sbtn = document.getElementById ("buttonComponentInsert");
$evt.addEventHandler(sbtn , "click", getListofCPBtnClick);
}
function getListofCPBtnClick(e) {
//code will go here
}
私の質問は:[ CPの挿入]ウィンドウ から選択したコンポーネントとテンプレートIDを取得する必要があります。以前はCME拡張機能の標準コードを変更することで取得できましたが、そうすることは想定されていません。そのため、最初に初期化しようとしています。私のjavascriptコードから「CPウィンドウを挿入」。そのウィンドウのイベントハンドラーを作成できますが、私の質問は、初期化されたら任意の関数を呼び出すことができるように、それを初期化する方法です。はっきりしない場合はお知らせください。