コード例 #1
0
ファイル: Page.cs プロジェクト: hbunjes/smartapi
        public void ReplaceContentClass(IContentClass replacement, IDictionary<string, string> oldToNewMapping, Replace replace)
        {
            const string REPLACE_CC =
                @"<PAGE action=""changetemplate"" guid=""{0}"" changeall=""{1}"" holdreferences=""1"" holdexportsettings=""1"" holdauthorizations=""1"" holdworkflow=""1""><TEMPLATE originalguid=""{2}"" changeguid=""{3}"">{4}</TEMPLATE></PAGE>";

            const string REPLACE_ELEMENT = @"<ELEMENT originalguid=""{0}"" changeguid=""{1}""/>";
            var oldElements = ContentClass.Elements;
            var newElements = replacement.Elements;

            var unmappedElements = oldElements.Where(element => !oldToNewMapping.ContainsKey(element.Name));
            var unmappedStr = unmappedElements.Aggregate(
                                                         "",
                                                         (s, element) => s + REPLACE_ELEMENT.RQLFormat(element, RQL.SESSIONKEY_PLACEHOLDER));
            var mappedStr = string.Join(
                                        "",
                                        from entry in oldToNewMapping
                                        let oldElement = oldElements[entry.Key]
                                        let newElement = newElements.GetByName(entry.Value)
                                        select REPLACE_ELEMENT.RQLFormat(oldElement, newElement));

            var isReplacingAll = replace == Replace.ForAllPagesOfContentClass;
            var query = REPLACE_CC.RQLFormat(this, isReplacingAll, ContentClass, replacement, mappedStr + unmappedStr);

            Project.ExecuteRQL(query, RqlType.SessionKeyInProject);

            _contentClass = null;
            _ccGuid = default(Guid);
        }
コード例 #2
0
ファイル: Page.cs プロジェクト: hbunjes/smartapi
 public override void Refresh()
 {
     _contentClass = null;
     _ccGuid = default(Guid);
     _mainLinkElement = null;
     base.Refresh();
 }
コード例 #3
0
        /// <summary>
        ///     Copy this template over to another content class
        /// </summary>
        /// <param name="target"> </param>
        public void CopyToContentClass(IContentClass target)
        {
            const string ADD_TEMPLATE_VARIANT = @"<TEMPLATE action=""assign"" guid=""{0}"">
                    <TEMPLATEVARIANTS action=""addnew"">
                        <TEMPLATEVARIANT name=""{1}"" description=""{2}"" code=""{3}"" fileextension=""{4}"" insertstylesheetinpage=""{5}"" nostartendmarkers=""{6}"" containerpagereference=""{7}""  pdforientation=""{8}"">{3}</TEMPLATEVARIANT></TEMPLATEVARIANTS></TEMPLATE>";
            XmlDocument  xmlDoc =
                target.Project.ExecuteRQL(
                    string.Format(ADD_TEMPLATE_VARIANT, target.Guid.ToRQLString(), HttpUtility.HtmlEncode(Name),
                                  HttpUtility.HtmlEncode(Description), HttpUtility.HtmlEncode(Data),
                                  HttpUtility.HtmlEncode(FileExtension), IsStylesheetIncludedInHeader.ToRQLString(),
                                  ContainsAreaMarksInPage.ToRQLString(), HasContainerPageReference.ToRQLString(),
                                  PdfOrientation), RqlType.SessionKeyInProject);

            if (xmlDoc.DocumentElement.InnerText.Trim().Length == 0)
            {
                return;
            }
            string errorMsg = string.Format("Error during addition of template variant '{0}' to content class '{1}'.",
                                            Name, target.Name);
            //sometimes it's <IODATA><ERROR>Reason</ERROR></IODATA> and sometimes just <IODATA>ERROR</IODATA>
            XmlNodeList errorElements = xmlDoc.GetElementsByTagName("ERROR");

            if (errorElements.Count > 0)
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            errorMsg + string.Format(" Reason: {0}.", errorElements[0].FirstChild.Value));
            }
            throw new SmartAPIException(Session.ServerLogin, errorMsg);
        }
