| |||||||||||||||||
| Source File | Conditionals | Statements | Methods | TOTAL | |||||||||||||
| Web\Scripts\IncludeJSCalendarScriptBlock.cs | - | 100,0 % | 100,0 % | 100,0 % |
|
||||||||||||
| 1 | #region Copyright | |
| 2 | /* | |
| 3 | ShowX. Maps business objects into presentation layer. | |
| 4 | Copyright (C) 2005 Jesus Diaz. | |
| 5 | ||
| 6 | This library is free software; you can redistribute it and/or | |
| 7 | modify it under the terms of the GNU Lesser General Public | |
| 8 | License as published by the Free Software Foundation; either | |
| 9 | version 2.1 of the License, or (at your option) any later version. | |
| 10 | ||
| 11 | This library is distributed in the hope that it will be useful, | |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 14 | Lesser General Public License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Lesser General Public | |
| 17 | License along with this library; if not, write to the Free Software | |
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
| 19 | ||
| 20 | For project details see: http://showx.sourceforge.net | |
| 21 | */ | |
| 22 | #endregion | |
| 23 | ||
| 24 | using System.IO; | |
| 25 | using System.Text; | |
| 26 | using log4net; | |
| 27 | ||
| 28 | namespace ShowX.Web.Scripts | |
| 29 | { | |
| 30 | /// <summary> | |
| 31 | /// IncludeJSCalendarScriptBlock generates the necessary includes in order to use | |
| 32 | /// the jsCalendar control. | |
| 33 | /// The script code looks somehow like: | |
| 34 | /// <code> | |
| 35 | /// <style type='text/css'>@import url(calendar-win2k-1.css);</style> | |
| 36 | /// <script type='text/javascript' src='calendar.js'></script> | |
| 37 | /// <script type='text/javascript' src='lang/calendar-en.js'></script> | |
| 38 | /// <script type='text/javascript' src='calendar-setup.js'></script>; | |
| 39 | /// </code> | |
| 40 | /// | |
| 41 | /// only that the file path should be adjusted to jsCalendar configuration path, | |
| 42 | /// which is done in the static constructor of the class. | |
| 43 | /// </summary> | |
| 44 | public class IncludeJSCalendarScriptBlock : ScriptBaseClass | |
| 45 | { | |
| 46 | private static readonly ILog log = LogManager.GetLogger( | |
| 47 | typeof( IncludeJSCalendarScriptBlock)); | |
| 48 | ||
| 49 | /// <summary> | |
| 50 | /// Base class for jscalendar | |
| 51 | /// </summary> | |
| 52 | string jsCalendarPath = "jscalendar-1.0/"; | |
| 53 | ||
| 54 | /// <summary> | |
| 55 | /// Constructor, to build script block. | |
| 56 | /// </summary> | |
| 57 | 33 | public IncludeJSCalendarScriptBlock() |
| 58 | : base ("IncludeJSCalendarScriptBlock:Key") | |
| 59 | { | |
| 60 | ||
| 61 | 33 | log.Info(string.Format( |
| 62 | "Building calendar include script. Using '{0}' as jsCalendar location", | |
| 63 | jsCalendarPath)); | |
| 64 | ||
| 65 | 33 | StringBuilder strBuilder = new StringBuilder(); |
| 66 | ||
| 67 | 33 | strBuilder.Append("<style type='text/css'>@import url(") |
| 68 | .Append(Path.Combine(jsCalendarPath,"calendar-win2k-1.css")) | |
| 69 | .Append(");</style>") | |
| 70 | .Append("<script type='text/javascript' src='") | |
| 71 | .Append(Path.Combine(jsCalendarPath,"calendar.js")) | |
| 72 | .Append("'></script>") | |
| 73 | .Append("<script type='text/javascript' src='") | |
| 74 | .Append(Path.Combine(jsCalendarPath,"lang/calendar-en.js")) | |
| 75 | .Append("'></script>") | |
| 76 | .Append("<script type='text/javascript' src='") | |
| 77 | .Append(Path.Combine(jsCalendarPath,"calendar-setup.js")) | |
| 78 | .Append("'></script>"); | |
| 79 | ||
| 80 | 33 | script = strBuilder.ToString(); |
| 81 | } | |
| 82 | } | |
| 83 | } | |
| 84 |
|
||||||||