/// <summary>
    /// Clears HashTables.
    /// </summary>
    private void ClearHashtables()
    {
        // Clear the object type hashtable
        ProviderStringDictionary.ReloadDictionaries(ClassName, true);

        // Clear the classes hashtable
        ProviderStringDictionary.ReloadDictionaries("cms.class", true);

        // Clear class structures
        ClassStructureInfo.Remove(ClassName, true);

        // Clear form resolver
        FormControlsResolvers.ClearResolvers(true);
    }
    /// <summary>
    /// OnAfterSave event handler.
    /// </summary>
    protected void editElem_OnAfterSave(object sender, EventArgs e)
    {
        if (oldClassName != DocumentType.ClassName)
        {
            // Move icons if class name was changed
            RefreshIcon(oldClassName, DocumentType.ClassName, DocumentType.ClassIsCoupledClass, null);
            RefreshIcon(oldClassName, DocumentType.ClassName, DocumentType.ClassIsCoupledClass, "48x48");
        }

        int  inheritedID      = DocumentType.ClassInheritsFromClassID;
        bool structureChanged = false;

        // Ensure (update) the inheritance
        if (inheritedID != oldInheritedID)
        {
            if (inheritedID > 0)
            {
                // Update the inherited fields
                DataClassInfo parentClass = DataClassInfoProvider.GetDataClassInfo(inheritedID);
                if (parentClass != null)
                {
                    FormHelper.UpdateInheritedClass(parentClass, DocumentType);
                }
            }
            else
            {
                // Remove the inherited fields
                FormHelper.RemoveInheritance(DocumentType, false);
            }

            structureChanged = true;
        }

        if ((oldClassName.ToLowerCSafe() != DocumentType.ClassName.ToLowerCSafe()) && (DocumentType.ClassIsDocumentType))
        {
            structureChanged = true;
        }

        // Updates data class in DB (inner unique class name check)
        DataClassInfoProvider.SetDataClassInfo(DocumentType);

        if (structureChanged)
        {
            // Create view for document types
            SqlGenerator.GenerateDefaultView(DocumentType, null);

            // Clear class structures
            ClassStructureInfo.Remove(DocumentType.ClassName, true);
        }
    }
Esempio n. 3
0
        private void ClearHashtables(string className)
        {
            ClassStructureInfo.Remove(className, true);
            FormEngineWebUIResolvers.ClearResolvers(true);

            var ti = ObjectTypeManager.GetTypeInfo(className);

            if (ti == null || ti.ProviderType == null)
            {
                return;
            }

            ti.InvalidateColumnNames();
            ti.InvalidateAllObjects();
        }
    /// <summary>
    /// OnAfterSave event handler.
    /// </summary>
    protected void editElem_OnAfterSave(object sender, EventArgs e)
    {
        string newClassName     = DocumentType.ClassName;
        bool   classNameChanged = !string.Equals(oldClassName, newClassName, StringComparison.InvariantCultureIgnoreCase);

        if (classNameChanged)
        {
            // Move icons if class name was changed
            RefreshIcon(oldClassName, newClassName, DocumentType.ClassIsCoupledClass, null);
            RefreshIcon(oldClassName, newClassName, DocumentType.ClassIsCoupledClass, "48x48");
        }

        // Ensure (update) the inheritance
        int inheritedID = DocumentType.ClassInheritsFromClassID;

        if (inheritedID != oldInheritedID)
        {
            if (inheritedID > 0)
            {
                // Update the inherited fields
                DataClassInfo parentClass = DataClassInfoProvider.GetDataClassInfo(inheritedID);
                if (parentClass != null)
                {
                    FormHelper.UpdateInheritedClass(parentClass, DocumentType);
                }
            }
            else
            {
                // Remove the inherited fields
                FormHelper.RemoveInheritance(DocumentType, false);
            }

            // Clear class structures
            ClassStructureInfo.Remove(DocumentType.ClassName, true);
        }

        // Synchronize site bindings
        if (oldResourceID != DocumentType.ClassResourceID)
        {
            DocumentTypeHelper.SynchronizeSiteBindingsWithResource(DocumentType as DocumentTypeInfo);
        }
    }