コード例 #4
0
        /// <summary>
        ///     Copies the element to another content class by creating a new element and copying the attribute values to it.
        ///     Make sure to set the language variant in the target project into which the element should be copied, first.
        /// </summary>
        /// <param name="contentClass"> target content class, into which the element should be copied </param>
        /// <returns> the created copy </returns>
        /// <remarks>
        ///     <list type="bullet">
        ///         <item>
        ///             <description>Override this method, if you need to set other values than the direct attributes of the element (e.g. setting text values of TextHtml elements)</description>
        ///         </item>
        ///         <item>
        ///             <description>
        ///                 The target content class is only modified on the server, thus the content class object does not contain the newly created element.
        ///                 If you need an updated version of the content class, you have to retrieve it again with
        ///                 <code>new ContentClass(Project, Guid);</code>
        ///             </description>
        ///         </item>
        ///     </list>
        /// </remarks>
        public IContentClassElement CopyToContentClass(IContentClass contentClass)
        {
            var newContentClassElement = CreateElement(contentClass, Type);
            var assign = new AttributeAssignment();

            assign.AssignAllRedDotAttributesForLanguage(this, newContentClassElement,
                                                        Project.LanguageVariants.Current.Abbreviation);

            var node = (XmlElement)newContentClassElement.XmlElement.Clone();

            node.Attributes.RemoveNamedItem("guid");
            string creationString = GetSaveString(node);

            // <summary>
            // RQL for creating an element from a content class.
            // Two parameters:
            // 1. Content class guid
            // 2. Element to create, make sure it contains an attribute "action" with the value "save"!
            // </summary>
            const string CREATE_ELEMENT = @"<TEMPLATE guid=""{0}"">{1}</TEMPLATE>";

            XmlDocument rqlResult =
                contentClass.Project.ExecuteRQL(string.Format(CREATE_ELEMENT, contentClass.Guid.ToRQLString(),
                                                              creationString));
            var resultElementNode = (XmlElement)rqlResult.GetElementsByTagName("ELEMENT")[0];

            if (resultElementNode == null)
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format("Error during creation of element {0}", this));
            }
            newContentClassElement.Guid = resultElementNode.GetGuid();

            return(newContentClassElement);
        }
コード例 #5
0
 internal ProjectVariantAssignment(IContentClass contentClass, IProjectVariant projectVariant,
                                   ITemplateVariant templateVariant)
 {
     _contentClass    = contentClass;
     _projectVariant  = projectVariant;
     _templateVariant = templateVariant;
 }
コード例 #6
0
 protected ContentClassElement(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass.Project, xmlElement)
 {
     // CreateAttributes("eltname", LANGUAGEVARIANTID);
     ContentClass = contentClass;
     LoadXml();
     _originalName = Name;
 }
コード例 #7
0
        /// <summary>
        ///     Create a new page in the current language variant and link it.
        /// </summary>
        /// <param name="cc"> Content class of the page </param>
        /// <param name="linkGuid"> Guid of the link the page should be linked to </param>
        /// <param name="headline"> The headline, or null (default) for the default headline </param>
        /// <returns> The newly created (and linked) page </returns>
        public IPage CreateAndConnect(IContentClass cc, Guid linkGuid, string headline = null)
        {
            const string CREATE_AND_LINK_PAGE = @"<LINK action=""assign"" guid=""{0}"">{1}</LINK>";
            XmlDocument  xmlDoc =
                _project.ExecuteRQL(string.Format(CREATE_AND_LINK_PAGE, linkGuid.ToRQLString(), PageCreationString(cc, headline)));

            return(CreatePageFromCreationReply(xmlDoc));
        }
コード例 #8
0
        private static string PageCreationString(IContentClass cc, string headline = null)
        {
            const string PAGE_CREATION_STRING = @"<PAGE action=""addnew"" templateguid=""{0}"" {1}/>";

            string headlineString = headline == null ? "" : string.Format(@"headline=""{0}""", HttpUtility.HtmlEncode(headline));

            return(string.Format(PAGE_CREATION_STRING, cc.Guid.ToRQLString(), headlineString));
        }
コード例 #9
0
 public Result(IPage page, DateTime creationDate, IUser originalAuthor, DateTime dateOfLastChange,
               IUser lastEditor, IContentClass contentClass)
 {
     Page             = page;
     CreationDate     = creationDate;
     OriginalAuthor   = originalAuthor;
     DateOfLastChange = dateOfLastChange;
     LastEditor       = lastEditor;
     ContentClass     = contentClass;
 }
