mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
*) modified Blog
- added delete-option - fixed displaying of admin options git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@1805 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
8548ee6b53
commit
b92a00172e
|
@ -13,7 +13,7 @@
|
|||
<table width="80%" border="1" cellpadding="0" cellspacing="0">
|
||||
<tr class="TableHeader"><td align="left">#[date]#</td><td>by #[author]#</td></tr>
|
||||
<tr class="WikiBackground"><td colspan=2 align="left"><h2>#[subject]#</h2><br>#[page]#</td><td></td></tr>
|
||||
<tr class="TableHeader"><td colspan=2 align="left"><a href="Blog.html?page=#[pageid]#">link</a>#(admin)#:: - <a href="Blog.html?page=#[pageid]#&edit=true">edit</a>#(/admin)#</td><td></td></tr>
|
||||
<tr class="TableHeader"><td colspan=2 align="left"><a href="Blog.html?page=#[pageid]#">link</a>#(admin)#:: - <a href="Blog.html?page=#[pageid]#&edit=true">edit</a> - <a href="Blog.html?page=#[pageid]#&delete=try">delete</a>#(/admin)#</td><td></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
#{/entries}#
|
||||
|
@ -27,7 +27,6 @@
|
|||
<p>Subject:<br><input name="subject" type="text" size="20" maxlength="80" value="#[subject]#"></p>
|
||||
<p>Text:<br><textarea name="content" cols="80" rows="24">#[page-code]#</textarea></p>
|
||||
<input type="hidden" name="page" value="#[pageid]#">
|
||||
<input type="hidden" name="reason" value="edit">
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
<input type="submit" name="preview" value="Preview">
|
||||
<input type="submit" name="view" value="Discard">
|
||||
|
@ -46,7 +45,6 @@
|
|||
<p>Subject:<br><input name="subject" type="text" size="20" maxlength="80" value="#[subject]#"></p>
|
||||
<p>Text:<br><textarea name="content" cols="80" rows="24">#[page-code]#</textarea></p>
|
||||
<input type="hidden" name="page" value="#[pageid]#">
|
||||
<input type="hidden" name="reason" value="edit">
|
||||
<input type="submit" name="submit" value="Submit">
|
||||
<input type="submit" name="preview" value="Preview">
|
||||
<input type="submit" name="view" value="Discard">
|
||||
|
@ -55,6 +53,18 @@
|
|||
<!-- 3: Access Denied (no rights) -->
|
||||
<h3>Access denied</h3>
|
||||
To edit or create blog-entries you need to be logged in as Admin or User that has Blog rights.
|
||||
::
|
||||
<!-- 4: Delete Confirmation -->
|
||||
<h3>Are you sure...</h3>
|
||||
... that you want to delete <b>#[subject]#</b> by #[author]#?<br><br>
|
||||
<form action="Blog.html" method="POST" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<input type="hidden" name="delete" value="sure">
|
||||
<input type="hidden" name="page" value="#[pageid]#">
|
||||
<input type="submit" value="Yes, delete it.">
|
||||
</form><br>
|
||||
<form action="Blog.html" method="POST" enctype="multipart/form-data" accept-charset="UTF-8">
|
||||
<input type="submit" value="No, leave it.">
|
||||
</form>
|
||||
#(/mode)#
|
||||
#%env/templates/footer.template%#
|
||||
</body>
|
||||
|
|
|
@ -53,6 +53,10 @@ public class Blog {
|
|||
author = de.anomic.yacy.yacyCore.seedDB.mySeed.get("Name", "anonymous");
|
||||
}
|
||||
}
|
||||
|
||||
if(hasRights && post.containsKey("delete") && post.get("delete").equals("sure")) {
|
||||
switchboard.blogDB.delete(pagename);
|
||||
}
|
||||
|
||||
if (post.containsKey("submit") && (hasRights)) {
|
||||
// store a new/edited blog-entry
|
||||
|
@ -103,6 +107,15 @@ public class Blog {
|
|||
}
|
||||
else prop.put("mode",3); //access denied (no rights)
|
||||
}
|
||||
else if(post.containsKey("delete") && post.get("delete").equals("try")) {
|
||||
if(hasRights) {
|
||||
prop.put("mode",4);
|
||||
prop.put("mode_pageid",pagename);
|
||||
prop.put("mode_author",page.author());
|
||||
prop.put("mode_subject",page.subject());
|
||||
}
|
||||
else prop.put("mode",3); //access denied (no rights)
|
||||
}
|
||||
else {
|
||||
wikiCode wikiTransformer=new wikiCode(switchboard);
|
||||
// show blog-entry/entries
|
||||
|
@ -155,6 +168,10 @@ public class Blog {
|
|||
prop.put("mode_entries_0_author", page.author());
|
||||
prop.put("mode_entries_0_date", dateString(page.date()));
|
||||
prop.put("mode_entries_0_page", wikiTransformer.transform(page.page()));
|
||||
if(hasRights) {
|
||||
prop.put("mode_entries_0_admin", 1);
|
||||
prop.put("mode_entries_0_admin_pageid",page.key());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -222,6 +222,13 @@ public class blogBoard {
|
|||
}
|
||||
}
|
||||
|
||||
public void delete(String key) {
|
||||
key = normalize(key);
|
||||
try {
|
||||
datbase.remove(key);
|
||||
} catch (IOException e) { }
|
||||
}
|
||||
|
||||
public Iterator keys(boolean up) throws IOException {
|
||||
return datbase.keys(up, false);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user