1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-05 06:07:32 +02:00

JS libraries update (Prototype JS 1.6.1, Scriptaculous 1.8.3), interactive user search started (ajax auto-complete) - work in progress; comment manager - small additions, user autocomplete search test; overall bugfixes/improvements

This commit is contained in:
secretr
2009-11-06 18:37:23 +00:00
parent fe77106b76
commit c1d99b4052
16 changed files with 2513 additions and 1798 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/comment.php,v $
| $Revision: 1.12 $
| $Date: 2009-11-05 17:32:18 $
| $Revision: 1.13 $
| $Date: 2009-11-06 18:37:23 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -70,26 +70,27 @@ class comments_admin_ui extends e_admin_ui
//protected $listQry = "SELECT SQL_CALC_FOUND_ROWS * FROM #comments"; // without any Order or Limit.
protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
//protected $editQry = "SELECT * FROM #comments WHERE comment_id = {ID}";
protected $pid = "comment_id";
protected $perPage = 10;
protected $batchDelete = true;
//TODO - finish 'user' type, set 'data' to all editable fields, set 'noedit' for all non-editable fields
protected $fields = array(
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'comment_id' => array('title'=> ID, 'type' => 'int', 'width' =>'5%', 'forced'=> TRUE),
'comment_item_id' => array('title'=> "item id", 'type' => 'text', 'width' => 'auto'),
'comment_subject' => array('title'=> "subject", 'type' => 'text', 'width' => 'auto', 'thclass' => 'left first'), // Display name
'comment_comment' => array('title'=> "comment", 'type' => 'textarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
'comment_author_id' => array('title'=> "authorID", 'type' => 'number', 'width' => 'auto'), // User id
'comment_author_id' => array('title'=> "authorID", 'type' => 'user', 'data' => 'int', 'width' => 'auto'), // User id
'comment_author_name' => array('title'=> "authorName",'type' => 'text', 'width' => 'auto'), // User name
'user_name' => array('title'=> "System user", 'type' => 'text', 'width' => 'auto', 'table' => 'user', 'noedit' => true), // User name
'comment_datestamp' => array('title'=> "datestamp", 'type' => 'datestamp', 'width' => 'auto'), // User date
'comment_blocked' => array('title'=> "blocked", 'type' => 'text', 'width' => 'auto'), // Photo
'comment_blocked' => array('title'=> "blocked", 'type' => 'boolean', 'data'=> 'int', 'filter' => true, 'batch' => true, 'width' => 'auto'), // Photo
'comment_ip' => array('title'=> "IP", 'type' => 'text', 'width' => '10%', 'thclass' => 'center' ), // Real name (no real vetting)
'comment_type' => array('title'=> "Type", 'type' => 'method', 'width' => '10%', 'thclass' => 'center', 'filter'=>TRUE,'batch'=>TRUE ), // No real vetting
'comment_lock' => array('title'=> "Lock", 'type' => 'text', 'width' => 'auto'),
'comment_lock' => array('title'=> "Lock", 'type' => 'boolean', 'data'=> 'int', 'filter' => true, 'batch' => true, 'width' => 'auto'),
'options' => array('title'=> LAN_OPTIONS, 'forced'=>TRUE, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center')
);
//required (but should be optional) - default column user prefs

View File

@@ -3,7 +3,7 @@
+ ----------------------------------------------------------------------------+
|| e107 website system
|
| <EFBFBD>Steve Dunstan 2001-2002
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_files/e_ajax.php,v $
| $Revision: 1.6 $
| $Date: 2009-01-16 17:57:57 $
| $Revision: 1.7 $
| $Date: 2009-11-06 18:37:23 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
@@ -25,7 +25,7 @@ ob_implicit_flush(0);
// Ajax Short-code-Replacer Routine.
$shortcodes = "";
// FIXME - new .php shortcodes & security (require_once)
if($_POST['ajax_sc'] && $_POST['ajax_scfile'])
{
include_once(e_HANDLER.'shortcode_handler.php');
@@ -33,11 +33,11 @@ ob_implicit_flush(0);
$shortcodes = $tp -> e_sc -> parse_scbatch($file);
}
if($_POST['ajax_sc'] && $_POST['ajax_used'])
if(vartrue($_POST['ajax_sc']) && e_AJAX_REQUEST)
{
list($fld,$parm) = explode("=",$_POST['ajax_sc']);
$prm = ($parm) ? "=".urldecode($parm) : "";
echo $tp->parseTemplate("{".strtoupper($fld).$prm."}",TRUE,$shortcodes);
list($fld,$parm) = explode("=", $_POST['ajax_sc'], 2);
$prm = ($parm) ? "=".rawurldecode($parm) : ""; //var_dump($_GET);
echo e107::getParser()->parseTemplate("{".strtoupper($fld).$prm."}", true, $shortcodes);
exit;
}
?>

View File

@@ -8,8 +8,8 @@
* e107 Javascript API
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/e107.js.php,v $
* $Revision: 1.35 $
* $Date: 2009-09-12 18:25:41 $
* $Revision: 1.36 $
* $Date: 2009-11-06 18:37:23 $
* $Author: secretr $
*
*/
@@ -863,7 +863,7 @@ Object.extend(e107Helper, {
/**
* Add fx scroll on click event
* on all <a href='#something" class="scroll-to"> elements
* on all '<a href="#something" class="scroll-to"></a>' elements
*/
scrollToObserver: function(event) {
var element = event.memo['element'] ? $(event.memo.element) : $$('body')[0];

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
// script.aculo.us builder.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us builder.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -74,7 +74,7 @@ var Builder = {
if(arguments[2])
this._children(element, arguments[2]);
return element;
return $(element);
},
_text: function(text) {
return document.createTextNode(text);
@@ -100,7 +100,7 @@ var Builder = {
if(typeof children=='object') { // array can hold nodes and text
children.flatten().each( function(e) {
if(typeof e=='object')
element.appendChild(e)
element.appendChild(e);
else
if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));
@@ -130,7 +130,7 @@ var Builder = {
tags.each( function(tag){
scope[tag] = function() {
return Builder.node.apply(Builder, [tag].concat($A(arguments)));
}
};
});
}
}
};

View File

@@ -1,8 +1,8 @@
// script.aculo.us controls.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us controls.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2009 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
// Contributors:
// Richard Livsey
// Rahul Bhargava
@@ -39,10 +39,10 @@
if(typeof Effect == 'undefined')
throw("controls.js requires including script.aculo.us' effects.js library");
var Autocompleter = { }
var Autocompleter = { };
Autocompleter.Base = Class.create({
baseInitialize: function(element, update, options) {
element = $(element)
element = $(element);
this.element = element;
this.update = $(update);
this.hasFocus = false;
@@ -211,13 +211,13 @@ Autocompleter.Base = Class.create({
},
markPrevious: function() {
if(this.index > 0) this.index--
if(this.index > 0) this.index--;
else this.index = this.entryCount-1;
this.getEntry(this.index).scrollIntoView(true);
},
markNext: function() {
if(this.index < this.entryCount-1) this.index++
if(this.index < this.entryCount-1) this.index++;
else this.index = 0;
this.getEntry(this.index).scrollIntoView(false);
},
@@ -268,8 +268,10 @@ Autocompleter.Base = Class.create({
if(!this.changed && this.hasFocus) {
this.update.innerHTML = choices;
Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.down());
if (this.update.down()) { //SecretR: quick fix
Element.cleanWhitespace(this.update.down());
}
if(this.update.firstChild && this.update.down().childNodes) {
this.entryCount =
this.update.down().childNodes.length;
@@ -366,6 +368,10 @@ Ajax.Autocompleter = Class.create(Autocompleter.Base, {
new Ajax.Request(this.url, this.options);
},
onException: function (request, e) {
console.log(request, e);
},
onComplete: function(request) {
this.updateChoices(request.responseText);
}
@@ -459,7 +465,7 @@ Autocompleter.Local = Class.create(Autocompleter.Base, {
}
}
if (partial.length)
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length))
ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
return "<ul>" + ret.join('') + "</ul>";
}
}, options || { });
@@ -476,7 +482,7 @@ Field.scrollFreeActivate = function(field) {
setTimeout(function() {
Field.activate(field);
}, 1);
}
};
Ajax.InPlaceEditor = Class.create({
initialize: function(element, url, options) {
@@ -606,7 +612,7 @@ Ajax.InPlaceEditor = Class.create({
this.triggerCallback('onEnterHover');
},
getText: function() {
return this.element.innerHTML;
return this.element.innerHTML.unescapeHTML();
},
handleAJAXFailure: function(transport) {
this.triggerCallback('onFailure', transport);
@@ -782,7 +788,7 @@ Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
onSuccess: function(transport) {
var js = transport.responseText.strip();
if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
throw 'Server returned an invalid collection representation.';
throw('Server returned an invalid collection representation.');
this._collection = eval(js);
this.checkForExternalText();
}.bind(this),

View File

@@ -1,7 +1,6 @@
// script.aculo.us dragdrop.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us dragdrop.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2007 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -123,7 +122,7 @@ var Droppables = {
if(this.last_active)
this.deactivate(this.last_active);
}
}
};
var Draggables = {
drags: [],
@@ -220,7 +219,7 @@ var Draggables = {
).length;
});
}
}
};
/*--------------------------------------------------------------------------*/
@@ -313,7 +312,7 @@ var Draggable = Class.create({
tag_name=='TEXTAREA')) return;
var pointer = [Event.pointerX(event), Event.pointerY(event)];
var pos = Position.cumulativeOffset(this.element);
var pos = this.element.cumulativeOffset();
this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
Draggables.activate(this);
@@ -333,8 +332,8 @@ var Draggable = Class.create({
if(this.options.ghosting) {
this._clone = this.element.cloneNode(true);
this.element._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
if (!this.element._originallyAbsolute)
this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
if (!this._originallyAbsolute)
Position.absolutize(this.element);
this.element.parentNode.insertBefore(this._clone, this.element);
}
@@ -405,9 +404,9 @@ var Draggable = Class.create({
}
if(this.options.ghosting) {
if (!this.element._originallyAbsolute)
if (!this._originallyAbsolute)
Position.relativize(this.element);
delete this.element._originallyAbsolute;
delete this._originallyAbsolute;
Element.remove(this._clone);
this._clone = null;
}
@@ -456,7 +455,7 @@ var Draggable = Class.create({
},
draw: function(point) {
var pos = Position.cumulativeOffset(this.element);
var pos = this.element.cumulativeOffset();
if(this.options.ghosting) {
var r = Position.realOffset(this.element);
pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
@@ -480,10 +479,10 @@ var Draggable = Class.create({
} else {
if(Object.isArray(this.options.snap)) {
p = p.map( function(v, i) {
return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this))
return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
} else {
p = p.map( function(v) {
return (v/this.options.snap).round()*this.options.snap }.bind(this))
return (v/this.options.snap).round()*this.options.snap }.bind(this));
}
}}
@@ -562,7 +561,7 @@ var Draggable = Class.create({
H = documentElement.clientHeight;
} else {
W = body.offsetWidth;
H = body.offsetHeight
H = body.offsetHeight;
}
}
return { top: T, left: L, width: W, height: H };
@@ -610,7 +609,8 @@ var Sortable = {
},
destroy: function(element){
var s = Sortable.options(element);
element = $(element);
var s = Sortable.sortables[element.id];
if(s) {
Draggables.removeObserver(s.element);
@@ -691,14 +691,14 @@ var Sortable = {
tree: options.tree,
hoverclass: options.hoverclass,
onHover: Sortable.onHover
}
};
var options_for_tree = {
onHover: Sortable.onEmptyHover,
overlap: options.overlap,
containment: options.containment,
hoverclass: options.hoverclass
}
};
// fix for gecko engine
Element.cleanWhitespace(element);
@@ -731,7 +731,7 @@ var Sortable = {
}
// keep reference
this.sortables[element.id] = options;
this.sortables[element.identify()] = options;
// for onupdate
Draggables.addObserver(new SortableObserver(element, options.onUpdate));
@@ -826,7 +826,7 @@ var Sortable = {
hide().addClassName('dropmarker').setStyle({position:'absolute'});
document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
}
var offsets = Position.cumulativeOffset(dropon);
var offsets = dropon.cumulativeOffset();
Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
if(position=='after')
@@ -853,11 +853,11 @@ var Sortable = {
children: [],
position: parent.children.length,
container: $(children[i]).down(options.treeTag)
}
};
/* Get the element containing the children and recurse over it */
if (child.container)
this._tree(child.container, options, child)
this._tree(child.container, options, child);
parent.children.push (child);
}
@@ -882,7 +882,7 @@ var Sortable = {
children: [],
container: element,
position: 0
}
};
return Sortable._tree(element, options, root);
},
@@ -942,14 +942,14 @@ var Sortable = {
}).join('&');
}
}
}
};
// Returns true if child is contained within element
Element.isParent = function(child, element) {
if (!child.parentNode || child == element) return false;
if (child.parentNode == element) return true;
return Element.isParent(child.parentNode, element);
}
};
Element.findChildren = function(element, only, recursive, tagName) {
if(!element.hasChildNodes()) return null;
@@ -967,8 +967,8 @@ Element.findChildren = function(element, only, recursive, tagName) {
});
return (elements.length>0 ? elements.flatten() : []);
}
};
Element.offsetSize = function (element, type) {
return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
}
};

