Вход Регистрация
Файл: plugins/p_fckeditor/fckeditor/editor/dialog/fck_div.html
Строк: 397
<?php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<!--
 * 
FCKeditor The text editor for Internet http://www.fckeditor.net
 
Copyright (C2003-2010 Frederico Caldeira Knabben
 
*
 * == 
BEGIN LICENSE ==
 *
 * 
Licensed under the terms of any of the following licenses at your
 
choice:
 *
 *  - 
GNU General Public License Version 2 or later (the "GPL")
 *    
http://www.gnu.org/licenses/gpl.html
 
*
 *  - 
GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    
http://www.gnu.org/licenses/lgpl.html
 
*
 *  - 
Mozilla Public License Version 1.1 or later (the "MPL")
 *    
http://www.mozilla.org/MPL/MPL-1.1.html
 
*
 * == 
END LICENSE ==
 *
 * 
Form dialog window.
-->
<
html xmlns="http://www.w3.org/1999/xhtml">
<
head>
    <
title></title>
    <
meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <
meta content="noindex, nofollow" name="robots" />
    <
script src="common/fck_dialog_common.js" type="text/javascript"></script>
    <
script type="text/javascript">
var 
dialog    window.parent ;
var 
oEditor dialog.InnerDialogLoaded() ;
var 
FCK oEditor.FCK ;
var 
FCKLang oEditor.FCKLang ;
var 
FCKBrowserInfo oEditor.FCKBrowserInfo ;
var 
FCKStyles oEditor.FCKStyles ;
var 
FCKElementPath oEditor.FCKElementPath ;
var 
FCKDomRange oEditor.FCKDomRange ;
var 
FCKDomTools oEditor.FCKDomTools ;
var 
FCKDomRangeIterator oEditor.FCKDomRangeIterator ;
var 
FCKListsLib oEditor.FCKListsLib ;
var 
AlwaysCreate dialog.Args().CustomValue ;

String.prototype.IEquals = function()
{
    var 
thisUpper this.toUpperCase() ;

    var 
aArgs arguments ;

    
// The arguments could also be a single array.
    
if ( aArgs.length == && aArgs[0].pop )
        
aArgs aArgs[0] ;

    for ( var 
aArgs.length i++ )
    {
        if ( 
thisUpper == aArgs[i].toUpperCase() )
            return 
true ;
    }
    return 
false ;
}

var 
CurrentContainers = [] ;
if ( !
AlwaysCreate )
{
    
dialog.Selection.EnsureSelection() ;
    
CurrentContainers FCKDomTools.GetSelectedDivContainers() ;
}

// Add some tabs
dialog.AddTab'General'FCKLang.DlgDivGeneralTab );
dialog.AddTab'Advanced'FCKLang.DlgDivAdvancedTab ) ;

function 
AddStyleOptionstyleName )
{
    var 
el GetE'selStyle' ) ;
    var 
opt document.createElement'option' ) ;
    
opt.text opt.value styleName ;

    if ( 
FCKBrowserInfo.IsIE )
        
el.addopt ) ;
    else
        
el.addoptnull ) ;
}

function 
OnDialogTabChangetabCode )
{
    
ShowE'divGeneral'tabCode == 'General' ) ;
    
ShowE'divAdvanced'tabCode == 'Advanced' ) ;
    
dialog.SetAutoSizetrue ) ;
}

function 
GetNearestAncestorDirectionnode )
{
    var 
dir 'ltr' ;    // HTML default.
    
while ( ( node node.parentNode ) )
    {
        if ( 
node.dir )
            
dir node.dir ;
    }
    return 
dir ;
}

window.onload = function()
{
    
// First of all, translate the dialog box texts
    
oEditor.FCKLanguageManager.TranslatePage(document) ;

    
dialog.SetOkButtontrue ) ;
    
dialog.SetAutoSizetrue ) ;

    
// Popuplate the style menu
    
var styles FCKStyles.GetStyles() ;
    var 
selectableStyles = {} ;
    for ( var 
i in styles )
    {
        if ( ! /^
_FCK_/.test) && styles[i].Element == 'div' )
            
selectableStyles[i] = styles[i] ;
    }
    if ( 
CurrentContainers.length <= )
    {
        var 
target CurrentContainers[0] ;
        var 
match null ;
        for ( var 
i in selectableStyles )
        {
            if ( 
target && styles[i].CheckElementRemovabletargettrue ) )
                
match ;
        }
        if ( !
match )
            
AddStyleOption"" ) ;
        for ( var 
i in selectableStyles )
            
