예제 #1
0
 private String getBox() {
     Html html = new Html();
     if (poll.Type == 1) {
         html.CheckBox( "pollOption", Convert.ToString( (optionIndex + 1) ), "" );
     }
     else {
         html.Radio( "pollOption", Convert.ToString( (optionIndex + 1) ), "" );
     }
     return html.ToString();
 }
예제 #2
0
        private String getSubmit( PollBase poll )
        {
            String voteLink = postLink;

            Boolean hasVote = checkHasVote();

            Html html = new Html();
            if (!user.IsRegisterUser) {
                html.Code( "<input type=button disabled=disabled value=\"" + lang.get( "pollLoginRequire" ) + "\" />" );
            }
            else if (hasVote) {
                html.Code( "<input type=button disabled=disabled value=\"" + lang.get( "pollVoted" ) + "\" />" );
            }
            else {

                html.Code( "<input id=\"btnPoll\" class=\"btn\" type=button value=\" " + lang.get( "pollVote" ) + " \" />" );

            }
            if (!(hasVote || (poll.IsVisible != 1))) {
                html.Code( " <span class='red font12'>[" + lang.get( "pollViewTip" ) + "]</span>" );
            }

            String js = getAjaxJs( voteLink, lang.get( "pollSelectRequire" ), lang.get( "pollVoted" ) );
            html.Code( js );

            return html.ToString();
        }
