Exemplo n.º 1
0
        protected override Control AddEditor(Control panel)
        {
            ItemEditView editor = new ItemEditView();
            editor.ID = Name;
            //editor.ZoneName = DefaultChildZoneName;
            editor.Init += OnChildEditorInit;

            panel.Controls.Add(editor);

            return editor;
        }
Exemplo n.º 2
0
 private void AddItemEditor(ContentItem item)
 {
     ItemEditView itemEditor = new ItemEditView();
     itemEditor.ID = ID + "_ie_" + itemEditorIndex;
     AddToContainer(itemEditorsContainer, itemEditor, item);
     itemEditors.Add(itemEditor);
     itemEditor.CurrentItem = item;
 }
Exemplo n.º 3
0
        private Window AddEditorWindow(ContentItem contentItem)
        {
            Window editorWindow = new Window
            {
                ID = ID + "editorWindow" + _itemEditorIndex,
                Title = "Edit",
                Icon = Icon.NoteEdit,
                Width = 800,
                Height = 400,
                Modal = true,
                Hidden = true,
                Layout = "Fit",
                AutoScroll = true
            };

            Controls.Add(editorWindow);

            // Item Editor

            ItemEditView itemEditor = new ItemEditView();
            itemEditor.ID = ID + "_ie_" + _itemEditorIndex;
            editorWindow.ContentControls.Add(itemEditor);
            itemEditor.CurrentItem = contentItem;

            _itemEditors.Add(itemEditor);

            // Buttons

            Ext.Net.Button saveButton = new Ext.Net.Button
            {
                ID = ID + "btnSave" + _itemEditorIndex,
                Text = "Update",
                Icon = Icon.Disk
            };
            string titleValue = itemEditor.PropertyControls.ContainsKey("Title")
                ? string.Format("Ext.getDom('{0}').value", itemEditor.PropertyControls["Title"].ClientID)
                : "'[No Title]'";
            saveButton.Listeners.Click.Handler = string.Format(@"
                var editorWindow = Ext.getCmp('{0}editorWindow{1}');
                var record = editorWindow.record;
                record.set('Title', {2});
                editorWindow.hide(null);",
                ClientID, _itemEditorIndex, titleValue);
            editorWindow.Buttons.Add(saveButton);

            ++_itemEditorIndex;

            return editorWindow;
        }
Exemplo n.º 4
0
 protected virtual void AddToContainer(Control container, ItemEditView itemEditor, ContentItem item)
 {
     FieldSet fs = new FieldSet();
     string status = (item.ID != 0) ? "ID #" + item.ID : "(Unsaved)";
     fs.Title = (item.ID != 0) ? Zeus.Context.Current.ContentTypes[item.GetType()].ContentTypeAttribute.Title + " " + status : "New Item " + status;
     container.Controls.Add(fs);
     fs.ContentControls.Add(itemEditor);
 }