Example #1
0
 public static void CKEditor(CKEditor.NET.CKEditorControl txtContent)
 {
     txtContent.Language = "vi";
     CKFinder.FileBrowser _FileBrowser = new CKFinder.FileBrowser();
     _FileBrowser.BasePath = "/ckfinder/";
     _FileBrowser.SetupCKEditor(txtContent);
 }
Example #2
0
        private void CargarProcesosProducto()
        {
            int    cont       = 1;
            string nombrectrl = "ckeProducto";
            string nombreval  = "rvProducto";
            string nombrepan  = "pan";

            //Se consulta los productos ingresados anteriormente
            ListProcesos = Producto.GetProductosProceso(Encabezado.CodigoProyecto);

            if (ListProcesos.Count > 0)
            {
                //Se realiza la creación de controles para presentar los productos en la pregunta 15
                foreach (ProductoProceso item in ListProcesos)
                {
                    //Acordeon pane y control texto enriquecido
                    AccordionPane ap1 = new AccordionPane()
                    {
                        ID = nombrepan + cont.ToString(),
                    };

                    CKEditor.NET.CKEditorControl ctrl = new CKEditor.NET.CKEditorControl();
                    ctrl.ID              = nombrectrl + cont.ToString();
                    ctrl.Enabled         = AllowUpdate;
                    ctrl.ValidationGroup = "grupo1";
                    ctrl.Attributes.Add("IdProducto", item.Id_Producto.ToString());
                    ctrl.Attributes.Add("IdProceso", item.Id_Proceso.ToString());

                    if (item.Id_Proceso != null)
                    {
                        ctrl.Text = item.DescProceso;
                    }

                    //validador
                    RequiredFieldValidator rv = new RequiredFieldValidator()
                    {
                        Display           = ValidatorDisplay.None,
                        ErrorMessage      = string.Format(Mensajes.GetMensaje(104), item.NomProducto),
                        ID                = nombreval + cont.ToString(),
                        ForeColor         = System.Drawing.Color.Red,
                        SetFocusOnError   = true,
                        ControlToValidate = nombrectrl + cont.ToString(),
                        ToolTip           = "Requerido",
                        ValidationGroup   = "grupo1"
                    };

                    rv.Font.Bold = true;
                    rv.Font.Size = FontUnit.XLarge;

                    //Se adicionan los controles creados dinámicamente
                    ap1.HeaderContainer.Controls.Add(new LiteralControl(string.Format("{0} - {1}", item.NomProducto, item.Unidad)));
                    ap1.ContentContainer.Controls.Add(rv);
                    ap1.ContentContainer.Controls.Add(ctrl);
                    Accordion1.Panes.Add(ap1);

                    cont++;
                }
            }
        }
Example #3
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                CustomizeControl1.FormTitle = string.Format(Settings.FormTitleFormat, "Sayfa", "Tanımlama");
                using (Sayfa m = SayfaMethods.GetSayfa(BAYMYO.UI.Converts.NullToInt16(Request.QueryString["sid"])))
                {
                    CustomizeControl1.RemoveVisible = (m.ID > 0);

                    TextBox txt = new TextBox();
                    txt.ID        = "Adi";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Baslik;
                    txt.MaxLength = 50;
                    CustomizeControl1.AddControl("Başlık", txt);

                    CKEditor.NET.CKEditorControl fck = new CKEditor.NET.CKEditorControl();
                    fck.ID     = "Icerik";
                    fck.Height = 400;
                    fck.Text   = m.Icerik;
                    CustomizeControl1.AddControl("Editör", fck);

                    DropDownList ddl = new DropDownList();
                    ddl.ID             = "Yerlesim";
                    ddl.CssClass       = "form-control";
                    ddl.Width          = 300;
                    ddl.DataValueField = "Key";
                    ddl.DataTextField  = "Value";
                    ddl.DataSource     = Core.GetMenuTypes();
                    ddl.DataBind();
                    ddl.SelectedValue = m.Yerlesim.ToString();
                    CustomizeControl1.AddControl("Yerleşim", ddl);

                    //ddl = new DropDownList();
                    //ddl.ID = "Dil";
                    //ddl.Width = 300;
                    //ddl.DataValueField = "Key";
                    //ddl.DataTextField = "Value";
                    //ddl.DataSource = Core.GetLanguages();
                    //ddl.DataBind();
                    //ddl.SelectedValue = m.Dil;
                    //CustomizeControl1.AddControl("Dil", ddl);

                    CheckBox chk = new CheckBox();
                    chk.ID      = "Aktif";
                    chk.Checked = (m.ID > 0) ? m.Aktif : true;
                    CustomizeControl1.AddControl("Yayımla", chk);

                    CustomizeControl1.SubmitClick += new CustomizeControl.ButtonEvent(CustomizeControl1_SubmitClick);
                    CustomizeControl1.RemoveClick += new CustomizeControl.ButtonEvent(CustomizeControl1_RemoveClick);
                }
            }
            catch (Exception ex)
            {
                CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Error, ex.Message);
            }
            base.OnInit(e);
        }
Example #4
0
        protected void btnLimpiarCampos_Click(object sender, EventArgs e)
        {
            try
            {
                CKEPregunta143.Text  = "";
                cke_Pregunta144.Text = "";
                CKEPregunta1441.Text = "";
                CKEPregunta1442.Text = "";

                foreach (AccordionPane item in Accordion1.Panes)
                {
                    CKEditor.NET.CKEditorControl ctrl = (CKEditor.NET.CKEditorControl)item.ContentContainer.Controls[1];
                    ctrl.Text = "";
                }
            }
            catch (Exception ex)
            {
                Utilidades.PresentarMsj(Mensajes.GetMensaje(7), this, "Alert");
            }
        }
Example #5
0
        private void addCom_Click(object sender, EventArgs e)
        {
            string  id  = ((Button)(sender)).ID.Split('_')[1];
            TextBox tox = (TextBox)(mainDiv.FindControl("jmBox" + id));

            CKEditor.NET.CKEditorControl comCon = (CKEditor.NET.CKEditorControl)(mainDiv.FindControl("tControll" + id));
            DateTime nDate = DateTime.Now;

            List <MySqlParameter> parameters = new List <MySqlParameter>();

            parameters.Add(new MySqlParameter("@id_vypisu", id));
            parameters.Add(new MySqlParameter("@jmeno", tox.Text));
            parameters.Add(new MySqlParameter("@text", comCon.Text));
            //parameters.Add(new MySqlParameter("@datum", nDate.ToString("yyyy-MM-dd H:mm:ss")));

            if (SQLBase.Instance.Insert("insert into Komentar_brigada (`id_vypisu`, `jmeno`, `text`, `datum`)" +
                                        " values (@id_vypisu,@jmeno,@text,NOW())", parameters))
            {
                Response.Redirect("Manage.aspx");
            }
        }
