- 3 more templates XHTML valid (had to remove all disabled <input>s if no blacklist was selected)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3135 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
karlchenofhell 18 years ago
parent d6eb699e8e
commit 89a270757f

@ -14,19 +14,19 @@
You may also provide your blacklist to other peers by sharing them; in return you may
collect blacklist entries from other peers.
</p>
<h3>Active list: <em>#[currentBlacklist]#</em> #(disabled)#::<span class="error">No blacklist selected</span>#(/disabled)#</h3>
<h3>Active list: #(disabled)#<em>#[currentBlacklist]#</em>::<span class="error">No blacklist selected</span>#(/disabled)#</h3>
<!-- blacklist selection -->
<fieldset class="selectList">
<legend>Select list:</legend>
<form action="Blacklist_p.html" method="post" enctype="multipart/form-data">
<form action="Blacklist_p.html" method="post" enctype="multipart/form-data">#(disabled)#
<div style="display:inline;">
<select name="selectedListName" size="1">
#{blackLists}#
<option value="#[name]#" #(selected)#::selected="selected"#(/selected)#>#[name]# [#(shared)#not shared::shared#(/shared)#] #{active}# #[blTypeName]##{/active}#</option>
#{/blackLists}#
</select>
<input type="submit" name="selectList" value="select" #(disabled)#::disabled="disabled"#(/disabled)# />
</div>
<input type="submit" name="selectList" value="select" />
</div>::#(/disabled)#
<div style="display:inline;">
New list:
<input type="text" name="newListName" />
@ -34,14 +34,14 @@
</div>
</form>
</fieldset>
#(disabled)#
<fieldset class="listSettings">
<legend>Settings for this list</legend>
<form action="Blacklist_p.html" method="post" enctype="multipart/form-data">
<div>
<input type="hidden" name="selectedListName" value="#[currentBlacklist]#" />
<input type="submit" name="shareList" value="Share/don't share this list" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" name="deleteList" value="Delete this list" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" name="shareList" value="Share/don't share this list" />
<input type="submit" name="deleteList" value="Delete this list" />
</div>
</form>
<form action="Blacklist_p.html" method="post" enctype="multipart/form-data">
@ -56,7 +56,7 @@
#{/currentActiveFor}#
</dl>
<input type="hidden" name="selectedListName" value="#[currentBlacklist]#" />
<input type="submit" name="activateList" value="Save" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" name="activateList" value="Save" />
</fieldset>
</form>
</fieldset>
@ -78,7 +78,7 @@
#{/Itemlist}#
</select>
<br />
<input type="submit" name="deleteBlacklistEntry" value="Delete URL pattern" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" name="deleteBlacklistEntry" value="Delete URL pattern" />
</div>
</form>
<form action="Blacklist_p.html" method="post" enctype="multipart/form-data">
@ -93,20 +93,22 @@
<div>
<input type="hidden" name="currentBlacklist" value="#[currentBlacklist]#" />
<input type="text" name="newEntry" size="50" />
<input type="submit" name="addBlacklistEntry" value="Add URL pattern"
#(disabled)#::disabled="disabled"#(/disabled)# />
<p>
#(status)# <!-- 0: -->
::
<strong>#[item]#</strong> was removed from blacklist
::
<strong>#[item]#</strong> was added to the blacklist
#(/status)#
</p>
<input type="submit" name="addBlacklistEntry" value="Add URL pattern" />
</div>
</form>
</fieldset>
::#(/disabled)#
<div>
<p>
#(status)# <!-- 0: -->
::
<strong>#[item]#</strong> was removed from blacklist
::
<strong>#[item]#</strong> was added to the blacklist
#(/status)#
</p>
</div>
#(disabled)#
<fieldset class="importListItems">
<legend>Import blacklist items from...</legend>
<!-- Blacklist import from other peer -->
@ -119,7 +121,7 @@
<option value="#[hash]#">#[name]#</option>
#{/otherHosts}#
</select>
<input type="submit" value="Load new blacklist items" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" value="Load new blacklist items" />
</fieldset>
</form>
@ -129,7 +131,7 @@
<legend>URL:</legend>
<input type="hidden" name="currentBlacklist" value="#[currentBlacklist]#" />
<input type="text" name="url" />
<input type="submit" value="Load new blacklist items" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" value="Load new blacklist items" />
</fieldset>
</form>
@ -139,10 +141,10 @@
<legend>file:</legend>
<input type="hidden" name="currentBlacklist" value="#[currentBlacklist]#" />
<input type="text" name="file" />
<input type="submit" value="Load new blacklist items" #(disabled)#::disabled="disabled"#(/disabled)# />
<input type="submit" value="Load new blacklist items" />
</fieldset>
</form>
</fieldset>
</fieldset>::#(/disabled)#
#%env/templates/footer.template%#
</body>
</html>