Esempio n. 5
0
    /// <summary>
    /// OnAfterSave event handler.
    /// </summary>
    protected void editElem_OnAfterSave(object sender, EventArgs e)
    {
        string newClassName     = DocumentType.ClassName;
        bool   classNameChanged = !oldClassName.Equals(newClassName, StringComparison.InvariantCultureIgnoreCase);

        if (classNameChanged)
        {
            // Move icons if class name was changed
            RefreshIcon(oldClassName, newClassName, DocumentType.ClassIsCoupledClass, null);
            RefreshIcon(oldClassName, newClassName, DocumentType.ClassIsCoupledClass, "48x48");
        }

        // Ensure (update) the inheritance
        int inheritedID = DocumentType.ClassInheritsFromClassID;

        if (inheritedID != oldInheritedID)
        {
            if (inheritedID > 0)
            {
                // Update the inherited fields
                DataClassInfo parentClass = DataClassInfoProvider.GetDataClassInfo(inheritedID);
                if (parentClass != null)
                {
                    FormHelper.UpdateInheritedClass(parentClass, DocumentType);
                }
            }
            else
            {
                // Remove the inherited fields
                FormHelper.RemoveInheritance(DocumentType, false);
            }

            // Clear class structures
            ClassStructureInfo.Remove(DocumentType.ClassName, true);
        }

        if (classNameChanged)
        {
            // Generate new default view if class name changed
            SqlGenerator.GenerateDefaultView(DocumentType, null);
        }
    }
Esempio n. 6
0
    /// <summary>
    /// Finds suitable index for order by statement.
    /// </summary>
    private Index FindOrderByIndex(ClassStructureInfo classStructureInfo)
    {
        var indexes = classStructureInfo.GetTableIndexes();

        if (indexes == null)
        {
            return(null);
        }

        // Clustered index has the best performance for paging but when not unique, stable result sets are not guaranteed over individual paging queries
        var clusteredIndex = indexes.GetClusteredIndex();

        if ((clusteredIndex != null) && clusteredIndex.IsUnique)
        {
            return(clusteredIndex);
        }

        // Fall back to primary key index and then any index which is better than paging over non-indexed columns
        return(indexes.GetPrimaryKeyIndex() ?? indexes.GetIndexes().FirstOrDefault());
    }
Esempio n. 7
0
    /// <summary>
    /// Adds GUID field to form definition.
    /// </summary>
    private void CreateGUID()
    {
        bool success;

        try
        {
            if (FormInfo == null)
            {
                return;
            }

            // Create GUID field
            FormFieldInfo ffiGuid = new FormFieldInfo();

            // Fill FormInfo object
            ffiGuid.Name = "ItemGUID";
            ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "GUID");
            ffiGuid.DataType = FieldDataType.Guid;
            ffiGuid.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
            ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, String.Empty);
            ffiGuid.PrimaryKey = false;
            ffiGuid.System     = true;
            ffiGuid.Visible    = false;
            ffiGuid.Size       = 0;
            ffiGuid.AllowEmpty = false;

            FormInfo.AddFormItem(ffiGuid);

            // Update definition
            dci.ClassFormDefinition = FormInfo.GetXmlDefinition();

            using (CMSActionContext context = new CMSActionContext())
            {
                // Disable logging into event log
                context.LogEvents = false;

                DataClassInfoProvider.SetDataClassInfo(dci);
            }

            // Clear the default queries
            QueryInfoProvider.ClearDefaultQueries(dci, true);

            // Clear the object type hashtable
            AbstractProviderDictionary.ReloadDictionaries(className, true);

            // Clear the classes hashtable
            AbstractProviderDictionary.ReloadDictionaries("cms.class", true);

            // Clear class strucures
            ClassStructureInfo.Remove(className, true);

            // Ensure GUIDs for all items
            using (CMSActionContext ctx = new CMSActionContext())
            {
                ctx.UpdateSystemFields = false;
                ctx.LogSynchronization = false;
                DataSet dsItems = CustomTableItemProvider.GetItems(className);
                if (!DataHelper.DataSourceIsEmpty(dsItems))
                {
                    foreach (DataRow dr in dsItems.Tables[0].Rows)
                    {
                        CustomTableItem item = CustomTableItem.New(className, dr);
                        item.ItemGUID = Guid.NewGuid();
                        item.Update();
                    }
                }
            }

            // Log event
            UserInfo currentUser = MembershipContext.AuthenticatedUser;

            var logData = new EventLogData(EventTypeEnum.Information, "Custom table", "GENERATEGUID")
            {
                EventDescription = String.Format(ResHelper.GetAPIString("customtable.GUIDGenerated", "Field 'ItemGUID' for custom table '{0}' was created and GUID values were generated."), dci.ClassName),
                UserID           = currentUser.UserID,
                UserName         = currentUser.UserName,
            };

            Service.Resolve <IEventLogService>().LogEvent(logData);

            success = true;
        }
        catch (Exception ex)
        {
            success = false;

            FieldEditor.ShowError(GetString("customtable.ErrorGUID"));

            // Log event
            Service.Resolve <IEventLogService>().LogException("Custom table", "GENERATEGUID", ex);
        }

        if (success)
        {
            URLHelper.Redirect(URLHelper.AddParameterToUrl(RequestContext.CurrentURL, "gen", "1"));
        }
    }
