summaryrefslogtreecommitdiffstats
path: root/fckeditor.popup.html
blob: 6451e3ef8c3c7797567240e893b3d7b0f92da67e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>FCKeditor</title>
	<!-- $id$ -->
	<script type="text/javascript">

// #### URLParams: holds all URL passed parameters (like ?Param1=Value1&Param2=Value2)
var FCKURLParams = new Object() ;

var aParams = document.location.search.substr(1).split('&') ;
for ( var i = 0 ; i < aParams.length ; i++ )
{
	var aParam = aParams[i].split('=') ;
	var sParamName  = aParam[0] ;
	var sParamValue = aParam[1] ;

	FCKURLParams[ sParamName ] = sParamValue ;
}

// It is preferable to have the oFCKeditor object defined in the opener window,
// so all the configurations will be there. In this way the popup doesn't need
// to take care of the configurations "clonning".
var oFCKeditor = window.opener[ FCKURLParams[ 'var' ] ] ;
oFCKeditor.Width	= '100%' ;
oFCKeditor.Height	= '100%' ;
oFCKeditor.Value	= window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value ;

function Ok()
{
	var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ;

	window.opener.document.getElementById( FCKURLParams[ 'el' ] ).value = oEditor.GetXHTML( true ) ;		// "true" means you want it formatted.

	window.opener.focus() ;
	window.close() ;
}

function Cancel()
{
	var oEditor = FCKeditorAPI.GetInstance( oFCKeditor.InstanceName ) ;
	
	if ( oEditor.IsDirty() )
	{
		if ( !confirm( 'Are you sure you want to cancel? Your changes will be lost.' ) )
			return ;
	}

	window.close() ;
}

	</script>
</head>
<body>
	<table width="100%" height="100%">
		<tr>
			<td height="100%">
				<script type="text/javascript">

// For now, it is not possible to retrieve the output HTML, so we must do it by
// hand. Future implementations of FCKeditor could bring a
// oFCKeditor.CreateHtml() function.
document.write( '<input type="hidden" id="' + oFCKeditor.InstanceName + '" name="' + oFCKeditor.InstanceName + '" value="' + oFCKeditor._HTMLEncode( oFCKeditor.Value ) + '" style="display:none" />' ) ;
document.write( oFCKeditor._GetConfigHtml() ) ;
document.write( oFCKeditor._GetIFrameHtml() ) ;

				</script>
			</td>
		</tr>
		<tr>
			<td>
				<input type="button" value="Ok" onclick="Ok();" style="width:120px" />
				<input type="button" value="Cancel" onclick="Cancel();" />
			</td>
		</tr>
	</table>
</body>
</html>