コード例 #10
0
 internal TemplateVariant(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass.Project, xmlElement)
 {
     ContentClass = contentClass;
     LoadXml();
     if (IsOnlyPartiallyInitialized(xmlElement))
     {
         IsInitialized = false;
     }
 }
コード例 #11
0
ファイル: IOptionList.cs プロジェクト: hbunjes/smartapi
        internal OptionList(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
        {
            if (xmlElement.SelectSingleNode(@"//SELECTIONS") == null)
            {
                IsInitialized = false;
            }
// ReSharper disable ObjectCreationAsStatement
            //TODO neu implementieren:
            //new OptionListSelectionAttribute(this, "eltoptionlistdata", xmlElement);
// ReSharper restore ObjectCreationAsStatement
        }
コード例 #12
0
        /// <summary>
        ///     Create an empty element of a specific type as child of a content class. Does not insert the element into the contentclass itself, but just provides a vanilla element with an XML node that contains only the "elttype" and the empty "guid" attribute.
        /// </summary>
        /// <param name="contentClass"> parent content class of the element </param>
        /// <param name="elementType"> type of the element </param>
        /// <returns> </returns>
        private static ContentClassElement CreateElement(IContentClass contentClass, ElementType elementType)
        {
            var          doc      = new XmlDocument();
            XmlElement   element  = doc.CreateElement("ELEMENT");
            XmlAttribute typeAttr = doc.CreateAttribute("elttype");
            XmlAttribute guidAttr = doc.CreateAttribute("guid");

            typeAttr.Value = ((int)elementType).ToString(CultureInfo.InvariantCulture);
            guidAttr.Value = new Guid().ToRQLString();
            element.Attributes.Append(typeAttr);
            element.Attributes.Append(guidAttr);

            return(CreateElement(contentClass, element));
        }
コード例 #13
0
 private void CopyPreassignedKeywordsToCC(IContentClass targetCC)
 {
     try
     {
         List <IKeyword> keywordsToAssign =
             PreassignedKeywords.Select(
                 x => targetCC.Project.Categories.GetByName(x.Category.Name).Keywords.GetByName(x.Name)).ToList();
         targetCC.PreassignedKeywords.Set(keywordsToAssign);
     } catch (Exception e)
     {
         throw new SmartAPIException(Session.ServerLogin,
                                     string.Format("Could not copy preassigned keywords for content class {0}",
                                                   Name), e);
     }
 }
コード例 #14
0
        public IContentClassElement ConvertFrom(IProjectObject parent, XmlElement element, RedDotAttribute attribute)
        {
            Guid projectGuid, ccGuid, elementGuid;

            if (!element.TryGetGuid("eltprojectguid", out projectGuid) ||
                !element.TryGetGuid("elttemplateguid", out ccGuid) ||
                !element.TryGetGuid("eltelementguid", out elementGuid))
            {
                return(null);
            }

            string langId = element.GetAttributeValue("eltlanguagevariantid");

            IProject      project      = parent.Session.ServerManager.Projects.GetByGuid(projectGuid);
            IContentClass contentClass = project.ContentClasses.GetByGuid(ccGuid);

            return(contentClass.Elements.GetByGuid(elementGuid));
        }
コード例 #15
0
        private void CopyAttributesToCC(IContentClass targetCC)
        {
            var assignment = new AttributeAssignment();

            assignment.AssignAllLanguageIndependentRedDotAttributes(EditableAreaSettings, targetCC.EditableAreaSettings);

            targetCC.EditableAreaSettings.Commit();
            targetCC.Refresh();
            try
            {
                assignment.AssignAllLanguageIndependentRedDotAttributes(this, targetCC);
            } catch (AttributeChangeException e)
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format(
                                                "Unable to assign attribute {0} in content class {1} of project {2} to content class {3} of project {4}",
                                                e.AttributeName, Name, Project.Name, targetCC.Name,
                                                targetCC.Project.Name), e);
            }
            targetCC.Commit();
        }
