Пример #1
0
        public string AddTextContent(Site site, TextFolder textFolder, System.Collections.Specialized.NameValueCollection values, [System.Runtime.InteropServices.OptionalAttribute][System.Runtime.InteropServices.DefaultParameterValueAttribute("")]string userid, string vendor)
        {
            var schema = textFolder.GetSchema();

            var textContent = new TextContent();
            foreach (string key in values)
            {
                textContent[key] = values[key];
            }
            textContent.Repository = textFolder.Repository.Name;
            textContent.SchemaName = textFolder.SchemaName;
            textContent.FolderName = textFolder.FullName;

            if (!string.IsNullOrEmpty(values["UUID"]))
            {
                textContent.UUID = values["UUID"];
            }
            textContent = _textContentBinder.Bind(schema, textContent, values, true, false);


            IncomingQueue incomeQueue = new IncomingQueue()
            {
                Message = null,
                Object = new Dictionary<string, object>(textContent),
                ObjectUUID = textContent.IntegrateId,
                ObjectTitle = textContent.GetSummary(),
                Vendor = vendor,
                PublishingObject = PublishingObject.TextContent,
                Action = PublishingAction.Publish,
                SiteName = site.FullName,
                Status = QueueStatus.Pending,
                UtcCreationDate = DateTime.UtcNow,
                UtcProcessedTime = null,
                UUID = Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10)
            };
            _incomeQueueProvider.Add(incomeQueue);

            return textContent.IntegrateId;
        }
Пример #2
0
 public static IHtmlString EditItemAttributes(TextContent data)
 {
     var userName = Page_Context.Current.ControllerContext.HttpContext.User.Identity.Name;
     if (data == null || !Page_Context.Current.EnabledInlineEditing(EditingType.Content)
         || !Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableToEditContent(data, userName))
     {
         return new HtmlString("");
     }
     var availableToPublish = Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableToPublish(data.GetFolder(), userName);
     return new HtmlString(string.Format("editType=\"list\" schema=\"{0}\" folder=\"{1}\" title=\"{2}\" uuid=\"{3}\" published=\"{4}\" editUrl=\"{5}\" summary=\"{6}\" publishAvailable=\"{7}\"",
             data.SchemaName, data.FolderName, data.GetFolder().AsActual().FriendlyText, data.UUID, data.Published
         , Page_Context.Current.Url.Action("InlineEdit", new
         {
             controller = "TextContent",
             Area = "Contents",
             RepositoryName = data.Repository,
             SiteName = Page_Context.Current.PageRequestContext.Site.FullName,
             FolderName = data.FolderName,
             UUID = data.UUID,
             Return = Page_Context.Current.ControllerContext.HttpContext.Request.RawUrl
         }), HttpUtility.HtmlAttributeEncode(data.GetSummary())
         , availableToPublish));
 }
Пример #3
0
        public string UpdateTextContent(Site site, TextFolder textFolder, string uuid, System.Collections.Specialized.NameValueCollection values, [System.Runtime.InteropServices.OptionalAttribute][System.Runtime.InteropServices.DefaultParameterValueAttribute("")]string userid, string vendor)
        {
            var schema = textFolder.GetSchema();
            var textContent = new TextContent(textFolder.Repository.Name, textFolder.SchemaName, textFolder.FullName);

            textContent = _textContentBinder.Bind(schema, textContent, values);

            IncomingQueue incomeQueue = new IncomingQueue(site, Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10))
            {
                Message = null,
                Object = new Dictionary<string, object>(textContent),
                ObjectUUID = textContent.IntegrateId,
                ObjectTitle = textContent.GetSummary(),
                Vendor = vendor,
                PublishingObject = PublishingObject.TextContent,
                Action = PublishingAction.Publish,
                Status = QueueStatus.Pending,
                UtcCreationDate = DateTime.UtcNow,
                UtcProcessedTime = null

            };
            _incomeQueueProvider.Add(incomeQueue);

            return textContent.IntegrateId;
        }