@ -0,0 +1,16 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<widget xmlns="http://www.w3.org/ns/widgets" |
||||
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||
id="http://uniboard.mnemis.com/widgets/webbrowser" |
||||
version="1.1" |
||||
width="900" |
||||
height="500" |
||||
ub:resizable="true"> |
||||
|
||||
<name>Choisir</name> |
||||
<author href="http://www.getuniboard.com" |
||||
email="info@mnemis.com">Mnemis SA</author> |
||||
<description>Choisir widget</description> |
||||
|
||||
<content src="index.html"/> |
||||
</widget> |
@ -0,0 +1,340 @@ |
||||
html, body{ |
||||
width: 100%; |
||||
padding: 0; |
||||
height: auto; |
||||
background-color: white; |
||||
margin: 0; |
||||
} |
||||
|
||||
a { |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.disclaimer{ |
||||
height: 30px; |
||||
position: fixed; |
||||
left: 0; |
||||
bottom: 0; |
||||
margin-left: 1px; |
||||
margin-right: 1px; |
||||
margin-bottom: 0px; |
||||
padding: 5px; |
||||
text-align: center; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-top-left-radius: 15px; |
||||
-webkit-border-top-right-radius: 15px; |
||||
border-top-left-radius: 15px; |
||||
border-top-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-bottom: none; |
||||
z-index: 10; |
||||
} |
||||
|
||||
#searchResult { |
||||
overflow: hidden; |
||||
text-align: center; |
||||
} |
||||
|
||||
.search{ |
||||
width: 90%; |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
padding: 5px; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-bottom-left-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
border-bottom-left-radius: 15px; |
||||
border-bottom-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-top: none; |
||||
z-index: 101; |
||||
} |
||||
|
||||
.search, |
||||
.disclaimer { |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.togglePages{ |
||||
padding: 0; |
||||
position: absolute; |
||||
bottom: -19px; |
||||
left: 40%; |
||||
width: 22%; |
||||
height: 15px; |
||||
background-color: #666; |
||||
-webkit-border-bottom-left-radius: 20px; |
||||
-webkit-border-bottom-right-radius: 20px; |
||||
border-bottom-left-radius: 20px; |
||||
border-bottom-right-radius: 20px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
box-shadow: #dadada -1px 0 4px; |
||||
cursor: pointer; |
||||
z-index: 100; |
||||
text-align: center; |
||||
} |
||||
|
||||
.toggleIcon{ |
||||
display: inline-block; |
||||
width: 14px; |
||||
height: 14px; |
||||
background: url(../images/trgUp.png) 50% no-repeat; |
||||
|
||||
} |
||||
|
||||
.searchInput{ |
||||
padding: 3px; |
||||
float: left; |
||||
width: 100%; |
||||
border-radius: 3px; |
||||
border-style: none; |
||||
height: 22px; |
||||
line-height: 18px; |
||||
vertical-align: middle; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.searchButton{ |
||||
background: url("../images/search_app.png") -38px -38px no-repeat; |
||||
width: 24px; |
||||
height: 24px; |
||||
overflow: hidden; |
||||
position: absolute; |
||||
right: 30px; |
||||
top: 9px; |
||||
margin-left: -2px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.subSearch{ |
||||
margin: 0; |
||||
float: left; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
width: 100%; |
||||
float: left; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
padding: 5px; |
||||
padding-right: 26px; |
||||
} |
||||
|
||||
#subSearchFilter{ |
||||
width: 100%; |
||||
float: left; |
||||
display: none; |
||||
} |
||||
|
||||
.searchResult{ |
||||
width: 98%; |
||||
padding: 3px; |
||||
background-color:#123456; |
||||
} |
||||
|
||||
.imgContainer{ |
||||
display: inline-block; |
||||
padding: 3px; |
||||
margin: 3px; |
||||
text-align: center; |
||||
overflow: hidden; |
||||
font-size: small; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
border: 1px solid #666; |
||||
border-radius: 5px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
-webkit-border-radius: 5px; |
||||
box-shadow: #666 -1px 0 4px; |
||||
vertical-align: top; |
||||
} |
||||
|
||||
.resultFooter{ |
||||
float: left; |
||||
margin: 5px; |
||||
padding: 3px; |
||||
width: 100%; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
font-weight: bold; |
||||
font-size: x-large; |
||||
text-align: center; |
||||
} |
||||
|
||||
#branding{ |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
z-index: 2; |
||||
} |
||||
|
||||
.filterContainer{ |
||||
float: left; |
||||
margin: 2px; |
||||
padding: 2px; |
||||
font-size: 14px; |
||||
|
||||
} |
||||
|
||||
.filterSelect{ |
||||
border-style:none; |
||||
-webkit-border-top-right-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
-moz-border-radius-topright: 15px; |
||||
-moz-border-radius-bottomright: 15px; |
||||
border-top-right-radius: 15px; |
||||
margin-top: 2px; |
||||
width: 100%; |
||||
} |
||||
|
||||
span{ |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
color: #666; |
||||
} |
||||
|
||||
[draggable] { |
||||
-webkit-user-select: none; |
||||
user-select: none; |
||||
} |
||||
|
||||
.toggleFilters{ |
||||
margin: 0; |
||||
padding: 0; |
||||
background-position: center; |
||||
background-image: url(../images/down.png); |
||||
position: absolute; |
||||
top: 11px; |
||||
right: 6px; |
||||
width: 20px; |
||||
height: 20px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.colors_line { |
||||
float: left; |
||||
margin: 4px; |
||||
margin-right: 0; |
||||
clear: left; |
||||
} |
||||
|
||||
.custom { |
||||
opacity: 0; |
||||
position: absolute; |
||||
left: -10000px; |
||||
} |
||||
|
||||
.filter_button.button.color { |
||||
display: inline-block; |
||||
width: 15px; |
||||
height: 15px; |
||||
border: 1px solid #EBEBEB; |
||||
padding: 0; |
||||
margin: 0; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.filter_button.button.color:hover { |
||||
border: 1px solid rgb(128,128,128); |
||||
cursor: pointer; |
||||
} |
||||
|
||||
input[type="radio"]:checked + .filter_button.button.color { |
||||
border: 1px solid rgb(255,255,255); |
||||
box-shadow: 0 0 0px 1px #000; |
||||
-webkit-box-shadow: 0 0 0px 1px #000; |
||||
} |
||||
|
||||
#allcolor { |
||||
background: white url('../images/search_app.png') -43px -144px no-repeat; |
||||
} |
||||
|
||||
#colored { |
||||
background: white url('../images/search_app.png') -43px -244px no-repeat; |
||||
} |
||||
|
||||
#grayed { |
||||
background: white url('../images/search_app.png') -45px -343px no-repeat; |
||||
} |
||||
|
||||
#black{ |
||||
background-color:#ffffff; |
||||
} |
||||
#blue{ |
||||
background-color:#0000FF; |
||||
} |
||||
#brown{ |
||||
background-color:rgba(139, 82, 16, 1); |
||||
} |
||||
|
||||
#gray{ |
||||
background-color:#999999; |
||||
} |
||||
|
||||
#green{ |
||||
background-color:#00CC00; |
||||
} |
||||
|
||||
#orange{ |
||||
background-color:#FB940B; |
||||
} |
||||
|
||||
#pink{ |
||||
background-color:#FF98BF; |
||||
} |
||||
|
||||
#purple{ |
||||
background-color:#762CA7; |
||||
} |
||||
|
||||
#red{ |
||||
background-color:#CC0000; |
||||
} |
||||
|
||||
#teal{ |
||||
background-color:#03C0C6; |
||||
} |
||||
|
||||
#white{ |
||||
background-color:#000000; |
||||
} |
||||
|
||||
#yellow{ |
||||
background-color:#FFFF00; |
||||
} |
||||
|
||||
.selectBox-dropdown, .selectBox-options li a { |
||||
line-height: 1.3 !important; |
||||
font-size: 13px; |
||||
} |
||||
|
||||
.pager_button { |
||||
padding: 3px 5px; |
||||
font-size: 16px; |
||||
color: black; |
||||
display: inline-block; |
||||
} |
||||
|
||||
.pager_button.active { |
||||
border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
background-color: gray; |
||||
color: white; |
||||
} |
||||
|
||||
/* |
||||
Planete Sankore Changes |
||||
*/ |
||||
.searchButton{ |
||||
right: 10px; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
padding-right: 5px; |
||||
} |
||||
|
||||
.imgContainer img { |
||||
width: 100px; |
||||
} |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 931 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 475 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,257 @@ |
||||
<!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> |
||||
<title>Planete Sankore Image Search</title> |
||||
<link rel="stylesheet" type="text/css" href="css/basic.css"/> |
||||
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> |
||||
<script type="text/javascript"> |
||||
var category = "audio"; |
||||
var thumbnails = false; |
||||
var minHeight = 180; |
||||
var minWidth = 150; |
||||
|
||||
var currentIndex = 0; |
||||
var currentTerm = ""; |
||||
var limit = 10; |
||||
var filtersDisplayed = false; //display or hide filters |
||||
|
||||
function addPaginationLinks(totalResults) { |
||||
var curPage = currentIndex; // check what page the app is on |
||||
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>"); |
||||
for (var i = 0; i < 10; i++) { |
||||
if (i * limit < totalResults) { |
||||
|
||||
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i).appendTo(pagesDiv); |
||||
if (curPage == i) { |
||||
link.addClass('active'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
pagesDiv.appendTo($('#searchResult')); |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragstart", imageDragging, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragenter", imageDragenter, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragleave", imageDragleave, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragover", imageDragover, false); |
||||
}) |
||||
} |
||||
|
||||
function searchFail(jqXHR, textStatus, errorThrown) { |
||||
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown); |
||||
} |
||||
|
||||
function searchComplete(json) { |
||||
// Grab our content div, clear it. |
||||
var totalResults = json.totalResults; |
||||
var contentDiv = $('#searchResult').empty(); |
||||
// Loop through our results, printing them to the page. |
||||
var results = json.rows; |
||||
for (var i = 0; i < results.length; i++) { |
||||
// For each result write it's title and image to the screen |
||||
var result = results[i]; |
||||
var imgContainer = $("<div class='imgContainer' draggable='true'>"); |
||||
var title = document.createElement('div'); |
||||
var iUrl = $("<input type='hidden'/>"); |
||||
var iContent = $("<input type='hidden'/>"); |
||||
var iHeight = $("<input type='hidden'/>"); |
||||
var iWidth = $("<input type='hidden'/>"); |
||||
var iTitle = $("<input type='hidden'/>"); |
||||
|
||||
// We use titleNoFormatting so that no HTML tags are left in the |
||||
// title |
||||
title.innerHTML = result.title; |
||||
if (thumbnails) { |
||||
var newImg = document.createElement('img'); |
||||
|
||||
// There is also a result.file property which has the escaped version |
||||
newImg.src = result.file; |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
imgContainer.append($(newImg)); |
||||
} else { |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
} |
||||
iUrl.attr("value", result.file); |
||||
iContent.attr("value", result.title); |
||||
iHeight.attr("value", result.height); |
||||
iWidth.attr("value", result.width); |
||||
iTitle.attr("value",result.title); |
||||
imgContainer.append($(title)); |
||||
imgContainer.append(iUrl); |
||||
imgContainer.append(iContent); |
||||
imgContainer.append(iHeight); |
||||
imgContainer.append(iWidth); |
||||
imgContainer.append(iTitle); |
||||
|
||||
// Put our title + image in the content |
||||
imgContainer.appendTo(contentDiv); |
||||
|
||||
} |
||||
// Now add links to additional pages of search results. |
||||
addPaginationLinks(totalResults); |
||||
} |
||||
|
||||
function imageDragging(e){ |
||||
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val()); |
||||
// alert($(this).find("input:hidden").eq(0).val()); |
||||
} |
||||
|
||||
function imageDragleave(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragover(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragenter(e){ |
||||
return false; |
||||
} |
||||
|
||||
$(document).ready(function(){ |
||||
|
||||
//variables |
||||
var mode = false; //search or view mode |
||||
var hide = false; //hide or no main panel |
||||
|
||||
//basic containers and elements |
||||
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Disclaimer<div>").appendTo("body"); |
||||
var search = $("<div id='search' class='search'>").appendTo("body"); |
||||
|
||||
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search); |
||||
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages); |
||||
|
||||
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search); |
||||
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search); |
||||
|
||||
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput); |
||||
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput); |
||||
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput); |
||||
|
||||
//adding filters to the wgt |
||||
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>") |
||||
.append($("<option value='0'>Any</option>")) |
||||
.append($("<option value='1'>Small</option>")) |
||||
.append($("<option value='2'>Medium</option>")) |
||||
.append($("<option value='3'>Large</option>")) |
||||
.append($("<option value='4'>Extra large</option>")); |
||||
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter); |
||||
|
||||
//mouse click actions |
||||
/* |
||||
toggleFilters.click(function(){ |
||||
if(filtersDisplayed){ |
||||
subSearchFilter.hide(); |
||||
toggleFilters.css("background-image","url(images/down.png)"); |
||||
filtersDisplayed = false; |
||||
} else { |
||||
subSearchFilter.show(); |
||||
toggleFilters.css("background-image","url(images/up.png)"); |
||||
filtersDisplayed = true; |
||||
} |
||||
}); |
||||
*/ |
||||
|
||||
togglePages.click(function(event){ |
||||
if(mode){ |
||||
hide = false; |
||||
$("#search, #disclaimer").slideDown('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgUp.png)"); |
||||
togglePages.appendTo("#search").css("top","").css("bottom","-14px"); |
||||
}); |
||||
mode = false; |
||||
} else { |
||||
hide = true; |
||||
$("#search, #disclaimer").slideUp('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgDown.png)"); |
||||
togglePages.appendTo("body").css("top","0"); |
||||
}); |
||||
mode = true; |
||||
} |
||||
}); |
||||
|
||||
searchButton.click(function(){ |
||||
if(!hide){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
}); |
||||
|
||||
searchInput.keydown(function(event){ |
||||
if(!hide){ |
||||
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
|
||||
} |
||||
}); |
||||
( |
||||
$(".imgContainer").live("click",function(){ |
||||
sankore.sendFileMetadata(createMetaData($(this))); |
||||
})); |
||||
|
||||
$(window).resize(function(){ |
||||
disclaimer.width($("body").width()-20); |
||||
search.width($("body").width()-20); |
||||
toggleIcon.css("margin-left",(togglePages.width()/2 - 7)); |
||||
}) |
||||
|
||||
}); |
||||
|
||||
function gotoPage(i) { |
||||
runSearch(currentTerm, i); |
||||
} |
||||
|
||||
// launching the search on planete sankore |
||||
function runSearch(term, index) { |
||||
currentTerm = term; |
||||
currentIndex = index; |
||||
var start = index * limit; |
||||
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit; |
||||
$.ajax({ |
||||
url: url, |
||||
success: searchComplete, |
||||
error: searchFail, |
||||
dataType: "json" |
||||
}); |
||||
} |
||||
|
||||
function createMetaData(parent){ |
||||
var meta = ""; |
||||
//alert($(this).find("input:hidden").eq(0).val()); |
||||
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" + |
||||
parent.find("input:hidden").eq(0).val() + |
||||
"</value></data><data><key>Content</key><value>" + |
||||
parent.find("input:hidden").eq(1).val() + |
||||
"</value></data><data><key>Height</key><value>" + |
||||
parent.find("input:hidden").eq(2).val() + |
||||
"</value></data><data><key>Width</key><value>" + |
||||
parent.find("input:hidden").eq(3).val() + |
||||
"</value></data><data><key>Title</key><value>" + |
||||
parent.find("input:hidden").eq(4).val() + |
||||
"</value></data></metadata>"; |
||||
return meta; |
||||
} |
||||
</script> |
||||
|
||||
</head> |
||||
<body style="font-family: Arial;border: 0 none;"> |
||||
<div id="branding" style="float: left;"></div><br /> |
||||
<div id="searchResult"></div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,16 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<widget xmlns="http://www.w3.org/ns/widgets" |
||||
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||
id="http://uniboard.mnemis.com/widgets/webbrowser" |
||||
version="1.1" |
||||
width="900" |
||||
height="500" |
||||
ub:resizable="true"> |
||||
|
||||
<name>Choisir</name> |
||||
<author href="http://www.getuniboard.com" |
||||
email="info@mnemis.com">Mnemis SA</author> |
||||
<description>Choisir widget</description> |
||||
|
||||
<content src="index.html"/> |
||||
</widget> |
@ -0,0 +1,340 @@ |
||||
html, body{ |
||||
width: 100%; |
||||
padding: 0; |
||||
height: auto; |
||||
background-color: white; |
||||
margin: 0; |
||||
} |
||||
|
||||
a { |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.disclaimer{ |
||||
height: 30px; |
||||
position: fixed; |
||||
left: 0; |
||||
bottom: 0; |
||||
margin-left: 1px; |
||||
margin-right: 1px; |
||||
margin-bottom: 0px; |
||||
padding: 5px; |
||||
text-align: center; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-top-left-radius: 15px; |
||||
-webkit-border-top-right-radius: 15px; |
||||
border-top-left-radius: 15px; |
||||
border-top-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-bottom: none; |
||||
z-index: 10; |
||||
} |
||||
|
||||
#searchResult { |
||||
overflow: hidden; |
||||
text-align: center; |
||||
} |
||||
|
||||
.search{ |
||||
width: 90%; |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
padding: 5px; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-bottom-left-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
border-bottom-left-radius: 15px; |
||||
border-bottom-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-top: none; |
||||
z-index: 101; |
||||
} |
||||
|
||||
.search, |
||||
.disclaimer { |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.togglePages{ |
||||
padding: 0; |
||||
position: absolute; |
||||
bottom: -19px; |
||||
left: 40%; |
||||
width: 22%; |
||||
height: 15px; |
||||
background-color: #666; |
||||
-webkit-border-bottom-left-radius: 20px; |
||||
-webkit-border-bottom-right-radius: 20px; |
||||
border-bottom-left-radius: 20px; |
||||
border-bottom-right-radius: 20px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
box-shadow: #dadada -1px 0 4px; |
||||
cursor: pointer; |
||||
z-index: 100; |
||||
text-align: center; |
||||
} |
||||
|
||||
.toggleIcon{ |
||||
display: inline-block; |
||||
width: 14px; |
||||
height: 14px; |
||||
background: url(../images/trgUp.png) 50% no-repeat; |
||||
|
||||
} |
||||
|
||||
.searchInput{ |
||||
padding: 3px; |
||||
float: left; |
||||
width: 100%; |
||||
border-radius: 3px; |
||||
border-style: none; |
||||
height: 22px; |
||||
line-height: 18px; |
||||
vertical-align: middle; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.searchButton{ |
||||
background: url("../images/search_app.png") -38px -38px no-repeat; |
||||
width: 24px; |
||||
height: 24px; |
||||
overflow: hidden; |
||||
position: absolute; |
||||
right: 30px; |
||||
top: 9px; |
||||
margin-left: -2px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.subSearch{ |
||||
margin: 0; |
||||
float: left; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
width: 100%; |
||||
float: left; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
padding: 5px; |
||||
padding-right: 26px; |
||||
} |
||||
|
||||
#subSearchFilter{ |
||||
width: 100%; |
||||
float: left; |
||||
display: none; |
||||
} |
||||
|
||||
.searchResult{ |
||||
width: 98%; |
||||
padding: 3px; |
||||
background-color:#123456; |
||||
} |
||||
|
||||
.imgContainer{ |
||||
display: inline-block; |
||||
padding: 3px; |
||||
margin: 3px; |
||||
text-align: center; |
||||
overflow: hidden; |
||||
font-size: small; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
border: 1px solid #666; |
||||
border-radius: 5px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
-webkit-border-radius: 5px; |
||||
box-shadow: #666 -1px 0 4px; |
||||
vertical-align: top; |
||||
} |
||||
|
||||
.resultFooter{ |
||||
float: left; |
||||
margin: 5px; |
||||
padding: 3px; |
||||
width: 100%; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
font-weight: bold; |
||||
font-size: x-large; |
||||
text-align: center; |
||||
} |
||||
|
||||
#branding{ |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
z-index: 2; |
||||
} |
||||
|
||||
.filterContainer{ |
||||
float: left; |
||||
margin: 2px; |
||||
padding: 2px; |
||||
font-size: 14px; |
||||
|
||||
} |
||||
|
||||
.filterSelect{ |
||||
border-style:none; |
||||
-webkit-border-top-right-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
-moz-border-radius-topright: 15px; |
||||
-moz-border-radius-bottomright: 15px; |
||||
border-top-right-radius: 15px; |
||||
margin-top: 2px; |
||||
width: 100%; |
||||
} |
||||
|
||||
span{ |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
color: #666; |
||||
} |
||||
|
||||
[draggable] { |
||||
-webkit-user-select: none; |
||||
user-select: none; |
||||
} |
||||
|
||||
.toggleFilters{ |
||||
margin: 0; |
||||
padding: 0; |
||||
background-position: center; |
||||
background-image: url(../images/down.png); |
||||
position: absolute; |
||||
top: 11px; |
||||
right: 6px; |
||||
width: 20px; |
||||
height: 20px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.colors_line { |
||||
float: left; |
||||
margin: 4px; |
||||
margin-right: 0; |
||||
clear: left; |
||||
} |
||||
|
||||
.custom { |
||||
opacity: 0; |
||||
position: absolute; |
||||
left: -10000px; |
||||
} |
||||
|
||||
.filter_button.button.color { |
||||
display: inline-block; |
||||
width: 15px; |
||||
height: 15px; |
||||
border: 1px solid #EBEBEB; |
||||
padding: 0; |
||||
margin: 0; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.filter_button.button.color:hover { |
||||
border: 1px solid rgb(128,128,128); |
||||
cursor: pointer; |
||||
} |
||||
|
||||
input[type="radio"]:checked + .filter_button.button.color { |
||||
border: 1px solid rgb(255,255,255); |
||||
box-shadow: 0 0 0px 1px #000; |
||||
-webkit-box-shadow: 0 0 0px 1px #000; |
||||
} |
||||
|
||||
#allcolor { |
||||
background: white url('../images/search_app.png') -43px -144px no-repeat; |
||||
} |
||||
|
||||
#colored { |
||||
background: white url('../images/search_app.png') -43px -244px no-repeat; |
||||
} |
||||
|
||||
#grayed { |
||||
background: white url('../images/search_app.png') -45px -343px no-repeat; |
||||
} |
||||
|
||||
#black{ |
||||
background-color:#ffffff; |
||||
} |
||||
#blue{ |
||||
background-color:#0000FF; |
||||
} |
||||
#brown{ |
||||
background-color:rgba(139, 82, 16, 1); |
||||
} |
||||
|
||||
#gray{ |
||||
background-color:#999999; |
||||
} |
||||
|
||||
#green{ |
||||
background-color:#00CC00; |
||||
} |
||||
|
||||
#orange{ |
||||
background-color:#FB940B; |
||||
} |
||||
|
||||
#pink{ |
||||
background-color:#FF98BF; |
||||
} |
||||
|
||||
#purple{ |
||||
background-color:#762CA7; |
||||
} |
||||
|
||||
#red{ |
||||
background-color:#CC0000; |
||||
} |
||||
|
||||
#teal{ |
||||
background-color:#03C0C6; |
||||
} |
||||
|
||||
#white{ |
||||
background-color:#000000; |
||||
} |
||||
|
||||
#yellow{ |
||||
background-color:#FFFF00; |
||||
} |
||||
|
||||
.selectBox-dropdown, .selectBox-options li a { |
||||
line-height: 1.3 !important; |
||||
font-size: 13px; |
||||
} |
||||
|
||||
.pager_button { |
||||
padding: 3px 5px; |
||||
font-size: 16px; |
||||
color: black; |
||||
display: inline-block; |
||||
} |
||||
|
||||
.pager_button.active { |
||||
border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
background-color: gray; |
||||
color: white; |
||||
} |
||||
|
||||
/* |
||||
Planete Sankore Changes |
||||
*/ |
||||
.searchButton{ |
||||
right: 10px; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
padding-right: 5px; |
||||
} |
||||
|
||||
.imgContainer img { |
||||
width: 100px; |
||||
} |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 8.7 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 931 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 475 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,257 @@ |
||||
<!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> |
||||
<title>Planete Sankore Image Search</title> |
||||
<link rel="stylesheet" type="text/css" href="css/basic.css"/> |
||||
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> |
||||
<script type="text/javascript"> |
||||
var category = "interactive"; |
||||
var thumbnails = false; |
||||
var minHeight = 180; |
||||
var minWidth = 150; |
||||
|
||||
var currentIndex = 0; |
||||
var currentTerm = ""; |
||||
var limit = 10; |
||||
var filtersDisplayed = false; //display or hide filters |
||||
|
||||
function addPaginationLinks(totalResults) { |
||||
var curPage = currentIndex; // check what page the app is on |
||||
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>"); |
||||
for (var i = 0; i < 10; i++) { |
||||
if (i * limit < totalResults) { |
||||
|
||||
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i).appendTo(pagesDiv); |
||||
if (curPage == i) { |
||||
link.addClass('active'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
pagesDiv.appendTo($('#searchResult')); |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragstart", imageDragging, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragenter", imageDragenter, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragleave", imageDragleave, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragover", imageDragover, false); |
||||
}) |
||||
} |
||||
|
||||
function searchFail(jqXHR, textStatus, errorThrown) { |
||||
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown); |
||||
} |
||||
|
||||
function searchComplete(json) { |
||||
// Grab our content div, clear it. |
||||
var totalResults = json.totalResults; |
||||
var contentDiv = $('#searchResult').empty(); |
||||
// Loop through our results, printing them to the page. |
||||
var results = json.rows; |
||||
for (var i = 0; i < results.length; i++) { |
||||
// For each result write it's title and image to the screen |
||||
var result = results[i]; |
||||
var imgContainer = $("<div class='imgContainer' draggable='true'>"); |
||||
var title = document.createElement('div'); |
||||
var iUrl = $("<input type='hidden'/>"); |
||||
var iContent = $("<input type='hidden'/>"); |
||||
var iHeight = $("<input type='hidden'/>"); |
||||
var iWidth = $("<input type='hidden'/>"); |
||||
var iTitle = $("<input type='hidden'/>"); |
||||
|
||||
// We use titleNoFormatting so that no HTML tags are left in the |
||||
// title |
||||
title.innerHTML = result.title; |
||||
if (thumbnails) { |
||||
var newImg = document.createElement('img'); |
||||
|
||||
// There is also a result.file property which has the escaped version |
||||
newImg.src = result.file; |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
imgContainer.append($(newImg)); |
||||
} else { |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
} |
||||
iUrl.attr("value", result.file); |
||||
iContent.attr("value", result.title); |
||||
iHeight.attr("value", result.height); |
||||
iWidth.attr("value", result.width); |
||||
iTitle.attr("value",result.title); |
||||
imgContainer.append($(title)); |
||||
imgContainer.append(iUrl); |
||||
imgContainer.append(iContent); |
||||
imgContainer.append(iHeight); |
||||
imgContainer.append(iWidth); |
||||
imgContainer.append(iTitle); |
||||
|
||||
// Put our title + image in the content |
||||
imgContainer.appendTo(contentDiv); |
||||
|
||||
} |
||||
// Now add links to additional pages of search results. |
||||
addPaginationLinks(totalResults); |
||||
} |
||||
|
||||
function imageDragging(e){ |
||||
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val()); |
||||
// alert($(this).find("input:hidden").eq(0).val()); |
||||
} |
||||
|
||||
function imageDragleave(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragover(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragenter(e){ |
||||
return false; |
||||
} |
||||
|
||||
$(document).ready(function(){ |
||||
|
||||
//variables |
||||
var mode = false; //search or view mode |
||||
var hide = false; //hide or no main panel |
||||
|
||||
//basic containers and elements |
||||
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Disclaimer<div>").appendTo("body"); |
||||
var search = $("<div id='search' class='search'>").appendTo("body"); |
||||
|
||||
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search); |
||||
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages); |
||||
|
||||
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search); |
||||
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search); |
||||
|
||||
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput); |
||||
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput); |
||||
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput); |
||||
|
||||
//adding filters to the wgt |
||||
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>") |
||||
.append($("<option value='0'>Any</option>")) |
||||
.append($("<option value='1'>Small</option>")) |
||||
.append($("<option value='2'>Medium</option>")) |
||||
.append($("<option value='3'>Large</option>")) |
||||
.append($("<option value='4'>Extra large</option>")); |
||||
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter); |
||||
|
||||
//mouse click actions |
||||
/* |
||||
toggleFilters.click(function(){ |
||||
if(filtersDisplayed){ |
||||
subSearchFilter.hide(); |
||||
toggleFilters.css("background-image","url(images/down.png)"); |
||||
filtersDisplayed = false; |
||||
} else { |
||||
subSearchFilter.show(); |
||||
toggleFilters.css("background-image","url(images/up.png)"); |
||||
filtersDisplayed = true; |
||||
} |
||||
}); |
||||
*/ |
||||
|
||||
togglePages.click(function(event){ |
||||
if(mode){ |
||||
hide = false; |
||||
$("#search, #disclaimer").slideDown('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgUp.png)"); |
||||
togglePages.appendTo("#search").css("top","").css("bottom","-14px"); |
||||
}); |
||||
mode = false; |
||||
} else { |
||||
hide = true; |
||||
$("#search, #disclaimer").slideUp('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgDown.png)"); |
||||
togglePages.appendTo("body").css("top","0"); |
||||
}); |
||||
mode = true; |
||||
} |
||||
}); |
||||
|
||||
searchButton.click(function(){ |
||||
if(!hide){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
}); |
||||
|
||||
searchInput.keydown(function(event){ |
||||
if(!hide){ |
||||
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
|
||||
} |
||||
}); |
||||
( |
||||
$(".imgContainer").live("click",function(){ |
||||
sankore.sendFileMetadata(createMetaData($(this))); |
||||
})); |
||||
|
||||
$(window).resize(function(){ |
||||
disclaimer.width($("body").width()-20); |
||||
search.width($("body").width()-20); |
||||
toggleIcon.css("margin-left",(togglePages.width()/2 - 7)); |
||||
}) |
||||
|
||||
}); |
||||
|
||||
function gotoPage(i) { |
||||
runSearch(currentTerm, i); |
||||
} |
||||
|
||||
// launching the search on planete sankore |
||||
function runSearch(term, index) { |
||||
currentTerm = term; |
||||
currentIndex = index; |
||||
var start = index * limit; |
||||
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit; |
||||
$.ajax({ |
||||
url: url, |
||||
success: searchComplete, |
||||
error: searchFail, |
||||
dataType: "json" |
||||
}); |
||||
} |
||||
|
||||
function createMetaData(parent){ |
||||
var meta = ""; |
||||
//alert($(this).find("input:hidden").eq(0).val()); |
||||
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" + |
||||
parent.find("input:hidden").eq(0).val() + |
||||
"</value></data><data><key>Content</key><value>" + |
||||
parent.find("input:hidden").eq(1).val() + |
||||
"</value></data><data><key>Height</key><value>" + |
||||
parent.find("input:hidden").eq(2).val() + |
||||
"</value></data><data><key>Width</key><value>" + |
||||
parent.find("input:hidden").eq(3).val() + |
||||
"</value></data><data><key>Title</key><value>" + |
||||
parent.find("input:hidden").eq(4).val() + |
||||
"</value></data></metadata>"; |
||||
return meta; |
||||
} |
||||
</script> |
||||
|
||||
</head> |
||||
<body style="font-family: Arial;border: 0 none;"> |
||||
<div id="branding" style="float: left;"></div><br /> |
||||
<div id="searchResult"></div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,16 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<widget xmlns="http://www.w3.org/ns/widgets" |
||||
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||
id="http://uniboard.mnemis.com/widgets/webbrowser" |
||||
version="1.1" |
||||
width="900" |
||||
height="500" |
||||
ub:resizable="true"> |
||||
|
||||
<name>Choisir</name> |
||||
<author href="http://www.getuniboard.com" |
||||
email="info@mnemis.com">Mnemis SA</author> |
||||
<description>Choisir widget</description> |
||||
|
||||
<content src="index.html"/> |
||||
</widget> |
@ -0,0 +1,340 @@ |
||||
html, body{ |
||||
width: 100%; |
||||
padding: 0; |
||||
height: auto; |
||||
background-color: white; |
||||
margin: 0; |
||||
} |
||||
|
||||
a { |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.disclaimer{ |
||||
height: 30px; |
||||
position: fixed; |
||||
left: 0; |
||||
bottom: 0; |
||||
margin-left: 1px; |
||||
margin-right: 1px; |
||||
margin-bottom: 0px; |
||||
padding: 5px; |
||||
text-align: center; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-top-left-radius: 15px; |
||||
-webkit-border-top-right-radius: 15px; |
||||
border-top-left-radius: 15px; |
||||
border-top-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-bottom: none; |
||||
z-index: 10; |
||||
} |
||||
|
||||
#searchResult { |
||||
overflow: hidden; |
||||
text-align: center; |
||||
} |
||||
|
||||
.search{ |
||||
width: 90%; |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
padding: 5px; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-bottom-left-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
border-bottom-left-radius: 15px; |
||||
border-bottom-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-top: none; |
||||
z-index: 101; |
||||
} |
||||
|
||||
.search, |
||||
.disclaimer { |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.togglePages{ |
||||
padding: 0; |
||||
position: absolute; |
||||
bottom: -19px; |
||||
left: 40%; |
||||
width: 22%; |
||||
height: 15px; |
||||
background-color: #666; |
||||
-webkit-border-bottom-left-radius: 20px; |
||||
-webkit-border-bottom-right-radius: 20px; |
||||
border-bottom-left-radius: 20px; |
||||
border-bottom-right-radius: 20px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
box-shadow: #dadada -1px 0 4px; |
||||
cursor: pointer; |
||||
z-index: 100; |
||||
text-align: center; |
||||
} |
||||
|
||||
.toggleIcon{ |
||||
display: inline-block; |
||||
width: 14px; |
||||
height: 14px; |
||||
background: url(../images/trgUp.png) 50% no-repeat; |
||||
|
||||
} |
||||
|
||||
.searchInput{ |
||||
padding: 3px; |
||||
float: left; |
||||
width: 100%; |
||||
border-radius: 3px; |
||||
border-style: none; |
||||
height: 22px; |
||||
line-height: 18px; |
||||
vertical-align: middle; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.searchButton{ |
||||
background: url("../images/search_app.png") -38px -38px no-repeat; |
||||
width: 24px; |
||||
height: 24px; |
||||
overflow: hidden; |
||||
position: absolute; |
||||
right: 30px; |
||||
top: 9px; |
||||
margin-left: -2px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.subSearch{ |
||||
margin: 0; |
||||
float: left; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
width: 100%; |
||||
float: left; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
padding: 5px; |
||||
padding-right: 26px; |
||||
} |
||||
|
||||
#subSearchFilter{ |
||||
width: 100%; |
||||
float: left; |
||||
display: none; |
||||
} |
||||
|
||||
.searchResult{ |
||||
width: 98%; |
||||
padding: 3px; |
||||
background-color:#123456; |
||||
} |
||||
|
||||
.imgContainer{ |
||||
display: inline-block; |
||||
padding: 3px; |
||||
margin: 3px; |
||||
text-align: center; |
||||
overflow: hidden; |
||||
font-size: small; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
border: 1px solid #666; |
||||
border-radius: 5px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
-webkit-border-radius: 5px; |
||||
box-shadow: #666 -1px 0 4px; |
||||
vertical-align: top; |
||||
} |
||||
|
||||
.resultFooter{ |
||||
float: left; |
||||
margin: 5px; |
||||
padding: 3px; |
||||
width: 100%; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
font-weight: bold; |
||||
font-size: x-large; |
||||
text-align: center; |
||||
} |
||||
|
||||
#branding{ |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
z-index: 2; |
||||
} |
||||
|
||||
.filterContainer{ |
||||
float: left; |
||||
margin: 2px; |
||||
padding: 2px; |
||||
font-size: 14px; |
||||
|
||||
} |
||||
|
||||
.filterSelect{ |
||||
border-style:none; |
||||
-webkit-border-top-right-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
-moz-border-radius-topright: 15px; |
||||
-moz-border-radius-bottomright: 15px; |
||||
border-top-right-radius: 15px; |
||||
margin-top: 2px; |
||||
width: 100%; |
||||
} |
||||
|
||||
span{ |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
color: #666; |
||||
} |
||||
|
||||
[draggable] { |
||||
-webkit-user-select: none; |
||||
user-select: none; |
||||
} |
||||
|
||||
.toggleFilters{ |
||||
margin: 0; |
||||
padding: 0; |
||||
background-position: center; |
||||
background-image: url(../images/down.png); |
||||
position: absolute; |
||||
top: 11px; |
||||
right: 6px; |
||||
width: 20px; |
||||
height: 20px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.colors_line { |
||||
float: left; |
||||
margin: 4px; |
||||
margin-right: 0; |
||||
clear: left; |
||||
} |
||||
|
||||
.custom { |
||||
opacity: 0; |
||||
position: absolute; |
||||
left: -10000px; |
||||
} |
||||
|
||||
.filter_button.button.color { |
||||
display: inline-block; |
||||
width: 15px; |
||||
height: 15px; |
||||
border: 1px solid #EBEBEB; |
||||
padding: 0; |
||||
margin: 0; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.filter_button.button.color:hover { |
||||
border: 1px solid rgb(128,128,128); |
||||
cursor: pointer; |
||||
} |
||||
|
||||
input[type="radio"]:checked + .filter_button.button.color { |
||||
border: 1px solid rgb(255,255,255); |
||||
box-shadow: 0 0 0px 1px #000; |
||||
-webkit-box-shadow: 0 0 0px 1px #000; |
||||
} |
||||
|
||||
#allcolor { |
||||
background: white url('../images/search_app.png') -43px -144px no-repeat; |
||||
} |
||||
|
||||
#colored { |
||||
background: white url('../images/search_app.png') -43px -244px no-repeat; |
||||
} |
||||
|
||||
#grayed { |
||||
background: white url('../images/search_app.png') -45px -343px no-repeat; |
||||
} |
||||
|
||||
#black{ |
||||
background-color:#ffffff; |
||||
} |
||||
#blue{ |
||||
background-color:#0000FF; |
||||
} |
||||
#brown{ |
||||
background-color:rgba(139, 82, 16, 1); |
||||
} |
||||
|
||||
#gray{ |
||||
background-color:#999999; |
||||
} |
||||
|
||||
#green{ |
||||
background-color:#00CC00; |
||||
} |
||||
|
||||
#orange{ |
||||
background-color:#FB940B; |
||||
} |
||||
|
||||
#pink{ |
||||
background-color:#FF98BF; |
||||
} |
||||
|
||||
#purple{ |
||||
background-color:#762CA7; |
||||
} |
||||
|
||||
#red{ |
||||
background-color:#CC0000; |
||||
} |
||||
|
||||
#teal{ |
||||
background-color:#03C0C6; |
||||
} |
||||
|
||||
#white{ |
||||
background-color:#000000; |
||||
} |
||||
|
||||
#yellow{ |
||||
background-color:#FFFF00; |
||||
} |
||||
|
||||
.selectBox-dropdown, .selectBox-options li a { |
||||
line-height: 1.3 !important; |
||||
font-size: 13px; |
||||
} |
||||
|
||||
.pager_button { |
||||
padding: 3px 5px; |
||||
font-size: 16px; |
||||
color: black; |
||||
display: inline-block; |
||||
} |
||||
|
||||
.pager_button.active { |
||||
border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
background-color: gray; |
||||
color: white; |
||||
} |
||||
|
||||
/* |
||||
Planete Sankore Changes |
||||
*/ |
||||
.searchButton{ |
||||
right: 10px; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
padding-right: 5px; |
||||
} |
||||
|
||||
.imgContainer img { |
||||
width: 100px; |
||||
} |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 931 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 475 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,257 @@ |
||||
<!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> |
||||
<title>Planete Sankore Image Search</title> |
||||
<link rel="stylesheet" type="text/css" href="css/basic.css"/> |
||||
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> |
||||
<script type="text/javascript"> |
||||
var category = "image"; |
||||
var thumbnails = true; |
||||
var minHeight = 180; |
||||
var minWidth = 150; |
||||
|
||||
var currentIndex = 0; |
||||
var currentTerm = ""; |
||||
var limit = 10; |
||||
var filtersDisplayed = false; //display or hide filters |
||||
|
||||
function addPaginationLinks(totalResults) { |
||||
var curPage = currentIndex; // check what page the app is on |
||||
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>"); |
||||
for (var i = 0; i < 10; i++) { |
||||
if (i * limit < totalResults) { |
||||
|
||||
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i).appendTo(pagesDiv); |
||||
if (curPage == i) { |
||||
link.addClass('active'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
pagesDiv.appendTo($('#searchResult')); |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragstart", imageDragging, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragenter", imageDragenter, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragleave", imageDragleave, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragover", imageDragover, false); |
||||
}) |
||||
} |
||||
|
||||
function searchFail(jqXHR, textStatus, errorThrown) { |
||||
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown); |
||||
} |
||||
|
||||
function searchComplete(json) { |
||||
// Grab our content div, clear it. |
||||
var totalResults = json.totalResults; |
||||
var contentDiv = $('#searchResult').empty(); |
||||
// Loop through our results, printing them to the page. |
||||
var results = json.rows; |
||||
for (var i = 0; i < results.length; i++) { |
||||
// For each result write it's title and image to the screen |
||||
var result = results[i]; |
||||
var imgContainer = $("<div class='imgContainer' draggable='true'>"); |
||||
var title = document.createElement('div'); |
||||
var iUrl = $("<input type='hidden'/>"); |
||||
var iContent = $("<input type='hidden'/>"); |
||||
var iHeight = $("<input type='hidden'/>"); |
||||
var iWidth = $("<input type='hidden'/>"); |
||||
var iTitle = $("<input type='hidden'/>"); |
||||
|
||||
// We use titleNoFormatting so that no HTML tags are left in the |
||||
// title |
||||
title.innerHTML = result.title; |
||||
if (thumbnails) { |
||||
var newImg = document.createElement('img'); |
||||
|
||||
// There is also a result.file property which has the escaped version |
||||
newImg.src = result.file; |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
imgContainer.append($(newImg)); |
||||
} else { |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
} |
||||
iUrl.attr("value", result.file); |
||||
iContent.attr("value", result.title); |
||||
iHeight.attr("value", result.height); |
||||
iWidth.attr("value", result.width); |
||||
iTitle.attr("value",result.title); |
||||
imgContainer.append($(title)); |
||||
imgContainer.append(iUrl); |
||||
imgContainer.append(iContent); |
||||
imgContainer.append(iHeight); |
||||
imgContainer.append(iWidth); |
||||
imgContainer.append(iTitle); |
||||
|
||||
// Put our title + image in the content |
||||
imgContainer.appendTo(contentDiv); |
||||
|
||||
} |
||||
// Now add links to additional pages of search results. |
||||
addPaginationLinks(totalResults); |
||||
} |
||||
|
||||
function imageDragging(e){ |
||||
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val()); |
||||
// alert($(this).find("input:hidden").eq(0).val()); |
||||
} |
||||
|
||||
function imageDragleave(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragover(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragenter(e){ |
||||
return false; |
||||
} |
||||
|
||||
$(document).ready(function(){ |
||||
|
||||
//variables |
||||
var mode = false; //search or view mode |
||||
var hide = false; //hide or no main panel |
||||
|
||||
//basic containers and elements |
||||
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Disclaimer<div>").appendTo("body"); |
||||
var search = $("<div id='search' class='search'>").appendTo("body"); |
||||
|
||||
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search); |
||||
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages); |
||||
|
||||
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search); |
||||
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search); |
||||
|
||||
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput); |
||||
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput); |
||||
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput); |
||||
|
||||
//adding filters to the wgt |
||||
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>") |
||||
.append($("<option value='0'>Any</option>")) |
||||
.append($("<option value='1'>Small</option>")) |
||||
.append($("<option value='2'>Medium</option>")) |
||||
.append($("<option value='3'>Large</option>")) |
||||
.append($("<option value='4'>Extra large</option>")); |
||||
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter); |
||||
|
||||
//mouse click actions |
||||
/* |
||||
toggleFilters.click(function(){ |
||||
if(filtersDisplayed){ |
||||
subSearchFilter.hide(); |
||||
toggleFilters.css("background-image","url(images/down.png)"); |
||||
filtersDisplayed = false; |
||||
} else { |
||||
subSearchFilter.show(); |
||||
toggleFilters.css("background-image","url(images/up.png)"); |
||||
filtersDisplayed = true; |
||||
} |
||||
}); |
||||
*/ |
||||
|
||||
togglePages.click(function(event){ |
||||
if(mode){ |
||||
hide = false; |
||||
$("#search, #disclaimer").slideDown('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgUp.png)"); |
||||
togglePages.appendTo("#search").css("top","").css("bottom","-14px"); |
||||
}); |
||||
mode = false; |
||||
} else { |
||||
hide = true; |
||||
$("#search, #disclaimer").slideUp('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgDown.png)"); |
||||
togglePages.appendTo("body").css("top","0"); |
||||
}); |
||||
mode = true; |
||||
} |
||||
}); |
||||
|
||||
searchButton.click(function(){ |
||||
if(!hide){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
}); |
||||
|
||||
searchInput.keydown(function(event){ |
||||
if(!hide){ |
||||
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
|
||||
} |
||||
}); |
||||
( |
||||
$(".imgContainer").live("click",function(){ |
||||
sankore.sendFileMetadata(createMetaData($(this))); |
||||
})); |
||||
|
||||
$(window).resize(function(){ |
||||
disclaimer.width($("body").width()-20); |
||||
search.width($("body").width()-20); |
||||
toggleIcon.css("margin-left",(togglePages.width()/2 - 7)); |
||||
}) |
||||
|
||||
}); |
||||
|
||||
function gotoPage(i) { |
||||
runSearch(currentTerm, i); |
||||
} |
||||
|
||||
// launching the search on planete sankore |
||||
function runSearch(term, index) { |
||||
currentTerm = term; |
||||
currentIndex = index; |
||||
var start = index * limit; |
||||
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit; |
||||
$.ajax({ |
||||
url: url, |
||||
success: searchComplete, |
||||
error: searchFail, |
||||
dataType: "json" |
||||
}); |
||||
} |
||||
|
||||
function createMetaData(parent){ |
||||
var meta = ""; |
||||
//alert($(this).find("input:hidden").eq(0).val()); |
||||
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" + |
||||
parent.find("input:hidden").eq(0).val() + |
||||
"</value></data><data><key>Content</key><value>" + |
||||
parent.find("input:hidden").eq(1).val() + |
||||
"</value></data><data><key>Height</key><value>" + |
||||
parent.find("input:hidden").eq(2).val() + |
||||
"</value></data><data><key>Width</key><value>" + |
||||
parent.find("input:hidden").eq(3).val() + |
||||
"</value></data><data><key>Title</key><value>" + |
||||
parent.find("input:hidden").eq(4).val() + |
||||
"</value></data></metadata>"; |
||||
return meta; |
||||
} |
||||
</script> |
||||
|
||||
</head> |
||||
<body style="font-family: Arial;border: 0 none;"> |
||||
<div id="branding" style="float: left;"></div><br /> |
||||
<div id="searchResult"></div> |
||||
</body> |
||||
</html> |
@ -0,0 +1,16 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<widget xmlns="http://www.w3.org/ns/widgets" |
||||
xmlns:ub="http://uniboard.mnemis.com/widgets" |
||||
id="http://uniboard.mnemis.com/widgets/webbrowser" |
||||
version="1.1" |
||||
width="900" |
||||
height="500" |
||||
ub:resizable="true"> |
||||
|
||||
<name>Choisir</name> |
||||
<author href="http://www.getuniboard.com" |
||||
email="info@mnemis.com">Mnemis SA</author> |
||||
<description>Choisir widget</description> |
||||
|
||||
<content src="index.html"/> |
||||
</widget> |
@ -0,0 +1,340 @@ |
||||
html, body{ |
||||
width: 100%; |
||||
padding: 0; |
||||
height: auto; |
||||
background-color: white; |
||||
margin: 0; |
||||
} |
||||
|
||||
a { |
||||
text-decoration: none; |
||||
} |
||||
|
||||
.disclaimer{ |
||||
height: 30px; |
||||
position: fixed; |
||||
left: 0; |
||||
bottom: 0; |
||||
margin-left: 1px; |
||||
margin-right: 1px; |
||||
margin-bottom: 0px; |
||||
padding: 5px; |
||||
text-align: center; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-top-left-radius: 15px; |
||||
-webkit-border-top-right-radius: 15px; |
||||
border-top-left-radius: 15px; |
||||
border-top-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-bottom: none; |
||||
z-index: 10; |
||||
} |
||||
|
||||
#searchResult { |
||||
overflow: hidden; |
||||
text-align: center; |
||||
} |
||||
|
||||
.search{ |
||||
width: 90%; |
||||
position: fixed; |
||||
top: 0; |
||||
left: 0; |
||||
padding: 5px; |
||||
background-color: #BBBBBB; |
||||
-webkit-border-bottom-left-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
border-bottom-left-radius: 15px; |
||||
border-bottom-right-radius: 15px; |
||||
border: solid 4px #EEEEEE; |
||||
border-top: none; |
||||
z-index: 101; |
||||
} |
||||
|
||||
.search, |
||||
.disclaimer { |
||||
width: 100%; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.togglePages{ |
||||
padding: 0; |
||||
position: absolute; |
||||
bottom: -19px; |
||||
left: 40%; |
||||
width: 22%; |
||||
height: 15px; |
||||
background-color: #666; |
||||
-webkit-border-bottom-left-radius: 20px; |
||||
-webkit-border-bottom-right-radius: 20px; |
||||
border-bottom-left-radius: 20px; |
||||
border-bottom-right-radius: 20px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
box-shadow: #dadada -1px 0 4px; |
||||
cursor: pointer; |
||||
z-index: 100; |
||||
text-align: center; |
||||
} |
||||
|
||||
.toggleIcon{ |
||||
display: inline-block; |
||||
width: 14px; |
||||
height: 14px; |
||||
background: url(../images/trgUp.png) 50% no-repeat; |
||||
|
||||
} |
||||
|
||||
.searchInput{ |
||||
padding: 3px; |
||||
float: left; |
||||
width: 100%; |
||||
border-radius: 3px; |
||||
border-style: none; |
||||
height: 22px; |
||||
line-height: 18px; |
||||
vertical-align: middle; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.searchButton{ |
||||
background: url("../images/search_app.png") -38px -38px no-repeat; |
||||
width: 24px; |
||||
height: 24px; |
||||
overflow: hidden; |
||||
position: absolute; |
||||
right: 30px; |
||||
top: 9px; |
||||
margin-left: -2px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.subSearch{ |
||||
margin: 0; |
||||
float: left; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
width: 100%; |
||||
float: left; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
padding: 5px; |
||||
padding-right: 26px; |
||||
} |
||||
|
||||
#subSearchFilter{ |
||||
width: 100%; |
||||
float: left; |
||||
display: none; |
||||
} |
||||
|
||||
.searchResult{ |
||||
width: 98%; |
||||
padding: 3px; |
||||
background-color:#123456; |
||||
} |
||||
|
||||
.imgContainer{ |
||||
display: inline-block; |
||||
padding: 3px; |
||||
margin: 3px; |
||||
text-align: center; |
||||
overflow: hidden; |
||||
font-size: small; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
border: 1px solid #666; |
||||
border-radius: 5px; |
||||
-webkit-box-shadow: #dadada -1px 0 4px; |
||||
-webkit-border-radius: 5px; |
||||
box-shadow: #666 -1px 0 4px; |
||||
vertical-align: top; |
||||
} |
||||
|
||||
.resultFooter{ |
||||
float: left; |
||||
margin: 5px; |
||||
padding: 3px; |
||||
width: 100%; |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
font-weight: bold; |
||||
font-size: x-large; |
||||
text-align: center; |
||||
} |
||||
|
||||
#branding{ |
||||
position: absolute; |
||||
top: 0; |
||||
left: 0; |
||||
z-index: 2; |
||||
} |
||||
|
||||
.filterContainer{ |
||||
float: left; |
||||
margin: 2px; |
||||
padding: 2px; |
||||
font-size: 14px; |
||||
|
||||
} |
||||
|
||||
.filterSelect{ |
||||
border-style:none; |
||||
-webkit-border-top-right-radius: 15px; |
||||
-webkit-border-bottom-right-radius: 15px; |
||||
-moz-border-radius-topright: 15px; |
||||
-moz-border-radius-bottomright: 15px; |
||||
border-top-right-radius: 15px; |
||||
margin-top: 2px; |
||||
width: 100%; |
||||
} |
||||
|
||||
span{ |
||||
font-family: Verdana,Arial,Helvetica,sans-serif; |
||||
color: #666; |
||||
} |
||||
|
||||
[draggable] { |
||||
-webkit-user-select: none; |
||||
user-select: none; |
||||
} |
||||
|
||||
.toggleFilters{ |
||||
margin: 0; |
||||
padding: 0; |
||||
background-position: center; |
||||
background-image: url(../images/down.png); |
||||
position: absolute; |
||||
top: 11px; |
||||
right: 6px; |
||||
width: 20px; |
||||
height: 20px; |
||||
cursor: pointer; |
||||
} |
||||
|
||||
.colors_line { |
||||
float: left; |
||||
margin: 4px; |
||||
margin-right: 0; |
||||
clear: left; |
||||
} |
||||
|
||||
.custom { |
||||
opacity: 0; |
||||
position: absolute; |
||||
left: -10000px; |
||||
} |
||||
|
||||
.filter_button.button.color { |
||||
display: inline-block; |
||||
width: 15px; |
||||
height: 15px; |
||||
border: 1px solid #EBEBEB; |
||||
padding: 0; |
||||
margin: 0; |
||||
box-sizing: border-box; |
||||
-webkit-box-sizing: border-box; |
||||
} |
||||
|
||||
.filter_button.button.color:hover { |
||||
border: 1px solid rgb(128,128,128); |
||||
cursor: pointer; |
||||
} |
||||
|
||||
input[type="radio"]:checked + .filter_button.button.color { |
||||
border: 1px solid rgb(255,255,255); |
||||
box-shadow: 0 0 0px 1px #000; |
||||
-webkit-box-shadow: 0 0 0px 1px #000; |
||||
} |
||||
|
||||
#allcolor { |
||||
background: white url('../images/search_app.png') -43px -144px no-repeat; |
||||
} |
||||
|
||||
#colored { |
||||
background: white url('../images/search_app.png') -43px -244px no-repeat; |
||||
} |
||||
|
||||
#grayed { |
||||
background: white url('../images/search_app.png') -45px -343px no-repeat; |
||||
} |
||||
|
||||
#black{ |
||||
background-color:#ffffff; |
||||
} |
||||
#blue{ |
||||
background-color:#0000FF; |
||||
} |
||||
#brown{ |
||||
background-color:rgba(139, 82, 16, 1); |
||||
} |
||||
|
||||
#gray{ |
||||
background-color:#999999; |
||||
} |
||||
|
||||
#green{ |
||||
background-color:#00CC00; |
||||
} |
||||
|
||||
#orange{ |
||||
background-color:#FB940B; |
||||
} |
||||
|
||||
#pink{ |
||||
background-color:#FF98BF; |
||||
} |
||||
|
||||
#purple{ |
||||
background-color:#762CA7; |
||||
} |
||||
|
||||
#red{ |
||||
background-color:#CC0000; |
||||
} |
||||
|
||||
#teal{ |
||||
background-color:#03C0C6; |
||||
} |
||||
|
||||
#white{ |
||||
background-color:#000000; |
||||
} |
||||
|
||||
#yellow{ |
||||
background-color:#FFFF00; |
||||
} |
||||
|
||||
.selectBox-dropdown, .selectBox-options li a { |
||||
line-height: 1.3 !important; |
||||
font-size: 13px; |
||||
} |
||||
|
||||
.pager_button { |
||||
padding: 3px 5px; |
||||
font-size: 16px; |
||||
color: black; |
||||
display: inline-block; |
||||
} |
||||
|
||||
.pager_button.active { |
||||
border-radius: 3px; |
||||
-webkit-border-radius: 3px; |
||||
background-color: gray; |
||||
color: white; |
||||
} |
||||
|
||||
/* |
||||
Planete Sankore Changes |
||||
*/ |
||||
.searchButton{ |
||||
right: 10px; |
||||
} |
||||
|
||||
#subSearchInput{ |
||||
padding-right: 5px; |
||||
} |
||||
|
||||
.imgContainer img { |
||||
width: 100px; |
||||
} |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 214 B |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 931 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 475 B |
After Width: | Height: | Size: 448 B |
After Width: | Height: | Size: 1.2 KiB |
@ -0,0 +1,255 @@ |
||||
<!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> |
||||
<title>Planete Sankore Image Search</title> |
||||
<link rel="stylesheet" type="text/css" href="css/basic.css"/> |
||||
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> |
||||
<script type="text/javascript"> |
||||
var category = "video"; |
||||
var thumbnails = false; |
||||
var minHeight = 180; |
||||
var minWidth = 150; |
||||
|
||||
var currentIndex = 0; |
||||
var currentTerm = ""; |
||||
var limit = 10; |
||||
var filtersDisplayed = false; //display or hide filters |
||||
|
||||
function addPaginationLinks(totalResults) { |
||||
var curPage = currentIndex; // check what page the app is on |
||||
var pagesDiv = $("<div id='resultFooter' class='resultFooter'>"); |
||||
for (var i = 0; i < 10; i++) { |
||||
if (i * limit < totalResults) { |
||||
|
||||
var link = $("<a class='pager_button'></a>").attr('href', 'javascript:gotoPage('+i+');').html(i).appendTo(pagesDiv); |
||||
if (curPage == i) { |
||||
link.addClass('active'); |
||||
} |
||||
} |
||||
} |
||||
|
||||
pagesDiv.appendTo($('#searchResult')); |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragstart", imageDragging, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragenter", imageDragenter, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragleave", imageDragleave, false); |
||||
}) |
||||
|
||||
$(".imgContainer").each(function(){ |
||||
this.addEventListener("dragover", imageDragover, false); |
||||
}) |
||||
} |
||||
|
||||
function searchFail(jqXHR, textStatus, errorThrown) { |
||||
alert('Impossible to connect to Planete Sankore: ' + textStatus + ' ' + errorThrown); |
||||
} |
||||
|
||||
function searchComplete(json) { |
||||
// Grab our content div, clear it. |
||||
var totalResults = json.totalResults; |
||||
var contentDiv = $('#searchResult').empty(); |
||||
// Loop through our results, printing them to the page. |
||||
var results = json.rows; |
||||
for (var i = 0; i < results.length; i++) { |
||||
// For each result write it's title and image to the screen |
||||
var result = results[i]; |
||||
var imgContainer = $("<div class='imgContainer' draggable='true'>"); |
||||
var title = document.createElement('div'); |
||||
var iUrl = $("<input type='hidden'/>"); |
||||
var iContent = $("<input type='hidden'/>"); |
||||
var iHeight = $("<input type='hidden'/>"); |
||||
var iWidth = $("<input type='hidden'/>"); |
||||
var iTitle = $("<input type='hidden'/>"); |
||||
|
||||
// We use titleNoFormatting so that no HTML tags are left in the |
||||
// title |
||||
title.innerHTML = result.title; |
||||
var newImg = document.createElement('img'); |
||||
|
||||
// There is also a result.file property which has the escaped version |
||||
if (thumbnails) { |
||||
newImg.src = result.file; |
||||
} else { |
||||
newImg.src = "./images/thumbnail_icon.png"; |
||||
} |
||||
var imgWidth = (result.tbWidth > minWidth)?result.tbWidth:minWidth; |
||||
var imgHeight = (result.tbHeight > minHeight)?result.tbHeight:minHeight; |
||||
imgContainer.width(imgWidth).height(imgHeight); |
||||
imgContainer.append($(newImg)); |
||||
iUrl.attr("value", result.file); |
||||
iContent.attr("value", result.title); |
||||
iHeight.attr("value", result.height); |
||||
iWidth.attr("value", result.width); |
||||
iTitle.attr("value",result.title); |
||||
imgContainer.append($(title)); |
||||
imgContainer.append(iUrl); |
||||
imgContainer.append(iContent); |
||||
imgContainer.append(iHeight); |
||||
imgContainer.append(iWidth); |
||||
imgContainer.append(iTitle); |
||||
|
||||
// Put our title + image in the content |
||||
imgContainer.appendTo(contentDiv); |
||||
|
||||
} |
||||
// Now add links to additional pages of search results. |
||||
addPaginationLinks(totalResults); |
||||
} |
||||
|
||||
function imageDragging(e){ |
||||
e.dataTransfer.setData("text/plain",$(this).find("input:hidden").eq(0).val()); |
||||
// alert($(this).find("input:hidden").eq(0).val()); |
||||
} |
||||
|
||||
function imageDragleave(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragover(e){ |
||||
return false; |
||||
} |
||||
|
||||
function imageDragenter(e){ |
||||
return false; |
||||
} |
||||
|
||||
$(document).ready(function(){ |
||||
|
||||
//variables |
||||
var mode = false; //search or view mode |
||||
var hide = false; //hide or no main panel |
||||
|
||||
//basic containers and elements |
||||
var disclaimer = $("<div id='disclaimer' class='disclaimer'>Disclaimer<div>").appendTo("body"); |
||||
var search = $("<div id='search' class='search'>").appendTo("body"); |
||||
|
||||
var togglePages = $("<div id='togglePages' class='togglePages'>").appendTo(search); |
||||
var toggleIcon = $("<div id='toggleIcon' class='toggleIcon'>").appendTo(togglePages); |
||||
|
||||
var subSearchInput = $("<div id='subSearchInput' class='subSearch'>").appendTo(search); |
||||
var subSearchFilter = $("<div id='subSearchFilter' class='subSearch'>").appendTo(search); |
||||
|
||||
var searchInput = $("<input id='searchInput' class='searchInput' type='text'/>").appendTo(subSearchInput); |
||||
var searchButton = $("<div id='searchButton' class='searchButton'>").appendTo(subSearchInput); |
||||
// var toggleFilters = $("<div id='toggleFilters' class='toggleFilters'>").appendTo(subSearchInput); |
||||
|
||||
//adding filters to the wgt |
||||
var selectFilter = $("<select id='sizeFilter' class='filterSelect'>") |
||||
.append($("<option value='0'>Any</option>")) |
||||
.append($("<option value='1'>Small</option>")) |
||||
.append($("<option value='2'>Medium</option>")) |
||||
.append($("<option value='3'>Large</option>")) |
||||
.append($("<option value='4'>Extra large</option>")); |
||||
$("<div class='filterContainer'>").append("<span>Size:</span>").append(selectFilter).appendTo(subSearchFilter); |
||||
|
||||
//mouse click actions |
||||
/* |
||||
toggleFilters.click(function(){ |
||||
if(filtersDisplayed){ |
||||
subSearchFilter.hide(); |
||||
toggleFilters.css("background-image","url(images/down.png)"); |
||||
filtersDisplayed = false; |
||||
} else { |
||||
subSearchFilter.show(); |
||||
toggleFilters.css("background-image","url(images/up.png)"); |
||||
filtersDisplayed = true; |
||||
} |
||||
}); |
||||
*/ |
||||
|
||||
togglePages.click(function(event){ |
||||
if(mode){ |
||||
hide = false; |
||||
$("#search, #disclaimer").slideDown('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgUp.png)"); |
||||
togglePages.appendTo("#search").css("top","").css("bottom","-14px"); |
||||
}); |
||||
mode = false; |
||||
} else { |
||||
hide = true; |
||||
$("#search, #disclaimer").slideUp('slow', function(){ |
||||
toggleIcon.css("background-image","url(images/trgDown.png)"); |
||||
togglePages.appendTo("body").css("top","0"); |
||||
}); |
||||
mode = true; |
||||
} |
||||
}); |
||||
|
||||
searchButton.click(function(){ |
||||
if(!hide){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
}); |
||||
|
||||
searchInput.keydown(function(event){ |
||||
if(!hide){ |
||||
if((event.keyCode == 0xA)||(event.keyCode == 0xD)){ |
||||
runSearch(searchInput.val(), 0); |
||||
togglePages.trigger("click"); |
||||
} |
||||
|
||||
} |
||||
}); |
||||
( |
||||
$(".imgContainer").live("click",function(){ |
||||
sankore.sendFileMetadata(createMetaData($(this))); |
||||
})); |
||||
|
||||
$(window).resize(function(){ |
||||
disclaimer.width($("body").width()-20); |
||||
search.width($("body").width()-20); |
||||
toggleIcon.css("margin-left",(togglePages.width()/2 - 7)); |
||||
}) |
||||
|
||||
}); |
||||
|
||||
function gotoPage(i) { |
||||
runSearch(currentTerm, i); |
||||
} |
||||
|
||||
// launching the search on planete sankore |
||||
function runSearch(term, index) { |
||||
currentTerm = term; |
||||
currentIndex = index; |
||||
var start = index * limit; |
||||
var url = "http://planete.sankore.org/xwiki/bin/view/Search/Resources?xpage=plain&category=" + category + "&level=&sort=title&dir=ASC&terms=" + escape(term) + "&start=" + start + "&limit=" + limit; |
||||
$.ajax({ |
||||
url: url, |
||||
success: searchComplete, |
||||
error: searchFail, |
||||
dataType: "json" |
||||
}); |
||||
} |
||||
|
||||
function createMetaData(parent){ |
||||
var meta = ""; |
||||
//alert($(this).find("input:hidden").eq(0).val()); |
||||
meta = "<metadata><data><key>Type</key><value>Image</value></data><data><key>Url</key><value>" + |
||||
parent.find("input:hidden").eq(0).val() + |
||||
"</value></data><data><key>Content</key><value>" + |
||||
parent.find("input:hidden").eq(1).val() + |
||||
"</value></data><data><key>Height</key><value>" + |
||||
parent.find("input:hidden").eq(2).val() + |
||||
"</value></data><data><key>Width</key><value>" + |
||||
parent.find("input:hidden").eq(3).val() + |
||||
"</value></data><data><key>Title</key><value>" + |
||||
parent.find("input:hidden").eq(4).val() + |
||||
"</value></data></metadata>"; |
||||
return meta; |
||||
} |
||||
</script> |
||||
|
||||
</head> |
||||
<body style="font-family: Arial;border: 0 none;"> |
||||
<div id="branding" style="float: left;"></div><br /> |
||||
<div id="searchResult"></div> |
||||
</body> |
||||
</html> |