@ -66,6 +66,7 @@ import de.anomic.yacy.yacyCore;
import de.anomic.yacy.yacySeed;
public class Blacklist_p {
private final static String DISABLED = "disabled_";
private final static String BLACKLIST = "blackLists_";
private final static String BLACKLIST_SHARED = "BlackLists.Shared";
@ -291,8 +292,8 @@ public class Blacklist_p {
// Read the blacklist items from file
int entryCount = 0;
if (blacklistToUse != null) {
int entryCount = 0;
final ArrayList list = listManager.getListArray(new File(listManager.listsPath, blacklistToUse));
// sort them
@ -306,77 +307,76 @@ public class Blacklist_p {
if (nextEntry.length() == 0) continue;
if (nextEntry.startsWith("#")) continue;
prop.put("Itemlist_" + entryCount + "_item", nextEntry);
prop.put(DISABLED + "Itemlist_" + entryCount + "_item", de.anomic.data.wikiCode.replaceHTMLonly(nextEntry));
entryCount++;
}
}
prop.put("Itemlist", entryCount);
prop.put(DISABLED + "Itemlist", entryCount);
// List known hosts for BlackList retrieval
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0) { // no nullpointer error
int peerCount = 0;
try {
TreeMap hostList = new TreeMap();
final Enumeration e = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.0);
while (e.hasMoreElements()) {
yacySeed seed = (yacySeed) e.nextElement();
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);
}
String peername;
while ((peername = (String) hostList.firstKey()) != null) {
final String Hash = (String) hostList.get(peername);
prop.put("otherHosts_" + peerCount + "_hash", Hash);
prop.put("otherHosts_" + peerCount + "_name", peername);
hostList.remove(peername);
peerCount++;
}
} catch (Exception e) {/* */}
prop.put("otherHosts", peerCount);
// List known hosts for BlackList retrieval
if (yacyCore.seedDB != null && yacyCore.seedDB.sizeConnected() > 0) { // no nullpointer error
int peerCount = 0;
try {
TreeMap hostList = new TreeMap();
final Enumeration e = yacyCore.seedDB.seedsConnected(true, false, null, (float) 0.0);
while (e.hasMoreElements()) {
yacySeed seed = (yacySeed) e.nextElement();
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);
}
String peername;
while ((peername = (String) hostList.firstKey()) != null) {
final String Hash = (String) hostList.get(peername);
prop.put(DISABLED + "otherHosts_" + peerCount + "_hash", Hash);
prop.put(DISABLED + "otherHosts_" + peerCount + "_name", peername);
hostList.remove(peername);
peerCount++;
}
} catch (Exception e) {/* */}
prop.put(DISABLED + "otherHosts", peerCount);
}
}
// List BlackLists
int blacklistCount = 0;
if (dirlist != null) {
for (int i = 0; i <= dirlist.length - 1; i++) {
prop.put(BLACKLIST + blacklistCount + "_name", dirlist[i]);
prop.put(BLACKLIST + blacklistCount + "_selected", 0);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_name", de.anomic.data.wikiCode.replaceHTMLonly(dirlist[i]));
prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", 0);
if (dirlist[i].equals(blacklistToUse)) { //current List
prop.put(BLACKLIST + blacklistCount + "_selected", 1);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_selected", 1);
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
prop.put("currentActiveFor_" + blTypes + "_blTypeName",supportedBlacklistTypes[blTypes]);
prop.put("currentActiveFor_" + blTypes + "_checked",
prop.put(DISABLED + "currentActiveFor_" + blTypes + "_blTypeName",supportedBlacklistTypes[blTypes]);
prop.put(DISABLED + "currentActiveFor_" + blTypes + "_checked",
listManager.ListInListslist(supportedBlacklistTypes[blTypes] + ".BlackLists",dirlist[i])?0:1);
}
prop.put("currentActiveFor",supportedBlacklistTypes.length);
prop.put(DISABLED + "currentActiveFor",supportedBlacklistTypes.length);
}
if (listManager.ListInListslist(BLACKLIST_SHARED, dirlist[i])) {
prop.put(BLACKLIST + blacklistCount + "_shared", 1);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_shared", 1);
} else {
prop.put(BLACKLIST + blacklistCount + "_shared", 0);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_shared", 0);
}
int activeCount = 0;
for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {
if (listManager.ListInListslist(supportedBlacklistTypes[blTypes] + ".BlackLists",dirlist[i])) {
prop.put(BLACKLIST + blacklistCount + "_active_" + activeCount + "_blTypeName",supportedBlacklistTypes[blTypes]);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_active_" + activeCount + "_blTypeName",supportedBlacklistTypes[blTypes]);
activeCount++;
}
}
prop.put(BLACKLIST + blacklistCount + "_active",activeCount);
prop.put(DISABLED + BLACKLIST + blacklistCount + "_active",activeCount);
blacklistCount++;
}
}
prop.put("blackLists", blacklistCount);
prop.put(DISABLED + "blackLists", blacklistCount);
prop.put("currentBlacklist", (blacklistToUse==null)?"":blacklistToUse);
prop.put("disabled", (blacklistToUse==null)?1:0);
prop.put(DISABLED + "currentBlacklist", (blacklistToUse==null)?"":blacklistToUse);
prop.put("disabled", (blacklistToUse == null) ? 1 : 0);
return prop;
}

