use of web.HTMLWriter in project common by zenlunatics.
the class MeetingColorRenderer method writeValue.
@Override
public void writeValue(View view, ColumnBase<?> column, Request request) throws IOException {
int row = view.data().getRow() - 1;
HTMLWriter writer = request.writer;
writer.write("<span id=\"p");
writer.write(row);
writer.write("\" style=\"border-left:12px solid;height:0px\" />");
writer.js("$('p" + row + "').style.borderColor=meeting.getColor(" + row + ");");
}
use of web.HTMLWriter in project common by zenlunatics.
the class Minutes method doGet.
// --------------------------------------------------------------------------
@Override
public boolean doGet(Request request) throws IOException {
if (super.doGet(request))
return true;
int minutes_id = request.getPathSegmentInt(1);
HTMLWriter writer = request.writer;
try {
ResultSet rs = request.db.select(new Select("text").from(m_table).whereIdEquals(minutes_id));
if (rs.next()) {
String text = rs.getString(1);
if (text != null)
writer.write("<div id=\"c_\">").writeWithLinks(text).br().buttonIconOnClick("print", "open_print_window(this)").write("</div>");
}
rs.getStatement().close();
} catch (SQLException e) {
throw new RuntimeException(e);
}
View attachments = new View(request.site.getViewDef(m_table + "_attachments", request.db), request);
ColumnBase<?> column = attachments.getColumn("filename");
attachments.select(new Select("*").from(m_table + "_attachments").where(m_table + "_id=" + minutes_id));
if (attachments.data().isBeforeFirst()) {
writer.hr().h4("Attachments");
while (attachments.next()) {
column.writeValue(attachments, null, request);
writer.br();
}
writer.br();
}
Comments.writeComments(m_table, minutes_id, request);
return true;
}
use of web.HTMLWriter in project common by zenlunatics.
the class Task method writeForm.
// --------------------------------------------------------------------------
private void writeForm(String view_def_name, String id, Request request) throws IOException {
HTMLWriter writer = request.writer;
writer.formOpen("POST", request.getContext() + "/db");
writer.hiddenInput("db_task", m_name);
writer.hiddenInput("db_view_def", view_def_name);
writer.hiddenInput("db_key_value", id);
writeFields(writer);
writer.tagClose();
}
use of web.HTMLWriter in project common by zenlunatics.
the class View method getColumnHTML.
// --------------------------------------------------------------------------
public String getColumnHTML(String column) {
HTMLWriter save_writer = m_writer;
HTMLWriter new_writer = m_writer.stringWriter();
new_writer.setDateTimeFormatter(m_request.date_time_formatter);
m_writer = new_writer;
m_request.writer = new_writer;
try {
writeColumnHTML(column);
} catch (IOException e) {
m_request.abort(e);
}
m_writer = save_writer;
m_request.writer = save_writer;
return new_writer.getWriter().toString();
}
use of web.HTMLWriter in project common by zenlunatics.
the class YearFilter method write.
// --------------------------------------------------------------------------
@Override
public String write(View view, Request request) throws IOException {
int this_year = request.site.newCalendar().get(Calendar.YEAR);
int year = this_year;
String filter = view.getState().filter;
if (filter != null) {
int index = filter.indexOf("extract(year from date)='");
if (index != -1 && filter.length() >= index + 29)
year = Integer.parseInt(filter.substring(index + 25, index + 29));
}
int earliest_year = request.db.lookupInt("extract(year from min(date))", m_table, view.getState().getBaseFilter(), this_year);
if (// postgres returns an answer even if there's no records
earliest_year == 0)
earliest_year = this_year;
int latest_year = request.db.lookupInt("extract(year from max(date))", m_table, view.getState().getBaseFilter(), this_year);
if (// postgres returns an answer even if there's no records
latest_year == 0)
latest_year = this_year;
HTMLWriter writer = request.writer;
String id = UUID.randomUUID().toString();
writer.setAttribute("id", id);
writer.setAttribute("class", "form-control");
writer.setAttribute("style", "display:inline;font-size:inherit;height:inherit;width:inherit;");
writer.tagOpen("select");
for (int i = earliest_year; i <= latest_year; i++) {
writer.write("<option");
if (i == year)
writer.write(" selected=\"selected\"");
writer.write(">").write(i).write("</option>");
}
writer.tagClose();
return id;
}
Aggregations