Kontakt til menighedsrådet
Error executing template "Designs/Dwsimple/Paragraph/Calendar.cshtml"
System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
at System.Net.HttpWebRequest.GetResponse()
at System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at CompiledRazorTemplates.Dynamic.RazorEngine_fc2705aa6d074c249135f61ea3c7e978.b__12_0(TextWriter __razor_helper_writer) in E:\Dynamicweb.net\Solutions\EGBrandsoft\dyssegaardskirken.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\Calendar.cshtml:line 190
at CompiledRazorTemplates.Dynamic.RazorEngine_fc2705aa6d074c249135f61ea3c7e978.Execute() in E:\Dynamicweb.net\Solutions\EGBrandsoft\dyssegaardskirken.dw9.dynamicweb-cms.com\files\Templates\Designs\Dwsimple\Paragraph\Calendar.cshtml:line 60
at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context, TextWriter reader)
at RazorEngine.Templating.RazorEngineService.RunCompile(ITemplateKey key, TextWriter writer, Type modelType, Object model, DynamicViewBag viewBag)
at RazorEngine.Templating.RazorEngineServiceExtensions.<>c__DisplayClass16_0.b__0(TextWriter writer)
at RazorEngine.Templating.RazorEngineServiceExtensions.WithWriter(Action`1 withWriter)
at Dynamicweb.Rendering.Template.RenderRazorTemplate()
1 @using System.Xml.Linq;
2 @using System.Text;
3 @using System.Globalization;
4
5 @inherits Dynamicweb.Rendering.RazorTemplateBase<Dynamicweb.Rendering.RazorTemplateModel<Dynamicweb.Rendering.Template>>
6
7 @{
8 init();
9 }
10
11 @functions {
12 private int columnsWritten { get; set; }
13 private int columns { get; set; }
14
15 public void init()
16 {
17 columnsWritten = Dynamicweb.Input.FormatInteger(System.Web.HttpContext.Current.Items["currentColumns"]);
18 columns = GetInteger("Item.Width");
19 System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + GetInteger("Item.Width");
20 }
21
22 public void Fluid()
23 {
24 columnsWritten = Dynamicweb.Input.FormatInteger(System.Web.HttpContext.Current.Items["currentColumns"]);
25 columns = 12;
26 System.Web.HttpContext.Current.Items["currentColumns"] = columnsWritten + 12;
27 }
28
29 public string ColumnClass()
30 {
31 if (GetString("Item.WidthMobile") == "hide"){
32 return "col-md-" + GetString("Item.Width") + " hidden-xs";
33 } else {
34 return "col-md-" + GetString("Item.Width") + " col-xs-" + GetString("Item.WidthMobile");
35 }
36 }
37
38 public string NewRow()
39 {
40 if (columns + columnsWritten > 12)
41 {
42 System.Web.HttpContext.Current.Items["currentColumns"] = columns;
43 return "</div><div class=\"row\">";
44 }
45 else
46 {
47 return string.Empty;
48 }
49
50 }
51 }
52
53
54 @NewRow()
55
56 <div class="@ColumnClass()">
57 <h1>@GetString("Item.Titel")</h1>
58
59 @if (@GetString("Item.LayoutMode") == "list") {
60 @CalendarList();
61 } else {
62 string thisyear = "";
63
64 <ul class="timeline hidden-xs">
65 @{
66 DateTime EndDate = DateTime.Now.AddDays(GetInteger("Item.Days"));
67 String StartDate = DateTime.Now.ToString("dd/MM/yyyy");
68 String Limit = int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands).ToString();
69
70 if (GetBoolean("Item.StartDateNow") == false){
71 EndDate = Convert.ToDateTime(GetString("Item.StartDate")).AddDays(GetInteger("Item.Days"));
72 StartDate = GetString("Item.StartDate");
73 }
74
75 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+GetString("Item.AccountNumber")+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate.ToString("dd/MM/yyyy");
76
77 if (GetString("Item.Show.Filter") != "alle"){
78 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter");
79 }
80
81 XDocument xdoc = XDocument.Load(linkstring);
82 var elements = xdoc.Element("DATA").Elements("AFTALE");
83
84 foreach (var el in elements)
85 {
86 string id = "0";
87 string type = "alle";
88 DateTime date;
89 string title = "Title";
90 string description = "Description";
91 string fulldate = "Date";
92 string cleanDate = "";
93 string location = "";
94 string document = "";
95 string document_type = "document";
96
97 if (el.Elements("ID").Any()){
98 id = el.Element("ID").Value;
99 }
100
101 if (el.Elements("AFTALETYPE").Any()){
102 type = el.Element("AFTALETYPE").Value;
103 }
104
105 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) {
106 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK"));
107 cleanDate = date.ToString("dddd d. MMMM kl. HH:mm", new CultureInfo("da-DK"));
108 }
109
110 if (el.Elements("OVERSKRIFT").Any()){
111 title = el.Element("OVERSKRIFT").Value;
112 }
113
114 if (el.Elements("BESKRIVELSE").Any()){
115 description = el.Element("BESKRIVELSE").Value;
116 }
117
118 if (el.Elements("DATO_FORMATERET").Any()){
119 fulldate = el.Element("DATO_FORMATERET").Value;
120 }
121
122 if (el.Elements("STED").Any()){
123 location = el.Element("STED").Value;
124 }
125
126 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("URL").Any()){
127 document = "http://kalender.brandsoft.dk/bska/" + el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("URL").Value;
128 }
129
130 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Elements("DOKUMENTTYPE").Any()){
131 document_type = el.Element("OFFENTLIGE_DOKUMENTER").Element("DOKUMENT").Element("DOKUMENTTYPE").Value;
132 }
133
134
135 <li class="event">
136 <div class="event-date">
137 <h3>@title</h3>
138 </div>
139 <div class="event-body">
140 <div class="row">
141 <div class="col-md-12">
142 <p>
143 @description
144 </p>
145
146 @if (location != ""){
147 <p><i>@location</i></p>
148 }
149
150 @if (document != ""){
151 <a href="@document" class="btn btn-dw-primary pull-right" download>Download dokument</a>
152 }
153 </div>
154 </div>
155 </div>
156 <div class="event-footer">
157 <ul class="aux-info-cells">
158 <li><span class="label label-default">@type</span> @fulldate</li>
159 </ul>
160 </div>
161 </li>
162 }
163 }
164 </ul>
165
166 <div class="hidden-lg hidden-md hidden-sm">
167 @CalendarList();
168 </div>
169 }
170 </div>
171
172 @helper CalendarList(){
173 <ul class="list-listings blog-list">
174 @{
175 DateTime EndDate = DateTime.Now.AddDays(GetInteger("Item.Days"));
176 String StartDate = DateTime.Now.ToString("dd/MM/yyyy");
177 String Limit = int.Parse(GetString("Item.CountLimit"), NumberStyles.AllowThousands).ToString();
178
179 if (GetBoolean("Item.StartDateNow") == false){
180 EndDate = Convert.ToDateTime(GetString("Item.StartDate")).AddDays(GetInteger("Item.Days"));
181 StartDate = GetString("Item.StartDate");
182 }
183
184 string linkstring = GetString("Item.FeedLink")+"&InKontonr="+GetString("Item.AccountNumber")+"&InMaksAntalAftaler="+Limit+"&InDatoFra="+StartDate+"&InDatoTil="+EndDate.ToString("dd/MM/yyyy");
185
186 if (GetString("Item.Show.Filter") != "alle"){
187 linkstring += "&InAftaletypeID=" + GetString("Item.Show.Filter");
188 }
189
190 XDocument xdoc = XDocument.Load(linkstring);
191 var elements = xdoc.Element("DATA").Elements("AFTALE");
192
193 foreach (var el in elements)
194 {
195 string id = "0";
196 string type = "alle";
197 DateTime date;
198 string title = "Title";
199 string description = "Description";
200 string fulldate = "Date";
201 string cleanDate = "";
202 string day = "";
203 string month = "";
204 string location = "";
205 string document = "";
206
207 if (el.Elements("ID").Any()){
208 id = el.Element("ID").Value;
209 }
210
211 if (el.Elements("AFTALETYPE").Any()){
212 type = el.Element("AFTALETYPE").Value;
213 }
214
215 if (el.Elements("DATO_FRA").Any() && el.Elements("KL_FRA").Any()) {
216 date = DateTime.Parse(el.Element("DATO_FRA").Value + " " + el.Element("KL_FRA").Value, new CultureInfo("da-DK"));
217 cleanDate = date.ToString("dddd d. MMMM kl. HH:mm", new CultureInfo("da-DK"));
218 day = date.ToString(" d", new CultureInfo("da-DK"));
219 month = date.ToString("MMM", new CultureInfo("da-DK"));
220 }
221
222 if (el.Elements("OVERSKRIFT").Any()){
223 title = el.Element("OVERSKRIFT").Value;
224 }
225
226 if (el.Elements("BESKRIVELSE").Any()){
227 description = el.Element("BESKRIVELSE").Value;
228 }
229
230 if (el.Elements("DATO_FORMATERET").Any()){
231 fulldate = el.Element("DATO_FORMATERET").Value;
232 }
233
234 if (el.Elements("STED").Any()){
235 location = el.Element("STED").Value;
236 }
237
238 if (el.Elements("OFFENTLIGE_DOKUMENTER").Any() && el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT").Any()){
239 foreach(var doc in el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT")) {
240 if (doc.Element("DOKUMENTTYPE").Value == "OFFENTLIGT_AFTALE_BILLEDE"){
241 document = "http://kalender.brandsoft.dk/bska/" + doc.Element("URL").Value;
242 break;
243 }
244 }
245 }
246
247
248
249 string link_start = "";
250 string link_end = "";
251 if (GetString("Item.ShowInfo") != "Hidden"){
252 link_start = "<div href=\"#\" onclick=\"toggle_visibility("+id+");\" style=\"cursor:pointer\">";
253 link_end = "</div>";
254 }
255 string registration_url = "https://kalenderhtml5.brandsoft.dk/#/event/" + GetString("Item.AccountNumber") + "/" + id;
256
257
258
259 @link_start
260 <div class="row">
261 <div class="media col-md-12">
262
263 <div class="media-left">
264
265 <div class="media-object calendar-date bg-primary color-secondary text-center"><span>@day</span> @month</div>
266
267 </div>
268 <div class="media-body">
269 <h2 class="media-heading color-primary">@title</h2>
270 @* <a href="@registration_url" target="_blank">Tilmeld</a> *@
271
272 <p class="list-item-info">@type</p>
273 <p class="list-item-info nomargin"><i class="fa fa-fw fa-calendar-o"></i> @fulldate</p>
274 <p class="list-item-info nomargin"><i class="fa fa-fw fa-map-marker"></i> @location</p>
275
276
277
278 @{
279 string isHidden = "";
280 if (GetString("Item.ShowInfo") == "Closed" || GetString("Item.ShowInfo") == "Hidden"){
281 isHidden = "style=\"display:none;\"";
282 }
283 }
284
285 <div id="@id" @isHidden>
286 <p>@description</p>
287
288 @{
289 var document_elements = el.Element("OFFENTLIGE_DOKUMENTER").Elements("DOKUMENT");
290 foreach(var doc in document_elements) {
291 if(doc.Element("DOKUMENTTYPE").Value == "OFFENTLIGT_DOKUMENT") {
292 string name = doc.Element("ORG_FILNAVN").Value;
293 string url = "http://kalender.brandsoft.dk/bska/" + doc.Element("URL").Value;
294 <br>
295 <i class="fa fa-fw fa-file-o list-item-info"></i><a href="@url" target="_blank" class="document-link">@name</a>
296 }
297 }
298 }
299 </div>
300
301
302 </div>
303 <div class="media-right hidden-xs" style="width: 33%;">
304 @if (document != ""){
305 if (GetString("Item.ShowInfo") == "Open"){
306 <img class="img-responsive bigPic" src="@document" alt="" id="@(id)_img" style="max-height: 500px; float:right; position: relative;"></img>
307 } else {
308 <img class="img-responsive" src="@document" alt="" id="@(id)_img" style="max-height: 100px; float:right; position: relative;"></img>
309 }
310 }
311 </div>
312
313 </div>
314 </div>
315
316 if (!string.IsNullOrWhiteSpace(description) || !string.IsNullOrWhiteSpace(document)){
317 if (GetString("Item.ShowInfo") == "Open"){
318 <p id="@(id)_chevron" class="text-center chevron"></p>
319 } else if (GetString("Item.ShowInfo") == "Closed") {
320 <p id="@(id)_chevron" class="text-center chevron bottom"></p>
321 }
322 }
323
324 @link_end
325 <hr>
326
327
328 }
329 }
330 </ul>
331 }
332
333 <script type="text/javascript">
334 function toggle_visibility(id) {
335 if($('#' + id + "_chevron").length){
336 $('#' + id).stop().slideToggle('slow');
337 $('#' + id + "_chevron").toggleClass('bottom');
338
339 var image = $('#' + id + "_img")
340 if(image.length && !image.hasClass('bigPic')){
341
342 var container_width = image.parent().width();
343 var image_height;
344 var natural_width = document.getElementById(id + "_img").naturalWidth;
345 var natural_height = document.getElementById(id + "_img").naturalHeight;
346
347 if(natural_width < container_width){ //>
348 container_width = natural_width;
349 }
350
351 var res = container_width / natural_width;
352
353 image_height = natural_height * res;
354
355 if(image_height > 400){
356 image_height = 400;
357 }
358
359 image.addClass('bigPic');
360 image.css('max-height', image_height + "px");
361 }else{
362 image.removeClass('bigPic');
363 image.css('max-height', "100px");
364 }
365 }
366 }
367 </script>
368