@ -106,7 +106,7 @@
<a href="#[link]#" class="bookmarkTitle">#[title]#</a>
</h4>
<p class="bookmarkDescription">#[description]#</p>
<p class="tags">Tagged with |&nbsp;#{tags}#<a href="Bookmarks.html?tag=#[tag]#" class="bookmarkTags">#[tag]#</a> | #{/tags}#</p>
<p class="tags">Tagged with | #{tags}#<a href="Bookmarks.html?tag=#[tag]#" class="bookmarkTags">#[tag]#</a> | #{/tags}#</p>
<p class="bookmarkActions">
<a href="Bookmarks.html?edit=#[hash]#" class="bookmarkAction">Edit</a> /
<a href="Bookmarks.html?delete=#[hash]#" class="bookmarkAction">Delete</a>

@ -242,7 +242,7 @@ public class Bookmarks {
while(count<max_count && it.hasNext()){
bookmark=switchboard.bookmarksDB.getBookmark((String)it.next());
if(bookmark!=null){
prop.put("bookmarks_"+count+"_link", bookmark.getUrl());
prop.put("bookmarks_"+count+"_link", de.anomic.data.wikiCode.replaceHTMLonly(bookmark.getUrl()));
prop.put("bookmarks_"+count+"_title", bookmark.getTitle());
prop.put("bookmarks_"+count+"_description", bookmark.getDescription());
prop.put("bookmarks_"+count+"_public", (bookmark.getPublic()? 1:0));

@ -17,7 +17,7 @@
<a href="#[url]#" class="tt">#[url]#</a>
<div class="CacheAdminInfo">
#[info]#
<strong>HTTP Header</strong><!-- TO-DO: CSS/XHTMLize begin -->
<p><strong>HTTP Header</strong></p><!-- TO-DO: CSS/XHTMLize begin -->
#(header)#<span class="info">- no header in header cache -</span>::<table border="0" cellspacing="0" cellpadding="0">#{line}#
<tr valign="top">
<td class="tt">#[property]#</td>
@ -28,70 +28,70 @@
#(type)#
<strong>TITLE:</strong><br />
#[title]#<br />
<br />
<p>
<strong>TITLE:</strong> #[title]#
</p>
<strong>SECTION HEADLINES:</strong><br />
<p><strong>SECTION HEADLINES:</strong></p>
<ul>#{headlines}#
<li>#[headline]#</li>#{/headlines}#
</ul>
<br />
<strong>HREF:</strong><br />
#(use.links)#::<p><strong>HREF:</strong></p>
<table border="0" cellspacing="0" cellpadding="0">#{links}#
<tr valign="top">
<td><span class="small">#[name]#</span></td>
<td class="tt">#[link]#</td>
</tr>#{/links}#
</table>
</table>#(/use.links)#
<strong>IMAGE:</strong><br />
#(use.images)#::<p><strong>IMAGE:</strong></p>
<table border="0" cellspacing="0" cellpadding="0">#{images}#
<tr valign="top">
<td><span class="small">#[name]#</span></td>
<td class="tt">#[link]#</td>
</tr>#{/images}#
</table>
</table>#(/use.images)#
<strong>AUDIO:</strong><br />
#(use.audio)#::<p><strong>AUDIO:</strong></p>
<table border="0" cellspacing="0" cellpadding="0">#{audio}#
<tr valign="top">
<td><span class="small">#[name]#</span></td>
<td class="tt">#[link]#</td>
</tr>#{/audio}#
</table>
</table>#(/use.audio)#
<strong>VIDEO:</strong><br />
#(use.video)#::<p><strong>VIDEO:</strong></p>
<table border="0" cellspacing="0" cellpadding="0">#{video}#
<tr valign="top">
<td><span class="small">#[name]#</span></td>
<td class="tt">#[link]#</td>
</tr>#{/video}#
</table>
</table>#(/use.video)#
<strong>APPS:</strong><br />
#(use.apps)#::<p><strong>APPS:</strong></p>
<table border="0" cellspacing="0" cellpadding="0">#{apps}#
<tr valign="top">
<td><span class="small">#[name]#</span></td>
<td class="tt">#[link]#</td>
</tr>#{/apps}#
</table>
</table>#(/use.apps)#
<strong>EMAIL:</strong><br />
#(use.email)#::<p><strong>EMAIL:</strong></p>
<table border="0" cellspacing="0" cellpadding="0">#{email}#
<tr valign="top">
<td><span class="small">#[name]#</span></td>
<td class="tt">#[link]#</td>
</tr>#{/email}#
</table>
</table>#(/use.email)#
<strong>TEXT:</strong><br />
<p><strong>TEXT:</strong></p>
<span class="small">
#[text]#
</span>
<strong>LINES:</strong><br />
<p><strong>LINES:</strong></p>
<span class="small">#{lines}#
<span style="display: block;">#[line]#</span>#{/lines}#
</span>

@ -148,7 +148,8 @@ public class CacheAdmin_p {
String[] t = document.getSectionTitles();
prop.put("info_type_headlines", t.length);
for (i = 0; i < t.length; i++)
prop.put("info_type_headlines_" + i + "_headline", t[i].replaceAll("\n", "").trim());
prop.put("info_type_headlines_" + i + "_headline",
de.anomic.data.wikiCode.replaceHTMLonly(t[i].replaceAll("\n", "").trim()));
formatAnchor(prop, document.getHyperlinks(), "links");
formatImageAnchor(prop, document.getImages());
@ -157,13 +158,15 @@ public class CacheAdmin_p {
formatAnchor(prop, document.getApplinks(), "apps");
formatAnchor(prop, document.getEmaillinks(), "email");
prop.put("info_type_text", new String(scraper.getText()));
prop.put("info_type_text",
de.anomic.data.wikiCode.replaceHTMLonly(new String(scraper.getText())));
i = 0;
final Iterator sentences = document.getSentences(false);
if (sentences != null)
while (sentences.hasNext()) {
prop.put("info_type_lines_" + i + "_line", sentences.next().toString().replaceAll("\n", "").trim());
prop.put("info_type_lines_" + i + "_line",
de.anomic.data.wikiCode.replaceHTMLonly(sentences.next().toString().replaceAll("\n", "").trim()));
i++;
}
prop.put("info_type_lines", i);
@ -257,29 +260,34 @@ public class CacheAdmin_p {
final Iterator iter = anchor.entrySet().iterator();
String descr;
Map.Entry entry;
prop.put("info_type_" + extension, anchor.size());
prop.put("info_type_use." + extension + "_" + extension, anchor.size());
int i = 0;
while (iter.hasNext()) {
entry = (Map.Entry) iter.next();
descr = ((String) entry.getValue()).trim();
if (descr.length() == 0) { descr = "-"; }
prop.put("info_type_" + extension + "_" + i + "_name", descr.replaceAll("\n", "").trim());
prop.put("info_type_" + extension + "_" + i + "_link", entry.getKey());
prop.put("info_type_use." + extension + "_" + extension + "_" + i + "_name",
de.anomic.data.wikiCode.replaceHTMLonly(descr.replaceAll("\n", "").trim()));
prop.put("info_type_use." + extension + "_" + extension + "_" + i + "_link",
de.anomic.data.wikiCode.replaceHTMLonly(entry.getKey().toString()));
i++;
}
prop.put("info_type_use." + extension, (i == 0) ? 0 : 1);
}
private static void formatImageAnchor(serverObjects prop, TreeSet anchor) {
final Iterator iter = anchor.iterator();
htmlFilterImageEntry ie;
prop.put("info_type_images", anchor.size());
prop.put("info_type_use.images_images", anchor.size());
int i = 0;
while (iter.hasNext()) {
ie = (htmlFilterImageEntry) iter.next();
prop.put("info_type_images_" + i + "_name", ie.alt().replaceAll("\n", "").trim());
prop.put("info_type_images_" + i + "_link", ie.url().toNormalform());
prop.put("info_type_use.images_images_" + i + "_name", ie.alt().replaceAll("\n", "").trim());
prop.put("info_type_use.images_images_" + i + "_link",
de.anomic.data.wikiCode.replaceHTMLonly(ie.url().toNormalform()));
i++;
}
prop.put("info_type_use.images", (i == 0) ? 0 : 1);
}
private static void linkPathString(serverObjects prop, String path, boolean dir) {

Loading…
Cancel
Save