View File

@@ -1,6 +1,6 @@
// script.aculo.us effects.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us effects.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Contributors:
// Justin Palmer (http://encytemedia.com/)
// Mark Pilgrim (http://diveintomark.org/)
@@ -72,25 +72,20 @@ var Effect = {
Transitions: {
linear: Prototype.K,
sinoidal: function(pos) {
return (-Math.cos(pos*Math.PI)/2) + 0.5;
return (-Math.cos(pos*Math.PI)/2) + .5;
},
reverse: function(pos) {
return 1-pos;
},
flicker: function(pos) {
var pos = ((-Math.cos(pos*Math.PI)/4) + 0.75) + Math.random()/4;
var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
return pos > 1 ? 1 : pos;
},
wobble: function(pos) {
return (-Math.cos(pos*Math.PI*(9*pos))/2) + 0.5;
return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
},
pulse: function(pos, pulses) {
pulses = pulses || 5;
return (
((pos % (1/pulses)) * pulses).round() == 0 ?
((pos * pulses * 2) - (pos * pulses * 2).floor()) :
1 - ((pos * pulses * 2) - (pos * pulses * 2).floor())
);
return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
},
spring: function(pos) {
return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
@@ -152,14 +147,13 @@ var Effect = {
'blind': ['BlindDown','BlindUp'],
'appear': ['Appear','Fade']
},
toggle: function(element, effect) {
toggle: function(element, effect, options) {
element = $(element);
effect = (effect || 'appear').toLowerCase();
var options = Object.extend({
return Effect[ Effect.PAIRS[ effect ][ element.visible() ? 1 : 0 ] ](element, Object.extend({
queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
}, arguments[2] || { });
Effect[element.visible() ?
Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
}, options || {}));
}
};
@@ -235,12 +229,6 @@ Effect.Queue = Effect.Queues.get('global');
Effect.Base = Class.create({
position: null,
start: function(options) {
function codeForEvent(options,eventName){
return (
(options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
(options[eventName] ? 'this.options.'+eventName+'(this);' : '')
);
}
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
this.currentFrame = 0;
@@ -251,18 +239,30 @@ Effect.Base = Class.create({
this.totalTime = this.finishOn-this.startOn;
this.totalFrames = this.options.fps*this.options.duration;
eval('this.render = function(pos){ '+
'if (this.state=="idle"){this.state="running";'+
codeForEvent(this.options,'beforeSetup')+
(this.setup ? 'this.setup();':'')+
codeForEvent(this.options,'afterSetup')+
'};if (this.state=="running"){'+
'pos=this.options.transition(pos)*'+this.fromToDelta+'+'+this.options.from+';'+
'this.position=pos;'+
codeForEvent(this.options,'beforeUpdate')+
(this.update ? 'this.update(pos);':'')+
codeForEvent(this.options,'afterUpdate')+
'}}');
this.render = (function() {
function dispatch(effect, eventName) {
if (effect.options[eventName + 'Internal'])
effect.options[eventName + 'Internal'](effect);
if (effect.options[eventName])
effect.options[eventName](effect);
}
return function(pos) {
if (this.state === "idle") {
this.state = "running";
dispatch(this, 'beforeSetup');
if (this.setup) this.setup();
dispatch(this, 'afterSetup');
}
if (this.state === "running") {
pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
this.position = pos;
dispatch(this, 'beforeUpdate');
if (this.update) this.update(pos);
dispatch(this, 'afterUpdate');
}
};
})();
this.event('beforeStart');
if (!this.options.sync)
@@ -510,16 +510,15 @@ Effect.Highlight = Class.create(Effect.Base, {
Effect.ScrollTo = function(element) {
var options = arguments[1] || { },
scrollOffsets = document.viewport.getScrollOffsets(),
elementOffsets = $(element).cumulativeOffset(),
max = (window.height || document.body.scrollHeight) - document.viewport.getHeight();
elementOffsets = $(element).cumulativeOffset();
if (options.offset) elementOffsets[1] += options.offset;
return new Effect.Tween(null,
scrollOffsets.top,
elementOffsets[1] > max ? max : elementOffsets[1],
elementOffsets[1],
options,
function(p){ scrollTo(scrollOffsets.left, p.round()) }
function(p){ scrollTo(scrollOffsets.left, p.round()); }
);
};
@@ -570,7 +569,7 @@ Effect.Puff = function(element) {
new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
Object.extend({ duration: 1.0,
beforeSetupInternal: function(effect) {
Position.absolutize(effect.effects[0].element)
Position.absolutize(effect.effects[0].element);
},
afterFinishInternal: function(effect) {
effect.effects[0].element.hide().setStyle(oldStyle); }
@@ -627,7 +626,7 @@ Effect.SwitchOff = function(element) {
afterFinishInternal: function(effect) {
effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
}
})
});
}
}, arguments[1] || { }));
};
@@ -676,7 +675,7 @@ Effect.Shake = function(element) {
new Effect.Move(effect.element,
{ x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
effect.element.undoPositioned().setStyle(oldStyle);
}}) }}) }}) }}) }}) }});
}}); }}); }}); }}); }}); }});
};
Effect.SlideDown = function(element) {
@@ -818,7 +817,7 @@ Effect.Grow = function(element) {
effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
}
}, options)
)
);
}
});
};
@@ -879,11 +878,13 @@ Effect.Shrink = function(element) {
Effect.Pulsate = function(element) {
element = $(element);
var options = arguments[1] || { };
var oldOpacity = element.getInlineOpacity();
var transition = options.transition || Effect.Transitions.sinoidal;
var reverser = function(pos){ return transition(1-Effect.Transitions.pulse(pos, options.pulses)) };
reverser.bind(transition);
var options = arguments[1] || { },
oldOpacity = element.getInlineOpacity(),
transition = options.transition || Effect.Transitions.linear,
reverser = function(pos){
return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
};
return new Effect.Opacity(element,
Object.extend(Object.extend({ duration: 2.0, from: 0,
afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
@@ -936,7 +937,7 @@ Effect.Morph = Class.create(Effect.Base, {
effect.transforms.each(function(transform) {
effect.element.style[transform.style] = '';
});
}
};
}
}
this.start(options);
@@ -947,7 +948,7 @@ Effect.Morph = Class.create(Effect.Base, {
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
color = color.parseColor();
return $R(0,2).map(function(i){
return parseInt( color.slice(i*2+1,i*2+3), 16 )
return parseInt( color.slice(i*2+1,i*2+3), 16 );
});
}
this.transforms = this.style.map(function(pair){
@@ -980,7 +981,7 @@ Effect.Morph = Class.create(Effect.Base, {
transform.unit != 'color' &&
(isNaN(transform.originalValue) || isNaN(transform.targetValue))
)
)
);
});
},
update: function(position) {
@@ -1083,7 +1084,7 @@ if (document.defaultView && document.defaultView.getComputedStyle) {
if (!styles.opacity) styles.opacity = element.getOpacity();
return styles;
};
};
}
Effect.Methods = {
morph: function(element, style) {
@@ -1092,7 +1093,7 @@ Effect.Methods = {
return element;
},
visualEffect: function(element, effect, options) {
element = $(element)
element = $(element);
var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
new Effect[klass](element, options);
return element;
@@ -1111,7 +1112,7 @@ $w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
element = $(element);
Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
return element;
}
};
}
);

View File

@@ -1,6 +1,6 @@
// script.aculo.us scriptaculous.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us scriptaculous.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -24,16 +24,25 @@
// For details, see the script.aculo.us web site: http://script.aculo.us/
var Scriptaculous = {
Version: '1.8.1',
Version: '1.8.3',
require: function(libraryName) {
try{
// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
} catch(e) {
// for xhtml+xml served content, fall back to DOM methods
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = libraryName;
document.getElementsByTagName('head')[0].appendChild(script);
}
},
REQUIRED_PROTOTYPE: '1.6.0',
REQUIRED_PROTOTYPE: '1.6.0.3',
load: function() {
function convertVersionString(versionString) {
var r = versionString.split('.');
return parseInt(r[0])*100000 + parseInt(r[1])*1000 + parseInt(r[2]);
var v = versionString.replace(/_.*|\./g, '');
v = parseInt(v + '0'.times(4-v.length));
return versionString.indexOf('_') > -1 ? v-1 : v;
}
if((typeof Prototype=='undefined') ||
@@ -43,17 +52,17 @@ var Scriptaculous = {
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
Scriptaculous.REQUIRED_PROTOTYPE);
/*
$A(document.getElementsByTagName("script")).findAll( function(s) {
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
/*var js = /scriptaculous\.js(\?.*)?$/;
$$('head script[src]').findAll(function(s) {
return s.src.match(js);
}).each(function(s) {
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
var includes = s.src.match(/\?.*load=([a-z,]*)/);
var path = s.src.replace(js, ''),
includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
function(include) { Scriptaculous.require(path+include+'.js') });
});
*/
}
});*/
}
};
Scriptaculous.load();

