1
0
mirror of https://github.com/e107inc/e107.git synced 2025-10-17 15:56:25 +02:00

Move JS folder

This commit is contained in:
Cameron
2012-11-23 22:47:01 -08:00
parent 203a76a16b
commit f54d647cf5
98 changed files with 2 additions and 2 deletions

View File

@@ -0,0 +1,17 @@
/* ADMIN specific styling */
a.media-select-image { margin:5px; border:1px solid silver; width:120px; height:100px; }
a.media-select-image:hover { border:1px solid red; }
a.media-select-icon { text-align:center; vertical-align:middle; margin:1px; border:1px solid white; width:48px; height:48px;}
a.media-select-icon:hover { border:1px solid red; }
.media-select-container { padding:10px; }
.media-select-none { text-decoration:none; }
.media-select-active { border: 2px solid silver; }
.e-moving { background-color: silver; }
tr.highlight-even { background-color: silver; }
tr.highlight-odd { background-color: silver; }
legend { display: none; }
.chzn-choices { width: 350px; }
.e-autocomplete { display: none }

View File

@@ -0,0 +1,404 @@
$(document).ready(function()
{
// run tips on title attribute.
$(".e-tip").each(function() {
var tip = $(this).attr('title');
if(!tip)
{
return;
}
$(this).tipsy({opacity:1.0,fade:true});
// $(this).css( 'cursor', 'pointer' )
});
// run tips on .field-help
$("input,textarea,select,label,.e-tip").each(function(c) {
var t = $(this).nextAll(".field-help");
t.hide();
// alert('hello');
$(this).tipsy({title: function() {
var tip = t.text();
return tip;
},
fade: true,
html: true,
gravity: 'w'
});
});
$(".e-spinner").spinner();
$(".e-radio-multi").each(function() {
// $(this).nextAll(".field-help").hide();
// $(this).nextAll(":input").tipsy({title: 'hello'});
});
$(".e-tags").tagit();
$(".e-multiselect").chosen();
// Decorate
$(".adminlist tr:even").addClass("even");
$(".adminlist tr:odd").addClass("odd");
$(".adminlist tr:first").addClass("first");
$(".adminlist tr:last").addClass("last");
// Modal Box - uses inline hidden content // NEEDS work - see customize link for admin-infopanel.
$(".e-modal-iframe").click(function (e) {
var id = $(this).attr("href");
e.preventDefault();
var page = $(this).attr("href")
var pagetitle = $(this).attr("title")
var $dialog = $("<div></div>")
.html("<iframe style=\"border: 0px; \" src=\"" + page + "\" width=\"100%\" height=\"100%\"></iframe>")
.dialog({
autoOpen: false,
modal: true,
width:800,
height: 700,
minWidth: 800,
minHeight: 700,
maxHeight: 700,
title: pagetitle
});
$dialog.dialog("open");
});
// Admin Prefs Navigation
$(".plugin-navigation a").click(function () {
// alert(document.location.hash);
$(".plugin-navigation a").each(function(index) {
var ot = $(this).attr("href");
$(ot).hide();
$(this).closest("li").removeClass("active");
$(this).switchClass( "link-active", "link", 0 );
});
var id = $(this).attr("href");
$(this).switchClass( "link", "link-active", 30 );
$(this).closest("li").addClass("active");
$(id).show({
effect: "slide"
});
});
// backend
$(".e-password-admin").pwdMeter({
minLength: 6,
displayGeneratePassword: true,
generatePassText: "Generate",
randomPassLength: 12
});
// Sorting
var fixHelper = function(e, ui) {
ui.closest("tr").switchClass( "odd", "highlight-odd", 0 );
ui.closest("tr").switchClass( "even", "highlight-even", 0 );
ui.children().each(function() {
$(this).width($(this).width());
// $(this).closest("tr").switchClass( "odd", "highlight-odd", 0 );
// $(this).closest("tr").switchClass( "even", "highlight-even", 0 );
});
return ui;
};
$("#e-sort").sortable({
helper: fixHelper,
cursor: "move",
opacity: 0.9,
handle: ".e-sort",
distance: 20,
containment: "parent",
stop: function(e,ui) {
var allItems = $(this).sortable("toArray");
var newSortValue = allItems.indexOf( $(ui.item).attr("id") );
// alert($(ui.item).attr("id") + " was moved to index " + newSortValue);
$(".highlight-even").switchClass( "highlight-even", "even", 600 );
$(".highlight-odd").switchClass( "highlight-odd", "odd", 600 );
},
update: function(event, ui) {
var allItems = $(this).sortable("toArray");
// console.log(allItems);
var neworder = allItems.indexOf( $(ui.item).attr("id") );
var linkid = $(ui.item).attr("id");
// $("td").removeClass("e-moving","slow");
var script = $(".e-sort:first").attr("href");
// alert(script);
$.ajax({
type: "POST",
url: script,
data: { all: allItems, linkid: linkid, neworder: neworder }
// data: { linkid: linkid, neworder: neworder }
}).done(function( msg ) {
// alert("Posted: "+allItems+" Updated: "+ msg );
});
}
});
// }).disableSelection(); // causes issue with admin->users drop-down selection.
// Check ALl Button
$("#e-check-all").click(function(){
$("input[type=\"checkbox\"]").attr("checked", "checked");
});
// Uncheck all button.
$("#e-uncheck-all").click(function(){
$("input[type=\"checkbox\"]").removeAttr("checked");
});
// Check-All checkbox toggle
$("input.toggle-all").click(function(evt){
if($(this).is(":checked")){
$("input[type=\"checkbox\"].checkbox").attr("checked", "checked");
}
else{
$("input[type=\"checkbox\"].checkbox").removeAttr("checked");
}
});
// highlight checked row
$(".adminlist input[type=\"checkbox\"].checkbox").click(function(evt){
if(this.checked)
{
$(this).closest("tr").switchClass( "odd", "highlight-odd", 0 );
$(this).closest("tr").switchClass( "even", "highlight-even", 0 );
}
else
{
$(this).closest("tr").switchClass( "highlight-even", "even", 300 );
$(this).closest("tr").switchClass( "highlight-odd", "odd", 300 );
}
});
// Basic Delete Confirmation
$("input.delete,button.delete").click(function(){
var answer = confirm($(this).attr("data-confirm"));
return answer // answer is a boolean
});
$("e-confirm").click(function(){
var answer = confirm($(this).attr("title"));
return answer // answer is a boolean
});
// Menu Manager Layout drop-down options
$("#menuManagerSelect").change(function(){
var link = $(this).val();
$("#menu_iframe").attr("data",link);
return false;
});
$(".e-shake" ).effect("shake",{times: 10, distance: 2},20);
$("select.filter").change(function() {
$(this).closest("form").submit();
});
$("div.e-autocomplete").keyup(function() { //TODO.
});
$(function() {
//$(".e-menumanager-delete").live("click", function(e){
$(".e-menumanager-delete").click(function(e){
e.preventDefault();
var area = 'remove';
var remove = $(this).attr('id');
var opt = remove.split('-');
var hidem = "#block-" + opt[1] +'-' + opt[2];
$(hidem).hide("slow");
// alert(hidem);
$.ajax({
type: "POST",
url: "menus.php?ajax_used=1",
data: { removeid: remove, area: area }
// data: { linkid: linkid, neworder: neworder }
}).done(function( msg ) {
// alert(msg );
});
});
$( ".column" ).sortable({
connectWith: ".column",
constain: 'table',
// stop: function(e,ui) {
// var allItems = $(this).sortable("toArray");
// var newSortValue = allItems.indexOf( $(ui.item).attr("id") );
// // alert($(ui.item).attr("id") + " was moved to index " + newSortValue);
// },
cursor: "move",
opacity: 0.9,
handle: ".portlet-header",
distance: 20,
remove: function(event, ui) {
// ui.item.clone().appendTo(this);
// $(this).sortable('cancel');
},
stop: function(event, ui) {
var linkid = $(ui.item).attr("id");
var area = $('#'+linkid).closest('.column').attr('id');
var areaList = $('#'+linkid).closest('.column').sortable("toArray");
// alert(areaList);
$(ui.item).attr("id")
var layout = $('#dbLayout').attr("value");
// alert(layout);
var opt = linkid.split('-');
if(area == 'remove')
{ // alert(area);
var remove = linkid;
areaList = '';
$('#check-' + opt[1]).show('fast');
$('#option-' + opt[1]).hide('fast');
$('#status-' + opt[1]).text('remove');
}
else
{
if($('#status-' + opt[1]).text() == 'insert' || $('#status-' + opt[1]).text() == 'update')
{
var stat = 'update';
}
else
{
var stat = 'insert';
}
var aId = area.split('-');
var newId = linkid + '-' + aId[1];
var remId = $('#'+linkid).find(".delete").attr('id') + aId[1];
$('#'+linkid).find(".delete").attr('id',remId);
var hidem = "block-" + opt[1] +'-' + aId[1];
$('#'+linkid).attr('id',hidem);
$('#check-' + opt[1]).hide('fast');
$('#option-' + opt[1]).show('fast');
$('#status-' + opt[1]).text(stat);
}
$.ajax({
type: "POST",
url: "menus.php?ajax_used=1",
data: { removeid: remove, insert:linkid, mode: stat, list: areaList, area: area, layout: layout }
// data: { linkid: linkid, neworder: neworder }
}).done(function( msg ) {
// alert(" Updated: "+ msg );
});
}
});
$( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
// $( ".portlet" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
.find( ".portlet-header" )
.addClass( "ui-widget-header ui-corner-all" )
.prepend( "<span class='ui-icon ui-icon-minusthick'></span>")
.end()
.find( ".portlet-content" );
$( ".portlet-header .ui-icon" ).click(function() {
$( this ).toggleClass( "ui-icon-minusthick" ).toggleClass( "ui-icon-plusthick" );
$( this ).parents( ".portlet:first" ).find( ".portlet-content" ).toggle();
});
$( ".column" ).disableSelection();
});
$.fn.extend({
insertAtCaret: function(myValue) {
if (document.selection) {
this.focus();
sel = document.selection.createRange();
sel.text = myValue;
this.focus();
}
else if (this.selectionStart || this.selectionStart == '0') {
var startPos = this.selectionStart;
var endPos = this.selectionEnd;
var scrollTop = this.scrollTop;
this.value = this.value.substring(0, startPos)+myValue+this.value.substring(endPos,this.value.length);
this.focus();
this.selectionStart = startPos + myValue.length;
this.selectionEnd = startPos + myValue.length;
this.scrollTop = scrollTop;
} else {
this.value += myValue;
this.focus();
}
}
})
// Text-area AutoGrow
// $("textarea.e-autoheight").elastic();
})

403
e107_web/js/core/admin.js Normal file
View File

@@ -0,0 +1,403 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* e107 Admin Helper
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/admin.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
if(typeof e107Admin == 'undefined') var e107Admin = {}
/**
* OnLoad Init Control
*/
if(!e107Admin['initRules']) {
e107Admin.initRules = {
'Helper': true,
'AdminMenu': true
}
}
e107Admin.Helper = {
/**
* Auto Initialize everything
*
* Use it with e107#runOnLoad
* Example: e107.runOnLoad(e107Admin.Helper.init.bind(e107Admin.Helper), document, true);
* Do it only ONCE per page!
*
*/
init: function(event) {
this.toggleCheckedHandler = this.toggleChecked.bindAsEventListener(this);
this.allCheckedEventHandler = this.allChecked.bindAsEventListener(this);
this.allUncheckedEventHandler = this.allUnchecked.bindAsEventListener(this);
this.allToggleCheckedEventHandler = this.allToggleChecked.bindAsEventListener(this);
element = event.memo['element'] ? $(event.memo.element) : $$('body')[0];
element.select('.autocheck').invoke('observe', 'click', this.toggleCheckedHandler);
element.select('button.action[name=check_all]', 'input.toggle_all[type=checkbox]').invoke('observe', 'click', this.allCheckedEventHandler);
element.select('button.action[name=uncheck_all]').invoke('observe', 'click', this.allUncheckedEventHandler);
element.select('input.toggle-all[type=checkbox]').invoke('observe', 'click', this.allToggleCheckedEventHandler);
element.select('button.delete', 'input.delete[type=image]', 'a.delete').each(function(el) {
if(el.hasClassName('no-confirm') || (el.readAttribute('rel') && el.readAttribute('rel').toLowerCase() == 'no-confirm')) return;
if(!el.readAttribute('delmsg')) {
var msg = el.readAttribute('title') || '';
el.writeAttribute('title', e107.getModLan('delete')).writeAttribute('delmsg', msg);
}
});
element.select('button.delete', 'input.delete[type=image]', 'a.delete').invoke('observe', 'click', function(e) {
var el = e.findElement('a.delete');
if(!el) el = e.findElement('input.delete');
if(!el) el = e.findElement('button.delete');
if(!el) return;
if(el.hasClassName('no-confirm') || (el.readAttribute('rel') && el.readAttribute('rel').toLowerCase() == 'no-confirm')) return;
var msg = el.readAttribute('delmsg') || e107.getModLan('delete_confirm');
if( !e107Helper.confirm(msg) ) e.stop();
});
element.select('textarea.e-autoheight').each( function (textarea) {
var options = {}, autoopt = '__' + textarea.name + 'autoheight_opt', autooptel = textarea.next('input[name=' + autoopt + ']');
if(autooptel) {
options['max_length'] = parseInt(autooptel.value);
}
new e107Admin.Nicearea(textarea, options);
});
},
/**
* Event listener: Auto-toggle single checkbox on click on its container element
* Usage: Just be sure to write down the proper CSS rules, no JS code required
* if e107Admin.Helper#init is executed
*
* Example:
* <div class='autocheck'>
* <input type='checkbox' class='checkbox' />
* <div class='smalltext field-help'>Inline Help Text</div>
* </div>
* OR
* <td class='control'>
* <div class='auto-toggle-area autocheck'>
* <input class='checkbox' type='checkbox' />
* <div class='smalltext field-help'>Inline Help Text</div>
* </div>
* </td>
* Note: The important part are classes 'autocheck' and 'checkbox'.
* Container tagName is not important (everything is valid)
* 'auto-toggle-area' class should be defined by the admin theme
* to control the e.g. width of the auto-toggle clickable area
*
* Demo: e107_admin/image.php
*
*/
toggleChecked: function(event) {
//do nothing if checkbox/form element or link is clicked
var tmp = event.element().nodeName.toLowerCase();
switch (tmp) {
case 'input':
case 'a':
case 'select':
case 'textarea':
case 'radio':
case 'label':
return;
break;
}
//checkbox container element
var element = event.findElement('.autocheck'), check = null;
if(element) {
check = element.select('input.checkbox'); //search for checkbox
}
//toggle checked property
if(check && check[0] && !($(check[0]).disabled)) {
$(check[0]).checked = !($(check[0]).checked);
}
},
/**
* Event listener
* Toggle all checkboxes in the current form, having name attribute value starting with 'multitoggle'
* by default or any value set by checkbox value (special command 'jstarget:start_with_selector')
* This method is auto-attached (if init() method is executed) to every checkbox having class toggle-all
*
* Example of valid checkbox being auto-observed:
* <input type='checkbox' class='toggle-all' name='not_important' value='jstarget:your_selector' />
*
* Demo: e107_admin/fla.php, e107_admin/db_verify.php
* Note: You could use e_form::checkbox_toggle() method (e107_handlers/form_handler.php),
* which produces multi-toggle checkbox observer in very convenient way
*
*/
allToggleChecked: function(event) {
//event.stop();
var form = event.element().up('form'), selector = 'multitoggle';
if(form) {
if(event.element().readAttribute('value').startsWith('jstarget:')) {
selector = event.element().readAttribute('value').replace(/jstarget:/, '').strip();
}
form.toggleChecked(event.element().checked, 'name^=' + selector);
}
},
/**
* Event listener
* Check all checkboxes in the current form, having name attribute value starting with 'multiaction'
* by default or any value set by button's value(special command 'jstarget:start_with_selector')
* This method is auto-attached to every button having name=check_all if init() method is executed
*
* Examples of valid inputbox markup:
* <input type='checkbox' class='checkbox' name='multiaction[]' />
* OR
* <input type='checkbox' class='checkbox' name='multiaction_something_else[]' />
* OR
* <input type='checkbox' class='checkbox' name='some_checkbox_array[]' /> (see the button example below)
* OR
* <input type='checkbox' class='checkbox' name='some_checkbox_array_some_more[]' /> (see the button example below)
*
* Example of button being auto-observed (see e107Admin.Helper#init)
* <button class='action' type='button' name='check_all' value='no-value'><span>Check All</span></button> // default selector - multiaction
* OR
* <button class='action' type='button' name='check_all' value='jstarget:some_checkbox_array'><span>Check All</span></button> // checkboxes names starting with - some_checkbox_array
*
* Demo: e107_admin/image.php, admin_log.php
*
*/
allChecked: function(event) {
//event.stop();
var form = event.element().up('form'), selector = 'multiaction';
if(form) {
if(event.element().readAttribute('value').startsWith('jstarget:')) {
selector = event.element().readAttribute('value').replace(/jstarget:/, '').strip();
}
form.toggleChecked(true, 'name^=' + selector);
}
},
/**
* Event listener
* Uncheck all checkboxes in the current form, having name attribute value starting with 'multiaction'
* by default or any value set by button's value(special command 'jstarget:start_with_selector')
* This method is auto-attached to every button having name=uncheck_all if init() method is executed
*
* Examples of valid inputbox markup:
* <input type='checkbox' class='checkbox' name='multiaction[]' />
* OR
* <input type='checkbox' class='checkbox' name='multiaction_something_else[]' />
* OR
* <input type='checkbox' class='checkbox' name='some_checkbox_array[]' /> (see the button example below)
* OR
* <input type='checkbox' class='checkbox' name='some_checkbox_array_some_more[]' /> (see the button example below)
*
* Example of button being auto-observed (see e107Admin.Helper#init)
* <button class='action' type='button' name='uncheck_all' value='no-value'><span>Uncheck All</span></button> // default selector - multiaction
* OR
* <button class='action' type='button' name='uncheck_all' value='jstarget:some_checkbox_array'><span>Uncheck All</span></button> // checkboxes names starting with - some_checkbox_array
*
* Demo: e107_admin/image.php, admin_log.php
*
*/
allUnchecked: function(event) {
event.stop();
var form = event.element().up('form'), selector = 'multiaction';
if(event.element().readAttribute('value').startsWith('jstarget:')) {
selector = event.element().readAttribute('value').replace(/jstarget:/, '').strip();
}
if(form) {
form.toggleChecked(false, 'name^=' + selector);
}
}
}
if(e107Admin.initRules.Helper)
e107.runOnLoad(e107Admin.Helper.init.bind(e107Admin.Helper), document, true);
/**
* Admin Menu Class
*/
e107Admin.AdminMenu = {
init: function(id, selection) {
if(!id) {
id = 'plugin-navigation';
selection = $$('ul.plugin-navigation', 'ul.plugin-navigation-sub');
}
selection = $A(selection);
if(this._track.get(id) || !selection) return false;
this._track.set(id, selection);
this.id = id;
this.location = document.location.hash.substring(1);
this.activeTab = null;
this.activeBar = null;
if(this.location) {
replace = new RegExp(this.id.camelize() + 'AdminMenu=');
this.activeTab = $(this.location.replace(replace, ''));
if(this.activeTab) {
this.activeTab.removeClassName('e-hideme').show();
}
}
selection.each( function(element, i) {
var check = element.select('a[href^=#]:not([href=#])');
if(!this.activeTab) { //no page hash, set default
if(check[0]) {
this.switchTab(check[0].hash.substr(1), check[0], element);
}
} else if(!this.activeBar && this.activeTab) {//there is page hash, bar is unknown
var h = this.activeTab.identify();
var bar = check.find( function(el){
return h == el.hash.substr(1);
});
this.switchTab(this.activeTab, bar, element);
}
check.invoke('observe', 'click', this.observer.bindAsEventListener(this, element));
}.bind(this));
//search for admin-menu forms
$$('form.admin-menu').invoke('observe', 'submit', function(event) { var form = event.element(); action = form.readAttribute('action') + document.location.hash; form.writeAttribute('action', action) } );
return true;
},
switchTab: function(show, bar, container) {
show = $(show);
if(!show) return false;
if(this.activeTab && this.activeTab.identify() != show.identify()) {
if(container) $(container).select('a.link-active[href^=#]').each(function (element) { element.removeClassName('link-active').addClassName('link'); element.up().removeClassName('active'); });
this.activeTab.hide();
this.activeTab = show;
this.activeTab.removeClassName('e-hideme').show();
if(bar) this.activeBar = bar;
this.activeBar.removeClassName('link').addClassName('link-active');
this.activeBar.up().addClassName('active');
return true;
} else if(!this.activeTab) { //init
if(container) $(container).select('a.link-active[href^=#]').each(function (element) { element.removeClassName('link-active').addClassName('link'); element.up().removeClassName('active'); });
this.activeTab = show.removeClassName('e-hideme').show();
if(bar) this.activeBar = bar.removeClassName('link').addClassName('link-active');
this.activeBar.up().addClassName('active');
return true;
} else if(!this.activeBar && this.activeTab) {//only bar is unknown
if(container) $(container).select('a.link-active[href^=#]').each(function (element) { element.removeClassName('link-active').addClassName('link'); element.up().removeClassName('active'); });
if(bar) this.activeBar = bar.removeClassName('link').addClassName('link-active');
this.activeBar.up().addClassName('active');
return true;
}
return false;
},
observer: function(event, cont) {
if(this.switchTab(event.element().hash.substr(1), event.element(), cont)) {
event.stop();
document.location.hash = this.id.camelize() + 'AdminMenu=' + event.element().hash.substr(1);
}
},
_track: $H()
}
// TEMPORARY HERE, awaiting the overall JS refactoring
/**
* Auto resizeable textarea, max character counter (optional)
* Inspired by user post on stackoverflow.com
* TODO - make it e107 widget (or even part of BBArea widget?)
* @param string|Element textarea
* @param Object options
*/
e107Admin.Nicearea = Class.create({
initialize: function(textarea, options)
{
this.textarea = $(textarea);
this.options = $H({
'min_height' : 30,
'max_height' : 400,
'max_length' : null
}).update(options);
this.textarea.observe('keyup', this.refresh.bind(this));
this._shadow = new Element('div').setStyle({
lineHeight : this.textarea.getStyle('lineHeight'),
fontSize : this.textarea.getStyle('fontSize'),
fontFamily : this.textarea.getStyle('fontFamily'),
position : 'absolute',
top: '-10000px',
left: '-10000px',
width: this.textarea.getWidth() + 'px'
});
this.textarea.insert({ after: this._shadow });
if(null !== this.options.get('max_length')) {
this._remainingCharacters = new Element('p').addClassName('remainingCharacters');
this.textarea.insert({before: this._remainingCharacters});
}
this.refresh();
},
refresh: function()
{
this._shadow.update($F(this.textarea).replace(/\n/g, '<br/>') + '<br/>');
this.textarea.setStyle({
height: Math.min(Math.max(parseInt(this._shadow.getHeight()) + parseInt(this.textarea.getStyle('lineHeight').replace('px', '')), this.options.get('min_height')), this.options.get('max_height')) + 'px'
});
if (null !== this.options.get('max_length')) {
var remaining = this.options.get('max_length') - $F(this.textarea).length;
if(!this.options.get('max_length')) this._remainingCharacters.update(Math.abs(remaining) + ' characters');
else this._remainingCharacters.update(Math.abs(remaining) + ' characters ' + (remaining > 0 ? 'remaining' : 'over the limit'));
}
}
});
if(e107Admin.initRules.AdminMenu)
document.observe( 'dom:loaded', function() { e107Admin.AdminMenu.init() });
// SecretR - FIXME - need general solution for admin UI tools + user autocomplete uses built-in Scripty Ajax.Autocompleter
//TODO find the right place for this and make generic - wanted it out of download plugin for now
// Current use:
// - filter text field must be in a form
// - form tag must have a class of e-filter-form
// - form must have an id of jstarget-xxx where xxx is the ID of the element to be replaced by the Ajax response
// - form action must be the URL to submit the Ajax request to
// - ajax requests posts 3 values:
// - ajax_used = 1 - because of a current issue with e107Ajax.Updater
// - filter_list=1 - to indicate to called URL that this is a filter list request
// - the name/value of the st input field in the form, i.e. the one with the text to be searched for
e107.runOnLoad(function(){
$$('form.e-filter-form').each(function(f) {
var el = f.select('input')[0];
el.e107PreviousValue = el.getValue();
el.observe('keyup', function(e) {
var el = e.element();
e.stop();
if (el.getValue() != el.e107PreviousValue) {
if (el.e107Timeout) {
window.clearTimeout(el.e107Timeout);
}
el.e107PreviousValue = el.getValue();
el.e107Timeout = window.setTimeout(function () {
new e107Ajax.Updater(f.id.replace(/jstarget-/, '').strip(), f.action, {
method: 'post',
parameters: 'ajax_used=1&filter_list=1&'+el.name+'='+el.getValue(),
overlayPage: $(document.body)
});
}, 500);
}
});
});
}, document, false);

View File

@@ -0,0 +1,16 @@
/* CSS File for Javascript library elements in all areas of e107 */
a.e-nav { padding:3px; }
div.e-rate { width:100px; display:inline-block }
img.e-rate { }
.e-rate-status { font-weight:bold;vertical-align:middle; padding-right:4px; width:140px; display:inline-block; text-align:right }
.e-rate-status-download { text-align:left; }
.e-rate-votes { vertical-align:middle; display:inline-block; width:100px }
select.e-bb { margin-top:4px; display:inline-block; vertical-align:top }
.bbcode_buttons { border:1px solid transparent; background-color: #FFFFFF }
.bbcode_buttons:hover { background-color: silver; border:1px solid black; }

View File

@@ -0,0 +1,920 @@
// handle secured json string - the Prototype implementation
$.ajaxSetup({
dataFilter: function(data, type) {
if(type != 'json') return data;
return data.replace(/^\/\*-secure-([\s\S]*)\*\/\s*$/, '$1');
}
});
$(document).ready(function()
{
$(".e-hideme").hide();
$(".e-expandit").show();
$(".e-spinner").spinner();
// default 'toggle'.
$(".e-expandit").click(function () {
var href = ($(this).is("a")) ? $(this).attr("href") : '';
if(href === "#" || href == "")
{
idt = $(this).nextAll("div");
$(idt).toggle("slow");
return true;
}
var id = $(this).attr("href");
$(id).toggle("slow");
return false;
});
// On
$(".e-expandit-on").click(function () {
var href = ($(this).is("a")) ? $(this).attr("href") : '';
if(href === "#" || href == "")
{
idt = $(this).nextAll("div");
$(idt).show("slow");
return true; // must be true or radio buttons etc. won't work
}
if($(this).attr("data-expandit"))
{
var id = $(this).attr("data-expandit");
}
else
{
var id = $(this).attr("href");
}
$(id).show("slow");
return false;
});
// Off.
$(".e-expandit-off").click(function () {
var href = ($(this).is("a")) ? $(this).attr("href") : '';
if(href === "#" || href == "")
{
idt = $(this).nextAll("div");
$(idt).hide("slow");
return true; // must be true or radio buttons etc. won't work
}
if($(this).attr("data-expandit"))
{
var id = $(this).attr("data-expandit");
}
else
{
var id = $(this).attr("href");
}
$(id).hide("slow");
return false;
});
// Dates --------------------------------------------------
$("input.e-date").each(function() {
$(this).datepicker({
dateFormat: $(this).attr("data-date-format"),
ampm: $(this).attr("data-date-ampm"),
showButtonPanel: true
});
});
$("input.e-datetime").each(function() {
$(this).datetimepicker({
dateFormat: $(this).attr("data-date-format"),
timeFormat: $(this).attr("data-time-format"),
ampm: $(this).attr("data-date-ampm"),
showButtonPanel: true
});
});
// Inline versions
$("div.e-date").each(function() {
var id = $(this).attr("id");
var newid = id.replace("inline-", "");
$(this).datepicker({
dateFormat: $(this).attr("data-date-format"),
ampm: $(this).attr("data-date-ampm"),
defaultDate: $("#"+newid).val(),
onSelect: function(dateText, inst) {
$("#"+newid).val(dateText);
}
});
});
$("div.e-datetime").each(function() {
var id = $(this).attr("id");
var newid = id.replace("inline-", "");
$(this).datetimepicker({
dateFormat: $(this).attr("data-date-format"),
ampm: $(this).attr("data-date-ampm"),
showButtonPanel: false,
onSelect: function(dateText, inst) {
$("#"+newid).val(dateText);
}
});
$(this).datetimepicker('setDate', $("#"+newid).val());
});
// Tabs -----------------------------------------------------
$(function() {
$( "#tab-container" ).tabs({cache: true});
});
// Tabs
$(function() {
$( ".e-tabs" ).tabs();
});
$('.e-tabs-add').on("click", function(){
var url = $(this).attr('data-url');
var ct = parseInt($("#e-tab-count").val());
var count = ct + 1;
// alert(count);
//return false;
if($("#tab-container").tabs("add",url +'&count='+count,"Page "+count))
{
$("#tab-container").tabs('select', ct);
$("#e-tab-count").val(count);
}
return false;
});
// --------------- Email ----------------------------------------
$('.e-email').on('blur', function() {
// alert('hello');
$(this).mailcheck({
suggested: function(element, suggestion) {
var id = $(element);
var hint = $(element).next('div').attr('data-hint');
var mes = hint.replace('[x]',suggestion.full);
$(element).next('div').html(mes);
$(element).next('div').show('slow');
},
empty: function(element) {
$(element).next('div').hide('slow');
}
});
});
// --------------- Passwords -----------------------------
// front-end
$('.e-password').on('keyup', function() {
// var len = $(this).val().length;
//data-minlength
});
// Tooltips for bbarea.
$(".bbcode_buttons").tipsy({gravity: 's',opacity: 1.0, fade: true,html: true});
// $("a.e-tip").tipsy({gravity: 'w',opacity: 1.0, fade: true,html: true});
// var tabs = $('#tab-container').clone(true);
// $('#htmlEditor').append(tabs);
/*
$("a.e-bb").click(function(){
var add = $(this).attr('data-bbcode');
var func = $(this).attr('data-function');
var diz = $(this).attr('title');
id = $(this).attr('href');
var tmp = id.replace('#','');
//alert(tmp);
if(func == 'insert')
{
addtext(add,true);
return false;
}
if(func == 'input')
{
addinput(add,diz);
return false;
}
if(func == 'show')
{
$('#'+add).show('slow');
// addinput(add,diz);
return false;
}
if(func == 'add')
{
addtext(add);
return false;
}
return false;
});
$("select.e-bb").change(function(){
var add = $(this).val();
addtext(add);
$(this).val('');
return false;
});
$(".e-bb").mouseover(function(){
var id = $(this).attr('id');
var diz = $(this).attr('title');
// alert(id);
var tmp = id.split('--');
// alert('#'+tmp[0]);
$('#'+tmp[0]).val(diz);
return false;
});
$(".e-bb").mouseout(function(){
var id = $(this).attr('id');
var tmp = id.split('--')
$('#'+tmp[0]).val('');
return false;
});
*/
// $(".e-multiselect").chosen();
// Character Counter
// $("textarea").before("<p class=\"remainingCharacters\" id=\"" + $("textarea").attr("name")+ "-remainingCharacters\">&nbsp;</p>");
$("textarea").keyup(function(){
// var max=$(this).attr("maxlength");
var max = 100;
var el = "#" + $(this).attr("name") + "-remainingCharacters";
var valLen=$(this).val().length;
$(el).text( valLen + " characters")
});
// Dialog
$("a.e-dialog").colorbox({
iframe:true,
width:"60%",
height:"70%",
speed:10,
opacity: 0.7
});
$(".e-dialog-close").live("click", function(){
parent.$.colorbox.close()
});
/*
$("a.e-dialog").live('click',function() {
var link = $(this).attr("href");
$(this).dialog({
modal: true,
open: function ()
{
$(this).load(link);
},
height: 600,
iframe: true,
width: 700,
title: 'Dynamically Loaded Page'
});
return false;
});
*/
$(".e-dialog-close").click(function () {
parent.$.colorbox.close()
});
// Modal Box - uses inline hidden content
$(".e-modal").click(function () {
var id = $(this).attr("href");
$(id).dialog({
minWidth: 800,
maxHeight: 700,
modal: true
});
});
$(".e-shake" ).effect("shake","",100);
$('.e-rate').each(function() {
var path = $(this).attr("data-path");
var script = $(this).attr("data-url");
var score = $(this).attr("data-score");
var readonly = parseInt($(this).attr("data-readonly"));
var tmp = $(this).attr('id');
var hint = $(this).attr("data-hint");
var hintArray = hint.split(',')
var t = tmp.split('-');
var table = t[0];
var id = t[1];
$('.e-rate').raty({
path : path,
half : true,
score : score,
readOnly : readonly,
hints : hintArray,
// starOff : 'star_off_16.png',
// starOn : 'star_on_16.png',
// starHalf : 'star_half_16.png',
// cancelOff : 'cancel-off-big.png',
// cancelOn : 'cancel-on-big.png',
// size : 16,
target : '#e-rate-'+tmp,
// targetType : 'number',
targetText : $('#e-rate-'+tmp).text(),
// cancel : true,
// css : 'e-rate-star',
click: function(score, evt) {
$(this).find('img').unbind('click');
$(this).find('img').unbind();
$.ajax({
type: "POST",
url: script + "?ajax_used=1",
data: { table: table, id: id, score: score }
}).done(function( msg ) {
alert(msg);
bla = msg.split('|');
$('#e-rate-'+tmp).text(bla[0]);
if(bla[1])
{
$('#e-rate-votes-'+tmp).text(bla[1]);
}
});
}
});
});
// $( ".field-help" ).tooltip();
// Allow Tabs to be used inside textareas.
$( 'textarea' ).keypress( function( e ) {
if ( e.keyCode == 9 ) {
e.preventDefault();
$( this ).val( $( this ).val() + '\t' );
}
});
// Text-area AutoGrow
// $("textarea.e-autoheight").elastic();
// ajax next/prev mechanism - updates url from value.
$(".e-nav").click(function(){ // should be run before ajax.
/*
var src = $(this).attr("data-src");
var inc = parseInt($(this).attr("data-nav-inc"));
var dir = $(this).attr("data-nav-dir");
var tot = parseInt($(this).attr("data-nav-total"));
var val = src.match(/from=(\d+)/);
var amt = parseInt(val[1]);
var oldVal = 'from='+ amt;
var sub = amt - inc;
var add = amt + inc;
$(this).show();
if(add > tot)
{
add = amt;
}
if(sub < 0)
{
sub = 0
}
if(dir == 'down')
{
var newVal = 'from='+ sub;
}
else
{
var newVal = 'from='+ add;
}
alert('nav');
src = src.replace(oldVal, newVal);
$(".e-nav").attr("data-src",src);
*/
});
$(".e-ajax").click(function(){
var id = $(this).attr("href");
var target = $(this).attr("data-target"); // support for input buttons etc.
var loading = $(this).attr('data-loading'); // image to show loading.
var nav = $(this).attr('data-nav-inc');
if(nav != null)
{
eNav(this,'.e-ajax'); //modify data-src value for next/prev. 'from='
}
var src = $(this).attr("data-src");
if(target != null)
{
id = '#' + target;
}
if(loading != null)
{
$(id).html("<img src='"+loading+"' alt='' />");
}
if(src === null) // old way - href='myscript.php#id-to-target
{
var tmp = src.split('#');
id = tmp[1];
src = tmp[0];
}
// var effect = $(this).attr("data-effect");
// alert(id);
$(id).load(src,function() {
// alert(src);
//$(this).hide();
// $(this).fadeIn();
});
return false;
});
// Does the same as externalLinks();
$('a').each(function() {
var href = $(this).attr("href");
var rel = $(this).attr("rel");
if(href && rel == 'external')
{
$(this).attr("target",'_blank');
}
});
})
/**
* dynamic next/prev
* @param e object (eg. from selector)
* @param navid - class with data-src that needs 'from=' value updated. (often 2 of them eg. next/prev)
*/
function eNav(e,navid)
{
var src = $(e).attr("data-src");
var inc = parseInt($(e).attr("data-nav-inc"));
var dir = $(e).attr("data-nav-dir");
var tot = parseInt($(e).attr("data-nav-total"));
var val = src.match(/from=(\d+)/);
var amt = parseInt(val[1]);
var oldVal = 'from='+ amt;
var sub = amt - inc;
var add = amt + inc;
$(e).show();
if(add > tot)
{
add = amt;
// $(e).hide();
}
if(sub < 0)
{
sub = 0
}
if(dir == 'down')
{
var newVal = 'from='+ sub;
}
else
{
var newVal = 'from='+ add;
}
src = src.replace(oldVal, newVal);
$(navid).attr("data-src",src);
}
// Legacy Stuff to be converted.
// BC Expandit() function
var nowLocal = new Date(); /* time at very beginning of js execution */
var localTime = Math.floor(nowLocal.getTime()/1000); /* time, in ms -- recorded at top of jscript */
function expandit(e) {
var href = ($(e).is("a")) ? $(e).attr("href") : '';
if(href === "#" || href == "")
{
idt = $(e).next("div");
$(idt).toggle("slow");
return false;;
}
var id = "#" + e;
$(id).toggle("slow");
return false;
};
var addinput = function(text,rep) {
// quick fix to prevent JS errors - proper match was done only for latin words
// var rep = text.match(/\=([^\]]*)\]/);
// var rep = '';
var val = rep ? prompt(rep) : prompt('http://');
if(!val)
{
return;
}
var newtext = text.replace('*', val);
emote = '';
addtext(newtext, emote);
return;
}
function SyncWithServerTime(serverTime, path, domain)
{
if (serverTime)
{
/* update time difference cookie */
var serverDelta=Math.floor(localTime-serverTime);
if(!path) path = '/';
if(!domain) domain = '';
else domain = '; domain=' + domain;
document.cookie = 'e107_tdOffset='+serverDelta+'; path='+path+domain;
document.cookie = 'e107_tdSetTime='+(localTime-serverDelta)+'; path='+path+domain; /* server time when set */
}
var tzCookie = 'e107_tzOffset=';
// if (document.cookie.indexOf(tzCookie) < 0) {
/* set if not already set */
var timezoneOffset = nowLocal.getTimezoneOffset(); /* client-to-GMT in minutes */
document.cookie = tzCookie + timezoneOffset+'; path='+path+domain;
// }
}
function urljump(url){
top.window.location = url;
}
function setInner(id, txt) {
document.getElementById(id).innerHTML = txt;
}
function jsconfirm(thetext){
return confirm(thetext);
}
function insertext(str,tagid,display){
document.getElementById(tagid).value = str;
if(display){
document.getElementById(display).style.display='none';
}
}
function appendtext(str,tagid,display){
document.getElementById(tagid).value += str;
document.getElementById(tagid).focus();
if(display){
document.getElementById(display).style.display='none';
}
}
function open_window(url,wth,hgt) {
if('full' == wth){
pwindow = window.open(url);
} else {
if (wth) {
mywidth=wth;
} else {
mywidth=600;
}
if (hgt) {
myheight=hgt;
} else {
myheight=400;
}
pwindow = window.open(url,'Name', 'top=100,left=100,resizable=yes,width='+mywidth+',height='+myheight+',scrollbars=yes,menubar=yes');
}
pwindow.focus();
}
function ejs_preload(ejs_path, ejs_imageString){
var ejs_imageArray = ejs_imageString.split(',');
for(ejs_loadall=0; ejs_loadall<ejs_imageArray.length; ejs_loadall++){
var ejs_LoadedImage=new Image();
ejs_LoadedImage.src=ejs_path + ejs_imageArray[ejs_loadall];
}
}
function textCounter(field,cntfield) {
cntfield.value = field.value.length;
}
function openwindow() {
opener = window.open("htmlarea/index.php", "popup","top=50,left=100,resizable=no,width=670,height=520,scrollbars=no,menubar=no");
opener.focus();
}
function setCheckboxes(the_form, do_check, the_cb){
var elts = (typeof(document.forms[the_form].elements[the_cb]) != 'undefined') ? document.forms[the_form].elements[the_cb] : document.forms[the_form].elements[the_cb];
if(document.getElementById(the_form))
{
if(the_cb)
{
var elts =(typeof(document.getElementById(the_form).elements[the_cb]) != 'undefined') ? document.getElementById(the_form).elements[the_cb] : document.getElementById(the_form).elements[the_cb];
}
else
{
var elts = document.getElementById(the_form);
}
}
var elts_cnt = (typeof(elts.length) != 'undefined') ? elts.length : 0;
if(elts_cnt){
for(var i = 0; i < elts_cnt; i++){
elts[i].checked = do_check;
}
}else{
elts.checked = do_check;
}
return true;
}
var ref=""+escape(top.document.referrer);
var colord = window.screen.colorDepth;
var res = window.screen.width + "x" + window.screen.height;
var eself = document.location;
/* TODO: @SecretR - Object of removal
// From http://phpbb.com
var clientPC = navigator.userAgent.toLowerCase();
var clientVer = parseInt(navigator.appVersion);
var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1) && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1) && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;
var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);
var e107_selectedInputArea;
var e107_selectedRange;
// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close){
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2) selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + open + s2 + close + s3;
return;
}
function mozSwap(txtarea, newtext){
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd == 1 || selEnd == 2) selEnd = selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + newtext + s3;
return;
}
*/
function storeCaret (textAr){
e107_selectedInputArea = textAr;
/* TODO: @SecretR - Object of removal - not needed anymore
if (textAr.createTextRange){
e107_selectedRange = document.selection.createRange().duplicate();
}*/
}
/**
* New improved version - fixed scroll to top behaviour when inserting BBcodes
* @TODO - improve it more (0.8)
*/
function addtext(text, emote) {
if (!window.e107_selectedInputArea) {
return; //[SecretR] TODO - alert the user
}
var eField = e107_selectedInputArea;
var eSelection = false;
var tagOpen = '';
var tagClose = '';
if (emote != true) { // Split if its a paired bbcode
var tmp = text.split('][', 2);
if (tmp[0] == text) {
tagOpen = text;
} else {
tagOpen = tmp[0] + ']';
tagClose = '[' + tmp[1];
}
} else { //Insert Emote
tagOpen = text;
}
// Windows user
if (document.selection) {
eSelection = document.selection.createRange().text;
eField.focus();
if (eSelection) {
document.selection.createRange().text = tagOpen + eSelection + tagClose;
} else {
document.selection.createRange().text = tagOpen + tagClose;
}
eSelection = '';
eField.blur();
eField.focus();
return;
}
var scrollPos = eField.scrollTop;
var selLength = eField.textLength;
var selStart = eField.selectionStart;
var selEnd = eField.selectionEnd;
if (selEnd <= 2 && typeof(selLength) != 'undefined' && (selStart != selEnd)) {
selEnd = selLength;
}
var sel1 = (eField.value).substring(0,selStart);
var sel2 = (eField.value).substring(selStart, selEnd);
var sel3 = (eField.value).substring(selEnd, selLength);
var newStart = selStart + tagOpen.length + sel2.length + tagClose.length;
eField.value = sel1 + tagOpen + sel2 + tagClose + sel3;
eField.focus();
eField.selectionStart = newStart;
eField.selectionEnd = newStart;
eField.scrollTop = scrollPos;
return;
}
function help(helpstr,tagid){
if(tagid){
document.getElementById(tagid).value = helpstr;
} else if(document.getElementById('dataform')) {
document.getElementById('dataform').helpb.value = helpstr;
}
}
function externalLinks() {
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++) {
var anchor = anchors[i];
if (anchor.getAttribute("href") &&
anchor.getAttribute("rel") == "external")
anchor.target = "_blank";
}
}
function eover(object, over) {
object.className = over;
}
var e107_dupCounter = 1;
function duplicateHTML(copy,paste,baseid){
if(document.getElementById(copy)){
e107_dupCounter++;
var type = document.getElementById(copy).nodeName; // get the tag name of the source copy.
var but = document.createElement('input');
var br = document.createElement('br');
but.type = 'button';
but.value = 'x';
but.className = 'button';
but.onclick = function(){ this.parentNode.parentNode.removeChild(this.parentNode); };
var destination = document.getElementById(paste);
var source = document.getElementById(copy).cloneNode(true);
var newentry = document.createElement(type);
newentry.appendChild(source);
newentry.value='';
newentry.appendChild(but);
newentry.appendChild(br);
if(baseid)
{
newid = baseid+e107_dupCounter;
newentry.innerHTML = newentry.innerHTML.replace(new RegExp(baseid, 'g'), newid);
newentry.id=newid;
}
destination.appendChild(newentry);
}
}
function preview_image(src_val,img_path, not_found)
{
var ta;
var desti = src_val + '_prev';
ta = document.getElementById(src_val).value;
if(ta){
document.getElementById(desti).src = img_path + ta;
}else{
document.getElementById(desti).src = not_found;
}
return;
}

231
e107_web/js/core/debug.js Normal file
View File

@@ -0,0 +1,231 @@
print_a = function(){
if(window.console)
$A(arguments).each( function(a) {console.log(a) });
};
var_dump = print_a;
var e107Debug = {
init: function() {
//always on top!
this.debugE = new Element('div', { 'id': 'e-debug-console', 'style': 'z-index: 9991' } ).update(this._console_header);
this.cont = new Element('div', { 'id': 'e-debug-console-cont', 'style': 'z-index: 9990' } ).insert(this.debugE);
this.input = new Element('input', { 'id': 'e-debug-console-input', 'type': 'text' } );
this.controlC = new Element('a', { 'id': 'e-debug-console-controls-close', 'href': '#' } ).update(' X');
this.controlE = new Element('a', { 'id': 'e-debug-console-controls-eval', 'href': '#' } ).update(' Run ');
//var controlCC = new Element('div', { 'float': 'right' }).insert(this.controlC);
this.cont.insert( new Element('div', { 'id': 'e-debug-console-controls' }).update('&gt;&gt; ').insert(this.input).insert(this.controlE).insert(this.controlC) );
this.commands = new Array('');
this.clen = this.commands.length;
this.cindex = 0;
var C = this;
(function() {
C.controlC.observe('click', function(e) {
e.stop();
C.hide();
});
C.controlE.observe('click', function(e) {
e.stop();
C.evalInput(); C.setFocus();
});
C.input.observe('keydown', function(e) { //supported in all modern browsers
var keycode = e.keyCode;
var enterKey, escapeKey, keyUp, keyDown;
if (e.DOM_VK_RETURN) { // mozilla
enterKey = e.DOM_VK_RETURN;
escapeKey = e.DOM_VK_ESCAPE;
keyUp = e.DOM_VK_UP;
keyDown = e.DOM_VK_DOWN;
} else { // ie && friends
escapeKey = 27;
enterKey = 13;
keyUp = 38;
keyDown = 40;
}
switch (keycode) {
case enterKey:
C.evalInput();
break;
case keyUp:
C.chistory(-1);
break;
case keyDown:
C.chistory(1);
break;
case escapeKey:
C.input.value = ''; C.input.blur(); C.input.focus();
break;
}
});
//TODO - destroy method, console commands (e.g. \run -help), better key navigation (e.g. Ctrl + Shift + Key)
}).defer();
document.observe('dom:loaded', function() {
$(document.body).insert(this.cont.hide());
if(Prototype.Browser.IE6) this.iecenter();
else this.center();
}.bind(this));
this.keyboardNav = this.keyboardNav.bindAsEventListener(this);
this.re_center = this.center.bindAsEventListener(this);
this.re_iecenter = this.iecenter.bindAsEventListener(this);
this.startKeyboardNav();
},
show: function() {
if(!this.visible()) {
this.startPosObserve();
this._toggle();
}
},
hide: function() {
if(this.visible()) {
this.stopPosObserve();
this._toggle();
}
},
_toggle: function() {
var C = this;
Effect.toggle(this.cont, 'blind', {
duration: 0.4,
beforeStart: this.setFocus.bind(C),
afterFinish: this.setFocus.bind(C)
});
this.cindex = 0; //reset commands index
},
visible: function() {
return this.cont.visible();
},
center: function() {
var w = document.viewport.getWidth(), cw = this.cont.getWidth();
var pos = parseInt(w/2 - cw/2);
this.cont.setStyle({ 'left': pos + 'px'});
},
iecenter: function() {
var offset = document.body.scrollTop;
var w = document.body.clientWidth;
if(!this.cd) this.cd = this.cont.getWidth();
var left = parseInt(w/2 - this.cd/2);
if(left < 0) { //ie6 - sick of it
left = 0;
}
this.cont.setStyle( {
'position': 'absolute',
'top': offset + 'px',
'left': left + 'px'
});
},
setFocus: function() {
if(this.visible()) { this.input.blur(); this.input.focus(); this.scrollDown(); }
else { this.input.value = ''; this.scrollDown(); this.input.blur(); }
},
scrollDown: function() {
this.debugE.scrollTop = this.debugE.scrollHeight;
},
log: function(d) {
this.show();
this.debugE.insert( new Element('div', { 'class': 'console-output' }).update(d) ); //TODO check the type
this.scrollDown();
},
syslog: function(msg, error) {
var logcol = '#333300';
if(error) logcol = '#cc3300';
this.log('<span style="color: ' + logcol + '">&gt;&gt; ' + msg + '</span>');
},
clearLog: function(d) {
this.debugE.update('');
},
evalInput: function() {
var src = this.input.value;
if(!src.length) return;
this.syslog(src);
this.input.value = '';
try {
var ret = eval.call(window, src);
if(ret) this.log(ret);
//setTimeout(src, 0); - Safari only! Not implemented anyway
this.clen = this.commands.push(src);
this.cindex = 0;
} catch(e) {
this.syslog(e, true);
this.clen = this.commands.push(src);
this.cindex = 0;
}
this.setFocus();
},
startKeyboardNav: function() {
document.observe('keydown', this.keyboardNav);
return this;
},
startPosObserve: function() {
if(Prototype.Browser.IE6) {
Event.observe(window,"resize", this.re_iecenter);
Event.observe(window,"scroll", this.re_iecenter);
return this;
}
Event.observe(window,"resize", this.re_center);
return this;
},
stopPosObserve: function() {
if(Prototype.Browser.IE6) {
Event.stopObserving(window,"scroll", this.re_iecenter);
Event.stopObserving(window,"resize", this.re_iecenter);
return this;
}
Event.stopObserving(window,"resize", this.re_center);
return this;
},
keyboardNav: function(event) {
//TODO - find out what kind of shortcuts are safe to be used (Ctrl + Alt + Shift brings me too much irritation)
var keycode = event.keyCode;
var key = String.fromCharCode(keycode).toLowerCase();
var isShifthPressed = event.shiftKey || (event.keyIdentifier && event.keyIdentifier.toLowerCase() == 'shift'); //ie & friends
var isCtrlPressed = event.ctrlKey || (event.keyIdentifier && event.keyIdentifier.toLowerCase() == 'control'); //ie & friends
var isAltPressed = event.altKey || (event.keyIdentifier && event.keyIdentifier.toLowerCase() == 'alt'); //ie & friends
if(isShifthPressed && isCtrlPressed && isAltPressed && key.match(/c|l/) /* && event.element() != this.input */ ) {
if(this.visible()) this.stopPosObserve()._toggle();
else this.startPosObserve()._toggle();
}
},
chistory: function(index) {
var ci = this.clen + this.cindex + index;
if(this.commands[ci] || ci === 0 || ci === this.clen) {
this.input.value = this.commands[ci] || '';
this.cindex += index;
}
},
_console_header: '<span class="smallblacktext">--- <strong>e107 Debug Console v1.0.0:</strong> session started ---</span><br />'
}
e107Debug.init();
echo = function() {
$A(arguments).each( function(a) { e107Debug.log(a) });
}

View File

@@ -0,0 +1,159 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* DECORATE HTML LIST ELEMENTS
* Inspired by Magento' decorate JS functions (www.magentocommerce.com)
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/decorate.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
e107Utils.Decorate = {
/**
* Decorate table rows and cells, tbody etc
* @see e107Utils.Decorate._decorate()
*/
table: function(table) {
var table = $(table);
if (!table) return;
//default options
this._options = {
'tbody': false,
'tbody_tr': 'odd even first last',
'thead_tr': 'first last',
'tfoot_tr': 'first last',
'tr_td': false
};
// overload options
Object.extend(this._options, (arguments[1] || {}));
// decorate
if (this._options['tbody']) {
this._decorate(table.select('tbody'), this._options['tbody']);
}
if (this._options['tbody_tr']) {
this._decorate(table.select('tbody tr:not(.no-decorate)'), this._options['tbody_tr']);
}
if (this._options['thead_tr']) {
this._decorate(table.select('thead tr:not(.no-decorate)'), this._options['thead_tr']);
}
if (this._options['tfoot_tr']) {
this._decorate(table.select('tfoot tr:not(.no-decorate)'), this._options['tfoot_tr']);
}
if (this._options['tr_td']) {
table.select('tr:not(.no-decorate)').each( function(tr) {
this._decorate(tr.select('td:not(.no-decorate)'), this._options['tr_td']);
}.bind(this));
}
},
/**
* Decorate list (ul)
* Default decorate CSS classes for list items are "odd", "even" and "last"
*
* Examples:
* e107Utils.Decorate.list('mylist'); //default decorate options over element with id 'mylist'
* e107Utils.Decorate.list('mylist', 'odd even'); //decorate options odd and even only over element with id 'mylist'
*
* @param list - id/DOM object of list element (ul) to be decorated
* [@param options] - string|array decorate options - @see e107Utils.Decorate._decorate()
* [@param recursive] - boolean decorate all childs if present
*/
list: function(list) {
list = $(list);
if (list) {
if (!varset(arguments[2])) {
var items = list.select('li:not(.no-decorate)');
} else {
var items = list.childElements();
}
this._decorate(items, (arguments[1] || 'odd even last'));
}
},
/**
* Set "odd", "even" and "last" CSS classes for list items
*
* Examples:
* e107Utils.Decorate.dataList('mydatalist'); //default decorate options over element with id 'mydatalist'
* e107Utils.Decorate.dataList('mydatalist', 'odd even'); //decorate options odd and even for dt elements, default for dd elements
*
* [@param dt_options] - string|array dt element decorate options - @see e107Utils.Decorate._decorate()
* [@param dd_options] - string|array dd element decorate options - @see e107Utils.Decorate._decorate()
*/
dataList: function(list) {
list = $(list);
if (list) {
this._decorate(list.select('dt:not(.no-decorate)'), (arguments[1] || 'odd even last'));
this._decorate(list.select('dd:not(.no-decorate)'), (arguments[2] || 'odd even last'));
}
},
/**
* Add classes to specified elements.
* Supported classes are: 'odd', 'even', 'first', 'last'
*
* @param elements - array of elements to be decorated
* [@param decorateParams] - array of classes to be set. If omitted or empty, all available will be used
*/
_decorate: function(elements) {
var decorateAllParams = $w('odd even first last');
this.decorateParams = $A();
this.params = {};
if (!elements.length) return;
if(!varset(arguments[1])) {
this.decorateParams = decorateAllParams;
} else if(typeof(arguments[1]) == 'string') {
this.decorateParams = $w(arguments[1]);
} else {
this.decorateParams = arguments[1];
}
decorateAllParams.each( function(v) {
this.params[v] = this.decorateParams.include(v);
}.bind(this));
// decorate first
if(this.params.first) {
Element.addClassName(elements[0], 'first');
}
// decorate last
if(this.params.last) {
Element.addClassName(elements[elements.length-1], 'last');
}
if(!this.params.even && !this.params.odd) {
return;
}
var selections = elements.partition(this._isEven);
if(this.params.even) {
selections[0].invoke('addClassName', 'even');
}
if(this.params.odd) {
selections[1].invoke('addClassName', 'odd');
}
},
/**
* Select/Reject/Partition callback function
*
* @see e107Utils.Decorate._decorate()
*/
_isEven: function(dummy, i) {
return ((i+1) % 2 == 0);
}
}

1931
e107_web/js/core/dialog.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,86 @@
.e-dialog {
position: absolute;
}
.e-dialog .move_handle {
cursor:move !important;
}
/*.e-dialog .e {
position: relative;
}*/
.e-dialog .resize_handle {
line-height: 1px;
font-size:1px;
width: 8px;
height: 8px;
z-index: 90;
position: absolute;
}
.e-dialog .se_sizer {
cursor: se-resize;
z-index: 100;
bottom:0;
right:0;
}
.e-dialog .sw_sizer {
cursor: sw-resize;
z-index: 100;
bottom:0;
left:0;
}
.e-dialog .nw_sizer {
cursor: nw-resize;
z-index: 100;
top:0;
left:0;
}
.e-dialog .ne_sizer {
cursor: ne-resize;
z-index: 100;
top:0;
right:0;
}
.e-dialog .n_sizer {
cursor: n-resize;
width:100%;
top:0;
left:0;
}
.e-dialog .s_sizer {
cursor: s-resize;
width: 100%;
bottom:0;
left:0;
}
.e-dialog .e_sizer {
cursor: e-resize;
height:100%;
top:0;
right:0;
}
.e-dialog .w_sizer {
cursor: w-resize;
height:100%;
top:0;
left:0;
}
.e-dialog .content {
overflow: auto;
position: relative;
}
html>body .e-dialog .content {
/* fixes an unbelievable rendering bug in Safari 2 */
border-top: 1px solid transparent;
}

View File

@@ -0,0 +1,197 @@
.e107 .nw {
background:transparent url(icons/top_unactive.gif) no-repeat scroll 0px 0px;
height:22px;
padding-left:10px;
}
.e107_focused .nw {
background:transparent url(icons/top.gif) no-repeat scroll 0px 0px !important;
}
.e107 .ne {
background:transparent url(icons/top_unactive.gif) no-repeat scroll right -44px;
height:22px;
padding-right:10px;
}
.e107_focused .ne {
background:transparent url(icons/top.gif) no-repeat scroll right -44px !important;
}
.e107 .n {
background:transparent url(icons/top_unactive.gif) repeat-x scroll right -22px;
color:#17385B;
font:normal 14px/26px Arial, sans-serif;
height:22px;
margin:0;
padding:0;
text-align: left;
overflow: hidden;
padding-right: 60px;
line-height: 20px;
color: #000;
}
.e107_focused .n {
background:transparent url(icons/top.gif) repeat-x scroll right -22px !important;
}
.e107 .content {
background:#FFF;
color:#000;
font:normal 12px/1em Verdana, Arial, sans-serif;
overflow:auto;
}
.e107 .w {
border-left:1px solid #DDD;
border-right:1px solid #DDD;
}
.e107 .e {
border-left:1px solid #EEE;
border-right:1px solid #EEE;
}
.e107 .sw {
background:transparent url(icons/bottom_unactive.gif) no-repeat scroll 0 0px;
font-size:2px;
height:15px;
padding-left:12px;
}
.e107_focused .sw {
background:transparent url(icons/bottom.gif) no-repeat scroll 0 0px !important;
}
.e107 .se {
background:transparent url(icons/bottom_unactive.gif) no-repeat scroll right -30px;
font-size:2px;
height:15px;
padding-right:12px;
}
.e107_focused .se {
background:transparent url(icons/bottom.gif) no-repeat scroll right -30px !important;
}
.e107_focused .se_sizer {
width:12px;
height:12px;
}
.e107 .se_resize_handle {
background:transparent url(icons/bottom_unactive.gif) no-repeat scroll right -45px;
font-size:2px;
height:15px;
padding-right:12px;
}
.e107_focused .se_resize_handle {
background:transparent url(icons/bottom.gif) no-repeat scroll right -45px !important;
}
.e107 .s {
background:transparent url(icons/bottom_unactive.gif) repeat-x scroll 0 -15px;
font-size:12px;
line-height:15px;
height:15px;
overflow:hidden;
border: 0 none;
}
.e107_focused .s {
background:transparent url(icons/bottom.gif) repeat-x scroll 0 -15px !important;
}
.e107 .buttons {
position: absolute;
top:1px;
right:7px;
height: 20px;
}
.e107 .buttons a.close {
float: right;
background:transparent url(icons/button_unactive.gif) no-repeat 0 0;
background-repeat: no-repeat;
height:15px;
width:14px;
margin: 3px 7px 0 0px;
padding-top:0px; /* padding-top = buttons order, it will be reset to 0, do not use padding, use margin*/
overflow:hidden;
}
.e107_focused .buttons a.close {
background:transparent url(icons/buttons.gif) no-repeat 0 0 !important;
background-repeat: no-repeat;
}
.e107 .buttons.over a.close {
background:transparent url(icons/buttons_over.gif) no-repeat 0 0px !important;
}
.e107 .buttons a.maximize {
float: right;
background:transparent url(icons/button_unactive.gif) no-repeat 0 0;
height:15px;
width:14px;
margin: 3px 7px 0 0;
padding-top:2px; /* padding-top = buttons order, it will be reset to 0, do not use padding, use margin*/
overflow:hidden;
}
.e107_focused .buttons a.maximize {
background:transparent url(icons/buttons.gif) no-repeat 0 -30px !important;
}
.e107 .buttons.over a.maximize {
background:transparent url(icons/buttons_over.gif) no-repeat 0 -30px !important;
}
/* padding-top = buttons order, it will be reset to 0, do not use padding, use margin*/
/* not implemented
.e107 .buttons a.minimize {
float: right;
background:transparent url(icons/button_unactive.gif) no-repeat 0 0;
height:15px;
width:14px;
margin: 3px 7px 0 0;
padding-top:1px;
overflow:hidden;
}
.e107_focused .buttons a.minimize {
background:transparent url(icons/buttons.gif) no-repeat 0 -15px !important;
}
.e107 .buttons.over a.minimize {
background:transparent url(icons/buttons_over.gif) no-repeat 0 -15px !important;
}
.e107 .buttons a.minimize.disabled, .e107 .buttons.over a.minimize.disabled {
background:transparent url(icons/button_unactive.gif) no-repeat 0 0 !important;
}
*/
.e107_overlay {
position:absolute;
top:0;
left:0;
width:100%;
background-color:#DDD;
filter:alpha(opacity=60);
opacity: 0.6;
-moz-opacity: 0.6;
}
.e107_wired {
position:absolute;
border: 3px dashed #f0f0f0;
background-color: #fff;
filter:alpha(opacity=60);
opacity: 0.6;
-moz-opacity: 0.6;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

View File

@@ -0,0 +1,99 @@
/*
* Prototype UI http://prototype-ui.com/
*
* Group: Drag UI provides Element#enableDrag method that allow elements to fire
* drag-related events.
*
* Events fired: - drag:started : fired when a drag is started (mousedown then
* mousemove) - drag:updated : fired when a drag is updated (mousemove) -
* drag:ended : fired when a drag is ended (mouseup)
*
* Notice it doesn't actually move anything, drag behavior has to be implemented
* by attaching handlers to drag events.
*
* Drag-related informations: event.memo contains useful information about the
* drag occuring: - dx : difference between pointer x position when drag started
* and actual x position - dy : difference between pointer y position when drag
* started and actual y position - mouseEvent : the original mouse event, useful
* to know pointer absolute position, or if key were pressed.
*
* Example, with event handling for a specific element: > // Now "resizable"
* will fire drag-related events > $('resizable').enableDrag(); > > // Let's
* observe them > $('resizable').observe('drag:started', function(event) { >
* this._dimensions = this.getDimensions(); > }).observe('drag:updated',
* function(event) { > var drag = event.memo; > > this.setStyle({ > width:
* this._dimensions.width + drag.dx + 'px', > height: this._dimensions.height +
* drag.dy + 'px' > }); > });
*
* Example, with event delegating on the whole document: > // All elements in
* the having the "draggable" class name will fire drag events. >
* $$('.draggable').invoke('enableDrag'); > > document.observe('drag:started',
* function(event) { > UI.logger.info('trying to drag ' + event.element().id); >
* }):
*/
Element.addMethods( {
enableDrag : function(element) {
return $(element).writeAttribute('draggable');
},
disableDrag : function(element) {
return $(element).writeAttribute('draggable', null);
},
isDraggable : function(element) {
return $(element).hasAttribute('draggable');
}
});
(function() {
var initPointer, draggedElement;
document.observe('mousedown', function(event) {
if (draggedElement = findDraggable(event.element())) {
// prevent default browser action to avoid selecting text for
// instance
event.preventDefault();
initPointer = event.pointer();
document.observe('mousemove', startDrag);
document.observe('mouseup', cancelDrag);
}
});
function findDraggable(element) {
while (element && element !== document) {
if (element.hasAttribute('draggable'))
return element;
element = $(element.parentNode);
}
}
function startDrag(event) {
document.stopObserving('mousemove', startDrag).stopObserving('mouseup', cancelDrag).observe('mousemove', drag).observe('mouseup', endDrag);
fire('drag:started', event);
}
function cancelDrag(event) {
document.stopObserving('mousemove', startDrag).stopObserving('mouseup', cancelDrag);
}
function drag(event) {
fire('drag:updated', event);
}
function endDrag(event) {
document.stopObserving('mousemove', drag).stopObserving('mouseup', endDrag);
fire('drag:ended', event);
}
function fire(eventName, event) {
var pointer = event.pointer();
draggedElement.fire(eventName, {
dx : pointer.x - initPointer.x,
dy : pointer.y - initPointer.y,
mouseEvent : event
});
}
})();

View File

@@ -0,0 +1,318 @@
$(document).ready(function()
{
// $(":input").tipsy({gravity: 'w',fade: true, live: true});
$(":input,label,.e-tip").each(function() {
var field = $(this).nextAll(".field-help");
if(field.length == 0)
{
$(this).tipsy({gravity: 'sw',fade: true, live: true}); // Normal 'title' attribute
return;
}
field.hide();
$(this).tipsy({
title: function() {
return field.html(); // field-help when HTML is required.
},
fade: true,
live: true,
html: true,
gravity: 'sw'
});
});
// var color = $(".divider").parents().css("background-color");
// $(".e-tip").tipsy({gravity: 'sw',fade: true, live: true});
$(".e-comment-submit").live("click", function(){
var url = $(this).attr("data-target");
var sort = $(this).attr("data-sort");
var pid = parseInt($(this).attr("data-pid"));
var formid = (pid != '0') ? "#e-comment-form-reply" : "#e-comment-form";
var data = $('form'+formid).serialize() ;
var total = parseInt($("#e-comment-total").text());
$.ajax({
type: 'POST',
url: url + '?ajax_used=1&mode=submit',
data: data,
success: function(data) {
// alert(data);
// console.log(data);
var a = $.parseJSON(data);
$("#comment").val('');
if(pid != 0)
{
$('#comment-'+pid).after(a.html).hide().slideDown(800);
}
else if(sort == 'desc')
{
$(a.html).prependTo('#comments-container').hide().slideDown(800);
}
else
{
$(a.html).appendTo('#comments-container').hide().slideDown(800);
alert('Thank you for commenting'); // possibly needed as the submission may go unoticed by the user
}
if(!a.error)
{
$("#e-comment-total").text(total + 1);
if(pid != '0')
{
$(formid).hide();
}
}
else
{
alert(a.msg);
}
return false;
}
});
return false;
});
$(".e-comment-reply").live("click", function(){
var url = $(this).attr("data-target");
var table = $(this).attr("data-type");
var sp = $(this).attr('id').split("-");
var id = "#comment-" + sp[3];
if($('.e-comment-edit-save').length != 0) //prevent creating save button twice.
{
return false;
}
$.ajax({
type: 'POST',
url: url + '?ajax_used=1&mode=reply',
data: { itemid: sp[3], table: table },
success: function(data) {
var a = $.parseJSON(data);
if(!a.error)
{
// alert(a.html);
$(id).after(a.html).hide().slideDown(800);
}
}
});
return false;
});
$(".e-comment-edit").live("click", function(){
var url = $(this).attr("data-target");
var sp = $(this).attr('id').split("-");
var id = "#comment-" + sp[3] + "-edit";
if($('.e-comment-edit-save').length != 0) //prevent creating save button twice.
{
return false;
}
$(id).attr('contentEditable',true);
$(id).after("<div class='e-comment-edit-save'><input data-target='"+url+"' id='e-comment-edit-save-"+sp[3]+"' class='button e-comment-edit-save' type='button' value='Save' /></div>");
$('div.e-comment-edit-save').hide().fadeIn(800);
$(id).addClass("e-comment-edit-active");
$(id).focus();
return false;
});
$("input.e-comment-edit-save").live("click", function(){
var url = $(this).attr("data-target");
var sp = $(this).attr('id').split("-");
var id = "#comment-" + sp[4] + "-edit";
var comment = $(id).text();
$(id).attr('contentEditable',false);
$.ajax({
url: url + '?ajax_used=1&mode=edit',
type: 'POST',
data: {
comment: comment,
itemid: sp[4]
},
success:function (data) {
var a = $.parseJSON(data);
if(!a.error)
{
$("div.e-comment-edit-save")
.hide()
.addClass("e-comment-edit-success")
.html(a.msg)
.fadeIn('slow')
.delay(1000)
.fadeOut('slow');
}
else
{
$("div.e-comment-edit-save")
.addClass("e-comment-edit-error")
.html(a.msg)
.fadeIn('slow')
.delay(1000)
.fadeOut('slow');
}
$(id).removeClass("e-comment-edit-active");
setTimeout(function() {
$('div.e-comment-edit-save').remove();
}, 2000);
// .delay(1000);
// alert(data);
return;
}
});
});
$(".e-comment-delete").live("click", function(){
var url = $(this).attr("data-target");
var sp = $(this).attr('id').split("-");
var id = "#comment-" + sp[3];
var total = parseInt($("#e-comment-total").text());
$.ajax({
type: 'POST',
url: url + '?ajax_used=1&mode=delete',
data: { itemid: sp[3] },
success: function(data) {
var a = $.parseJSON(data);
if(!a.error)
{
$(id).hide('slow');
$("#e-comment-total").text(total - 1);
}
}
});
return false;
});
$(".e-comment-approve").live("click", function(){
var url = $(this).attr("data-target");
var sp = $(this).attr('id').split("-");
var id = "#comment-status-" + sp[3];
$.ajax({
type: 'POST',
url: url + '?ajax_used=1&mode=approve',
data: { itemid: sp[3] },
success: function(data) {
var a = $.parseJSON(data);
if(!a.error)
{
//TODO modify status of html on page.
$(id).text(a.html)
.fadeIn('slow')
.addClass('e-comment-edit-success'); //TODO another class?
$('#e-comment-approve-'+sp[3]).hide('slow');
}
else
{
alert(a.msg);
}
}
});
return false;
});
$(".e-rate-thumb").live("click", function(){
var src = $(this).attr("href");
var thumb = $(this);
var tmp = src.split('#');
var id = tmp[1];
var src = tmp[0];
$.ajax({
type: "POST",
url: src,
data: { ajax_used: 1, mode: 'thumb' },
dataType: "html",
success: function(html) {
if(html == '')
{
return false;
}
var tmp = html.split('|');
up= tmp[0];
down = tmp[1];
$('#'+id +'-up').text(up);
$('#'+id +'-down').text(down);
thumb.attr('title','Thanks for voting');
// alert('Thanks for liking');
}
});
return false;
});
});

View File

@@ -0,0 +1,342 @@
$(document).ready(function()
{
$(".e-dialog-save").live("click", function(){// FIXME TODO missing caret , text selection overwrite etc.
var newval = $('#bbcode_holder').val();
// alert(newval);
var target = $(this).attr('data-target');
//alert('hello');
if(!target){return true; }
//('#' + target, window.top.document).insertAtCaret(newVal);
// $('#' + target, window.parent.document).append(newval); //FIXME caret!!
// var t = $('#' + target, window.parent.document).text();
$('#' + target, window.top.document).attr('value',newval); // set new value
// inserttext(newval,target);
// alert(newval);
});
$(".e-media-attribute").keyup(function () {
eMediaAttribute();
});
function eMediaAttribute(e)
{
var style = '';
var bb = '';
var target = $(e).attr('data-target');
// var path = $(e).attr('data-path');
// var preview = $(e).attr('data-preview');
// var src = $(e).attr('data-src');
var src = $('#src').attr('value'); // working old
var path = $('#path').attr('value'); // working old
var preview = $('#preview').attr('value'); // working old
var width = $('#width').val();
var height = $('#height').val();
var margin_top = $('#margin-top').val();
var margin_bottom = $('#margin-bottom').val();
var margin_right = $('#margin-right').val();
var margin_left = $('#margin-left').val();
if(width !='')
{
style = style + 'width:' + width + 'px;';
}
if(height !='')
{
style = style + 'height:' + height + 'px;';
}
if(margin_right !='')
{
style = style + 'margin-right:' + margin_right + 'px;';
}
if(margin_left !='')
{
style = style + 'margin-left:' + margin_left + 'px;';
}
if(margin_top !='')
{
style = style + 'margin-top:' + margin_top + 'px;';
}
if(margin_bottom !='')
{
style = style + 'margin-bottom:' + margin_bottom + 'px;';
}
bb = '[img';
if(style !='')
{
bb = bb + ' style='+style;
}
bb = bb + ']';
bb = bb + path;
bb = bb + '[/img]';
$('#bbcode_holder').val(bb);
// document.getElementById('bbcode_holder').value = bb;
// var html = '<img style=\"' + style + '\" src=\"'+ src +'\" />';
var html = '<img style=\"' + style + '\" src=\"'+ src +'\" alt=\"\" width=\"' + width + '\" height=\"' + height + '\"/>';
$('#html_holder').val(html);
}
// $(".e-media-select").click(function () {
$(".e-media-select").live("click", function(){
// console.log(this);
var id = $(this).attr('data-id');
var target = $(this).attr('data-target');
var path = $(this).attr('data-path');
var preview = $(this).attr('data-preview');
var src = $(this).attr('data-src');
var bbcode = $(this).attr('data-bbcode');
var name = $(this).attr('data-name');
//alert(target);
$(this).addClass("media-select-active");
$(this).closest("img").addClass("active");
if(bbcode == "file") // not needed for Tinymce
{
bbpath = '[file='+ id +']'+ name + '[/file]';
$('#bbcode_holder').val(bbpath);
alert(bbpath); //FIXME bbcode - Insert into correct caret in text-area.
return;
// $('input#' + target, window.top.document).attr('value',path); // set new value
// $('textarea#' + target, window.top.document).attr('value',bbpath);
}
// if(bbcode == 'wysiwyg')
{
//alert('hello');
}
if(bbcode == "img")
{
// bbpath = '['+bbcode+']'+ path + '[/' + bbcode + ']';
//alert(bbpath);
}
$('#src').attr('value',src); // working old
$('#preview').attr('src',preview); // working old
$('#path').attr('value',path); // working old
$('#src').attr('src',src); // working old
$('img#' + target + "_prev", window.top.document).attr('src',preview); // set new value
$('div#' + target + "_prev", window.top.document).html(preview); // set new value
$('span#' + target + "_prev", window.top.document).html(preview); // set new value
// see $frm->filepicker()
if(target !='')
{
$('input#' + target , window.top.document).attr('value',path); // set new value
}
eMediaAttribute(this);
// $(this).parent('#src').attr('value',preview); // set new value
// $(this).parent('#preview').attr('src',preview); // set new value
return false;
});
$(".e-media-nav").click(function(){
return mediaNav(this,'.e-media-nav');
/*
var id = $(this).attr("href");
var src = $(this).attr("data-src");
var target = $(this).attr("data-target"); // support for input buttons etc.
var loading = $(this).attr('data-loading'); // image to show loading.
var search = $('#media-search').val(); // image to show loading.
if(target != null)
{
id = '#' + target;
}
if(loading != null)
{
$(id).html("<img src='"+loading+"' alt='' />");
}
if(src === null) // old way - href='myscript.php#id-to-target
{
var tmp = src.split('#');
id = tmp[1];
src = tmp[0];
}
if(search !== null)
{
src = src + '&search='+search;
}
// var effect = $(this).attr("data-effect");
// alert(src);
$(id).load(src,function() {
// alert(src);
// $(this).hide();
// $(this).SlideUp();
});
*/
});
$("#media-search").keyup(function(){
mediaNav(this,null);
});
function mediaNav(e,navid)
{
var id = $(e).attr("href");
var target = $(e).attr("data-target"); // support for input buttons etc.
var loading = $(e).attr('data-loading'); // image to show loading.
var search = $('#media-search').val(); // image to show loading.
var nav = $(e).attr('data-nav-inc');
if(nav !== null && navid !==null)
{
eNav(e,navid);
}
var src = $(e).attr("data-src");
if(target != null)
{
id = '#' + target;
}
if(loading != null)
{
$(id).html("<img src='"+loading+"' alt='' />");
}
if(src === null) // old way - href='myscript.php#id-to-target
{
var tmp = src.split('#');
id = tmp[1];
src = tmp[0];
}
if(search !== null)
{
src = src + '&search='+search;
}
$(id).load(src,function() {
// alert(src);
// $(this).hide();
// $(this).SlideUp();
});
}
// ----------------- Upload --------------------------------------
var upath = $("#uploader").attr("rel"),
extImg = $("#uploader").attr("extimg"),
extArchive = $("#uploader").attr("extarch"),
extDoc = $("#uploader").attr("extdoc");
$("#uploader").pluploadQueue({
// General settings
runtimes : "html5,html4",
url : upath,
max_file_size : "10mb",
chunk_size : "1mb",
unique_names : false,
// Resize images on clientside if we can
// resize : {width : 320, height : 240, quality : 90},
// Specify what files to browse for
filters : [
{title : "Image files", extensions : extImg || "jpg,gif,png,jpeg"},
{title : "Zip files", extensions : extArchive || "zip,gz"},
{title : "Document files", extensions : extDoc || "pdf,doc,docx,xls,xlsm"}
],
preinit : {
Init: function(up, info) {
//log('[Init]', 'Info:', info, 'Features:', up.features);
}
},
init : {
FilesAdded: function(up, files) {
},
FileUploaded: function(up, file, info) { // Called when a file has finished uploading
//log('[FileUploaded] File:', file, "Info:", info);
},
UploadProgress: function(up, file) { // Called while a file is being uploaded
// console.log(up.total);
// console.log('[UploadProgress]', 'File:', file, "Total:", up.total);
},
UploadComplete: function(up, files){
document.location.reload(); // refresh the page.
},
ChunkUploaded: function(up, file, info) { // Called when a file chunk has finished uploading
//log('[ChunkUploaded] File:', file, "Info:", info);
// console.log(info);
},
Error: function(up, args) { // Called when a error has occured
alert('There was an error');
// console.log(args);
}
}
});
// -----------------------------------------------------------------
});

295
e107_web/js/core/shadow.js Normal file
View File

@@ -0,0 +1,295 @@
/**
* Global prefs
*/
e107Base.setPrefs('core-shadow', {
theme: "e107_shadow",
focus: false,
zIndex: 100
});
/*
* Class: e107Widgets.Shadow Add shadow around a DOM element. The element MUST BE in
* ABSOLUTE position.
*
* Shadow can be skinned by CSS (see e107_shadow.css). CSS
* must be included to see shadow.
*
* A shadow can have two states: focused and blur. Shadow shifts are set in CSS
* file as margin and padding of shadow_container to add visual information.
*
* Example: new e107Widgets.Shadow("element_id");
*/
e107Widgets.Shadow = Class.create(e107WidgetAbstract, {
/*
* Method: initialize Constructor, adds shadow elements to the DOM if
* element is in the DOM. Element MUST BE in ABSOLUTE position.
* Parameters: element - DOM element options - Hashmap of options -
* theme (default: mac_shadow) - focus (default: true) - zIndex
* (default: 100)
*/
initialize: function(element, options) {
this.initMod('core-shadow', options);
this.element = $(element);
this.create();
this.iframe = e107API.Browser.IE && e107API.Browser.IE < 7 ? new e107Utils.IframeShim() : null;
this.render();
},
/*
* Method: destroy Destructor, removes elements from the DOM
*/
destroy: function() {
if (this.shadow.parentNode)
this.remove();
},
// Group: Size and Position
/*
* Method: setPosition Sets top/left shadow position in pixels
* Parameters: top - top position in pixel left - left position in pixel
*/
setPosition: function(top, left) {
if (this.shadowSize) {
var shadowStyle = this.shadow.style;
top = parseInt(top) - this.shadowSize.top + this.shadowShift.top;
left = parseInt(left) - this.shadowSize.left + this.shadowShift.left;
shadowStyle.top = top + 'px';
shadowStyle.left = left + 'px';
if (this.iframe)
this.iframe.setPosition(top, left);
}
return this;
},
/*
* Method: setSize Sets width/height shadow in pixels
* Parameters: width - width in pixel height - height in pixel
*/
setSize: function(width, height) {
if (this.shadowSize) {
try {
var w = Math.max(0, parseInt(width) + this.shadowSize.width - this.shadowShift.width) + "px";
this.shadow.style.width = w;
var h = Math.max(0, parseInt(height) - this.shadowShift.height) + "px";
// this.shadowContents[1].style.height = h;
this.shadowContents[1].childElements().each(function(e) {
e.style.height = h
});
this.shadowContents.each(function(item) {
item.style.width = w
});
if (this.iframe)
this.iframe.setSize(width + this.shadowSize.width - this.shadowShift.width, height + this.shadowSize.height - this.shadowShift.height);
} catch (e) {
// IE could throw an exception if called to early
}
}
return this;
},
/*
* Method: setBounds Sets shadow bounds in pixels
* Parameters: bounds - an Hash {top:, left:, width:, height:}
*/
setBounds: function(bounds) {
return this.setPosition(bounds.top, bounds.left).setSize(bounds.width, bounds.height);
},
/*
* Method: setZIndex Sets shadow z-index
* Parameters: zIndex - zIndex value
*/
setZIndex: function(zIndex) {
this.shadow.style.zIndex = zIndex;
return this;
},
// Group: Render
/*
* Method: show Displays shadow
*/
show: function() {
this.render();
this.shadow.show();
if (this.iframe)
this.iframe.show();
return this;
},
/*
* Method: hide Hides shadow
*/
hide: function() {
this.shadow.hide();
if (this.iframe)
this.iframe.hide();
return this;
},
/*
* Method: remove Removes shadow from the DOM
*/
remove: function() {
this.shadow.remove();
return this;
},
// Group: Status
/*
* Method: focus Focus shadow.
* Change shadow shift. Shift values are set in CSS file as margin and
* padding of shadow_container to add visual information of shadow
* status.
*/
focus: function() {
this.options.focus = true;
this.updateShadow();
return this;
},
/*
* Method: blur Blurs shadow.
* Change shadow shift. Shift values are set in CSS file as margin and
* padding of shadow_container to add visual information of shadow
* status.
*/
blur: function() {
this.options.focus = false;
this.updateShadow();
return this;
},
// Private Functions
// Adds shadow elements to DOM, computes shadow size and displays it
render: function() {
if (this.element.parentNode && !Object.isElement(this.shadow.parentNode)) {
this.element.parentNode.appendChild(this.shadow);
this.computeSize();
this.setBounds(Object.extend(this.element.getDimensions(), this.getElementPosition()));
this.shadow.show();
}
return this;
},
// Creates HTML elements without inserting them into the DOM
create: function() {
var zIndex = this.element.getStyle('zIndex');
zIndex = (zIndex || this.options.zIndex) - 1;
this.element.setStyle( {
zIndex: zIndex
});
this.shadowContents = new Array(3);
this.shadowContents[0] = new Element("div").insert(new Element("div", {
className: "shadow_center_wrapper"
}).insert(new Element("div", {
className: "n_shadow"
}))).insert(new Element("div", {
className: "shadow_right ne_shadow"
})).insert(new Element("div", {
className: "shadow_left nw_shadow"
}));
this.shadowContents[1] = new Element("div").insert(new Element("div", {
className: "shadow_center_wrapper c_shadow"
})).insert(new Element("div", {
className: "shadow_right e_shadow"
})).insert(new Element("div", {
className: "shadow_left w_shadow"
}));
this.centerElements = this.shadowContents[1].childElements();
this.shadowContents[2] = new Element("div").insert(new Element("div", {
className: "shadow_center_wrapper"
}).insert(new Element("div", {
className: "s_shadow"
}))).insert(new Element("div", {
className: "shadow_right se_shadow"
})).insert(new Element("div", {
className: "shadow_left sw_shadow"
}));
this.shadow = new Element("div", {
className: "shadow_container " + this.options.theme,
style: "position:absolute; top:-10000px; left:-10000px; display:none; z-index:" + zIndex
}).insert(this.shadowContents[0]).insert(this.shadowContents[1]).insert(this.shadowContents[2]);
},
// Compute shadow size
computeSize: function() {
if (this.focusedShadowShift)
return;
this.shadow.show();
// Trick to get shadow shift designed in CSS as padding
var content = this.shadowContents[1].select("div.c_shadow").first();
this.unfocusedShadowShift = {};
this.focusedShadowShift = {};
$w("top left bottom right").each(function(pos) {
this.unfocusedShadowShift[pos] = content.getNumStyle("padding-" + pos) || 0
}.bind(this));
this.unfocusedShadowShift.width = this.unfocusedShadowShift.left + this.unfocusedShadowShift.right;
this.unfocusedShadowShift.height = this.unfocusedShadowShift.top + this.unfocusedShadowShift.bottom;
$w("top left bottom right").each(function(pos) {
this.focusedShadowShift[pos] = content.getNumStyle("margin-" + pos) || 0
}.bind(this));
this.focusedShadowShift.width = this.focusedShadowShift.left + this.focusedShadowShift.right;
this.focusedShadowShift.height = this.focusedShadowShift.top + this.focusedShadowShift.bottom;
this.shadowShift = this.options.focus ? this.focusedShadowShift : this.unfocusedShadowShift;
// Get shadow size
this.shadowSize = {
top: this.shadowContents[0].childElements()[1].getNumStyle("height"),
left: this.shadowContents[0].childElements()[1].getNumStyle("width"),
bottom: this.shadowContents[2].childElements()[1].getNumStyle("height"),
right: this.shadowContents[0].childElements()[2].getNumStyle("width")
};
this.shadowSize.width = this.shadowSize.left + this.shadowSize.right;
this.shadowSize.height = this.shadowSize.top + this.shadowSize.bottom;
// Remove padding
content.setStyle("padding:0; margin:0");
this.shadow.hide();
},
// Update shadow size (called when it changes from focused to blur and
// vice-versa)
updateShadow: function() {
this.shadowShift = this.options.focus ? this.focusedShadowShift : this.unfocusedShadowShift;
var shadowStyle = this.shadow.style,
pos = this.getElementPosition(),
size = this.element.getDimensions();
shadowStyle.top = pos.top - this.shadowSize.top + this.shadowShift.top + 'px';
shadowStyle.left = pos.left - this.shadowSize.left + this.shadowShift.left + 'px';
shadowStyle.width = size.width + this.shadowSize.width - this.shadowShift.width + "px";
var h = parseInt(size.height - this.shadowShift.height) + "px";
this.centerElements.each(function(e) {
e.style.height = h
});
var w = parseInt(size.width + this.shadowSize.width - this.shadowShift.width) + "px";
this.shadowContents.each(function(item) {
item.style.width = w
});
},
// Get element position in integer values
getElementPosition: function() {
return {
top: this.element.getNumStyle("top"),
left: this.element.getNumStyle("left")
}
}
});

View File

@@ -0,0 +1,67 @@
.shadow_container.e107_shadow .shadow_center_wrapper {
float:left;
width:100%;
}
.shadow_container.e107_shadow .shadow_right {
float:left;
width:30px;
margin-left:-30px
}
.shadow_container.e107_shadow .shadow_left {
float:left;
margin-left:-100%;
width:30px;
}
.shadow_container.e107_shadow .se_shadow {
background:url(icons/se.png);
height:30px;
}
.shadow_container.e107_shadow .s_shadow {
background:url(icons/s.png);
height:30px;
margin: 0 30px;
}
.shadow_container.e107_shadow .sw_shadow {
background:url(icons/sw.png);
height:30px;
}
.shadow_container.e107_shadow .ne_shadow {
background:url(icons/ne.png);
height:30px;
}
.shadow_container.e107_shadow .n_shadow {
background:url(icons/n.png);
height:30px;
margin: 0 30px;
}
.shadow_container.e107_shadow .nw_shadow {
background:url(icons/nw.png);
height:30px;
}
.shadow_container.e107_shadow .e_shadow {
background:url(icons/e.png) repeat-y;
}
.shadow_container.e107_shadow .w_shadow {
background:url(icons/w.png) repeat-y;
}
.shadow_container.e107_shadow .c_shadow {
/* Padding is used to set shift values for unfocused window */
padding:20px 17px 17px 17px;
/* Maring is used to set shift values for focused window */
margin:17px 12px 12px 12px;
}
.shadow_container.e107_shadow {
font-size: 2px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

328
e107_web/js/core/tabs.js Normal file
View File

@@ -0,0 +1,328 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* e107Widget.Tabs Class
*
* Create tabs, supports ajax/inline content, browser history & bookmarks
* (unobtrusive Javascript)
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/tabs.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
/**
* Global prefs
*/
e107Base.setPrefs('core-tabs', {
tabsClassName: 'e-tabs',
bookmarkFix: true,
historyNavigation: false,
pageOverlay: false,
elementOverlay: true,
ajaxCache: true
});
e107Widgets.Tabs = Class.create(e107WidgetAbstract, {
initialize: function(container, options) {
this.Version = '1.0';
this.events = new e107EventManager(this);
var optHandlers = {
show: this.show,
hide: this.hide
}
Object.extend(optHandlers , options || {});
this.global = this;
this.initMod('core-tabs', optHandlers).__initTabData(container);
},
__initTabData: function(container) {
var cstring, celement = $(container);
if(null === celement)
throw('e107Widgets.Tabs: invalid value for container'); //TODO Lan
if(Object.isString(container)) {
cstring = container;
} else if(Object.isElement(container)) {
cstring = celement.identify();
}
this.histotyHash = ('etab-' + cstring).camelize();
if(!this.getModCache('-data')) {
this.setModCache('-data', {});
}
this.tabData = this.getModCache('-data')['ref-' + cstring];
this._observer = this.observer.bindAsEventListener(this); //click observer
if(!this.tabData && !this.___initialized) {
if(this.options.bookmarkFix || this.options.historyNavigation) this.options.history = true;
this.___methods = $w('show hide select tabSelect ajaxSelect visible getPanelId getMenuId startObserve stopObserve getPanelId getPanel getMenuId getMenu');
this.tabData = {
container: celement,
list: $A()
}
if(celement.nodeName.toLowerCase != 'ul')
var celements = celement.select('ul.' + this.options.tabsClassName + ' > li');
else
var celements = $$('body')[0].select(cstring + ' > li');
celements.inject(this.tabData.list, function(arr, elitem, i) {
var mid = elitem.identify(),
a = elitem.select('a')[0],
act = a.hash.substr(1),
cid = $(act);
var that = this;
arr[i] = { Index: i, menuId: mid, menu: elitem, menuAction: act, actionItem: a, panel: cid, panelId: cid.id, ajaxUrl: a.readAttribute('rel'), global: that, exec: that._exec.bind(that, i) };
this._extendTab(arr[i]);
return arr;
}.bind(this));
this.exec_recursive('hide').getDefault().select();
this.startEvents();
this.___initialized = true;
this.getModCache('-data')['ref-' + cstring] = this.tabData;
}
},
_extendTab: function(data) {
this.___methods.inject(data, function(obj, method) {
obj[method] = this[method].bind(this, obj);
return obj;
}.bind(this));
data.events = new e107EventManager(this);
data.options = this.options;
data.histotyHash = this.histotyHash;
return this._detectLoad(data);
},
_detectLoad: function(tab) {
if(tab.ajaxUrl) {
var lopts = $w(tab.ajaxUrl).detect(function (values) {
return values.startsWith('ajax-tab');
});
if(lopts) {
var link = tab.actionItem.readAttribute('href').split('#')[0]; //link url
tab.ajaxUrl = link ? link : document.location.href.split('#')[0]; //self url
}
return tab;
}
tab.ajaxUrl = false;
return tab;
},
_exec: function(index, method, options) {
if(!this.___methods.include(method) || !this.tabData.list[index]) {
throw('e107Widgets.Tabs._exec: wrong method or object not found!');
}
this.tabData.list[index][method](options);
return this.tabData.list[index];
},
/**
* Available only in instance' global scope
*/
exec: function(index, method, options) {
this.tabData.list[index].exec(method, options || {});
return this;
},
/**
* Available only in instance' global scope
*/
exec_recursive: function(method, except, options) {
if(except)
this.tabData.list.without(except).invoke('exec', method, options || {});
else
this.tabData.list.invoke('exec', method, options || {});
return this;
},
_getTabByIdnex: function(index) {
return this.tabData.list[index] || null;
},
_getTabByPanelId: function(name) {
return this.tabData.list.find(function(tab_obj) { return tab_obj.getPanelId() == name }) || null;
},
/**
* Available only in instance' global scope
*/
get: function(tab) {
if(Object.isNumber(tab))
return this._getTabByIdnex(tab);
else if(Object.isString(tab))
return this._getTabByPanelId(tab);
return tab;
},
getPanelId: function(tab_obj) {
return tab_obj.panelId;
},
getPanel: function(tab_obj) {
return tab_obj.panel;
},
getMenuId: function(tab_obj) {
return tab_obj.menuId;
},
getMenu: function(tab_obj) {
return tab_obj.menu;
},
/**
* Available only in instance' global scope
*/
getDefault: function() {
var current = e107History.get(this.histotyHash);
if(current) {
var tab = this.get(current) || this.tabData.list[0];
this._active = tab.Index;
return tab;
}
this._active = 0;
return this.tabData.list[0];
},
getActive: function() {
if(!this.global._active) {
var _active = this.tabData.list.find(function(tab_obj) { return tab_obj.visible(); }) || null;
if(_active) {
this.global._active = _active.Index;
}
}
return this.get(this.global._active);
},
visible: function(tab) {
return tab.getPanel().visible();
},
show: function(tab) {
tab.getMenu().addClassName('active');
tab.getPanel().addClassName('active').show();
if(tab.global.options.history)
e107History.set(tab.histotyHash, tab.getPanelId());
return tab;
},
hide: function(tab) {
tab.getMenu().removeClassName('active');
tab.getPanel().removeClassName('active').hide();
return tab;
},
select: function(tab) {
if(!tab.visible()) {
if(tab.ajaxUrl)
return tab.ajaxSelect();
return tab.tabSelect();
}
return tab;
},
ajaxSelect: function(tab) {
if(!tab.ajaxUrl || (this.global.options.ajaxCache && tab.options['ajaxCached']))
return tab.tabSelect();
var ovel = this.global.options.overlayElement === true ? tab.getPanel() : $(this.global.options.overlayElement);
tab.getMenu().addClassName('active');
new e107Ajax.Updater(tab.getPanel(), tab.ajaxUrl, {
overlayPage: this.options.pageOverlay ? tab.getPanel() : false,
overlayElement: ovel || false,
onComplete: function() { tab.options.ajaxCached = this.global.options.ajaxCache; tab.tabSelect(); }.bind(this)
});
return tab;
},
tabSelect: function(tab) {
this.global.events.notify('hideActive', this.global.getActive()); //global trigger
tab.events.notify('hide', this.global.getActive()); // tab object trigger
this.options.hide(this.global.getActive());
this.global.events.notify('showSelected', tab); //global trigger
tab.events.notify('show', tab); // tab object trigger
this.options.show(tab);
this.global._active = tab.Index;
return tab;
},
startEvents: function() {
this.exec_recursive('startObserve');
this._startHistory();
return this;
},
stopEvents: function() {
this.exec_recursive('stopObserve');
this._stopHistory();
return this;
},
startObserve: function(tab) {
tab.actionItem.observe('click', this._observer); return this;
},
stopObserve: function(tab) {
tab.actionItem.stopObserving('click', this._observer); return this;
},
observer: function(event) {
var el = event.findElement('a');
if(el) {
event.stop();
this.get(el.hash.substr(1)).select();
}
},
eventObserve: function(method, callback) {
this.events.observe(method, callback); return this;
},
eventStopObserve: function() {
this.events.stopObserving(method, callback); return this;
},
_startHistory: function() {
if(this.options.historyNavigation) {
e107History.Observer.start();
var that = this;
// set handler for this instance
e107History.Registry.set({
id: this.histotyHash,
onStateChange: function(tab) {
that.get(String(tab)).select();
}
});
}
},
_stopHistory: function() {
e107History.Observer.stop();
e107History.Registry.unset(this.histotyHash);
}
});

View File

@@ -0,0 +1,77 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://gnu.org).
*
* e107 Tooltip Widget
* Create static/ajax tooltips (unobtrusive Javascript)
*
* $Source: /cvs_backup/e107_0.8/e107_files/jslib/core/tooltip.js,v $
* $Revision$
* $Date$
* $Author$
*
*/
/**
* Global prefs
*/
e107Base.setPrefs('core-tooltip', {
backgroundColor: '', // background color (used if set)
borderColor: '', // Default border color (used if set)
textColor: '', // Default text color (used if set)
textShadowColor: '', // Default text shadow color (used if set)
align: "left", // left (default) | right
maxWidth: 250, // Max tooltip width
delay: 250, // Default delay before tooltip appears in ms
mouseFollow: true, // Tooltips follows the mouse moving
opacity: .75, // Default tooltips opacity
appearDuration: .25, // Default appear duration in sec
hideDuration: .25 // Default disappear duration in sec
});
/**
* e107Widget.Tooltip Class
*
* Inspired by CoolTip by Andrey Okonetchnikov
* (http://www.wildbit.com/labs/cooltips)
*/
e107Widgets.Tooltip = Class.create(e107WidgetAbstract, {
Version: '1.0',
initialize: function(element, options) {
this.events = new e107EventManager(this);
this.ttinit = false;
this.initMod('core-tooltip', optHandlers).__initTabData(container);
this.attachListeners();
},
show: function(e) {
},
hide: function(e) {
},
update: function(e){
},
create: function() {
},
attachListeners: function() {
},
_clearTimeout: function(timer) {
clearTimeout(timer);
clearInterval(timer);
return null;
}
});