Пример #1
0
        private void UpdateObjectFromFields()
        {
            selectedItem.Name             = Name.Text;
            selectedItem.MediaTypeHandler = MediaTypeHandler.GetValue().ToString();

            if (MasterPageSelector.SelectedValue != "")
            {
                selectedItem.MasterPageID = long.Parse(MasterPageSelector.SelectedValue);
            }
            else
            {
                selectedItem.MasterPage = null;
            }

            selectedItem.Label               = Label.Text;
            selectedItem.IsActive            = IsActive.Checked;
            selectedItem.ShowInMenu          = ShowInMenu.Checked;
            selectedItem.ShowInSiteTree      = ShowInSiteTree.Checked;
            selectedItem.ShowInSearchResults = ShowInSearchResults.Checked;
            selectedItem.EnableCaching       = EnableCaching.Checked;
            selectedItem.AddRoles(MultiRoleSelector.GetSelectedRoles());
            selectedItem.AddChildMediaTypes(MultiMediaTypeSelector.GetSelectedMediaTypes());
            selectedItem.MainLayout           = MediaDetailsMapper.ConvertUrlsToShortCodes(MainLayout.Text);
            selectedItem.SummaryLayout        = MediaDetailsMapper.ConvertUrlsToShortCodes(SummaryLayout.Text);
            selectedItem.FeaturedLayout       = MediaDetailsMapper.ConvertUrlsToShortCodes(FeaturedLayout.Text);
            selectedItem.UseMediaTypeLayouts  = UseMediaTypeLayouts.Checked;
            selectedItem.OnPublishExecuteCode = OnPublishExecuteCode.Text;
        }
Пример #2
0
        public void UpdateObjectFromFields(FrameworkLibrary.Settings settings)
        {
            settings.ShoppingCartTax              = decimal.Parse(ShoppingCartTax.Text);
            settings.MaxRequestLength             = int.Parse(MaxRequestLengthInMB.Text) * (1024 * 1024);
            settings.MaxUploadFileSizePerFile     = int.Parse(MaxUploadFileSizePerFileInMB.Text) * (1024 * 1024);
            settings.GlobalCodeInHead             = MediaDetailsMapper.ConvertUrlsToShortCodes(GlobalCodeInHead.Text);
            settings.GlobalCodeInBody             = MediaDetailsMapper.ConvertUrlsToShortCodes(GlobalCodeInBody.Text);
            settings.SiteOfflineUrl               = SiteOfflineUrl.Text;
            settings.PageNotFoundUrl              = PageNotFoundUrl.Text;
            settings.EnableGlossaryTerms          = EnableGlossaryTerms.Checked;
            settings.OutputCacheDurationInSeconds = long.Parse(OutputCacheDurationInSeconds.Text);

            if (!string.IsNullOrEmpty(SiteOnlineAtDateTime.Text))
            {
                settings.SiteOnlineAtDateTime = DateTime.Parse(SiteOnlineAtDateTime.Text);
            }
            else
            {
                settings.SiteOnlineAtDateTime = DateTime.Now;
            }


            if (!string.IsNullOrEmpty(SiteOfflineAtDateTime.Text))
            {
                settings.SiteOfflineAtDateTime = DateTime.Parse(SiteOfflineAtDateTime.Text);
            }
            else
            {
                settings.SiteOfflineAtDateTime = null;
            }

            settings.DefaultLanguageID   = long.Parse(DefaultLanguageSelector.SelectedValue);
            settings.DefaultMasterPageID = long.Parse(DefaultMasterPageSelector.SelectedValue);
        }
Пример #3
0
 public void UpdateObjectFromFields()
 {
     selectedItem.MainLayout                = MediaDetailsMapper.ConvertUrlsToShortCodes(MainLayout.Text);
     selectedItem.SummaryLayout             = MediaDetailsMapper.ConvertUrlsToShortCodes(SummaryLayout.Text);
     selectedItem.FeaturedLayout            = MediaDetailsMapper.ConvertUrlsToShortCodes(FeaturedLayout.Text);
     selectedItem.UseMediaTypeLayouts       = UseMediaTypeLayouts.Checked;
     selectedItem.UseDefaultLanguageLayouts = UseDefaultLanguageLayouts.Checked;
     selectedItem.OnPublishExecuteCode      = OnPublishExecuteCode.Text;
 }
