public static MvcHtmlString UploadButtonControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, string buttonTextKey, string defaultButtonText, string inputCss = null, string inputType = null) { //helper.RegisterScript("~/scripts/fileuploader.js", true); helper.RegisterWebReference("fileuploader"); return(GetControlGroup(widget, id, textKey, defaultText, string.Format(" <a class=\"btn {1}\" id=\"{0}\" >{2}</a>", widget.GetId(id), inputCss, HttpUtility.HtmlEncode(widget.GetText(buttonTextKey, defaultButtonText))))); }
public static MvcHtmlString TextEditorControl(this HtmlHelper helper, Models.IClientControl clientControl, string id, string dataColumn, bool required = false, string labelText = null) { var model = new Models.DataControl(dataColumn, Services.Portal.CurrentPortal.GetAttribute("Core", "TextEditor", "Core/CKTextEditor")); model.ClientId = clientControl.GetId(id); model.Required = required; model.LabelText = labelText; helper.RenderPartial("Controls/" + model.Path, model); return(null); }
public static MvcHtmlString InputFileBrowserControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, Dictionary <string, string> dataAttributes, string inputCss = null, string mimeType = "", bool required = false) { //ONLY REGISTER ONCE AND AT END?!?! helper.RenderWidget("Core/Admin/FileBrowser", new Dictionary <string, object>() { { "MimeType", mimeType } }, true); return(GetControlGroup(widget, id, textKey, defaultText, string.Format(" <input type=\"text\" class=\"{2}\" id=\"{0}\" {1} {3}/>" + " <a class=\"btn\" data-action=\"filebrowser\" data-control=\"{0}\" ><i class=\"icon-picture\"></i></a>", widget.GetId(id), GetDataAttributeMarkup(dataAttributes), inputCss, required ? "required=\"required\"" : ""), "input-append")); }
//public static MvcHtmlString LabelControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, string dataColumn, string css = null) //{ // return GetControlGroup(widget, id, textKey, defaultText, // string.Format("<label class=\"{2}\" id=\"{0}\" {1}></label>", // widget.GetId(id), GetDataAttributeMarkup(GetDataAttributeDict(dataColumn)), css)); //} public static MvcHtmlString InputControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, string dataColumn = null, string inputCss = null, string inputType = null, bool readOnly = false, bool required = false, string dataType = null, string valueMatchControl = null, bool disableAutoComplete = false) { if (!string.IsNullOrEmpty(valueMatchControl)) { valueMatchControl = widget.GetId(valueMatchControl); //todo: right place for this? } if (dataType == "datetime") //todo: auto do this? { helper.RegisterWebReferenceGroup("timepicker"); } return(InputControlGroup(helper, widget, id, textKey, defaultText, GetDataAttributeDict(dataColumn, dataType: dataType, valueMatchControl: valueMatchControl), required, inputCss, inputType, readOnly, disableAutoComplete)); }
private static MvcHtmlString GetControlGroup(Models.IClientControl widget, string id, string textKey, string defaultText, string controlMarkup, string controlsCss = "") { return(new MvcHtmlString(string.Format( "<div class=\"control-group\">" + "<label class=\"control-label\" for=\"{0}\">{1}</label>" + "<div class=\"controls {2}\">" + " {3}" + "</div>" + "</div>", widget.GetId(id), HttpUtility.HtmlEncode(widget.GetText(textKey, defaultText)), controlsCss, controlMarkup))); }
public static MvcHtmlString MultiSelectControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, Dictionary <string, string> dataAttributes, bool required, List <SelectListItem> items, string inputCss = null) { var clientId = widget.GetId(id); helper.RegisterWebReferenceGroup("multiselect"); //helper.RegisterScript("~/scripts/multiselect/jquery.multiselect.min.js", true); //helper.RegisterStylesheet("~/scripts/multiselect/jquery.multiselect.css", true); //todo: localize text (Select Options) //helper.RegisterDocumentReadyScript("multiselect-init", string.Format("$('select[data-controltype=\"multiselect\"]').multiselect({{ selectedList: 3 }});", clientId)); var options = new System.Text.StringBuilder(); foreach (var item in items) { options.AppendLine(string.Format("<option {0} value=\"{1}\">{2}</option>", item.Selected ? "selected=\"selected\" " : "", item.Value, HttpUtility.HtmlEncode(item.Text))); } return(GetControlGroup(widget, id, textKey, defaultText, string.Format(" <select class=\"{2}\" id=\"{0}\" {1} multiple=\"multiple\" {4}>{3}</select>", clientId, GetDataAttributeMarkup(dataAttributes), inputCss, options.ToString(), required ? "required=\"required\"" : ""))); }
public static MvcHtmlString DropDownControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, string dataColumn, IEnumerable <SelectListItem> selectList, string inputCss = null, SelectListItem blankItem = null) { var list = selectList.ToList(); //todo: minor little hack... if (blankItem != null) { list.Insert(0, blankItem); } return(GetControlGroup(widget, id, textKey, defaultText, helper.DropDownList(widget.GetId(id), list, new { @class = inputCss, data_column = dataColumn }).ToString())); }
public static MvcHtmlString TextAreaControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, Dictionary <string, string> dataAttributes, bool required, string inputCss = "", int rows = 3, bool readOnly = false) { return(GetControlGroup(widget, id, textKey, defaultText, string.Format("<textarea type=\"text\" class=\"{2}\" id=\"{0}\" {1} rows=\"{3}\" {4} {5}></textarea>", widget.GetId(id), GetDataAttributeMarkup(dataAttributes), inputCss, rows, required ? "required=\"required\"" : "", readOnly ? "readonly=\"readonly\"" : ""))); }
public static MvcHtmlString InputControlGroup(this HtmlHelper helper, Models.IClientControl widget, string id, string textKey, string defaultText, Dictionary <string, string> dataAttributes, bool required, string inputCss = null, string inputType = null, bool readOnly = false, bool disableAutoComplete = false) { return(GetControlGroup(widget, id, textKey, defaultText, string.Format("<input type=\"{3}\" class=\"{2}\" id=\"{0}\" name=\"{0}\" {1} {4} {5} {6}/>", widget.GetId(id), GetDataAttributeMarkup(dataAttributes), inputCss, string.IsNullOrEmpty(inputType) ? "text" : inputType, readOnly ? "readonly=\"readonly\"" : "", required ? "required=\"required\"" : "", disableAutoComplete ? "autocomplete=\"off\"" : ""))); }
public static MvcHtmlString RenderClientControl(this HtmlHelper helper, Models.IClientControl clientControl, string id, Models.Chart model) { model.ClientId = clientControl.GetId(id); helper.RenderPartial("Controls/" + model.Path, model); return(null); }