diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/dialog/googleMaps.html b/main/inc/lib/fckeditor/editor/plugins/googlemaps/dialog/googleMaps.html new file mode 100644 index 0000000000..062805b8e4 --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/dialog/googleMaps.html @@ -0,0 +1,118 @@ + + + +
+| + + + | ++ + + | ++ Zoom Level + + | ++ + + | +
| + + + | ++ + + | +
You should have been redirected to the documentation
+ + \ No newline at end of file diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/install.html b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/install.html new file mode 100644 index 0000000000..044f5bd684 --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/install.html @@ -0,0 +1,156 @@ + + + + +This is a dialog-based plugin to handle insertion and modification of Google + Maps in FCKeditor
+Alfonso Martínez de Lizarrondo
+Get the latest version and/or updated info
+The 'Preview' command in FCKeditor won't work properly if there's a GoogleMap + in the content. This seems related to the way the Google Maps API script loads + and inserts its content.
+These threads in the API group point to the same problem:
+ http://groups.google.com/group/Google-Maps-API/browse_thread/thread/7849dfd612181b6c/1c3e5f7fb5fa3301
+http://groups.google.com/group/Google-Maps-API/browse_thread/thread/89ea5fa4e0a0ccb9/05c364940447891d
A workaround for the problem could be to use the Server +preview plugin
+Extract the contents of the zip in you plugins directory, so it ends up like
+ this
+ 
+editor\ + ... + js\ + lang\ + plugins\ + ... + googlemaps\ + fckplugin.js + readme.html + dialog\ + docs\ + images\ + lang\ + ... + skins\ ++
Now add in your fckconfig.js or custom js configuration
+file the following line:
+FCKConfig.Plugins.Add( 'googlemaps', 'de,en,es,fr,it,nl') ;
+
Add the button 'googlemaps' (lowercase) to your toolbarset:
+FCKConfig.ToolbarSets["Basic"] = [
+
+ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink',
+ '-','googlemaps','-','About']
+] ;
The most important part is your GoogleMaps key. It must be set properly for
+ the
+ plugin to work, or Google will refuse to serve the maps data.
+ You must get one for each server where you want to use the plugin, just get
+ the key for free here after agreeing to the Terms of Use of the GoogleMaps
+ API: http://www.google.com/apis/maps/signup.html
+ (Please don't ask questions about where you can use GoogleMaps or how to get
+ key,
+ those items aren't related to this plugin.)
+ For example the key for "localhost" is
+ ABQIAAAAlXu5Pw6DFAUgqM2wQn01gxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSy5hTGQdsosYD3dz6faZHVrO-02A
Once you get the key, you must set it in the configuration file:
+FCKConfig.GoogleMaps_Key = 'ABQIAAAAlXu5Pw6DFAUgqM2wQn01gxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSy5hTGQdsosYD3dz6faZHVrO-02A'
+ ;
+
(remember to replace the key in green with your own one)
+Note: if you leave an empty string then the toolbar icon won't be shown (so you can easily use the same toolbar configuration as the current +setup in FCKeditor doesn't allow to add/remove plugins/ToolbarIcons in a really easy way)
+There are several options that you can set to change the default values for + a new map:
+All these values can be set in the fckconfig.js file, a custom js configuration + file, or at the moment of the creation of the FCKeditor instance using any + language.
+Now empty the cache of your browser and reload the editor, the new button
+
should
+ be ready to use.
If you find this plugin useful, consider making a donation so it can be further +improved, any amount can help to keep the development running.
+ +If you need some special feature for this plugin, or if you need any other kind of plugin +for FCKeditor then contact me and we can discuss it
+FCKeditor is © FredCK.com
+Google, Google Maps and the Google Maps API are all properties of Google.
+ + diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/install_es.html b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/install_es.html new file mode 100644 index 0000000000..53e2d5bf0c --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/install_es.html @@ -0,0 +1,152 @@ + + + + +Este es un plugin basado en una ventana de dialogo para controlar la inserción + y modificación de Mapas Google en FCKeditor
+Alfonso Martínez de Lizarrondo
+Descarga la última versión + y/o información actualizada
+El botón de 'Previsualizar' en FCKeditor no funcionará correctamente si hay + algún mapa en el contenido. El problema parece debido a la forma en que la + API de Google Maps realiza la inserción y carga del contenido adicional.
+Estos temas en el grupo del API apuntan al mismo problema :
+ http://groups.google.com/group/Google-Maps-API/browse_thread/thread/7849dfd612181b6c/1c3e5f7fb5fa3301
+http://groups.google.com/group/Google-Maps-API/browse_thread/thread/89ea5fa4e0a0ccb9/05c364940447891d
Una solución para este problema podría ser utilizar el plugin de Previsualización + mediante el servidor
+Extrae los contenidos del zip en tu carpeta de plugins, de forma que quede
+ como a continuación
+
+editor\ + ... + js\ + lang\ + plugins\ + ... + googlemaps\ + fckplugin.js + readme.html + dialog\ + docs\ + images\ + lang\ + ... + skins\ ++
Ahora incluye en tu fckconfig.js o fichero de configuración que estes
+ usando la siguiente linea:
+FCKConfig.Plugins.Add( 'googlemaps', 'de,en,es,fr,it,nl') ;
Añade el botón 'googlemaps' (en minúsculas) a tu barra de
+ botones:
+FCKConfig.ToolbarSets["Basic"] = [
+
+ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink',
+ '-','googlemaps','-','About']
+] ;
La parte más importante es tu clave para GoogleMaps. Debe estar establecida
+ correctamente para que el plugin funcione, ya que sino Google no proporcionará
+ los datos para el mapa.
+ Debes obtener una para cada servidor donde quieras utilizar el plugin, puedes
+ obtenerlas gratuitamente aquí tras aceptar las condiciones de uso de los Mapas
+ Google: http://www.google.com/apis/maps/signup.html
+ (Por favor, no hagais preguntas sobre en que sitios se puede usar GoogleMaps
+ o cómo conseguir la clave, ya que son temas que no están relacionados con el
+ plugin.)
+ Por ejemplo, la clave para "localhost" es
+ABQIAAAAlXu5Pw6DFAUgqM2wQn01gxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSy5hTGQdsosYD3dz6faZHVrO-02A
Una vez que tengas la clave, has de añadirla a tu fichero de configuración:
+FCKConfig.GoogleMaps_Key = 'ABQIAAAAlXu5Pw6DFAUgqM2wQn01gxT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSy5hTGQdsosYD3dz6faZHVrO-02A'
+ ;
(recuerda que has de sustituir la clave en verde por la tuya)
+Nota: si dejas esa variable como una cadena en blanco entonces el icono no se mostrará (así se puede reutilizar la misma configuración +de la barra para diferentes situaciones y dependiendo de esa variable se mostrará o no, ya que el sistema actual de FCKeditor no permite +el añadir/eliminar plugins o botones de una forma realmente sencilla)
+Hay varias opciones que puedes establecer para cambiar los valores por defecto + con los que se crearán los nuevos mapas:
+Estos valores pueden establecerse en el fichero fckconfig.js, + un fichero de configuración personalizado o en el momento de creación del FCKeditor + utilizando cualquier lenguaje.
+ +Ahora vacía la caché del navegador, recarga el editor y el nuevo
+ botón
+
debería
+ estar listo para usarse .
Si ves que este plugin es útil, considera la opción de realizar una donación + para que pueda ser mejorado, cualquier cantidad ayudará a que el desarrollo + siga adelante.
+ +Si necesitas alguna funcionalidad especial para este plugin, o si necesitas + cualquier otro plugin para FCKeditor, contacta conmigo y hablaremos sobre el + tema
+FCKeditor © FredCK.com
+Google, Google Maps y el API de Google Maps son propiedades de Google.
+ + diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/installation.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/installation.png new file mode 100644 index 0000000000..f1abb18f06 Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/installation.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/marker.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/marker.png new file mode 100644 index 0000000000..24d250aeff Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/marker.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/preview.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/preview.png new file mode 100644 index 0000000000..b05063084b Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/preview.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/styles.css b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/styles.css new file mode 100644 index 0000000000..58ae80a0d6 --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/styles.css @@ -0,0 +1,59 @@ +body { + font-family: Arial, Helvetica, sans-serif; + font-size: 90%; +} +h1 { + text-align:center; + font-size:180%; +} +h2 { + border-bottom:2px solid #CCC; + margin:1em 0 0.4em 0; +} +h3 { + margin-bottom:0.4em; +} +p { + margin:0 0 1em 1em; + text-align:justify; +} +ol { + margin:0 0 1.2em 1em; + padding:0; + list-style-type:none; +} +ol li { + margin:0.2em 0; +} +pre, code { + font-size:100%; + font-family:"Courier New", Courier, mono; + background-color: #CCCCCC; + border:1px solid #999; + padding:0.2em 1em; + margin: 0.4em 0; + display:block; + white-space: pre; + overflow: auto; +} +form { + margin:0 0 0 1em; +} +span.key { + color: #006600; +} +#install { + display:none +} +#languages ul { + display:inline; + list-style-type:none; + margin:0; + padding:0; +} +#languages li { + display:inline; + margin:0; + padding:0; + vertical-align:bottom; +} \ No newline at end of file diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/uk.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/uk.png new file mode 100644 index 0000000000..264f39fa05 Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/uk.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog1.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog1.png new file mode 100644 index 0000000000..e98213b9eb Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog1.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog2.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog2.png new file mode 100644 index 0000000000..91b2980af4 Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog2.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog3.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog3.png new file mode 100644 index 0000000000..4e7fa19352 Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog3.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog4.png b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog4.png new file mode 100644 index 0000000000..0d96c3ffc8 Binary files /dev/null and b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/user_dialog4.png differ diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/users.html b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/users.html new file mode 100644 index 0000000000..4e6d7f2fed --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/users.html @@ -0,0 +1,110 @@ + + + + +This dialog allows to handle the insertion and modification of Google + Maps in FCKeditor
+Press the
button
+ in the FCKeditor toolbar, and a new dialog will open allowing to configure
+ the parameters of the map that you want to show.
+
+
+
+
+
+
+
With these inputs you can control the dimensions of the map as they will appear + in your final page. You can also drag and resize the placeholder image that + appears while you are in the editor.
+You can control this way the level of zoom of the map. You can use either + the top dropdown or the embeded + and - controls in the map.
+These inputs set the center of the map. You can also use the arrow buttons + embeded in the map or even drag and drop the map itself.
+Input here the location that you want to search and if it is properly found + then the map will re-center automatically and add a marker to + that point. To be able to find what you want separate each item with a comma: + "street, city, country"
+By pressing this button you can add a marker at any place in the map. It's + properties window will open and you can change the text or delete the marker. + You can the placement of any marker dragging it around.
+
+
+
This is the text that will appear if the visitor clicks on the marker (you + can test it in the Map tab).
+With this tab you can drag a polyline accross the map, and adjust each of + its points dragging the markers that appear while you are here.
+When you go close the dialog, a placeholder item will be added to your content + representing the current map. It will have the proper dimensions and a black + border around it, and it will feature a Google Maps logo at the center.
+You can click to select it and drag one of the corners to resize it, but remember + that the center of the map and the position of the marker won't change, so + you might need to check again in the editing dialog that everything is fine
+ 
You can add to your page as many maps as you want, the system is prepared + to work with various maps at the same time.
+To edit an existing map you can select it and then click again the toolbar + button, or use the entry in the context menu, or even just double click it. + Whatever you want.
+Existe un problema por el cual si intentas hacer una previsualización en FCKeditor + de una página que contiene un mapa, la previsualización no se mostrará
+If you find this plugin useful, consider making a donation so it can be further +improved, any amount can help to keep the development running.
+ +If you need some special feature for this plugin, or if you need any other kind of plugin +for FCKeditor then contact me and we can discuss it: amla70 at gmail dot com
+FCKeditor is © FredCK.com
+Google, Google Maps and the Google Maps API are all properties of Google.
+ + diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/users_es.html b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/users_es.html new file mode 100644 index 0000000000..6cc3b8746e --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/docs/users_es.html @@ -0,0 +1,110 @@ + + + + +Esta ventana permite insertar y modificar Mapas + Google en FCKeditor
+Pulsa el botón
en
+ la barra de botones de FCKeditor, y se abrirá una ventana para configurar los
+ parámetros del mapa que quieres mostrar.
+
+
+
+
+
+
+
Con estas casillas puedes controlar las dimensiones del mapa que aparecerá + en la página web. También es posible redimensionar directamente el elemento + que aparece durante la edición de la página para ajustar las dimensiones.
+Permite controlar el nivel de zoom del mapa. Puede usarse el desplegable superior + o los controles + y - incrustados en el mapa.
+Estas casillas establecen cual será el centro del mapa. También es posible + modificarlo mediante las flechas que aparecen incrustadas en el mapa inferior + o incluso hacer click y desplazarlo.
+Escribe aquí la dirección que deseas buscar, y si se encuentra el mapa se + centrará automáticamente en esas coordenadas y un marcador aparecerá en el + punto. Para poder hacer búsquedas adecuadamente, recuerda que hay que separar + cada elemento con una coma: "calle, ciudad, provincia, país"
+Al pulsar este botón podrás añadir un marcador en cualquier punto del mapa. Se abrirá su ventana de propiedades y ahí puedes ajustar el texto o borrar el marcador. Puedes ajustar la posición de un marcador arrastrandolo.
+
+
+
Este es el texto que se mostrará cuando los visitantes hagan click en el marcador (puedes probarlo en la pestaña Mapa).
+Aquí puedes dibujar una linea o ruta sobre el mapa, y ajustar cada uno de sus puntos mediante los minimarcadores que se muestran mientras se está aquí.
+Cuando cierres la ventana, se añadirá en el contenido del editor un elemento + para representar el mapa. Este elemento tendrá las dimensiones apropiadas con + un borde negro alrededor suya y el logo de Google Maps en el centro.
+Puedes hacer click para seleccionarlo y arrastrar una de las esquinas para + redimensionarlo, pero recuerda que el centro del mapa y la posición del marcador + no cambiarán, por lo que puede ser conveniente abrir de nuevo la ventana de + edición para verificar que todo está bien.
+ 
Puedes incluir en la página tantos mapas como desees, el funcionamiento no + está limitado a un número determinado de mapas.
+Para editar un mapa que ya existe simplemente lo puedes seleccionar y hacer + click otra vez en el botón, o hacer click con el botón derecho y escoger la + opción ahí de editar el mapa, o hacer doble click en él. Lo que más te guste.
+Existe un problema por el cual si intentas hacer una previsualización en FCKeditor +de una página que contiene un mapa, la previsualización no se mostrará normalmente.
+Si ves que este plugin es útil, considera la opción de realizar una donación + para que pueda ser mejorado, cualquier cantidad ayudará a que el desarrollo + siga adelante.
+ +Si necesitas alguna funcionalidad especial para este plugin, o si necesitas + cualquier otro plugin para FCKeditor, contacta conmigo y hablaremos sobre el + tema
+FCKeditor © FredCK.com
+Google, Google Maps y el API de Google Maps son propiedades de Google.
+ + diff --git a/main/inc/lib/fckeditor/editor/plugins/googlemaps/fckplugin.js b/main/inc/lib/fckeditor/editor/plugins/googlemaps/fckplugin.js new file mode 100644 index 0000000000..7495b43dcf --- /dev/null +++ b/main/inc/lib/fckeditor/editor/plugins/googlemaps/fckplugin.js @@ -0,0 +1,752 @@ +/* + GoogleMaps Plugin for FCKeditor + Dialog plugin to handle insertion and modification of Google Maps in FCKeditor + + File Author: + Alfonso Martinez de Lizarrondo amla70 at gmail dot com + + version 1.97 + + See readme.html +*/ + +// Check that the Google key is defined +if ( typeof( FCKConfig.GoogleMaps_Key ) != 'string') +{ + alert( 'Error.\r\nThe configuration doesn\'t contain the Google Maps key.\r\n' + + 'Please read the Configuration section.') ; + + window.open(FCKPlugins.Items['googlemaps'].Path + 'docs/' + FCKLang.GMapsHelpFile + '#configure'); +} + +// If it's empty automatically remove the button from any toolbar. +if ( !FCKConfig.GoogleMaps_Key || FCKConfig.GoogleMaps_Key.length === 0) +{ + for( var name in FCKConfig.ToolbarSets ) + RemoveButtonFromToolbarSet( FCKConfig.ToolbarSets[name], 'googlemaps' ) ; +} + +/** + Helper function + It does remove a button from an toolbarset. + It's better than leaving it disabled as it will avoid questions about why some button is always disabled. +*/ +function RemoveButtonFromToolbarSet(ToolbarSet, CommandName) +{ + if (!ToolbarSet) + return; + + for ( var x = 0 ; x < ToolbarSet.length ; x++ ) + { + var oToolbarItems = ToolbarSet[x] ; + + // If the configuration for the toolbar is missing some element or has any extra comma + // this item won't be valid, so skip it and keep on processing. + if ( !oToolbarItems ) + continue ; + + if ( typeof( oToolbarItems ) == 'object' ) + { + for ( var j = 0 ; j < oToolbarItems.length ; j++ ) + { + if ( oToolbarItems[j] == CommandName) + { + oToolbarItems.splice(j, 1); + ToolbarSet[x] = oToolbarItems ; + return; + } + } + } + } +} + +// Toolbar button + +// Register the related command. +FCKCommands.RegisterCommand( 'googlemaps', new FCKDialogCommand( 'googlemaps', FCKLang.DlgGMapsTitle, FCKPlugins.Items['googlemaps'].Path + 'dialog/googleMaps.html', 450, 428 ) ) ; + +// Create the "googlemaps" toolbar button. +var oGoogleMapsButton = new FCKToolbarButton( 'googlemaps', FCKLang.GMapsBtn, FCKLang.GMapsBtnTooltip) ; +oGoogleMapsButton.IconPath = FCKPlugins.Items['googlemaps'].Path + 'images/mapIcon.gif' ; + +FCKToolbarItems.RegisterItem( 'googlemaps', oGoogleMapsButton ) ; + + +// Detection of existing maps +/** + FCKCommentsProcessor + --------------------------- + It's run after a document has been loaded, it detects all the protected source elements + + In order to use it, you add your comment parser with + FCKCommentsProcessor.AddParser( function ) +*/ +if (typeof FCKCommentsProcessor === 'undefined') +{ + var FCKCommentsProcessor = FCKDocumentProcessor.AppendNew() ; + FCKCommentsProcessor.ProcessDocument = function( oDoc ) + { + if ( FCK.EditMode != FCK_EDITMODE_WYSIWYG ) + return ; + + if ( !oDoc ) + return ; + + //Find all the comments: + //try to choose the best approach according to the browser: + if ( oDoc.evaluate ) + this.findCommentsXPath( oDoc ); + else + { + if (oDoc.all) + this.findCommentsIE( oDoc.body ) ; + else + this.findComments( oDoc.body ) ; + } + + } + + FCKCommentsProcessor.findCommentsXPath = function(oDoc) { + var nodesSnapshot = oDoc.evaluate('//body//comment()', oDoc.body, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null ); + + for ( var i=0 ; i < nodesSnapshot.snapshotLength; i++ ) + { + this.parseComment( nodesSnapshot.snapshotItem(i) ) ; + } + } + + FCKCommentsProcessor.findCommentsIE = function(oNode) { + var aComments = oNode.getElementsByTagName( '!' ); + for(var i=aComments.length-1; i >=0 ; i--) + { + var comment = aComments[i] ; + if (comment.nodeType == 8 ) // oNode.COMMENT_NODE) + this.parseComment( comment ) ; + } + } + + // Fallback function, iterate all the nodes and its children searching for comments. + FCKCommentsProcessor.findComments = function( oNode ) + { + if (oNode.nodeType == 8 ) // oNode.COMMENT_NODE) + { + this.parseComment( oNode ) ; + } + else + { + if (oNode.hasChildNodes()) + { + var children = oNode.childNodes ; + for (var i = children.length-1; i >=0 ; i--) + this.findComments( children[ i ] ); + } + } + } + + // We get a comment node + // Check that it's one that we are interested on: + FCKCommentsProcessor.parseComment = function( oNode ) + { + var value = oNode.nodeValue ; + + // Difference between 2.4.3 and 2.5 + var prefix = ( FCKConfig.ProtectedSource._CodeTag || 'PS\\.\\.' ) ; + + var regex = new RegExp( "\\{" + prefix + "(\\d+)\\}", "g" ) ; + + if ( regex.test( value ) ) + { + var index = RegExp.$1 ; + var content = FCKTempBin.Elements[ index ] ; + + // Now call the registered parser handlers. + var oCalls = this.ParserHandlers ; + if ( oCalls ) + { + for ( var i = 0 ; i < oCalls.length ; i++ ) + oCalls[ i ]( oNode, content, index ) ; + + } + + } + } + + /** + The users of the object will add a parser here, the callback function gets two parameters: + oNode: it's the node in the editorDocument that holds the position of our content + oContent: it's the node (removed from the document) that holds the original contents + index: the reference in the FCKTempBin of our content + */ + FCKCommentsProcessor.AddParser = function( handlerFunction ) + { + if ( !this.ParserHandlers ) + this.ParserHandlers = [ handlerFunction ] ; + else + { + // Check that the event handler isn't already registered with the same listener + // It doesn't detect function pointers belonging to an object (at least in Gecko) + if ( this.ParserHandlers.IndexOf( handlerFunction ) == -1 ) + this.ParserHandlers.push( handlerFunction ) ; + } + } +} +/** + END of FCKCommentsProcessor + --------------------------- +*/ + + + + +// Check if the comment it's one of our scripts: +var GoogleMaps_CommentsProcessorParser = function( oNode, oContent, index) +{ + if ( FCK.GoogleMapsHandler.detectMapScript( oContent ) ) + { + var oMap = FCK.GoogleMapsHandler.createNew() ; + oMap.parse( oContent ) ; + oMap.createHtmlElement( oNode, index ) ; + } + else + { + if ( FCK.GoogleMapsHandler.detectGoogleScript( oContent ) ) + oNode.parentNode.removeChild( oNode ); + } +} + +FCKCommentsProcessor.AddParser( GoogleMaps_CommentsProcessorParser ); + + + +// Context menu +FCK.ContextMenu.RegisterListener( { + AddItems : function( menu, tag, tagName ) + { + // under what circumstances do we display this option + if ( tagName == 'IMG' && tag.getAttribute( 'MapNumber' ) ) + { + // No other options: + menu.RemoveAllItems() ; + // the command needs the registered command name, the title for the context menu, and the icon path + menu.AddItem( 'googlemaps', FCKLang.DlgGMapsTitle, oGoogleMapsButton.IconPath ) ; + } + }} +); + +// Double click +FCK.RegisterDoubleClickHandler( editMap, 'IMG' ) ; + +function editMap( oNode ) +{ + if ( !oNode.getAttribute( 'MapNumber' )) + return ; + + FCK.Commands.GetCommand( 'googlemaps' ).Execute() ; +} + + +// Object that handles the common functions about all the maps +FCK.GoogleMapsHandler = { + // Object to store a reference to each map + maps: {}, + + getMap: function(id){ + return this.maps[id]; + }, + + // Verify that the node is a script generated by this plugin. + detectMapScript: function( script ) + { + // We only know about version 1: + if ( !(/FCK googlemaps v1\.(\d+)/.test(script)) ) + return false; + + return true + }, + + // Self-executed function, we want to run it once at initialization only. + // Public key that will be used for the generated maps, + // while we are editing we will use only FCKConfig.GoogleMaps_Key + publicKey : function() { + // if FCKConfig.GoogleMaps_PublicKey is set to something, then use it + if ( FCKConfig.GoogleMaps_PublicKey ) + return FCKConfig.GoogleMaps_PublicKey ; + + // else we will use GoogleMaps_Key for both the public and private side. + return FCKConfig.GoogleMaps_Key ; + }(), + + // Detects both the google script as well as our ending block + // both must be removed and then added later only if neccesary + detectGoogleScript: function( script ) + { + // Our final script + if (/FCK googlemapsEnd v1\./.test(script) ) + return true ; + + // If it is the Google Maps script, get the public key from here: + if ( !/^' ; + }, + + // This can be called from the dialog + createNew: function() + { + var map = new FCKGoogleMap() ; + this.maps[ map.number ] = map; + return map; + }, + + BuildEndingScript: function() + { + var versionMarker = '// FCK googlemapsEnd v1.97'; + + var aScript = [] ; + aScript.push('\r\n'); + + return aScript.join('\r\n'); + }, + + // We will use this to track the number of maps that are generated + // This way we know if we must add the Google Script or not. + // We store their names so they are called properly from BuildEndingScript + CreatedMapsNames : [], + + // Function that will be injected into the normal core + GetXHTMLAfter: function( node, includeNode, format, Result ) + { + if (FCK.GoogleMapsHandler.CreatedMapsNames.length > 0) + { + Result += FCK.GoogleMapsHandler.BuildEndingScript() ; + } + // Reset the counter each time the GetXHTML function is called + FCK.GoogleMapsHandler.CreatedMapsNames = []; + + return Result ; + }, + + // Store any previous processor so nothing breaks + previousProcessor: FCKXHtml.TagProcessors[ 'img' ] +} + + +// Our object that will handle parsing of the script and creating the new one. +var FCKGoogleMap = function() +{ + var now = new Date() ; + this.number = '' + now.getFullYear() + now.getMonth() + now.getDate() + now.getHours() + now.getMinutes() + now.getSeconds() ; + + this.width = FCKConfig.GoogleMaps_Width || 400 ; + this.height = FCKConfig.GoogleMaps_Height || 240 ; + + this.centerLat = FCKConfig.GoogleMaps_CenterLat || 37.4419 ; + this.centerLon = FCKConfig.GoogleMaps_CenterLon || -122.1419 ; + this.zoom = FCKConfig.GoogleMaps_Zoom || 11 ; + + this.markerPoints = [] ; + + this.LinePoints = '' ; + this.LineLevels = '' ; + + this.mapType = 0 ; + + this.WrapperClass = FCKConfig.GoogleMaps_WrapperClass || '' ; +} + + +FCKGoogleMap.prototype.createHtmlElement = function( oReplacedNode, index) +{ + var oFakeNode = FCK.EditorDocument.createElement( 'IMG' ) ; + + // Are we creating a new map? + if ( !oReplacedNode ) + { + index = FCKTempBin.AddElement( this.BuildScript() ) ; + var prefix = ( FCKConfig.ProtectedSource._CodeTag || 'PS..' ) ; + oReplacedNode = FCK.EditorDocument.createComment( '{' + prefix + index + '}' ) ; + FCK.InsertElement(oReplacedNode); + } + oFakeNode.contentEditable = false ; +// oFakeNode.setAttribute( '_fckfakelement', 'true', 0 ) ; + + oFakeNode.setAttribute( '_fckrealelement', FCKTempBin.AddElement( oReplacedNode ), 0 ) ; + oFakeNode.setAttribute( '_fckBinNode', index, 0 ) ; + + oFakeNode.src = FCKConfig.FullBasePath + 'images/spacer.gif' ; + oFakeNode.style.display = 'block' ; + oFakeNode.style.border = '1px solid black' ; + oFakeNode.style.background = 'white center center url("' + FCKPlugins.Items['googlemaps'].Path + 'images/maps_res_logo.png' + '") no-repeat' ; + + oFakeNode.setAttribute("MapNumber", this.number, 0) ; + + oReplacedNode.parentNode.insertBefore( oFakeNode, oReplacedNode ) ; + oReplacedNode.parentNode.removeChild( oReplacedNode ) ; + + // dimensions + this.updateHTMLElement( oFakeNode ); + + return oFakeNode ; +} + +FCKGoogleMap.prototype.updateScript = function( oFakeNode ) +{ + this.updateDimensions( oFakeNode ) ; + + var index = oFakeNode.getAttribute( '_fckBinNode' ); + FCKTempBin.Elements[ index ] = this.BuildScript() ; +} + +FCKGoogleMap.prototype.updateHTMLElement = function( oFakeNode ) +{ + oFakeNode.width = this.width ; + oFakeNode.height = this.height ; + + // Static maps preview :-) + oFakeNode.src = this.generateStaticMap() ; + oFakeNode.style.border = 0 ; + + // The wrapper class is applied to the IMG not to a wrapping DIV !!! + if ( this.WrapperClass !== '') + oFakeNode.className = this.WrapperClass ; +} + +FCKGoogleMap.prototype.generateStaticMap = function() +{ + var w = Math.min(this.width, 640); + var h = Math.min(this.height, 640); + var staticMapTypes = ['roadmap', 'satellite', 'hybrid', 'terrain'] ; + + return 'http://maps.google.com/staticmap?center=' + this.centerLat + ',' + this.centerLon + + '&zoom=' + this.zoom + '&size=' + w + 'x' + h + + '&maptype=' + staticMapTypes[ this.mapType ] + + this.generateStaticMarkers() + + '&key=' + FCKConfig.GoogleMaps_Key +} + +FCKGoogleMap.prototype.generateStaticMarkers = function() +{ + if (this.markerPoints.length==0) + return ''; + + var aPoints = []; + for (var i=0; iYou should have been redirected to the documentation
+ + \ No newline at end of file