コード例 #16
0
        /// <summary>
        ///     Copy selected elements from this content class to another target content class.
        /// </summary>
        /// <param name="targetCC"> Target content class to copy the elements to </param>
        /// <param name="elementNames"> Names of the elements to copy </param>
        public void CopyElementsToContentClass(IContentClass targetCC, params string[] elementNames)
        {
            if (elementNames == null || elementNames.Length == 0)
            {
                return;
            }

            var createdElements = new Dictionary <string, IContentClassElement>();

            using (new LanguageContext(Project))
            {
                var assign = new AttributeAssignment();
                foreach (var languageVariant in Project.LanguageVariants)
                {
                    ILanguageVariant targetLanguageVariant =
                        targetCC.Project.LanguageVariants[languageVariant.Abbreviation];
                    foreach (var curElementName in elementNames)
                    {
                        IContentClassElement curTargetContentClassElement;
                        languageVariant.Select();
                        var curSourceContentClassElement = Elements[curElementName];
                        if (createdElements.TryGetValue(curElementName, out curTargetContentClassElement))
                        {
                            targetLanguageVariant.Select();
                            assign.AssignAllRedDotAttributesForLanguage(curSourceContentClassElement,
                                                                        curTargetContentClassElement,
                                                                        targetLanguageVariant.Abbreviation);
                            curTargetContentClassElement.CommitInCurrentLanguage();
                        }
                        else
                        {
                            targetLanguageVariant.Select();
                            curTargetContentClassElement = curSourceContentClassElement.CopyToContentClass(targetCC);
                            createdElements.Add(curElementName, curTargetContentClassElement);
                        }
                    }
                }
            }
        }
