Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="ident">ident (art or parent)</param>
        public Form_Comment_New(long id,string ident)
        {
            _action = new CMS_Action("/comment/add?"+ident+"="+id.ToString());

            CMS_Form_Element_Textbox name = new CMS_Form_Element_Textbox("name");
            name.setRequired();
            name.setLabel("Nickname");

            this.addElement(name);

            CMS_Form_Element_Textbox email = new CMS_Form_Element_Textbox("email");
            email.setRequired();
            email.setLabel("E-mail");
            email.addValidator(new CMS_Validator_Email());

            this.addElement(email);

            CMS_Form_Element_Textbox title = new CMS_Form_Element_Textbox("title");
            title.setLabel("Title");
            title.setRequired();

            this.addElement(title);

            CMS_Form_Element_Textarea text = new CMS_Form_Element_Textarea("text");
            text.setRequired();
            text.setLabel("Comment");

            this.addElement(text);

            CMS_Form_Element_Submit ok = new CMS_Form_Element_Submit("ok");
            ok.setLabel("Comment!");

            this.addElement(ok);
        }
Exemple #2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="id">user id</param>
        public Form_Author_Add(long id)
        {
            _action = new CMS_Action("/backend/PromoteUser?id=" + id.ToString());

            CMS_Form_Element_Textbox name = new CMS_Form_Element_Textbox("name");
            name.setLabel("First name");
            name.setRequired();

            this.addElement(name);

            CMS_Form_Element_Textbox lastname = new CMS_Form_Element_Textbox("lastname");
            lastname.setRequired();
            lastname.setLabel("Lastname");

            this.addElement(lastname);

            CMS_Form_Element_Textarea description = new CMS_Form_Element_Textarea("description");
            description.setLabel("Description");
            description.setRequired();
            description.setClass("ckeditor");

            this.addElement(description);

            CMS_Form_Element_Submit ok = new CMS_Form_Element_Submit("ok");
            ok.setLabel("Promote to author");

            this.addElement(ok);
        }
Exemple #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Form_LoginForm(string backUrl)
        {
            _action = new CMS_Action("/user/login");

            CMS_Form_Element_Textbox username = new CMS_Form_Element_Textbox("username");
            username.setLabel("Uživatelské jméno");
            username.setRequired();

            addElement(username);

            CMS_Form_Element_Hidden hidden = new CMS_Form_Element_Hidden("backUrl");
            hidden.setValue(backUrl);

            addElement(hidden);

            CMS_Form_Element_Password pw = new CMS_Form_Element_Password("password");
            pw.setLabel("Heslo");
            pw.setRequired();

            addElement(pw);

            CMS_Form_Element_Submit submit = new CMS_Form_Element_Submit("submit");
            submit.setLabel("Přihlásit se");

            addElement(submit);
        }
Exemple #4
0
        /// <summary>
        /// Sets data for edit mode
        /// </summary>
        /// <param name="edited">edited entity</param>
        public void setEditData(author edited)
        {
            _action = new CMS_Action("/backend/EditAuthor?uid=" + edited.usersid.ToString());

            _elements["lastname"].setValue(edited.lastname);
            _elements["name"].setValue(edited.name);
            _elements["description"].setValue(edited.description);

            _elements["ok"].setLabel("Save changes");
        }
Exemple #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="parent">parentid</param>
        public Form_Role_Add(long parent)
        {
            _action = new CMS_Action("/backend/AddRole?parent="+parent.ToString());

            CMS_Form_Element_Textbox name = new CMS_Form_Element_Textbox("name");
            name.setRequired();
            name.setLabel("Category title");

            this.addElement(name);

            CMS_Form_Element_Submit ok = new CMS_Form_Element_Submit("ok");
            ok.setLabel("Add the role");

            this.addElement(ok);
        }
Exemple #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        public Form_LoginForm()
        {
            _action = new CMS_Action("/user/login");

            CMS_Form_Element_Textbox username = new CMS_Form_Element_Textbox("username");
            username.setLabel("Username");
            username.setRequired();

            addElement(username);

            CMS_Form_Element_Password pw = new CMS_Form_Element_Password("password");
            pw.setLabel("Password");
            pw.setRequired();

            addElement(pw);

            CMS_Form_Element_Submit submit = new CMS_Form_Element_Submit("submit");
            submit.setLabel("Sign in");

            addElement(submit);
        }
