commit
41a34288bd
@ -1,44 +1,44 @@ |
||||
/* |
||||
* Licensed under the terms of the GNU Lesser General Public License: |
||||
* http://www.opensource.org/licenses/lgpl-license.php
|
||||
*
|
||||
* |
||||
* File Name: fckplugin.js |
||||
* Plugin to add some HTML, a single snippet; a choice from multiple snippets; or manually entered HTML |
||||
*
|
||||
* |
||||
* File Authors: |
||||
* Paul Moers (http://www.saulmade.nl/FCKeditor/FCKPlugins.php)
|
||||
*/ |
||||
|
||||
// insertHtmlObject constructor
|
||||
var insertHtmlToolbarCommand = function() |
||||
{ |
||||
} |
||||
// insertHtmlObject constructor
|
||||
var insertHtmlToolbarCommand = function() |
||||
{ |
||||
} |
||||
|
||||
// register the command
|
||||
FCKCommands.RegisterCommand('insertHtml', new insertHtmlToolbarCommand()); |
||||
// register the command
|
||||
FCKCommands.RegisterCommand('insertHtml', new insertHtmlToolbarCommand()); |
||||
|
||||
// create the toolbar button
|
||||
var insertHtmlButton = new FCKToolbarButton('insertHtml', FCKConfig.insertHtml_buttonTooltip || FCKLang.inserHTML_buttonTooltip); |
||||
insertHtmlButton.IconPath = FCKPlugins.Items['insertHtml'].Path + 'images/toolbarIcon_default.gif'; // or pick any other in folder 'images'
|
||||
FCKToolbarItems.RegisterItem('insertHtml', insertHtmlButton); |
||||
// create the toolbar button
|
||||
var insertHtmlButton = new FCKToolbarButton('insertHtml', FCKConfig.insertHtml_buttonTooltip || FCKLang.inserHTML_buttonTooltip); |
||||
insertHtmlButton.IconPath = FCKPlugins.Items['insertHtml'].Path + 'images/toolbarIcon_default.gif'; // or pick any other in folder 'images'
|
||||
FCKToolbarItems.RegisterItem('insertHtml', insertHtmlButton); |
||||
|
||||
// manage the plugins' button behavior
|
||||
insertHtmlToolbarCommand.prototype.GetState = function() |
||||
{ |
||||
return FCK_TRISTATE_OFF; |
||||
} |
||||
// manage the plugins' button behavior
|
||||
insertHtmlToolbarCommand.prototype.GetState = function() |
||||
{ |
||||
return FCK_TRISTATE_OFF; |
||||
} |
||||
|
||||
// insertHtml's button click function
|
||||
insertHtmlToolbarCommand.prototype.Execute = function() |
||||
{ |
||||
if (FCKConfig.insertHtml_showDialog || !FCKConfig.insertHtml_snippets || (FCKConfig.insertHtml_snippets && !FCKConfig.insertHtml_snippets.length)) |
||||
{ |
||||
var dialog = new FCKDialogCommand('insertHtml', FCKLang.insertHtml_dialogTitle, FCKPlugins.Items['insertHtml'].Path + 'insertHtml.html', 200, 100); |
||||
dialog.Execute(); |
||||
} |
||||
else |
||||
{ |
||||
FCK.InsertHtml(FCKConfig.insertHtml_snippet); |
||||
FCK.EditorWindow.parent.FCKUndo.SaveUndoStep(); |
||||
} |
||||
} |
||||
// insertHtml's button click function
|
||||
insertHtmlToolbarCommand.prototype.Execute = function() |
||||
{ |
||||
if (FCKConfig.insertHtml_showDialog || !FCKConfig.insertHtml_snippets || (FCKConfig.insertHtml_snippets && !FCKConfig.insertHtml_snippets.length)) |
||||
{ |
||||
var dialog = new FCKDialogCommand('insertHtml', FCKLang.insertHtml_dialogTitle, FCKPlugins.Items['insertHtml'].Path + 'insertHtml.html', 200, 100); |
||||
dialog.Execute(); |
||||
} |
||||
else |
||||
{ |
||||
FCK.InsertHtml(FCKConfig.insertHtml_snippet); |
||||
FCK.EditorWindow.parent.FCKUndo.SaveUndoStep(); |
||||
} |
||||
} |
||||
|
@ -1,111 +1,111 @@ |
||||
|
||||
|
||||
var dialog = window.parent; |
||||
var editorWindow = dialog.InnerDialogLoaded(); |
||||
var editorInstance = editorWindow.FCK; |
||||
var FCKConfig = editorWindow.FCKConfig; |
||||
var FCKTools = editorWindow.FCKTools; |
||||
var FCKBrowserInfo = editorWindow.FCKBrowserInfo; |
||||
|
||||
|
||||
// onload
|
||||
window.onload = function() |
||||
{ |
||||
var description, snippet; |
||||
|
||||
// show snippets to choose from
|
||||
if (typeof(FCKConfig.insertHtml_snippets) == 'object') |
||||
{ |
||||
var snippetsDiv, snippetDiv, numberOfSnippets = 0; |
||||
|
||||
snippetsDiv = document.createElement('div'); |
||||
snippetsDiv.id = 'snippets'; |
||||
|
||||
for (description in FCKConfig.insertHtml_snippets) |
||||
{ |
||||
snippetDiv = document.createElement('div'); |
||||
snippetDiv.innerHTML = description; |
||||
snippetDiv.className = 'snippet'; |
||||
snippetDiv.snippet = FCKConfig.insertHtml_snippets[description]; |
||||
snippetDiv.onmouseover = function(){this.className += ' PopupSelectionBox'}; |
||||
snippetDiv.onmouseout = function(){this.className = this.className.replace(/\s?PopupSelectionBox\s?/, '')}; |
||||
if (FCKConfig.insertHtml_showTextarea) |
||||
{ |
||||
snippetDiv.onclick = function(){ |
||||
document.getElementById('insertHtmlTextArea').value = this.snippet; |
||||
}; |
||||
} |
||||
else |
||||
{ |
||||
snippetDiv.onclick = function(){ |
||||
editorInstance.InsertHtml(this.snippet); |
||||
editorWindow.FCKUndo.SaveUndoStep(); |
||||
dialog.CloseDialog(); |
||||
}; |
||||
} |
||||
snippetsDiv.appendChild(snippetDiv); |
||||
|
||||
numberOfSnippets++; |
||||
} |
||||
document.getElementById('content').appendChild(snippetsDiv); |
||||
|
||||
// load dialog
|
||||
} |
||||
|
||||
// show textarea
|
||||
if (FCKConfig.insertHtml_showTextarea || !FCKConfig.insertHtml_snippets || !numberOfSnippets) |
||||
{ |
||||
insertHtmlTextArea = document.createElement('textarea'); |
||||
insertHtmlTextArea.id = 'insertHtmlTextArea'; |
||||
document.getElementById('content').appendChild(insertHtmlTextArea); |
||||
// set the size of the textarea
|
||||
insertHtmlTextArea.style.width = (FCKConfig.insertHtml_textareaWidth || 300) + 'px'; |
||||
insertHtmlTextArea.style.height = (FCKConfig.insertHtml_textareaHeight || 100) + 'px'; |
||||
// load default content
|
||||
if (typeof(FCKConfig.insertHtml_snippets) == 'object') |
||||
{ |
||||
for (description in FCKConfig.insertHtml_snippets) |
||||
{ |
||||
snippet = FCKConfig.insertHtml_snippets[description]; |
||||
break; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
//snippet = FCKConfig.insertHtml_snippets;//Chamilo replaced by below (by now)
|
||||
snippet = "";//Insert your tex here
|
||||
} |
||||
insertHtmlTextArea.value = snippet; |
||||
} |
||||
|
||||
// resize around snippets and/or textarea
|
||||
// for IE this must be done before translating the dialog or the dialog will be to wide; also IE needs an approximate resize before autofitting or the dialog width will be to large
|
||||
if (FCKBrowserInfo.IsIE) dialog.Sizer.ResizeDialog(parseInt(FCKConfig.insertHtml_textareaWidth || 300), parseInt(FCKConfig.insertHtml_textareaHeight || 100) + 130); |
||||
dialog.SetAutoSize(true); |
||||
|
||||
// recenter dialog
|
||||
setTimeout(function(){ // after a dummy delay, needed for webkit
|
||||
var topWindowSize = FCKTools.GetViewPaneSize(dialog.top.window); |
||||
dialog.frameElement.style.left = Math.round((topWindowSize.Width - dialog.frameElement.offsetWidth) / 2) + 'px'; |
||||
dialog.frameElement.style.top = Math.round((topWindowSize.Height - dialog.frameElement.offsetHeight) / 2).toString() + 'px';; |
||||
}, 0); |
||||
|
||||
// translate the dialog box texts
|
||||
editorWindow.FCKLanguageManager.TranslatePage(document); |
||||
|
||||
// activate the "OK" button
|
||||
dialog.SetOkButton(true); |
||||
} |
||||
|
||||
// dialog's 'ok' button function to insert the Html
|
||||
function Ok() |
||||
{ |
||||
if (insertHtmlTextArea.value) |
||||
{ |
||||
editorInstance.InsertHtml(insertHtmlTextArea.value); |
||||
editorWindow.FCKUndo.SaveUndoStep(); |
||||
|
||||
return true; // makes the dialog to close
|
||||
} |
||||
} |
||||
var dialog = window.parent; |
||||
var editorWindow = dialog.InnerDialogLoaded(); |
||||
var editorInstance = editorWindow.FCK; |
||||
var FCKConfig = editorWindow.FCKConfig; |
||||
var FCKTools = editorWindow.FCKTools; |
||||
var FCKBrowserInfo = editorWindow.FCKBrowserInfo; |
||||
|
||||
|
||||
// onload
|
||||
window.onload = function() |
||||
{ |
||||
var description, snippet; |
||||
|
||||
// show snippets to choose from
|
||||
if (typeof(FCKConfig.insertHtml_snippets) == 'object') |
||||
{ |
||||
var snippetsDiv, snippetDiv, numberOfSnippets = 0; |
||||
|
||||
snippetsDiv = document.createElement('div'); |
||||
snippetsDiv.id = 'snippets'; |
||||
|
||||
for (description in FCKConfig.insertHtml_snippets) |
||||
{ |
||||
snippetDiv = document.createElement('div'); |
||||
snippetDiv.innerHTML = description; |
||||
snippetDiv.className = 'snippet'; |
||||
snippetDiv.snippet = FCKConfig.insertHtml_snippets[description]; |
||||
snippetDiv.onmouseover = function(){this.className += ' PopupSelectionBox'}; |
||||
snippetDiv.onmouseout = function(){this.className = this.className.replace(/\s?PopupSelectionBox\s?/, '')}; |
||||
if (FCKConfig.insertHtml_showTextarea) |
||||
{ |
||||
snippetDiv.onclick = function(){ |
||||
document.getElementById('insertHtmlTextArea').value = this.snippet; |
||||
}; |
||||
} |
||||
else |
||||
{ |
||||
snippetDiv.onclick = function(){ |
||||
editorInstance.InsertHtml(this.snippet); |
||||
editorWindow.FCKUndo.SaveUndoStep(); |
||||
dialog.CloseDialog(); |
||||
}; |
||||
} |
||||
snippetsDiv.appendChild(snippetDiv); |
||||
|
||||
numberOfSnippets++; |
||||
} |
||||
document.getElementById('content').appendChild(snippetsDiv); |
||||
|
||||
// load dialog
|
||||
} |
||||
|
||||
// show textarea
|
||||
if (FCKConfig.insertHtml_showTextarea || !FCKConfig.insertHtml_snippets || !numberOfSnippets) |
||||
{ |
||||
insertHtmlTextArea = document.createElement('textarea'); |
||||
insertHtmlTextArea.id = 'insertHtmlTextArea'; |
||||
document.getElementById('content').appendChild(insertHtmlTextArea); |
||||
// set the size of the textarea
|
||||
insertHtmlTextArea.style.width = (FCKConfig.insertHtml_textareaWidth || 300) + 'px'; |
||||
insertHtmlTextArea.style.height = (FCKConfig.insertHtml_textareaHeight || 100) + 'px'; |
||||
// load default content
|
||||
if (typeof(FCKConfig.insertHtml_snippets) == 'object') |
||||
{ |
||||
for (description in FCKConfig.insertHtml_snippets) |
||||
{ |
||||
snippet = FCKConfig.insertHtml_snippets[description]; |
||||
break; |
||||
} |
||||
} |
||||
else |
||||
{ |
||||
//snippet = FCKConfig.insertHtml_snippets;//Chamilo replaced by below (by now)
|
||||
snippet = "";//Insert your tex here
|
||||
} |
||||
insertHtmlTextArea.value = snippet; |
||||
} |
||||
|
||||
// resize around snippets and/or textarea
|
||||
// for IE this must be done before translating the dialog or the dialog will be to wide; also IE needs an approximate resize before autofitting or the dialog width will be to large
|
||||
if (FCKBrowserInfo.IsIE) dialog.Sizer.ResizeDialog(parseInt(FCKConfig.insertHtml_textareaWidth || 300), parseInt(FCKConfig.insertHtml_textareaHeight || 100) + 130); |
||||
dialog.SetAutoSize(true); |
||||
|
||||
// recenter dialog
|
||||
setTimeout(function(){ // after a dummy delay, needed for webkit
|
||||
var topWindowSize = FCKTools.GetViewPaneSize(dialog.top.window); |
||||
dialog.frameElement.style.left = Math.round((topWindowSize.Width - dialog.frameElement.offsetWidth) / 2) + 'px'; |
||||
dialog.frameElement.style.top = Math.round((topWindowSize.Height - dialog.frameElement.offsetHeight) / 2).toString() + 'px';; |
||||
}, 0); |
||||
|
||||
// translate the dialog box texts
|
||||
editorWindow.FCKLanguageManager.TranslatePage(document); |
||||
|
||||
// activate the "OK" button
|
||||
dialog.SetOkButton(true); |
||||
} |
||||
|
||||
// dialog's 'ok' button function to insert the Html
|
||||
function Ok() |
||||
{ |
||||
if (insertHtmlTextArea.value) |
||||
{ |
||||
editorInstance.InsertHtml(insertHtmlTextArea.value); |
||||
editorWindow.FCKUndo.SaveUndoStep(); |
||||
|
||||
return true; // makes the dialog to close
|
||||
} |
||||
} |
||||
|
||||
|
@ -0,0 +1,8 @@ |
||||
/* |
||||
* Translator: Ivan Tcholakov, ivantcholakov@gmail.com, 2011 |
||||
* Bulgarian language file. |
||||
* Encoding: UTF-8 |
||||
*/ |
||||
FCKLang.inserHTML_buttonTooltip = 'Вмъкване на HTML код'; |
||||
FCKLang.insertHtml_dialogTitle = 'Вмъкване на HTML код'; |
||||
FCKLang.inserHtml_help = 'Въведете по-долу вашия HTML код и натиснете бутона "Добре (OK)", за вмъкване в редактирания текст на съответното място.'; |
@ -1,6 +1,6 @@ |
||||
|
||||
|
||||
FCKLang.inserHTML_buttonTooltip = 'Insertar Widget'; |
||||
FCKLang.insertHtml_dialogTitle = 'Insertar Widget'; |
||||
FCKLang.inserHtml_help = 'Introduzca cualquier código HTML debajo y haga clic \'ok\' para insertarlo en la posición en la que se encuentra el cursor en el editor.'; |
||||
FCKLang.inserHTML_buttonTooltip = 'Insertar Widget'; |
||||
FCKLang.insertHtml_dialogTitle = 'Insertar Widget'; |
||||
FCKLang.inserHtml_help = 'Introduzca cualquier código HTML debajo y haga clic \'ok\' para insertarlo en la posición en la que se encuentra el cursor en el editor.'; |
||||
|
||||
|
@ -0,0 +1,6 @@ |
||||
<?php require_once('../main/inc/global.inc.php'); |
||||
|
||||
var_dump(api_is_windows_os()); |
||||
|
||||
//echo (api_is_windows_os()?'true':'false'); |
||||
?> |
Loading…
Reference in new issue