use of org.apache.wiki.attachment.Attachment in project jspwiki by apache.
the class RPCHandler method getRecentChanges.
public Vector getRecentChanges(Date since) {
checkPermission(PagePermission.VIEW);
Collection<WikiPage> pages = m_engine.getRecentChanges();
Vector<Hashtable<String, Object>> result = new Vector<Hashtable<String, Object>>();
Calendar cal = Calendar.getInstance();
cal.setTime(since);
//
// Convert UTC to our time.
//
cal.add(Calendar.MILLISECOND, (cal.get(Calendar.ZONE_OFFSET) + (cal.getTimeZone().inDaylightTime(since) ? cal.get(Calendar.DST_OFFSET) : 0)));
since = cal.getTime();
for (WikiPage page : pages) {
if (page.getLastModified().after(since) && !(page instanceof Attachment)) {
result.add(encodeWikiPage(page));
}
}
return result;
}
use of org.apache.wiki.attachment.Attachment in project jspwiki by apache.
the class RPCHandlerUTF8 method getAllPages.
public Vector getAllPages() {
checkPermission(PagePermission.VIEW);
Collection<WikiPage> pages = m_engine.getRecentChanges();
Vector<String> result = new Vector<String>();
for (WikiPage p : pages) {
if (!(p instanceof Attachment)) {
result.add(p.getName());
}
}
return result;
}
use of org.apache.wiki.attachment.Attachment in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testAttachmentLink3.
/**
* Are attachments parsed correctly also when using gappy text?
*/
@Test
public void testAttachmentLink3() throws Exception {
TestEngine testEngine2 = new TestEngine(props);
testEngine2.saveText("TestPage", "foo ");
created.addElement("TestPage");
Attachment att = new Attachment(testEngine2, "TestPage", "TestAtt.txt");
att.setAuthor("FirstPost");
testEngine2.getAttachmentManager().storeAttachment(att, testEngine.makeAttachmentFile());
String src = "[Test page/TestAtt.txt]";
Assert.assertEquals("<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test page/TestAtt.txt</a>" + "<a href=\"/test/PageInfo.jsp?page=TestPage/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>", translate(testEngine2, src));
}
use of org.apache.wiki.attachment.Attachment in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testAttachmentLink2.
@Test
public void testAttachmentLink2() throws Exception {
props.setProperty("jspwiki.encoding", "ISO-8859-1");
// TODO
TestEngine testEngine2 = new TestEngine(props);
testEngine2.saveText("Test", "foo ");
created.addElement("Test");
Attachment att = new Attachment(testEngine2, "Test", "TestAtt.txt");
att.setAuthor("FirstPost");
testEngine2.getAttachmentManager().storeAttachment(att, testEngine.makeAttachmentFile());
String src = "This should be an [attachment link|Test/TestAtt.txt]";
Assert.assertEquals("This should be an <a class=\"attachment\" href=\"/test/attach/Test/TestAtt.txt\">attachment link</a>" + "<a href=\"/test/PageInfo.jsp?page=Test/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>", translate(testEngine2, src));
}
use of org.apache.wiki.attachment.Attachment in project jspwiki by apache.
the class JSPWikiMarkupParserTest method testAttachmentLink4.
@Test
public void testAttachmentLink4() throws Exception {
TestEngine testEngine2 = new TestEngine(props);
testEngine2.saveText("TestPage", "foo ");
created.addElement("TestPage");
Attachment att = new Attachment(testEngine2, "TestPage", "TestAtt.txt");
att.setAuthor("FirstPost");
testEngine2.getAttachmentManager().storeAttachment(att, testEngine.makeAttachmentFile());
String src = "[" + testEngine2.beautifyTitle("TestPage/TestAtt.txt") + "]";
Assert.assertEquals("<a class=\"attachment\" href=\"/test/attach/TestPage/TestAtt.txt\">Test Page/TestAtt.txt</a>" + "<a href=\"/test/PageInfo.jsp?page=TestPage/TestAtt.txt\" class=\"infolink\"><img src=\"/test/images/attachment_small.png\" border=\"0\" alt=\"(info)\" /></a>", translate(testEngine2, src));
}
Aggregations