예제 #3
0
 private String getControl( ContentPoll poll, int optionIndex, String optionText ) {
     Html html = new Html();
     if (poll.Type == 1) {
         html.CheckBox( "pollOption", Convert.ToString( (optionIndex + 1) ), optionText );
     }
     else {
         html.Radio( "pollOption", Convert.ToString( (optionIndex + 1) ), optionText );
     }
     return html.ToString();
 }
        private void showEdit( IEntity obj ) {

            EntityInfo entityInfo = Entity.GetInfo( obj );
            Html html = new Html();

            html.Code( "<form methond=\"post\" class=\"ajaxPostForm\" action=\"" + to( Update, obj.Id ) + "\">" );

            html.Code( string.Format( "<div class='codeCmd'><a href='{0}'>返回列表</a></div>", to( Model ) + "?typeName=" + entityInfo.FullName ) );
            html.Code( "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" class='formTable'>" );
            foreach (EntityPropertyInfo pInfo in entityInfo.SavedPropertyList) {

                if (pInfo.Name.Equals( "Id" )) continue;

                string str = this.getPropertyValue( obj, pInfo );
                string style = "";
                if ((pInfo.SaveAttribute == null) || ((pInfo.SaveAttribute != null) && (pInfo.SaveAttribute.Length > 100))) {
                    style = "width:400px;";
                }
                string control = Html.TextInput( pInfo.Name, str, style );
                if (pInfo.IsLongText) {
                    if (rft.GetAttribute( pInfo.Property, typeof( HtmlTextAttribute ) ) != null) {

                        String itemName = pInfo.Name;
                        control = @"<script type=""text/plain"" id=""" + itemName + @""" name=""" + itemName + @""">" + str + @"</script>
<script>
_run(function () { 
    wojilu.editor.bind('" + itemName + @"').height(220).line(2).show();
});
</script>
";
                   }
                    else {
                        control = "<div>" + Html.TextArea( pInfo.Name, str, "width:98%; height:80px;" ) + "</div>";
                    }
                }
                else if (pInfo.IsEntity) {
                    string textField = getDropText( pInfo );
                    if (textField.Length > 0) {
                        IList list = ndb.findAll( pInfo.Type );
                        if (list.Count > 0) {
                            IEntity objP = obj.get( pInfo.Name ) as IEntity;
                            if (objP != null) {
                                control = Html.DropList( list, pInfo.Name, textField, "Id", objP.Id );
                            }
                        }
                    }
                }
                html.Code( string.Format( "<tr><td class=\"mLable\">{0}</td><td>{1} {2}</td></tr>", pInfo.Label, control, this.getErrorInfo( pInfo.Name ) ) );
            }
            html.Code( "</td></tr></table>" );
            html.Code( "<div style=\"margin:5px 10px;\">" );
            html.Submit( "修改数据" );
            html.Code( "<input type=\"button\" onclick=\"history.back();\" value=\"返回\" style=\"margin-left:15px;\" />" );
            html.HiddenInput( "typeName", entityInfo.FullName );
            html.Code( "</div>" );
            html.FormEnd();
            actionContent( html.ToString() );
        }
        //---------------------------------------------------------------------------------------------------------


        public void Add() {

            String typeName = ctx.Get( "typeName" );

            EntityInfo ei = Entity.GetInfo( typeName );
            Html html = new Html();

            html.Code( "<form methond=\"post\" class=\"ajaxPostForm\" action=\"" + to( Insert ) + "\">" );
            html.Code( string.Format( "<div class='codeCmd'><a href='{0}'>返回列表</a></div>", to( Model ) + "?typeName=" + typeName ) );
            html.Code( "<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\" class='formTable'>" );
            foreach (EntityPropertyInfo propertyInfo in ei.SavedPropertyList) {
                if (propertyInfo.Name.Equals( "Id" )) {
                    continue;
                }
                string txtValue = "";
                if ((propertyInfo.Type == typeof( int )) || (propertyInfo.Type == typeof( decimal ))) {
                    txtValue = "0";
                }
                else if (propertyInfo.Type == typeof( DateTime )) {
                    txtValue = DateTime.Now.ToString();
                }
                string style = "";
                if ((propertyInfo.SaveAttribute == null) || ((propertyInfo.SaveAttribute != null) && (propertyInfo.SaveAttribute.Length > 100))) {
                    style = "width:400px;";
                }
                string control = Html.TextInput( propertyInfo.Name, txtValue, style );
                if (propertyInfo.IsLongText) {

                    if (rft.GetAttribute( propertyInfo.Property, typeof( HtmlTextAttribute ) ) != null) {

                        //control = Editor.NewOne( propertyInfo.Name, "", "200px", editorJsPath, MvcConfig.Instance.JsVersion, Editor.ToolbarType.Full ).ToString();

                        String itemName = propertyInfo.Name;

                        control = @"<script type=""text/plain"" id=""" + itemName + @""" name=""" + itemName + @"""></script>
<script>
_run(function () { 
    wojilu.editor.bind('" + itemName + @"').height(220).line(2).show();
});
</script>
";
                     }
                    else {

                        control = "<div>" + Html.TextArea( propertyInfo.Name, "", "width:98%; height:80px;" ) + "</div>";

                    }
                }
                else if (propertyInfo.IsEntity) {
                    string textField = getDropText( propertyInfo );
                    if (textField.Length > 0) {
                        IList list = ndb.findAll( propertyInfo.Type );
                        if (list.Count > 0) {
                            control = Html.DropList( list, propertyInfo.Name, textField, "Id", null );
                        }
                    }
                }
                html.Code( string.Format( "<tr><td class=\"mLable\">{0}</td><td>{1} {2}</td></tr>", propertyInfo.Label, control, this.getErrorInfo( propertyInfo.Name ) ) );
            }
            html.Code( "</td></tr></table>" );
            html.Code( "<div style=\"margin:5px 10px;\">" );
            html.Submit( "添加数据" );
            html.Code( "<input type=\"button\" onclick=\"history.back();\" value=\"返回\" style=\"margin-left:15px;\" />" );
            html.HiddenInput( "typeName", ei.FullName );
            html.Code( "</div>" );
            html.FormEnd();
            actionContent( html.ToString() );
        }
예제 #6
0
        private String getControl( ForumPoll poll, int optionIndex, String optionText )
        {
            Html html = new Html();
            if (poll.Type == 1) {
                html.CheckBox( "pollOption", Convert.ToString( (optionIndex + 1) ), optionText );
            }
            else {
                String __name = "pollOption";
                String __val = Convert.ToString( (optionIndex + 1) );
                String __txt = optionText;

                html.Code( string.Format( "<label class=\"radio\"><input type=\"radio\" name=\"{0}\" id=\"{3}\" value=\"{1}\" /> {2}</label> ", __name, __val, __txt, __name + __val ) );
            }
            return html.ToString();
        }