use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class ScanItemListBulkHandler method writeContents.
@Override
protected void writeContents() throws IOException {
parseFormData();
String[] itemIDs = (String[]) parameters.get("id_ALL");
boolean checked = "true".equals(parameters.get("checked"));
DateData valueToStore = checked ? new DateData() : null;
DataContext data = getDataContext();
for (String itemID : itemIDs) {
if (!checkValidID(itemID))
throw new TinyCGIException(400, "Bad item ID");
data.putValue(itemID, valueToStore);
}
out.write("OK");
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class GetUnassignedAndDeferredTime method isMaster.
private boolean isMaster(String projectPath) throws IOException {
DashHierarchy hierarchy = getPSPProperties();
PropertyKey key = hierarchy.findExistingKey(projectPath);
String templateID = null;
if (key != null)
templateID = hierarchy.getID(key);
if (templateID == null)
throw new TinyCGIException(404, "Not a team project");
else if (templateID.endsWith(SyncWBS.MASTER_ROOT))
return true;
else if (templateID.endsWith(SyncWBS.TEAM_ROOT))
return false;
else
throw new TinyCGIException(404, "Not a team project");
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class SavePageHandler method service.
public String service(Writer out, String pageName) throws IOException {
if (Settings.isReadOnly()) {
out.write("Location: /dash/snippets/saveError.shtm?err=Read_Only" + "\r\n\r\n");
return null;
} else if (!AbstractPageAssembler.hasEditPermission()) {
throw new TinyCGIException(403, "No permission");
}
// read the description of the page from posted form data
PageContentTO page = parsePostedPageContent();
// get an output stream for saving the contents
String persistenceQualifier = page.getMetadataValue(PersistenceService.QUALIFIER_ATTRIBUTE_NAME, null);
OutputStream dest = CmsDefaultConfig.getPersistence().save(persistenceQualifier, pageName);
// serialize the contents to the output stream
ContentSerializer ser = CmsDefaultConfig.getSerializer();
ser.format(page, dest);
dest.close();
// ask the dispatcher to redirect to the plain viewing page.
return "";
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class EditSinglePageAssembler method writePage.
@Override
protected void writePage(Writer out, Set headerItems, PageContentTO page) throws IOException {
if (!hasEditPermission())
throw new TinyCGIException(403, "No permission");
out.write(HTML_TRANSITIONAL_DOCTYPE);
out.write("<html>\n");
writeHead(out, headerItems, page);
out.write("<body scroll=\"yes\">\n");
writeFormStart(out);
writeHeaderElements(out, page);
writePageMetadataEditors(out, page);
writePageSnippetEditors(out, page);
writeFooterElements(out, page);
writeFormEnd(out);
out.write("<script type=\"text/javascript\">DashCMS.initPage();</script>\n");
out.write("</body>\n");
out.write("</html>\n");
}
use of net.sourceforge.processdash.net.http.TinyCGIException in project processdash by dtuma.
the class LOCDiffReport method printStoredReport.
private void printStoredReport() throws IOException {
long reportId = Long.parseLong(getParameter("report"));
File reportFile = STORED_REPORTS.get(reportId);
if (reportFile == null)
throw new TinyCGIException(404, "Report Not Found");
else
FileUtils.copyFile(reportFile, outStream);
}
Aggregations