Предоставляет возможность определения url сайта.
Exemplo n.º 1
0
 /// <summary>
 /// Хвост (теги &lt;a> и &lt;img>) для локальных ссылок.
 /// </summary>
 /// <param name="provider"></param>
 /// <param name="mid">ID сообщения.</param>
 private static string GetMsgInDbLinkPostfix(
     IServiceProvider provider,
     int mid)
 {
     return(string.Format(_imageFormatPostfix,
                          SiteUrlHelper.GetMessageUrl(mid),
                          GetImageUri(provider, "ExtBrowser", StyleImageType.Small),
                          SR.MsgExtBrowserLinkTitle));
 }
Exemplo n.º 2
0
        public string GetNotFoundMessage(string messageName)
        {
            const string messageFormat =
                "<a class='m' href='{0}' title='{1}'>{1}</a>&nbsp;" + _imageLinkFormat;

            var styleImageManager = _serviceProvider.GetRequiredService <IStyleImageManager>();
            var externalLink      = string.Format(messageFormat,
                                                  SiteUrlHelper.GetInfoUrl(messageName),
                                                  SR.MsgExtBrowserLinkTitle,
                                                  styleImageManager.GetImageUri("ExtBrowser", StyleImageType.Small));

            return(string.Format(
                       GetStringTemplate(_templateMessageNotFound),
                       string.Format(SR.MessageNotFound, messageName),
                       externalLink));
        }
Exemplo n.º 3
0
        private static string ProcessRsdnLinkInternal(
            IServiceProvider provider,
            string name,
            string text)
        {
            string link;
            string imageUrl;

            var msg =
                string.IsNullOrEmpty(name)
                                        ? null
                                        : DatabaseManager
                .GetMessageByName(
                    provider,
                    name,
                    m => new { m.ID, m.Subject, m.Date, m.UserNick });

            if (msg == null)
            {
                link     = SiteUrlHelper.GetInfoUrl(name);
                imageUrl = GetImageUri(provider, @"ForumImages\webref", StyleImageType.ConstSize);
            }
            else
            {
                link     = FormatUri(JanusProtocolResourceType.Message, msg.ID.ToString());
                imageUrl = GetImageUri(provider, "NameGroup", StyleImageType.ConstSize);
            }

            const string format =
                "<a class='m' href='{0}' title='{4}'><img border='0' align='absmiddle' src='{1}'></a>" +
                "&nbsp;<a class='m' href='{0}' title='{4}'>{2}</a>{3}";

            return
                (string.Format(
                     format,
                     link,
                     imageUrl,
                     text,
                     msg != null ? GetMsgInDbLinkPostfix(provider, msg.ID) : string.Empty,
                     msg != null
                                                ? FormatMsgLinkTitle(msg.Subject, msg.Date, msg.UserNick)
                                                : link));
        }
Exemplo n.º 4
0
        public string GetNotFoundMessage(int mid)
        {
            const string messageFormat =
                _imageLinkFormat + "&nbsp;<a class='m' href='{0}' title='{1}'>{1}</a>&nbsp;";

            var styleImageManager = _serviceProvider.GetRequiredService <IStyleImageManager>();
            var absentMessage     = string.Format(messageFormat,
                                                  FormatUri(JanusProtocolResourceType.MessageAbsent, mid.ToString()),
                                                  SR.MessageAbsentLoadTitle,
                                                  styleImageManager.GetImageUri("MsgNotInDb", StyleImageType.ConstSize));

            var externalLink = string.Format(_imageLinkFormat,
                                             SiteUrlHelper.GetMessageUrl(mid),
                                             SR.MsgExtBrowserLinkTitle,
                                             styleImageManager.GetImageUri("ExtBrowser", StyleImageType.Small));

            return(string.Format(
                       GetStringTemplate(_templateMessageNotFound),
                       string.Format(SR.MessageNotFound, mid),
                       absentMessage + externalLink));
        }
Exemplo n.º 5
0
 public void ExecuteOpenForumOnRsdn(
     ICommandContext context, int?forumId)
 {
     context.OpenUrlInBrowser(
         SiteUrlHelper.GetForumUrl(GetForum(context, forumId).Name));
 }
Exemplo n.º 6
0
 public void ExecuteOpenFileUploadOnRsdn(ICommandContext context)
 {
     context.OpenUrlInBrowser(SiteUrlHelper.GetFileUploadUrl());
 }
Exemplo n.º 7
0
 public void ExecuteOpenMessageRatingOnRsdn(ICommandContext context, int?messageId)
 {
     context.OpenUrlInBrowser(
         SiteUrlHelper.GetRatingUrl(
             ForumCommandHelper.GetMessageId(context, messageId)));
 }
Exemplo n.º 8
0
        public void ExecuteCopyMessageAuthorAddress(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            ClipboardHelper.CopyUrl(SiteUrlHelper.GetUserProfileUrl(msg.UserID), msg.UserNick);
        }
Exemplo n.º 9
0
        public void ExecuteCopyMessageAddress(ICommandContext context, int?messageId)
        {
            var msg = ForumMessageCommandHelper.GetMessage(context, messageId);

            ClipboardHelper.CopyUrl(SiteUrlHelper.GetMessageUrl(msg.ID), msg.Subject);
        }