Modificare il file:
\FckEditor\plugins\dwzDate\fckplugin.js
//********START******** /* 1st, define the 'command' to execute when an item from the list is selected - ie, insert the text. */ var FCKdwzDate_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 FCKdwzDate_command.prototype.Execute = function(itemText, itemLabel) { var Format = itemText var mydate = new Date(); var aMonth var aDay if(FCKLang.dwzMonth && FCKLang.dwzMonth!=""){ aMonth = FCKLang.dwzMonth.split(";") }else{ aMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December") } if(FCKLang.dwzDay && FCKLang.dwzDay!=""){ aDay = FCKLang.dwzDay.split(";") }else{ aDay = new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") } var myDay = mydate.getDate() var myMonth = mydate.getMonth() var myYear = mydate.getYear() var myWday = mydate.getDay() var defaultFormat = "dd/mm/yyyy" var defaultSeparator = "/" if(Format.indexOf("/")!=-1){ arFormat = Format.toLowerCase().split("/") separator = "/" }else 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 "d": formatted += cong + myDay cong = separator break; case "dd": formatted += cong + dwzRightForDate("0" + myDay.toString(),2) cong = separator break; case "m": formatted += cong + myMonth cong = separator break; case "mm": myMonth += 1 formatted += cong + dwzRightForDate("0" + myMonth.toString(),2) cong = separator break; case "day": formatted += cong + aDay[parseInt(myWday)] cong = separator break; case "month": formatted += cong + aMonth[parseInt(myMonth)] cong = separator break; case "yy": formatted += cong + dwzRightForDate(myYear.toString(),2) cong = separator break; case "yyyy": formatted += cong + dwzRightForDate(myYear.toString(),4) cong = separator break; } } FCK.InsertHtml(formatted); } //was getting GetState is not a function (or similar) errors, so added this. FCKdwzDate_command.prototype.GetState = function() { return "Date"; } FCKCommands.RegisterCommand( 'dwzDate' , new FCKdwzDate_command('dwzDateCmd') ) ; function dwzRightForDate(str,len){ if(str && str!="" && str.length>len){ return str.substring(str.length-len) }else{ return str } } /* 2nd, create the Combo object */ var FCKToolbardwzDate=function(tooltip,style){ this.Command=FCKCommands.GetCommand('dwzDate');//the command to execute when an item is selected this.CommandName = 'dwzDate'; 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 = 230 ; this.FieldWidth = 75 ; }; FCKToolbardwzDate.prototype=new FCKToolbarSpecialCombo; //Label to appear in the FCK toolbar FCKToolbardwzDate.prototype.GetLabel=function(){ return "<img src='" + FCKConfig.PluginsPath + "dwzDate/dwzDate.gif' border='0' >" }; //Add the items to the combo list FCKToolbardwzDate.prototype.CreateItems=function(targetSpecialCombo){ //this._Combo.AddItem(itemText, itemLabel); //see FCKMyCombo_command.prototype.Execute = function(itemText, itemLabel) above var formatList = new Array("d/m/yy;1/1/05","dd/mm/yy;01/01/05","dd/mm/yyyy;01/01/2005","d-m-yy;1-1-05","d-m-yyyy;1-1-2005","dd-mm-yy;01-01-05","dd-mm-yyyy;01-01-2005","m/d/yy;1/1/05","m/d/yyyy;1/1/2005","mm/dd/yy;10/01/05","mm/dd/yyyy;10/01/2005","m-d-yy;1-1-05","m-d-yyyy;1-1-2005","mm-dd-yy;10-01-05","mm-dd-yyyy;10-01-2005","yyyy/mm/dd;2005/10/01","yyyy/m/d;2005/1/1","yy/mm/dd;05/10/01","yy/m/d;05/1/1","yyyy-mm-dd;2005-10-01","yyyy-m-d;2005-1-1","yy-mm-dd;05-10-01","yy-m-d;05-1-1","d m yy;1 1 05","dd mm yy;01 10 05","dd mm yyyy;01 10 2005","m d yy;1 1 05","m d yyyy;1 1 2005","mm dd yy;10 01 05","mm dd yyyy;10 01 2005","dd month yyyy;01 Jan 2005","d month yy;1 Jan 05","month dd yyyy;Jan 01 2005","month d yy;Jan 1 05","day dd month yyyy;Sun 01 Jan 2005","day d month yy;Sun 1 Jan 05") 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( 'dwzDate' , new FCKToolbardwzDate( 'dwzDate', FCK_TOOLBARITEM_ONLYTEXT ) ) ; //or FCK_TOOLBARITEM_ONLYTEXT //********END********
[
Íàçàä
]