AddStyleOption) ;
        if ( 
match )
            
GetE'selStyle' ).value match ;

        
// Set the value for other inputs
        
if ( target )
        {
            
GetE'txtClass' ).value target.className ;
            
GetE'txtId' ).value target.id ;
            
GetE'txtLang' ).value target.lang ;
            
GetE'txtInlineStyle').value target.style.cssText ;
            
GetE'txtTitle' ).value target.title ;
            
GetE'selLangDir').value target.dir || GetNearestAncestorDirectiontarget ) ;
        }
    }
    else
    {
        
GetE'txtId' ).disabled true ;
        
AddStyleOption"" ) ;
        for ( var 
i in selectableStyles )
            
AddStyleOption) ;
    }
}

function 
CreateDiv()
{
    var 
newBlocks = [] ;
    var 
range = new FCKDomRangeFCK.EditorWindow ) ;
    
range.MoveToSelection() ;

    var 
bookmark range.CreateBookmark() ;

    
// Kludge for #1592: if the bookmark nodes are in the beginning of
    // $tagName, then move them to the nearest block element in the
    // $tagName.
    
if ( FCKBrowserInfo.IsIE )
    {
        var 
bStart    range.GetBookmarkNodebookmarktrue ) ;
        var 
bEnd    range.GetBookmarkNodebookmarkfalse ) ;

        var 
cursor ;

        if ( 
bStart
                
&& bStart.parentNode.nodeName.IEquals'div' )
                && !
bStart.previousSibling )
        {
            
cursor bStart ;
            while ( ( 
cursor cursor.nextSibling ) )
            {
                if ( 
FCKListsLib.BlockElementscursor.nodeName.toLowerCase() ] )
                    
FCKDomTools.MoveNodebStartcursortrue ) ;
            }
        }

        if ( 
bEnd
                
&& bEnd.parentNode.nodeName.IEquals'div' )
                && !
bEnd.previousSibling )
        {
            
cursor bEnd ;
            while ( ( 
cursor cursor.nextSibling ) )
            {
                if ( 
FCKListsLib.BlockElementscursor.nodeName.toLowerCase() ] )
                {
                    if ( 
cursor.firstChild == bStart )
                        
FCKDomTools.InsertAfterNodebStartbEnd ) ;
                    else
                        
FCKDomTools.MoveNodebEndcursortrue ) ;
                }
            }
        }
    }

    var 
iterator = new FCKDomRangeIteratorrange ) ;
    var 
block ;

    var 
paragraphs = [] ;
    while ( ( 
block iterator.GetNextParagraph() ) )
        
paragraphs.pushblock ) ;

    
// Make sure all paragraphs have the same parent.
    
var commonParent paragraphs[0].parentNode ;
    var 
tmp = [] ;
    for ( var 
paragraphs.length i++ )
    {
        
block paragraphs[i] ;
        
commonParent FCKDomTools.GetCommonParentsblock.parentNodecommonParent ).pop() ;
    }

    
// The common parent must not be the following tags: table, tbody, tr, ol, ul.
    
while ( commonParent.nodeName.IEquals'table''tbody''tr''ol''ul' ) )
        
commonParent commonParent.parentNode ;

    
// Reconstruct the block list to be processed such that all resulting blocks
    // satisfy parentNode == commonParent.
    
var lastBlock null ;
    while ( 
paragraphs.length )
    {
        
block paragraphs.shift() ;
        while ( 
block.parentNode != commonParent )
            
block block.parentNode ;
        if ( 
block != lastBlock )
            
tmp.pushblock ) ;
        
lastBlock block ;
    }
    
paragraphs tmp ;

    
// Split the paragraphs into groups depending on their BlockLimit element.
    
var groups = [] ;
    var 
lastBlockLimit null ;
    for ( var 
paragraphs.length i++ )
    {
        
block paragraphs[i] ;
        var 
elementPath = new FCKElementPathblock ) ;
        if ( 
elementPath.BlockLimit != lastBlockLimit )
        {
            
groups.push( [] ) ;
            
lastBlockLimit elementPath.BlockLimit ;
        }
        
groups[groups.length 1].pushblock ) ;
    }

    
// Create a DIV container for each group.
    
for ( var groups.length i++ )
    {
        var 
divNode FCK.EditorDocument.createElement'div' ) ;
        
groups[i][0].parentNode.insertBeforedivNodegroups[i][0] ) ;
        for ( var 
groups[i].length j++ )
            
FCKDomTools.MoveNodegroups[i][j], divNode ) ;
        