Esempio n. 8
0
    /// <summary>
    /// Adds GUID field to form definition.
    /// </summary>
    private void CreateGUID()
    {
        try
        {
            // Create GUID field
            FormFieldInfo ffiGuid = new FormFieldInfo();

            // Fill FormInfo object
            ffiGuid.Name = "ItemGUID";
            ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldCaption, "GUID");
            ffiGuid.DataType = FieldDataType.Guid;
            ffiGuid.SetPropertyValue(FormFieldPropertyEnum.DefaultValue, string.Empty);
            ffiGuid.SetPropertyValue(FormFieldPropertyEnum.FieldDescription, String.Empty);
            ffiGuid.FieldType = FormFieldControlTypeEnum.CustomUserControl;
            ffiGuid.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLowerCSafe();
            ffiGuid.PrimaryKey = false;
            ffiGuid.System     = true;
            ffiGuid.Visible    = false;
            ffiGuid.Size       = 0;
            ffiGuid.AllowEmpty = false;

            FormInfo.AddFormItem(ffiGuid);

            // Update table structure - columns could be added
            bool old = TableManager.UpdateSystemFields;
            TableManager.UpdateSystemFields = true;
            string schema = FormInfo.GetXmlDefinition();

            TableManager tm = new TableManager(null);
            tm.UpdateTableByDefinition(dci.ClassTableName, schema);

            TableManager.UpdateSystemFields = old;

            // Update xml schema and form definition
            dci.ClassFormDefinition = schema;
            dci.ClassXmlSchema      = tm.GetXmlSchema(dci.ClassTableName);

            dci.Generalized.LogEvents = false;

            // Save the data
            DataClassInfoProvider.SetDataClassInfo(dci);

            dci.Generalized.LogEvents = true;

            // Clear the default queries
            QueryInfoProvider.ClearDefaultQueries(dci, true, false);

            // Clear the object type hashtable
            ProviderStringDictionary.ReloadDictionaries(className, true);

            // Clear the classes hashtable
            ProviderStringDictionary.ReloadDictionaries("cms.class", true);

            // Clear class strucures
            ClassStructureInfo.Remove(className, true);

            // Ensure GUIDs for all items
            using (CMSActionContext ctx = new CMSActionContext())
            {
                ctx.UpdateSystemFields = false;
                ctx.LogSynchronization = false;
                DataSet dsItems = CustomTableItemProvider.GetItems(className);
                if (!DataHelper.DataSourceIsEmpty(dsItems))
                {
                    foreach (DataRow dr in dsItems.Tables[0].Rows)
                    {
                        CustomTableItem item = CustomTableItem.New(className, dr);
                        item.ItemGUID = Guid.NewGuid();
                        item.Update();
                    }
                }
            }

            // Log event
            UserInfo currentUser = MembershipContext.AuthenticatedUser;
            EventLogProvider.LogEvent(EventType.INFORMATION, "Custom table", "GENERATEGUID", string.Format(ResHelper.GetAPIString("customtable.GUIDGenerated", "Field 'ItemGUID' for custom table '{0}' was created and GUID values were generated."), dci.ClassName), null, currentUser.UserID, currentUser.UserName);

            URLHelper.Redirect(URLHelper.AddParameterToUrl(RequestContext.CurrentURL, "gen", "1"));
        }
        catch (Exception ex)
        {
            FieldEditor.ShowError(GetString("customtable.ErrorGUID") + ex.Message);

            // Log event
            EventLogProvider.LogException("Custom table", "GENERATEGUID", ex);
        }
    }
