Add tagging overlay element

Conflicts:
	htroot/env/templates/jqueryheader.template
	htroot/yacysearchitem.java
	source/net/yacy/interaction/Interaction.java
pull/1/head
cominch 13 years ago committed by Michael Peter Christen
parent bee3bee8f3
commit bde07ed7a8

@ -51,6 +51,9 @@
</p> </p>
#%env/templates/footer.template%#
</body> </body>

@ -1,7 +1,12 @@
<!-- jQuery header /env/jqueryheader.template --> <!-- 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="/currentyacypeer/query/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" /> <link media="screen" type="text/css" href="/currentyacypeer/jquery/css/jquery-ui-combobox.css" rel="stylesheet" />
<script src="/jquery/js/jquery-1.7.min.js" type="text/javascript"></script> <link media="screen" type="text/css" href="/currentyacypeer/jquery/slider/jquery.slider.min.css" rel="stylesheet" />
<script src="/jquery/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script> <script src="/currentyacypeer/jquery/js/jquery-1.7.min.js" type="text/javascript"></script>
<script src="/jquery/js/jquery-ui-combobox.js" type="text/javascript"></script> <script src="/currentyacypeer/jquery/js/jquery-ui-1.8.16.custom.min.js" type="text/javascript"></script>
<!-- END jQuery header --> <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 -->

@ -58,26 +58,34 @@ document <img src="/currentyacypeer/env/grafics/bad.png" width="16px" height="16
</div> --> </div> -->
<div id="sidebar-element" class="sci_panel" style="top: 110px;"> <div id="sidebar-element" class="sci_panel" style="top: 110px;">
<input id="SliderSingle" type="slider" name="price" value="20" /> <input type="text" name="tags" id="tags" class="bm_input" size="80" />
<script type="text/javascript" charset="utf-8"> <script type="text/javascript" charset="utf-8">
$("#SliderSingle").slider(
{ var oldvalue = loadvalue ('#[link]#', 'http://virtual.x/hastags');
from: 0,
to: 100, document.getElementById('tags').value = oldvalue;
step: 2.5,
round: 1, $('#tags').tagsInput({
format: { format: '##.0', locale: 'de'}, 'height':'105px',
dimension: '&nbsp;', 'width':'270px',
skin: 'round', 'interactive':true,
onstatechange: function(value) { 'removeWithBackspace' : true,
triple ('#[link]#', '#[link]#', 'http://virtual.x/hasvalue', value, '#[username]#'); 'minChars' : 0,
} 'maxChars' : 0,
} 'placeholderColor' : '#666666',
); 'onChange' : function () {
</script> storevalue ('#[link]#', 'http://virtual.x/hastags', document.getElementById('tags').value);
}
});
</script>
</div> </div>

@ -29,9 +29,11 @@ package interaction;
//javac -classpath .:../classes ViewLog_p.java //javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT //if the shell's current path is HTROOT
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction; import net.yacy.interaction.Interaction;
import net.yacy.search.Switchboard; import net.yacy.search.Switchboard;
import de.anomic.data.UserDB;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch; import de.anomic.server.serverSwitch;
@ -42,6 +44,56 @@ public class Triple {
final Switchboard sb = (Switchboard) env; final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects(); 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 url = "";
String s = ""; String s = "";
@ -75,11 +127,11 @@ public class Triple {
if (post.containsKey("load")) { if (post.containsKey("load")) {
o = Interaction.TripleGet(s, p); o = Interaction.TripleGet(s, p, username);
} else { } else {
Interaction.Triple(url, s, p, o, from); Interaction.Triple(url, s, p, o, username);
} }
prop.put("result", o); prop.put("result", o);

@ -177,7 +177,7 @@ public class yacysearchitem {
} }
} }
prop.putHTML("content_link", modifyURL); 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 // END interaction
prop.putHTML("content_target", target); prop.putHTML("content_target", target);

@ -449,34 +449,26 @@ public static String Contribution(String url, String comment, String from, Strin
return ""; return "";
} }
public static String Triple(String url, String s, String p, String o, String from) { public static String Triple(String url, String s, String p, String o, String from) {
Resource r = TripleStore.model.getResource(s+"/"+from);
final Switchboard sb = Switchboard.getSwitchboard(); Property pr = TripleStore.model.getProperty(p);
TripleStore.model.removeAll(r, pr, (Resource) null);
Resource r = TripleStore.model.getResource(s); r.addProperty(pr, o);
Property pr = TripleStore.model.createProperty(p); Log.logInfo ("TRIPLESTORE", "PUT "+from+" / "+s+" - "+p+" - "+o);
return "";
r.addProperty(pr, o);
Log.logInfo ("TRIPLESTORE", "PUT "+s+"-"+p+"-"+o);
return "";
} }
public static String TripleGet(String s, String p) { public static String TripleGet(String s, String p, String username) {
Resource r = TripleStore.model.getResource(s+"/"+username);
final Switchboard sb = Switchboard.getSwitchboard();
Resource r = TripleStore.model.getResource(s);
Property pr = TripleStore.model.getProperty(p); Property pr = TripleStore.model.getProperty(p);
StmtIterator iter = TripleStore.model.listStatements(r, pr, (Resource) null); StmtIterator iter = TripleStore.model.listStatements(r, pr, (Resource) null);
Log.logInfo ("TRIPLESTORE", "GET "+s+" - "+p); Log.logInfo ("TRIPLESTORE", "GET "+s+" - "+p);
while (iter.hasNext()) { while (iter.hasNext()) {
String obj = iter.nextStatement().getObject().toString();
return (iter.nextStatement().getObject().toString()); Log.logInfo ("TRIPLESTORE", "GET "+username+" / "+s+" - "+p+" - "+obj);
return (obj);
} }
return ""; return "";
@ -485,9 +477,6 @@ public static String TripleGet(String s, String p) {
public static String GetContribution(String url) { public static String GetContribution(String url) {
final Switchboard sb = Switchboard.getSwitchboard();
// Boolean processlocal = false; // Boolean processlocal = false;
// //
// if (!sb.getConfig("interaction.contribution.accumulationpeer", "").equals("")) { // if (!sb.getConfig("interaction.contribution.accumulationpeer", "").equals("")) {

Loading…
Cancel
Save