View File

@@ -1,6 +1,6 @@
// script.aculo.us slider.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us slider.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Marty Haught, Thomas Fuchs
// Copyright (c) 2005-2009 Marty Haught, Thomas Fuchs
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -209,12 +209,12 @@ Control.Slider = Class.create({
var pointer = [Event.pointerX(event), Event.pointerY(event)];
var track = handle;
if (track==this.track) {
var offsets = Position.cumulativeOffset(this.track);
var offsets = this.track.cumulativeOffset();
this.event = event;
this.setValue(this.translateToValue(
(this.isVertical() ? pointer[1]-offsets[1] : pointer[0]-offsets[0])-(this.handleLength/2)
));
var offsets = Position.cumulativeOffset(this.activeHandle);
var offsets = this.activeHandle.cumulativeOffset();
this.offsetX = (pointer[0] - offsets[0]);
this.offsetY = (pointer[1] - offsets[1]);
} else {
@@ -227,7 +227,7 @@ Control.Slider = Class.create({
this.activeHandleIdx = this.handles.indexOf(this.activeHandle);
this.updateStyles();
var offsets = Position.cumulativeOffset(this.activeHandle);
var offsets = this.activeHandle.cumulativeOffset();
this.offsetX = (pointer[0] - offsets[0]);
this.offsetY = (pointer[1] - offsets[1]);
}
@@ -246,7 +246,7 @@ Control.Slider = Class.create({
},
draw: function(event) {
var pointer = [Event.pointerX(event), Event.pointerY(event)];
var offsets = Position.cumulativeOffset(this.track);
var offsets = this.track.cumulativeOffset();
pointer[0] -= this.offsetX + offsets[0];
pointer[1] -= this.offsetY + offsets[1];
this.event = event;

View File

@@ -1,6 +1,6 @@
// script.aculo.us sound.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us sound.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
//
// Based on code created by Jules Gravinese (http://www.webveteran.com/)
//
@@ -29,12 +29,12 @@ Sound = {
var sound = $('sound_'+options.track+'_'+id);
sound.Stop && sound.Stop();
sound.remove();
})
});
this.tracks[options.track] = null;
}
if(!this.tracks[options.track])
this.tracks[options.track] = { id: 0 }
this.tracks[options.track] = { id: 0 };
else
this.tracks[options.track].id++;
@@ -49,7 +49,11 @@ Sound = {
if(Prototype.Browser.Gecko && navigator.userAgent.indexOf("Win") > 0){
if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('QuickTime') != -1 }))
Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>')
Sound.template = new Template('<object id="sound_#{track}_#{id}" width="0" height="0" type="audio/mpeg" data="#{url}"/>');
else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('Windows Media') != -1 }))
Sound.template = new Template('<object id="sound_#{track}_#{id}" type="application/x-mplayer2" data="#{url}"></object>');
else if(navigator.plugins && $A(navigator.plugins).detect(function(p){ return p.name.indexOf('RealPlayer') != -1 }))
Sound.template = new Template('<embed type="audio/x-pn-realaudio-plugin" style="height:0" id="sound_#{track}_#{id}" src="#{url}" loop="false" autostart="true" hidden="true"/>');
else
Sound.play = function(){}
Sound.play = function(){};
}