Example #6
0
        private void GenerateContractVersions(string LanguageTitle, AmandamentTemplateEntity cte)
        {
            HtmlGenericControl parent = new HtmlGenericControl("div");

            parent.Attributes.Add("width", "100%");
            parent.Attributes.Add("clear", "both");

            HtmlGenericControl h2 = new HtmlGenericControl("h2");

            h2.Attributes.Add("id", LanguageTitle + "Title");

            HtmlGenericControl font = new HtmlGenericControl("font");

            font.Attributes.Add("color", "#707070");

            HtmlGenericControl strong = new HtmlGenericControl("strong");

            Label text = new Label();

            text.Text = LanguageTitle + " Version ";

            HyperLink link = new HyperLink();

            link.ID       = LanguageTitle + "ShowHyperLink";
            link.CssClass = "fltrht employeeLinkLast employeeLink employeeLinkWithoutEm";
            link.Text     = "Show";

            strong.Controls.Add(text);
            font.Controls.Add(strong);
            h2.Controls.Add(font);
            h2.Controls.Add(link);

            HtmlGenericControl container = new HtmlGenericControl("div");

            container.Attributes.Add("id", (LanguageTitle + "Div"));
            container.Attributes.Add("style", "display:none");

            CKEditor.NET.CKEditorControl ckEditor = new CKEditor.NET.CKEditorControl();
            ckEditor.ID                        = LanguageTitle;
            ckEditor.Height                    = 500;
            ckEditor.BasePath                  = "~/ckeditor";
            ckEditor.ReadOnly                  = true;
            ckEditor.FilebrowserBrowseUrl      = "/HRM/ckfinder/ckfinder.html";
            ckEditor.FilebrowserImageBrowseUrl = "/HRM/ckfinder/ckfinder.html?type=Images";
            ckEditor.FilebrowserImageUploadUrl = "/HRM/ckfinder/core/connector/aspx/connector.aBspx?command=QuickUpload&type=Images";
            ckEditor.config.toolbar            = new object[]
            {
                new object[] { "Print" }
            };
            ckEditor.Text = cte.Content;


            container.Controls.Add(ckEditor);

            parent.Controls.Add(h2);
            parent.Controls.Add(container);

            contractVersion.Controls.Add(parent);

            StringBuilder sb = new StringBuilder();

            sb.Append("<script language='javascript'>");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').click(function () {");
            sb.Append("\n");
            sb.Append("if($('#" + link.ClientID + "').text() == 'Hide') {");
            sb.Append("\n");
            sb.Append("$('#" + container.ClientID + "').fadeOut('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Show'); }");
            sb.Append("\n");
            sb.Append("else { $('#" + container.ClientID + "').fadeIn('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Hide');");
            sb.Append("\n");
            sb.Append("$('html,body').animate({ scrollTop: $('#" + container.ClientID + "').offset().top }, 'slow'); } });");
            sb.Append("\n");
            sb.Append("</script>");

            // if the script is not already registered
            if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), ("HeyPopup" + LanguageTitle)))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), ("HeyPopup" + LanguageTitle), sb.ToString());
            }
        }
Example #7
0
        private void GenerateContractVersions(string LanguageTitle, ContractTemplateEntity cte)
        {
            HtmlGenericControl parent = new HtmlGenericControl("div");
            parent.Attributes.Add("width", "100%");
            parent.Attributes.Add("clear", "both");

            HtmlGenericControl h2 = new HtmlGenericControl("h2");
            h2.Attributes.Add("id", LanguageTitle + "Title");

            HtmlGenericControl font = new HtmlGenericControl("font");
            font.Attributes.Add("color", "#707070");

            HtmlGenericControl strong = new HtmlGenericControl("strong");

            Label text = new Label();
            text.Text = LanguageTitle + " Version ";

            HyperLink link = new HyperLink();
            link.ID = LanguageTitle + "ShowHyperLink";
            link.CssClass = "fltrht employeeLinkLast employeeLink employeeLinkWithoutEm";
            link.Text = "Show";

            strong.Controls.Add(text);
            font.Controls.Add(strong);
            h2.Controls.Add(font);
            h2.Controls.Add(link);

            HtmlGenericControl container = new HtmlGenericControl("div");
            container.Attributes.Add("id", (LanguageTitle + "Div"));
            container.Attributes.Add("style", "display:none");

            CKEditor.NET.CKEditorControl ckEditor = new CKEditor.NET.CKEditorControl();
            ckEditor.ID = LanguageTitle;
            ckEditor.Height = 500;
            ckEditor.BasePath = "~/ckeditor";
            ckEditor.ReadOnly = true;
            ckEditor.FilebrowserBrowseUrl = "/HRM/ckfinder/ckfinder.html";
            ckEditor.FilebrowserImageBrowseUrl = "/HRM/ckfinder/ckfinder.html?type=Images";
            ckEditor.FilebrowserImageUploadUrl = "/HRM/ckfinder/core/connector/aspx/connector.aBspx?command=QuickUpload&type=Images";
            ckEditor.config.toolbar = new object[]
                {
                    new object[] { "Print"}
                };

            ckEditor.Text = cte.Content;

            #region replaceContractTemplate

            JobDetailsSessionView jbs = (JobDetailsSessionView)Session["JobDetails"];
            jbs.IsGenerated = true;

            EmployeeView employeeView = new EmployeeView();
            employeeView = new EmployeeMapper().Get(new EmployeeEntity() { Id = Convert.ToInt32(Request.QueryString["EmployeeId"]) });

            ckEditor.Text = ckEditor.Text.Replace(@"{#ContractNumber}", ContractNumberTextBox.Text);
            DateTime dt;
            if (DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#StartDate}", dt.ToString("dd.MM.yyyy"));
            }
            if (DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#EndDate}", dt.ToString("dd.MM.yyyy"));
            }
            else
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#EndDate}", "");
            }

            ckEditor.Text = new GUIHelper().ReplaceTemplateContractWithConcreteContract(ckEditor.Text, jbs, employeeView);

            #endregion

            container.Controls.Add(ckEditor);

            parent.Controls.Add(h2);
            parent.Controls.Add(container);

            contractVersion.Controls.Add(parent);

            StringBuilder sb = new StringBuilder();

            sb.Append("<script language='javascript'>");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').click(function () {");
            sb.Append("\n");
            sb.Append("if($('#" + link.ClientID + "').text() == 'Hide') {");
            sb.Append("\n");
            sb.Append("$('#" + container.ClientID + "').fadeOut('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Show'); }");
            sb.Append("\n");
            sb.Append("else { $('#" + container.ClientID + "').fadeIn('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Hide');");
            sb.Append("\n");
            sb.Append("$('html,body').animate({ scrollTop: $('#" + container.ClientID + "').offset().top }, 'slow'); } });");
            sb.Append("\n");
            sb.Append("</script>");

            // if the script is not already registered
            if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), ("HeyPopup" + LanguageTitle)))
                ClientScript.RegisterStartupScript(Page.GetType(), ("HeyPopup" + LanguageTitle), sb.ToString());
        }
        /// <summary>
        /// Must create and return the control 
        /// that will show the administration interface
        /// If none is available returns null
        /// </summary>
        public Control GetAdministrationInterface(Style controlStyle)
        {
            Table table = new Table();
            table.ControlStyle.CopyFrom(controlStyle); //CSS questionBuilder
            table.Width = Unit.Percentage(100);

            int maxEntries = 0;
            int entryCount = 0;
            string maxReachedMessage = ResourceManager.GetString("QuotaReachedMessage", this.LanguageCode);
 
            SurveyEntryQuotaData quotaSettings = new Surveys().GetQuotaSettings(this.SurveyId);
            if (quotaSettings.SurveyEntryQuotas.Rows.Count > 0)
            {
                maxEntries = quotaSettings.SurveyEntryQuotas[0].MaxEntries;
                entryCount = quotaSettings.SurveyEntryQuotas[0].EntryCount;
                maxReachedMessage = quotaSettings.SurveyEntryQuotas[0].MaxReachedMessage;
            }

            this._entryCount.Text = entryCount.ToString();


            table.Rows.Add(this.BuildRow(this._entryCount, ResourceManager.GetString("EntriesNumberLabel", this.LanguageCode), controlStyle));
            this._maxEntryTextBox = new TextBox();
            this._maxEntryTextBox.Text = maxEntries.ToString();
            this._maxEntryTextBox.Width = Unit.Pixel(40);

            table.Rows.Add(this.BuildRow(this._maxEntryTextBox, ResourceManager.GetString("MaxQuotaEntriesLabel", this.LanguageCode), controlStyle));

            table.Rows.Add(this.BuildRow(null, ResourceManager.GetString("QuotaReachedLabel", this.LanguageCode), controlStyle));

            //ckeditor row:
            this._maxReachedMessage = new CKEditor.NET.CKEditorControl();
            this._maxReachedMessage.BasePath = "~/Scripts/ckeditor";
            this._maxReachedMessage.config.enterMode = CKEditor.NET.EnterMode.BR;
            this._maxReachedMessage.Width = Unit.Percentage(100);
            this._maxReachedMessage.config.skin = "moonocolor";
            this._maxReachedMessage.Text = maxReachedMessage;

            table.Rows.Add(this.BuildRow(this._maxReachedMessage, null, controlStyle));
            
            PlaceHolder child = new PlaceHolder();

            Button button = new Button();
            button.Text = ResourceManager.GetString("ApplyChangesButton", this.LanguageCode);
            button.CssClass = "btn btn-primary btn-xs bw";
            button.Click += new EventHandler(this.OnUpdateClick);
            child.Controls.Add(button);

            Button button2 = new Button();
            button2.Text = ResourceManager.GetString("ResetQuotaEntriesButton", this.LanguageCode);
            button2.CssClass = "btn btn-primary btn-xs bw";
            button2.Click += new EventHandler(this.OnResetClick);
            child.Controls.Add(button2);

            table.Rows.Add(this.BuildRow(child, null, controlStyle));

            return table;
        }