Пример #4
0
        public void SaveField()
        {
            if (DynamicField.Controls.Count == 0)
            {
                return;
            }

            var control = DynamicField.Controls[0];

            if (control is WebApplication.Admin.Controls.Fields.IFieldControl)
            {
                var ctrl  = ((WebApplication.Admin.Controls.Fields.IFieldControl)control);
                var value = ctrl.GetValue();

                if (value is string)
                {
                    var str = value.ToString();
                    str = MediaDetailsMapper.ConvertUrlsToShortCodes(str);
                    Field.FieldValue = str;
                }

                ctrl.SetValue(value);
            }
            else
            {
                try
                {
                    Field.FieldValue = ParserHelper.ParseData("{" + Field.GetAdminControlValue + "}", control);
                }
                catch (Exception ex)
                {
                    DisplayErrorMessage("Error", ErrorHelper.CreateError(ex));
                }
            }

            if (Field.MediaTypeField != null && Field.UseMediaTypeFieldFrontEndLayout)
            {
                Field.MediaTypeField.FrontEndLayout = FrontEndLayout.Text;
            }
            else
            {
                Field.FrontEndLayout = FrontEndLayout.Text;
            }

            var returnObj = FieldsMapper.Update(Field);

            if (returnObj.IsError)
            {
                DisplayErrorMessage("Error", returnObj.Error);
            }
            else
            {
                Field.MediaDetail.RemoveFromCache();
                DisplaySuccessMessage("Successfully saved");
            }
        }
        public void UpdateFieldsFromObject()
        {
            var selectedItem = (FrameworkLibrary.UrlRedirectRule)SelectedItem;

            VirtualPathToRedirect.Text = selectedItem.VirtualPathToRedirect;
            RedirectToUrl.Text         = MediaDetailsMapper.ConvertUrlsToShortCodes(selectedItem.RedirectToUrl);
            Is301Redirect.Checked      = selectedItem.Is301Redirect;

            CommonPanel.UpdateFieldsFromObject();
        }
        public void UpdateFieldsFromObject()
        {
            //ShowInMenu.Checked = selectedItem.ShowInMenu;
            ShowInSearchResults.Checked = selectedItem.ShowInSearchResults;
            UseDirectLink.Checked       = selectedItem.UseDirectLink;

            selectedItem.DirectLink = MediaDetailsMapper.ConvertUrlsToShortCodes(selectedItem.DirectLink);

            DirectLink.SetValue(selectedItem.DirectLink);
            OpenInNewWindow.Checked      = selectedItem.OpenInNewWindow;
            RenderInFooter.Checked       = selectedItem.RenderInFooter;
            ForceSSL.Checked             = selectedItem.ForceSSL;
            CssClasses.Text              = selectedItem.CssClasses;
            RedirectToFirstChild.Checked = selectedItem.RedirectToFirstChild;
            IsProtected.Checked          = selectedItem.IsProtected;
        }
Пример #7
0
        private void UpdateObjectFromMediaFields()
        {
            foreach (var FieldGroupTabContent in FieldGroupTabContents.Items)
            {
                var MediaFieldsList = (ListView)FieldGroupTabContent.FindControl("MediaFieldsList");

                var index = 0;
                foreach (var item in MediaFieldsList.Items)
                {
                    var fieldIdField = (HiddenField)item.FindControl("FieldID");
                    var dynamicField = (PlaceHolder)item.FindControl("DynamicField");
                    var fieldId      = long.Parse(fieldIdField.Value.ToString());

                    //var dataItem = MediasMapper.GetDataModel().Fields.SingleOrDefault(i => i.ID == fieldId);

                    var dataItem = (MediaDetailField)((IEnumerable <object>)MediaFieldsList.DataSource).ElementAt(index);
                    index++;

                    if (dynamicField.Controls.Count == 0)
                    {
                        return;
                    }

                    var control = dynamicField.Controls[0];

                    if (control.Controls.Count > 0)
                    {
                        foreach (Control ctrl in control.Controls)
                        {
                            if (!(ctrl is LiteralControl))
                            {
                                control = ctrl;
                            }
                        }
                    }

                    var adminPanel = WebFormHelper.FindControlRecursive(dynamicField, "AdminPanel");

                    if (adminPanel != null)
                    {
                        control = adminPanel.Parent;
                    }

                    if (control is WebApplication.Admin.Controls.Fields.IFieldControl)
                    {
                        var valAsString = ((WebApplication.Admin.Controls.Fields.IFieldControl)control).GetValue().ToString();

                        if (!string.IsNullOrEmpty(valAsString))
                        {
                            valAsString = MediaDetailsMapper.ConvertUrlsToShortCodes(valAsString);

                            if (valAsString.Contains(URIHelper.BaseUrl))
                            {
                                valAsString = valAsString.Replace(URIHelper.BaseUrl, "{BaseUrl}");
                            }
                        }

                        dataItem.FieldValue = MediaDetailsMapper.ConvertUrlsToShortCodes(valAsString);
                    }
                    else
                    {
                        var fieldValue = "";

                        if (dataItem.GetAdminControlValue.Contains("@"))
                        {
                            fieldValue = ParserHelper.ParseData(dataItem.GetAdminControlValue, new { Control = control });
                        }
                        else
                        {
                            fieldValue = ParserHelper.ParseData("{" + dataItem.GetAdminControlValue + "}", control);
                        }

                        if (fieldValue != "{" + dataItem.GetAdminControlValue + "}")
                        {
                            fieldValue          = MediaDetailsMapper.ConvertUrlsToShortCodes(fieldValue);
                            dataItem.FieldValue = fieldValue.Replace(URIHelper.BaseUrl, "{BaseUrl}");
                        }
                        else
                        {
                            dataItem.FieldValue = "";
                        }
                    }
                }
            }

            /*var returnObj = MediaDetailsMapper.Update(SelectedItem);
             *
             * if (returnObj.IsError)
             *  BasePage.DisplayErrorMessage("Error", returnObj.Error);*/
        }