parent
bef823c247
commit
c90f174799
@ -1,139 +0,0 @@
|
|||||||
#(enabled)#::
|
|
||||||
|
|
||||||
<style type="text/css" >
|
|
||||||
/* Menu */
|
|
||||||
|
|
||||||
.menugroup h3 {
|
|
||||||
-webkit-border-top-left-radius: 5px;
|
|
||||||
-webkit-border-top-right-radius: 5px;
|
|
||||||
-khtml-border-top-left-radius: 5px;
|
|
||||||
-khtml-border-top-right-radius: 5px;
|
|
||||||
-moz-border-radius-topleft: 5px;
|
|
||||||
-moz-border-radius-topright: 5px;
|
|
||||||
border-top-left-radius: 5px;
|
|
||||||
border-top-right-radius: 5px;
|
|
||||||
|
|
||||||
background-color: #[color_tableheader]#;
|
|
||||||
color:white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.SubMenugroup h3, .SubMenu h3 {
|
|
||||||
-webkit-border-radius: 5px;
|
|
||||||
-khtml-border-radius: 5px;
|
|
||||||
-moz-border-radius: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
|
|
||||||
background-color:#[color_tableheader]#;
|
|
||||||
color:white;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.MenuItemLink, ul.SubMenu em {
|
|
||||||
background-color:#[color_tableitem]#;
|
|
||||||
color:#[color_text]#;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover.MenuItemLink {
|
|
||||||
background-color:transparent;
|
|
||||||
color:#[color_text]#;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.SubMenu a.MenuItemLink {
|
|
||||||
margin-top:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.MenuItemLink{
|
|
||||||
display:block;
|
|
||||||
text-decoration:none;
|
|
||||||
margin-top:1px;
|
|
||||||
margin-bottom:1px;
|
|
||||||
padding:1px 10px 1px 15px;
|
|
||||||
font-size:0.9em;
|
|
||||||
white-space:nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
li.menugroup a {
|
|
||||||
white-space:normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.MenuItemLink.lock{
|
|
||||||
background-image:url(/env/grafics/lock.gif);
|
|
||||||
background-position:2px center;
|
|
||||||
background-repeat:no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover.MenuItemLink {
|
|
||||||
text-decoration:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.SubMenu em {
|
|
||||||
margin-top:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.SubMenu em.lock {
|
|
||||||
background-image:url(/env/grafics/lock.gif);
|
|
||||||
background-position:2px center;
|
|
||||||
background-repeat:no-repeat;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.SubMenu em {
|
|
||||||
display:block;
|
|
||||||
text-decoration:none;
|
|
||||||
margin-top:1px;
|
|
||||||
margin-bottom:1px;
|
|
||||||
padding:1px 10px 1px 15px;
|
|
||||||
font-size:0.9em;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* <ul>, <li> */
|
|
||||||
|
|
||||||
ul.tagList {
|
|
||||||
list-style:none;
|
|
||||||
padding:0;
|
|
||||||
margin-left:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ul.menu, ul.SubMenu {
|
|
||||||
clear:left;
|
|
||||||
padding:0;
|
|
||||||
margin:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.menu li, ul.SubMenu li {
|
|
||||||
list-style:none;
|
|
||||||
margin:0;
|
|
||||||
margin-top:1px;
|
|
||||||
padding:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul.SubMenu li {
|
|
||||||
float:left;
|
|
||||||
margin-right:1px;
|
|
||||||
margin-top:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
li.menugroup {
|
|
||||||
margin-left:5px;
|
|
||||||
margin-bottom:10px;
|
|
||||||
list-style:none;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
#(feedbackenabled)#::<!--#include virtual="/interaction/Feedback_part.html" -->#(/feedbackenabled)#
|
|
||||||
#(addcontentenabled)#::<!--#include virtual="/interaction/Suggest_part.html" -->#(/addcontentenabled)#
|
|
||||||
#(userlogonenabled)#::<!--#include virtual="/interaction/Login_part.html" -->#(/userlogonenabled)#
|
|
||||||
|
|
||||||
<!--#include virtual="/interaction/Category_part.html" -->
|
|
||||||
|
|
||||||
<div class="SubMenu" style="position: fixed; bottom: 0px; width: 100%;">
|
|
||||||
|
|
||||||
<ul class="SubMenu">
|
|
||||||
#(addcontentenabled)#::<li style="width:#[ratio]#%;"><a id="add_trigger" href="" class="MenuItemLink" style="color: #fff; background-color: #5A346E;" onclick="addclicker(); return false;">suggest a website</a></li>#(/addcontentenabled)#
|
|
||||||
#(userlogonenabled)#::<li style="width:#[ratio]#%;"><!--#include virtual="/interaction/Loginbutton_part.html" --></li>#(/userlogonenabled)#
|
|
||||||
#(feedbackenabled)#::<li style="width:#[ratio]#%;"><a id="feedback_trigger" href="" class="MenuItemLink" style="color: #fff; background-color: #5A346E;" onclick="clicker(); return false;">feedback</a></li>#(/feedbackenabled)#
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
#(/enabled)#
|
|
@ -1,299 +0,0 @@
|
|||||||
#(enabled)#::
|
|
||||||
|
|
||||||
<style type="text/css" >
|
|
||||||
|
|
||||||
.sci_panel {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:1px solid #5a346e;
|
|
||||||
|
|
||||||
width: 210px;
|
|
||||||
height: auto;
|
|
||||||
padding: 30px 110px 30px 30px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_right {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 10px;
|
|
||||||
top: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 65px;
|
|
||||||
height: 20px;
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_tags {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 100px;
|
|
||||||
top: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 65px;
|
|
||||||
height: 20px;
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.sci_hide {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 0px;
|
|
||||||
top: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 30px;
|
|
||||||
height: 20px;
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_left {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 50px;
|
|
||||||
top: 0;
|
|
||||||
margin-top: 1px;
|
|
||||||
padding-left: 50px;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 250px;
|
|
||||||
height: 19px;
|
|
||||||
padding: 9px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_panel p{
|
|
||||||
margin: 0 0 15px 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #cccccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_panel a, .sci_panel a:visited{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #9FC54E;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid #9FC54E;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_panel a:hover, .sci_panel a:visited:hover{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #ffffff;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_headerbar {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 0px;;
|
|
||||||
width: 100%;
|
|
||||||
height: 35px;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
background: #ffffff;
|
|
||||||
|
|
||||||
padding: 0px 0px 0px 0px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_bar {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 35px;;
|
|
||||||
width: 100%;
|
|
||||||
height: 2px;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
background: #5a346e;
|
|
||||||
|
|
||||||
padding: 0px 0px 0px 0px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_masterbutton {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 0px;
|
|
||||||
top: -15px;
|
|
||||||
|
|
||||||
width: 0px;
|
|
||||||
height: 65px;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
background: #5a346e;
|
|
||||||
|
|
||||||
padding: 0px 0px 0px 0px;
|
|
||||||
|
|
||||||
z-index:99999;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-button" class="sci_masterbutton" style="">
|
|
||||||
<img src="/currentyacypeer/env/grafics/sciety.png" onclick="$('.sci_headerbar').toggle(); "/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sci_headerbar" class="sci_headerbar">
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-bar" class="sci_bar" style="">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-source" class="sci_left" style="">
|
|
||||||
|
|
||||||
<!--#include virtual="/interaction/Scibutton_part.html?details=true&url=#[link]#" -->
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sidebar-source" class="sci_tags" style="">
|
|
||||||
|
|
||||||
<img id="scitag" src="/currentyacypeer/env/grafics/tag.png" width="20px" height="20px" alt="0" onclick="$('#sidebar-tags').toggle(); return false"> <span style="font-size: x-small; position: absolute; margin-top: 4px;">tags</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sidebar-document" class="sci_right" style="">
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
|
|
||||||
function toggleit() {
|
|
||||||
|
|
||||||
var a = $('#scilight').attr('alt');
|
|
||||||
|
|
||||||
if (a == '0') {
|
|
||||||
|
|
||||||
$('#scilight').attr('alt', "1");
|
|
||||||
$('#scilight').attr('src', "/currentyacypeer/env/grafics/scilight_1.png");
|
|
||||||
storevalue_t ('#[link]#', 'scivote', '1');
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$('#scilight').attr('alt', "0");
|
|
||||||
$('#scilight').attr('src', "/currentyacypeer/env/grafics/scilight_0.png");
|
|
||||||
storevalue_t ('#[link]#', 'scivote', '0');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<img id="scilight" src="/currentyacypeer/env/grafics/scilight_0.png" width="20px" height="20px" alt="0" onclick="toggleit(); return false"> <span style="font-size: x-small; position: absolute; margin-top: 4px;">scilight</span>
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
|
|
||||||
if (loadvalue_t ('#[link]#', 'scivote') == '1') {
|
|
||||||
$('#scilight').attr('alt', '1');
|
|
||||||
$('#scilight').attr('src', '/currentyacypeer/env/grafics/scilight_1.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-tags" class="sci_panel" style="top: 50px; display: none;">
|
|
||||||
|
|
||||||
<input type="text" name="tags" id="tags" class="bm_input" size="80" />
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
|
|
||||||
var oldvalue = loadvalue_t ('#[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_t ('#[link]#', 'http://virtual.x/hastags', document.getElementById('tags').value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
#(/enabled)#
|
|
@ -1,100 +0,0 @@
|
|||||||
package interaction;
|
|
||||||
|
|
||||||
//ViewLog_p.java
|
|
||||||
//-----------------------
|
|
||||||
//part of the AnomicHTTPD caching proxy
|
|
||||||
//(C) by Michael Peter Christen; mc@yacy.net
|
|
||||||
//first published on http://www.anomic.de
|
|
||||||
//Frankfurt, Germany, 2004
|
|
||||||
//
|
|
||||||
//This File is contributed by Alexander Schier
|
|
||||||
//last major change: 14.12.2004
|
|
||||||
//
|
|
||||||
//This program is free software; you can redistribute it and/or modify
|
|
||||||
//it under the terms of the GNU General Public License as published by
|
|
||||||
//the Free Software Foundation; either version 2 of the License, or
|
|
||||||
//(at your option) any later version.
|
|
||||||
//
|
|
||||||
//This program is distributed in the hope that it will be useful,
|
|
||||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
//GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//You should have received a copy of the GNU General Public License
|
|
||||||
//along with this program; if not, write to the Free Software
|
|
||||||
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
//You must compile this file with
|
|
||||||
//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.search.Switchboard;
|
|
||||||
import de.anomic.data.UserDB;
|
|
||||||
import de.anomic.server.serverObjects;
|
|
||||||
import de.anomic.server.serverSwitch;
|
|
||||||
|
|
||||||
public class OverlayInteraction {
|
|
||||||
|
|
||||||
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
|
||||||
|
|
||||||
final Switchboard sb = (Switchboard) env;
|
|
||||||
|
|
||||||
final serverObjects prop = new serverObjects();
|
|
||||||
|
|
||||||
|
|
||||||
prop.put("enabled", "1");
|
|
||||||
|
|
||||||
UserDB.Entry entry=null;
|
|
||||||
|
|
||||||
prop.put("enabled_username", "anonymous");
|
|
||||||
|
|
||||||
prop.put("enabled_link", post.get("link", ""));
|
|
||||||
|
|
||||||
//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");
|
|
||||||
prop.put("enabled_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");
|
|
||||||
prop.put("enabled_username", "staticadmin");
|
|
||||||
//identified via form-login
|
|
||||||
//TODO: this does not work for a static admin, yet.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return prop;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,304 +0,0 @@
|
|||||||
#(enabled)#::
|
|
||||||
|
|
||||||
<style type="text/css" >
|
|
||||||
|
|
||||||
.sci_panel {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:1px solid #5a346e;
|
|
||||||
|
|
||||||
width: 210px;
|
|
||||||
height: auto;
|
|
||||||
padding: 30px 110px 30px 30px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_right {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 10px;
|
|
||||||
top: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 65px;
|
|
||||||
height: 20px;
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_tags {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 100px;
|
|
||||||
top: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 65px;
|
|
||||||
height: 20px;
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.sci_hide {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
right: 0px;
|
|
||||||
top: 0;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 30px;
|
|
||||||
height: 20px;
|
|
||||||
padding: 5px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_left {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 50px;
|
|
||||||
top: 0;
|
|
||||||
margin-top: 1px;
|
|
||||||
padding-left: 50px;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
width: 250px;
|
|
||||||
height: 19px;
|
|
||||||
padding: 9px 5px 5px 5px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
color: #5a346e;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_panel p{
|
|
||||||
margin: 0 0 15px 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #cccccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_panel a, .sci_panel a:visited{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #9FC54E;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid #9FC54E;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_panel a:hover, .sci_panel a:visited:hover{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
color: #ffffff;
|
|
||||||
text-decoration: none;
|
|
||||||
border-bottom: 1px solid #ffffff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_headerbar {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 0px;;
|
|
||||||
width: 100%;
|
|
||||||
height: 35px;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
background: #ffffff;
|
|
||||||
|
|
||||||
padding: 0px 0px 0px 0px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_bar {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 0;
|
|
||||||
top: 35px;;
|
|
||||||
width: 100%;
|
|
||||||
height: 2px;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
background: #5a346e;
|
|
||||||
|
|
||||||
padding: 0px 0px 0px 0px;
|
|
||||||
|
|
||||||
z-index:99998;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.sci_masterbutton {
|
|
||||||
|
|
||||||
font: arial,helvetica,sans-serif;
|
|
||||||
font-size: 10px;
|
|
||||||
position: fixed;
|
|
||||||
left: 0px;
|
|
||||||
top: -15px;
|
|
||||||
|
|
||||||
width: 0px;
|
|
||||||
height: 65px;
|
|
||||||
background: #ffffff;
|
|
||||||
border:0px;
|
|
||||||
|
|
||||||
background: #5a346e;
|
|
||||||
|
|
||||||
padding: 0px 0px 0px 0px;
|
|
||||||
|
|
||||||
z-index:99999;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-button" class="sci_masterbutton" style="">
|
|
||||||
<img src="/currentyacypeer/env/grafics/sciety.png" onclick="$('.sci_headerbar').toggle(); "/>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sci_headerbar" class="sci_headerbar">
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-bar" class="sci_bar" style="">
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-source" class="sci_left" style="">
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sidebar-source" class="sci_tags" style="">
|
|
||||||
|
|
||||||
<img id="scitag" src="/currentyacypeer/env/grafics/tag.png" width="20px" height="20px" alt="0" onclick="$('#sidebar-tags').toggle(); return false"> <span style="font-size: x-small; position: absolute; margin-top: 4px;">tags</span>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="sidebar-document" class="sci_right" style="">
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function toggleit() {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
thing('#[link]#', 'title');
|
|
||||||
|
|
||||||
var a = $('#scilight').attr('alt');
|
|
||||||
|
|
||||||
if (a == '0') {
|
|
||||||
|
|
||||||
$('#scilight').attr('alt', "1");
|
|
||||||
$('#scilight').attr('src', "/currentyacypeer/env/grafics/scilight_1.png");
|
|
||||||
storevalue_t ('#[link]#', 'scivote', '1');
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
$('#scilight').attr('alt', "0");
|
|
||||||
$('#scilight').attr('src', "/currentyacypeer/env/grafics/scilight_0.png");
|
|
||||||
storevalue_t ('#[link]#', 'scivote', '0');
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<img id="scilight" src="/currentyacypeer/env/grafics/scilight_0.png" width="20px" height="20px" alt="0" onclick="toggleit(); return false"> <span style="font-size: x-small; position: absolute; margin-top: 4px;">scilight</span>
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
|
|
||||||
if (loadvalue_t ('#[link]#', 'scivote') == '1') {
|
|
||||||
$('#scilight').attr('alt', '1');
|
|
||||||
$('#scilight').attr('src', '/currentyacypeer/env/grafics/scilight_1.png');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="sidebar-tags" class="sci_panel" style="top: 50px; display: none;">
|
|
||||||
|
|
||||||
<input type="text" name="tags" id="tags" class="bm_input" size="80" />
|
|
||||||
|
|
||||||
<script type="text/javascript" charset="utf-8">
|
|
||||||
|
|
||||||
var oldvalue = loadvalue_t ('#[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_t ('#[link]#', 'http://virtual.x/hastags', document.getElementById('tags').value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
|
|
||||||
#(/enabled)#
|
|
@ -1,100 +0,0 @@
|
|||||||
package interaction;
|
|
||||||
|
|
||||||
//ViewLog_p.java
|
|
||||||
//-----------------------
|
|
||||||
//part of the AnomicHTTPD caching proxy
|
|
||||||
//(C) by Michael Peter Christen; mc@yacy.net
|
|
||||||
//first published on http://www.anomic.de
|
|
||||||
//Frankfurt, Germany, 2004
|
|
||||||
//
|
|
||||||
//This File is contributed by Alexander Schier
|
|
||||||
//last major change: 14.12.2004
|
|
||||||
//
|
|
||||||
//This program is free software; you can redistribute it and/or modify
|
|
||||||
//it under the terms of the GNU General Public License as published by
|
|
||||||
//the Free Software Foundation; either version 2 of the License, or
|
|
||||||
//(at your option) any later version.
|
|
||||||
//
|
|
||||||
//This program is distributed in the hope that it will be useful,
|
|
||||||
//but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
//GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
//You should have received a copy of the GNU General Public License
|
|
||||||
//along with this program; if not, write to the Free Software
|
|
||||||
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
|
|
||||||
|
|
||||||
//You must compile this file with
|
|
||||||
//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.search.Switchboard;
|
|
||||||
import de.anomic.data.UserDB;
|
|
||||||
import de.anomic.server.serverObjects;
|
|
||||||
import de.anomic.server.serverSwitch;
|
|
||||||
|
|
||||||
public class OverlayReview {
|
|
||||||
|
|
||||||
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
|
|
||||||
|
|
||||||
final Switchboard sb = (Switchboard) env;
|
|
||||||
|
|
||||||
final serverObjects prop = new serverObjects();
|
|
||||||
|
|
||||||
|
|
||||||
prop.put("enabled", env.getConfigBool("interaction.overlayreview.enabled", true) ? "1" : "0");
|
|
||||||
|
|
||||||
UserDB.Entry entry=null;
|
|
||||||
|
|
||||||
prop.put("enabled_username", "anonymous");
|
|
||||||
|
|
||||||
prop.put("enabled_link", post.get("link", ""));
|
|
||||||
|
|
||||||
//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");
|
|
||||||
prop.put("enabled_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");
|
|
||||||
prop.put("enabled_username", "staticadmin");
|
|
||||||
//identified via form-login
|
|
||||||
//TODO: this does not work for a static admin, yet.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return prop;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function()
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
$('#sciety_trigger').click (function() {
|
|
||||||
|
|
||||||
$('#sciet_panel').toggle("fast");
|
|
||||||
$(this).toggleClass("active");
|
|
||||||
return false;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
|
||||||
|
|
||||||
#sciety_trigger {
|
|
||||||
|
|
||||||
font-size: 16px;
|
|
||||||
font-family: sans-serif;
|
|
||||||
|
|
||||||
position: fixed;
|
|
||||||
top: 160px;
|
|
||||||
right: 0px;
|
|
||||||
z-index: 99999;
|
|
||||||
border: 1px solid #444444;
|
|
||||||
padding: 20px 40px 20px 15px;
|
|
||||||
color: #fff;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
text-decoration: none;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<div class="sciety_trigger" id="sciety_trigger">
|
|
||||||
sciety
|
|
||||||
</div>
|
|
@ -1,23 +0,0 @@
|
|||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
#(forward)#::<meta http-equiv="REFRESH" content="0; url=#[target]#" />#(/forward)#
|
|
||||||
<title>YaCy '#[clientname]#': Add to sciety</title>
|
|
||||||
#%env/templates/metas.template%#
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body id="index">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div id="content">
|
|
||||||
|
|
||||||
<h4 class="portalheading">Suggest</h4>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#%env/templates/footer.template%#
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1 +0,0 @@
|
|||||||
thanks
|
|
@ -1,125 +0,0 @@
|
|||||||
package interaction;
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import net.yacy.yacy;
|
|
||||||
import net.yacy.cora.protocol.RequestHeader;
|
|
||||||
import net.yacy.interaction.Interaction;
|
|
||||||
import net.yacy.kelondro.logging.Log;
|
|
||||||
import net.yacy.search.Switchboard;
|
|
||||||
import de.anomic.data.UserDB;
|
|
||||||
import de.anomic.server.serverObjects;
|
|
||||||
import de.anomic.server.serverSwitch;
|
|
||||||
|
|
||||||
|
|
||||||
public class UploadSingleFile {
|
|
||||||
|
|
||||||
public static serverObjects respond(final RequestHeader header,
|
|
||||||
final serverObjects post, final serverSwitch env) {
|
|
||||||
final Switchboard sb = (Switchboard) env;
|
|
||||||
final serverObjects prop = new serverObjects();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (post != null){
|
|
||||||
|
|
||||||
|
|
||||||
if (post.containsKey("uploadfile") && !post.get("uploadfile").isEmpty()) {
|
|
||||||
|
|
||||||
UserDB.Entry entry = sb.userDB.getEntry(Interaction.GetLoggedOnUser(header));
|
|
||||||
|
|
||||||
if (entry != null) {
|
|
||||||
|
|
||||||
if (entry.hasRight(UserDB.AccessRight.UPLOAD_RIGHT)) {
|
|
||||||
|
|
||||||
// the user has the upload right
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
String targetfilename = post.get("uploadfile", "target.file");
|
|
||||||
|
|
||||||
String targetfolder = "/upload/"+Interaction.GetLoggedOnUser(header);
|
|
||||||
|
|
||||||
if (post.containsKey("targetfilename")) {
|
|
||||||
targetfilename = post.get("targetfilename");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if (post.containsKey("targetfolder")) {
|
|
||||||
targetfolder = post.get("targetfolder");
|
|
||||||
|
|
||||||
if (!targetfolder.startsWith("/")) {
|
|
||||||
targetfolder = "/" + targetfolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
File f = new File(yacy.dataHome_g, "DATA/HTDOCS"+targetfolder+"/");
|
|
||||||
|
|
||||||
yacy.mkdirsIfNeseccary (f);
|
|
||||||
|
|
||||||
f = new File(f, targetfilename);
|
|
||||||
|
|
||||||
Log.logInfo ("FILEUPLOAD", f.toString());
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
ByteArrayInputStream stream = new ByteArrayInputStream(post
|
|
||||||
.get("uploadfile$file").getBytes());
|
|
||||||
|
|
||||||
|
|
||||||
if (stream != null) {
|
|
||||||
|
|
||||||
OutputStream out;
|
|
||||||
|
|
||||||
|
|
||||||
out = new FileOutputStream(f.toString());
|
|
||||||
|
|
||||||
|
|
||||||
byte[] buf = new byte[1024];
|
|
||||||
int len;
|
|
||||||
while ((len = stream.read(buf)) > 0) {
|
|
||||||
out.write(buf, 0, len);
|
|
||||||
}
|
|
||||||
stream.close();
|
|
||||||
out.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// return rewrite properties
|
|
||||||
return prop;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
|||||||
/**
|
|
||||||
* Emulate FormData for some browsers
|
|
||||||
* MIT License
|
|
||||||
* (c) 2010 François de Metz
|
|
||||||
*/
|
|
||||||
(function(w) {
|
|
||||||
if (w.FormData)
|
|
||||||
return;
|
|
||||||
function FormData() {
|
|
||||||
this.fake = true;
|
|
||||||
this.boundary = "--------FormData" + Math.random();
|
|
||||||
this._fields = [];
|
|
||||||
}
|
|
||||||
FormData.prototype.append = function(key, value) {
|
|
||||||
this._fields.push([key, value]);
|
|
||||||
}
|
|
||||||
FormData.prototype.toString = function() {
|
|
||||||
var boundary = this.boundary;
|
|
||||||
var body = "";
|
|
||||||
this._fields.forEach(function(field) {
|
|
||||||
body += "--" + boundary + "\r\n";
|
|
||||||
// file upload
|
|
||||||
if (field[1].name) {
|
|
||||||
var file = field[1];
|
|
||||||
body += "Content-Disposition: form-data; name=\""+ field[0] +"\"; filename=\""+ file.name +"\"\r\n";
|
|
||||||
body += "Content-Type: "+ file.type +"\r\n\r\n";
|
|
||||||
body += file.getAsBinary() + "\r\n";
|
|
||||||
} else {
|
|
||||||
body += "Content-Disposition: form-data; name=\""+ field[0] +"\";\r\n\r\n";
|
|
||||||
body += field[1] + "\r\n";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
body += "--" + boundary +"--";
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
w.FormData = FormData;
|
|
||||||
})(window);
|
|
@ -1,405 +0,0 @@
|
|||||||
function newload (name, div) {
|
|
||||||
|
|
||||||
$.get(name, function(data) {
|
|
||||||
|
|
||||||
$('#'+div).html(data);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function xmlToString (xmlData) {
|
|
||||||
|
|
||||||
var xmlString;
|
|
||||||
|
|
||||||
if (window.ActiveXObject) {
|
|
||||||
xmlString = xmlData.xml;
|
|
||||||
}
|
|
||||||
|
|
||||||
else {
|
|
||||||
xmlString = (new XMLSerializer()).serializeToString(xmlData);
|
|
||||||
}
|
|
||||||
|
|
||||||
return xmlString;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function rdfload (datastore) {
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
type : "GET",
|
|
||||||
url: "/currentyacypeer/interaction/GetRDF.xml?global=true",
|
|
||||||
dataType: "xml",
|
|
||||||
success: function(xml) {
|
|
||||||
datastore.load(xml);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function feedback (url, comment, from) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Feedback.json?url='+url+'&comment='+comment+'&from='+from, function(data) {
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function suggest (url) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Suggest.json?url='+url, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function contribution (url, comment, username) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Contribution.json?url='+url+'&comment='+comment+'&from='+username, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function triple (url, s, p, o, username) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Triple.json?url='+url+'&s='+s+'&p='+p+'&o='+o+'&from='+username, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function storevalue_t (s, p, o) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Table.json?url='+s+'&s='+s+'&p='+p+'&o='+o, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function storevalueglobal_t (s, p, o) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Table.json?global=true&url='+s+'&s='+s+'&p='+p+'&o='+o, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function storevalue (s, p, o) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Triple.json?url='+s+'&s='+s+'&p='+p+'&o='+o, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function storevalueglobal (s, p, o) {
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Triple.json?global=true&url='+s+'&s='+s+'&p='+p+'&o='+o, function(data) {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadvalue (s, p) {
|
|
||||||
|
|
||||||
var res = {result: ""};
|
|
||||||
|
|
||||||
$.ajaxSetup({async: false});
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Triple.json?s='+s+'&p='+p+'&load=true', function (data) {
|
|
||||||
|
|
||||||
res = data;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return res.result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadvalue_t (s, p) {
|
|
||||||
|
|
||||||
var res = {result: ""};
|
|
||||||
|
|
||||||
$.ajaxSetup({async: false});
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Table.json?s='+s+'&p='+p+'&load=true', function (data) {
|
|
||||||
|
|
||||||
res = data;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return res.result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadvalueglobal_t (s, p) {
|
|
||||||
|
|
||||||
var res = {result: ""};
|
|
||||||
|
|
||||||
$.ajaxSetup({async: false});
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Table.json?global=true&s='+s+'&p='+p+'&load=true', function (data) {
|
|
||||||
|
|
||||||
res = data;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return res.result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadvalueglobal (s, p) {
|
|
||||||
|
|
||||||
var res = {result: ""};
|
|
||||||
|
|
||||||
$.ajaxSetup({async: false});
|
|
||||||
|
|
||||||
$.getJSON('/currentyacypeer/interaction/Triple.json?global=true&s='+s+'&p='+p+'&load=true', function (data) {
|
|
||||||
|
|
||||||
res = data;
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return res.result;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function thing(url, title)
|
|
||||||
{
|
|
||||||
var newItems = [];
|
|
||||||
|
|
||||||
var d = new Date();
|
|
||||||
var n = d.getTime();
|
|
||||||
|
|
||||||
var customItem = {
|
|
||||||
"itemType": "webpage",
|
|
||||||
"title": title,
|
|
||||||
"url": url
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
newItems.push(customItem);
|
|
||||||
|
|
||||||
var payload = JSON.stringify({"overall":{"item":customItem}}, null, "\t");
|
|
||||||
|
|
||||||
doAuthenticatedPost(payload, payload, function(status) {
|
|
||||||
if(!status) {
|
|
||||||
// callback(false, new Error("Save to server failed"));
|
|
||||||
} else {
|
|
||||||
|
|
||||||
// callback(true, newItems);
|
|
||||||
}
|
|
||||||
}, true, true);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function doAuthenticatedPost (body, body2, callback, docreate, dooverwrite, param, paramval) {
|
|
||||||
|
|
||||||
// process url
|
|
||||||
// var url = "http://wiki.sciety.org/content/Special:ECC_In";
|
|
||||||
// var url = "http://wiki.sciety.org/content/Special:ECC_In";
|
|
||||||
var url = "http://141.52.79.141/content/Special:ECC_In";
|
|
||||||
|
|
||||||
|
|
||||||
// do form submit
|
|
||||||
|
|
||||||
doFormSubmit(url, body, body2, function(xmlhttp) {
|
|
||||||
|
|
||||||
if([200, 201, 204].indexOf(xmlhttp.status) !== -1) {
|
|
||||||
|
|
||||||
theResult = JSON.parse(xmlhttp.responseText);
|
|
||||||
|
|
||||||
alert (theResult.username);
|
|
||||||
|
|
||||||
// document.getElementById("sciety_averagerating").value = "Average rating: " + theResult.averagerating;
|
|
||||||
|
|
||||||
// document.getElementById("sciety_username").value = "Current user: " + theResult.username;
|
|
||||||
// document.getElementById("sciety_uservalue").value = "Your ranking weight: " + theResult.uservalue;
|
|
||||||
|
|
||||||
// update_view();
|
|
||||||
|
|
||||||
callback(true);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
theResult = JSON.parse(xmlhttp.responseText);
|
|
||||||
|
|
||||||
// document.getElementById("sciety_averagerating").value = "Average rating: " + theResult.averagerating;
|
|
||||||
|
|
||||||
// document.getElementById("sciety_username").value = "Current user: " + theResult.username;
|
|
||||||
// document.getElementById("sciety_uservalue").value = "Your ranking weight: " + theResult.uservalue;
|
|
||||||
|
|
||||||
var msg = xmlhttp.responseText;
|
|
||||||
|
|
||||||
alert (theResult.username);
|
|
||||||
|
|
||||||
// update_view();
|
|
||||||
|
|
||||||
callback(false);
|
|
||||||
}
|
|
||||||
}, false, docreate, dooverwrite, param, paramval);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function doSubmitAdditionalElement (body, body2, callback, docreate, dooverwrite, param, paramval) {
|
|
||||||
|
|
||||||
// process url
|
|
||||||
// var url = "http://wiki.sciety.org/content/Special:ECC_In";
|
|
||||||
var url = "http://wiki.sciety.org/content/Special:ECC_Add";
|
|
||||||
|
|
||||||
|
|
||||||
// do form submit
|
|
||||||
|
|
||||||
doFormSubmit(url, body, body2, function(xmlhttp) {
|
|
||||||
|
|
||||||
if([200, 201, 204].indexOf(xmlhttp.status) !== -1) {
|
|
||||||
|
|
||||||
theResult = JSON.parse(xmlhttp.responseText);
|
|
||||||
|
|
||||||
update_view();
|
|
||||||
|
|
||||||
callback(true);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
theResult = JSON.parse(xmlhttp.responseText);
|
|
||||||
|
|
||||||
var msg = xmlhttp.responseText;
|
|
||||||
|
|
||||||
update_view();
|
|
||||||
|
|
||||||
callback(false);
|
|
||||||
}
|
|
||||||
}, false, docreate, dooverwrite, param, paramval);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function doFormSubmit (url, body, body2, onDone, headers, docreate, dooverwrite, param, paramval) {
|
|
||||||
|
|
||||||
var bodyStart = body.substr(0, 1024);
|
|
||||||
|
|
||||||
var formData = new FormData();
|
|
||||||
|
|
||||||
formData.append ("create", docreate);
|
|
||||||
formData.append ("overwrite", dooverwrite);
|
|
||||||
|
|
||||||
formData.append ("item", body);
|
|
||||||
formData.append ("data", body2);
|
|
||||||
|
|
||||||
|
|
||||||
if (param) {
|
|
||||||
formData.append(param, paramval);
|
|
||||||
}
|
|
||||||
|
|
||||||
var ie = false;
|
|
||||||
|
|
||||||
if (XDomainRequest) {
|
|
||||||
ie = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (ie) {
|
|
||||||
var xmlhttp = new XDomainRequest();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var xmlhttp = new XMLHttpRequest();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
|
|
||||||
xmlhttp.open('POST', url, true);
|
|
||||||
|
|
||||||
|
|
||||||
xmlhttp.onreadystatechange = function(){
|
|
||||||
_stateChange(xmlhttp, onDone);
|
|
||||||
};
|
|
||||||
|
|
||||||
// if (formData.fake)
|
|
||||||
|
|
||||||
if (!ie ) {
|
|
||||||
xmlhttp.setRequestHeader("Content-Type", "multipart/form-data; boundary="+formData.boundary);
|
|
||||||
xmlhttp.sendAsBinary(formData.toString());
|
|
||||||
} else {
|
|
||||||
|
|
||||||
xmlhttp.send(body);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
} catch(e) {
|
|
||||||
|
|
||||||
alert (e);
|
|
||||||
|
|
||||||
if(onDone) {
|
|
||||||
window.setTimeout(function() {
|
|
||||||
try {
|
|
||||||
onDone({"status":0});
|
|
||||||
} catch(e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return xmlhttp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handler for XMLHttpRequest state change
|
|
||||||
*
|
|
||||||
* @param {nsIXMLHttpRequest} XMLHttpRequest whose state just changed
|
|
||||||
* @param {Function} [onDone] Callback for request completion
|
|
||||||
* @param {String} [responseCharset] Character set to force on the response
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
function _stateChange(xmlhttp, callback) {
|
|
||||||
switch (xmlhttp.readyState){
|
|
||||||
// Request not yet made
|
|
||||||
case 1:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Called multiple times while downloading in progress
|
|
||||||
case 3:
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Download complete
|
|
||||||
case 4:
|
|
||||||
if (callback) {
|
|
||||||
try {
|
|
||||||
callback(xmlhttp);
|
|
||||||
} catch(e) {
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue