Пример #1
0
    protected void Binding_Panel2()
    {
        contenu           = new AIS.Content();
        contenu.published = "n";
        contenu.id_user   = UserInfo.UserID;
        contenu.photo     = "";
        contenu.text      = "";
        contenu.title     = "Nouvelle annonce";
        contenu.type      = "Annonce";
        contenu.textFile  = "";


        int id_c = DataMapping.Insert_Content(contenu);

        if (id_c > 0)
        {
            contenu.id = id_c;

            if (contenu != null)
            {
                // Custum image manager
                string        filename_Img = Functions.ClearFileName(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/");
                DirectoryInfo d            = new DirectoryInfo(Server.MapPath(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/"));
                if (!d.Exists)
                {
                    d.Create();
                }
                TXT_Editor.ImageManager.ViewPaths   = new string[] { filename_Img };
                TXT_Editor.ImageManager.UploadPaths = new string[] { filename_Img };
                TXT_Editor.ImageManager.DeletePaths = new string[] { filename_Img };

                // Custum document manager
                string filename_Doc = Functions.ClearFileName(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/");
                TXT_Editor.DocumentManager.ViewPaths   = new string[] { filename_Doc };
                TXT_Editor.DocumentManager.UploadPaths = new string[] { filename_Doc };
                TXT_Editor.DocumentManager.DeletePaths = new string[] { filename_Doc };
                //size
                TXT_Editor.DocumentManager.MaxUploadFileSize = 4194304;
                TXT_Editor.ImageManager.MaxUploadFileSize    = 1048576;

                Session["id_contenu"] = contenu.id;

                Session["publie"] = contenu.published;

                if (!string.IsNullOrEmpty(contenu.text))
                {
                    TXT_Editor.Content = contenu.text;
                }

                if (!string.IsNullOrEmpty(contenu.title))
                {
                    TBX_Titre.Text = contenu.title;
                }

                if (!string.IsNullOrEmpty(contenu.announcementType))
                {
                    if (contenu.announcementType.ToLower() == "offre")
                    {
                        RBT_Offre.Checked = true;
                    }
                    else
                    {
                        RBT_Demande.Checked = true;
                    }
                }

                IMG_Logo.ImageUrl       = contenu.GetAnnoncePhoto();
                HF_Logo.Value           = contenu.photo;
                BT_Effacer_Logo.Visible = contenu.photo != "";

                if (!string.IsNullOrEmpty(contenu.file))
                {
                    HL_Url.NavigateUrl = contenu.GetAnnonceFichier();
                }

                if (!string.IsNullOrEmpty(contenu.textFile))
                {
                    HL_Url.Text        = contenu.textFile;
                    TXT_Url_Texte.Text = contenu.textFile;
                }
            }
        }
        else
        {
        }
    }
Пример #2
0
    protected void Binding_Panel2()
    {
        if (content != null)
        {
            if (!string.IsNullOrEmpty(content.text))
            {
                LTL_Texte2.Text = content.text;
            }
            else
            {
                if (!UserInfo.IsSuperUser)
                {
                    LTL_Texte2.Visible = false;
                }
            }

            if (!string.IsNullOrEmpty(content.title))
            {
                LBL_Titre2.Text = content.title;
            }
            else
            {
                if (!UserInfo.IsSuperUser)
                {
                    LBL_Titre2.Visible = false;
                }
            }

            if (!string.IsNullOrEmpty(content.GetAnnoncePhoto()))
            {
                IMG_Logo2.ImageUrl = content.GetAnnoncePhoto();
            }
            else
            {
                if (!UserInfo.IsSuperUser)
                {
                    IMG_Logo2.Visible = false;
                }
            }

            if (!string.IsNullOrEmpty(content.file))
            {
                HLK_URL2.NavigateUrl = content.GetAnnonceFichier();
            }
            else
            {
                if (!UserInfo.IsSuperUser)
                {
                    HLK_URL2.Visible = false;
                }
            }

            Member membre = DataMapping.GetMemberByUserID(content.id_user);
            if (membre != null && membre.id != null && membre.id > 0)
            {
                PortalSettings ps = PortalController.GetCurrentPortalSettings();
                if (ps.UserInfo.Roles != null && ps.UserInfo.Roles.Count() > 0)
                {
                    HLK_Contact2.NavigateUrl = "javascript:dnnModal.show('/AIS/contact.aspx?id=" + membre.id + "&popUp=true',false,350,850,false);";
                }
                else
                {
                    HLK_Contact2.NavigateUrl = "javascript:dnnModal.show('/AIS/contact.aspx?id=" + membre.id + "&popUp=true',false,350,500,false);";
                }
            }
            else
            {
                if (!UserInfo.IsSuperUser)
                {
                    HLK_Contact2.Visible = false;
                }
            }
        }
        else
        {
            if (!UserInfo.IsSuperUser)
            {
                LTL_Texte2.Visible   = false;
                LBL_Titre2.Visible   = false;
                IMG_Logo2.Visible    = false;
                HLK_URL2.Visible     = false;
                HLK_Contact2.Visible = false;
            }
        }
    }