Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Add tagging overlay element

cominchbde07ed7a85d
diff --git a/htroot/DemoServletInteraction.html b/htroot/DemoServletInteraction.html
index 94e81bce8..c455e5d60 100644
--- a/htroot/DemoServletInteraction.html
+++ b/htroot/DemoServletInteraction.html
@@ -51,6 +51,9 @@
</p>
+
+
+ #%env/templates/footer.template%#
</body>
diff --git a/htroot/env/templates/jqueryheader.template b/htroot/env/templates/jqueryheader.template
index cbe12c4e7..235119203 100644
--- a/htroot/env/templates/jqueryheader.template
+++ b/htroot/env/templates/jqueryheader.template
@@ -1,7 +1,12 @@
<!-- jQuery header /env/jqueryheader.template -->
- <link media="screen" type="text/css" href="/jquery/themes/start/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
- <link media="screen" type="text/css" href="/jquery/css/jquery-ui-combobox.css" rel="stylesheet" />
- <script src="/jquery/js/jquery-1.7.min.js" type="text/javascript"></script>
- <script src="/jquery/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
- <script src="/jquery/js/jquery-ui-combobox.js" type="text/javascript"></script>
- <!-- END jQuery header -->
\ No newline at end of file
+ <link media="screen" type="text/css" href="/currentyacypeer/query/themes/start/jquery-ui-1.8.16.custom.css" rel="stylesheet" />
+ <link media="screen" type="text/css" href="/currentyacypeer/jquery/css/jquery-ui-combobox.css" rel="stylesheet" />
+ <link media="screen" type="text/css" href="/currentyacypeer/jquery/slider/jquery.slider.min.css" rel="stylesheet" />
+ <script src="/currentyacypeer/jquery/js/jquery-1.7.min.js" type="text/javascript"></script>
+ <script src="/currentyacypeer/jquery/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
+ <script src="/currentyacypeer/jquery/js/jquery-ui-combobox.js" type="text/javascript"></script>
+ <script src="/currentyacypeer/jquery/slider/jquery.slider.min.js" type="text/javascript"></script>
+
+ <link media="screen" type="text/css" href="/currentyacypeer/jquery/css/jquery.tagsinput.css" rel="stylesheet" />
+ <script src="/currentyacypeer/jquery/js/jquery.tagsinput.min.js" type="text/javascript"></script>
+<!-- END jQuery header -->
diff --git a/htroot/interaction/OverlayInteraction.html b/htroot/interaction/OverlayInteraction.html
index d3fea7278..d68b4569a 100644
--- a/htroot/interaction/OverlayInteraction.html
+++ b/htroot/interaction/OverlayInteraction.html
@@ -58,26 +58,34 @@ document <img src="/currentyacypeer/env/grafics/bad.png" width="16px" height="16
</div> -->
+
<div id="sidebar-element" class="sci_panel" style="top: 110px;">
-<input id="SliderSingle" type="slider" name="price" value="20" />
-
-<script type="text/javascript" charset="utf-8">
- $("#SliderSingle").slider(
- {
- from: 0,
- to: 100,
- step: 2.5,
- round: 1,
- format: { format: '##.0', locale: 'de'},
- dimension: '&nbsp;',
- skin: 'round',
- onstatechange: function(value) {
- triple ('#[link]#', '#[link]#', 'http://virtual.x/hasvalue', value, '#[username]#');
- }
- }
- );
-</script>
+<input type="text" name="tags" id="tags" class="bm_input" size="80" />
+
+ <script type="text/javascript" charset="utf-8">
+
+ var oldvalue = loadvalue ('#[link]#', 'http://virtual.x/hastags');
+
+ document.getElementById('tags').value = oldvalue;
+
+ $('#tags').tagsInput({
+ 'height':'105px',
+ 'width':'270px',
+ 'interactive':true,
+ 'removeWithBackspace' : true,
+ 'minChars' : 0,
+ 'maxChars' : 0,
+ 'placeholderColor' : '#666666',
+ 'onChange' : function () {
+ storevalue ('#[link]#', 'http://virtual.x/hastags', document.getElementById('tags').value);
+ }
+ });
+
+
+
+ </script>
+
</div>
diff --git a/htroot/interaction/Triple.java b/htroot/interaction/Triple.java
index 4dd06ef96..f183049ae 100644
--- a/htroot/interaction/Triple.java
+++ b/htroot/interaction/Triple.java
@@ -29,9 +29,11 @@ package interaction;
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT
+import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
import net.yacy.search.Switchboard;
+import de.anomic.data.UserDB;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@@ -42,6 +44,56 @@ public class Triple {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
+
+ UserDB.Entry entry=null;
+
+
+
+ //default values
+ prop.put("enabled_logged_in", "0");
+ prop.put("enabled_logged-in_limit", "0");
+ String username = "anonymous";
+ prop.put("enabled_status", "0");
+ //identified via HTTPPassword
+ entry=sb.userDB.proxyAuth((header.get(RequestHeader.AUTHORIZATION, "xxxxxx")));
+ if(entry != null){
+ prop.put("enabled_logged-in_identified-by", "1");
+ //try via cookie
+ }else{
+ entry=sb.userDB.cookieAuth(header.getHeaderCookies());
+ prop.put("enabled_logged-in_identified-by", "2");
+ //try via ip
+ if(entry == null){
+ entry=sb.userDB.ipAuth((header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
+ if(entry != null){
+ prop.put("enabled_logged-in_identified-by", "0");
+ }
+ }
+ }
+
+ //identified via userDB
+ if(entry != null){
+ prop.put("enabled_logged-in", "1");
+ username = entry.getUserName();
+ if(entry.getTimeLimit() > 0){
+ prop.put("enabled_logged-in_limit", "1");
+ final long limit=entry.getTimeLimit();
+ final long used=entry.getTimeUsed();
+ prop.put("enabled_logged-in_limit_timelimit", limit);
+ prop.put("enabled_logged-in_limit_timeused", used);
+ int percent=0;
+ if(limit!=0 && used != 0)
+ percent=(int)((float)used/(float)limit*100);
+ prop.put("enabled_logged-in_limit_percent", percent/3);
+ prop.put("enabled_logged-in_limit_percent2", (100-percent)/3);
+ }
+ //logged in via static Password
+ }else if(sb.verifyAuthentication(header)){
+ prop.put("enabled_logged-in", "2");
+ username = "staticadmin";
+ //identified via form-login
+ //TODO: this does not work for a static admin, yet.
+ }
String url = "";
String s = "";
@@ -75,11 +127,11 @@ public class Triple {
if (post.containsKey("load")) {
- o = Interaction.TripleGet(s, p);
+ o = Interaction.TripleGet(s, p, username);
} else {
- Interaction.Triple(url, s, p, o, from);
+ Interaction.Triple(url, s, p, o, username);
}
prop.put("result", o);
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index d900983dd..c067919b2 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -177,7 +177,7 @@ public class yacysearchitem {
}
}
prop.putHTML("content_link", modifyURL);
- prop.putHTML("content_value", Interaction.TripleGet(result.urlstring(), "http://virtual.x/hasvalue"));
+ prop.putHTML("content_value", Interaction.TripleGet(result.urlstring(), "http://virtual.x/hasvalue", "anonymous"));
// END interaction
prop.putHTML("content_target", target);
diff --git a/source/net/yacy/interaction/Interaction.java b/source/net/yacy/interaction/Interaction.java
index 007bf1cc1..11bd984dc 100644
--- a/source/net/yacy/interaction/Interaction.java
+++ b/source/net/yacy/interaction/Interaction.java
@@ -449,34 +449,26 @@ public static String Contribution(String url, String comment, String from, Strin
return "";
}
-public static String Triple(String url, String s, String p, String o, String from) {
-
- final Switchboard sb = Switchboard.getSwitchboard();
-
- Resource r = TripleStore.model.getResource(s);
- Property pr = TripleStore.model.createProperty(p);
-
- r.addProperty(pr, o);
-
- Log.logInfo ("TRIPLESTORE", "PUT "+s+"-"+p+"-"+o);
-
- return "";
+public static String Triple(String url, String s, String p, String o, String from) {
+ Resource r = TripleStore.model.getResource(s+"/"+from);
+ Property pr = TripleStore.model.getProperty(p);
+ TripleStore.model.removeAll(r, pr, (Resource) null);
+ r.addProperty(pr, o);
+ Log.logInfo ("TRIPLESTORE", "PUT "+from+" / "+s+" - "+p+" - "+o);
+ return "";
}
-public static String TripleGet(String s, String p) {
-
- final Switchboard sb = Switchboard.getSwitchboard();
-
- Resource r = TripleStore.model.getResource(s);
+public static String TripleGet(String s, String p, String username) {
+ Resource r = TripleStore.model.getResource(s+"/"+username);
Property pr = TripleStore.model.getProperty(p);
StmtIterator iter = TripleStore.model.listStatements(r, pr, (Resource) null);
-
Log.logInfo ("TRIPLESTORE", "GET "+s+" - "+p);
-
+
while (iter.hasNext()) {
-
- return (iter.nextStatement().getObject().toString());
+ String obj = iter.nextStatement().getObject().toString();
+ Log.logInfo ("TRIPLESTORE", "GET "+username+" / "+s+" - "+p+" - "+obj);
+ return (obj);
}
return "";
@@ -485,9 +477,6 @@ public static String TripleGet(String s, String p) {
public static String GetContribution(String url) {
- final Switchboard sb = Switchboard.getSwitchboard();
-
-
// Boolean processlocal = false;
//
// if (!sb.getConfig("interaction.contribution.accumulationpeer", "").equals("")) {