Example #9
0
        private void GenerateContractVersions(string LanguageTitle, ContractTemplateEntity cte)
        {
            HtmlGenericControl parent = new HtmlGenericControl("div");

            parent.Attributes.Add("width", "100%");
            parent.Attributes.Add("clear", "both");

            HtmlGenericControl h2 = new HtmlGenericControl("h2");

            h2.Attributes.Add("id", LanguageTitle + "Title");

            HtmlGenericControl font = new HtmlGenericControl("font");

            font.Attributes.Add("color", "#707070");

            HtmlGenericControl strong = new HtmlGenericControl("strong");

            Label text = new Label();

            text.Text = LanguageTitle + " Version ";

            HyperLink link = new HyperLink();

            link.ID       = LanguageTitle + "ShowHyperLink";
            link.CssClass = "fltrht employeeLinkLast employeeLink employeeLinkWithoutEm";
            link.Text     = "Show";

            strong.Controls.Add(text);
            font.Controls.Add(strong);
            h2.Controls.Add(font);
            h2.Controls.Add(link);

            HtmlGenericControl container = new HtmlGenericControl("div");

            container.Attributes.Add("id", (LanguageTitle + "Div"));
            container.Attributes.Add("style", "display:none");

            CKEditor.NET.CKEditorControl ckEditor = new CKEditor.NET.CKEditorControl();
            ckEditor.ID                        = LanguageTitle;
            ckEditor.Height                    = 500;
            ckEditor.BasePath                  = "~/ckeditor";
            ckEditor.ReadOnly                  = true;
            ckEditor.FilebrowserBrowseUrl      = "/HRM/ckfinder/ckfinder.html";
            ckEditor.FilebrowserImageBrowseUrl = "/HRM/ckfinder/ckfinder.html?type=Images";
            ckEditor.FilebrowserImageUploadUrl = "/HRM/ckfinder/core/connector/aspx/connector.aBspx?command=QuickUpload&type=Images";
            ckEditor.config.toolbar            = new object[]
            {
                new object[] { "Print" }
            };

            ckEditor.Text = cte.Content;

            #region replaceContractTemplate

            JobDetailsSessionView jbs = (JobDetailsSessionView)Session["JobDetails"];
            jbs.IsGenerated = true;

            EmployeeView employeeView = new EmployeeView();
            employeeView = new EmployeeMapper().Get(new EmployeeEntity()
            {
                Id = Convert.ToInt32(Request.QueryString["EmployeeId"])
            });

            ckEditor.Text = ckEditor.Text.Replace(@"{#ContractNumber}", ContractNumberTextBox.Text);
            DateTime dt;
            if (DateTime.TryParseExact(StartDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#StartDate}", dt.ToString("dd.MM.yyyy"));
            }
            if (DateTime.TryParseExact(EndDateTextBox.Text, "dd.MM.yyyy", null, System.Globalization.DateTimeStyles.None, out dt))
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#EndDate}", dt.ToString("dd.MM.yyyy"));
            }
            else
            {
                ckEditor.Text = ckEditor.Text.Replace(@"{#EndDate}", "");
            }

            ckEditor.Text = new GUIHelper().ReplaceTemplateContractWithConcreteContract(ckEditor.Text, jbs, employeeView);

            #endregion

            container.Controls.Add(ckEditor);

            parent.Controls.Add(h2);
            parent.Controls.Add(container);

            contractVersion.Controls.Add(parent);

            StringBuilder sb = new StringBuilder();

            sb.Append("<script language='javascript'>");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').click(function () {");
            sb.Append("\n");
            sb.Append("if($('#" + link.ClientID + "').text() == 'Hide') {");
            sb.Append("\n");
            sb.Append("$('#" + container.ClientID + "').fadeOut('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Show'); }");
            sb.Append("\n");
            sb.Append("else { $('#" + container.ClientID + "').fadeIn('slow');");
            sb.Append("\n");
            sb.Append("$('#" + link.ClientID + "').text('Hide');");
            sb.Append("\n");
            sb.Append("$('html,body').animate({ scrollTop: $('#" + container.ClientID + "').offset().top }, 'slow'); } });");
            sb.Append("\n");
            sb.Append("</script>");

            // if the script is not already registered
            if (!Page.ClientScript.IsClientScriptBlockRegistered(Page.GetType(), ("HeyPopup" + LanguageTitle)))
            {
                ClientScript.RegisterStartupScript(Page.GetType(), ("HeyPopup" + LanguageTitle), sb.ToString());
            }
        }