newBlocks.pushdivNode ) ;
    }

    
range.MoveToBookmarkbookmark ) ;
    
range.Select() ;

    
FCK.Focus() ;
    
FCK.Events.FireEvent'OnSelectionChange' ) ;

    return 
newBlocks ;
}

function 
Ok()
{
    
oEditor.FCKUndo.SaveUndoStep() ;

    if ( 
CurrentContainers.length )
        
CurrentContainers CreateDiv();

    var 
setValue = function( attrNameinputName )
    {
        var 
val GetEinputName ).value ;
        for ( var 
CurrentContainers.length i++ )
        {
            if ( 
val == '' )
                
CurrentContainers[i].removeAttributeattrName ) ;
            else
                
CurrentContainers[i].setAttributeattrNameval ) ;
        }
    }

    
// Apply modifications to the DIV container according to dialog inputs.
    
if ( CurrentContainers.length == )
    {
        
setValue'class''txtClass' ) ;
        
setValue'id''txtId' ) ;
    }
    
setValue'lang''txtLang' ) ;
    if ( 
FCKBrowserInfo.IsIE )
    {
        for ( var 
CurrentContainers.length i++ )
            
CurrentContainers[i].style.cssText GetE'txtInlineStyle' ).value ;
    }
    else
        
setValue'style''txtInlineStyle' ) ;
    
setValue'title''txtTitle' ) ;
    for ( var 
CurrentContainers.length i++ )
    {
        var 
dir GetE'selLangDir' ).value ;
        var 
styleName GetE'selStyle' ).value ;
        if ( 
GetNearestAncestorDirectionCurrentContainers[i] ) != dir )
            
CurrentContainers[i].dir dir ;
        else
            
CurrentContainers[i].removeAttribute'dir' ) ;

        if ( 
styleName )
            
FCKStyles.GetStylestyleName ).ApplyToObjectCurrentContainers[i] ) ;
    }

    return 
true ;
}

    </
script>
</
head>
<
body style="overflow: hidden">
    <
div id="divGeneral">
        <
table cellspacing="0" cellpadding="0" width="100%" border="0">
            <
colgroup span="2">
                <
col width="49%" />
                <
col width="2%" />
                <
col width="49%" />
            </
colgroup>
            <
tr>
                <
td>
                    <
span fcklang="DlgDivStyle">Style</span><br />
                    <
select id="selStyle" style="width: 100%;">
                    </
select>
                </
td>
                <
td>&nbsp;</td>
                <
td>
                    <
span fcklang="DlgGenClass">Stylesheet Classes</span><br />
                    <
input id="txtClass" style="width: 100%" type="text" />
                </
td>
            </
tr>
        </
table>
    </
div>
    <
div id="divAdvanced" style="display: none">
        <
table cellspacing="0" cellpadding="0" width="100%" border="0">
            <
colgroup span="2">
                <
col width="49%" />
                <
col width="2%" />
                <
col width="49%" />
            </
colgroup>
            <
tr>
                <
td>
                    <
span fcklang="DlgGenId">Id</span><br />
                    <
input style="width: 100%" type="text" id="txtId" />
                </
td>
                <
td>&nbsp;</td>
                <
td>
                    <
span fcklang="DlgGenLangCode">Language Code</span><br />
                    <
input style="width: 100%" type="text" id="txtLang" />
                </
td>
            </
tr>
            <
tr>
                <
td colspan="3">&nbsp;</td>
            </
tr>
            <
tr>
                <
td colspan="3">
                    <
span fcklang="DlgDivInlineStyle">Inline Style</span><br />
                    <
input style="width: 100%" type="text" id="txtInlineStyle" />
                </
td>
            </
tr>
            <
tr>
                <
td colspan="3">&nbsp;</td>
            </
tr>
            <
tr>
                <
td colspan="3">
                    <
span fcklang="DlgGenTitle">Advisory Title</span><br />
                    <
input style="width: 100%" type="text" id="txtTitle" />
                </
td>
            </
tr>
            <
tr>
                <
td>&nbsp;</td>
            </
tr>
            <
tr>
                <
td>
                    <
span fcklang="DlgGenLangDir">Language Direction</span><br />
                    <
select id="selLangDir">
                        <
option fcklang="DlgGenLangDirLtr" value="ltr">Left to Right (LTR)
                        <
option fcklang="DlgGenLangDirRtl" value="rtl">Right to Left (RTL)
                    </
select>
                </
td>
            </
tr>
        </
table>
    </
div>
</
body>
</
html>
?>
Онлайн: 0
Реклама