示例#1
0
        private void setContentTypes(String contentType)
        {
            // set the content model type and aspects options
            this.ContentType.Items.Clear();
            ComboItem item;
            ComboItem selectedItem = null;

            // only get the document types of subtype Content
            Alfresco.DictionaryServiceWebService.ClassPredicate classPredicate = new Alfresco.DictionaryServiceWebService.ClassPredicate();
            classPredicate.names = new String[] { "cm:content" };
            classPredicate.followSubClass = true;

            Alfresco.DictionaryServiceWebService.ClassDefinition[] classDefinitions = WebServiceFactory.getDictionaryService().getClasses(classPredicate, null);
            foreach (Alfresco.DictionaryServiceWebService.ClassDefinition classDefinition in classDefinitions)
            {

                string displayLabel = classDefinition.title;
                if (displayLabel != null && displayLabel.Trim().Length != 0)
                {
                    item = new ComboItem(displayLabel, classDefinition.name);
                    item.ItemTag = classDefinition;
                    if (classDefinition.isAspect)
                    {
                        this.Aspects.Items.Add(item);
                    }
                    else
                    {

                        this.ContentType.Items.Add(item);

                        if (contentType != null && contentType.Equals(classDefinition.name))
                        {
                            // this is the current selected item
                            selectedItem = item;
                        }
                    }
                }
            }

            if (selectedItem != null)
            {
                this.ContentType.SelectedItem = selectedItem;
            }

            this.ContentType.Enabled = true;
        }
示例#2
0
        private void ContentType_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                // clear any checked aspects
                this.clearAspects();

                // get the destination fields for the content type
                // and create new releaselinks
                this.releaseLinks = new ArrayList();
                // get the ClassDef assigned to the comboItem
                ComboItem comboItem = (ComboItem)this.ContentType.SelectedItem;
                Alfresco.DictionaryServiceWebService.ClassDefinition classDefinition = (Alfresco.DictionaryServiceWebService.ClassDefinition)comboItem.ItemTag;
                Alfresco.DictionaryServiceWebService.PropertyDefinition[] properties = classDefinition.properties;

                int propLength = 0;
                if (properties != null)
                {
                    int offset = 0;
                    foreach (Alfresco.DictionaryServiceWebService.PropertyDefinition prop in properties)
                    {
                        // dont add content type fields, these are for the tiff, ocr and pdf fields
                        String dataType = prop.dataType;

                        if (dataType.EndsWith("content"))
                        {
                            // add this to the document content options
                            ComboItem contentComboItem = new ComboItem(prop.title, prop.name);
                            if (this.OCR.Enabled || this.PDF.Enabled)
                            {

                                if (this.OCR.Items.Count == 0)
                                {
                                    this.OCR.Items.Add("");
                                    this.PDF.Items.Add("");
                                }

                                this.OCR.Items.Add(contentComboItem);
                                this.PDF.Items.Add(contentComboItem);
                            }
                            else
                            {
                                if (this.Image.Items.Count == 0)
                                {
                                    this.Image.Items.Add("");
                                }
                            }

                            this.Image.Items.Add(contentComboItem);

                            offset++;
                        }
                        else
                        {
                            String title = prop.title;
                            if (title != null && !title.Equals(""))
                            {
                                this.addReleaseLink(title, ReleaseConstants.CONTENT_TYPE + prop.name, dataType, prop.mandatory);
                            }
                            else
                            {
                                // dont add
                                offset++;
                            }
                        }
                    }
                    propLength = properties.Length - offset;

                }

                if (propLength < this.numFieldsDisplayed)
                {
                    // hide the extra fields
                    for (int i = propLength; i < this.numFieldsDisplayed; i++)
                    {
                        this.removeFields(i);
                    }
                }

                this.destinationFieldCount = propLength;

                if (this.destinationFieldCount <= MAX_FILEDS)
                {
                    this.numFieldsDisplayed = this.destinationFieldCount;
                }
                else
                {
                    this.numFieldsDisplayed = MAX_FILEDS;
                    // turn on the scroll bar and set the max scroll size
                    this.vScrollBar1.Maximum = this.destinationFieldCount;
                    this.vScrollBar1.Visible = true;
                }

                // display the new links and enable the aspects
                this.Aspects.Enabled = true;
                this.displayDestinations(0);
            }
            catch (Exception ex)
            {
                Log log = new Log();
                log.ErrorLog(".\\log\\", "frmAlfrescoSetUp method ContentType_SelectedIndexChanged " + ex.Message, ex.StackTrace);
            }
        }
示例#3
0
 private void setAspectsOptions(ComboItem[] items)
 {
     this.Aspects.Items.Clear();
     this.Aspects.Items.AddRange(items);
     this.Aspects.SelectedIndex = -1;
     this.Aspects.Enabled = true;
 }