Esempio n. 9
0
    void btnGUID_Click(object sender, EventArgs e)
    {
        try
        {
            // Create GUID field
            FormFieldInfo ffiGuid = new FormFieldInfo();

            // Fill FormInfo object
            ffiGuid.Name                    = "ItemGUID";
            ffiGuid.Caption                 = "GUID";
            ffiGuid.DataType                = FormFieldDataTypeEnum.GUID;
            ffiGuid.DefaultValue            = "";
            ffiGuid.Description             = "";
            ffiGuid.FieldType               = FormFieldControlTypeEnum.CustomUserControl;
            ffiGuid.Settings["controlname"] = Enum.GetName(typeof(FormFieldControlTypeEnum), FormFieldControlTypeEnum.LabelControl).ToLower();
            ffiGuid.PrimaryKey              = false;
            ffiGuid.System                  = true;
            ffiGuid.Visible                 = false;
            ffiGuid.Size                    = 0;
            ffiGuid.AllowEmpty              = false;

            FormInfo.AddFormField(ffiGuid);

            // Update table structure - columns could be added
            bool old = TableManager.UpdateSystemFields;
            TableManager.UpdateSystemFields = true;
            string schema = FormInfo.GetXmlDefinition();
            TableManager.UpdateTableBySchema(dci.ClassTableName, schema);
            TableManager.UpdateSystemFields = old;

            // Update xml schema and form definition
            dci.ClassFormDefinition = schema;
            dci.ClassXmlSchema      = TableManager.GetXmlSchema(dci.ClassTableName);

            dci.Generalized.LogEvents = false;

            // Save the data
            DataClassInfoProvider.SetDataClass(dci);

            dci.Generalized.LogEvents = true;

            // Generate default queries
            SqlGenerator.GenerateDefaultQueries(dci, true, false);

            // Clear cached data
            CMSObjectHelper.RemoveReadOnlyObjects(CustomTableItemProvider.GetObjectType(className), true);
            CustomTableItemProvider.Remove(className, true);
            // Clear the object type hashtable
            ProviderStringDictionary.ReloadDictionaries(className, true);

            // Clear the classes hashtable
            ProviderStringDictionary.ReloadDictionaries("cms.class", true);

            // Clear class strucures
            ClassStructureInfo.Remove(className, true);

            // Ensure GUIDs for all items
            CustomTableItemProvider tableProvider = new CustomTableItemProvider();
            tableProvider.UpdateSystemFields = false;
            tableProvider.LogSynchronization = false;
            DataSet dsItems = tableProvider.GetItems(className, null, null);
            if (!DataHelper.DataSourceIsEmpty(dsItems))
            {
                foreach (DataRow dr in dsItems.Tables[0].Rows)
                {
                    CustomTableItem item = new CustomTableItem(dr, className, tableProvider);
                    item.ItemGUID = Guid.NewGuid();
                    item.Update();
                }
            }

            // Log event
            UserInfo currentUser = CMSContext.CurrentUser;
            EventLog.LogEvent(EventLogProvider.EVENT_TYPE_INFORMATION, DateTime.Now, "Custom table", "GENERATEGUID", currentUser.UserID, currentUser.UserName, 0, null, null, string.Format(ResHelper.GetAPIString("customtable.GUIDGenerated", "Field 'ItemGUID' for custom table '{0}' was created and GUID values were generated."), dci.ClassName), 0, null);

            URLHelper.Redirect(URLHelper.AddParameterToUrl(URLRewriter.CurrentURL, "gen", "1"));
        }
        catch (Exception ex)
        {
            lblError.Visible = true;
            lblError.Text    = GetString("customtable.ErrorGUID") + ex.Message;

            // Log event
            EventLog.LogEvent("Custom table", "GENERATEGUID", ex);
        }
    }
    /// <summary>
    /// Handles the ButtonOK's onClick event.
    /// </summary>
    protected void btnOK_Click(object sender, EventArgs e)
    {
        // finds whether required fields are not empty or well filled
        string result = new Validator().NotEmpty(tbDisplayName.Text.Trim(), GetString("DocumentType_Edit_General.DisplayNameRequired")).
                        NotEmpty(tbNamespaceName.Text.Trim(), GetString("DocumentType_Edit_General.NamespaceNameRequired")).
                        NotEmpty(tbCodeName.Text.Trim(), GetString("DocumentType_Edit_General.CodeNameRequired")).
                        IsIdentifier(tbNamespaceName.Text.Trim(), GetString("DocumentType_Edit_General.NamespaceNameIdentifier")).
                        IsCodeName(tbCodeName.Text.Trim(), GetString("DocumentType_Edit_General.CodeNameIdentifier")).Result;

        // Get full class name
        string        newClassName = tbNamespaceName.Text.Trim() + "." + tbCodeName.Text.Trim();
        DataClassInfo classInfo    = DataClassInfoProvider.GetDataClass(documentTypeId);

        // Check if class exists
        if (classInfo == null)
        {
            return;
        }

        className = classInfo.ClassName;
        bool classNameChanged = (CMSString.Compare(className, newClassName, true) != 0);

        // Check if new class name is unique
        if (classNameChanged)
        {
            DataClassInfo ci = DataClassInfoProvider.GetDataClass(newClassName);
            if ((ci != null) && (ci.ClassID != classInfo.ClassID))
            {
                result += String.Format(GetString("class.exists"), newClassName);
            }
        }

        if (result == "")
        {
            classInfo = classInfo.Clone();

            int originalInherits = classInfo.ClassInheritsFromClassID;
            int inherits         = ValidationHelper.GetInteger(selInherits.Value, 0);

            classInfo.ClassInheritsFromClassID = inherits;

            // sets properties of the classInfo
            classInfo.ClassDisplayName      = tbDisplayName.Text.Trim();
            classInfo.ClassName             = newClassName;
            classInfo.ClassNewPageURL       = txtNewPage.Text.Trim();
            classInfo.ClassEditingPageURL   = tbEditingPage.Text.Trim();
            classInfo.ClassListPageURL      = tbListPage.Text.Trim();
            classInfo.ClassViewPageUrl      = txtViewPage.Text.Trim();
            classInfo.ClassPreviewPageUrl   = txtPreviewPage.Text.Trim();
            classInfo.ClassUsePublishFromTo = chkClassUsePublishFromTo.Checked;
            classInfo.ClassIsMenuItemType   = chkIsMenuItem.Checked;

            // Show template selection
            bool templateSelection = (classInfo.ClassShowTemplateSelection = chkTemplateSelection.Checked);
            if (templateSelection)
            {
                classInfo.ClassPageTemplateCategoryID = categorySelector.SelectedCategoryID;
            }
            else
            {
                classInfo.ClassPageTemplateCategoryID = 0;
            }

            classInfo.ClassDefaultPageTemplateID = templateDefault.PageTemplateID;
            classInfo.ClassLoadGeneration        = drpGeneration.Value;

            // Refresh the tabs according to ClassIsProduct setting
            ScriptHelper.RefreshTabHeader(Page, null);

            try
            {
                bool structureChanged = false;

                // Ensure (update) the inheritance
                if (originalInherits != inherits)
                {
                    if (inherits > 0)
                    {
                        // Update the inherited fields
                        DataClassInfo parentClass = DataClassInfoProvider.GetDataClass(inherits);
                        if (parentClass != null)
                        {
                            FormHelper.UpdateInheritedClass(parentClass, classInfo);
                        }
                    }
                    else
                    {
                        // Remove the inherited fields
                        FormHelper.RemoveInheritance(classInfo, false);
                    }

                    structureChanged = true;
                }

                // Updates data class in DB (inner unique class name check)
                DataClassInfoProvider.SetDataClass(classInfo);

                if ((className.ToLowerCSafe() != newClassName.ToLowerCSafe()) && (classInfo.ClassIsDocumentType))
                {
                    structureChanged = true;

                    // Class name was changed -> update queries
                    SqlGenerator.GenerateQuery(newClassName, "searchtree", SqlOperationTypeEnum.SearchTree, false);
                    SqlGenerator.GenerateQuery(newClassName, "selectdocuments", SqlOperationTypeEnum.SelectDocuments, false);
                    SqlGenerator.GenerateQuery(newClassName, "selectversions", SqlOperationTypeEnum.SelectVersions, false);
                }

                if (structureChanged)
                {
                    // Create view for document types
                    SqlGenerator.GenerateDefaultView(classInfo, null);

                    // Clear class structures
                    ClassStructureInfo.Remove(classInfo.ClassName, true);
                }

                // Refresh document type icons
                bool classIsCoupled = classInfo.ClassIsCoupledClass;

                RefreshIcon(className, newClassName, classNameChanged, classIsCoupled, null);
                RefreshIcon(className, newClassName, classNameChanged, classIsCoupled, "48x48");

                pnlIcons.Update();

                className = newClassName;

                // Show message
                ShowChangesSaved();
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("Document types", "UPDATE", ex);

                // Show error message
                ShowError(ex.Message);
            }
        }
        else
        {
            // hides asp validators in case the javascript is disabled
            RequiredFieldValidatorDisplayName.Visible       = false;
            RequiredFieldValidatorNamespaceName.Visible     = false;
            RequiredFieldValidatorCodeName.Visible          = false;
            RegularExpressionValidatorNameSpaceName.Visible = false;
            RegularExpressionValidatorCodeName.Visible      = false;

            // Show error message
            ShowError(result);
        }
    }
