/// <summary>
        /// Gets all the assigned validators for the given Editor.
        /// </summary>
        /// <param name="editor"></param>
        /// <returns>ValidatorCollection</returns>
        private ValidatorCollection GetEditorValidators(FieldSuiteEditor editor)
        {
            ValidatorCollection validators = ValidatorManager.BuildValidators(ValidatorsMode.ValidatorBar, editor.Item);
            ValidatorOptions    options    = new ValidatorOptions(false);

            foreach (string marker in editor.FieldInfo.Keys)
            {
                FieldInfo fieldInfo = editor.FieldInfo[marker] as FieldInfo;
                if (fieldInfo == null)
                {
                    continue;
                }
                Sitecore.Data.Validators.BaseValidator validator = validators.Where(x => x.FieldID == fieldInfo.FieldID).FirstOrDefault();
                if (validator == null)
                {
                    continue;
                }
                validator.ControlToValidate = marker;
            }

            ValidatorManager.Validate(validators, options);
            ValidatorManager.UpdateValidators(validators);

            return(validators);
        }
Esempio n. 2
0
        /// <summary>
        /// Renders the Content Editor for the Current Item's Fields
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public FieldSuiteEditor CreateContentEditor(Item item)
        {
            //instantiate editor
            FieldSuiteEditor editor = new FieldSuiteEditor
            {
                RenderHeader      = false,
                RenderTabsAndBars = false,
                RenderWarnings    = true,
                SectionsToRender  = new List <string>()
                {
                    "Spotlight Image"
                },
                NewSectionNames = new Dictionary <string, string>()
            };

            //render item in editor
            editor.Render(CurrentItem, CurrentItem.Parent, new Hashtable(), ContentEditor, true);

            //transfer rendering to the client page
            Context.ClientPage.ClientResponse.SetOuterHtml(ContentEditor.ID, ContentEditor);

            CurrentEditors.Add(editor);

            return(editor);
        }
		/// <summary>
		/// Renders the Content Editor for the Current Item's Fields
		/// </summary>
		/// <param name="item"></param>
		/// <returns></returns>
		public FieldSuiteEditor CreateContentEditor(Item item)
		{
			//instantiate editor
			FieldSuiteEditor editor = new FieldSuiteEditor
			{
				RenderHeader = true,
				RenderTabsAndBars = false,
				RenderWarnings = true
			};

			//render item in editor
			editor.Render(CurrentItem, CurrentItem.Parent, new Hashtable(), ContentEditor, true);

			//transfer rendering to the client page
			Context.ClientPage.ClientResponse.SetOuterHtml(ContentEditor.ID, ContentEditor);

			CurrentEditors.Add(editor);

			return editor;
		}
        /// <summary>
        /// Renders the Content Editor for the Current Item's Fields
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public FieldSuiteEditor CreateContentEditor(Item item)
        {
            //instantiate editor
            FieldSuiteEditor editor = new FieldSuiteEditor
            {
                RenderHeader = true,
                RenderTabsAndBars = false,
                RenderWarnings = true
            };

            //render item in editor
            editor.Render(CurrentItem, CurrentItem.Parent, new Hashtable(), ContentEditor, true);

            //transfer rendering to the client page
            Context.ClientPage.ClientResponse.SetOuterHtml(ContentEditor.ID, ContentEditor);

            CurrentEditors.Add(editor);

            return editor;
        }
Esempio n. 5
0
        private void ProcessDirtyBit(NameValueCollection args)
        {
            ClientPipelineArgs pipelineArgs = new ClientPipelineArgs(args);

            FieldSuiteEditor[] editors = new FieldSuiteEditor[CurrentEditors.Count];
            CurrentEditors.CopyTo(editors);
            DirtyEditors = editors.ToList();

            DirtySargs = new List <SaveArgs>();
            foreach (FieldSuiteEditor editor in CurrentEditors)
            {
                Hashtable fieldInfo = editor.FieldInfo;
                SaveArgs  sargs     = new SaveArgs(GetSavePacket(fieldInfo).XmlDocument)
                {
                    SaveAnimation = false
                };
                DirtySargs.Add(sargs);
            }

            Sitecore.Pipelines.Pipeline pipe = Context.ClientPage.Start(this, "ShowSaveMessage", pipelineArgs);

            LoadCurrentItem();
        }
        private void ProcessDirtyBit(NameValueCollection args)
        {
            ClientPipelineArgs pipelineArgs = new ClientPipelineArgs(args);

            FieldSuiteEditor[] editors = new FieldSuiteEditor[CurrentEditors.Count];
            CurrentEditors.CopyTo(editors);
            DirtyEditors = editors.ToList();

            DirtySargs = new List<SaveArgs>();
            foreach (FieldSuiteEditor editor in CurrentEditors)
            {
                Hashtable fieldInfo = editor.FieldInfo;
                SaveArgs sargs = new SaveArgs(GetSavePacket(fieldInfo).XmlDocument) { SaveAnimation = false };
                DirtySargs.Add(sargs);
            }

            Sitecore.Pipelines.Pipeline pipe = Context.ClientPage.Start(this, "ShowSaveMessage", pipelineArgs);

            LoadCurrentItem();
        }
        /// <summary>
        /// Gets all the assigned validators for the given Editor.
        /// </summary>
        /// <param name="editor"></param>
        /// <returns>ValidatorCollection</returns>
        private ValidatorCollection GetEditorValidators(FieldSuiteEditor editor)
        {
            ValidatorCollection validators = ValidatorManager.BuildValidators(ValidatorsMode.ValidatorBar, editor.Item);
            ValidatorOptions options = new ValidatorOptions(false);

            foreach (string marker in editor.FieldInfo.Keys)
            {
                FieldInfo fieldInfo = editor.FieldInfo[marker] as FieldInfo;
                if (fieldInfo == null) continue;
                Sitecore.Data.Validators.BaseValidator validator = validators.Where(x => x.FieldID == fieldInfo.FieldID).FirstOrDefault();
                if (validator == null) continue;
                validator.ControlToValidate = marker;
            }

            ValidatorManager.Validate(validators, options);
            ValidatorManager.UpdateValidators(validators);

            return validators;
        }
        /// <summary>
        /// Renders the Content Editor for the Current Item's Fields
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public FieldSuiteEditor CreateContentEditor(Item item)
        {
            //instantiate editor
            FieldSuiteEditor editor = new FieldSuiteEditor
            {
                RenderHeader = false,
                RenderTabsAndBars = false,
                RenderWarnings = true,
                SectionsToRender = new List<string>() { "Spotlight Image" },
                NewSectionNames = new Dictionary<string, string>()
            };

            //render item in editor
            editor.Render(CurrentItem, CurrentItem.Parent, new Hashtable(), ContentEditor, true);

            //transfer rendering to the client page
            Context.ClientPage.ClientResponse.SetOuterHtml(ContentEditor.ID, ContentEditor);

            CurrentEditors.Add(editor);

            return editor;
        }