Example #10
0
        /// <summary>
        /// Must create and return the control
        /// that will show the administration interface
        /// If none is available returns null
        /// </summary>
        public Control GetAdministrationInterface(Style controlStyle)
        {
            Table table = new Table();

            table.ControlStyle.CopyFrom(controlStyle); //CSS questionBuilder
            table.Width = Unit.Percentage(100);

            int    maxEntries        = 0;
            int    entryCount        = 0;
            string maxReachedMessage = ResourceManager.GetString("QuotaReachedMessage", this.LanguageCode);

            SurveyEntryQuotaData quotaSettings = new Surveys().GetQuotaSettings(this.SurveyId);

            if (quotaSettings.SurveyEntryQuotas.Rows.Count > 0)
            {
                maxEntries        = quotaSettings.SurveyEntryQuotas[0].MaxEntries;
                entryCount        = quotaSettings.SurveyEntryQuotas[0].EntryCount;
                maxReachedMessage = quotaSettings.SurveyEntryQuotas[0].MaxReachedMessage;
            }

            this._entryCount.Text = entryCount.ToString();


            table.Rows.Add(this.BuildRow(this._entryCount, ResourceManager.GetString("EntriesNumberLabel", this.LanguageCode), controlStyle));
            this._maxEntryTextBox       = new TextBox();
            this._maxEntryTextBox.Text  = maxEntries.ToString();
            this._maxEntryTextBox.Width = Unit.Pixel(40);

            table.Rows.Add(this.BuildRow(this._maxEntryTextBox, ResourceManager.GetString("MaxQuotaEntriesLabel", this.LanguageCode), controlStyle));

            table.Rows.Add(this.BuildRow(null, ResourceManager.GetString("QuotaReachedLabel", this.LanguageCode), controlStyle));

            //ckeditor row:
            this._maxReachedMessage                  = new CKEditor.NET.CKEditorControl();
            this._maxReachedMessage.BasePath         = "~/Scripts/ckeditor";
            this._maxReachedMessage.config.enterMode = CKEditor.NET.EnterMode.BR;
            this._maxReachedMessage.Width            = Unit.Percentage(100);
            this._maxReachedMessage.config.skin      = "moonocolor";
            this._maxReachedMessage.Text             = maxReachedMessage;

            table.Rows.Add(this.BuildRow(this._maxReachedMessage, null, controlStyle));

            PlaceHolder child = new PlaceHolder();

            Button button = new Button();

            button.Text     = ResourceManager.GetString("ApplyChangesButton", this.LanguageCode);
            button.CssClass = "btn btn-primary btn-xs bw";
            button.Click   += new EventHandler(this.OnUpdateClick);
            child.Controls.Add(button);

            Button button2 = new Button();

            button2.Text     = ResourceManager.GetString("ResetQuotaEntriesButton", this.LanguageCode);
            button2.CssClass = "btn btn-primary btn-xs bw";
            button2.Click   += new EventHandler(this.OnResetClick);
            child.Controls.Add(button2);

            table.Rows.Add(this.BuildRow(child, null, controlStyle));

            return(table);
        }
Example #11
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                List <ProyectoDetalleProceso> lst = new List <ProyectoDetalleProceso>();
                bool esNuevo = IdPrimario != 0 ? false : true;

                Formulario = new ProyectoProduccion()
                {
                    RealizaImportacion  = ddlPregunta144.SelectedValue == "1" ? true : false,
                    ActivosProveedores  = CKEPregunta1441.Text.Trim(),
                    CondicionesTecnicas = CKEPregunta143.Text.Trim(),
                    Justificacion       = cke_Pregunta144.Text.Trim(),
                    IdProyecto          = Encabezado.CodigoProyecto,
                    IncrementoValor     = CKEPregunta1442.Text.Trim()
                };

                //Se crean los detalles de los procesos en los productos

                foreach (AccordionPane item in Accordion1.Panes)
                {
                    CKEditor.NET.CKEditorControl ctrl = (CKEditor.NET.CKEditorControl)item.ContentContainer.Controls[1];

                    var reg = new ProyectoDetalleProceso()
                    {
                        DescripcionProceso = ctrl.Text.Trim(),
                        IdProducto         = int.Parse(ctrl.Attributes["IdProducto"])
                    };

                    if (!ctrl.Attributes["IdProceso"].Equals(""))
                    {
                        reg.IdDetalleProceso = int.Parse(ctrl.Attributes["IdProceso"]);
                    }

                    lst.Add(reg);
                }

                //Si es nuevo se crea el nuevo registro. Si no se actualiza
                if (!esNuevo)
                {
                    Formulario.IdProduccion = IdPrimario;
                }

                //De acuerdo al resultado se presenta el mensaje de la inserción y/o actualización
                if (ProduccionNegocio.setDatosFormulario(Formulario, esNuevo))
                {
                    if (ProduccionNegocio.setDetalleProceso(lst))
                    {
                        //Si es nuevo registro se consulta el id creado
                        if (esNuevo)
                        {
                            IdPrimario = ProduccionNegocio.getFormulario(Encabezado.CodigoProyecto).IdProduccion;
                        }

                        Utilidades.PresentarMsj(Mensajes.GetMensaje(8), this, "Alert");

                        //Se actualiza la última fecha de actualización y genera el registro del tab
                        Negocio.PlanDeNegocioV2.Utilidad.ProyectoGeneral.UpdateTab(CodigoTab, Encabezado.CodigoProyecto, usuario.IdContacto, usuario.CodGrupo, false);

                        //Actualiza la columna de completitud del tab
                        Negocio.PlanDeNegocioV2.Utilidad.TabFormulacion.UpdateTabCompleto(CodigoTab, Encabezado.CodigoProyecto, usuario.IdContacto, true);

                        //Actualiza la fecha de ultima actualización
                        Encabezado.ActualizarFecha();
                    }
                }
                else
                {
                    Utilidades.PresentarMsj(Mensajes.GetMensaje(7), this, "Alert");
                }
            }
            catch (Exception ex)
            {
                Utilidades.PresentarMsj(Mensajes.GetMensaje(7), this, "Alert");
            }
        }
