public void Show_Item_Path_and_Template_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();
            var fieldList = new FieldList();
            fieldList.AddField("Full Path", "/sitecore/content/foo");
            fieldList.AddField("Template Name", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;
            Assert.Contains("/sitecore/content/foo", summaryRow);
            Assert.Contains("Bar", summaryRow);
        }
Beispiel #2
0
        private static FieldList GetItem()
        {
            var item = Context.Item;

            var data = new FieldList();

            var itemValues = GetItem(item);

            foreach (var field in itemValues.Fields)
            {
                data.AddField(field.Key, field.Value);
            }

            data.AddField("Fields", GeFieldsProperties(item));
            data.AddField("Extended Properties", GetExtendedProperties(item).Fields);

            return(data);
        }
Beispiel #3
0
        public void Show_Item_Path_and_Template_as_first_row_of_tab_data()
        {
            var requestData = new RequestData();
            var fieldList   = new FieldList();

            fieldList.AddField("Full Path", "/sitecore/content/foo");
            fieldList.AddField("Template Name", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            dynamic data = _sut.GetData(null);

            string summaryRow = data.Rows[0].Columns[1].Data;

            Assert.Contains("/sitecore/content/foo", summaryRow);
            Assert.Contains("Bar", summaryRow);
        }
        public void Return_null_if_analysis_overview_information_is_missing()
        {
            var requestData = new RequestData();
            var fieldList = new FieldList();
            fieldList.AddField("Foo", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
Beispiel #5
0
        private static FieldList GetItem(Item item)
        {
            var data = new FieldList();

            data.AddField("Name", item.Name);
            data.AddField("Display Name", item.DisplayName);
            data.AddField("Language Name", item.Language.Name);
            data.AddField("Template Name", item.Template.Name);

            if (item.Parent != null)
            {
                data.AddField("Parent Name", item.Parent.Name);
            }

            data.AddField("Full Path", item.Paths.FullPath);
            data.AddField("Version Number", item.Version.Number);
            data.AddField("ID", item.ID.Guid);
            data.AddField("Parent ID", item.ParentID.Guid);
            data.AddField("Template ID", item.TemplateID.Guid);

            return(data);
        }
Beispiel #6
0
        private static FieldList GetCulture(CultureInfo culture)
        {
            var data = new FieldList();

            data.AddField("Name", culture.Name);
            data.AddField("Parent", culture.Parent);
            data.AddField("Display Name", culture.DisplayName);
            data.AddField("English Name", culture.EnglishName);
            data.AddField("Native Name", culture.NativeName);
            data.AddField("Two Letter ISO Language Name", culture.TwoLetterISOLanguageName);
            data.AddField("Three Letter Windows Language Name", culture.ThreeLetterWindowsLanguageName);
            data.AddField("Three Letter ISO Language Name", culture.ThreeLetterISOLanguageName);

            return(data);
        }
        public void Return_null_if_analysis_overview_information_is_missing()
        {
            var requestData = new RequestData();
            var fieldList   = new FieldList();

            fieldList.AddField("Foo", "Bar");
            requestData.Add(DataKey.Item, fieldList);

            _requestDataProvider.Setup(x => x.GetData()).Returns(requestData);

            var data = _sut.GetData(null);

            Assert.Null(data);
        }
Beispiel #8
0
        private static FieldList GetRequest()
        {
            var request = Context.Request;

            var data = new FieldList();

            data.AddField("FilePath", request.FilePath);
            data.AddField("ItemPath", request.ItemPath);

            if (request.QueryString.AllKeys.Any())
            {
                var queryString = new FieldList();

                foreach (var key in request.QueryString.AllKeys)
                {
                    queryString.AddField(key, request.QueryString.GetValues(key));
                }

                data.AddField("QueryString", queryString);
            }

            return(data);
        }
Beispiel #9
0
        private static FieldList GetUser()
        {
            var user = Context.User;

            var data = new FieldList();

            data.AddField("Name", user.Name);
            data.AddField("DisplayName", user.DisplayName);
            data.AddField("Roles", user.Roles.Select(r => r.Name));
            data.AddField("Description", user.Description);
            data.AddField("Domain Name", user.GetDomainName());
            data.AddField("IsAdministrator", user.IsAdministrator);
            data.AddField("IsAuthenticated", user.IsAuthenticated);
            data.AddField("LocalName", user.LocalName);

            return(data);
        }
Beispiel #10
0
        private static FieldList GetDatabase()
        {
            var database = Context.Database;

            var data = new FieldList();

            data.AddField("Name", database.Name);
            data.AddField("Connection String Name", database.ConnectionStringName);
            data.AddField("Read Only", database.ReadOnly);
            data.AddField("Protected", database.Protected);
            data.AddField("Security Enabled", database.SecurityEnabled);
            data.AddField("Proxies Enabled", database.ProxiesEnabled);
            data.AddField("Publish Virtual Items", database.PublishVirtualItems);
            data.AddField("HasContentItem", database.HasContentItem);

            return(data);
        }
Beispiel #11
0
        private static FieldList GetPageMode()
        {
            var data = new FieldList();

            data.AddField("IsDebugging", Context.PageMode.IsDebugging);
            data.AddField("IsNormal", Context.PageMode.IsNormal);
            data.AddField("IsPageEditor", Context.PageMode.IsPageEditor);
            data.AddField("IsPageEditorEditing", Context.PageMode.IsPageEditorEditing);
            data.AddField("IsPreview", Context.PageMode.IsPreview);
            data.AddField("IsProfiling", Context.PageMode.IsProfiling);
            data.AddField("IsSimulatedDevicePreviewing", Context.PageMode.IsSimulatedDevicePreviewing);

            return(data);
        }
        public void GetFields(Connection cnt)
        {
            int i;

            System.Data.DataTable schemaColumn = null;
            fields = new FieldList();
            if (cnt.IsOdbc)
            {
                return;
            }
            //=====================================================
            EPField   fld;
            dbWrapper db = new dbWrapper();

            db.CreateCommand(cnt);
            string sep1 = DatabaseEditUtil.SepBegin(cnt.NameDelimiterStyle);
            string sep2 = DatabaseEditUtil.SepEnd(cnt.NameDelimiterStyle);

            db.SetCommandText("SELECT * FROM " + sep1 + ViewName + sep2);
            db.SetCommandType(System.Data.CommandType.Text);
            try
            {
                db.OpenReader(System.Data.CommandBehavior.SchemaOnly);
                schemaColumn = db.GetSchemaTable();
                db.CloseReader();
                db.Close();
                if (schemaColumn != null)
                {
                    for (i = 0; i < schemaColumn.Rows.Count; i++)
                    {
                        fld = EPField.MakeFieldFromColumnInfo(i, schemaColumn.Rows[i]);
                        fld.FromTableName = ViewName;
                        fields.AddField(fld);
                    }
                }
            }
            catch
            {
            }
            finally
            {
                db.CloseReader();
                db.Close();
            }
        }
Beispiel #13
0
        private static FieldList GetDevice()
        {
            var device = Context.Device;

            var data = new FieldList();

            data.AddField("Name", device.Name);
            data.AddField("Display Name", device.DisplayName);
            data.AddField("Id", device.ID.Guid);
            data.AddField("Query String", device.QueryString);
            data.AddField("Agent", device.Agent);

            if (device.FallbackDevice != null)
            {
                data.AddField("Fallback Device Name", device.FallbackDevice.Name);
            }

            data.AddField("Icon", device.Icon);
            data.AddField("Is Default", device.IsDefault);
            data.AddField("Is Valid", device.IsValid);

            return(data);
        }
Beispiel #14
0
        private static FieldList GetItemTemplate()
        {
            var template = Context.Item.Template;

            var data = new FieldList();

            data.AddField("Name", template.Name);
            data.AddField("Display Name", template.DisplayName);
            data.AddField("Full Name", template.FullName);
            data.AddField("ID", template.ID.Guid);
            data.AddField("Base Templates", template.BaseTemplates.Select(t => t.Name));

            if (template.StandardValues != null)
            {
                data.AddField("Standard Values", template.StandardValues.Paths.FullPath);
            }

            data.AddField("Own Fields", GetTemplateFieldProperties(template.OwnFields));
            data.AddField("Fields", GetTemplateFieldProperties(template.Fields));
            data.AddField("Template InnerItem", GetItem(template.InnerItem).Fields);

            return(data);
        }
        private static FieldList GetPageMode()
        {
            var data = new FieldList();

            data.AddField("IsDebugging", Context.PageMode.IsDebugging);
            data.AddField("IsNormal", Context.PageMode.IsNormal);
            data.AddField("IsPageEditor", Context.PageMode.IsPageEditor);
            data.AddField("IsPageEditorEditing", Context.PageMode.IsPageEditorEditing);
            data.AddField("IsPreview", Context.PageMode.IsPreview);
            data.AddField("IsProfiling", Context.PageMode.IsProfiling);
            data.AddField("IsSimulatedDevicePreviewing", Context.PageMode.IsSimulatedDevicePreviewing);

            return data;
        }
 private void reloadFields()
 {
     if (editState == EnumEditState.Ready)
     {
         editState = EnumEditState.Loading;
         if (ds != null)
         {
             try
             {
                 if (ds.Tables.Count > 0)
                 {
                     if (ds.Tables[0].Rows.Count > 0)
                     {
                         EPField   fld;
                         FieldList flds = new FieldList();
                         for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                         {
                             if (VPLUtil.ObjectToBool(ds.Tables[0].Rows[i][1]))
                             {
                                 fld      = new EPField();
                                 fld.Name = ds.Tables[0].Rows[i][0].ToString();
                                 if (ds.Tables[0].Rows[i][2] != null && ds.Tables[0].Rows[i][2] != System.DBNull.Value)
                                 {
                                     fld.FieldText = ds.Tables[0].Rows[i][2].ToString();
                                 }
                                 fld.FromTableName = ds.Tables[0].TableName;
                                 flds.AddField(fld);
                             }
                         }
                         objRet.SetFields(flds);
                         showSQL();
                     }
                 }
             }
             catch (Exception er)
             {
                 FormLog.NotifyException(true, er);
             }
         }
         editState = EnumEditState.Ready;
     }
 }
        private static FieldList GetItemTemplate()
        {
            var template = Context.Item.Template;

            var data = new FieldList();

            data.AddField("Name", template.Name);
            data.AddField("Display Name", template.DisplayName);
            data.AddField("Full Name", template.FullName);
            data.AddField("ID", template.ID.Guid);
            data.AddField("Base Templates", template.BaseTemplates.Select(t => t.Name));

            if (template.StandardValues != null)
            {
                data.AddField("Standard Values", template.StandardValues.Paths.FullPath);
            }

            data.AddField("Own Fields", GetTemplateFieldProperties(template.OwnFields));
            data.AddField("Fields", GetTemplateFieldProperties(template.Fields));
            data.AddField("Template InnerItem", GetItem(template.InnerItem).Fields);

            return data;
        }
Beispiel #18
0
        private static FieldList GetDomain()
        {
            var domain = Context.Domain;

            var data = new FieldList();

            data.AddField("Name", domain.Name);
            data.AddField("Is Default", domain.IsDefault);
            data.AddField("Account Prefix", domain.AccountPrefix);
            data.AddField("Anonymous User Name", domain.AnonymousUserName);
            data.AddField("Default Profile Item ID", domain.DefaultProfileItemID);
            data.AddField("Ensure Anonymous User", domain.EnsureAnonymousUser);
            data.AddField("Everyone Role Name", domain.EveryoneRoleName);
            data.AddField("Locally Managed", domain.LocallyManaged);
            data.AddField("Anonymous User Email Pattern", domain.AnonymousUserEmailPattern);
            data.AddField("Account Name Validation", domain.AccountNameValidation);
            data.AddField("Member Pattern", domain.MemberPattern);

            return(data);
        }
        private static FieldList GetRequest()
        {
            var request = Context.Request;

            var data = new FieldList();

            data.AddField("FilePath", request.FilePath);
            data.AddField("ItemPath", request.ItemPath);

            if (request.QueryString.AllKeys.Any())
            {
                var queryString = new FieldList();

                foreach (var key in request.QueryString.AllKeys)
                {
                    queryString.AddField(key, request.QueryString.GetValues(key));
                }

                data.AddField("QueryString", queryString);
            }

            return data;
        }
 private static void AddCloneFields(Item item, FieldList data)
 {
     data.AddField("Is Clone", item.IsClone);
     data.AddField("Is Item Clone", item.IsItemClone);
     data.AddField("Source Uri", item.SourceUri);
 }
        private static FieldList GetItemVisualization()
        {
            var itemVisualization = Context.Item.Visualization;
            var device = Context.Device;

            var layoutItem = itemVisualization.GetLayout(device);
            var renderings = itemVisualization.GetRenderings(device, true);

            var data = new FieldList();

            data.AddField("Layout", GetLayout(layoutItem).Fields);
            data.AddField("Renderings", GetRenderings(renderings));

            return data;
        }
Beispiel #22
0
        private static FieldList GetExtendedProperties(Item item)
        {
            var data = new FieldList();

            data.AddField("Key", item.Key);
            data.AddField("Has Children", item.HasChildren);

            if ((item.Children != null) && item.HasChildren)
            {
                data.AddField("Children", item.Children.Count);
            }

            if (item.Branch != null)
            {
                data.AddField("Branch Name", item.Branch.Name);
                data.AddField("Branch Id", item.BranchId.Guid);
            }

            data.AddField("Short Description", item.Appearance.ShortDescription);
            data.AddField("Long Description", item.Appearance.LongDescription);

            data.AddField("Originator Id", item.OriginatorId.Guid);
            data.AddField("Uri", item.Uri);
            data.AddField("Full Path", item.Paths.FullPath);
            data.AddField("Long ID", item.Paths.LongID);
            data.AddField("Hidden", item.Appearance.Hidden);
            data.AddField("Read Only", item.Appearance.ReadOnly);
            data.AddField("Sort order", item.Appearance.Sortorder);
            data.AddField("Style", item.Appearance.Style);

            AddCloneFields(item, data);

            data.AddField("Created", item.Statistics.Created);
            data.AddField("Created By", item.Statistics.CreatedBy);
            data.AddField("Updated", item.Statistics.Updated);
            data.AddField("Updated By", item.Statistics.UpdatedBy);
            data.AddField("Revision", item.Statistics.Revision);

            return(data);
        }
        private static FieldList GetDiagnostics()
        {
            var diag = Context.Diagnostics;

            var data = new FieldList();

            data.AddField("Debugging", diag.Debugging);
            data.AddField("Profiling", diag.Profiling);
            data.AddField("Tracing", diag.Tracing);
            data.AddField("Show Rendering Info", diag.ShowRenderingInfo);
            data.AddField("Draw Rendering Borders", diag.DrawRenderingBorders);

            return data;
        }
        private static FieldList GetDatabase()
        {
            var database = Context.Database;

            var data = new FieldList();

            data.AddField("Name", database.Name);
            data.AddField("Connection String Name", database.ConnectionStringName);
            data.AddField("Read Only", database.ReadOnly);
            data.AddField("Protected", database.Protected);
            data.AddField("Security Enabled", database.SecurityEnabled);
            data.AddField("Proxies Enabled", database.ProxiesEnabled);
            data.AddField("Publish Virtual Items", database.PublishVirtualItems);
            data.AddField("HasContentItem", database.HasContentItem);

            return data;
        }
Beispiel #25
0
        private void treeView1_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            btDelChild.Enabled = false;
            cbxFields.Items.Clear();
            TableNode nd = treeView1.SelectedNode as TableNode;

            if (nd != null)
            {
                try
                {
                    int i;
                    btDelChild.Enabled = (nd.Parent != null);
                    //
                    if (!nd.FieldsLoaded)
                    {
                        nd.FieldsLoaded = true;
                        nd.table.GetFields(schema.dbCon);
                        nd.table.GetIndexes(schema.dbCon);
                    }
                    for (i = 0; i < nd.table.FieldCount; i++)
                    {
                        cbxFields.Items.Add(nd.table.GetField(i));
                    }
                    //check unique index
                    bool bIndexed = false;
                    for (i = 0; i < nd.table.FieldCount; i++)
                    {
                        if (nd.table.GetField(i).Indexed)
                        {
                            bIndexed = true;
                            break;
                        }
                    }
                    if (!bIndexed)
                    {
                        if (nd.table.Indexes != null)
                        {
                            for (i = 0; i < nd.table.Indexes.Length; i++)
                            {
                                if (nd.table.Indexes[i].IsUnique)
                                {
                                    for (int j = 0; j < nd.table.Indexes[i].fields.Count; j++)
                                    {
                                        nd.table.fields[nd.table.Indexes[i].fields[i].Name].Indexed = true;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    //
                    dataGrid1.Refresh();
                    dataGrid1.DataBindings.Clear();
                    dataGrid1.DataSource = null;
                    dataGrid1.DataMember = null;
                    //
                    qry.ClearQuery();
                    //
                    dataGrid1.Refresh();
                    dataGrid1.Name = nd.Text;
                    //create a query for the table
                    qry.UpdatableTableName = nd.Text;
                    qry.Description        = nd.Text;
                    qry.SampleTopRec       = nd.TopRec;
                    qry.UseSampleTopRec    = true;
                    if (qry.DatabaseConnection.TopRecordStyle == EnumTopRecStyle.NotAllowed)
                    {
                        qry.Where = "1=2";
                    }
                    else
                    {
                        qry.Where = "";
                    }
                    qry.From = string.Format(CultureInfo.InvariantCulture,
                                             "{0}{1}{2}", qry.NameDelimiterBegin, nd.Text, qry.NameDelimiterEnd);
                    FieldList fl = new FieldList();
                    for (i = 0; i < nd.table.FieldCount; i++)
                    {
                        fl.AddField(nd.table.GetField(i));
                    }
                    for (i = 0; i < fl.Count; i++)
                    {
                        fl[i].SetDefaultEditor();
                    }
                    qry.Fields = fl;
                    qry.Query();
                    //
                    dataGrid1.DataSource = qry.DataStorage;
                    if (qry.DataStorage != null)
                    {
                        dataGrid1.DataMember = qry.DataStorage.Tables[0].TableName;
                    }
                    dataGrid1.Refresh();
                    //
                    schema.dbCon = qry.DatabaseConnection.ConnectionObject;
                    dataGrid1_CurrentCellChanged(null, null);
                    dlgDatabase_Resize(null, null);
                    dataGrid1.Visible = (qry.Fields.Count > 0);
                    if (cbxFields.Items.Count > 0)
                    {
                        cbxFields.SelectedIndex = 0;
                    }
                }
                catch (Exception err)
                {
                    MessageBox.Show(this, VPLUtil.FormExceptionText(err), this.Text, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Stop);
                }
            }
        }
        private static FieldList GetLanguage()
        {
            var language = Context.Language;

            var data = new FieldList();

            data.AddField("Name", language.Name);
            data.AddField("DisplayName", language.GetDisplayName());
            data.AddField("CultureInfo", GetCulture(language.CultureInfo).Fields);

            if (language.Origin != null && language.Origin.ItemId != (Data.ID)null)
            {
                data.AddField("Origin Item Id", language.Origin.ItemId.Guid);
            }

            return data;
        }
        private static FieldList GetSite()
        {
            var site = Context.Site;

            var data = new FieldList();

            data.AddField("Name", site.Name);
            data.AddField("HostName", site.HostName);
            data.AddField("TargetHostName", site.TargetHostName);
            data.AddField("Language", site.Language);
            data.AddField("Database", site.Properties["database"]);
            data.AddField("Device", site.Device);
            data.AddField("RootPath", site.RootPath);
            data.AddField("StartItem", site.StartItem);
            data.AddField("StartPath", site.StartPath);
            data.AddField("PhysicalFolder", site.PhysicalFolder);
            data.AddField("VirtualFolder", site.VirtualFolder);
            data.AddField("LoginPage", site.LoginPage);
            data.AddField("RequireLogin", site.RequireLogin);
            data.AddField("AllowDebug", site.AllowDebug);
            data.AddField("EnableAnalytics", site.EnableAnalytics);
            data.AddField("EnableDebugger", site.EnableDebugger);
            data.AddField("EnablePreview", site.EnablePreview);
            data.AddField("EnableWorkflow", site.EnableWorkflow);
            data.AddField("EnableWebEdit", site.EnableWebEdit);
            data.AddField("FilterItems", site.FilterItems);
            data.AddField("CacheHtml", site.CacheHtml);
            data.AddField("CacheMedia", site.CacheMedia);
            data.AddField("MediaCachePath", site.MediaCachePath);
            data.AddField("XmlControlPage", site.XmlControlPage);

            return data;
        }
        private static FieldList GetLicense()
        {
            var data = new FieldList();

            var license = new LicenseReader().GetInfo();
            data.AddField(Texts.LicenseID, license.Id);
            data.AddField(Texts.LicenseHolder, license.Licensee);
            data.AddField("Country", license.Country);
            data.AddField("Version", license.Version);
            data.AddField("Expires", license.Expiration.ToShortDateString());

            return data;
        }
        private static FieldList GetDevice()
        {
            var device = Context.Device;

            var data = new FieldList();

            data.AddField("Name", device.Name);
            data.AddField("Display Name", device.DisplayName);
            data.AddField("Id", device.ID.Guid);
            data.AddField("Query String", device.QueryString);
            data.AddField("Agent", device.Agent);

            if (device.FallbackDevice != null)
            {
                data.AddField("Fallback Device Name", device.FallbackDevice.Name);
            }

            data.AddField("Icon", device.Icon);
            data.AddField("Is Default", device.IsDefault);
            data.AddField("Is Valid", device.IsValid);

            return data;
        }
Beispiel #30
0
        private static FieldList GetSite()
        {
            var site = Context.Site;

            var data = new FieldList();

            data.AddField("Name", site.Name);
            data.AddField("HostName", site.HostName);
            data.AddField("TargetHostName", site.TargetHostName);
            data.AddField("Language", site.Language);
            data.AddField("Database", site.Properties["database"]);
            data.AddField("Device", site.Device);
            data.AddField("RootPath", site.RootPath);
            data.AddField("StartItem", site.StartItem);
            data.AddField("StartPath", site.StartPath);
            data.AddField("PhysicalFolder", site.PhysicalFolder);
            data.AddField("VirtualFolder", site.VirtualFolder);
            data.AddField("LoginPage", site.LoginPage);
            data.AddField("RequireLogin", site.RequireLogin);
            data.AddField("AllowDebug", site.AllowDebug);
            data.AddField("EnableAnalytics", site.EnableAnalytics);
            data.AddField("EnableDebugger", site.EnableDebugger);
            data.AddField("EnablePreview", site.EnablePreview);
            data.AddField("EnableWorkflow", site.EnableWorkflow);
            data.AddField("EnableWebEdit", site.EnableWebEdit);
            data.AddField("FilterItems", site.FilterItems);
            data.AddField("CacheHtml", site.CacheHtml);
            data.AddField("CacheMedia", site.CacheMedia);
            data.AddField("MediaCachePath", site.MediaCachePath);
            data.AddField("XmlControlPage", site.XmlControlPage);

            return(data);
        }
        private static FieldList GetUser()
        {
            var user = Context.User;

            var data = new FieldList();

            data.AddField("Name", user.Name);
            data.AddField("DisplayName", user.DisplayName);
            data.AddField("Roles", user.Roles.Select(r => r.Name));
            data.AddField("Description", user.Description);
            data.AddField("Domain Name", user.GetDomainName());
            data.AddField("IsAdministrator", user.IsAdministrator);
            data.AddField("IsAuthenticated", user.IsAuthenticated);
            data.AddField("LocalName", user.LocalName);

            return data;
        }
        private static FieldList GetLayout(LayoutItem layoutItem)
        {
            var data = new FieldList();

            data.AddField("Display Name", layoutItem.DisplayName);
            data.AddField("File Path", layoutItem.FilePath);
            data.AddField("ID", layoutItem.ID.Guid.ToString());

            return data;
        }
        private static FieldList GetDomain()
        {
            var domain = Context.Domain;

            var data = new FieldList();

            data.AddField("Name", domain.Name);
            data.AddField("Is Default", domain.IsDefault);
            data.AddField("Account Prefix", domain.AccountPrefix);
            data.AddField("Anonymous User Name", domain.AnonymousUserName);
            data.AddField("Default Profile Item ID", domain.DefaultProfileItemID);
            data.AddField("Ensure Anonymous User", domain.EnsureAnonymousUser);
            data.AddField("Everyone Role Name", domain.EveryoneRoleName);
            data.AddField("Locally Managed", domain.LocallyManaged);
            data.AddField("Anonymous User Email Pattern", domain.AnonymousUserEmailPattern);
            data.AddField("Account Name Validation", domain.AccountNameValidation);
            data.AddField("Member Pattern", domain.MemberPattern);

            return data;
        }
Beispiel #34
0
 private static void AddCloneFields(Item item, FieldList data)
 {
     data.AddField("Is Clone", item.IsClone);
     data.AddField("Is Item Clone", item.IsItemClone);
     data.AddField("Source Uri", item.SourceUri);
 }
        private void lstTable_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (editState != EnumEditState.Ready)
            {
                return;
            }
            editState = EnumEditState.TableChanged;
            try
            {
                int n = lstTable.SelectedIndex;
                if (n >= 0)
                {
                    //reload Field Grid ======================================
                    //
                    dt           = new DatabaseTable();
                    dt.TableName = lstTable.Items[n].ToString();
                    //
                    loadFromCache();
                    //
                    ds = new System.Data.DataSet("Fields");
                    ds.Tables.Add(dt.TableName);
                    ds.Tables[0].Columns.Add();
                    ds.Tables[0].Columns.Add();
                    ds.Tables[0].Columns.Add();
                    //
                    ds.Tables[0].Columns[0].Caption    = "FieldName";
                    ds.Tables[0].Columns[0].ColumnName = "FieldName";
                    ds.Tables[0].Columns[0].DataType   = typeof(string);
                    ds.Tables[0].Columns[0].MaxLength  = 30;
                    ds.Tables[0].Columns[0].ReadOnly   = true;
                    //
                    ds.Tables[0].Columns[1].Caption    = "Include";
                    ds.Tables[0].Columns[1].ColumnName = "Include";
                    ds.Tables[0].Columns[1].DataType   = typeof(bool);
                    //
                    ds.Tables[0].Columns[2].Caption    = "Value";
                    ds.Tables[0].Columns[2].ColumnName = "Value";
                    ds.Tables[0].Columns[2].DataType   = typeof(string);
                    ds.Tables[0].Columns[2].MaxLength  = 80;
                    //
                    dataGrid1.AllowUserToOrderColumns = false;
                    //
                    dt.GetFields(dbConn.ConnectionObject);
                    int      count = dt.FieldCount;
                    object[] vs;
                    EPField  fld, fld2;
                    _currentFields = new FieldList();
                    for (int i = 0; i < count; i++)
                    {
                        fld = dt.GetField(i);
                        _currentFields.AddField(fld);
                        vs    = new object[3];
                        vs[0] = fld.Name;
                        fld2  = objRet.GetField(fld.Name);
                        if (fld2 != null)
                        {
                            fld2.OleDbType = fld.OleDbType;
                            vs[1]          = true;
                            vs[2]          = fld2.FieldText;
                        }
                        else
                        {
                            vs[1] = false;
                            vs[2] = "";
                        }
                        ds.Tables[0].Rows.Add(vs);
                    }
                    //
                    ds.Tables[0].ColumnChanged  += new System.Data.DataColumnChangeEventHandler(dlgPropSQLNonQuery_ColumnChanged);
                    ds.Tables[0].ColumnChanging += new System.Data.DataColumnChangeEventHandler(dlgPropSQLNonQuery_ColumnChanging);
                    //
                    dataGrid1.DataSource = null;
                    dataGrid1.Columns.Clear();
                    dataGrid1.AutoGenerateColumns      = true;
                    dataGrid1.DataSource               = ds;
                    dataGrid1.DataMember               = dt.TableName;
                    dataGrid1.AllowUserToOrderColumns  = false;
                    dataGrid1.AllowUserToAddRows       = false;
                    dataGrid1.AllowUserToDeleteRows    = false;
                    dataGrid1.AllowUserToResizeRows    = false;
                    dataGrid1.AllowUserToResizeColumns = true;
                    dataGrid1.ColumnHeadersVisible     = true;

                    //
                    dataGrid1.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                    //
                    dataGrid1.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dataGrid1.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
                    dataGrid1.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
                    //
                    txtValue.Text = "";
                    //
                    if (string.Compare(objRet.TableName, dt.TableName, StringComparison.OrdinalIgnoreCase) != 0)
                    {
                        saveTocCache();
                    }
                    showSQL();
                }
            }
            finally
            {
                editState = EnumEditState.Ready;
            }
        }
        private static FieldList GetItem(Item item)
        {
            var data = new FieldList();

            data.AddField("Name", item.Name);
            data.AddField("Display Name", item.DisplayName);
            data.AddField("Language Name", item.Language.Name);
            data.AddField("Template Name", item.Template.Name);

            if (item.Parent != null)
            {
                data.AddField("Parent Name", item.Parent.Name);
            }

            data.AddField("Full Path", item.Paths.FullPath);
            data.AddField("Version Number", item.Version.Number);
            data.AddField("ID", item.ID.Guid);
            data.AddField("Parent ID", item.ParentID.Guid);
            data.AddField("Template ID", item.TemplateID.Guid);

            return data;
        }
        private static FieldList GetExtendedProperties(Item item)
        {
            var data = new FieldList();

            data.AddField("Key", item.Key);
            data.AddField("Has Children", item.HasChildren);

            if ((item.Children != null) && item.HasChildren)
            {
                data.AddField("Children", item.Children.Count);
            }

            if (item.Branch != null)
            {
                data.AddField("Branch Name", item.Branch.Name);
                data.AddField("Branch Id", item.BranchId.Guid);
            }

            data.AddField("Short Description", item.Appearance.ShortDescription);
            data.AddField("Long Description", item.Appearance.LongDescription);

            data.AddField("Originator Id", item.OriginatorId.Guid);
            data.AddField("Uri", item.Uri);
            data.AddField("Full Path", item.Paths.FullPath);
            data.AddField("Long ID", item.Paths.LongID);
            data.AddField("Hidden", item.Appearance.Hidden);
            data.AddField("Read Only", item.Appearance.ReadOnly);
            data.AddField("Sort order", item.Appearance.Sortorder);
            data.AddField("Style", item.Appearance.Style);

            AddCloneFields(item, data);

            data.AddField("Created", item.Statistics.Created);
            data.AddField("Created By", item.Statistics.CreatedBy);
            data.AddField("Updated", item.Statistics.Updated);
            data.AddField("Updated By", item.Statistics.UpdatedBy);
            data.AddField("Revision", item.Statistics.Revision);

            return data;
        }
        private static FieldList GetCulture(CultureInfo culture)
        {
            var data = new FieldList();

            data.AddField("Name", culture.Name);
            data.AddField("Parent", culture.Parent);
            data.AddField("Display Name", culture.DisplayName);
            data.AddField("English Name", culture.EnglishName);
            data.AddField("Native Name", culture.NativeName);
            data.AddField("Two Letter ISO Language Name", culture.TwoLetterISOLanguageName);
            data.AddField("Three Letter Windows Language Name", culture.ThreeLetterWindowsLanguageName);
            data.AddField("Three Letter ISO Language Name", culture.ThreeLetterISOLanguageName);

            return data;
        }
        private static FieldList GetItem()
        {
            var item = Context.Item;

            var data = new FieldList();

            var itemValues = GetItem(item);

            foreach (var field in itemValues.Fields)
            {
                data.AddField(field.Key, field.Value);
            }

            data.AddField("Fields", GeFieldsProperties(item));
            data.AddField("Extended Properties", GetExtendedProperties(item).Fields);

            return data;
        }