Esempio n. 11
0
    /// <summary>
    /// Reloads control with new data.
    /// </summary>
    private void ReloadData()
    {
        tblDocument.Rows.Clear();

        DataClassInfo ci = DataClassInfoProvider.GetDataClass(Node.NodeClassName);

        if (ci != null)
        {
            fi = FormHelper.GetFormInfo(ci.ClassName, false);

            TableHeaderCell labelCell = new TableHeaderCell();
            TableHeaderCell valueCell = null;

            // Add header column with version number
            if (CompareNode == null)
            {
                labelCell.Text            = GetString("General.FieldName");
                labelCell.EnableViewState = false;
                valueCell = new TableHeaderCell();
                valueCell.EnableViewState = false;
                valueCell.Text            = GetString("General.Value");

                // Add table header
                AddRow(labelCell, valueCell, "UniGridHead", false);
            }
            else
            {
                labelCell.Text = GetString("lock.versionnumber");
                valueCell      = GetRollbackTableHeaderCell("source", Node.DocumentID, versionHistoryId);
                TableHeaderCell valueCompare = GetRollbackTableHeaderCell("compare", CompareNode.DocumentID, versionCompare);

                // Add table header
                AddRow(labelCell, valueCell, valueCompare, true, "UniGridHead", false);
            }

            if (ci.ClassIsProduct)
            {
                // Add coupled class fields
                ClassStructureInfo skuCsi = ClassStructureInfo.GetClassInfo("ecommerce.sku");
                if (skuCsi != null)
                {
                    foreach (string col in skuCsi.ColumnNames)
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            if (ci.ClassIsCoupledClass)
            {
                // Add coupled class fields
                ClassStructureInfo coupledCsi = ClassStructureInfo.GetClassInfo(Node.NodeClassName);
                if (coupledCsi != null)
                {
                    foreach (string col in coupledCsi.ColumnNames)
                    {
                        // If comparing with other version and current coupled column is not versioned do not display it
                        if (!((CompareNode != null) && !(VersionManager.IsVersionedCoupledColumn(Node.NodeClassName, col))))
                        {
                            AddField(Node, CompareNode, col);
                        }
                    }
                }
            }

            // Add versioned document class fields
            ClassStructureInfo docCsi = ClassStructureInfo.GetClassInfo("cms.document");
            if (docCsi != null)
            {
                foreach (string col in docCsi.ColumnNames)
                {
                    // If comparing with other version and current document column is not versioned do not display it
                    // One exception is DocumentNamePath column which will be displayed even if it is not marked as a versioned column
                    if (!((CompareNode != null) && (!(VersionManager.IsVersionedDocumentColumn(col) || (col.ToLowerCSafe() == "documentnamepath")))))
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            // Add versioned document class fields
            ClassStructureInfo treeCsi = ClassStructureInfo.GetClassInfo("cms.tree");
            if (treeCsi != null)
            {
                foreach (string col in treeCsi.ColumnNames)
                {
                    // Do not display cms_tree columns when comparing with other version
                    // cms_tree columns are not versioned
                    if (CompareNode == null)
                    {
                        AddField(Node, CompareNode, col);
                    }
                }
            }

            // Add unsorted attachments to the table
            AddField(Node, CompareNode, UNSORTED);
        }
    }