Example #12
0
        protected void Page_Load()
        {
            toolbar = new object[]
            {
                new object[] { "Bold", "Italic", "Underline", "Strike", "Smiley" }
            };


            if (Session["UserAuthentication"] == null)
            {
                Response.Redirect("Login.aspx");
            }
            if (!SQLBase.Instance.isAdminLoggedIn())
            {
                addNews.Visible = false;
            }


            List <MySqlParameter> parameters = new List <MySqlParameter>();

            List <string>[] queryResult = SQLBase.Instance.Select(
                "SELECT id_vypisu,text_vypisu,datum FROM Vypis_brigad ORDER BY datum ASC", 3, parameters);
            if (!SQLBase.Instance.sqlStatementCompleted)
            {
                //      System.Diagnostics.Debug.WriteLine("SQL select failed.");
                return;
            }

            //   System.Diagnostics.Debug.WriteLine("SQL select results: " );
            // Prochazeni vysledku selectu
            int n1 = SQLBase.Instance.numberOfSelectedRows;

            for (int i = 0; i < n1; i++)
            {
                DateTime date;
                int      id_vyp = Int32.Parse(queryResult[0][i]);
                string   html   = queryResult[1][i];
                DateTime.TryParse(queryResult[2][i], out date);


                System.Web.UI.HtmlControls.HtmlGenericControl NewDiv =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                NewDiv.ID = "bigDiv" + i;
                System.Web.UI.HtmlControls.HtmlGenericControl NewDiv2 =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                NewDiv2.ID = "vypDiv" + i;
                System.Web.UI.HtmlControls.HtmlGenericControl NewDiv3 =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");

                System.Web.UI.HtmlControls.HtmlGenericControl TopDiv =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                TopDiv.ID = "topDiv" + i;

                TopDiv.Style.Add(HtmlTextWriterStyle.BorderWidth, "1px");
                TopDiv.Style.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                TopDiv.Style.Add(HtmlTextWriterStyle.BorderColor, "#545454");
                TopDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#e27414");
                TopDiv.Style.Add(HtmlTextWriterStyle.Color, "white");
                TopDiv.Style.Add(HtmlTextWriterStyle.Width, "100%");
                TopDiv.Style.Add(HtmlTextWriterStyle.PaddingTop, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.PaddingBottom, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.PaddingLeft, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.PaddingRight, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.MarginBottom, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.MarginTop, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.MarginRight, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.MarginLeft, "0px");
                TopDiv.Style.Add(HtmlTextWriterStyle.Display, "inline-block");

                Label tLabel = new Label();
                tLabel.Text = "<hgroup>  Popis brigády <hgroup/>";
                tLabel.Style.Add(HtmlTextWriterStyle.Color, "white");
                TopDiv.Controls.Add(tLabel);


                Label nLabel = new Label();
                NewDiv.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#efefef");
                NewDiv.Style.Add(HtmlTextWriterStyle.Width, "99%");
                NewDiv.Style.Add(HtmlTextWriterStyle.BorderWidth, "1px");
                NewDiv.Style.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                NewDiv.Style.Add(HtmlTextWriterStyle.BorderColor, "#545454");
                NewDiv.Style.Add(HtmlTextWriterStyle.PaddingLeft, "0px");
                NewDiv.Style.Add(HtmlTextWriterStyle.PaddingRight, "0px");
                NewDiv.Style.Add(HtmlTextWriterStyle.MarginBottom, "60px");
                NewDiv.Style.Add(HtmlTextWriterStyle.TextAlign, "center");

                NewDiv2.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#FFFFFF");
                NewDiv2.Style.Add(HtmlTextWriterStyle.Width, "99%");
                NewDiv2.Style.Add(HtmlTextWriterStyle.PaddingTop, "0px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.PaddingBottom, "0px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.PaddingLeft, "1px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.PaddingRight, "1px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.BorderWidth, "1px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.BorderStyle, "solid");
                NewDiv2.Style.Add(HtmlTextWriterStyle.BorderColor, "#545454");
                NewDiv2.Style.Add(HtmlTextWriterStyle.MarginRight, "0px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.MarginLeft, "0px");
                NewDiv2.Style.Add(HtmlTextWriterStyle.Display, "inline-block");

                NewDiv3.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#ededed");
                NewDiv3.Style.Add(HtmlTextWriterStyle.Width, "99%");
                NewDiv3.Style.Add(HtmlTextWriterStyle.PaddingTop, "4px");
                NewDiv3.Style.Add(HtmlTextWriterStyle.PaddingBottom, "4px");
                NewDiv3.Style.Add(HtmlTextWriterStyle.PaddingLeft, "8px");
                NewDiv3.Style.Add(HtmlTextWriterStyle.PaddingRight, "8px");
                NewDiv3.Style.Add(HtmlTextWriterStyle.MarginRight, "0px");
                NewDiv3.Style.Add(HtmlTextWriterStyle.MarginLeft, "0px");
                NewDiv3.Style.Add(HtmlTextWriterStyle.Display, "inline-block");

                System.Web.UI.HtmlControls.HtmlGenericControl NewDivDat =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                NewDivDat.ID = "divdatum" + i;
                NewDivDat.Style.Add(HtmlTextWriterStyle.TextAlign, "right");
                NewDivDat.Style.Add(HtmlTextWriterStyle.BorderColor, "#545454");
                NewDivDat.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#FFFFFF");
                NewDivDat.Style.Add(HtmlTextWriterStyle.Width, "99%");
                NewDivDat.Style.Add(HtmlTextWriterStyle.PaddingTop, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.PaddingBottom, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.PaddingLeft, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.PaddingRight, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.MarginBottom, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.MarginTop, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.MarginRight, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.MarginLeft, "0px");
                NewDivDat.Style.Add(HtmlTextWriterStyle.Display, "inline-block");


                nLabel.Text = html + "<br/>";

                Label datLabel = new Label();
                datLabel.Text = "    Napsal admin dne: " + date.ToString("dd/MM/yyyy") + "   ";

                Button delete = new Button();
                delete.ID            = "del_" + id_vyp;
                delete.Text          = "Smazat";
                delete.OnClientClick = "return confirm('Chcete smazat výpis id:" + id_vyp + " ?')";
                delete.Click        += del_Click;
                if (!SQLBase.Instance.isAdminLoggedIn())
                {
                    delete.Visible = false;
                }

                NewDivDat.Controls.Add(delete);
                NewDivDat.Controls.Add(datLabel);

                NewDiv2.Controls.Add(TopDiv);
                NewDiv2.Controls.Add(nLabel);
                NewDiv2.Controls.Add(NewDivDat);


                NewDiv.Controls.Add(NewDiv2);


                Label brLabel = new Label();
                brLabel.Text = "<br><hgroup><h3>  Komentáře:</h3></hgroup><br>";



                mainDiv.Controls.Add(NewDiv);

                List <MySqlParameter> parameters2 = new List <MySqlParameter>();
                parameters2.Add(new MySqlParameter("@id_vypisu", id_vyp));
                List <string>[] queryResult2 = SQLBase.Instance.Select(
                    "SELECT id_komentare,jmeno,text,datum FROM Komentar_brigada WHERE id_vypisu = @id_vypisu ORDER BY datum DESC", 4, parameters2, 3);
                if (!SQLBase.Instance.sqlStatementCompleted || !SQLBase.Instance.foundSomeResult)
                {
                    //      System.Diagnostics.Debug.WriteLine("SQL select failed.");
                    brLabel.Text = brLabel.Text + "<div style=\"width:100%; background-color:f4e7cd; text-align:center;\"><h2>Ještě tu nikdo nenapsal komentář</h2></div>";
                }

                int n2 = SQLBase.Instance.numberOfSelectedRows;
                for (int j = 0; j < n2; j++)
                {
                    DateTime date2  = SQLBase.Instance.parsDate;
                    int      id_kom = Int32.Parse(queryResult2[0][j]);
                    string   jmeno  = queryResult2[1][j];
                    string   kom    = queryResult2[2][j];


                    string sAd = "";
                    if (j > 0)
                    {
                        sAd = "<hr><br/>";
                    }
                    brLabel.Text = brLabel.Text + sAd + "<div style=\"width:100%;background-color:white; text-align:left;\"><table style=\"width:100%;background-color:f4e7cd; text-align:left;\"><tr><td style=\"vertical-align: middle; width:15%;\">  <b>" + jmeno + "</b> napsal : <td style=\"width:60%;\">" + kom + "</td><td style=\"width:35%;\"> Dne " + date.ToString("dd.MM.yyyy") + "</td></tr></table> </div><br/>";
                }

                System.Web.UI.HtmlControls.HtmlGenericControl NewDivCom =
                    new System.Web.UI.HtmlControls.HtmlGenericControl("DIV");
                NewDivCom.ID = "divdcom" + i;
                NewDivCom.Style.Add(HtmlTextWriterStyle.Width, "96%");
                NewDivCom.Style.Add(HtmlTextWriterStyle.PaddingTop, "0px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.PaddingBottom, "0px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.PaddingLeft, "16px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.PaddingRight, "16px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.MarginBottom, "0px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.MarginTop, "0px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.MarginRight, "0px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.MarginLeft, "0px");
                NewDivCom.Style.Add(HtmlTextWriterStyle.BackgroundColor, "#efefef");
                NewDivCom.Style.Add(HtmlTextWriterStyle.TextAlign, "left");
                NewDivCom.Style.Add(HtmlTextWriterStyle.Display, "inline-block");
                NewDivCom.Style.Add(HtmlTextWriterStyle.Position, "relative");
                NewDivCom.Controls.Add(brLabel);
                NewDivCom.Controls.Add(NewDiv3);

                Label comLab = new Label();
                comLab.Text = "<hr><h3>  Vložit komentář: </h3><table style=\"margin-left:20px; vertical-align:top; min-width:500px; width:500px;\"><tr><td style=\"text-align:left; width:20%;\">Jméno : </td><td style=\"text-align:left;\">";

                TextBox jmBox = new TextBox();
                jmBox.ID = "jmBox" + id_vyp;

                CKEditor.NET.CKEditorControl tControl = new CKEditor.NET.CKEditorControl();
                tControl.ResizeEnabled      = false;
                tControl.Height             = 120;
                tControl.Width              = 600;
                tControl.ToolbarCanCollapse = false;

                tControl.ID             = "tControll" + id_vyp;
                tControl.config.toolbar = toolbar;


                Label comLab2 = new Label();
                comLab2.Text = "</td></tr><tr><td style=\"text-align:left; width:20%; \">Komentář : </td><td style=\"text-align:left;\">";

                Label comLab3 = new Label();
                comLab3.Text = "</td></tr><tr><td style=\"text-align:left; width:20%; \"></td><td style=\"text-align:right;\">";

                Button addCom = new Button();
                addCom.ID            = "addCom_" + id_vyp;
                addCom.Text          = "Přidat komentář";
                addCom.OnClientClick = "return confirm('Chcete vložit komentář?)";
                addCom.Click        += addCom_Click;



                Label comLab4 = new Label();
                comLab4.Text = "</td></tr></table><br/><br/>";

                NewDivCom.Controls.Add(comLab);
                NewDivCom.Controls.Add(jmBox);
                NewDivCom.Controls.Add(comLab2);
                NewDivCom.Controls.Add(tControl);
                NewDivCom.Controls.Add(comLab3);
                NewDivCom.Controls.Add(addCom);
                NewDivCom.Controls.Add(comLab4);

                NewDiv.Controls.Add(NewDivCom);
            }
        }
Example #13
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                CustomizeControl1.FormTitle = string.Format(Settings.FormTitleFormat, "Haber", "Ekleme/Düzeltme Formu");
                if (Request.QueryString["hid"] != null)
                {
                    ViewState["tempID"] = Request.QueryString["hid"];
                }
                using (Haber m = HaberMethods.GetHaber(BAYMYO.UI.Converts.NullToInt64(ViewState["tempID"])))
                {
                    bool notNull = (m.ID > 0), isAdmin = Core.IsUserAdmin;
                    if (notNull)
                    {
                        Default(m, isAdmin);
                    }

                    TextBox txt = new TextBox();
                    txt.ID        = "Baslik";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Baslik;
                    txt.MaxLength = 75;
                    CustomizeControl1.AddControl("Başlık", txt);

                    txt           = new TextBox();
                    txt.ID        = "Ozet";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Ozet;
                    txt.TextMode  = TextBoxMode.MultiLine;
                    txt.MaxLength = 250;
                    CustomizeControl1.AddControl("Özet", txt, "Liste ve RSS'ler için gösterilecek içeriktir.");

                    CKEditor.NET.CKEditorControl fck = new CKEditor.NET.CKEditorControl();
                    fck.ID     = "Icerik";
                    fck.Height = 400;
                    fck.Text   = m.Icerik;
                    CustomizeControl1.AddControl("Editör", fck);

                    txt           = new TextBox();
                    txt.ID        = "Etiket";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Etiket;
                    txt.MaxLength = 100;
                    CustomizeControl1.AddControl("Etiket", txt, string.Format("Lütfen virgül({0}) ile ayrıarak ve boşluk bırakmadan yazınız! Örnek: elma{0}meyve{0}sebze{0}bahçe", Settings.SplitFormat));

                    DropDownList ddl = null;
                    //    = new DropDownList();
                    //ddl.ID = "Galeri";
                    //ddl.Width = 746;
                    //ddl.CssClass = "form-control";
                    //ddl.DataMember = "album";
                    //ddl.DataValueField = "id";
                    //ddl.DataTextField = "adi";
                    //AlbumCollection albumler = AlbumMethods.GetSelect(20);
                    //albumler.Insert(0, new Album { ID = 0, Adi = "<Seçiniz>" });
                    //ddl.DataSource = albumler;
                    //ddl.DataBind();
                    //ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(m.Galeri);
                    //CustomizeControl1.AddControl("İlgili Galeri", ddl, m.Galeri > 0 ? string.Format("İlgili <b>Galeri</b>'ye resim yüklemek yada düzeltmek için <a href=\"{0}\" target=\"_blank\">buraya tıklayın.</a>", Settings.PanelPath + "?go=galeri&raid=" + m.Galeri) : "");

                    Image img = new Image();
                    img.ID      = "BuyukResim";
                    img.Width   = 250;
                    img.ToolTip = m.ResimUrl;
                    if (!string.IsNullOrEmpty(m.ResimUrl))
                    {
                        img.ImageUrl = Settings.ImagesPath + "haber/b/" + m.ResimUrl;
                    }
                    else
                    {
                        img.ImageUrl = Settings.ImagesPath + "admin-yok.png";
                    }
                    CustomizeControl1.AddControl("Büyük Resim", img);

                    FileUpload flu = new FileUpload();
                    flu.ID      = "ResimUrl";
                    flu.ToolTip = m.ResimUrl;
                    CustomizeControl1.AddControl("Resim Ekle", flu, "Tavsiye edilen, Genişlik(W):728px - Yükseklik(H):300px");

                    img       = new Image();
                    img.ID    = "KucukResim";
                    img.Width = 150;
                    if (!string.IsNullOrEmpty(m.ResimUrl))
                    {
                        img.ImageUrl = Settings.ImagesPath + "haber/" + m.ResimUrl;
                    }
                    else
                    {
                        img.ImageUrl = Settings.ImagesPath + "admin-yok.png";
                    }
                    CustomizeControl1.AddControl("Küçük Resim", img);

                    flu    = new FileUpload();
                    flu.ID = "KucukResimUrl";
                    CustomizeControl1.AddControl("Küçük Resim Ekle", flu, "<b>Bu alanda resim seçmezseniz büyük resim küçültülecektir.</b> Genişlik(W):350px/Yükseklik(H):140px");

                    ddl                = new DropDownList();
                    ddl.ID             = "Kategori";
                    ddl.Width          = 300;
                    ddl.CssClass       = "form-control";
                    ddl.DataMember     = "kategori";
                    ddl.DataValueField = "id";
                    ddl.DataTextField  = "adi";
                    List <Kategori> kategoriler = KategoriMethods.GetMenu("haber", true);
                    ListItem        item        = null;
                    foreach (Kategori kategori in kategoriler)
                    {
                        switch (kategori.ParentID)
                        {
                        case "":
                            item = new ListItem(kategori.Adi, kategori.ID);
                            item.Attributes.CssStyle.Value = "padding-left: 5px; background: #f5f5f5; color: #454545;";
                            break;

                        case "0":
                            item = new ListItem(kategori.Adi, kategori.ID);
                            item.Attributes.CssStyle.Value = "padding-left: 25px; background: #f5f5f5; color: #fe760c; font-weight: bold;";
                            break;

                        default:
                            item = new ListItem(kategori.Adi, kategori.ID);
                            item.Attributes.CssStyle.Value = string.Format("padding-left: {0}px; background: #f5f5f5; color: #454545;", (BAYMYO.UI.Converts.NullToInt(kategori.ParentID.Split(',').Length + 1) * 25));
                            break;
                        }
                        ddl.Items.Add(item);
                    }
                    kategoriler.Clear();
                    ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(m.KategoriID);
                    CustomizeControl1.AddControl("Kategori", ddl, "<a href=\"" + Settings.PanelPath + "?go=kategori&mdl=haber\">[+] Yeni Kategori</a>");

                    //ddl = new DropDownList();
                    //ddl.ID = "Sehir";
                    //ddl.Width = 300;
                    //ddl.CssClass = "form-control";
                    //ddl.DataMember = "Sehir";
                    //ddl.DataValueField = "Adi";
                    //ddl.DataTextField = "Adi";
                    //SehirCollection sehirler = SehirMethods.GetSelect();
                    //sehirler.Insert(0, new Sehir(0, ""));
                    //ddl.DataSource = sehirler;
                    //ddl.DataBind();
                    //ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(m.Sehir);
                    //CustomizeControl1.AddControl("Şehir (İL)", ddl);

                    //ddl = new DropDownList();
                    //ddl.ID = "Anasayfa";
                    //ddl.Width = 300;
                    //ddl.CssClass = "form-control";
                    //ddl.DataMember = "MainViewStates";
                    //ddl.DataValueField = "Key";
                    //ddl.DataTextField = "Value";
                    //ddl.DataSource = Core.GetMainViewStates();
                    //ddl.DataBind();
                    //ddl.SelectedValue = notNull ? m.Anasayfa.ToString() : "1";
                    //CustomizeControl1.AddControl("Anasayfa", ddl);

                    //DateTimeControl cnt = this.Page.LoadControl(Settings.DateTimeControlPath) as DateTimeControl;
                    //cnt.ID = "Tarih";
                    //cnt.FormatType = FormatTypes.DateTime;
                    //CustomizeControl1.AddControl("Yayın Tarihi", cnt, "* Seçilmesi zorunlu alan. Belirtilen tarihte haber yayımlanacaktır.");
                    //cnt.Date = (m.ID > 1) ? m.KayitTarihi : DateTime.Now;

                    CheckBoxList chkList = new CheckBoxList();
                    chkList.ID = "chkList";
                    chkList.RepeatDirection = RepeatDirection.Horizontal;
                    chkList.Items.Add("Gösterim Sayı");
                    chkList.Items[0].Selected = notNull ? m.GosterimSayi : true;
                    chkList.Items.Add("Üyelere Özel");
                    chkList.Items[1].Selected = m.Uye;
                    chkList.Items.Add("Yorumları Göster");
                    chkList.Items[2].Selected = notNull ? m.Yorum : false;
                    chkList.Items.Add("Yönetici Onayı");
                    chkList.Items[3].Selected = notNull ? m.YoneticiOnay : isAdmin;
                    chkList.Items[3].Enabled  = isAdmin;
                    chkList.Items.Add("Yayımla");
                    chkList.Items[4].Selected = notNull ? m.Aktif : isAdmin;
                    chkList.Items[4].Enabled  = isAdmin;

                    CustomizeControl1.AddControl("Seçimler", chkList);

                    //CustomizeControl1.AddTitle("HABER İÇERİSİNE VİDEO EKLE");

                    //ddl = new DropDownList();
                    //ddl.ID = "Video";
                    //ddl.Width = 746;
                    //ddl.CssClass = "form-control";
                    //ddl.DataMember = "video";
                    //ddl.DataValueField = "id";
                    //ddl.DataTextField = "baslik";
                    //VideoCollection videolar = VideoMethods.GetSelect(m.Video, 20);
                    //Video v = VideoMethods.GetVideo(m.Video);
                    //if (v.ID > 0)
                    //    videolar.Add(v);
                    //videolar.Insert(0, new Video { ID = 0, Baslik = "<Seçiniz>" });
                    //ddl.DataSource = videolar;
                    //ddl.DataBind();
                    //ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(m.Video);
                    //CustomizeControl1.AddControl("İlgili Video", ddl, m.Video > 0 ? string.Format("İlgili <b>Video</b>'yu güncellemek için <a href=\"{0}\" target=\"_blank\">buraya tıklayın.</a>", Settings.PanelPath + "?go=video&vid=" + m.Video) : "Eğer listeden video seçilirse aşağıdaki embed kod ve kategori dikkate alınmayacaktır.");

                    //txt = new TextBox();
                    //txt.ID = "HaberEmbed";
                    //txt.Text = v.Embed;
                    //txt.CssClass = "form-control";
                    //txt.TextMode = TextBoxMode.MultiLine;
                    //txt.MaxLength = 750;
                    //txt.ClientIDMode = ClientIDMode.Static;
                    //CustomizeControl1.AddControl("Video Embed", txt, "Her hangi bir video sitesinden 'embed' kodu almanız gereklidir.");

                    //ddl = new DropDownList();
                    //ddl.ID = "KategoriVideo";
                    //ddl.Width = 250;
                    //ddl.CssClass = "form-control";
                    //ddl.DataMember = "kategori";
                    //ddl.DataValueField = "id";
                    //ddl.DataTextField = "adi";
                    //ddl.DataSource = KategoriMethods.GetMenu("video", true);
                    //ddl.DataBind();
                    //ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(v.KategoriID);
                    //CustomizeControl1.AddControl("Video Kategorileri", ddl, "Sadece <b>Embed</b> kod girildiğinde kategori seçilmezse video yüklenmez.");

                    CustomizeControl1.SubmitClick += new CustomizeControl.ButtonEvent(CustomizeControl1_SubmitClick);
                    CustomizeControl1.RemoveClick += new CustomizeControl.ButtonEvent(CustomizeControl1_RemoveClick);
                }
            }
            catch (Exception ex)
            {
                CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Error, ex.Message);
            }
            base.OnInit(e);
        }