コード例 #17
0
ファイル: IHeadline.cs プロジェクト: erminas/smartapi
 internal Headline(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #18
0
ファイル: IHitList.cs プロジェクト: erminas/smartapi
 internal HitList(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #19
0
ファイル: IPageDefinition.cs プロジェクト: erminas/smartapi
 internal PageDefinition(IContentClass contentClass, XmlElement element)
     : base(contentClass.Project, element)
 {
     _contentClass = contentClass;
     LoadXml();
 }
コード例 #20
0
ファイル: IProjectContent.cs プロジェクト: erminas/smartapi
 internal ProjectContent(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #21
0
 protected ContentClassElement(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass.Project, xmlElement)
 {
     // CreateAttributes("eltname", LANGUAGEVARIANTID);
     ContentClass = contentClass;
     LoadXml();
     _originalName = Name;
 }
コード例 #22
0
        /// <summary>
        ///     Create a new page.
        /// </summary>
        /// <param name="cc"> Content class of the page </param>
        /// <param name="headline"> The headline, or null (default) for the default headline </param>
        /// <returns> The newly created page </returns>
        public IPage Create(IContentClass cc, string headline = null)
        {
            XmlDocument xmlDoc = _project.ExecuteRQL(PageCreationString(cc, headline));

            return(CreatePageFromCreationReply(xmlDoc));
        }
コード例 #23
0
 private void CopyAllElementsToCC(IContentClass targetCC)
 {
     CopyElementsToContentClass(targetCC, Elements.Select(element => element.Name).ToArray());
 }
コード例 #24
0
ファイル: IContentClass.cs プロジェクト: erminas/smartapi
 private void CopyAllElementsToCC(IContentClass targetCC)
 {
     CopyElementsToContentClass(targetCC, Elements.Select(element => element.Name).ToArray());
 }
コード例 #25
0
ファイル: IContentClass.cs プロジェクト: erminas/smartapi
        /// <summary>
        ///     Copy selected elements from this content class to another target content class.
        /// </summary>
        /// <param name="targetCC"> Target content class to copy the elements to </param>
        /// <param name="elementNames"> Names of the elements to copy </param>
        public void CopyElementsToContentClass(IContentClass targetCC, params string[] elementNames)
        {
            if (elementNames == null || elementNames.Length == 0)
            {
                return;
            }

            var createdElements = new Dictionary<string, IContentClassElement>();
            using (new LanguageContext(Project))
            {
                var assign = new AttributeAssignment();
                foreach (var languageVariant in Project.LanguageVariants)
                {
                    ILanguageVariant targetLanguageVariant =
                        targetCC.Project.LanguageVariants[languageVariant.Abbreviation];
                    foreach (var curElementName in elementNames)
                    {
                        IContentClassElement curTargetContentClassElement;
                        languageVariant.Select();
                        var curSourceContentClassElement = Elements[curElementName];
                        if (createdElements.TryGetValue(curElementName, out curTargetContentClassElement))
                        {
                            targetLanguageVariant.Select();
                            assign.AssignAllRedDotAttributesForLanguage(curSourceContentClassElement,
                                                                        curTargetContentClassElement,
                                                                        targetLanguageVariant.Abbreviation);
                            curTargetContentClassElement.CommitInCurrentLanguage();
                        }
                        else
                        {
                            targetLanguageVariant.Select();
                            curTargetContentClassElement = curSourceContentClassElement.CopyToContentClass(targetCC);
                            createdElements.Add(curElementName, curTargetContentClassElement);
                        }
                    }
                }
            }
        }
コード例 #26
0
ファイル: IAttribute.cs プロジェクト: erminas/smartapi
 internal Attribute(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #27
0
ファイル: ITextAnchor.cs プロジェクト: erminas/smartapi
 internal TextAnchor(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #28
0
ファイル: IOptionList.cs プロジェクト: erminas/smartapi
 internal OptionList(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
     if (xmlElement.SelectSingleNode(@"//SELECTIONS") == null)
     {
         IsInitialized = false;
     }
     // ReSharper disable ObjectCreationAsStatement
     //TODO neu implementieren:
     //new OptionListSelectionAttribute(this, "eltoptionlistdata", xmlElement);
     // ReSharper restore ObjectCreationAsStatement
 }
コード例 #29
0
ファイル: IMedia.cs プロジェクト: erminas/smartapi
 internal Media(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #30
0
 internal StandardFieldNumeric(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #31
0
ファイル: IArea.cs プロジェクト: erminas/smartapi
 internal Area(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
     PreassignedContentClasses = new PreassignedContentClassesAndPageDefinitions(this);
     _targetContainerPreassignment = new TargetContainerPreassignment(this);
 }
コード例 #32
0
ファイル: IContentClass.cs プロジェクト: erminas/smartapi
        private void CopyAttributesToCC(IContentClass targetCC)
        {
            var assignment = new AttributeAssignment();
            assignment.AssignAllLanguageIndependentRedDotAttributes(EditableAreaSettings, targetCC.EditableAreaSettings);

            targetCC.EditableAreaSettings.Commit();
            targetCC.Refresh();
            try
            {
                assignment.AssignAllLanguageIndependentRedDotAttributes(this, targetCC);
            } catch (AttributeChangeException e)
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format(
                                                "Unable to assign attribute {0} in content class {1} of project {2} to content class {3} of project {4}",
                                                e.AttributeName, Name, Project.Name, targetCC.Name,
                                                targetCC.Project.Name), e);
            }
            targetCC.Commit();
        }
コード例 #33
0
 protected AbstractWorkflowAssignments(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
     _workflowAssignments = new WorkflowAssignments(this);
 }
コード例 #34
0
ファイル: IContentClass.cs プロジェクト: erminas/smartapi
 private void CopyPreassignedKeywordsToCC(IContentClass targetCC)
 {
     try
     {
         List<IKeyword> keywordsToAssign =
             PreassignedKeywords.Select(
                 x => targetCC.Project.Categories.GetByName(x.Category.Name).Keywords.GetByName(x.Name)).ToList();
         targetCC.PreassignedKeywords.Set(keywordsToAssign);
     } catch (Exception e)
     {
         throw new SmartAPIException(Session.ServerLogin,
                                     string.Format("Could not copy preassigned keywords for content class {0}",
                                                   Name), e);
     }
 }
コード例 #35
0
        /// <summary>
        ///     Copies the element to another content class by creating a new element and copying the attribute values to it.
        ///     Make sure to set the language variant in the target project into which the element should be copied, first.
        /// </summary>
        /// <param name="contentClass"> target content class, into which the element should be copied </param>
        /// <returns> the created copy </returns>
        /// <remarks>
        ///     <list type="bullet">
        ///         <item>
        ///             <description>Override this method, if you need to set other values than the direct attributes of the element (e.g. setting text values of TextHtml elements)</description>
        ///         </item>
        ///         <item>
        ///             <description>
        ///                 The target content class is only modified on the server, thus the content class object does not contain the newly created element.
        ///                 If you need an updated version of the content class, you have to retrieve it again with
        ///                 <code>new ContentClass(Project, Guid);</code>
        ///             </description>
        ///         </item>
        ///     </list>
        /// </remarks>
        public IContentClassElement CopyToContentClass(IContentClass contentClass)
        {
            var newContentClassElement = CreateElement(contentClass, Type);
            var assign = new AttributeAssignment();
            assign.AssignAllRedDotAttributesForLanguage(this, newContentClassElement,
                                                        Project.LanguageVariants.Current.Abbreviation);

            var node = (XmlElement) newContentClassElement.XmlElement.Clone();
            node.Attributes.RemoveNamedItem("guid");
            string creationString = GetSaveString(node);

            // <summary>
            // RQL for creating an element from a content class.
            // Two parameters:
            // 1. Content class guid
            // 2. Element to create, make sure it contains an attribute "action" with the value "save"!
            // </summary>
            const string CREATE_ELEMENT = @"<TEMPLATE guid=""{0}"">{1}</TEMPLATE>";

            XmlDocument rqlResult =
                contentClass.Project.ExecuteRQL(string.Format(CREATE_ELEMENT, contentClass.Guid.ToRQLString(),
                                                              creationString));
            var resultElementNode = (XmlElement) rqlResult.GetElementsByTagName("ELEMENT")[0];
            if (resultElementNode == null)
            {
                throw new SmartAPIException(Session.ServerLogin,
                                            string.Format("Error during creation of element {0}", this));
            }
            newContentClassElement.Guid = resultElementNode.GetGuid();

            return newContentClassElement;
        }
コード例 #36
0
ファイル: IContentClass.cs プロジェクト: erminas/smartapi
 internal ContentClassVersion(IContentClass parent, XmlElement xmlElement)
     : base(parent.Project, xmlElement)
 {
     ContentClass = parent;
 }
コード例 #37
0
 internal DatabaseContent(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
     //We need to add eltsrc with sessionkey, because otherwise eltalt won't get stored (setting alt through the smart tree doesn't work for that reason).
     XmlElement.SetAttributeValue("eltsrc", RQL.SESSIONKEY_PLACEHOLDER);
 }
コード例 #38
0
ファイル: IDatabaseContent.cs プロジェクト: erminas/smartapi
 internal DatabaseContent(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
     //We need to add eltsrc with sessionkey, because otherwise eltalt won't get stored (setting alt through the smart tree doesn't work for that reason).
     XmlElement.SetAttributeValue("eltsrc", RQL.SESSIONKEY_PLACEHOLDER);
 }
コード例 #39
0
 internal List(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
     _targetContainerPreassignment = new TargetContainerPreassignment(this);
     PreassignedContentClasses     = new PreassignedContentClassesAndPageDefinitions(this);
     _referencePreassignment       = new ReferencePreassignment(this);
 }
コード例 #40
0
ファイル: IBrowse.cs プロジェクト: hbunjes/smartapi
 internal Browse(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
 }
コード例 #41
0
ファイル: IStandardFieldURL.cs プロジェクト: erminas/smartapi
 internal StandardFieldURL(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #42
0
 internal ImageAnchor(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
 }
コード例 #43
0
 internal PageDefinitions(IContentClass contentClass, Caching caching) : base(caching)
 {
     _contentClass = contentClass;
     RetrieveFunc  = GetPageDefinitions;
 }
コード例 #44
0
 protected ContentClassContentElement(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #45
0
 internal Frame(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
     PreassignedContentClasses = new PreassignedContentClassesAndPageDefinitions(this);
 }
コード例 #46
0
 /// <summary>
 ///     Create an element out of its XML representation (uses the attribute "elttype") to determine the element type and create the appropriate object.
 /// </summary>
 /// <param name="contentClass"> parent content class that contains the element </param>
 /// <param name="xmlElement"> XML representation of the element </param>
 /// <exception cref="ArgumentException">if the "elttype" attribute of the XML node contains an unknown value</exception>
 internal static ContentClassElement CreateElement(IContentClass contentClass, XmlElement xmlElement)
 {
     var type = (ElementType) int.Parse(xmlElement.GetAttributeValue("elttype"));
     switch (type)
     {
         case ElementType.DatabaseContent:
             return new DatabaseContent(contentClass, xmlElement);
         case ElementType.TextHtml:
             return new TextHtml(contentClass, xmlElement);
         case ElementType.TextAscii:
             return new TextAscii(contentClass, xmlElement);
         case ElementType.StandardFieldText:
         case ElementType.StandardFieldTextLegacy:
             return new StandardFieldText(contentClass, xmlElement);
         case ElementType.StandardFieldNumeric:
             return new StandardFieldNumeric(contentClass, xmlElement);
         case ElementType.StandardFieldDate:
             return new StandardFieldDate(contentClass, xmlElement);
         case ElementType.StandardFieldTime:
             return new StandardFieldTime(contentClass, xmlElement);
         case ElementType.StandardFieldUserDefined:
             return new StandardFieldUserDefined(contentClass, xmlElement);
         case ElementType.StandardFieldEmail:
             return new StandardFieldEmail(contentClass, xmlElement);
         case ElementType.StandardFieldUrl:
             return new StandardFieldURL(contentClass, xmlElement);
         case ElementType.Headline:
             return new Headline(contentClass, xmlElement);
         case ElementType.Background:
             return new Background(contentClass, xmlElement);
         case ElementType.Image:
             return new Image(contentClass, xmlElement);
         case ElementType.Media:
             return new Media(contentClass, xmlElement);
         case ElementType.ListEntry:
             return new ListEntry(contentClass, xmlElement);
         case ElementType.Transfer:
             return new Transfer(contentClass, xmlElement);
         case ElementType.Ivw:
             return new IVW(contentClass, xmlElement);
         case ElementType.OptionList:
             return new OptionList(contentClass, xmlElement);
         case ElementType.Attribute:
             return new Attribute(contentClass, xmlElement);
         case ElementType.Info:
             return new Info(contentClass, xmlElement);
         case ElementType.Browse:
             return new Browse(contentClass, xmlElement);
         case ElementType.Area:
             return new Area(contentClass, xmlElement);
         case ElementType.AnchorAsImage:
             return new ImageAnchor(contentClass, xmlElement);
         case ElementType.AnchorAsText:
             return new TextAnchor(contentClass, xmlElement);
         case ElementType.Container:
             return new Container(contentClass, xmlElement);
         case ElementType.Frame:
             return new Frame(contentClass, xmlElement);
         case ElementType.SiteMap:
             return new SiteMap(contentClass, xmlElement);
         case ElementType.HitList:
             return new HitList(contentClass, xmlElement);
         case ElementType.List:
             return new List(contentClass, xmlElement);
         case ElementType.ProjectContent:
             return new ProjectContent(contentClass, xmlElement);
         case ElementType.ConditionRedDotLiveOrDeliveryServer:
             return new DeliveryServerConstraint(contentClass, xmlElement);
         default:
             throw new ArgumentException("unknown element type: " + type);
     }
 }
コード例 #47
0
 internal ProjectContent(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
 }
コード例 #48
0
ファイル: IText.cs プロジェクト: erminas/smartapi
 protected Text(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #49
0
        /// <summary>
        ///     Create an empty element of a specific type as child of a content class. Does not insert the element into the contentclass itself, but just provides a vanilla element with an XML node that contains only the "elttype" and the empty "guid" attribute.
        /// </summary>
        /// <param name="contentClass"> parent content class of the element </param>
        /// <param name="elementType"> type of the element </param>
        /// <returns> </returns>
        private static ContentClassElement CreateElement(IContentClass contentClass, ElementType elementType)
        {
            var doc = new XmlDocument();
            XmlElement element = doc.CreateElement("ELEMENT");
            XmlAttribute typeAttr = doc.CreateAttribute("elttype");
            XmlAttribute guidAttr = doc.CreateAttribute("guid");
            typeAttr.Value = ((int) elementType).ToString(CultureInfo.InvariantCulture);
            guidAttr.Value = new Guid().ToRQLString();
            element.Attributes.Append(typeAttr);
            element.Attributes.Append(guidAttr);

            return CreateElement(contentClass, element);
        }
コード例 #50
0
 internal DeliveryServerConstraint(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #51
0
ファイル: ITemplateVariant.cs プロジェクト: erminas/smartapi
 internal TemplateVariant(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass.Project, xmlElement)
 {
     ContentClass = contentClass;
     LoadXml();
     if (IsOnlyPartiallyInitialized(xmlElement))
     {
         IsInitialized = false;
     }
 }
コード例 #52
0
 internal static IContentClassElement CreateElement(IContentClass contentClass, Guid elementGuid)
 {
     var xmlElement = GetRQLRepresentation(contentClass.Project, elementGuid);
     return CreateElement(contentClass, xmlElement);
 }
コード例 #53
0
 internal ContentClassVersion(IContentClass parent, XmlElement xmlElement) : base(parent.Project, xmlElement)
 {
     ContentClass = parent;
 }
コード例 #54
0
ファイル: ITemplateVariant.cs プロジェクト: erminas/smartapi
 /// <summary>
 ///     Copy this template over to another content class
 /// </summary>
 /// <param name="target"> </param>
 public void CopyToContentClass(IContentClass target)
 {
     const string ADD_TEMPLATE_VARIANT = @"<TEMPLATE action=""assign"" guid=""{0}"">
             <TEMPLATEVARIANTS action=""addnew"">
                 <TEMPLATEVARIANT name=""{1}"" description=""{2}"" code=""{3}"" fileextension=""{4}"" insertstylesheetinpage=""{5}"" nostartendmarkers=""{6}"" containerpagereference=""{7}""  pdforientation=""{8}"">{3}</TEMPLATEVARIANT></TEMPLATEVARIANTS></TEMPLATE>";
     XmlDocument xmlDoc =
         target.Project.ExecuteRQL(
             string.Format(ADD_TEMPLATE_VARIANT, target.Guid.ToRQLString(), HttpUtility.HtmlEncode(Name),
                           HttpUtility.HtmlEncode(Description), HttpUtility.HtmlEncode(Data),
                           HttpUtility.HtmlEncode(FileExtension), IsStylesheetIncludedInHeader.ToRQLString(),
                           ContainsAreaMarksInPage.ToRQLString(), HasContainerPageReference.ToRQLString(),
                           PdfOrientation), RqlType.SessionKeyInProject);
     if (xmlDoc.DocumentElement.InnerText.Trim().Length == 0)
     {
         return;
     }
     string errorMsg = string.Format("Error during addition of template variant '{0}' to content class '{1}'.",
                                     Name, target.Name);
     //sometimes it's <IODATA><ERROR>Reason</ERROR></IODATA> and sometimes just <IODATA>ERROR</IODATA>
     XmlNodeList errorElements = xmlDoc.GetElementsByTagName("ERROR");
     if (errorElements.Count > 0)
     {
         throw new SmartAPIException(Session.ServerLogin,
                                     errorMsg + string.Format(" Reason: {0}.", errorElements[0].FirstChild.Value));
     }
     throw new SmartAPIException(Session.ServerLogin, errorMsg);
 }
コード例 #55
0
 internal StandardFieldEmail(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
 }
コード例 #56
0
ファイル: IListEntry.cs プロジェクト: erminas/smartapi
 internal ListEntry(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
 }
コード例 #57
0
ファイル: ITextHtml.cs プロジェクト: erminas/smartapi
 internal TextHtml(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
     //TODO checken, ob die werte in editoroptions nicht invertiert enthalten sind
 }
コード例 #58
0
ファイル: IContainer.cs プロジェクト: erminas/smartapi
 internal Container(IContentClass contentClass, XmlElement xmlElement)
     : base(contentClass, xmlElement)
 {
     PreassignedContentClasses = new PreassignedContentClassesAndPageDefinitions(this);
     _referencePreassignment = new ReferencePreassignment(this);
 }
コード例 #59
0
 internal TextHtml(IContentClass contentClass, XmlElement xmlElement) : base(contentClass, xmlElement)
 {
     //TODO checken, ob die werte in editoroptions nicht invertiert enthalten sind
 }
コード例 #60
0
ファイル: ITemplateVariant.cs プロジェクト: erminas/smartapi
 public TemplateVariant(IContentClass contentClass, Guid guid)
     : base(contentClass.Project, guid)
 {
     ContentClass = contentClass;
 }