Exemple #7
0
        /// <summary>
        /// Sets data for edit mode
        /// </summary>
        /// <param name="r">resource</param>
        /// <param name="roles">List of roles</param>
        /// <param name="allowed">List of allowed roles</param>
        public void setEditData(resource r, List<role> roles, List<role> allowed)
        {
            _action = new CMS_Action("/backend/EditResource?id=" + r.id);

            this._elements["name"].setValue(r.name);
            this._elements["controller"].setValue(r.controller);
            this._elements["action"].setValue(r.action);

            CMS_Form_Element submit = this._elements["ok"];
            this._elements.Remove("ok");

            List<long> allowedIds = allowed.Select(x => x.id).ToList();

            foreach (role roleItem in roles)
            {
                CMS_Form_Element_Select s = new CMS_Form_Element_Select("role_"+roleItem.id);
                s.setLabel("Acces for role "+roleItem.name);
                s.addOption("-1","Please choose");
                s.addOption("1","Allow");
                s.addOption("0","Deny");

                if (allowedIds.Contains(roleItem.id))
                {
                    s.setValue("1");
                }
                else
                {
                    s.setValue("0");
                }

                this.addElement(s);
            }
            this.addElement(submit);

            this._elements["ok"].setLabel("Save changes");
        }
Exemple #8
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="OriginalArticle">Edited article</param>
        public Form_Article_Edit(article OriginalArticle)
        {
            _action = new CMS_Action("/backend/editArticle?id="+OriginalArticle.id.ToString());

            CMS_Form_Element_Textbox title = new CMS_Form_Element_Textbox("title");
            title.setLabel("Title");
            title.setRequired();
            title.setValue(OriginalArticle.title);
            title.addValidator(new CMS_Validator_StringLength(0, 100));

            this.addElement(title);

            CMS_Form_Element_Textarea perex = new CMS_Form_Element_Textarea("perex");
            perex.setRequired();
            perex.setValue(OriginalArticle.introtext);
            perex.setLabel("Introtext");
            perex.setClass("ckeditor");

            CMS_Validator_StringLength v = new CMS_Validator_StringLength();
            v.setMaxLength(1000);
            perex.addValidator(v);

            this.addElement(perex);

            CMS_Form_Element_Textarea text = new CMS_Form_Element_Textarea("text");
            text.setRequired();
            text.setValue(OriginalArticle.fulltext);
            text.setLabel("Text");
            text.setClass("ckeditor");

            this.addElement(text);

            CMS_Form_Element_Select authors = new CMS_Form_Element_Select("authors");
            authors.setIsMultiSelect();
            authors.setLabel("Authors");
            authors.setSize(4);
            authors.setRequired();

            this.addElement(authors);

            CMS_Form_Element_Select categories = new CMS_Form_Element_Select("categories");
            categories.setIsMultiSelect();
            categories.setLabel("Categories");
            categories.setSize(4);
            categories.setRequired();

            this.addElement(categories);

            CMS_Form_Element_DateTime published = new CMS_Form_Element_DateTime("published");
            published.setRequired();
            published.setValue(OriginalArticle.date_published.ToString());
            published.setLabel("Publish date");

            this.addElement(published);

            CMS_Form_Element_DateTime pullback = new CMS_Form_Element_DateTime("pullback");
            pullback.setLabel("Pullback date");
            pullback.setValue(OriginalArticle.date_pullback.ToString());

            this.addElement(pullback);

            CMS_Form_Element_Select roles = new CMS_Form_Element_Select("roles");
            roles.setRequired();
            roles.setLabel("Role with access to the article");
            roles.setValue("1");

            this.addElement(roles);

            CMS_Form_Element_File smallIcon = new CMS_Form_Element_File("smallIcon");
            smallIcon.setRequired();
            smallIcon.setLabel("Small icon");

            this.addElement(smallIcon);

            CMS_Form_Element_File bigIcon = new CMS_Form_Element_File("bigIcon");
            bigIcon.setRequired();
            bigIcon.setLabel("Big icon");

            this.addElement(bigIcon);

            CMS_Form_Element_Textbox tags = new CMS_Form_Element_Textbox("tags");
            tags.setLabel("Tags (whitespace separated)");

            this.addElement(tags);

            CMS_Form_Element_Select published_bool = new CMS_Form_Element_Select("published_bool");
            published_bool.addOption("0", "No");
            published_bool.addOption("1", "Yes");
            published_bool.setLabel("Published state");

            published_bool.setValue(OriginalArticle.published.ToString());

            this.addElement(published_bool);

            CMS_Form_Element_Submit submit = new CMS_Form_Element_Submit("submit");
            submit.setLabel("Save the article");
            this.addElement(submit);
        }