View File

@@ -1,8 +1,8 @@
// script.aculo.us unittest.js v1.8.1, Thu Jan 03 22:07:12 -0500 2008
// script.aculo.us unittest.js v1.8.3, Thu Oct 08 11:23:33 +0200 2009
// Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2007 Jon Tirsen (http://www.tirsen.com)
// (c) 2005-2007 Michael Schuerig (http://www.schuerig.de/michael/)
// Copyright (c) 2005-2009 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
// (c) 2005-2009 Jon Tirsen (http://www.tirsen.com)
// (c) 2005-2009 Michael Schuerig (http://www.schuerig.de/michael/)
//
// script.aculo.us is freely distributable under the terms of an MIT-style license.
// For details, see the script.aculo.us web site: http://script.aculo.us/
@@ -32,8 +32,8 @@ Event.simulateMouse = function(element, eventName) {
this.mark.style.left = options.pointerX + "px";
this.mark.style.width = "5px";
this.mark.style.height = "5px;";
this.mark.style.borderTop = "1px solid red;"
this.mark.style.borderLeft = "1px solid red;"
this.mark.style.borderTop = "1px solid red;";
this.mark.style.borderLeft = "1px solid red;";
if(this.step)
alert('['+new Date().getTime().toString()+'] '+eventName+'/'+Test.Unit.inspect(options));
@@ -67,7 +67,7 @@ Event.simulateKeys = function(element, command) {
}
};
var Test = {}
var Test = {};
Test.Unit = {};
// security exception workaround
@@ -117,7 +117,7 @@ Test.Unit.Logger.prototype = {
'<thead><tr><th>Status</th><th>Test</th><th>Message</th></tr></thead>' +
'<tbody id="loglines"></tbody>' +
'</table>';
this.logsummary = $('logsummary')
this.logsummary = $('logsummary');
this.loglines = $('loglines');
},
_toHTML: function(txt) {
@@ -125,15 +125,15 @@ Test.Unit.Logger.prototype = {
},
addLinksToResults: function(){
$$("tr.failed .nameCell").each( function(td){ // todo: limit to children of this.log
td.title = "Run only this test"
td.title = "Run only this test";
Event.observe(td, 'click', function(){ window.location.search = "?tests=" + td.innerHTML;});
});
$$("tr.passed .nameCell").each( function(td){ // todo: limit to children of this.log
td.title = "Run all tests"
td.title = "Run all tests";
Event.observe(td, 'click', function(){ window.location.search = "";});
});
}
}
};
Test.Unit.Runner = Class.create();
Test.Unit.Runner.prototype = {
@@ -246,7 +246,7 @@ Test.Unit.Runner.prototype = {
failures + " failures, " +
errors + " errors");
}
}
};
Test.Unit.Assertions = Class.create();
Test.Unit.Assertions.prototype = {
@@ -331,7 +331,7 @@ Test.Unit.Assertions.prototype = {
catch(e) { this.error(e); }
},
assertNull: function(obj) {
var message = arguments[1] || 'assertNull'
var message = arguments[1] || 'assertNull';
try { (obj==null) ? this.pass() :
this.fail(message + ': got "' + Test.Unit.inspect(obj) + '"'); }
catch(e) { this.error(e); }
@@ -461,7 +461,7 @@ Test.Unit.Assertions.prototype = {
iterations + ' iterations in ' + (timeTaken/1000)+'s' );
return timeTaken;
}
}
};
Test.Unit.Testcase = Class.create();
Object.extend(Object.extend(Test.Unit.Testcase.prototype, Test.Unit.Assertions.prototype), {
@@ -526,7 +526,7 @@ Test.setupBDDExtensionMethods = function(){
};
var makeAssertion = function(assertion, args, object) {
this[assertion].apply(this,(args || []).concat([object]));
}
};
Test.BDDMethods = {};
$H(METHODMAP).each(function(pair) {
@@ -539,7 +539,7 @@ Test.setupBDDExtensionMethods = function(){
[Array.prototype, String.prototype, Number.prototype, Boolean.prototype].each(
function(p){ Object.extend(p, Test.BDDMethods) }
);
}
};
Test.context = function(name, spec, log){
Test.setupBDDExtensionMethods();

View File

@@ -0,0 +1,47 @@
<?php
// $Id: usersearch.php,v 1.1 2009-11-06 18:37:23 secretr Exp $
function usersearch_shortcode($parm)
{
// FIXME - permissions, sql query
if(!ADMIN || !e_AJAX_REQUEST)
{
return '<ul></ul>';
}
parse_str(str_replace('--', '&', $parm), $parm);
$tp = e107::getParser();
$sql = e107::getDb();
$search_field = 'user_'.vartrue($parm['searchfld'], 'name');
$info_field = $search_field == 'user_name' ? 'user_loginname' : 'user_name';
$posted = $_POST[vartrue($parm['srcfld'], 'user_name')];
if(!$posted)
{
return '<ul></ul>';
}
$allowed = array('user_id', 'user_name', 'user_loginname', 'user_customtitle', 'user_email');
if(!in_array($search_field, $allowed))
{
$search_field = 'user_name';
}
$ret = "<ul>";
$qry = "
SELECT u.user_id, u.user_name, u.user_loginname, u.user_customtitle, u.user_email FROM #user AS u
WHERE {$search_field} LIKE '".$tp->toDb($posted)."%'
";
if($sql->db_Select_gen($qry))
{
while($row = $sql->db_Fetch())
{
$ret .= "<li id='{$row['user_id']}'>{$row[$search_field]}<span class='informal'> [{$row['user_id']}] ".$row[$info_field]." </span></li>";
}
}
$ret .= "</ul>";
return $ret;
}
?>

View File

@@ -2185,15 +2185,7 @@ class e_admin_ui extends e_admin_controller_ui
{
$tree->addMessageSuccess($cnt.' records successfully reversed.');
//sync models
foreach ($selected as $id)
{
if($tree->hasNode($id))
{
$tree->getNode($id)
->set($field, $syncvalue)
->setMessages();
}
}
$tree->load(true);
}
$this->getTreeModel()->setMessages();
break;
@@ -2297,7 +2289,7 @@ class e_admin_ui extends e_admin_controller_ui
if($filterField && $filterValue !== '' && isset($this->fields[$filterField]))
{
$ftable = vartrue($this->fields[$filterField]['table'], $this->getTableName());
$searchQry[] = "`{$ftable}.`$filterField` = '".$filterValue."'";
$searchQry[] = "`#{$ftable}`.`$filterField` = '".$filterValue."'";
}
$filter = array();

View File

@@ -9,8 +9,8 @@
* Form Handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/form_handler.php,v $
* $Revision: 1.69 $
* $Date: 2009-11-05 17:32:18 $
* $Revision: 1.70 $
* $Date: 2009-11-06 18:37:23 $
* $Author: secretr $
*
*/
@@ -176,9 +176,72 @@ class e_form
return $cal->make_input_field($cal_options, $cal_attrib);
}
function user($name, $default_id, $options = array())
/**
* UNDER CONSTRUCTION!!!
*
* @param object $name
* @param object $id_fld
* @param object $default_name
* @param object $default_id
* @param object $options [optional]
* @return
*/
function userpicker($name, $id_fld, $default_name, $default_id, $options = array())
{
return 'User auto-complete search - under development';
if(!is_array($options)) parse_str($options, $options);
$reset = '';
if(vartrue($options['reset']))
{
$reset = '
<a href="#" onclick="$(\'subscriber-system-id\').value=0; \$(\'subscriber-system-id\').previous(\'input\').value=\'\'; return false;">reset</a>
';
}
$ret = '
<div class="e-autocomplete-c">
'.$this->text($name, $default_name, 150, array('id' => false, 'readonly' => vartrue($options['readonly']) ? true : false)).'
'.$this->text($id_fld, $default_id, 10, array('id' => false, 'readonly'=>true, 'class'=>'tbox number')).'
'.$reset.'
<span class="indicator" style="display: none;">
<img src="'.e_IMAGE_ABS.'generic/loading_16.gif" class="icon action S16" alt="Loading..." />
</span>
<div class="e-autocomplete"></div>
</div>
';
e107::getJs()->requireCoreLib('scriptaculous/controls.js', 2);
e107::getJs()->footerInline("
//autocomplete fields
\$\$('input[name={$name}]').each(function(el) {
if(el.readOnly) {
el.observe('click', function(ev) { ev.stop(); var el1 = ev.findElement('input'); el1.blur(); } );
el.next('span.indicator').hide();
el.next('div.e-autocomplete').hide();
return;
}
new Ajax.Autocompleter(el, el.next('div.e-autocomplete'), '".e_FILE_ABS."e_ajax.php', {
paramName: '{$name}',
minChars: 2,
frequency: 0.5,
afterUpdateElement: function(txt, li) {
console.log(\$(li).id, '{$id_fld}');
if(!\$(li)) return;
if(\$(li).id) {
el.next('input[name={$id_fld}]').value = parseInt(\$(li).id);
} else {
el.next('input[name={$id_fld}]').value = 0
}
},
indicator: el.next('span.indicator'),
parameters: 'ajax_used=1&ajax_sc=usersearch=".rawurlencode('searchfld=user--srcfld='.$name)."'
});
});
");
return $ret;
}
function file($name, $options = array())
@@ -188,6 +251,10 @@ class e_form
return "<input type='file' name='{$name}'".$this->get_attributes($options, $name)." />";
}
function upload($name, $options = array())
{
return 'Ready to use upload form fields, optional - file list view';
}
function password($name, $maxlength = 50, $options = array())
{
@@ -1151,14 +1218,22 @@ class e_form
return $this->$method($key, $value, $uc_options, vartrue($parms['__options'], array()));
break;
case 'user_name':
/*case 'user_name':
case 'user_loginname':
case 'user_login':
case 'user_customtitle':
case 'user_email':
case 'user_email':*/
case 'user':
//user_id expected
//$value = get_user_data($value);
return $this->user($key, $value, $parms);
// Just temporary solution, will be changed soon
if(!is_array($value))
{
$value = get_user_data($value);
}
if(!$value) $value = array();
$uname = varset($value['user_name']);
$value = varset($value['user_id'], 0);
return $this->userpicker($key.'_usersearch', $key, $uname, $value, $parms);
break;
case 'boolean':

View File

@@ -665,6 +665,32 @@ input.action.edit {}
/********** Element Loading Status default style */
.element-loading-mask { background-repeat: no-repeat; background-position: 50% 50%; background-color: #f5f5f5; }
/********** Auto complete default style */
div.e-autocomplete {
position:absolute;
width:250px;
background-color:white;
border:1px solid #c0c0c0;
margin:0;
padding:0;
}
div.e-autocomplete ul {
list-style-type:none;
margin:0;
padding:0;
font-weight: bold; font-size: 11px
}
div.e-autocomplete ul li.selected { background-color: #f5f5f5;}
div.e-autocomplete ul li {
list-style-type:none;
display:block;
margin:0;
padding: 5px;
cursor:pointer;
}
div.e-autocomplete ul li span.informal { font-weight: normal; font-size: 9px}
/********** Docs */
#docs-list { padding: 10px; margin-bottom: 15px; border: 1px solid #f5f5f5; }
#docs-list .qitem { margin: 3px 0; padding-left: 10px; }