Beispiel #1
0
        public static void ShowBuildMappingForm(SPDocumentLibrary docLib, MappingProfile mp)
        {
            if (docLib == null)
            {
                return;
            }
            frmBuildMapping f = new frmBuildMapping();

            //--populate cboTargetContentType
            List <string> inelligableContentTypes = new List <string>();

            //inelligableContentTypes.Add("Document");
            inelligableContentTypes.Add("Folder");
            foreach (SPContentType ct in docLib.ContentTypes)
            {
                if (!inelligableContentTypes.Contains(ct.Name))
                {
                    f.cboTargetContentType.Items.Add(ct.Name);
                }
            }

            //--
            f.lblTargetDocLib.Text = "Target Document Library: " + docLib.Title;
            f.m_targetDocLib       = docLib;
            if (mp == null) //--create a new Mapping Profile
            {
                f.m_mpWorking = new MappingProfile("new profile", "");
                f.m_mpWorking.MappingItems = new List <MappingItem>();
                f.txtProfileName.Text      = "(New Mapping Profile)";
                f.Text = "New Mapping Profile";
                f.lnkDeleteProfile.Enabled = false;
                if (f.cboTargetContentType.Items.Count == 1)
                {
                    f.cboTargetContentType.SelectedIndex = 0;
                }
            }
            else //--edit existing Mapping Profile
            {
                f.m_editingMPindex = ActionMetaDataUtil.MappingProfiles.IndexOf(mp);
                MappingProfile ret = (MappingProfile)Util.DeepCopy(mp);
                if (ret == null)
                {
                    return;
                }
                f.m_mpWorking         = ret;
                f.txtProfileName.Text = mp.ProfileName;
                f.cboTargetContentType.SelectedIndex = f.cboTargetContentType.FindStringExact(mp.TargetContentTypeName);
                f.Text = "Edit Mapping Profile";
                if (f.m_mpWorking.MappingItems == null)
                {
                    f.m_mpWorking.MappingItems = new List <MappingItem>();
                }
            }

            f.displayMappingProfileInRtb(null, null);
            f.Location = new Point(MainForm.DefInstance.Left + 10, MainForm.DefInstance.Top + 10);

            //--
            f.ShowDialog();
        }
        public static void ShowBuildMappingForm(SPDocumentLibrary docLib, MappingProfile mp)
        {
            if (docLib == null)
                return;
            frmBuildMapping f = new frmBuildMapping();

            //--populate cboTargetContentType
            List<string> inelligableContentTypes = new List<string>();
            //inelligableContentTypes.Add("Document");
            inelligableContentTypes.Add("Folder");
            foreach (SPContentType ct in docLib.ContentTypes)
            {
                if (!inelligableContentTypes.Contains(ct.Name)) 
                    f.cboTargetContentType.Items.Add(ct.Name);
            }

            //--
            f.lblTargetDocLib.Text = "Target Document Library: " + docLib.Title;
            f.m_targetDocLib = docLib;
            if (mp == null) //--create a new Mapping Profile
            {
                f.m_mpWorking = new MappingProfile("new profile","");
                f.m_mpWorking.MappingItems = new List<MappingItem>();
                f.txtProfileName.Text = "(New Mapping Profile)";
                f.Text = "New Mapping Profile";
                f.lnkDeleteProfile.Enabled = false;
                if (f.cboTargetContentType.Items.Count == 1)
                    f.cboTargetContentType.SelectedIndex = 0;
            }
            else //--edit existing Mapping Profile
            {
                f.m_editingMPindex = ActionMetaDataUtil.MappingProfiles.IndexOf(mp);
                MappingProfile ret = (MappingProfile)Util.DeepCopy(mp);
                if (ret == null)
                    return;
                f.m_mpWorking = ret;
                f.txtProfileName.Text = mp.ProfileName;
                f.cboTargetContentType.SelectedIndex = f.cboTargetContentType.FindStringExact(mp.TargetContentTypeName);
                f.Text = "Edit Mapping Profile";
                if (f.m_mpWorking.MappingItems == null)
                    f.m_mpWorking.MappingItems = new List<MappingItem>();
            }

            f.displayMappingProfileInRtb(null, null);
            f.Location = new Point(MainForm.DefInstance.Left +10 , MainForm.DefInstance.Top + 10);

            //--
            f.ShowDialog();
        }