Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);
            ValidatorPanel.Attributes.Add("style", "display:none;");
            dataTreeView.OnClick += new EventHandler(dataTreeView_OnClick);

            if (Context.ClientPage.IsEvent)
            {
                return;
            }

            // Sets up the data context to show all children of the /sitecore item in the master database
            TreeviewDataContext.DataViewName = "Master";

            // in questione preview mode we do not need these values.
            TreeviewDataContext.Root = EducationMediaFolder.ID.ToString();

            if (CurrentEditors == null)
            {
                CurrentEditors = new List <FieldSuiteEditor>();
            }

            if (CurrentItem.IsNull())
            {
                //there is nothing to render except the tree so the user can select an item
                if (AddFromExistingItem)
                {
                    //set form
                    SetDisplay();
                    return;
                }
                CreateItem();
            }

            LoadCurrentItem();
        }
Ejemplo n.º 2
0
        public override void Execute(CommandContext context)
        {
            AppName      = context.Parameters[AppNameParameter];
            Personalized = context.Parameters[PersonalParameter] == "1";

            Assert.ArgumentNotNull(context, nameof(context));
            var settingsPath = ApplicationSettings.GetSettingsPath(AppName, Personalized);

            CurrentItem = Factory.GetDatabase(ApplicationSettings.SettingsDb).GetItem(settingsPath);
            if (CurrentItem.IsNull())
            {
                var settings = ApplicationSettings.GetInstance(AppName, Personalized);
                settings.Save();
                CurrentItem = Factory.GetDatabase(ApplicationSettings.SettingsDb).GetItem(settingsPath);
            }

            Context.ClientPage.Start(this, "StartFieldEditor", new ClientPipelineArgs(context.Parameters)
            {
                Parameters =
                {
                    { "uri", CurrentItem.Uri.ToString() }
                }
            });
        }