Exemplo n.º 1
0
function addFckPopupJS($src)
{
    $res = "";
    $res .= "<script type=\"text/javascript\"><!--\n";
    // ---------------------------------------------------------------------------
    $res .= "function insItem() {\n";
    $type = getPopupSelType();
    switch ($type) {
        case "image":
            $res .= "dialogArguments = window.opener.FCKLastDialogInfo ;\n";
            $res .= "var oEditor\t\t= dialogArguments.Editor ;\n";
            $res .= "var FCK\t\t\t= oEditor.FCK ;\n";
            $res .= "var FCKLang\t\t= oEditor.FCKLang ;\n";
            $res .= "var FCKConfig\t= oEditor.FCKConfig ;\n";
            $res .= "var titleTxt = GetE('title_text').value;\n";
            $res .= "var altTxt = GetE('alt_text').value;\n";
            $res .= "// Get the selected item (if available).\n";
            $res .= "var oItem = FCK.Selection.GetSelectedElement() ;\n";
            $res .= "var bHasItem = ( oItem != null ) ;\n";
            $res .= "if ( bHasItem ) {\n";
            $res .= "FCK.Selection.Delete() ;\n";
            $res .= "}\n";
            $res .= "oItem = FCK.CreateElement( 'IMG' ) ;\n";
            $res .= "oItem.src=\"" . $src . "\" ;\n";
            $res .= "oItem.title=titleTxt ;\n";
            $res .= "oItem.alt=altTxt ;\n";
            break;
        case "flash":
            $res .= "dialogArguments = window.opener.FCKLastDialogInfo ;\n";
            $res .= "var oEditor\t\t= dialogArguments.Editor ;\n";
            $res .= "var FCK\t\t\t= oEditor.FCK ;\n";
            $res .= "var FCKLang\t\t= oEditor.FCKLang ;\n";
            $res .= "var FCKConfig\t= oEditor.FCKConfig ;\n";
            $res .= "var itemWidth = GetE('width').value;\n";
            $res .= "var itemHeight = GetE('height').value;\n";
            $res .= "var itemBgCol = GetE('bgcolor').value;\n";
            $res .= "// Get the selected item (if available).\n";
            $res .= "var oItem = FCK.Selection.GetSelectedElement() ;\n";
            $res .= "var bHasItem = ( oItem != null ) ;\n";
            $res .= "if ( bHasItem ) {\n";
            $res .= "FCK.Selection.Delete() ;\n";
            $res .= "}\n";
            $res .= "oItem = FCK.CreateElement( 'embed' ) ;\n";
            $res .= "oItem.src=\"" . $src . "\" ;\n";
            $res .= "oItem.bgcolor=itemBgCol ;\n";
            $res .= "oItem.width=itemWidth ;\n";
            $res .= "oItem.height=itemHeight ;\n";
            $res .= "oItem.type=\"application/x-shockwave-flash\" ;\n";
            $res .= "FCK.OnAfterSetHTML() ;\n";
            break;
        case "audio":
        case "video":
        case "streaming":
            addAjaxJs();
            // req. by our friend json..
            $res .= "dialogArguments = window.opener.FCKLastDialogInfo ;\n";
            $res .= "var oEditor\t\t= dialogArguments.Editor ;\n";
            $res .= "var FCK\t\t\t= oEditor.FCK ;\n";
            $res .= "var FCKLang\t\t= oEditor.FCKLang ;\n";
            $res .= "var FCKConfig\t= oEditor.FCKConfig ;\n";
            $res .= "var html_code = GetE('embed_code').value;\n";
            $res .= 'var parsed = unescape(html_code);' . "\n";
            $res .= 'parsed = parsed.evalJSON(true);' . "\n";
            $res .= "FCK.InsertHtml(parsed.code);\n";
            $res .= "FCK.OnAfterSetHTML() ;\n";
            break;
    }
    $res .= "window.close();\n";
    $res .= "}\n\n";
    // ---------------------------------------------------------------------------
    $res .= getPopupCommonCode();
    $res .= "--></script>\n";
    return $res;
}
Exemplo n.º 2
0
function addScriptaculousJs()
{
    return;
    if (!isset($GLOBALS["page"])) {
        return;
    }
    addCss('windows', 'framework');
    addAjaxJs();
    if (!isset($GLOBALS["_js_cache"])) {
        $GLOBALS["_js_cache"] = array();
    }
    if (!in_array('_scriptacolus_js', $GLOBALS["_js_cache"])) {
        $GLOBALS["_js_cache"][] = '_scriptacolus_js';
        $GLOBALS["page"]->add('<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/scriptaculous/src/scriptaculous.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/scriptaculous/lib/prototype.improvements.js "></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/scriptaculous/src/scriptaculous.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/scriptaculous/src/windows.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/scriptaculous/src/HelpBalloon.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/scriptaculous/src/notice.js"></script>' . "\n" . '<script type="text/javascript">' . '	setImgBalloonPath(\'' . getPathImage('fw') . 'balloon/images/\');' . '</script>', "page_head");
    }
}