From 886882dd8406ffc84e8122b7808d1e40e706b284 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Wed, 19 Sep 2007 20:12:52 +0000 Subject: [PATCH] Added InsertTime functionality SVN revision: 1923 --- .../editor/plugins/elog/fckplugin.js | 69 ++++++++++++++++-- .../editor/plugins/elog/inserttime.gif | Bin 0 -> 1051 bytes 2 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 scripts/fckeditor/editor/plugins/elog/inserttime.gif diff --git a/scripts/fckeditor/editor/plugins/elog/fckplugin.js b/scripts/fckeditor/editor/plugins/elog/fckplugin.js index cf2c3a9e..1ed60579 100644 --- a/scripts/fckeditor/editor/plugins/elog/fckplugin.js +++ b/scripts/fckeditor/editor/plugins/elog/fckplugin.js @@ -21,16 +21,13 @@ * This plugin registers ELOG specific Toolbar items */ +/*---- 'Submit' ----------------------------------------------------*/ + // Register 'Submit' toolbar button var oELOGSubmitItem = new FCKToolbarButton('ELOGSubmit', 'Submit Entry', null, null, true, null, 3); FCKToolbarItems.RegisterItem('ELOGSubmit', oELOGSubmitItem); -// Create 'InsertTime' toolbar button -var oInsertTimeItem = new FCKToolbarButton('InsertTime', 'Insert Date/Time', null, null, true, null, 4); -oInsertTimeItem.IconPath = FCKConfig.PluginsPath + 'elog/inserttime.gif' ; -FCKToolbarItems.RegisterItem('InsertTime', oInsertTimeItem); - -// Register command +// Register 'Submit' command var oELOGSubmitCommand = new Object(); oELOGSubmitCommand.Name = 'ELOGSubmit'; @@ -43,9 +40,65 @@ oELOGSubmitCommand.Execute = function() oELOGSubmitCommand.GetState = function() { - // This function is always enabled. - return FCK_TRISTATE_OFF ; + // This function is always enabled. + return FCK_TRISTATE_OFF ; } FCKCommands.RegisterCommand('ELOGSubmit', oELOGSubmitCommand); +/*---- 'InsertTime' ------------------------------------------------*/ + +// Create 'InsertTime' toolbar button +var oInsertTimeItem = new FCKToolbarButton('InsertTime', 'Insert Date/Time', null, null, true, null, 4); +oInsertTimeItem.IconPath = FCKConfig.PluginsPath + 'elog/inserttime.gif' ; +FCKToolbarItems.RegisterItem('InsertTime', oInsertTimeItem); + +// Register 'InsertTime' command +var oInsertTimeCommand = new Object(); +oInsertTimeCommand.Name = 'InsertTime'; + +oInsertTimeCommand.Execute = function() +{ + var xmlHttp; + + try { + xmlHttp = new XMLHttpRequest(); // Firefox, Opera 8.0+, Safari + } + catch (e) { + try { + xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer + } + catch (e) { + try { + xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); + } + catch (e) { + alert("Your browser does not support AJAX!"); + return false; + } + } + } + + xmlHttp.onreadystatechange = function() + { + if(xmlHttp.readyState == 4) + { + // Get the editor instance that we want to interact with. + var oEditor = FCKeditorAPI.GetInstance('Text') ; + + // Insert the desired HTML. + oEditor.InsertHtml(xmlHttp.responseText); + } + } + + xmlHttp.open("GET","../../../?cmd=gettimedate",true); + xmlHttp.send(null); +} + +oInsertTimeCommand.GetState = function() +{ + // This function is always enabled. + return FCK_TRISTATE_OFF ; +} + +FCKCommands.RegisterCommand('InsertTime', oInsertTimeCommand); diff --git a/scripts/fckeditor/editor/plugins/elog/inserttime.gif b/scripts/fckeditor/editor/plugins/elog/inserttime.gif new file mode 100644 index 0000000000000000000000000000000000000000..35b0020c82bf3aefaec8a6cd4f93880fbf11b8f6 GIT binary patch literal 1051 zcmZ?wbhEHb6krfwXlDQc9yNOjU3(=ZX?uGkK6M8!9dBN34{p5xCWAOW(-=PUI00Q3 z0UZx915X(vM=|qIDXS1x;{;**bUjBeLkAZFM?X7vcU%7$TmN`f&ul&KB-@ZQo7hsj z*mAqXYEMsVFE49~^o5ZtvXg*qW*7wS5`o4H@+l z>YFP|Te~WnJ1g4z3%V9GHl{Z>XSTLxwYTRqG?%ya*Y@`pO_)$TXKwA>xwReL4XyoC znkIBKOz!EQ)X_L)a@(Z29g`+Zo!K~bZhPa@CG!_eoWEdd_oA)ymo1sGX7B3Noom)~ zE?qu*+44DyS5DrtWy+2nllSbIzH8U)W$QOA-MoG4{+0Xoty#ML;L06GjvbqK{KWhd zC+43!xAeq`m4^>+JaS~ug$v6rU0QMN+UgrO*4((c_U6rXw{8K^`pcI$UB0&I%9Xu$ z?rgYwcjLW#K(y)p{Y`i8?z(qx*Zuo@9z59m;K7zhkG4K}vhB&!?N6U>fAC=Mg9rN_ zKHT^G*^cMWcf5G9>(#5>Z{F^G`*!cUcl+MI-+%r3*+-9#KYDcH@nax5`QX912M^9a zethxKqifHe-Fp7~_KO!+Uc9*d;lqJXpALTdbm;TvLtnoh`S$JT_wPr4{5S?q4kL?D z{K>-1z_6Y{2jp!~o?zhk!4S_Wlkt?DS22rCtLCZN;Z}vDV*!eZj;9YP@h`ZdXzDdZ z(>F$|LgGg2L9u}OUMqD(xkO~S*3X`5p#I59%%%t`ApL~XnE=2@zuOqzhbOf zy{4`TS#IDvsVU(>qgL0vHCb1?uFf{jRuGV!vFre+(HfS