Not working Samples

Posted by Community Admin on 05-Aug-2018 12:15

Not working Samples

All Replies

Posted by Community Admin on 10-Nov-2012 00:00

Hi, i tried the Charity Sample Kit from SDK. The first run ends with error on DB connection. No wonder, even though i entered correct connection to my SQL Server, the sample try access the server specified in DataConfig.config, where was registered .\SQLexpress2008 ! I can overcome this error witch changing the correct connection string in DataConfig file and run the sample within Visual Studio. I wanted to try how works the reminder from Events. After click on "Add reminder" is the "404 Error" displayed with message Description:
HTTP 404. The resource you are looking for (or one of its dependencies)
could have been removed, had its name changed, or is temporarily unavailable.
 Please review the following URL and make sure that it is spelled correctly.


Requested URL:
/ical/event/4eade9fe-5b4e-4da5-b061-e112b2d795de

and further:

In SDK stands written by Charity Sample under Goals:
- Donation Widget with PayPal integration (where ?) i click on Donate i see no Donation Widget on Page !!!
- Custom Templates and themes .... i see only one Theme which is in Charity Sample since first SDK release
- Volunteer and job opportunity pages .... where ? .... I am blind?

The overall quality of Sitefinity and SDK is terrible. More and more I start think, that recommend customers migrate to another CMS system.


Posted by Community Admin on 19-Nov-2012 00:00

Yeah, the SDK Sample is broken and frustrating.

If this helps:
Here's my implementation with an .ashx httphandler.

I modified the sample code for the ICalReminder feature. If that's what you're trying to do:

I then call the handler  via a link in the widget template.
link code:
<a href='/Widgets/Calendar/ICalReminder.ashx?event=<%# Eval("Id")%>'>Add to Calendar</a>

Create a generic handler in .NET - .cs filetype (.ashx)

in your code-behind do something like this:
using DDay.iCal;
using DDay.iCal.Serialization.iCalendar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using Telerik.Sitefinity;
using Telerik.Sitefinity.Modules.Events;

namespace SitefinityWebApp.Widgets.Calendar

    /// <summary>
    /// Summary description for ICalReminder
    /// </summary>
    public class ICalReminder : IHttpHandler
   
        private Guid _eventID;

        public ICalReminder()
       
        

        public bool IsReusable
        
            get return false;
        

        public void ProcessRequest(HttpContext context)
        
            var host = context.Request.Url.Host;
            var sEventId = context.Request.QueryString["event"];


            if (Guid.TryParse(sEventId, out _eventID))
           

                // initialize calendar item
                var cal = new iCalendar();
                cal.Version = "1.0";

                var em = EventsManager.GetManager();

                var ev = em.GetEvent(_eventID);

                if (ev == null) return;

                var appt = new DDay.iCal.Event();
                appt.Start = new iCalDateTime(ev.EventStart.ToUniversalTime());
                if (ev.EventEnd.HasValue)
                    appt.End = new iCalDateTime(ev.EventEnd.Value.ToUniversalTime());
                else
                    appt.IsAllDay = true;

                // save and format description
                var description = ev.Content.ToString().Replace("\r\n", "<br /><br/>");
                description = description.Replace("src=\"/", "src=\"http://" + host + "/");
                appt.AddProperty("X-ALT-DESC", description);

                // non-html property
                var reg = new Regex("<(.|\n)+?>");
                appt.Description = reg.Replace(description, "");

                // event location
                var location = ev.Street;
                // location = location == null ? ev.ContentItem.GetMetaData("Street") : string.Concat(location, " (", ev.ContentItem.GetMetaData("Street"), ")");
                appt.Location = location.ToString();

                appt.Summary = ev.Title;

                // url
                //var evUrl = ConfigurationManager.AppSettings[EventsManager.DefaultContentProvider + "Url"];
                //if (string.IsNullOrEmpty(evUrl)) break;
                appt.Url = new Uri("http://www.bing.com");// string.Concat("http://", host, evUrl, ev.ContentItem.UrlWithExtension);
                cal.Events.Add(appt);

                // write calendar feed!
                var ser = new iCalendarSerializer(cal);
                context.Response.Clear();
                context.Response.ContentType = "text/calendar";
                context.Response.AddHeader("content-disposition", string.Format("attachment; filename=0.ics",ev.Title));
                context.Response.Write(ser.SerializeToString());
                //context.Response.Flush();
           
        

        
   

Posted by Community Admin on 22-Nov-2012 00:00

Hi everyone,

You are right that the features you described are not working correctly in the last version of the Charity sample. The iCal feed, as well as the donation widget will be fixed in the next release.

As for the issue with the connection string, we have not experienced this and it works when we tested. The SDK browser adjusts that connection string every time you specify a DB connection through the pop-up. Try resetting the sample and running it again.

Thank you for this feedback, we will make sure the problems are addressed.

Regards,
Slavo
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

This thread is closed