Modificare il file:
\FckEditor\plugins\dwzTime\fckplugin.js
//********START******** /* 1st, define the 'command' to execute when an item from the list is selected - ie, insert the text. */ var FCKdwzTime_command = function(name) { /* The 'name' parameter doesn't do anything. You could define above using: a) var FCKMyCombo_command = function() { or b) var FCKMyCombo_command = function(name, var1, var2, var3) { or c) what ever you like Just remember to reflect this at the 'FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command('any_name') ) ;' line below. EG: a) FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command() ) ; b) FCKCommands.RegisterCommand( 'mycombocommand' , new FCKMyCombo_command('any_name', 'var1', 'var2', 'var3') ) ; c) what ever you like */ this.Name = name ; } //This get's executed when an item from the combo list gets selected FCKdwzTime_command.prototype.Execute = function(itemText, itemLabel) { var Format = itemText var mydate = new Date(); var defaultFormat = "h:mm" myHour = mydate.getHours(); myMin = mydate.getMinutes(); mySec = mydate.getSeconds(); if(Format.indexOf(".")!=-1){ arFormat = Format.toLowerCase().split(".") separator = "." }else if(Format.indexOf(":")!=-1){ arFormat = Format.toLowerCase().split(":") separator = ":" }else{ separator = defaultSeparator arFormat = defaultFormat.split(",") } var formatted = "" var cong = "" for(x=0;x<arFormat.length;x++){ switch(arFormat[x]){ case "hh": formatted += cong + dwzRightForTime(myHour.toString(),2) cong = separator break; case "mm": formatted += cong + dwzRightForTime(myMin.toString(),2) cong = separator break; case "ss": formatted += cong + dwzRightForTime(mySec.toString(),2) cong = separator break; } } FCK.InsertHtml(formatted); } //was getting GetState is not a function (or similar) errors, so added this. FCKdwzTime_command.prototype.GetState = function() { return "Date"; } FCKCommands.RegisterCommand( 'dwzTime' , new FCKdwzTime_command('dwzTimeCmd') ) ; function dwzRightForTime(str,len){ if(str && str!="" && str.length>len){ return str.substring(str.length-len) }else{ return str } } /* 2nd, create the Combo object */ var FCKToolbardwzTime=function(tooltip,style){ this.Command=FCKCommands.GetCommand('dwzTime');//the command to execute when an item is selected this.CommandName = 'dwzTime'; this.Label=this.GetLabel(); this.Tooltip=tooltip?tooltip:this.Label; //Doesn't seem to work this.Style=style; //FCK_TOOLBARITEM_ICONTEXT OR FCK_TOOLBARITEM_ONLYTEXT this.PanelWidth = 150 ; this.FieldWidth = 75 ; }; FCKToolbardwzTime.prototype=new FCKToolbarSpecialCombo; //Label to appear in the FCK toolbar FCKToolbardwzTime.prototype.GetLabel=function(){ return "<img src='" + FCKConfig.PluginsPath + "dwzTime/dwzTime.gif' border='0' >" }; //Add the items to the combo list FCKToolbardwzTime.prototype.CreateItems=function(targetSpecialCombo){ //this._Combo.AddItem(itemText, itemLabel); //see FCKMyCombo_command.prototype.Execute = function(itemText, itemLabel) above var formatList = new Array("hh:mm;12:05","hh:mm:ss;12:05:25","hh.mm;12.05","hh.mm.ss;12.05.25") for(x=0;x<formatList.length;x++){ tmp = formatList[x].split(";") table = '<table width="100%" border=0 cellpadding=0 cellspacing=0>' table += '<tr>' table += '<td align=left>' + tmp[0] + '</td>' table += '<td align=right>' + tmp[1] + '</td>' table += '</tr>' table += '</table>' this._Combo.AddItem(tmp[0], table) } } //Register the combo with the FCKEditor FCKToolbarItems.RegisterItem( 'dwzTime' , new FCKToolbardwzTime( 'dwzTime', FCK_TOOLBARITEM_ONLYTEXT ) ) ; //or FCK_TOOLBARITEM_ONLYTEXT //********END********
[
Íàçàä
]