mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-14 20:33:48 +00:00
Added InsertTime functionality
SVN revision: 1923
This commit is contained in:
parent
659c919262
commit
886882dd84
@ -21,16 +21,13 @@
|
|||||||
* This plugin registers ELOG specific Toolbar items
|
* This plugin registers ELOG specific Toolbar items
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*---- 'Submit' ----------------------------------------------------*/
|
||||||
|
|
||||||
// Register 'Submit' toolbar button
|
// Register 'Submit' toolbar button
|
||||||
var oELOGSubmitItem = new FCKToolbarButton('ELOGSubmit', 'Submit Entry', null, null, true, null, 3);
|
var oELOGSubmitItem = new FCKToolbarButton('ELOGSubmit', 'Submit Entry', null, null, true, null, 3);
|
||||||
FCKToolbarItems.RegisterItem('ELOGSubmit', oELOGSubmitItem);
|
FCKToolbarItems.RegisterItem('ELOGSubmit', oELOGSubmitItem);
|
||||||
|
|
||||||
// Create 'InsertTime' toolbar button
|
// Register 'Submit' command
|
||||||
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
|
|
||||||
var oELOGSubmitCommand = new Object();
|
var oELOGSubmitCommand = new Object();
|
||||||
oELOGSubmitCommand.Name = 'ELOGSubmit';
|
oELOGSubmitCommand.Name = 'ELOGSubmit';
|
||||||
|
|
||||||
@ -43,9 +40,65 @@ oELOGSubmitCommand.Execute = function()
|
|||||||
|
|
||||||
oELOGSubmitCommand.GetState = function()
|
oELOGSubmitCommand.GetState = function()
|
||||||
{
|
{
|
||||||
// This function is always enabled.
|
// This function is always enabled.
|
||||||
return FCK_TRISTATE_OFF ;
|
return FCK_TRISTATE_OFF ;
|
||||||
}
|
}
|
||||||
|
|
||||||
FCKCommands.RegisterCommand('ELOGSubmit', oELOGSubmitCommand);
|
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);
|
||||||
|
|||||||
BIN
scripts/fckeditor/editor/plugins/elog/inserttime.gif
Normal file
BIN
scripts/fckeditor/editor/plugins/elog/inserttime.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
Loading…
x
Reference in New Issue
Block a user