use of web.HTMLWriter in project common by zenlunatics.
the class Admin method writeManyToManyLinkTableCreateForm.
// --------------------------------------------------------------------------
private void writeManyToManyLinkTableCreateForm(Request request) throws IOException {
HTMLWriter writer = request.writer;
writer.formOpen("POST", "admin");
writer.hiddenInput("action", "many_to_many_link_table_create");
writer.write("<table style=\"border-collapse:separate;border-spacing:2px;\"><tr><td>");
writer.write("table 1");
writer.write("</td><td style=\"padding:2px;\">");
writer.textInput("table1", null, null);
writer.write("</td></tr><tr><td style=\"padding:2px;\">");
writer.write("table 2");
writer.write("</td><td style=\"padding:2px;\">");
writer.textInput("table2", null, null);
writer.write("</td></tr></table>");
writer.aButtonOnClick("create", "send_form(this,function(t){get_nav_list('tables');dialog_alert('','table created')});");
writer.tagClose();
}
use of web.HTMLWriter in project common by zenlunatics.
the class Admin method importCSVForm.
// --------------------------------------------------------------------------
public static void importCSVForm(Request request) throws IOException {
HTMLWriter writer = request.writer;
MethodForm method_form = new MethodForm(Admin.class);
method_form.open("importCSV", request);
Table table = new Table(writer);
table.tr().td();
writer.write("filename");
table.td();
writer.textInput("filename", null, null);
table.tr().td().td();
writer.checkbox("first_line", "first line is column names", null, false, false);
table.close();
method_form.close(writer);
}
use of web.HTMLWriter in project common by zenlunatics.
the class Admin method writeSearchPanel.
// --------------------------------------------------------------------------
private void writeSearchPanel(Request request) throws IOException {
HTMLWriter writer = request.writer;
writer.write("Column: <input /><br />");
writer.write("Where: <input /><br />");
writer.aButtonOnClick("search", "var w=this.getPrevious().getPrevious();var c=w.getPrevious().getPrevious();$('tables with column').replace('?action=tables with column&column='+c.value+'&where='+w.value)");
writer.write("<div id=\"tables with column\"></div>");
}
use of web.HTMLWriter in project common by zenlunatics.
the class Admin method writeColumnForm.
// --------------------------------------------------------------------------
private void writeColumnForm(String table, JDBCColumn jdbc_column, Request request) throws IOException {
HTMLWriter writer = request.writer;
web.Form form = new web.Form(null, null, writer).setButtonsLocation(web.Form.Location.NONE).open();
writer.hiddenInput("table", table);
if (jdbc_column == null) {
writer.hiddenInput("action", "column_add");
form.rowOpen("name");
writer.write("<input type=\"text\" name=\"column\" />");
} else {
writer.hiddenInput("action", "set column type");
writer.hiddenInput("column", jdbc_column.name);
}
form.rowOpen("type");
Select types = new Select("type", JDBCColumn.types);
if (jdbc_column != null)
types.setSelectedOption(jdbc_column.type_name, null);
types.write(request);
form.rowOpen("size");
if (jdbc_column != null && jdbc_column.type_name.endsWith("char") && jdbc_column.size > 0 && jdbc_column.size < 1000)
writer.textInput("size", "3", Integer.toString(jdbc_column.size));
else
writer.textInput("size", "3", null);
if (jdbc_column == null) {
form.rowOpen("references");
new Select("reftable", request.db.getTableNames(false)).setAllowNoSelection(true).write(request);
}
form.close();
}
use of web.HTMLWriter in project common by zenlunatics.
the class CalendarPicker method writeCheckBoxes.
// --------------------------------------------------------------------------
public void writeCheckBoxes(Request request) throws IOException {
Collection<EventProvider> event_providers = getCalendarsSorted(request);
if (event_providers.size() > 1) {
int num_written = 0;
Person user = request.getUser();
String[] checked_calendars = getCheckedCalendars(user);
HTMLWriter writer = request.writer;
request.writer.write("Overlap other calendars: ");
for (EventProvider event_provider : event_providers) {
String name = event_provider.getName();
if (m_event_provider_name.equals(name))
continue;
num_written++;
if (num_written > 0)
writer.space();
writer.setAttribute("class", "event checkbox");
String color = event_provider.getColor();
if (color != null)
writer.setAttribute("style", "display:inline-block;white-space:nowrap;padding-left:2px;background-color:" + color);
else
writer.setAttribute("style", "display:inline-block;white-space:nowrap;padding-left:2px;");
writer.tagOpen("div");
writer.setAttribute("onchange", "XHR_post(context+'/" + URLEncoder.encode(m_event_provider_name, "UTF-8") + "','toggle=" + URLEncoder.encode(name, "UTF-8") + "',function(){$('calendar').calendar.update()})");
writer.checkbox("e" + (num_written - 1), event_provider.getDisplayName(), null, checked_calendars == null ? false : Util.indexOf(checked_calendars, name) != -1, true);
writer.tagClose();
}
writer.setAttribute("class", "btn btn-default btn-xs");
writer.setAttribute("style", "margin-left:4px;");
writer.aOnClick("all", "XHR_post(context+'/" + URLEncoder.encode(m_event_provider_name, "UTF-8") + "','check=all',function(){$('calendar').calendar.set_checkboxes(true)})");
writer.setAttribute("class", "btn btn-default btn-xs");
writer.setAttribute("style", "margin-left:4px;");
writer.aOnClick("none", "XHR_post(context+'/" + URLEncoder.encode(m_event_provider_name, "UTF-8") + "','check=none',function(){$('calendar').calendar.set_checkboxes(false)})");
}
}
Aggregations