public static string DemoUri(string passphrase)
        {
            var path = "/demos/login?passphrase=" + passphrase;

            return(Parameters.Service.AbsoluteUri != null
                ? Parameters.Service.AbsoluteUri + path
                : Url.AbsoluteUri().Replace(Url.AbsolutePath(), Get(path)));
        }
Exemple #2
0
        private void Notice(SiteSettings ss, string type)
        {
            var title = WikiUtilities.TitleDisplayValue(ss, this);
            var url   = Url.AbsoluteUri().Replace(
                Url.AbsolutePath(), Locations.ItemEdit(WikiId));

            ss.Notifications.Where(o => o.Enabled).ForEach(notification =>
            {
                if (notification.HasRelatedUsers())
                {
                    var users = new List <long>();
                    Rds.ExecuteTable(statements: Rds.SelectWikis(
                                         tableType: Sqls.TableTypes.All,
                                         distinct: true,
                                         column: Rds.WikisColumn()
                                         .Creator()
                                         .Updator(),
                                         where : Rds.WikisWhere().WikiId(WikiId)))
                    .AsEnumerable()
                    .ForEach(dataRow =>
                    {
                        users.Add(dataRow["Creator"].ToLong());
                        users.Add(dataRow["Updator"].ToLong());
                    });
                    notification.ReplaceRelatedUsers(users);
                }
                switch (type)
                {
                case "Created":
                    notification.Send(
                        Displays.Created(title).ToString(),
                        url,
                        NoticeBody(ss, notification));
                    break;

                case "Updated":
                    var body = NoticeBody(ss, notification, update: true);
                    if (body.Length > 0)
                    {
                        notification.Send(
                            Displays.Updated(title).ToString(),
                            url,
                            body);
                    }
                    break;

                case "Deleted":
                    notification.Send(
                        Displays.Deleted(title).ToString(),
                        url,
                        NoticeBody(ss, notification));
                    break;
                }
            });
        }
Exemple #3
0
        public static string Key(Context context)
        {
            var callerOfMethod = context.Action;

            if (Sessions.Created())
            {
                var path = Url.AbsolutePath().ToLower()
                           .Split('/').Where(o => o != string.Empty).ToList();
                var methodIndex = path.IndexOf(callerOfMethod.ToLower());
                return(methodIndex != -1
                    ? path.Take(methodIndex).Join("/")
                    : path.Join("/"));
            }
            return(string.Empty);
        }
 public static string ItemEditAbsoluteUri(long id)
 {
     return(Parameters.Service.AbsoluteUri != null
         ? Parameters.Service.AbsoluteUri + "/items/" + id
         : Url.AbsoluteUri().Replace(Url.AbsolutePath(), ItemEdit(id)));
 }
        protected XDocument GenerateRsd(BlogAddress blogAddress)
        {
            XNamespace rsdNamespace = "http://archipelago.phrasewise.com/rsd";
            XDocument  rsd          = new XDocument(
                new XElement(rsdNamespace + "rsd", new XAttribute("version", "1.0"),
                             new XElement(rsdNamespace + "service",
                                          new XElement(rsdNamespace + "engineName", "Oxite"),
                                          new XElement(rsdNamespace + "engineLink", Url.Oxite()),
                                          new XElement(rsdNamespace + "homePageLink", Url.AbsolutePath(Url.Home())),
                                          new XElement(rsdNamespace + "apis",
                                                       GenerateRsdApiList(blogAddress, rsdNamespace)
                                                       )
                                          )
                             ));

            return(rsd);
        }