Example #14
0
        protected override void OnInit(EventArgs e)
        {
            try
            {
                CustomizeControl1.FormTitle = string.Format(Settings.FormTitleFormat, "Makale", "Ekleme/Düzeltme Formu");
                if (Request.QueryString["mklid"] != null)
                {
                    ViewState["tempID"] = Request.QueryString["mklid"];
                }
                using (Makale m = MakaleMethods.GetMakale(BAYMYO.UI.Converts.NullToInt64(ViewState["tempID"])))
                {
                    bool notNull = (m.ID > 0), isAdmin = Core.IsUserAdmin;
                    if (notNull)
                    {
                        Default(m, isAdmin);
                    }

                    TextBox txt = new TextBox();
                    txt.ID        = "Baslik";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Baslik;
                    txt.MaxLength = 75;
                    CustomizeControl1.AddControl("Başlık", txt);

                    txt           = new TextBox();
                    txt.ID        = "Ozet";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Ozet;
                    txt.TextMode  = TextBoxMode.MultiLine;
                    txt.MaxLength = 150;
                    CustomizeControl1.AddControl("Özet", txt, "Liste ve RSS'ler için gösterilecek içeriktir.");

                    CKEditor.NET.CKEditorControl fck = new CKEditor.NET.CKEditorControl();
                    fck.ID     = "Icerik";
                    fck.Height = 400;
                    fck.Text   = m.Icerik;
                    CustomizeControl1.AddControl("Editör", fck);

                    txt           = new TextBox();
                    txt.ID        = "Etiket";
                    txt.CssClass  = "form-control";
                    txt.Text      = m.Etiket;
                    txt.MaxLength = 100;
                    CustomizeControl1.AddControl("Etiket", txt, string.Format("Lütfen virgül({0}) ile ayrıarak ve boşluk bırakmadan yazınız! Örnek: elma{0}meyve{0}sebze{0}bahçe", Settings.SplitFormat));

                    //DateTimeControl cnt = this.Page.LoadControl(Settings.DateTimeControlPath) as DateTimeControl;
                    //cnt.ID = "Tarih";
                    //cnt.FormatType = FormatTypes.DateTime;
                    //CustomizeControl1.AddControl("Tarih", cnt, "* Seçilmesi zorunlu alan.");
                    //cnt.Date = m.KayitTarihi;

                    DropDownList ddl = new DropDownList();
                    ddl.ID             = "Yazar";
                    ddl.Width          = 250;
                    ddl.CssClass       = "form-control";
                    ddl.DataMember     = "hesap";
                    ddl.DataValueField = "id";
                    ddl.DataTextField  = "adi";
                    using (BAYMYO.UI.Web.CustomSqlQuery data = new BAYMYO.UI.Web.CustomSqlQuery(ddl, "select id, concat_ws(' ',adi,soyadi) as adi from hesap where tipi in(1,2,5)"))
                    {
                        data.Execute();
                    }
                    ddl.Items.Insert(0, new ListItem("<Seçiniz>", ""));
                    ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(m.HesapID);
                    CustomizeControl1.AddControl("Yazarlar", ddl, "<a href=\"" + Settings.PanelPath + "?go=hesap&type=2\">[+] Yeni Yazar</a> (Not: Buraya sadece <b>Admin</b>, <b>Moderatör</b> ve <b>Private</b> olan yazarlar getirilir.)");

                    ddl                = new DropDownList();
                    ddl.ID             = "Kategori";
                    ddl.Width          = 250;
                    ddl.CssClass       = "form-control";
                    ddl.DataMember     = "kategori";
                    ddl.DataValueField = "id";
                    ddl.DataTextField  = "adi";
                    List <Kategori> kategoriler = KategoriMethods.GetMenu("makale", true);
                    ListItem        item        = null;
                    foreach (Kategori kategori in kategoriler)
                    {
                        switch (kategori.ParentID)
                        {
                        case "":
                            item = new ListItem(kategori.Adi, kategori.ID);
                            item.Attributes.CssStyle.Value = "padding-left: 5px;background: #f5f5f5; color: #454545;";
                            break;

                        case "0":
                            item = new ListItem(kategori.Adi, kategori.ID);
                            item.Attributes.CssStyle.Value = "padding-left: 25px;background: #f5f5f5; color: #fe760c; font-weight: bold;";
                            break;

                        default:
                            item = new ListItem(kategori.Adi, kategori.ID);
                            item.Attributes.CssStyle.Value = string.Format("padding-left: {0}px;background: #f5f5f5; color: #454545;", (BAYMYO.UI.Converts.NullToInt(kategori.ParentID.Split(',').Length + 1) * 25));
                            break;
                        }
                        ddl.Items.Add(item);
                    }
                    kategoriler.Clear();
                    ddl.SelectedValue = BAYMYO.UI.Converts.NullToString(m.KategoriID);
                    CustomizeControl1.AddControl("Kategori", ddl, "<a href=\"" + Settings.PanelPath + "?go=kategori&mdl=makale\">[+] Yeni Kategori</a>");

                    Image img = new Image();
                    img.ID      = "BuyukResim";
                    img.ToolTip = m.ResimUrl;
                    if (!string.IsNullOrEmpty(m.ResimUrl))
                    {
                        img.ImageUrl = Settings.ImagesPath + "makale/" + m.ResimUrl;
                    }
                    else
                    {
                        img.ImageUrl = Settings.ImagesPath + "admin-yok.png";
                    }
                    CustomizeControl1.AddControl("Makale Resim", img);

                    FileUpload flu = new FileUpload();
                    flu.ID       = "ResimUrl";
                    flu.ToolTip  = m.ResimUrl;
                    flu.CssClass = "form-control";
                    CustomizeControl1.AddControl("Resim Ekle", flu, "Genişlik(W):728px - Yükseklik(H):300px");

                    CheckBoxList chkList = new CheckBoxList();
                    chkList.ID = "chkList";
                    chkList.RepeatDirection = RepeatDirection.Horizontal;
                    chkList.Items.Add("Gösterim Sayı");
                    chkList.Items[0].Selected = notNull ? m.GosterimSayi : true;
                    chkList.Items.Add("Üyelere Özel");
                    chkList.Items[1].Selected = m.Uye;
                    chkList.Items.Add("Yorumları Göster");
                    chkList.Items[2].Selected = notNull ? m.Yorum : false;
                    chkList.Items.Add("Yönetici Onayı");
                    chkList.Items[3].Selected = notNull ? m.YoneticiOnay : isAdmin;
                    chkList.Items[3].Enabled  = isAdmin;
                    chkList.Items.Add("Yayımla");
                    chkList.Items[4].Selected = notNull ? m.Aktif : isAdmin;
                    chkList.Items[4].Enabled  = isAdmin;
                    CustomizeControl1.AddControl("Seçimler", chkList);

                    CustomizeControl1.SubmitClick += new CustomizeControl.ButtonEvent(CustomizeControl1_SubmitClick);
                    CustomizeControl1.RemoveClick += new CustomizeControl.ButtonEvent(CustomizeControl1_RemoveClick);
                }
            }
            catch (Exception ex)
            {
                CustomizeControl1.MessageText = MessageBox.Show(DialogResult.Error, ex.Message);
            }
            base.OnInit(e);
        }