remove broken tagger extension
This commit is contained in:
parent
866b77ab19
commit
fd359fb08c
Binary file not shown.
Before Width: | Height: | Size: 183 B |
Binary file not shown.
Before Width: | Height: | Size: 227 B |
Binary file not shown.
Before Width: | Height: | Size: 170 B |
Binary file not shown.
Before Width: | Height: | Size: 198 B |
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
class TaggerInfo extends ExtensionInfo
|
||||
{
|
||||
public const KEY = "tagger";
|
||||
|
||||
public $key = self::KEY;
|
||||
public $name = "Tagger";
|
||||
public $authors = ["Artanis (Erik Youngren)"=>"artanis.00@gmail.com"];
|
||||
public $dependencies = [TaggerXMLInfo::KEY];
|
||||
public $description = "Advanced Tagging v2";
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
class Tagger extends Extension
|
||||
{
|
||||
/** @var TaggerTheme */
|
||||
protected $theme;
|
||||
|
||||
public function onDisplayingImage(DisplayingImageEvent $event)
|
||||
{
|
||||
global $page, $user;
|
||||
|
||||
if ($user->can(Permissions::EDIT_IMAGE_TAG) && ($event->image->is_locked() || $user->can(Permissions::EDIT_IMAGE_LOCK))) {
|
||||
$this->theme->build_tagger($page, $event);
|
||||
}
|
||||
}
|
||||
|
||||
public function onSetupBuilding(SetupBuildingEvent $event)
|
||||
{
|
||||
$sb = new SetupBlock("Tagger");
|
||||
$sb->add_int_option("ext_tagger_search_delay", "Delay queries by ");
|
||||
$sb->add_label(" milliseconds.");
|
||||
$sb->add_label("<br/>Limit queries returning more than ");
|
||||
$sb->add_int_option("ext_tagger_tag_max");
|
||||
$sb->add_label(" tags to ");
|
||||
$sb->add_int_option("ext_tagger_limit");
|
||||
$event->panel->add_block($sb);
|
||||
}
|
||||
}
|
@ -1,221 +0,0 @@
|
||||
/*jshint forin:false, nonew:true, undef:true, strict:false, browser:true, jquery:true */
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
||||
* Do not remove this notice. *
|
||||
\* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
function byId(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
var Tagger = {
|
||||
initialize : function (image_id) {
|
||||
// object navigation
|
||||
this.tag.parent = this;
|
||||
this.position.parent = this;
|
||||
// components
|
||||
this.editor.container = byId('tagger_parent');
|
||||
this.editor.titlebar = byId('tagger_titlebar');
|
||||
this.editor.toolbar = byId('tagger_toolbar');
|
||||
//this.editor.menu = byId('tagger_p-menu');
|
||||
this.editor.body = byId('tagger_body');
|
||||
this.editor.tags = byId('tagger_tags');
|
||||
this.editor.form = this.editor.tags.parentNode;
|
||||
this.editor.statusbar = byId('tagger_statusbar');
|
||||
// initial data
|
||||
this.tag.image = image_id;
|
||||
this.tag.query = config.make_link("tagger/tags");
|
||||
this.tag.list = null;
|
||||
this.tag.suggest = null;
|
||||
this.tag.image_tags();
|
||||
|
||||
// reveal
|
||||
this.editor.container.style.display = "";
|
||||
|
||||
// dragging
|
||||
DragHandler.attach(this.editor.titlebar);
|
||||
|
||||
// positioning
|
||||
this.position.load();
|
||||
|
||||
// events
|
||||
window.onunload = function () { Tagger.position.save(); };
|
||||
},
|
||||
|
||||
alert : function (type,text,timeout) {
|
||||
var id = "tagger_alert-"+type;
|
||||
var t_alert = byId(id);
|
||||
if (t_alert) {
|
||||
if(text === false) {
|
||||
// remove
|
||||
t_alert.parentNode.removeChild(t_alert);
|
||||
} else {
|
||||
// update
|
||||
t_alert.innerHTML = text;
|
||||
}
|
||||
} else if (text) {
|
||||
// create
|
||||
t_alert = document.createElement("div");
|
||||
t_alert.setAttribute("id",id);
|
||||
t_alert.appendChild(document.createTextNode(text));
|
||||
this.editor.statusbar.appendChild(t_alert);
|
||||
if(timeout>1) {
|
||||
console.log("Tagger.alert('"+type+"',false,0)");
|
||||
setTimeout("Tagger.alert('"+type+"',false,0)",timeout);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
editor : {},
|
||||
|
||||
tag : {
|
||||
submit : function () {
|
||||
var l = this.list.childNodes.length;
|
||||
var tags = [];
|
||||
for(var i=0; i<l; i++) {
|
||||
var s_tag = this.list.childNodes[i].firstChild.data;
|
||||
tags.push(s_tag);
|
||||
}
|
||||
tags = tags.join(" ");
|
||||
this.parent.editor.tags.value = tags;
|
||||
return true;
|
||||
},
|
||||
|
||||
search : function(s,ms) {
|
||||
clearTimeout(Tagger.tag.timer);
|
||||
Tagger.tag.timer = setTimeout(
|
||||
"Tagger.tag.ajax('"+Tagger.tag.query+"?s="+s+"',Tagger.tag.receive)",
|
||||
ms);
|
||||
},
|
||||
|
||||
receive : function (xml) {
|
||||
if(xml) {
|
||||
Tagger.tag.suggest = document.importNode(
|
||||
xml.responseXML.getElementsByTagName("list")[0],true);
|
||||
Tagger.tag.publish(Tagger.tag.suggest,byId("tagger_p-search"));
|
||||
}
|
||||
if(Tagger.tag.suggest.getAttribute("max")) {
|
||||
var rows = Tagger.tag.suggest.getAttribute("rows");
|
||||
var max = Tagger.tag.suggest.getAttribute("max");
|
||||
Tagger.alert("maxout","Showing "+rows+" of "+max+" tags",0);
|
||||
} else {
|
||||
Tagger.alert("maxout",false);
|
||||
}
|
||||
},
|
||||
|
||||
image_tags : function(xml) {
|
||||
if (!xml) {
|
||||
this.ajax(this.query+"/"+this.image,this.image_tags);
|
||||
return true;
|
||||
} else {
|
||||
Tagger.tag.list = document.importNode(
|
||||
xml.responseXML.getElementsByTagName("list")[0],true);
|
||||
Tagger.tag.publish(Tagger.tag.list,byId("tagger_p-applied"));
|
||||
}
|
||||
},
|
||||
|
||||
publish : function (list, page) {
|
||||
list.setAttribute("xmlns","http://www.w3.org/1999/xhtml");
|
||||
|
||||
var l = list.childNodes.length;
|
||||
for(var i=0; i<l; i++) {
|
||||
var tag = list.childNodes[i];
|
||||
tag.onclick = function () {
|
||||
Tagger.tag.toggle(this);
|
||||
byId("tagger_filter").select();
|
||||
};
|
||||
tag.setAttribute("title",tag.getAttribute("count")+" uses");
|
||||
}
|
||||
|
||||
page.innerHTML = "";
|
||||
page.appendChild(list);
|
||||
},
|
||||
|
||||
create : function (tag_name) {
|
||||
if(tag_name.length > 0) {
|
||||
var tag = document.createElement("tag");
|
||||
tag.setAttribute("count","0");
|
||||
tag.setAttribute("id","newTag_"+tag_name);
|
||||
tag.setAttribute("title","New - 0 uses");
|
||||
tag.onclick = function() {
|
||||
Tagger.tag.toggle(this);
|
||||
};
|
||||
tag.appendChild(document.createTextNode(tag_name));
|
||||
Tagger.tag.list.appendChild(tag);
|
||||
}
|
||||
},
|
||||
|
||||
toggle : function (tag) {
|
||||
if(tag.parentNode == this.list) {
|
||||
this.list.removeChild(tag);
|
||||
} else {
|
||||
this.list.appendChild(tag);
|
||||
}
|
||||
},
|
||||
|
||||
ajax : function (url, callback) {
|
||||
var http = new XMLHttpRequest();
|
||||
http.open("GET",url,true);
|
||||
http.onreadystatechange = function () {
|
||||
if(http.readyState == 4) { callback(http); }
|
||||
};
|
||||
http.send(null);
|
||||
}
|
||||
},
|
||||
|
||||
position : {
|
||||
set : function (x,y) {
|
||||
if (!x || !y) {
|
||||
this.parent.editor.container.style.top = "25px";
|
||||
this.parent.editor.container.style.left = "";
|
||||
this.parent.editor.container.style.right = "25px";
|
||||
this.parent.editor.container.style.bottom = "";
|
||||
|
||||
var xy = this.get();
|
||||
x = xy[0];
|
||||
y = xy[1];
|
||||
}
|
||||
this.parent.editor.container.style.top = y+"px";
|
||||
this.parent.editor.container.style.left = x+"px";
|
||||
this.parent.editor.container.style.right = "";
|
||||
this.parent.editor.container.style.bottom = "";
|
||||
},
|
||||
|
||||
get : function () {
|
||||
// https://www.quirksmode.org/js/findpos.html
|
||||
var left = 0;
|
||||
var top = 0;
|
||||
var obj = this.parent.editor.container;
|
||||
if(obj.offsetParent) {
|
||||
left = obj.offsetLeft;
|
||||
top = obj.offsetTop;
|
||||
while (obj = obj.offsetParent) {
|
||||
left += obj.offsetLeft;
|
||||
top += obj.offsetTop;
|
||||
}
|
||||
}
|
||||
return [left,top];
|
||||
},
|
||||
|
||||
save : function (x,y) {
|
||||
if (!x || !y) {
|
||||
var xy = this.get();
|
||||
x = xy[0];
|
||||
y = xy[1];
|
||||
}
|
||||
Cookies.set(config.title+"_tagger-position", x+" "+y, {expires: 14});
|
||||
},
|
||||
|
||||
load : function () {
|
||||
var p = Cookies.get(config.title+"_tagger-position");
|
||||
if(p) {
|
||||
var xy = p.split(" ");
|
||||
this.set(xy[0],xy[1]);
|
||||
} else {
|
||||
this.set();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,103 +0,0 @@
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
||||
* Do not remove this notice. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#tagger_parent {
|
||||
text-align:left;
|
||||
position:fixed;
|
||||
max-width:300px;
|
||||
|
||||
}
|
||||
#tagger_parent * {
|
||||
background-color:#EEE;
|
||||
}
|
||||
|
||||
#tagger_titlebar {
|
||||
background-color:#ddd;
|
||||
border:2px solid;
|
||||
cursor:move;
|
||||
font-weight:bold;
|
||||
-moz-border-radius:5px 5px 0 0;
|
||||
padding:.25em;
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#tagger_toolbar, #tagger_body {
|
||||
padding:2px 2px 0 2px;
|
||||
border-style:solid;
|
||||
border-width: 0 2px 0 2px;
|
||||
}
|
||||
#tagger_body {
|
||||
max-height:175px;
|
||||
overflow-x:hidden;
|
||||
overflow-y:auto;
|
||||
}
|
||||
|
||||
#tagger_statusbar {
|
||||
background-color:#ddd;
|
||||
border:2px solid;
|
||||
font-weight: bold;
|
||||
min-height:16px;
|
||||
-moz-border-radius:0 0 5px 5px;
|
||||
padding:.25em;
|
||||
} #tagger_statusbar * { background-color:#ddd; }
|
||||
|
||||
#tagger_body div {
|
||||
padding-top:2px;
|
||||
margin-top:2px;
|
||||
border-top:1px solid;
|
||||
}
|
||||
|
||||
/* Tagger Styling
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
#tagger_parent form {
|
||||
display:inline;
|
||||
}
|
||||
#tagger_parent input {
|
||||
width:auto;
|
||||
}
|
||||
#tagger_parent input[type=text] {
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
/* Custom Element Base Styles
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
#tagger_parent list {
|
||||
display: block;
|
||||
}
|
||||
#tagger_parent tag {
|
||||
font-size:1.25em;
|
||||
display:block;
|
||||
}
|
||||
|
||||
#tagger_parent list[id=image] tag:before {
|
||||
content:url('./images/active.png');
|
||||
}
|
||||
|
||||
#tagger_parent list[id=search] tag:before {
|
||||
content:url('./images/inactive.png');
|
||||
}
|
||||
/* Hovering */
|
||||
#tagger_parent tag:hover {
|
||||
cursor:pointer;
|
||||
background-color:#ddd;
|
||||
}
|
||||
|
||||
/*#tagger_parent list[id=image] tag:hover {
|
||||
background-color:#faa;
|
||||
}
|
||||
|
||||
#tagger_parent list[id=search] tag:hover {
|
||||
background-color:#afa;
|
||||
}*/
|
||||
|
||||
#tagger_parent list[id=image] tag:hover:before {
|
||||
content:url('./images/rem-tag.png');
|
||||
}
|
||||
|
||||
#tagger_parent list[id=search] tag:hover:before {
|
||||
content:url('./images/add-tag.png');
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
<?php declare(strict_types=1);
|
||||
use function MicroHTML\DIV;
|
||||
use function MicroHTML\FORM;
|
||||
use function MicroHTML\INPUT;
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Tagger - Advanced Tagging v2 *
|
||||
* Author: Artanis (Erik Youngren <artanis.00@gmail.com>) *
|
||||
* Do not remove this notice. *
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
class TaggerTheme extends Themelet
|
||||
{
|
||||
public function build_tagger(Page $page, DisplayingImageEvent $event)
|
||||
{
|
||||
// Initialization code
|
||||
$base_href = get_base_href();
|
||||
// TODO: AJAX test and fallback.
|
||||
|
||||
$page->add_html_header("<script src='$base_href/ext/tagger/webtoolkit.drag.js' type='text/javascript'></script>");
|
||||
$page->add_block(new Block(
|
||||
null,
|
||||
"<script type='text/javascript'>
|
||||
$( document ).ready(function() {
|
||||
Tagger.initialize(".$event->get_image()->id.");
|
||||
});
|
||||
</script>",
|
||||
"main",
|
||||
1000
|
||||
));
|
||||
|
||||
// Tagger block
|
||||
$page->add_block(new Block(
|
||||
null,
|
||||
(string)$this->html($event->get_image()),
|
||||
"main"
|
||||
));
|
||||
}
|
||||
private function html(Image $image)
|
||||
{
|
||||
global $config;
|
||||
$h_query = isset($_GET['search'])? $h_query= "search=".url_escape($_GET['search']) : "";
|
||||
|
||||
$delay = $config->get_string("ext_tagger_search_delay", "250");
|
||||
|
||||
// TODO: option for initial Tagger window placement.
|
||||
return DIV(
|
||||
["id"=>"tagger_parent", "style"=>"display:none; top:25px; right:25px;"],
|
||||
DIV(["id"=>"tagger_titlebar"], "Tagger"),
|
||||
DIV(
|
||||
["id"=>"tagger_toolbar"],
|
||||
INPUT(["type"=>"text", "value"=>"", "id"=>"tagger_filter", "onkeyup"=>"Tagger.tag.search(this.value, $delay);"]),
|
||||
INPUT(["type"=>"button", "value">"Add", "onclick"=>"Tagger.tag.create(byId('tagger_filter').value);"]),
|
||||
FORM(
|
||||
["action"=>make_link("tag_edit/set"), "method"=>"POST", "onsubmit"=>"Tagger.tag.submit();"],
|
||||
INPUT(["type"=>"hidden", "name"=>"image_id", "value"=>$image->id, "id"=>"image_id"]),
|
||||
INPUT(["type"=>"hidden", "name"=>"query", "value"=>$h_query, "id"=>""]),
|
||||
INPUT(["type"=>"hidden", "name"=>"source", "value"=>$image->source, "id"=>""]),
|
||||
INPUT(["type"=>"hidden", "name"=>"tags", "value"=>"", "id"=>"tagger_tags"]),
|
||||
INPUT(["type"=>"", "value"=>"Set"]),
|
||||
),
|
||||
# UL(["id"=>"tagger_p-menu"]),
|
||||
# BR(["style"=>"clear:both;"]),
|
||||
),
|
||||
DIV(
|
||||
["id"=>"tagger_body"],
|
||||
DIV(["id"=>"tagger_p-search", "name"=>"Searched Tags"]),
|
||||
DIV(["id"=>"tagger_p-applied", "name"=>"Applied Tags"]),
|
||||
),
|
||||
DIV(
|
||||
["id"=>"tagger_statusbar"],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
/*jshint bitwise:true, curly:true, forin:false, noarg:true, noempty:true, nonew:true, undef:true, strict:false, browser:true, jquery:true */
|
||||
|
||||
/**
|
||||
*
|
||||
* Crossbrowser Drag Handler
|
||||
* http://www.webtoolkit.info/
|
||||
*
|
||||
* Modified by Erik Youngren to move parent node
|
||||
**/
|
||||
|
||||
var DragHandler = {
|
||||
|
||||
|
||||
// private property.
|
||||
_oElem : null,
|
||||
|
||||
|
||||
// public method. Attach drag handler to an element.
|
||||
attach : function(oElem) {
|
||||
oElem.onmousedown = DragHandler._dragBegin;
|
||||
|
||||
// callbacks
|
||||
oElem.dragBegin = function () {};
|
||||
oElem.drag = function () {};
|
||||
oElem.dragEnd = function () {};
|
||||
|
||||
return oElem;
|
||||
},
|
||||
|
||||
|
||||
// private method. Begin drag process.
|
||||
_dragBegin : function(e) {
|
||||
var oElem = DragHandler._oElem = this;
|
||||
|
||||
if (isNaN(parseInt(oElem.parentNode.style.left))) { oElem.parentNode.style.left = '0px'; }
|
||||
if (isNaN(parseInt(oElem.parentNode.style.top))) { oElem.parentNode.style.top = '0px'; }
|
||||
|
||||
var x = parseInt(oElem.parentNode.style.left);
|
||||
var y = parseInt(oElem.parentNode.style.top);
|
||||
|
||||
e = e ? e : window.event;
|
||||
oElem.mouseX = e.clientX;
|
||||
oElem.mouseY = e.clientY;
|
||||
|
||||
oElem.dragBegin(oElem, x, y);
|
||||
|
||||
document.onmousemove = DragHandler._drag;
|
||||
document.onmouseup = DragHandler._dragEnd;
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
// private method. Drag (move) element.
|
||||
_drag : function(e) {
|
||||
var oElem = DragHandler._oElem;
|
||||
|
||||
var x = parseInt(oElem.parentNode.style.left);
|
||||
var y = parseInt(oElem.parentNode.style.top);
|
||||
|
||||
e = e ? e : window.event;
|
||||
oElem.parentNode.style.left = x + (e.clientX - oElem.mouseX) + 'px';
|
||||
oElem.parentNode.style.top = y + (e.clientY - oElem.mouseY) + 'px';
|
||||
|
||||
oElem.mouseX = e.clientX;
|
||||
oElem.mouseY = e.clientY;
|
||||
|
||||
oElem.drag(oElem, x, y);
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
|
||||
// private method. Stop drag process.
|
||||
_dragEnd : function() {
|
||||
var oElem = DragHandler._oElem;
|
||||
|
||||
var x = parseInt(oElem.parentNode.style.left);
|
||||
var y = parseInt(oElem.parentNode.style.top);
|
||||
|
||||
oElem.dragEnd(oElem, x, y);
|
||||
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
DragHandler._oElem = null;
|
||||
}
|
||||
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user