From b40122832fdc3ebac05ca46e941f1c20698f1d06 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 21 Oct 2011 16:11:38 +0200 Subject: [PATCH 001/106] first implementation of fullcalendar plugin with old buttons working --- apps/calendar/templates/calendar.php | 84 +++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 1c948b948c..eb50bc9541 100644 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -6,6 +6,86 @@ var dayNamesShort = tA(array('Sun.', 'Mon.', 'Tue.', var monthNames = tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>; var monthNamesShort = tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>; var allDayText = 't('All day') ?>'; +var neweventtitle = 't('Title') ?>'; +$(document).ready(function() { + var date = new Date(); + var d = date.getDate(); + var m = date.getMonth(); + var y = date.getFullYear(); + + var calendar = $('#calendar').fullCalendar({ + selectable: true, + selectHelper: true, + select: function(start, end, allDay) { + var title = prompt(neweventtitle + ':'); + if (title) { + calendar.fullCalendar('renderEvent', + { + title: title, + start: start, + end: end, + allDay: allDay + }, + true // make the event "stick" + ); + } + calendar.fullCalendar('unselect'); + }, + editable: true, + events: [ + { + title: 'All Day Event', + start: new Date(y, m, 1) + }, + { + title: 'Long Event', + start: new Date(y, m, d-5), + end: new Date(y, m, d-2) + }, + { + id: 999, + title: 'Repeating Event', + start: new Date(y, m, d-3, 16, 0), + allDay: false + }, + { + id: 999, + title: 'Repeating Event', + start: new Date(y, m, d+4, 16, 0), + allDay: false + }, + { + title: 'Meeting', + start: new Date(y, m, d, 10, 30), + allDay: false + }, + { + title: 'Lunch', + start: new Date(y, m, d, 12, 0), + end: new Date(y, m, d, 14, 0), + allDay: false + }, + { + title: 'Birthday Party', + start: new Date(y, m, d+1, 19, 0), + end: new Date(y, m, d+1, 22, 30), + allDay: false + }, + { + title: 'Click for Google', + start: new Date(y, m, 28), + end: new Date(y, m, 29), + url: 'http://google.com/' + } + ] + }); + var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear()); + $('#oneweekview_radio').click(function(){$('#calendar').fullCalendar( 'changeView', 'agendaWeek');}); + $('#onemonthview_radio').click(function(){$('#calendar').fullCalendar( 'changeView', 'month');}); + $('#today_input').click(function(){$('#calendar').fullCalendar( 'today' );var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear());}); + $('#datecontrol_left').click(function(){$('#calendar').fullCalendar( 'prev' );var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear());}); + $('#datecontrol_right').click(function(){$('#calendar').fullCalendar( 'next' );var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear());}); +});
@@ -13,7 +93,7 @@ var allDayText = 't('All day') ?>';
- +
@@ -31,7 +111,7 @@ var allDayText = 't('All day') ?>';
-
+
From d09b3ad2e74d34e8563322864aa0b452d0ad4e67 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 21 Oct 2011 17:50:10 +0200 Subject: [PATCH 002/106] Revert "first implementation of fullcalendar plugin with old buttons working" This reverts commit b40122832fdc3ebac05ca46e941f1c20698f1d06. --- apps/calendar/templates/calendar.php | 84 +--------------------------- 1 file changed, 2 insertions(+), 82 deletions(-) diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index eb50bc9541..1c948b948c 100644 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -6,86 +6,6 @@ var dayNamesShort = tA(array('Sun.', 'Mon.', 'Tue.', var monthNames = tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>; var monthNamesShort = tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>; var allDayText = 't('All day') ?>'; -var neweventtitle = 't('Title') ?>'; -$(document).ready(function() { - var date = new Date(); - var d = date.getDate(); - var m = date.getMonth(); - var y = date.getFullYear(); - - var calendar = $('#calendar').fullCalendar({ - selectable: true, - selectHelper: true, - select: function(start, end, allDay) { - var title = prompt(neweventtitle + ':'); - if (title) { - calendar.fullCalendar('renderEvent', - { - title: title, - start: start, - end: end, - allDay: allDay - }, - true // make the event "stick" - ); - } - calendar.fullCalendar('unselect'); - }, - editable: true, - events: [ - { - title: 'All Day Event', - start: new Date(y, m, 1) - }, - { - title: 'Long Event', - start: new Date(y, m, d-5), - end: new Date(y, m, d-2) - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d-3, 16, 0), - allDay: false - }, - { - id: 999, - title: 'Repeating Event', - start: new Date(y, m, d+4, 16, 0), - allDay: false - }, - { - title: 'Meeting', - start: new Date(y, m, d, 10, 30), - allDay: false - }, - { - title: 'Lunch', - start: new Date(y, m, d, 12, 0), - end: new Date(y, m, d, 14, 0), - allDay: false - }, - { - title: 'Birthday Party', - start: new Date(y, m, d+1, 19, 0), - end: new Date(y, m, d+1, 22, 30), - allDay: false - }, - { - title: 'Click for Google', - start: new Date(y, m, 28), - end: new Date(y, m, 29), - url: 'http://google.com/' - } - ] - }); - var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear()); - $('#oneweekview_radio').click(function(){$('#calendar').fullCalendar( 'changeView', 'agendaWeek');}); - $('#onemonthview_radio').click(function(){$('#calendar').fullCalendar( 'changeView', 'month');}); - $('#today_input').click(function(){$('#calendar').fullCalendar( 'today' );var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear());}); - $('#datecontrol_left').click(function(){$('#calendar').fullCalendar( 'prev' );var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear());}); - $('#datecontrol_right').click(function(){$('#calendar').fullCalendar( 'next' );var date = $('#calendar').fullCalendar('getDate');$('#datecontrol_date').html(date.getDate() + "." + date.getMonth() + "." + date.getFullYear());}); -});
@@ -93,7 +13,7 @@ $(document).ready(function() {
- +
@@ -111,7 +31,7 @@ $(document).ready(function() {
-
+
From e48377d85b49402e1ad441a44508af612b8dda2c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 21 Oct 2011 18:19:44 +0200 Subject: [PATCH 003/106] added transition function from 'old' calendar to fullcalendar (fixed currentview bug) and removed listview (it is not implemented in fullcalendar yet) --- apps/calendar/ajax/changeview.php | 5 ++--- apps/calendar/index.php | 11 +++++++++++ apps/calendar/js/calendar.js | 4 ++-- apps/calendar/templates/calendar.php | 2 +- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php index b396ff4945..ef05c7cd49 100644 --- a/apps/calendar/ajax/changeview.php +++ b/apps/calendar/ajax/changeview.php @@ -7,10 +7,9 @@ */ require_once ("../../../lib/base.php"); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $currentview = $_GET["v"]; OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", $currentview); +OC_JSON::success(); ?> diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 7150fb8490..2764184dac 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -19,6 +19,17 @@ $eventSources = array(); foreach($calendars as $calendar){ $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar); } +//Fix currentview for fullcalendar +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "agendaWeek"); +} +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); +} +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); +} + OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addScript('calendar', 'calendar'); diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index bf9e2628ff..fccc301a91 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -531,10 +531,10 @@ $(document).ready(function(){ }); $('#onemonthview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'month'); - }); + });/* $('#listview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'list'); - }); + });*/ $('#today_input').click(function(){ $('#calendar_holder').fullCalendar('today'); }); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 1c948b948c..d9c6a506e0 100644 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -13,7 +13,7 @@ var allDayText = 't('All day') ?>';
- +
From c40383b6102130ca1e94a9ce2afe48af4d0ffc81 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 21 Oct 2011 18:27:12 +0200 Subject: [PATCH 004/106] enable listview button --- apps/calendar/index.php | 2 +- apps/calendar/js/calendar.js | 4 ++-- apps/calendar/templates/calendar.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 2764184dac..2442d27db4 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -27,7 +27,7 @@ if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'mont OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); } if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ - OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "month"); + OC_Preferences::setValue(OC_USER::getUser(), "calendar", "currentview", "list"); } OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index fccc301a91..bf9e2628ff 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -531,10 +531,10 @@ $(document).ready(function(){ }); $('#onemonthview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'month'); - });/* + }); $('#listview_radio').click(function(){ $('#calendar_holder').fullCalendar('changeView', 'list'); - });*/ + }); $('#today_input').click(function(){ $('#calendar_holder').fullCalendar('today'); }); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index d9c6a506e0..1c948b948c 100644 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -13,7 +13,7 @@ var allDayText = 't('All day') ?>';
- +
From add48b26579cef68ffa776022f31138ee9de152d Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 9 Dec 2011 14:35:59 +0100 Subject: [PATCH 005/106] optimize timezone detection --- apps/calendar/ajax/guesstimezone.php | 2 +- apps/calendar/js/geo.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/calendar/ajax/guesstimezone.php b/apps/calendar/ajax/guesstimezone.php index a3594498b0..07aadc5cb1 100755 --- a/apps/calendar/ajax/guesstimezone.php +++ b/apps/calendar/ajax/guesstimezone.php @@ -28,7 +28,7 @@ $geolocation = file_get_contents('http://ws.geonames.org/timezone?lat=' . $lat . //Information are by Geonames (http://www.geonames.org) and licensed under the Creative Commons Attribution 3.0 License $geoxml = simplexml_load_string($geolocation); $geoarray = make_array_out_of_xml($geoxml); -if(isset($geoarray['timezone']['timezoneId']) && $geoarray['timezone']['timezoneId'] != ''){ +if(in_array($geoarray['timezone']['timezoneId'], DateTimeZone::listIdentifiers())){ OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $geoarray['timezone']['timezoneId']); $message = array('message'=> $l->t('New Timezone:') . $geoarray['timezone']['timezoneId']); OC_JSON::success($message); diff --git a/apps/calendar/js/geo.js b/apps/calendar/js/geo.js index acea17c026..744d960b75 100755 --- a/apps/calendar/js/geo.js +++ b/apps/calendar/js/geo.js @@ -10,6 +10,7 @@ if (navigator.geolocation) { function(data){ if (data.status == 'success'){ $('#notification').html(data.message); + $('#notification').attr('title', 'CC BY 3.0 by Geonames.org'); $('#notification').slideDown(); window.setTimeout(function(){$('#notification').slideUp();}, 5000); }else{ From bd68cee8cf0c1d3daabc34672a261bc3cd26eb74 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 9 Dec 2011 14:36:43 +0100 Subject: [PATCH 006/106] add resettimezone file for testing timezone detection --- apps/calendar/resettimezone.php | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 apps/calendar/resettimezone.php diff --git a/apps/calendar/resettimezone.php b/apps/calendar/resettimezone.php new file mode 100644 index 0000000000..1ef9591ae3 --- /dev/null +++ b/apps/calendar/resettimezone.php @@ -0,0 +1,4 @@ + \ No newline at end of file From 33caa64ccec78fea98b61485cb459987dfa2998c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 10 Dec 2011 15:11:41 +0100 Subject: [PATCH 007/106] check for php version is greater than 5.3.0 - we make extensive use of Date Time Libs --- apps/calendar/appinfo/app.php | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 5675e624dd..5dc41a77ca 100644 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -1,25 +1,27 @@ ')){ + $l=new OC_L10N('calendar'); + OC::$CLASSPATH['OC_Calendar_Calendar'] = 'apps/calendar/lib/calendar.php'; + OC::$CLASSPATH['OC_Calendar_Object'] = 'apps/calendar/lib/object.php'; + OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php'; + OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php'; + OC_HOOK::connect('OC_User', 'post_createUser', 'OC_Calendar_Hooks', 'deleteUser'); -OC_Util::addScript('calendar','loader'); + OC_Util::addScript('calendar','loader'); -OC_App::register( array( - 'order' => 10, - 'id' => 'calendar', - 'name' => 'Calendar' )); + OC_App::register( array( + 'order' => 10, + 'id' => 'calendar', + 'name' => 'Calendar' )); -OC_App::addNavigationEntry( array( - 'id' => 'calendar_index', - 'order' => 10, - 'href' => OC_Helper::linkTo( 'calendar', 'index.php' ), - 'icon' => OC_Helper::imagePath( 'calendar', 'icon.png' ), - 'name' => $l->t('Calendar'))); + OC_App::addNavigationEntry( array( + 'id' => 'calendar_index', + 'order' => 10, + 'href' => OC_Helper::linkTo( 'calendar', 'index.php' ), + 'icon' => OC_Helper::imagePath( 'calendar', 'icon.png' ), + 'name' => $l->t('Calendar'))); -OC_App::registerPersonal('calendar', 'settings'); + OC_App::registerPersonal('calendar', 'settings'); -require_once('apps/calendar/lib/search.php'); \ No newline at end of file + require_once('apps/calendar/lib/search.php'); +} \ No newline at end of file From 56f12cbfb1439dba6bdfd22023d84b3db153bf68 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 10 Dec 2011 17:54:42 +0100 Subject: [PATCH 008/106] delete unused files --- apps/calendar/ajax/daysofweekend.php | 11 --------- apps/calendar/ajax/duration.php | 12 ---------- apps/calendar/ajax/firstdayofweek.php | 12 ---------- apps/calendar/ajax/setdaysofweekend.php | 30 ------------------------ apps/calendar/ajax/setduration.php | 17 -------------- apps/calendar/ajax/setfirstdayofweek.php | 16 ------------- 6 files changed, 98 deletions(-) delete mode 100755 apps/calendar/ajax/daysofweekend.php delete mode 100644 apps/calendar/ajax/duration.php delete mode 100755 apps/calendar/ajax/firstdayofweek.php delete mode 100755 apps/calendar/ajax/setdaysofweekend.php delete mode 100644 apps/calendar/ajax/setduration.php delete mode 100755 apps/calendar/ajax/setfirstdayofweek.php diff --git a/apps/calendar/ajax/daysofweekend.php b/apps/calendar/ajax/daysofweekend.php deleted file mode 100755 index 606d13b1e1..0000000000 --- a/apps/calendar/ajax/daysofweekend.php +++ /dev/null @@ -1,11 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -echo OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'weekend', '{"Monday":"false","Tuesday":"false","Wednesday":"false","Thursday":"false","Friday":"false","Saturday":"true","Sunday":"true"}'); -?> diff --git a/apps/calendar/ajax/duration.php b/apps/calendar/ajax/duration.php deleted file mode 100644 index cdc41388ab..0000000000 --- a/apps/calendar/ajax/duration.php +++ /dev/null @@ -1,12 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -$duration = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'duration', "60"); -OC_JSON::encodedPrint(array("duration" => $duration)); -?> diff --git a/apps/calendar/ajax/firstdayofweek.php b/apps/calendar/ajax/firstdayofweek.php deleted file mode 100755 index eff82cece1..0000000000 --- a/apps/calendar/ajax/firstdayofweek.php +++ /dev/null @@ -1,12 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -$firstdayofweek = OC_Preferences::getValue( OC_User::getUser(), 'calendar', 'firstdayofweek', "1"); -OC_JSON::encodedPrint(array("firstdayofweek" => $firstdayofweek)); -?> \ No newline at end of file diff --git a/apps/calendar/ajax/setdaysofweekend.php b/apps/calendar/ajax/setdaysofweekend.php deleted file mode 100755 index b5ef5f8573..0000000000 --- a/apps/calendar/ajax/setdaysofweekend.php +++ /dev/null @@ -1,30 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -$weekenddays = array("Monday"=>"false", "Tuesday"=>"false", "Wednesday"=>"false", "Thursday"=>"false", "Friday"=>"false", "Saturday"=>"false", "Sunday"=>"false"); -for($i = 0;$i < count($_POST["weekend"]); $i++){ - switch ($_POST["weekend"][$i]){ - case "Monday": - case "Tuesday": - case "Wednesday": - case "Thursday": - case "Friday": - case "Saturday": - case "Sunday": - break; - default: - OC_JSON::error(); - exit; - } - $weekenddays[$_POST["weekend"][$i]] = "true"; -} -$setValue = json_encode($weekenddays); -OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'weekend', $setValue); -OC_JSON::success(); -?> diff --git a/apps/calendar/ajax/setduration.php b/apps/calendar/ajax/setduration.php deleted file mode 100644 index a75c8faea4..0000000000 --- a/apps/calendar/ajax/setduration.php +++ /dev/null @@ -1,17 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -if(isset($_POST["duration"])){ - OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'duration', $_POST["duration"]); - OC_JSON::success(); -}else{ - OC_JSON::error(); -} -?> - diff --git a/apps/calendar/ajax/setfirstdayofweek.php b/apps/calendar/ajax/setfirstdayofweek.php deleted file mode 100755 index 571b95af0e..0000000000 --- a/apps/calendar/ajax/setfirstdayofweek.php +++ /dev/null @@ -1,16 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or - * later. - * See the COPYING-README file. - */ -require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); -if(isset($_POST["firstdayofweek"])){ - OC_Preferences::setValue(OC_User::getUser(), 'calendar', 'firstdayofweek', $_POST["firstdayofweek"]); - OC_JSON::success(); -}else{ - OC_JSON::error(); -} -?> From 5e6fa608eb2d80cce3b1263eb68a8edcd1d0c05c Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 22 Dec 2011 16:31:01 +0100 Subject: [PATCH 009/106] use OC_JSON::checkLoggedIn() in all ajax files --- apps/calendar/ajax/activation.php | 4 +--- apps/calendar/ajax/choosecalendar.php | 4 +--- apps/calendar/ajax/deletecalendar.php | 4 +--- apps/calendar/ajax/deleteevent.php | 4 +--- apps/calendar/ajax/editcalendar.php | 4 +--- apps/calendar/ajax/editevent.php | 4 +--- apps/calendar/ajax/editeventform.php | 4 +--- apps/calendar/ajax/importdialog.php | 4 +--- apps/calendar/ajax/newcalendar.php | 4 +--- apps/calendar/ajax/newevent.php | 4 +--- apps/calendar/ajax/neweventform.php | 4 +--- 11 files changed, 11 insertions(+), 33 deletions(-) diff --git a/apps/calendar/ajax/activation.php b/apps/calendar/ajax/activation.php index 3c2bc6de23..ada2e44547 100644 --- a/apps/calendar/ajax/activation.php +++ b/apps/calendar/ajax/activation.php @@ -7,9 +7,7 @@ */ require_once ("../../../lib/base.php"); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $calendarid = $_POST['calendarid']; $calendar = OC_Calendar_App::getCalendar($calendarid);//access check diff --git a/apps/calendar/ajax/choosecalendar.php b/apps/calendar/ajax/choosecalendar.php index 0935a4c42a..9281c8edbd 100644 --- a/apps/calendar/ajax/choosecalendar.php +++ b/apps/calendar/ajax/choosecalendar.php @@ -8,9 +8,7 @@ require_once('../../../lib/base.php'); $l10n = new OC_L10N('calendar'); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $output = new OC_TEMPLATE("calendar", "part.choosecalendar"); $output -> printpage(); diff --git a/apps/calendar/ajax/deletecalendar.php b/apps/calendar/ajax/deletecalendar.php index fc308da6da..901cbbfcb0 100644 --- a/apps/calendar/ajax/deletecalendar.php +++ b/apps/calendar/ajax/deletecalendar.php @@ -7,9 +7,7 @@ */ require_once('../../../lib/base.php'); -if(!OC_USER::isLoggedIn()) { - die(''); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $cal = $_POST["calendarid"]; diff --git a/apps/calendar/ajax/deleteevent.php b/apps/calendar/ajax/deleteevent.php index 269f4a47f4..b25a5af1a2 100644 --- a/apps/calendar/ajax/deleteevent.php +++ b/apps/calendar/ajax/deleteevent.php @@ -9,9 +9,7 @@ require_once('../../../lib/base.php'); $l10n = new OC_L10N('calendar'); -if(!OC_USER::isLoggedIn()) { - die(''); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $id = $_POST['id']; diff --git a/apps/calendar/ajax/editcalendar.php b/apps/calendar/ajax/editcalendar.php index e44763c9aa..7aeb5bbe30 100644 --- a/apps/calendar/ajax/editcalendar.php +++ b/apps/calendar/ajax/editcalendar.php @@ -7,9 +7,7 @@ */ require_once('../../../lib/base.php'); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions(); diff --git a/apps/calendar/ajax/editevent.php b/apps/calendar/ajax/editevent.php index f00ab1d960..5a487da175 100644 --- a/apps/calendar/ajax/editevent.php +++ b/apps/calendar/ajax/editevent.php @@ -7,9 +7,7 @@ */ require_once('../../../lib/base.php'); -if(!OC_USER::isLoggedIn()) { - die(''); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $errarr = OC_Calendar_Object::validateRequest($_POST); diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index fe6c6f7357..2c81539d2e 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -8,9 +8,7 @@ require_once('../../../lib/base.php'); -if(!OC_USER::isLoggedIn()) { - die(''); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $id = $_GET['id']; diff --git a/apps/calendar/ajax/importdialog.php b/apps/calendar/ajax/importdialog.php index 232b4ba580..8d8430da7a 100644 --- a/apps/calendar/ajax/importdialog.php +++ b/apps/calendar/ajax/importdialog.php @@ -10,9 +10,7 @@ require_once('../../../lib/base.php'); $l10n = new OC_L10N('calendar'); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $tmpl = new OC_Template('calendar', 'part.import'); diff --git a/apps/calendar/ajax/newcalendar.php b/apps/calendar/ajax/newcalendar.php index a7935c9567..af3ba4fbbe 100644 --- a/apps/calendar/ajax/newcalendar.php +++ b/apps/calendar/ajax/newcalendar.php @@ -8,9 +8,7 @@ require_once('../../../lib/base.php'); $l10n = new OC_L10N('calendar'); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $calendarcolor_options = OC_Calendar_Calendar::getCalendarColorOptions(); $calendar = array( diff --git a/apps/calendar/ajax/newevent.php b/apps/calendar/ajax/newevent.php index 1a696cf778..c7c4d29943 100644 --- a/apps/calendar/ajax/newevent.php +++ b/apps/calendar/ajax/newevent.php @@ -10,9 +10,7 @@ require_once('../../../lib/base.php'); $l10n = new OC_L10N('calendar'); -if(!OC_USER::isLoggedIn()) { - die(""); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); $errarr = OC_Calendar_Object::validateRequest($_POST); diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index e12e99219e..6de1f8ca30 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -8,9 +8,7 @@ require_once('../../../lib/base.php'); -if(!OC_USER::isLoggedIn()) { - die(''); -} +OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); if (!isset($_POST['start'])){ From 8ee53708ae708f7765f13f7dee34c68a4f95a6e1 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 25 Dec 2011 15:07:53 +0100 Subject: [PATCH 010/106] use pre-decrement instead of post-decrement --- apps/calendar/ajax/events.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/ajax/events.php b/apps/calendar/ajax/events.php index 1430432b8a..998991c2fb 100644 --- a/apps/calendar/ajax/events.php +++ b/apps/calendar/ajax/events.php @@ -58,7 +58,7 @@ foreach($events as $event){ } if($return_event['allDay'] == true){ $return_event['start'] = $result->format('Y-m-d'); - $return_event['end'] = date('Y-m-d', $result->format('U') + $duration--); + $return_event['end'] = date('Y-m-d', $result->format('U') + --$duration); }else{ $return_event['start'] = $result->format('Y-m-d H:i:s'); $return_event['end'] = date('Y-m-d H:i:s', $result->format('U') + $duration); From 9eef57faed0f6c8f1481a3bcb38df24605e12384 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 25 Dec 2011 23:19:49 +0100 Subject: [PATCH 011/106] make repeating events editable --- apps/calendar/ajax/editeventform.php | 166 +++++++++- apps/calendar/ajax/neweventform.php | 29 ++ apps/calendar/js/calendar.js | 123 +++++++- apps/calendar/lib/app.php | 41 ++- apps/calendar/lib/object.php | 338 +++++++++++++++++++-- apps/calendar/templates/part.eventform.php | 251 +++++++++++---- 6 files changed, 858 insertions(+), 90 deletions(-) diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index 2c81539d2e..4783fcca89 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -40,7 +40,6 @@ switch($dtstart->getDateType()) { $summary = $vevent->getAsString('SUMMARY'); $location = $vevent->getAsString('LOCATION'); $categories = $vevent->getAsArray('CATEGORIES'); -$repeat = $vevent->getAsString('CATEGORY'); $description = $vevent->getAsString('DESCRIPTION'); foreach($categories as $category){ if (!in_array($category, $category_options)){ @@ -53,10 +52,150 @@ if ($last_modified){ }else{ $lastmodified = 0; } +if($data['repeating'] == 1){ + $rrule = explode(';', $vevent->getAsString('RRULE')); + $rrulearr = array(); + foreach($rrule as $rule){ + list($attr, $val) = explode('=', $rule); + $rrulearr[$attr] = $val; + } + if(!isset($rrulearr['INTERVAL']) || $rrulearr['INTERVAL'] == ''){ + $rrulearr['INTERVAL'] = 1; + } + if(array_key_exists('BYDAY', $rrulearr)){ + if(substr_count($rrulearr['BYDAY'], ',') == 0){ + if(strlen($rrulearr['BYDAY']) == 2){ + $repeat['weekdays'] = array($rrulearr['BYDAY']); + }elseif(strlen($rrulearr['BYDAY']) == 3){ + $repeat['weekofmonth'] = substr($rrulearr['BYDAY'] , 0, 1); + $repeat['weekdays'] = array(substr($rrulearr['BYDAY'] , 1, 2)); + }elseif(strlen($rrulearr['BYDAY']) == 4){ + $repeat['weekofmonth'] = substr($rrulearr['BYDAY'] , 0, 2); + $repeat['weekdays'] = array(substr($rrulearr['BYDAY'] , 2, 2)); + } + }else{ + $byday_days = explode(',', $rrulearr['BYDAY']); + foreach($byday_days as $byday_day){ + if(strlen($byday_day) == 2){ + $repeat['weekdays'][] = $byday_day; + }elseif(strlen($rrulearr['BYDAY']) == 3){ + $repeat['weekofmonth'] = substr($byday_day , 0, 1); + $repeat['weekdays'][] = substr($byday_day , 1, 2); + }elseif(strlen($rrulearr['BYDAY']) == 4){ + $repeat['byweekno'] = substr($byday_day , 0, 2); + $repeat['weekdays'][] = substr($byday_day , 2, 2); + } + } + } + } + if(array_key_exists('BYMONTHDAY', $rrulearr)){ + if(substr_count($rrulearr['BYMONTHDAY'], ',') == 0){ + $repeat['bymonthday'][] = $rrulearr['BYMONTHDAY']; + }else{ + $bymonthdays = explode(',', $rrulearr['BYMONTHDAY']); + foreach($bymonthdays as $bymonthday){ + $repeat['bymonthday'][] = $bymonthday; + } + } + } + if(array_key_exists('BYYEARDAY', $rrulearr)){ + if(substr_count($rrulearr['BYYEARDAY'], ',') == 0){ + $repeat['byyearday'][] = $rrulearr['BYYEARDAY']; + }else{ + $byyeardays = explode(',', $rrulearr['BYYEARDAY']); + foreach($byyeardays as $yearday){ + $repeat['byyearday'][] = $yearday; + } + } + } + if(array_key_exists('BYWEEKNO', $rrulearr)){ + if(substr_count($rrulearr['BYWEEKNO'], ',') == 0){ + $repeat['byweekno'][] = (string) $rrulearr['BYWEEKNO']; + }else{ + $byweekno = explode(',', $rrulearr['BYWEEKNO']); + foreach($byweekno as $weekno){ + $repeat['byweekno'][] = (string) $weekno; + } + } + } + if(array_key_exists('BYMONTH', $rrulearr)){ + $months = OC_Calendar_App::getByMonthOptions(); + if(substr_count($rrulearr['BYMONTH'], ',') == 0){ + $repeat['bymonth'][] = $months[$month]; + }else{ + $bymonth = explode(',', $rrulearr['BYMONTH']); + foreach($bymonth as $month){ + $repeat['bymonth'][] = $months[$month]; + } + } + } + switch($rrulearr['FREQ']){ + case 'DAILY': + $repeat['repeat'] = 'daily'; + break; + case 'WEEKLY': + if($rrulearr['INTERVAL'] % 2 == 0){ + $repeat['repeat'] = 'biweekly'; + $rrulearr['INTERVAL'] = $rrulearr['INTERVAL'] / 2; + }elseif($rrulearr['BYDAY'] == 'MO,TU,WE,TH,FR'){ + $repeat['repeat'] = 'weekday'; + }else{ + $repeat['repeat'] = 'weekly'; + } + break; + case 'MONTHLY': + $repeat['repeat'] = 'monthly'; + if(array_key_exists('BYDAY', $rrulearr)){ + $repeat['month'] = 'weekday'; + }else{ + $repeat['month'] = 'monthday'; + } + break; + case 'YEARLY': + $repeat['repeat'] = 'yearly'; + if(array_key_exists('BYMONTH', $rrulearr)){ + $repeat['year'] = 'bydaymonth'; + }elseif(array_key_exists('BYWEEKNO', $rrulearr)){ + $repeat['year'] = 'byweekno'; + }else{ + $repeat['year'] = 'byyearday'; + } + } + $repeat['interval'] = $rrulearr['INTERVAL']; + if(array_key_exists('COUNT', $rrulearr)){ + $end = 'count'; + $count = $rrulearr['COUNT']; + }elseif(array_key_exists('UNTIL', $rrulearr)){ + $end = 'date'; + $endbydate_day = substr($rrulearr['UNTIL'], 6, 2); + $endbydate_month = substr($rrulearr['UNTIL'], 4, 2); + $endbydate_year = substr($rrulearr['UNTIL'], 0, 4); + $endbydate = $endbydate_day . $endbydate_month . $endbydate_year; + }else{ + $end = 'never'; + } + if(array_key_exists('weekdays', $repeat)){ + $repeat_weekdays_ = array(); + $days = OC_Calendar_App::getWeeklyOptions(); + foreach($repeat['weekdays'] as $weekday){ + $repeat_weekdays_[] = $days[$weekday]; + } + $repeat['weekdays'] = $repeat_weekdays_; + } +} $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); $category_options = OC_Calendar_App::getCategoryOptions(); $repeat_options = OC_Calendar_App::getRepeatOptions(); +$repeat_end_options = OC_Calendar_App::getEndOptions(); +$repeat_month_options = OC_Calendar_App::getMonthOptions(); +$repeat_year_options = OC_Calendar_App::getYearOptions(); +$repeat_weekly_options = OC_Calendar_App::getWeeklyOptions(); +$repeat_weekofmonth_options = OC_Calendar_App::getWeekofMonth(); +$repeat_byyearday_options = OC_Calendar_App::getByYearDayOptions(); +$repeat_bymonth_options = OC_Calendar_App::getByMonthOptions(); +$repeat_byweekno_options = OC_Calendar_App::getByWeekNoOptions(); +$repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions(); $tmpl = new OC_Template('calendar', 'part.editevent'); $tmpl->assign('id', $id); @@ -64,6 +203,15 @@ $tmpl->assign('lastmodified', $lastmodified); $tmpl->assign('calendar_options', $calendar_options); $tmpl->assign('category_options', $category_options); $tmpl->assign('repeat_options', $repeat_options); +$tmpl->assign('repeat_month_options', $repeat_month_options); +$tmpl->assign('repeat_weekly_options', $repeat_weekly_options); +$tmpl->assign('repeat_end_options', $repeat_end_options); +$tmpl->assign('repeat_year_options', $repeat_year_options); +$tmpl->assign('repeat_byyearday_options', $repeat_byyearday_options); +$tmpl->assign('repeat_bymonth_options', $repeat_bymonth_options); +$tmpl->assign('repeat_byweekno_options', $repeat_byweekno_options); +$tmpl->assign('repeat_bymonthday_options', $repeat_bymonthday_options); +$tmpl->assign('repeat_weekofmonth_options', $repeat_weekofmonth_options); $tmpl->assign('title', $summary); $tmpl->assign('location', $location); @@ -74,8 +222,22 @@ $tmpl->assign('startdate', $startdate); $tmpl->assign('starttime', $starttime); $tmpl->assign('enddate', $enddate); $tmpl->assign('endtime', $endtime); -$tmpl->assign('repeat', $repeat); $tmpl->assign('description', $description); + +$tmpl->assign('repeat', $repeat['repeat']); +$tmpl->assign('repeat_month', $repeat['month']); +$tmpl->assign('repeat_weekdays', $repeat['weekdays']); +$tmpl->assign('repeat_interval', $repeat['interval']); +$tmpl->assign('repeat_end', $repeat['end']); +$tmpl->assign('repeat_count', $repeat['count']); +$tmpl->assign('repeat_weekofmonth', $repeat['weekofmonth']); +$tmpl->assign('repeat_date', $repeat['date']); +$tmpl->assign('repeat_year', $repeat['year']); +$tmpl->assign('repeat_byyearday', $repeat['byyearday']); +$tmpl->assign('repeat_bymonthday', $repeat['bymonthday']); +$tmpl->assign('repeat_bymonth', $repeat['bymonth']); +$tmpl->assign('repeat_byweekno', $repeat['byweekno']); $tmpl->printpage(); + ?> diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index 6de1f8ca30..1812407dd6 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -32,14 +32,43 @@ $end->setTimezone(new DateTimeZone($timezone)); $calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser()); $category_options = OC_Calendar_App::getCategoryOptions(); $repeat_options = OC_Calendar_App::getRepeatOptions(); +$repeat_end_options = OC_Calendar_App::getEndOptions(); +$repeat_month_options = OC_Calendar_App::getMonthOptions(); +$repeat_year_options = OC_Calendar_App::getYearOptions(); +$repeat_weekly_options = OC_Calendar_App::getWeeklyOptions(); +$repeat_weekofmonth_options = OC_Calendar_App::getWeekofMonth(); +$repeat_byyearday_options = OC_Calendar_App::getByYearDayOptions(); +$repeat_bymonth_options = OC_Calendar_App::getByMonthOptions(); +$repeat_byweekno_options = OC_Calendar_App::getByWeekNoOptions(); +$repeat_bymonthday_options = OC_Calendar_App::getByMonthDayOptions(); $tmpl = new OC_Template('calendar', 'part.newevent'); $tmpl->assign('calendar_options', $calendar_options); $tmpl->assign('category_options', $category_options); +$tmpl->assign('repeat_options', $repeat_options); +$tmpl->assign('repeat_month_options', $repeat_month_options); +$tmpl->assign('repeat_weekly_options', $repeat_weekly_options); +$tmpl->assign('repeat_end_options', $repeat_end_options); +$tmpl->assign('repeat_year_options', $repeat_year_options); +$tmpl->assign('repeat_byyearday_options', $repeat_byyearday_options); +$tmpl->assign('repeat_bymonth_options', $repeat_bymonth_options); +$tmpl->assign('repeat_byweekno_options', $repeat_byweekno_options); +$tmpl->assign('repeat_bymonthday_options', $repeat_bymonthday_options); +$tmpl->assign('repeat_weekofmonth_options', $repeat_weekofmonth_options); + $tmpl->assign('startdate', $start->format('d-m-Y')); $tmpl->assign('starttime', $start->format('H:i')); $tmpl->assign('enddate', $end->format('d-m-Y')); $tmpl->assign('endtime', $end->format('H:i')); $tmpl->assign('allday', $allday); +$tmpl->assign('repeat', 'doesnotrepeat'); +$tmpl->assign('repeat_month', 'monthday'); +$tmpl->assign('repeat_weekdays', array()); +$tmpl->assign('repeat_interval', 1); +$tmpl->assign('repeat_end', 'never'); +$tmpl->assign('repeat_count', '10'); +$tmpl->assign('repeat_weekofmonth', 'auto'); +$tmpl->assign('repeat_date', ''); +$tmpl->assign('repeat_year', 'byyearday'); $tmpl->printpage(); ?> diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index c3644b5370..93dddf516f 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -25,6 +25,19 @@ Calendar={ minWidth:'auto', classes: 'category', }); + Calendar.UI.repeat('init'); + $('#end').change(function(){ + Calendar.UI.repeat('end'); + }); + $('#repeat').change(function(){ + Calendar.UI.repeat('repeat'); + }); + $('#advanced_year').change(function(){ + Calendar.UI.repeat('year'); + }); + $('#advanced_month').change(function(){ + Calendar.UI.repeat('month'); + }); $('#event').dialog({ width : 500, close : function(event, ui) { @@ -132,9 +145,16 @@ Calendar={ }); }, showadvancedoptions:function(){ - $("#advanced_options").css("display", "block"); + $("#advanced_options").slideDown('slow'); $("#advanced_options_button").css("display", "none"); }, + showadvancedoptionsforrepeating:function(){ + if($("#advanced_options_repeating").is(":hidden")){ + $('#advanced_options_repeating').slideDown('slow'); + }else{ + $('#advanced_options_repeating').slideUp('slow'); + } + }, getEventPopupText:function(event){ if (event.allDay){ var timespan = $.fullCalendar.formatDates(event.start, event.end, 'ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}', {monthNamesShort: monthNamesShort, monthNames: monthNames, dayNames: dayNames, dayNamesShort: dayNamesShort}); //t('calendar', "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}") @@ -205,6 +225,107 @@ Calendar={ event.preventDefault(); } }, + repeat:function(task){ + if(task=='init'){ + $('#byweekno').multiselect({ + header: false, + noneSelectedText: $('#advanced_byweekno').attr('title'), + selectedList: 2, + minWidth:'auto' + }); + $('#weeklyoptions').multiselect({ + header: false, + noneSelectedText: $('#weeklyoptions').attr('title'), + selectedList: 2, + minWidth:'auto' + }); + $('input[name="bydate"]').datepicker({ + dateFormat : 'dd-mm-yy' + }); + $('#byyearday').multiselect({ + header: false, + noneSelectedText: $('#byyearday').attr('title'), + selectedList: 2, + minWidth:'auto' + }); + $('#bymonth').multiselect({ + header: false, + noneSelectedText: $('#bymonth').attr('title'), + selectedList: 2, + minWidth:'auto' + }); + $('#bymonthday').multiselect({ + header: false, + noneSelectedText: $('#bymonthday').attr('title'), + selectedList: 2, + minWidth:'auto' + }); + Calendar.UI.repeat('end'); + Calendar.UI.repeat('repeat'); + Calendar.UI.repeat('month'); + Calendar.UI.repeat('year'); + } + if(task == 'end'){ + $('#byoccurrences').css('display', 'none'); + $('#bydate').css('display', 'none'); + if($('#end option:selected').val() == 'count'){ + $('#byoccurrences').css('display', 'block'); + } + if($('#end option:selected').val() == 'date'){ + $('#bydate').css('display', 'block'); + } + } + if(task == 'repeat'){ + $('#advanced_month').css('display', 'none'); + $('#advanced_weekday').css('display', 'none'); + $('#advanced_weekofmonth').css('display', 'none'); + $('#advanced_byyearday').css('display', 'none'); + $('#advanced_bymonth').css('display', 'none'); + $('#advanced_byweekno').css('display', 'none'); + $('#advanced_year').css('display', 'none'); + $('#advanced_bymonthday').css('display', 'none'); + if($('#repeat option:selected').val() == 'monthly'){ + $('#advanced_month').css('display', 'block'); + } + if($('#repeat option:selected').val() == 'weekly'){ + $('#advanced_weekday').css('display', 'block'); + } + if($('#repeat option:selected').val() == 'yearly'){ + $('#advanced_year').css('display', 'block'); + $('#advanced_byyearday').css('display', 'block'); + } + if($('#repeat option:selected').val() == 'doesnotrepeat'){ + $('#advanced_options_repeating').slideUp('slow'); + } + } + if(task == 'month'){ + $('#advanced_weekday').css('display', 'none'); + $('#advanced_weekofmonth').css('display', 'none'); + if($('#advanced_month_select option:selected').val() == 'weekday'){ + $('#advanced_weekday').css('display', 'block'); + $('#advanced_weekofmonth').css('display', 'block'); + } + } + if(task == 'year'){ + $('#advanced_weekday').css('display', 'none'); + $('#advanced_byyearday').css('display', 'none'); + $('#advanced_bymonth').css('display', 'none'); + $('#advanced_byweekno').css('display', 'none'); + $('#advanced_bymonthday').css('display', 'none'); + if($('#advanced_year option:selected').val() == 'byyearday'){ + $('#advanced_byyearday').css('display', 'block'); + } + if($('#advanced_year option:selected').val() == 'byweekno'){ + $('#advanced_byweekno').css('display', 'block'); + + } + if($('#advanced_year option:selected').val() == 'bydaymonth'){ + $('#advanced_bymonth').css('display', 'block'); + $('#advanced_bymonthday').css('display', 'block'); + $('#advanced_weekday').css('display', 'block'); + } + } + }, Calendar:{ overview:function(){ if($('#choosecalendar_dialog').dialog('isOpen') == true){ diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index b023d531aa..6e92cf67c5 100644 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -75,8 +75,43 @@ class OC_Calendar_App{ ); } - public static function getRepeatOptions() - { - OC_Calendar_Object::getRepeatOptions(self::$l10n); + public static function getRepeatOptions(){ + return OC_Calendar_Object::getRepeatOptions(self::$l10n); + } + + public static function getEndOptions(){ + return OC_Calendar_Object::getEndOptions(self::$l10n); + } + + public static function getMonthOptions(){ + return OC_Calendar_Object::getMonthOptions(self::$l10n); + } + + public static function getWeeklyOptions(){ + return OC_Calendar_Object::getWeeklyOptions(self::$l10n); + } + + public static function getYearOptions(){ + return OC_Calendar_Object::getYearOptions(self::$l10n); + } + + public static function getByYearDayOptions(){ + return OC_Calendar_Object::getByYearDayOptions(); + } + + public static function getByMonthOptions(){ + return OC_Calendar_Object::getByMonthOptions(self::$l10n); + } + + public static function getByWeekNoOptions(){ + return OC_Calendar_Object::getByWeekNoOptions(); + } + + public static function getByMonthDayOptions(){ + return OC_Calendar_Object::getByMonthDayOptions(); + } + + public static function getWeekofMonth(){ + return OC_Calendar_Object::getWeekofMonth(self::$l10n); } } diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index 58fe60611c..c5ae760d00 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -356,9 +356,98 @@ class OC_Calendar_Object{ 'weekday' => $l10n->t('Every Weekday'), 'biweekly' => $l10n->t('Bi-Weekly'), 'monthly' => $l10n->t('Monthly'), - 'yearly' => $l10n->t('Yearly'), + 'yearly' => $l10n->t('Yearly') ); } + + public static function getEndOptions($l10n) + { + return array( + 'never' => $l10n->t('never'), + 'count' => $l10n->t('by occurrences'), + 'date' => $l10n->t('by date') + ); + } + + public static function getMonthOptions($l10n) + { + return array( + 'monthday' => $l10n->t('by monthday'), + 'weekday' => $l10n->t('by weekday') + ); + } + + public static function getWeeklyOptions($l10n) + { + return array( + 'MO' => $l10n->t('Monday'), + 'TU' => $l10n->t('Tuesday'), + 'WE' => $l10n->t('Wednesday'), + 'TH' => $l10n->t('Thursday'), + 'FR' => $l10n->t('Friday'), + 'SA' => $l10n->t('Saturday'), + 'SU' => $l10n->t('Sunday') + ); + } + + public static function getWeekofMonth($l10n) + { + return array( + 'auto' => $l10n->t('events week of month'), + '1' => $l10n->t('first'), + '2' => $l10n->t('second'), + '3' => $l10n->t('third'), + '4' => $l10n->t('fourth'), + '5' => $l10n->t('fifth'), + '-1' => $l10n->t('last') + ); + } + + public static function getByYearDayOptions(){ + $return = array(); + foreach(range(1,366) as $num){ + $return[(string) $num] = (string) $num; + } + return $return; + } + + public static function getByMonthDayOptions(){ + $return = array(); + foreach(range(1,31) as $num){ + $return[(string) $num] = (string) $num; + } + return $return; + } + + public static function getByMonthOptions($l10n){ + return array( + '1' => $l10n->t('January'), + '2' => $l10n->t('February'), + '3' => $l10n->t('March'), + '4' => $l10n->t('April'), + '5' => $l10n->t('May'), + '6' => $l10n->t('June'), + '7' => $l10n->t('July'), + '8' => $l10n->t('August'), + '9' => $l10n->t('September'), + '10' => $l10n->t('October'), + '11' => $l10n->t('November'), + '12' => $l10n->t('December') + ); + } + + public static function getYearOptions($l10n){ + return array( + 'byyearday' => $l10n->t('by yearday(s)'), + 'byweekno' => $l10n->t('by weeknumber(s)'), + 'bydaymonth' => $l10n->t('by day and month') + ); + } + + public static function getByWeekNoOptions(){ + return range(1, 52); + } + public static function validateRequest($request) { $errnum = 0; @@ -397,7 +486,91 @@ class OC_Calendar_Object{ $errarr['to'] = 'true'; $errnum++; } - ; + if($request['repeat'] != 'doesnotrepeat'){ + if(is_nan($request['interval']) && $request['interval'] != ''){ + $errarr['interval'] = 'true'; + $ernum++; + } + if(array_key_exists('repeat', $request) && !array_key_exists($request['repeat'], self::getRepeatOptions(OC_Calendar_App::$l10n))){ + $errarr['repeat'] = 'true'; + $ernum++; + } + if(array_key_exists('advanced_month_select', $request) && !array_key_exists($request['advanced_month_select'], self::getMonthOptions(OC_Calendar_App::$l10n))){ + $errarr['advanced_month_select'] = 'true'; + $errnum++; + } + if(array_key_exists('advanced_year_select', $request) && !array_key_exists($request['advanced_year_select'], self::getYearOptions(OC_Calendar_App::$l10n))){ + $errarr['advanced_year_select'] = 'true'; + $errnum++; + } + if(array_key_exists('weekofmonthoptions', $request) && !array_key_exists($request['weekofmonthoptions'], self::getWeekofMonth(OC_Calendar_App::$l10n))){ + $errarr['weekofmonthoptions'] = 'true'; + $errnum++; + } + if($request['end'] != 'never'){ + if(!array_key_exists($request['end'], self::getEndOptions(OC_Calendar_App::$l10n))){ + $errarr['end'] = 'true'; + $errnum++; + } + if($request['end'] == 'count' && is_nan($request['byoccurrences'])){ + $errarr['byoccurrences'] = 'true'; + $errnum++; + } + if($request['end'] == 'date'){ + list($bydate_day, $bydate_month, $bydate_year) = explode('-', $request['bydate']); + if(!checkdate($bydate_month, $bydate_day, $bydate_year)){ + $errarr['bydate'] = 'true'; + $errnum++; + } + } + } + if(array_key_exists('weeklyoptions', $request)){ + foreach($request['weeklyoptions'] as $option){ + if(!in_array($option, self::getWeeklyOptions(OC_Calendar_App::$l10n))){ + $errarr['weeklyoptions'] = 'true'; + $errnum++; + } + } + } + if(array_key_exists('byyearday', $request)){ + foreach($request['byyearday'] as $option){ + if(!array_key_exists($option, self::getByYearDayOptions())){ + $errarr['byyearday'] = 'true'; + $errnum++; + } + } + } + if(array_key_exists('weekofmonthoptions', $request)){ + if(is_nan((double)$request['weekofmonthoptions'])){ + $errarr['weekofmonthoptions'] = 'true'; + $errnum++; + } + } + if(array_key_exists('bymonth', $request)){ + foreach($request['bymonth'] as $option){ + if(!in_array($option, self::getByMonthOptions(OC_Calendar_App::$l10n))){ + $errarr['bymonth'] = 'true'; + $errnum++; + } + } + } + if(array_key_exists('byweekno', $request)){ + foreach($request['byweekno'] as $option){ + if(!array_key_exists($option, self::getByWeekNoOptions())){ + $errarr['byweekno'] = 'true'; + $errnum++; + } + } + } + if(array_key_exists('bymonthday', $request)){ + foreach($request['bymonthday'] as $option){ + if(!array_key_exists($option, self::getByMonthDayOptions())){ + $errarr['bymonthday'] = 'true'; + $errnum++; + } + } + } + } if(!$allday && self::checkTime(urldecode($request['totime']))) { $errarr['totime'] = 'true'; $errnum++; @@ -468,27 +641,146 @@ class OC_Calendar_Object{ $fromtime = $request['fromtime']; $totime = $request['totime']; } - $description = $request["description"]; - //$repeat = $request["repeat"]; - /*switch($request["repeatfreq"]){ - case "DAILY": - $repeatfreq = "DAILY"; - case "WEEKLY": - $repeatfreq = "WEEKLY"; - case "WEEKDAY": - $repeatfreq = "DAILY;BYDAY=MO,TU,WE,TH,FR"; //load weeksdayss from userconfig when weekdays are choosable - case "": - $repeatfreq = ""; - case "": - $repeatfreq = ""; - case "": - $repeatfreq = ""; - default: - $repeat = "false"; - }*/ - $repeat = "false"; - $vevent = $vcalendar->VEVENT; + $description = $request["description"]; + $repeat = $request["repeat"]; + if($repeat != 'doesnotrepeat'){ + $rrule = ''; + $interval = $request['interval']; + $end = $request['end']; + $byoccurrences = $request['byoccurrences']; + switch($repeat){ + case 'daily': + $rrule .= 'FREQ=DAILY'; + break; + case 'weekly': + $rrule .= 'FREQ=WEEKLY'; + if(array_key_exists('weeklyoptions', $request)){ + $byday = ''; + $daystrings = array_flip(self::getWeeklyOptions(OC_Calendar_App::$l10n)); + foreach($request['weeklyoptions'] as $days){ + if($byday == ''){ + $byday .= $daystrings[$days]; + }else{ + $byday .= ',' .$daystrings[$days]; + } + } + $rrule .= ';BYDAY=' . $byday; + } + break; + case 'weekday': + $rrule .= 'FREQ=DAILY'; + $rrule .= ';BYDAY=MO,TU,WE,TH,FR'; + break; + case 'biweekly': + $rrule .= 'FREQ=WEEKLY'; + $interval = $interval * 2; + break; + case 'monthly': + $rrule .= 'FREQ=MONTHLY'; + if($request['advanced_month_select'] == 'monthday'){ + break; + }elseif($request['advanced_month_select'] == 'weekday'){ + if($request['weekofmonthoptions'] == 'auto'){ + $weekofmonth = floor($request['weekofmonthoptions']/7); + }else{ + $weekofmonth = $request['weekofmonthoptions']; + } + $days = array_flip(self::getWeeklyOptions(OC_Calendar_App::$l10n)); + $byday = ''; + foreach($request['weeklyoptions'] as $day){ + if($byday == ''){ + $byday .= $weekofmonth . $days[$day]; + }else{ + $byday .= ',' . $weekofmonth . $days[$day]; + } + } + $rrule .= ';BYDAY=' . $byday; + } + break; + case 'yearly': + $rrule .= 'FREQ=YEARLY'; + if($request['advanced_year_select'] == 'byyearday'){ + $byyearday = ''; + foreach($request['byyearday'] as $yearday){ + if($byyearday == ''){ + $byyearday = $yearday; + }else{ + $byyearday .= ',' . $yearday; + } + } + $rrule .= ';BYYEARDAY=' . $byyearday; + }elseif($request['advanced_year_select'] == 'byweekno'){ + list($_day, $_month, $_year) = explode('-', $from); + $rrule .= ';BYDAY=' . strtoupper(substr(date('l', mktime(0,0,0, $_month, $_day, $_year)), 0, 2)); + $byweekno = ''; + foreach($request['byweekno'] as $weekno){ + if($byweekno == ''){ + $byweekno = $weekno; + }else{ + $byweekno .= ',' . $weekno; + } + } + $rrule .= ';BYWEEKNO=' . $byweekno; + }elseif($request['advanced_year_select'] == 'bydaymonth'){ + if(array_key_exists('weeklyoptions', $request)){ + $days = array_flip(self::getWeeklyOptions(OC_Calendar_App::$l10n)); + $byday = ''; + foreach($request['weeklyoptions'] as $day){ + if($byday == ''){ + $byday .= $days[$day]; + }else{ + $byday .= ',' . $days[$day]; + } + } + $rrule .= ';BYDAY=' . $byday; + } + if(array_key_exists('bymonth', $request)){ + $monthes = array_flip(self::getByMonthOptions(OC_Calendar_App::$l10n)); + $bymonth = ''; + foreach($request['bymonth'] as $month){ + if($bymonth == ''){ + $bymonth .= $monthes[$month]; + }else{ + $bymonth .= ',' . $monthes[$month]; + } + } + $rrule .= ';BYMONTH=' . $bymonth; + + } + if(array_key_exists('bymonthday', $request)){ + $bymonthday = ''; + foreach($request['bymonthday'] as $monthday){ + if($bymonthday == ''){ + $bymonthday .= $monthday; + }else{ + $bymonthday .= ',' . $monthday; + } + } + $rrule .= ';BYMONTHDAY=' . $bymonthday; + + } + } + break; + default: + break; + } + if($interval != ''){ + $rrule .= ';INTERVAL=' . $interval; + } + if($end == 'count'){ + $rrule .= ';COUNT=' . $byoccurrences; + } + if($end == 'date'){ + list($bydate_day, $bydate_month, $bydate_year) = explode('-', $request['bydate']); + $rrule .= ';UNTIL=' . $bydate_year . $bydate_month . $bydate_day; + } + $vevent->setString('RRULE', $rrule); + $repeat = "true"; + }else{ + $repeat = "false"; + } + $vevent->setDateTime('LAST-MODIFIED', 'now', Sabre_VObject_Element_DateTime::UTC); $vevent->setDateTime('DTSTAMP', 'now', Sabre_VObject_Element_DateTime::UTC); @@ -521,4 +813,4 @@ class OC_Calendar_Object{ return $vcalendar; } -} +} \ No newline at end of file diff --git a/apps/calendar/templates/part.eventform.php b/apps/calendar/templates/part.eventform.php index dfa5fb8c78..1f2073f4bc 100644 --- a/apps/calendar/templates/part.eventform.php +++ b/apps/calendar/templates/part.eventform.php @@ -2,92 +2,221 @@ t("Title");?>: - " value="" maxlength="100" name="title"/> + " value="" maxlength="100" name="title"/> - +
+ + + +
t("Category");?>: -    t("Calendar");?>: -

- +
+ id="allday_checkbox" name="allday"> + + - + +    + + + +    + +
- id="allday_checkbox" name="allday"> -
t("From");?>: - -    - -
t("To");?>: - -    - -
" onclick="Calendar.UI.showadvancedoptions();" id="advanced_options_button"> From ffa835c56f4575b3e6e40a1d2247f7b374fdc892 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 26 Dec 2011 19:59:15 +0100 Subject: [PATCH 012/106] fix the default setting for yearly repeating events --- apps/calendar/ajax/neweventform.php | 2 +- apps/calendar/js/calendar.js | 10 ++++------ apps/calendar/lib/object.php | 14 ++++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index 1812407dd6..88468dd3db 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -69,6 +69,6 @@ $tmpl->assign('repeat_end', 'never'); $tmpl->assign('repeat_count', '10'); $tmpl->assign('repeat_weekofmonth', 'auto'); $tmpl->assign('repeat_date', ''); -$tmpl->assign('repeat_year', 'byyearday'); +$tmpl->assign('repeat_year', 'bydate'); $tmpl->printpage(); ?> diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index 93dddf516f..892dbd79e4 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -292,7 +292,6 @@ Calendar={ } if($('#repeat option:selected').val() == 'yearly'){ $('#advanced_year').css('display', 'block'); - $('#advanced_byyearday').css('display', 'block'); } if($('#repeat option:selected').val() == 'doesnotrepeat'){ $('#advanced_options_repeating').slideUp('slow'); @@ -312,14 +311,13 @@ Calendar={ $('#advanced_bymonth').css('display', 'none'); $('#advanced_byweekno').css('display', 'none'); $('#advanced_bymonthday').css('display', 'none'); - if($('#advanced_year option:selected').val() == 'byyearday'){ - $('#advanced_byyearday').css('display', 'block'); + if($('#advanced_year_select option:selected').val() == 'byyearday'){ + //$('#advanced_byyearday').css('display', 'block'); } - if($('#advanced_year option:selected').val() == 'byweekno'){ + if($('#advanced_year_select option:selected').val() == 'byweekno'){ $('#advanced_byweekno').css('display', 'block'); - } - if($('#advanced_year option:selected').val() == 'bydaymonth'){ + if($('#advanced_year_select option:selected').val() == 'bydaymonth'){ $('#advanced_bymonth').css('display', 'block'); $('#advanced_bymonthday').css('display', 'block'); $('#advanced_weekday').css('display', 'block'); diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index c5ae760d00..b53feb0bf0 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -438,6 +438,7 @@ class OC_Calendar_Object{ public static function getYearOptions($l10n){ return array( + 'bydate' => $l10n->t('by events date'), 'byyearday' => $l10n->t('by yearday(s)'), 'byweekno' => $l10n->t('by weeknumber(s)'), 'bydaymonth' => $l10n->t('by day and month') @@ -700,12 +701,13 @@ class OC_Calendar_Object{ break; case 'yearly': $rrule .= 'FREQ=YEARLY'; - if($request['advanced_year_select'] == 'byyearday'){ - $byyearday = ''; - foreach($request['byyearday'] as $yearday){ - if($byyearday == ''){ - $byyearday = $yearday; - }else{ + if($request['advanced_year_select'] == 'bydate'){ + + }elseif($request['advanced_year_select'] == 'byyearday'){ + list($_day, $_month, $_year) = explode('-', $from); + $byyearday = date('z', mktime(0,0,0, $_month, $_day, $_year)) + 1; + if(array_key_exists('byyearday', $request)){ + foreach($request['byyearday'] as $yearday){ $byyearday .= ',' . $yearday; } } From 4793d25c577dcad3516853d05d62cf264fc54448 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 30 Dec 2011 21:07:16 +0100 Subject: [PATCH 013/106] Added license and waiver of conditions for jquery.inview. CSS fix on contact list. Query contacts from multiple address books. --- apps/contacts/ajax/addcard.php | 1 + apps/contacts/ajax/contacts.php | 9 +++--- apps/contacts/css/styles.css | 1 + apps/contacts/index.php | 9 ++++-- apps/contacts/js/LICENSE.jquery.inview | 41 ++++++++++++++++++++++++++ apps/contacts/js/jquery.inview.txt | 15 ++++++++++ apps/contacts/lib/addressbook.php | 25 ++++++++++++++-- apps/contacts/lib/vcard.php | 19 ++++++++++-- 8 files changed, 110 insertions(+), 10 deletions(-) create mode 100644 apps/contacts/js/LICENSE.jquery.inview create mode 100644 apps/contacts/js/jquery.inview.txt diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index 9d782246a0..54c455e515 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -61,5 +61,6 @@ foreach( $add as $propname){ $vcard->addProperty($propname, $value, $prop_parameters); } $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); +OC_Log::write('contacts','ajax/addcard.php - adding id: '.$id,OC_Log::DEBUG); OC_Contacts_App::renderDetails($id, $vcard); diff --git a/apps/contacts/ajax/contacts.php b/apps/contacts/ajax/contacts.php index b34cf41424..54ad3e4c10 100644 --- a/apps/contacts/ajax/contacts.php +++ b/apps/contacts/ajax/contacts.php @@ -6,14 +6,14 @@ * See the COPYING-README file. */ -function contacts_namesort($a,$b){ - return strcasecmp($a['fullname'],$b['fullname']); -} - require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('contacts'); +$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser()); +$contacts = OC_Contacts_VCard::all($ids); +//OC_Log::write('contacts','contacts.php: '.count($contacts).' contacts.',OC_Log::DEBUG); +/* $addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser()); $contacts = array(); foreach( $addressbooks as $addressbook ){ @@ -26,6 +26,7 @@ foreach( $addressbooks as $addressbook ){ } } usort($contacts,'contacts_namesort'); +*/ $tmpl = new OC_TEMPLATE("contacts", "part.contacts"); $tmpl->assign('contacts', $contacts); $page = $tmpl->fetchPage(); diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index b6709c5a79..53b469e6ee 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -1,3 +1,4 @@ +#contacts { padding-left:5px; padding-top: 5px; background: #fff; } #contacts li { padding-left:25px;background:url('../img/person.svg') no-repeat; } #chooseaddressbook {margin-right: 170px; float: right;} #contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;} diff --git a/apps/contacts/index.php b/apps/contacts/index.php index a6af54c878..5ab6f293ab 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -32,6 +32,9 @@ OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); // Get active address books. This creates a default one if none exists. +$ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser()); +$contacts = OC_Contacts_VCard::all($ids); + $addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser()); // Load the files we need @@ -39,7 +42,7 @@ OC_App::setActiveNavigationEntry( 'contacts_index' ); // Load a specific user? $id = isset( $_GET['id'] ) ? $_GET['id'] : null; - +/* // sort addressbooks (use contactsort) usort($addressbooks,'contacts_namesort'); @@ -55,8 +58,10 @@ foreach( $addressbooks as $addressbook ){ } usort($contacts,'contacts_namesort'); - +*/ $details = array(); + +// FIXME: This cannot work..? if( !is_null($id)/* || count($contacts)*/){ if(is_null($id)) $id = $contacts[0]['id']; $vcard = OC_Contacts_App::getContactVCard($id); diff --git a/apps/contacts/js/LICENSE.jquery.inview b/apps/contacts/js/LICENSE.jquery.inview new file mode 100644 index 0000000000..1ed340edbe --- /dev/null +++ b/apps/contacts/js/LICENSE.jquery.inview @@ -0,0 +1,41 @@ +Attribution-Non-Commercial-Share Alike 2.0 UK: England & Wales + +http://creativecommons.org/licenses/by-nc-sa/2.0/uk/ + +You are free: + + * to copy, distribute, display, and perform the work + * to make derivative works + + +Under the following conditions: + + * Attribution — You must give the original author credit. + Attribute this work: + Information + What does "Attribute this work" mean? + The page you came from contained embedded licensing metadata, + including how the creator wishes to be attributed for re-use. + You can use the HTML here to cite the work. Doing so will + also include metadata on your page so that others can find the + original work as well. + + * Non-Commercial — You may not use this work for commercial + purposes. + * Share Alike — If you alter, transform, or build upon this + work, you may distribute the resulting work only under a + licence identical to this one. + +With the understanding that: + + * Waiver — Any of the above conditions can be waived if you get + permission from the copyright holder. + * Other Rights — In no way are any of the following rights + affected by the license: + o Your fair dealing or fair use rights; + o The author's moral rights; + o Rights other persons may have either in the work itself + or in how the work is used, such as publicity or privacy rights. + * Notice — For any reuse or distribution, you must make clear to + others the licence terms of this work. + diff --git a/apps/contacts/js/jquery.inview.txt b/apps/contacts/js/jquery.inview.txt new file mode 100644 index 0000000000..c53dbd1d97 --- /dev/null +++ b/apps/contacts/js/jquery.inview.txt @@ -0,0 +1,15 @@ +jQuery.inview is licensed Attribution-Non-Commercial-Share Alike 2.0 but the +conditions has been waived by the author in the following tweet: + +https://twitter.com/#!/ChristopherBlum/status/148382899887013888 + +Saying: + +Thomas Tanghus @tanghus 18 Dec. 2011 + +@ChristopherBlum Hi. Is it OK if I use https://github.com/protonet/jquery.inview in ownCloud? Preferably under an AGPL license ;-) owncloud.org + + +Christopher Blum Christopher Blum @ChristopherBlum 18 Dec. 2011 + +@tanghus Feel free to! :) diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index 6f2f34225d..b3c981a541 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -140,6 +140,25 @@ class OC_Contacts_Addressbook{ return true; } + public static function cleanArray($array, $remove_null_number = true){ + $new_array = array(); + + $null_exceptions = array(); + + foreach ($array as $key => $value){ + $value = trim($value); + + if($remove_null_number){ + $null_exceptions[] = '0'; + } + + if(!in_array($value, $null_exceptions) && $value != "") { + $new_array[] = $value; + } + } + return $new_array; + } + /** * @brief Get active addressbooks for a user. * @param integer $uid User id. If null current user will be used. @@ -170,7 +189,8 @@ class OC_Contacts_Addressbook{ public static function active($uid){ $active = self::activeIds($uid); $addressbooks = array(); - /** FIXME: Is there a way to prepare a statement 'WHERE id IN ([range])'? + /* FIXME: Is there a way to prepare a statement 'WHERE id IN ([range])'? + * See OC_Contacts_VCard:all. */ foreach( $active as $aid ){ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id = ? ORDER BY displayname' ); @@ -208,6 +228,7 @@ class OC_Contacts_Addressbook{ unset($openaddressbooks[array_search($id, $openaddressbooks)]); } } + $openaddressbooks = self::cleanArray($openaddressbooks, false); sort($openaddressbooks, SORT_NUMERIC); // FIXME: I alway end up with a ';' prepending when imploding the array..? OC_Preferences::setValue(OC_User::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks)); @@ -221,7 +242,7 @@ class OC_Contacts_Addressbook{ * @return boolean */ public static function isActive($id){ - OC_Log::write('contacts','OC_Contacts_Addressbook::isActive('.$id.'):'.in_array($id, self::activeIds()), OC_Log::DEBUG); + //OC_Log::write('contacts','OC_Contacts_Addressbook::isActive('.$id.'):'.in_array($id, self::activeIds()), OC_Log::DEBUG); return in_array($id, self::activeIds()); } diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 7285761fd5..81519b3d05 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -47,9 +47,24 @@ class OC_Contacts_VCard{ * ['carddata'] */ public static function all($id){ - $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' ); - $result = $stmt->execute(array($id)); + //$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' ); + //$result = $stmt->execute(array($id)); + if(is_array($id)) { + $id_sql = join(',', array_fill(0, count($id), '?')); + $prep = 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid IN ('.$id_sql.') ORDER BY fullname'; + try { + $stmt = OC_DB::prepare( $prep ); + $result = $stmt->execute($id); + } catch(Exception $e) { + OC_Log::write('contacts','OC_Contacts_VCard:all:, exception: '.$e->getMessage(),OC_Log::DEBUG); + OC_Log::write('contacts','OC_Contacts_VCard:all, ids: '.join(',', $id),OC_Log::DEBUG); + OC_Log::write('contacts','SQL:'.$prep,OC_Log::DEBUG); + } + } else { + $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' ); + $result = $stmt->execute(array($id)); + } $cards = array(); while( $row = $result->fetchRow()){ $cards[] = $row; From 97471b5c2a079be34aeff099019f219135b9cb2c Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Fri, 30 Dec 2011 23:39:31 +0100 Subject: [PATCH 014/106] Thumbnails was overwriting default style so hover and active didn't work. Moved them to the 'a' element instead. --- apps/contacts/css/styles.css | 4 ++-- apps/contacts/js/interface.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/contacts/css/styles.css b/apps/contacts/css/styles.css index 53b469e6ee..c890be8582 100644 --- a/apps/contacts/css/styles.css +++ b/apps/contacts/css/styles.css @@ -1,5 +1,5 @@ -#contacts { padding-left:5px; padding-top: 5px; background: #fff; } -#contacts li { padding-left:25px;background:url('../img/person.svg') no-repeat; } +#contacts { padding-left:2px; padding-top: 5px; background: #fff; } +#leftcontent a { height: 23px; display: block; margin: 0 0 0 0; padding: 0 0 0 25px; } #chooseaddressbook {margin-right: 170px; float: right;} #contacts_details_name { font-weight:bold;font-size:1.1em;margin-left:25%;} #contacts_details_photo { margin:.5em 0em .5em 25%; } diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 3190efae3c..35639ef6cc 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -113,9 +113,9 @@ Contacts={ lazyupdate:function(){ //alert('lazyupdate'); $('#contacts li').live('inview', function(){ - if (!$(this).attr('style')) { + if (!$(this).find('a').attr('style')) { //alert($(this).data('id') + ' has background: ' + $(this).attr('style')); - $(this).css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); + $(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); }/* else { alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url')); }*/ @@ -301,9 +301,9 @@ $(document).ready(function(){ // bottom part of element is visible } else { // whole part of element is visible - if (!$(this).attr('style')) { + if (!$(this).find('a').attr('style')) { //alert($(this).data('id') + ' has background: ' + $(this).attr('style')); - $(this).css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); + $(this).find('a').css('background','url(thumbnail.php?id='+$(this).data('id')+') no-repeat'); }/* else { alert($(this).data('id') + ' has style ' + $(this).attr('style').match('url')); }*/ From 39e67707d778c4d8782b66787317e8d9c28954ac Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Fri, 30 Dec 2011 22:47:39 +0000 Subject: [PATCH 015/106] Updated jquery ui js and css. Improved color scheme. --- core/css/jquery-ui-1.8.16.custom.css | 362 ++++++++++++ core/js/jquery-ui-1.8.16.custom.min.js | 761 +++++++++++++++++++++++++ lib/base.php | 4 +- 3 files changed, 1125 insertions(+), 2 deletions(-) create mode 100755 core/css/jquery-ui-1.8.16.custom.css create mode 100755 core/js/jquery-ui-1.8.16.custom.min.js diff --git a/core/css/jquery-ui-1.8.16.custom.css b/core/css/jquery-ui-1.8.16.custom.css new file mode 100755 index 0000000000..add1c6af08 --- /dev/null +++ b/core/css/jquery-ui-1.8.16.custom.css @@ -0,0 +1,362 @@ +/* + * jQuery UI CSS Framework 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault="Lucida%20Grande",%20Arial,%20Verdana,%20sans-serif&fwDefault=bold&fsDefault=1em&cornerRadius=4px&bgColorHeader=1d2d44&bgTextureHeader=01_flat.png&bgImgOpacityHeader=35&borderColorHeader=1d2d44&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f8f8f8&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=ddd&fcDefault=555&iconColorDefault=1d2d44&bgColorHover=ffffff&bgTextureHover=01_flat.png&bgImgOpacityHover=100&borderColorHover=ddd&fcHover=333&iconColorHover=1d2d44&bgColorActive=f8f8f8&bgTextureActive=02_glass.png&bgImgOpacityActive=100&borderColorActive=1d2d44&fcActive=1d2d44&iconColorActive=1d2d44&bgColorHighlight=f8f8f8&bgTextureHighlight=04_highlight_hard.png&bgImgOpacityHighlight=100&borderColorHighlight=ddd&fcHighlight=555&iconColorHighlight=ffffff&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: \\\"Lucida Grande\\\", Arial, Verdana, sans-serif; font-size: 1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: \\\"Lucida Grande\\\", Arial, Verdana, sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee; color: #333333; } +.ui-widget-content a { color: #333333; } +.ui-widget-header { border: 1px solid #1d2d44; background: #1d2d44; color: #ffffff; font-weight: bold; } +.ui-widget-header a { color: #ffffff; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #ddd; background: #f8f8f8; font-weight: bold; color: #555; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #ddd; background: #ffffff; font-weight: bold; color: #333; } +.ui-state-hover a, .ui-state-hover a:hover { color: #333; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #1d2d44; background: #f8f8f8; font-weight: bold; color: #1d2d44; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #1d2d44; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + +/* states and images */ +.ui-icon { width: 16px; height: 16px; } +.ui-icon-closethick { background-image: url(../img/actions/delete.png); } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #666666; opacity: .50;filter:Alpha(Opacity=50); } +.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* + * jQuery UI Resizable 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Autocomplete 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.16 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} +/* + * jQuery UI Button 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .4em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Dialog 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; background-color: #EEE;} +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Slider 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI Datepicker 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* + * jQuery UI Progressbar 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } \ No newline at end of file diff --git a/core/js/jquery-ui-1.8.16.custom.min.js b/core/js/jquery-ui-1.8.16.custom.min.js new file mode 100755 index 0000000000..eefefa8579 --- /dev/null +++ b/core/js/jquery-ui-1.8.16.custom.min.js @@ -0,0 +1,761 @@ +/*! + * jQuery UI 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI + */ +(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.16", +keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({propAttr:c.fn.prop||c.fn.attr,_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d= +this;setTimeout(function(){c(d).focus();b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this, +"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart": +"mousedown")+".ui-disableSelection",function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight, +outerWidth:c.fn.outerWidth,outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a, +"tabindex"),d=isNaN(b);return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&& +a.element[0].parentNode)for(var e=0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted= +false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); +;/* + * jQuery UI Position 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Position + */ +(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, +left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= +k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= +m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= +d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= +a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), +g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); +;/* + * jQuery UI Draggable 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Draggables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== +"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= +this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;if(b.iframeFix)d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('
').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options; +this.helper=this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}); +this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true}, +_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b= +false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration, +10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle|| +!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&& +a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent= +this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"), +10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"), +10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top, +(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!= +"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"), +10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+ +this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&& +!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.leftg[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.topg[3])?h:!(h-this.offset.click.topg[2])?e:!(e-this.offset.click.left=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= +i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f
').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), +top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= +this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", +nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d
');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== +String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); +this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy(); +var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a= +false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"}); +this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff= +{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis]; +if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false}, +_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f, +{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight: +Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(cb.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left= +null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+ +a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+ +c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]); +b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.16"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(), +10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top- +f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType? +e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a= +e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing, +step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= +e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset; +var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left: +a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top- +d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition, +f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, +display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b= +e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height= +d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); +;/* + * jQuery UI Selectable 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectables + * + * Depends: + * jquery.ui.core.js + * jquery.ui.mouse.js + * jquery.ui.widget.js + */ +(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), +selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, +c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", +c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= +this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); +this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== +"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&& +!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top, +left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; +this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= +document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); +return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], +e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); +c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"): +this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null, +dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, +toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); +if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), +this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= +this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= +d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| +0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", +a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- +f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- +this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, +this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", +a,this._uiHash());for(e=0;e").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&& +a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"); +d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&& +b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source= +this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, +"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); +(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", +-1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id"); +this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b, +this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| +this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| +this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("");e.secondary&&a.append("");if(!this.options.text){d.push(f?"ui-button-icons-only": +"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")=== +"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"); +b.Widget.prototype.destroy.call(this)}})})(jQuery); +;/* + * jQuery UI Dialog 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * jquery.ui.button.js + * jquery.ui.draggable.js + * jquery.ui.mouse.js + * jquery.ui.position.js + * jquery.ui.resizable.js + */ +(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, +position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ +b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&!i.isDefaultPrevented()&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), +h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id", +e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); +a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!== +b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.scrollTop(),scrollLeft:d.element.scrollLeft()};c.ui.dialog.maxZ+=1; +d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target=== +f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a, +function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", +handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition, +originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize", +f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "): +[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f); +if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"): +e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a= +this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height- +b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.16",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "), +create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(),height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&& +c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight);b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(b.range==="min"||b.range==="max"?" ui-slider-range-"+b.range:""))}for(var j=c.length;j"); +this.handles=c.add(d(e.join("")).appendTo(a.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){b.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(b.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle", +g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!a.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!a._keySliding){a._keySliding=true;d(this).addClass("ui-state-active");i=a._start(g,l);if(i===false)return}break}m=a.options.step;i=a.options.values&&a.options.values.length? +(h=a.values(l)):(h=a.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=a._valueMin();break;case d.ui.keyCode.END:h=a._valueMax();break;case d.ui.keyCode.PAGE_UP:h=a._trimAlignValue(i+(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=a._trimAlignValue(i-(a._valueMax()-a._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===a._valueMax())return;h=a._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===a._valueMin())return;h=a._trimAlignValue(i- +m);break}a._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(a._keySliding){a._keySliding=false;a._stop(g,k);a._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy(); +return this},_mouseCapture:function(a){var b=this.options,c,f,e,j,g;if(b.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:a.pageX,y:a.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(b.range===true&&this.values(1)===b.min){g+=1;e=d(this.handles[g])}if(this._start(a,g)===false)return false; +this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();b=e.offset();this._clickOffset=!d(a.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:a.pageX-b.left-e.width()/2,top:a.pageY-b.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(a,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(a){var b= +this._normValueFromMouse({x:a.pageX,y:a.pageY});this._slide(a,this._handleIndex,b);return false},_mouseStop:function(a){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(a,this._handleIndex);this._change(a,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(a){var b;if(this.orientation==="horizontal"){b= +this.elementSize.width;a=a.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{b=this.elementSize.height;a=a.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}b=a/b;if(b>1)b=1;if(b<0)b=0;if(this.orientation==="vertical")b=1-b;a=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+b*a)},_start:function(a,b){var c={handle:this.handles[b],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(b); +c.values=this.values()}return this._trigger("start",a,c)},_slide:function(a,b,c){var f;if(this.options.values&&this.options.values.length){f=this.values(b?0:1);if(this.options.values.length===2&&this.options.range===true&&(b===0&&c>f||b===1&&c1){this.options.values[a]=this._trimAlignValue(b);this._refreshValue();this._change(null,a)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e=this._valueMax())return this._valueMax();var b=this.options.step>0?this.options.step:1,c=(a-this._valueMin())%b;a=a-c;if(Math.abs(c)*2>=b)a+=c>0?b:-b;return parseFloat(a.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max},_refreshValue:function(){var a= +this.options.range,b=this.options,c=this,f=!this._animateOff?b.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,b.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({width:e- +g+"%"},{queue:false,duration:b.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},b.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:b.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,b.animate);if(a==="min"&&this.orientation==="horizontal")this.range.stop(1,1)[f?"animate":"css"]({width:e+"%"}, +b.animate);if(a==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:b.animate});if(a==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},b.animate);if(a==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:b.animate})}}});d.extend(d.ui.slider,{version:"1.8.16"})})(jQuery); +;/* + * jQuery UI Tabs 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
  • #{label}
  • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& +e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= +d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| +(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); +this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= +this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); +if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); +this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ +g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", +function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; +this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= +-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; +d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= +d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, +e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); +j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); +if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, +this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, +load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, +"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, +url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.16"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k'))}function N(a){return a.bind("mouseout", +function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"); +b.addClass("ui-state-hover");b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.16"}});var B=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv}, +setDefaults:function(a){H(this._defaults,a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g, +"\\\\$1"),input:a,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('
    '))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker", +function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b);b.settings.disabled&&this._disableDatepicker(a)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c== +"focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c=this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f==""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker(): +d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a,"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a, +b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker",function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.settings.disabled&&this._disableDatepicker(a);b.dpDiv.css("display","block")}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+= +1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput);a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/ +2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b= +d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e= +a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a, +"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f== +a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a);d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input", +a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c=d.datepicker._get(b,"beforeShow");c=c?c.apply(a,[a,b]):{};if(c!==false){H(b.settings,c);b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value= +"";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c={left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b); +c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover");if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing= +true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv);J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()}); +a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&& +!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]||c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(), +h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b= +this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b=this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b); +this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")}, +_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&&d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"): +0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth=b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e["selected"+(c=="M"? +"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a); +this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a);a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField"); +if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a));d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"? +b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()%100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=A+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd", +COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames: +null)||this._defaults.monthNames;var i=function(o){(o=k+1 +12?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay=a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&& +a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(),b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay? +new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n=this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a)); +n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m, +g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+s+"":f?"":''+s+"";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&& +a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
    '+(c?h:"")+(this._isInRange(a,s)?'":"")+(c?"":h)+"
    ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),A=this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right":"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='
    '+(/all|left/.test(t)&& +x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,A,v)+'
    ';var z=j?'":"";for(t=0;t<7;t++){var r=(t+h)%7;z+="=5?' class="ui-datepicker-week-end"':"")+'>'+q[r]+""}y+=z+"";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay, +z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q";var R=!j?"":'";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&ro;R+='";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+""}g++;if(g>11){g=0;m++}y+="
    '+this._get(a,"weekHeader")+"
    '+this._get(a,"calculateWeek")(r)+""+(F&&!D?" ":L?''+ +r.getDate()+"":''+r.getDate()+"")+"
    "+(l?""+(i[0]>0&&G==i[1]-1?'
    ':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'': +"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"),l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
    ',o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&&l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b, +e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()):g;for(a.yearshtml+='";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
    ";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c=="Y"?b:0),f=a.drawMonth+ +(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear");if(b)b.apply(a.input? +a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a);c=this._daylightSavingAdjust(new Date(c, +e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a,"dayNamesShort"),dayNames:this._get(a, +"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker=function(a){if(!this.length)return this; +if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));return this.each(function(){typeof a== +"string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.16";window["DP_jQuery_"+B]=d})(jQuery); +;/* + * jQuery UI Progressbar 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
    ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); +this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* +this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.16"})})(jQuery); +;/* + * jQuery UI Effects 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/ + */ +jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], +16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, +a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= +a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", +"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, +0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, +211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, +d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; +f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, +[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.16",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}), +d=document.activeElement;c.wrap(b);if(c[0]===d||f.contains(c[0],d))f(d).focus();b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(e,g){a[g]=c.css(g);if(isNaN(parseInt(a[g],10)))a[g]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){var a,b=document.activeElement; +if(c.parent().is(".ui-effects-wrapper")){a=c.parent().replaceWith(c);if(c[0]===b||f.contains(c[0],b))f(b).focus();return a}return c},setTransition:function(c,a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)}); +return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this, +arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/ +2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b, +d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c, +a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/=e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b, +d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ +e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); +;/* + * jQuery UI Effects Fade 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fade + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Fold 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Fold + * + * Depends: + * jquery.effects.core.js + */ +(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], +10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); +;/* + * jQuery UI Effects Highlight 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Highlight + * + * Depends: + * jquery.effects.core.js + */ +(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& +this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); +;/* + * jQuery UI Effects Pulsate 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Effects/Pulsate + * + * Depends: + * jquery.effects.core.js + */ +(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); +b.dequeue()})})}})(jQuery); +; \ No newline at end of file diff --git a/lib/base.php b/lib/base.php index 700236c96c..943ab5f24d 100644 --- a/lib/base.php +++ b/lib/base.php @@ -132,7 +132,7 @@ class OC{ // Add the stuff we need always OC_Util::addScript( "jquery-1.6.4.min" ); - OC_Util::addScript( "jquery-ui-1.8.14.custom.min" ); + OC_Util::addScript( "jquery-ui-1.8.16.custom.min" ); OC_Util::addScript( "jquery-showpassword" ); OC_Util::addScript( "jquery.infieldlabel.min" ); OC_Util::addScript( "jquery-tipsy" ); @@ -141,7 +141,7 @@ class OC{ OC_Util::addScript('search','result'); OC_Util::addStyle( "styles" ); OC_Util::addStyle( "multiselect" ); - OC_Util::addStyle( "jquery-ui-1.8.14.custom" ); + OC_Util::addStyle( "jquery-ui-1.8.16.custom" ); OC_Util::addStyle( "jquery-tipsy" ); $errors=OC_Util::checkServer(); From 5ebf8a87f2523b799a7cd3302410cbeef7cfb1db Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Fri, 30 Dec 2011 23:08:44 +0000 Subject: [PATCH 016/106] Removed old jquery-ui css and js --- core/css/jquery-ui-1.8.14.custom.css | 381 ------------ core/js/jquery-ui-1.8.14.custom.min.js | 789 ------------------------- 2 files changed, 1170 deletions(-) delete mode 100644 core/css/jquery-ui-1.8.14.custom.css delete mode 100644 core/js/jquery-ui-1.8.14.custom.min.js diff --git a/core/css/jquery-ui-1.8.14.custom.css b/core/css/jquery-ui-1.8.14.custom.css deleted file mode 100644 index 887e4b5e57..0000000000 --- a/core/css/jquery-ui-1.8.14.custom.css +++ /dev/null @@ -1,381 +0,0 @@ -/* - * jQuery UI CSS Framework 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - */ - -/* Layout helpers -----------------------------------*/ -.ui-helper-hidden { display: none; } -.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } -.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } -.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } -.ui-helper-clearfix { display: inline-block; } -/* required comment for clearfix to work in Opera \*/ -* html .ui-helper-clearfix { height:1%; } -.ui-helper-clearfix { display:block; } -/* end clearfix */ -.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } - - -/* Interaction Cues -----------------------------------*/ -.ui-state-disabled { cursor: default !important; } - - -/* Icons -----------------------------------*/ - -/* states and images */ -.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } - -/* states and images */ -.ui-icon { width: 16px; height: 16px; } -.ui-icon-closethick { background-image: url(../img/actions/delete.png); } - -/* Misc visuals -----------------------------------*/ - -/* Overlays */ -.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } - - -/* - * jQuery UI CSS Framework 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Theming/API - * - * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px - */ - - -/* Component containers -----------------------------------*/ -.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; } -.ui-widget .ui-widget { font-size: 1em; } -.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; } -.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee 50% top repeat-x; color: #333333; } -.ui-widget-content a { color: #333333; } -.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 50% 50% repeat-x; color: #ffffff; font-weight: bold; } -.ui-widget-header a { color: #ffffff; } - -/* Interaction states -----------------------------------*/ -.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 50% 50% repeat-x; font-weight: bold; color: #1c94c4; } -.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; } -.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce 50% 50% repeat-x; font-weight: bold; color: #c77405; } -.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; } -.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff 50% 50% repeat-x; font-weight: bold; color: #eb8f00; } -.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; } -.ui-widget :active { outline: none; } - -/* Interaction Cues -----------------------------------*/ -.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c 50% top repeat-x; color: #363636; } -.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } -.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 50% 50% repeat; color: #ffffff; } -.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; } -.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; } -.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } -.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } -.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } - - -/* Misc visuals -----------------------------------*/ - -/* Corner radius */ -.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; } -.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; } -.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } -.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } - -/* Overlays */ -.ui-widget-overlay { background: #666666 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); } -.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/* - * jQuery UI Resizable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Resizable#theming - */ -.ui-resizable { position: relative;} -.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } -.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } -.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } -.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } -.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } -.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } -.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } -.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } -.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* - * jQuery UI Selectable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectable#theming - */ -.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } -/* - * jQuery UI Accordion 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Accordion#theming - */ -/* IE/Win - Fix animation bug - #4615 */ -.ui-accordion { width: 100%; } -.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } -.ui-accordion .ui-accordion-li-fix { display: inline; } -.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } -.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } -.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } -.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } -.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } -.ui-accordion .ui-accordion-content-active { display: block; } -/* - * jQuery UI Autocomplete 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete#theming - */ -.ui-autocomplete { position: absolute; cursor: default; } - -/* workarounds */ -* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ - -/* - * jQuery UI Menu 1.8.14 - * - * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Menu#theming - */ -.ui-menu { - list-style:none; - padding: 2px; - margin: 0; - display:block; - float: left; -} -.ui-menu .ui-menu { - margin-top: -3px; -} -.ui-menu .ui-menu-item { - margin:0; - padding: 0; - zoom: 1; - float: left; - clear: left; - width: 100%; -} -.ui-menu .ui-menu-item a { - text-decoration:none; - display:block; - padding:.2em .4em; - line-height:1.5; - zoom:1; -} -.ui-menu .ui-menu-item a.ui-state-hover, -.ui-menu .ui-menu-item a.ui-state-active { - font-weight: normal; - margin: -1px; -} -/* - * jQuery UI Button 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Button#theming - */ -.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ -.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ -button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ -.ui-button-icons-only { width: 3.4em; } -button.ui-button-icons-only { width: 3.7em; } - -/*button text element */ -.ui-button .ui-button-text { display: block; line-height: 1.4; } -.ui-button-text-only .ui-button-text { padding: .4em 1em; } -.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } -.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } -.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } -.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } -/* no icon support for input elements, provide padding by default */ -input.ui-button { padding: .4em 1em; } - -/*button icon element(s) */ -.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } -.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } -.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } -.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } -.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } - -/*button sets*/ -.ui-buttonset { margin-right: 7px; } -.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } - -/* workarounds */ -button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ -/* - * jQuery UI Dialog 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog#theming - */ -.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } -.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } -.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } -.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } -.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } -.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } -.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } -.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } -.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } -.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } -.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } -.ui-draggable .ui-dialog-titlebar { cursor: move; } -/* - * jQuery UI Slider 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Slider#theming - */ -.ui-slider { position: relative; text-align: left; } -.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } -.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } - -.ui-slider-horizontal { height: .8em; } -.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } -.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } -.ui-slider-horizontal .ui-slider-range-min { left: 0; } -.ui-slider-horizontal .ui-slider-range-max { right: 0; } - -.ui-slider-vertical { width: .8em; height: 100px; } -.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } -.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } -.ui-slider-vertical .ui-slider-range-min { bottom: 0; } -.ui-slider-vertical .ui-slider-range-max { top: 0; }/* - * jQuery UI Tabs 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs#theming - */ -.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ -.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } -.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } -.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } -.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } -.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ -.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } -.ui-tabs .ui-tabs-hide { display: none !important; } -/* - * jQuery UI Datepicker 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Datepicker#theming - */ -.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } -.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } -.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } -.ui-datepicker .ui-datepicker-prev { left:2px; } -.ui-datepicker .ui-datepicker-next { right:2px; } -.ui-datepicker .ui-datepicker-prev-hover { left:1px; } -.ui-datepicker .ui-datepicker-next-hover { right:1px; } -.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } -.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } -.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } -.ui-datepicker select.ui-datepicker-month-year {width: 100%;} -.ui-datepicker select.ui-datepicker-month, -.ui-datepicker select.ui-datepicker-year { width: 49%;} -.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } -.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } -.ui-datepicker td { border: 0; padding: 1px; } -.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } -.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } -.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } -.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } - -/* with multiple calendars */ -.ui-datepicker.ui-datepicker-multi { width:auto; } -.ui-datepicker-multi .ui-datepicker-group { float:left; } -.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } -.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } -.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } -.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } -.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } -.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } -.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } - -/* RTL support */ -.ui-datepicker-rtl { direction: rtl; } -.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } -.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } -.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } -.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } -.ui-datepicker-rtl .ui-datepicker-group { float:right; } -.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } -.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } - -/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ -.ui-datepicker-cover { - display: none; /*sorry for IE5*/ - display/**/: block; /*sorry for IE5*/ - position: absolute; /*must have*/ - z-index: -1; /*must have*/ - filter: mask(); /*must have*/ - top: -4px; /*must have*/ - left: -4px; /*must have*/ - width: 200px; /*must have*/ - height: 200px; /*must have*/ -}/* - * jQuery UI Progressbar 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar#theming - */ -.ui-progressbar { height:2em; text-align: left; } -.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } diff --git a/core/js/jquery-ui-1.8.14.custom.min.js b/core/js/jquery-ui-1.8.14.custom.min.js deleted file mode 100644 index f9e4f1e840..0000000000 --- a/core/js/jquery-ui-1.8.14.custom.min.js +++ /dev/null @@ -1,789 +0,0 @@ -/*! - * jQuery UI 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI - */ -(function(c,j){function k(a,b){var d=a.nodeName.toLowerCase();if("area"===d){b=a.parentNode;d=b.name;if(!a.href||!d||b.nodeName.toLowerCase()!=="map")return false;a=c("img[usemap=#"+d+"]")[0];return!!a&&l(a)}return(/input|select|textarea|button|object/.test(d)?!a.disabled:"a"==d?a.href||b:b)&&l(a)}function l(a){return!c(a).parents().andSelf().filter(function(){return c.curCSS(this,"visibility")==="hidden"||c.expr.filters.hidden(this)}).length}c.ui=c.ui||{};if(!c.ui.version){c.extend(c.ui,{version:"1.8.14", -keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91}});c.fn.extend({_focus:c.fn.focus,focus:function(a,b){return typeof a==="number"?this.each(function(){var d=this;setTimeout(function(){c(d).focus(); -b&&b.call(d)},a)}):this._focus.apply(this,arguments)},scrollParent:function(){var a;a=c.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(c.curCSS(this,"position",1))&&/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this,"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(c.curCSS(this,"overflow",1)+c.curCSS(this, -"overflow-y",1)+c.curCSS(this,"overflow-x",1))}).eq(0);return/fixed/.test(this.css("position"))||!a.length?c(document):a},zIndex:function(a){if(a!==j)return this.css("zIndex",a);if(this.length){a=c(this[0]);for(var b;a.length&&a[0]!==document;){b=a.css("position");if(b==="absolute"||b==="relative"||b==="fixed"){b=parseInt(a.css("zIndex"),10);if(!isNaN(b)&&b!==0)return b}a=a.parent()}}return 0},disableSelection:function(){return this.bind((c.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection", -function(a){a.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}});c.each(["Width","Height"],function(a,b){function d(f,g,m,n){c.each(e,function(){g-=parseFloat(c.curCSS(f,"padding"+this,true))||0;if(m)g-=parseFloat(c.curCSS(f,"border"+this+"Width",true))||0;if(n)g-=parseFloat(c.curCSS(f,"margin"+this,true))||0});return g}var e=b==="Width"?["Left","Right"]:["Top","Bottom"],h=b.toLowerCase(),i={innerWidth:c.fn.innerWidth,innerHeight:c.fn.innerHeight,outerWidth:c.fn.outerWidth, -outerHeight:c.fn.outerHeight};c.fn["inner"+b]=function(f){if(f===j)return i["inner"+b].call(this);return this.each(function(){c(this).css(h,d(this,f)+"px")})};c.fn["outer"+b]=function(f,g){if(typeof f!=="number")return i["outer"+b].call(this,f);return this.each(function(){c(this).css(h,d(this,f,true,g)+"px")})}});c.extend(c.expr[":"],{data:function(a,b,d){return!!c.data(a,d[3])},focusable:function(a){return k(a,!isNaN(c.attr(a,"tabindex")))},tabbable:function(a){var b=c.attr(a,"tabindex"),d=isNaN(b); -return(d||b>=0)&&k(a,!d)}});c(function(){var a=document.body,b=a.appendChild(b=document.createElement("div"));c.extend(b.style,{minHeight:"100px",height:"auto",padding:0,borderWidth:0});c.support.minHeight=b.offsetHeight===100;c.support.selectstart="onselectstart"in b;a.removeChild(b).style.display="none"});c.extend(c.ui,{plugin:{add:function(a,b,d){a=c.ui[a].prototype;for(var e in d){a.plugins[e]=a.plugins[e]||[];a.plugins[e].push([b,d[e]])}},call:function(a,b,d){if((b=a.plugins[b])&&a.element[0].parentNode)for(var e= -0;e0)return true;a[b]=1;d=a[b]>0;a[b]=0;return d},isOverAxis:function(a,b,d){return a>b&&a=9)&&!a.button)return this._mouseUp(a);if(this._mouseStarted){this._mouseDrag(a);return a.preventDefault()}if(this._mouseDistanceMet(a)&&this._mouseDelayMet(a))(this._mouseStarted=this._mouseStart(this._mouseDownEvent,a)!==false)?this._mouseDrag(a):this._mouseUp(a);return!this._mouseStarted},_mouseUp:function(a){b(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted= -false;a.target==this._mouseDownEvent.target&&b.data(a.target,this.widgetName+".preventClickEvent",true);this._mouseStop(a)}return false},_mouseDistanceMet:function(a){return Math.max(Math.abs(this._mouseDownEvent.pageX-a.pageX),Math.abs(this._mouseDownEvent.pageY-a.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return true}})})(jQuery); -;/* - * jQuery UI Position 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Position - */ -(function(c){c.ui=c.ui||{};var n=/left|center|right/,o=/top|center|bottom/,t=c.fn.position,u=c.fn.offset;c.fn.position=function(b){if(!b||!b.of)return t.apply(this,arguments);b=c.extend({},b);var a=c(b.of),d=a[0],g=(b.collision||"flip").split(" "),e=b.offset?b.offset.split(" "):[0,0],h,k,j;if(d.nodeType===9){h=a.width();k=a.height();j={top:0,left:0}}else if(d.setTimeout){h=a.width();k=a.height();j={top:a.scrollTop(),left:a.scrollLeft()}}else if(d.preventDefault){b.at="left top";h=k=0;j={top:b.of.pageY, -left:b.of.pageX}}else{h=a.outerWidth();k=a.outerHeight();j=a.offset()}c.each(["my","at"],function(){var f=(b[this]||"").split(" ");if(f.length===1)f=n.test(f[0])?f.concat(["center"]):o.test(f[0])?["center"].concat(f):["center","center"];f[0]=n.test(f[0])?f[0]:"center";f[1]=o.test(f[1])?f[1]:"center";b[this]=f});if(g.length===1)g[1]=g[0];e[0]=parseInt(e[0],10)||0;if(e.length===1)e[1]=e[0];e[1]=parseInt(e[1],10)||0;if(b.at[0]==="right")j.left+=h;else if(b.at[0]==="center")j.left+=h/2;if(b.at[1]==="bottom")j.top+= -k;else if(b.at[1]==="center")j.top+=k/2;j.left+=e[0];j.top+=e[1];return this.each(function(){var f=c(this),l=f.outerWidth(),m=f.outerHeight(),p=parseInt(c.curCSS(this,"marginLeft",true))||0,q=parseInt(c.curCSS(this,"marginTop",true))||0,v=l+p+(parseInt(c.curCSS(this,"marginRight",true))||0),w=m+q+(parseInt(c.curCSS(this,"marginBottom",true))||0),i=c.extend({},j),r;if(b.my[0]==="right")i.left-=l;else if(b.my[0]==="center")i.left-=l/2;if(b.my[1]==="bottom")i.top-=m;else if(b.my[1]==="center")i.top-= -m/2;i.left=Math.round(i.left);i.top=Math.round(i.top);r={left:i.left-p,top:i.top-q};c.each(["left","top"],function(s,x){c.ui.position[g[s]]&&c.ui.position[g[s]][x](i,{targetWidth:h,targetHeight:k,elemWidth:l,elemHeight:m,collisionPosition:r,collisionWidth:v,collisionHeight:w,offset:e,my:b.my,at:b.at})});c.fn.bgiframe&&f.bgiframe();f.offset(c.extend(i,{using:b.using}))})};c.ui.position={fit:{left:function(b,a){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();b.left= -d>0?b.left-d:Math.max(b.left-a.collisionPosition.left,b.left)},top:function(b,a){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();b.top=d>0?b.top-d:Math.max(b.top-a.collisionPosition.top,b.top)}},flip:{left:function(b,a){if(a.at[0]!=="center"){var d=c(window);d=a.collisionPosition.left+a.collisionWidth-d.width()-d.scrollLeft();var g=a.my[0]==="left"?-a.elemWidth:a.my[0]==="right"?a.elemWidth:0,e=a.at[0]==="left"?a.targetWidth:-a.targetWidth,h=-2*a.offset[0];b.left+= -a.collisionPosition.left<0?g+e+h:d>0?g+e+h:0}},top:function(b,a){if(a.at[1]!=="center"){var d=c(window);d=a.collisionPosition.top+a.collisionHeight-d.height()-d.scrollTop();var g=a.my[1]==="top"?-a.elemHeight:a.my[1]==="bottom"?a.elemHeight:0,e=a.at[1]==="top"?a.targetHeight:-a.targetHeight,h=-2*a.offset[1];b.top+=a.collisionPosition.top<0?g+e+h:d>0?g+e+h:0}}}};if(!c.offset.setOffset){c.offset.setOffset=function(b,a){if(/static/.test(c.curCSS(b,"position")))b.style.position="relative";var d=c(b), -g=d.offset(),e=parseInt(c.curCSS(b,"top",true),10)||0,h=parseInt(c.curCSS(b,"left",true),10)||0;g={top:a.top-g.top+e,left:a.left-g.left+h};"using"in a?a.using.call(b,g):d.css(g)};c.fn.offset=function(b){var a=this[0];if(!a||!a.ownerDocument)return null;if(b)return this.each(function(){c.offset.setOffset(this,b)});return u.call(this)}}})(jQuery); -;/* - * jQuery UI Draggable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Draggables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(d){d.widget("ui.draggable",d.ui.mouse,{widgetEventPrefix:"drag",options:{addClasses:true,appendTo:"parent",axis:false,connectToSortable:false,containment:false,cursor:"auto",cursorAt:false,grid:false,handle:false,helper:"original",iframeFix:false,opacity:false,refreshPositions:false,revert:false,revertDuration:500,scope:"default",scroll:true,scrollSensitivity:20,scrollSpeed:20,snap:false,snapMode:"both",snapTolerance:20,stack:false,zIndex:false},_create:function(){if(this.options.helper== -"original"&&!/^(?:r|a|f)/.test(this.element.css("position")))this.element[0].style.position="relative";this.options.addClasses&&this.element.addClass("ui-draggable");this.options.disabled&&this.element.addClass("ui-draggable-disabled");this._mouseInit()},destroy:function(){if(this.element.data("draggable")){this.element.removeData("draggable").unbind(".draggable").removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled");this._mouseDestroy();return this}},_mouseCapture:function(a){var b= -this.options;if(this.helper||b.disabled||d(a.target).is(".ui-resizable-handle"))return false;this.handle=this._getHandle(a);if(!this.handle)return false;d(b.iframeFix===true?"iframe":b.iframeFix).each(function(){d('
    ').css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1E3}).css(d(this).offset()).appendTo("body")});return true},_mouseStart:function(a){var b=this.options;this.helper= -this._createHelper(a);this._cacheHelperProportions();if(d.ui.ddmanager)d.ui.ddmanager.current=this;this._cacheMargins();this.cssPosition=this.helper.css("position");this.scrollParent=this.helper.scrollParent();this.offset=this.positionAbs=this.element.offset();this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left};d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}); -this.originalPosition=this.position=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);b.containment&&this._setContainment();if(this._trigger("start",a)===false){this._clear();return false}this._cacheHelperProportions();d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.helper.addClass("ui-draggable-dragging");this._mouseDrag(a,true);d.ui.ddmanager&&d.ui.ddmanager.dragStart(this,a);return true}, -_mouseDrag:function(a,b){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!b){b=this._uiHash();if(this._trigger("drag",a,b)===false){this._mouseUp({});return false}this.position=b.position}if(!this.options.axis||this.options.axis!="y")this.helper[0].style.left=this.position.left+"px";if(!this.options.axis||this.options.axis!="x")this.helper[0].style.top=this.position.top+"px";d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);return false},_mouseStop:function(a){var b= -false;if(d.ui.ddmanager&&!this.options.dropBehaviour)b=d.ui.ddmanager.drop(this,a);if(this.dropped){b=this.dropped;this.dropped=false}if((!this.element[0]||!this.element[0].parentNode)&&this.options.helper=="original")return false;if(this.options.revert=="invalid"&&!b||this.options.revert=="valid"&&b||this.options.revert===true||d.isFunction(this.options.revert)&&this.options.revert.call(this.element,b)){var c=this;d(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration, -10),function(){c._trigger("stop",a)!==false&&c._clear()})}else this._trigger("stop",a)!==false&&this._clear();return false},_mouseUp:function(a){this.options.iframeFix===true&&d("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)});d.ui.ddmanager&&d.ui.ddmanager.dragStop(this,a);return d.ui.mouse.prototype._mouseUp.call(this,a)},cancel:function(){this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear();return this},_getHandle:function(a){var b=!this.options.handle|| -!d(this.options.handle,this.element).length?true:false;d(this.options.handle,this.element).find("*").andSelf().each(function(){if(this==a.target)b=true});return b},_createHelper:function(a){var b=this.options;a=d.isFunction(b.helper)?d(b.helper.apply(this.element[0],[a])):b.helper=="clone"?this.element.clone().removeAttr("id"):this.element;a.parents("body").length||a.appendTo(b.appendTo=="parent"?this.element[0].parentNode:b.appendTo);a[0]!=this.element[0]&&!/(fixed|absolute)/.test(a.css("position"))&& -a.css("position","absolute");return a},_adjustOffsetFromHelper:function(a){if(typeof a=="string")a=a.split(" ");if(d.isArray(a))a={left:+a[0],top:+a[1]||0};if("left"in a)this.offset.click.left=a.left+this.margins.left;if("right"in a)this.offset.click.left=this.helperProportions.width-a.right+this.margins.left;if("top"in a)this.offset.click.top=a.top+this.margins.top;if("bottom"in a)this.offset.click.top=this.helperProportions.height-a.bottom+this.margins.top},_getParentOffset:function(){this.offsetParent= -this.helper.offsetParent();var a=this.offsetParent.offset();if(this.cssPosition=="absolute"&&this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0])){a.left+=this.scrollParent.scrollLeft();a.top+=this.scrollParent.scrollTop()}if(this.offsetParent[0]==document.body||this.offsetParent[0].tagName&&this.offsetParent[0].tagName.toLowerCase()=="html"&&d.browser.msie)a={top:0,left:0};return{top:a.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:a.left+(parseInt(this.offsetParent.css("borderLeftWidth"), -10)||0)}},_getRelativeOffset:function(){if(this.cssPosition=="relative"){var a=this.element.position();return{top:a.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:a.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}else return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"), -10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var a=this.options;if(a.containment=="parent")a.containment=this.helper[0].parentNode;if(a.containment=="document"||a.containment=="window")this.containment=[a.containment=="document"?0:d(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,a.containment=="document"?0:d(window).scrollTop()-this.offset.relative.top-this.offset.parent.top, -(a.containment=="document"?0:d(window).scrollLeft())+d(a.containment=="document"?document:window).width()-this.helperProportions.width-this.margins.left,(a.containment=="document"?0:d(window).scrollTop())+(d(a.containment=="document"?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top];if(!/^(document|window|parent)$/.test(a.containment)&&a.containment.constructor!=Array){a=d(a.containment);var b=a[0];if(b){a.offset();var c=d(b).css("overflow")!= -"hidden";this.containment=[(parseInt(d(b).css("borderLeftWidth"),10)||0)+(parseInt(d(b).css("paddingLeft"),10)||0),(parseInt(d(b).css("borderTopWidth"),10)||0)+(parseInt(d(b).css("paddingTop"),10)||0),(c?Math.max(b.scrollWidth,b.offsetWidth):b.offsetWidth)-(parseInt(d(b).css("borderLeftWidth"),10)||0)-(parseInt(d(b).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(c?Math.max(b.scrollHeight,b.offsetHeight):b.offsetHeight)-(parseInt(d(b).css("borderTopWidth"), -10)||0)-(parseInt(d(b).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom];this.relative_container=a}}else if(a.containment.constructor==Array)this.containment=a.containment},_convertPositionTo:function(a,b){if(!b)b=this.position;a=a=="absolute"?1:-1;var c=this.cssPosition=="absolute"&&!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName);return{top:b.top+ -this.offset.relative.top*a+this.offset.parent.top*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollTop():f?0:c.scrollTop())*a),left:b.left+this.offset.relative.left*a+this.offset.parent.left*a-(d.browser.safari&&d.browser.version<526&&this.cssPosition=="fixed"?0:(this.cssPosition=="fixed"?-this.scrollParent.scrollLeft():f?0:c.scrollLeft())*a)}},_generatePosition:function(a){var b=this.options,c=this.cssPosition=="absolute"&& -!(this.scrollParent[0]!=document&&d.ui.contains(this.scrollParent[0],this.offsetParent[0]))?this.offsetParent:this.scrollParent,f=/(html|body)/i.test(c[0].tagName),e=a.pageX,h=a.pageY;if(this.originalPosition){var g;if(this.containment){if(this.relative_container){g=this.relative_container.offset();g=[this.containment[0]+g.left,this.containment[1]+g.top,this.containment[2]+g.left,this.containment[3]+g.top]}else g=this.containment;if(a.pageX-this.offset.click.leftg[2])e=g[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>g[3])h=g[3]+this.offset.click.top}if(b.grid){h=b.grid[1]?this.originalPageY+Math.round((h-this.originalPageY)/b.grid[1])*b.grid[1]:this.originalPageY;h=g?!(h-this.offset.click.topg[3])?h:!(h-this.offset.click.topg[2])?e:!(e-this.offset.click.left=0;i--){var j=c.snapElements[i].left,l=j+c.snapElements[i].width,k=c.snapElements[i].top,m=k+c.snapElements[i].height;if(j-e=j&&f<=l||h>=j&&h<=l||fl)&&(e>= -i&&e<=k||g>=i&&g<=k||ek);default:return false}};d.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(a,b){var c=d.ui.ddmanager.droppables[a.options.scope]||[],e=b?b.type:null,g=(a.currentItem||a.element).find(":data(droppable)").andSelf(),f=0;a:for(;f').css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(), -top:this.element.css("top"),left:this.element.css("left")}));this.element=this.element.parent().data("resizable",this.element.data("resizable"));this.elementIsWrapper=true;this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")});this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});this.originalResizeStyle= -this.originalElement.css("resize");this.originalElement.css("resize","none");this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"}));this.originalElement.css({margin:this.originalElement.css("margin")});this._proportionallyResize()}this.handles=a.handles||(!e(".ui-resizable-handle",this.element).length?"e,s,se":{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne", -nw:".ui-resizable-nw"});if(this.handles.constructor==String){if(this.handles=="all")this.handles="n,e,s,w,se,sw,ne,nw";var c=this.handles.split(",");this.handles={};for(var d=0;d');/sw|se|ne|nw/.test(f)&&g.css({zIndex:++a.zIndex});"se"==f&&g.addClass("ui-icon ui-icon-gripsmall-diagonal-se");this.handles[f]=".ui-resizable-"+f;this.element.append(g)}}this._renderAxis=function(h){h=h||this.element;for(var i in this.handles){if(this.handles[i].constructor== -String)this.handles[i]=e(this.handles[i],this.element).show();if(this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)){var j=e(this.handles[i],this.element),l=0;l=/sw|ne|nw|se|n|s/.test(i)?j.outerHeight():j.outerWidth();j=["padding",/ne|nw|n/.test(i)?"Top":/se|sw|s/.test(i)?"Bottom":/^e$/.test(i)?"Right":"Left"].join("");h.css(j,l);this._proportionallyResize()}e(this.handles[i])}};this._renderAxis(this.element);this._handles=e(".ui-resizable-handle",this.element).disableSelection(); -this._handles.mouseover(function(){if(!b.resizing){if(this.className)var h=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);b.axis=h&&h[1]?h[1]:"se"}});if(a.autoHide){this._handles.hide();e(this.element).addClass("ui-resizable-autohide").hover(function(){if(!a.disabled){e(this).removeClass("ui-resizable-autohide");b._handles.show()}},function(){if(!a.disabled)if(!b.resizing){e(this).addClass("ui-resizable-autohide");b._handles.hide()}})}this._mouseInit()},destroy:function(){this._mouseDestroy(); -var b=function(c){e(c).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};if(this.elementIsWrapper){b(this.element);var a=this.element;a.after(this.originalElement.css({position:a.css("position"),width:a.outerWidth(),height:a.outerHeight(),top:a.css("top"),left:a.css("left")})).remove()}this.originalElement.css("resize",this.originalResizeStyle);b(this.originalElement);return this},_mouseCapture:function(b){var a= -false;for(var c in this.handles)if(e(this.handles[c])[0]==b.target)a=true;return!this.options.disabled&&a},_mouseStart:function(b){var a=this.options,c=this.element.position(),d=this.element;this.resizing=true;this.documentScroll={top:e(document).scrollTop(),left:e(document).scrollLeft()};if(d.is(".ui-draggable")||/absolute/.test(d.css("position")))d.css({position:"absolute",top:c.top,left:c.left});e.browser.opera&&/relative/.test(d.css("position"))&&d.css({position:"relative",top:"auto",left:"auto"}); -this._renderProxy();c=m(this.helper.css("left"));var f=m(this.helper.css("top"));if(a.containment){c+=e(a.containment).scrollLeft()||0;f+=e(a.containment).scrollTop()||0}this.offset=this.helper.offset();this.position={left:c,top:f};this.size=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalSize=this._helper?{width:d.outerWidth(),height:d.outerHeight()}:{width:d.width(),height:d.height()};this.originalPosition={left:c,top:f};this.sizeDiff= -{width:d.outerWidth()-d.width(),height:d.outerHeight()-d.height()};this.originalMousePosition={left:b.pageX,top:b.pageY};this.aspectRatio=typeof a.aspectRatio=="number"?a.aspectRatio:this.originalSize.width/this.originalSize.height||1;a=e(".ui-resizable-"+this.axis).css("cursor");e("body").css("cursor",a=="auto"?this.axis+"-resize":a);d.addClass("ui-resizable-resizing");this._propagate("start",b);return true},_mouseDrag:function(b){var a=this.helper,c=this.originalMousePosition,d=this._change[this.axis]; -if(!d)return false;c=d.apply(this,[b,b.pageX-c.left||0,b.pageY-c.top||0]);this._updateVirtualBoundaries(b.shiftKey);if(this._aspectRatio||b.shiftKey)c=this._updateRatio(c,b);c=this._respectSize(c,b);this._propagate("resize",b);a.css({top:this.position.top+"px",left:this.position.left+"px",width:this.size.width+"px",height:this.size.height+"px"});!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize();this._updateCache(c);this._trigger("resize",b,this.ui());return false}, -_mouseStop:function(b){this.resizing=false;var a=this.options,c=this;if(this._helper){var d=this._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName);d=f&&e.ui.hasScroll(d[0],"left")?0:c.sizeDiff.height;f=f?0:c.sizeDiff.width;f={width:c.helper.width()-f,height:c.helper.height()-d};d=parseInt(c.element.css("left"),10)+(c.position.left-c.originalPosition.left)||null;var g=parseInt(c.element.css("top"),10)+(c.position.top-c.originalPosition.top)||null;a.animate||this.element.css(e.extend(f, -{top:g,left:d}));c.helper.height(c.size.height);c.helper.width(c.size.width);this._helper&&!a.animate&&this._proportionallyResize()}e("body").css("cursor","auto");this.element.removeClass("ui-resizable-resizing");this._propagate("stop",b);this._helper&&this.helper.remove();return false},_updateVirtualBoundaries:function(b){var a=this.options,c,d,f;a={minWidth:k(a.minWidth)?a.minWidth:0,maxWidth:k(a.maxWidth)?a.maxWidth:Infinity,minHeight:k(a.minHeight)?a.minHeight:0,maxHeight:k(a.maxHeight)?a.maxHeight: -Infinity};if(this._aspectRatio||b){b=a.minHeight*this.aspectRatio;d=a.minWidth/this.aspectRatio;c=a.maxHeight*this.aspectRatio;f=a.maxWidth/this.aspectRatio;if(b>a.minWidth)a.minWidth=b;if(d>a.minHeight)a.minHeight=d;if(cb.width,h=k(b.height)&&a.minHeight&&a.minHeight>b.height;if(g)b.width=a.minWidth;if(h)b.height=a.minHeight;if(d)b.width=a.maxWidth;if(f)b.height=a.maxHeight;var i=this.originalPosition.left+this.originalSize.width,j=this.position.top+this.size.height,l=/sw|nw|w/.test(c);c=/nw|ne|n/.test(c);if(g&&l)b.left=i-a.minWidth;if(d&&l)b.left=i-a.maxWidth;if(h&&c)b.top=j-a.minHeight;if(f&&c)b.top=j-a.maxHeight;if((a=!b.width&&!b.height)&&!b.left&&b.top)b.top=null;else if(a&&!b.top&&b.left)b.left= -null;return b},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var b=this.helper||this.element,a=0;a');var a=e.browser.msie&&e.browser.version<7,c=a?1:0;a=a?2:-1;this.helper.addClass(this._helper).css({width:this.element.outerWidth()+ -a,height:this.element.outerHeight()+a,position:"absolute",left:this.elementOffset.left-c+"px",top:this.elementOffset.top-c+"px",zIndex:++b.zIndex});this.helper.appendTo("body").disableSelection()}else this.helper=this.element},_change:{e:function(b,a){return{width:this.originalSize.width+a}},w:function(b,a){return{left:this.originalPosition.left+a,width:this.originalSize.width-a}},n:function(b,a,c){return{top:this.originalPosition.top+c,height:this.originalSize.height-c}},s:function(b,a,c){return{height:this.originalSize.height+ -c}},se:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},sw:function(b,a,c){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[b,a,c]))},ne:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[b,a,c]))},nw:function(b,a,c){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[b,a,c]))}},_propagate:function(b,a){e.ui.plugin.call(this,b,[a,this.ui()]); -b!="resize"&&this._trigger(b,a,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}});e.extend(e.ui.resizable,{version:"1.8.14"});e.ui.plugin.add("resizable","alsoResize",{start:function(){var b=e(this).data("resizable").options,a=function(c){e(c).each(function(){var d=e(this);d.data("resizable-alsoresize",{width:parseInt(d.width(), -10),height:parseInt(d.height(),10),left:parseInt(d.css("left"),10),top:parseInt(d.css("top"),10),position:d.css("position")})})};if(typeof b.alsoResize=="object"&&!b.alsoResize.parentNode)if(b.alsoResize.length){b.alsoResize=b.alsoResize[0];a(b.alsoResize)}else e.each(b.alsoResize,function(c){a(c)});else a(b.alsoResize)},resize:function(b,a){var c=e(this).data("resizable");b=c.options;var d=c.originalSize,f=c.originalPosition,g={height:c.size.height-d.height||0,width:c.size.width-d.width||0,top:c.position.top- -f.top||0,left:c.position.left-f.left||0},h=function(i,j){e(i).each(function(){var l=e(this),q=e(this).data("resizable-alsoresize"),p={},r=j&&j.length?j:l.parents(a.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(r,function(n,o){if((n=(q[o]||0)+(g[o]||0))&&n>=0)p[o]=n||null});if(e.browser.opera&&/relative/.test(l.css("position"))){c._revertToRelativePosition=true;l.css({position:"absolute",top:"auto",left:"auto"})}l.css(p)})};typeof b.alsoResize=="object"&&!b.alsoResize.nodeType? -e.each(b.alsoResize,function(i,j){h(i,j)}):h(b.alsoResize)},stop:function(){var b=e(this).data("resizable"),a=b.options,c=function(d){e(d).each(function(){var f=e(this);f.css({position:f.data("resizable-alsoresize").position})})};if(b._revertToRelativePosition){b._revertToRelativePosition=false;typeof a.alsoResize=="object"&&!a.alsoResize.nodeType?e.each(a.alsoResize,function(d){c(d)}):c(a.alsoResize)}e(this).removeData("resizable-alsoresize")}});e.ui.plugin.add("resizable","animate",{stop:function(b){var a= -e(this).data("resizable"),c=a.options,d=a._proportionallyResizeElements,f=d.length&&/textarea/i.test(d[0].nodeName),g=f&&e.ui.hasScroll(d[0],"left")?0:a.sizeDiff.height;f={width:a.size.width-(f?0:a.sizeDiff.width),height:a.size.height-g};g=parseInt(a.element.css("left"),10)+(a.position.left-a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing, -step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement= -e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top","Right","Left","Bottom"]).each(function(i,j){f[i]=m(d.css("padding"+j))});b.containerOffset=d.offset();b.containerPosition=d.position();b.containerSize={height:d.innerHeight()-f[3],width:d.innerWidth()-f[1]};c=b.containerOffset; -var g=b.containerSize.height,h=b.containerSize.width;h=e.ui.hasScroll(a,"left")?a.scrollWidth:h;g=e.ui.hasScroll(a)?a.scrollHeight:g;b.parentData={element:a,left:c.left,top:c.top,width:h,height:g}}}},resize:function(b){var a=e(this).data("resizable"),c=a.options,d=a.containerOffset,f=a.position;b=a._aspectRatio||b.shiftKey;var g={top:0,left:0},h=a.containerElement;if(h[0]!=document&&/static/.test(h.css("position")))g=d;if(f.left<(a._helper?d.left:0)){a.size.width+=a._helper?a.position.left-d.left: -a.position.left-g.left;if(b)a.size.height=a.size.width/c.aspectRatio;a.position.left=c.helper?d.left:0}if(f.top<(a._helper?d.top:0)){a.size.height+=a._helper?a.position.top-d.top:a.position.top;if(b)a.size.width=a.size.height*c.aspectRatio;a.position.top=a._helper?d.top:0}a.offset.left=a.parentData.left+a.position.left;a.offset.top=a.parentData.top+a.position.top;c=Math.abs((a._helper?a.offset.left-g.left:a.offset.left-g.left)+a.sizeDiff.width);d=Math.abs((a._helper?a.offset.top-g.top:a.offset.top- -d.top)+a.sizeDiff.height);f=a.containerElement.get(0)==a.element.parent().get(0);g=/relative|absolute/.test(a.containerElement.css("position"));if(f&&g)c-=a.parentData.left;if(c+a.size.width>=a.parentData.width){a.size.width=a.parentData.width-c;if(b)a.size.height=a.size.width/a.aspectRatio}if(d+a.size.height>=a.parentData.height){a.size.height=a.parentData.height-d;if(b)a.size.width=a.size.height*a.aspectRatio}},stop:function(){var b=e(this).data("resizable"),a=b.options,c=b.containerOffset,d=b.containerPosition, -f=b.containerElement,g=e(b.helper),h=g.offset(),i=g.outerWidth()-b.sizeDiff.width;g=g.outerHeight()-b.sizeDiff.height;b._helper&&!a.animate&&/relative/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g});b._helper&&!a.animate&&/static/.test(f.css("position"))&&e(this).css({left:h.left-d.left-c.left,width:i,height:g})}});e.ui.plugin.add("resizable","ghost",{start:function(){var b=e(this).data("resizable"),a=b.options,c=b.size;b.ghost=b.originalElement.clone();b.ghost.css({opacity:0.25, -display:"block",position:"relative",height:c.height,width:c.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass(typeof a.ghost=="string"?a.ghost:"");b.ghost.appendTo(b.helper)},resize:function(){var b=e(this).data("resizable");b.ghost&&b.ghost.css({position:"relative",height:b.size.height,width:b.size.width})},stop:function(){var b=e(this).data("resizable");b.ghost&&b.helper&&b.helper.get(0).removeChild(b.ghost.get(0))}});e.ui.plugin.add("resizable","grid",{resize:function(){var b= -e(this).data("resizable"),a=b.options,c=b.size,d=b.originalSize,f=b.originalPosition,g=b.axis;a.grid=typeof a.grid=="number"?[a.grid,a.grid]:a.grid;var h=Math.round((c.width-d.width)/(a.grid[0]||1))*(a.grid[0]||1);a=Math.round((c.height-d.height)/(a.grid[1]||1))*(a.grid[1]||1);if(/^(se|s|e)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a}else if(/^(ne)$/.test(g)){b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}else{if(/^(sw)$/.test(g)){b.size.width=d.width+h;b.size.height= -d.height+a}else{b.size.width=d.width+h;b.size.height=d.height+a;b.position.top=f.top-a}b.position.left=f.left-h}}});var m=function(b){return parseInt(b,10)||0},k=function(b){return!isNaN(parseInt(b,10))}})(jQuery); -;/* - * jQuery UI Selectable 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Selectables - * - * Depends: - * jquery.ui.core.js - * jquery.ui.mouse.js - * jquery.ui.widget.js - */ -(function(e){e.widget("ui.selectable",e.ui.mouse,{options:{appendTo:"body",autoRefresh:true,distance:0,filter:"*",tolerance:"touch"},_create:function(){var c=this;this.element.addClass("ui-selectable");this.dragged=false;var f;this.refresh=function(){f=e(c.options.filter,c.element[0]);f.each(function(){var d=e(this),b=d.offset();e.data(this,"selectable-item",{element:this,$element:d,left:b.left,top:b.top,right:b.left+d.outerWidth(),bottom:b.top+d.outerHeight(),startselected:false,selected:d.hasClass("ui-selected"), -selecting:d.hasClass("ui-selecting"),unselecting:d.hasClass("ui-unselecting")})})};this.refresh();this.selectees=f.addClass("ui-selectee");this._mouseInit();this.helper=e("
    ")},destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item");this.element.removeClass("ui-selectable ui-selectable-disabled").removeData("selectable").unbind(".selectable");this._mouseDestroy();return this},_mouseStart:function(c){var f=this;this.opos=[c.pageX, -c.pageY];if(!this.options.disabled){var d=this.options;this.selectees=e(d.filter,this.element[0]);this._trigger("start",c);e(d.appendTo).append(this.helper);this.helper.css({left:c.clientX,top:c.clientY,width:0,height:0});d.autoRefresh&&this.refresh();this.selectees.filter(".ui-selected").each(function(){var b=e.data(this,"selectable-item");b.startselected=true;if(!c.metaKey){b.$element.removeClass("ui-selected");b.selected=false;b.$element.addClass("ui-unselecting");b.unselecting=true;f._trigger("unselecting", -c,{unselecting:b.element})}});e(c.target).parents().andSelf().each(function(){var b=e.data(this,"selectable-item");if(b){var g=!c.metaKey||!b.$element.hasClass("ui-selected");b.$element.removeClass(g?"ui-unselecting":"ui-selected").addClass(g?"ui-selecting":"ui-unselecting");b.unselecting=!g;b.selecting=g;(b.selected=g)?f._trigger("selecting",c,{selecting:b.element}):f._trigger("unselecting",c,{unselecting:b.element});return false}})}},_mouseDrag:function(c){var f=this;this.dragged=true;if(!this.options.disabled){var d= -this.options,b=this.opos[0],g=this.opos[1],h=c.pageX,i=c.pageY;if(b>h){var j=h;h=b;b=j}if(g>i){j=i;i=g;g=j}this.helper.css({left:b,top:g,width:h-b,height:i-g});this.selectees.each(function(){var a=e.data(this,"selectable-item");if(!(!a||a.element==f.element[0])){var k=false;if(d.tolerance=="touch")k=!(a.left>h||a.righti||a.bottomb&&a.rightg&&a.bottom *",opacity:false,placeholder:false,revert:false,scroll:true,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1E3},_create:function(){var a=this.options;this.containerCache={};this.element.addClass("ui-sortable"); -this.refresh();this.floating=this.items.length?a.axis==="x"||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):false;this.offset=this.element.offset();this._mouseInit()},destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled").removeData("sortable").unbind(".sortable");this._mouseDestroy();for(var a=this.items.length-1;a>=0;a--)this.items[a].item.removeData("sortable-item");return this},_setOption:function(a,b){if(a=== -"disabled"){this.options[a]=b;this.widget()[b?"addClass":"removeClass"]("ui-sortable-disabled")}else d.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(a,b){if(this.reverting)return false;if(this.options.disabled||this.options.type=="static")return false;this._refreshItems(a);var c=null,e=this;d(a.target).parents().each(function(){if(d.data(this,"sortable-item")==e){c=d(this);return false}});if(d.data(a.target,"sortable-item")==e)c=d(a.target);if(!c)return false;if(this.options.handle&& -!b){var f=false;d(this.options.handle,c).find("*").andSelf().each(function(){if(this==a.target)f=true});if(!f)return false}this.currentItem=c;this._removeCurrentsFromItems();return true},_mouseStart:function(a,b,c){b=this.options;var e=this;this.currentContainer=this;this.refreshPositions();this.helper=this._createHelper(a);this._cacheHelperProportions();this._cacheMargins();this.scrollParent=this.helper.scrollParent();this.offset=this.currentItem.offset();this.offset={top:this.offset.top-this.margins.top, -left:this.offset.left-this.margins.left};this.helper.css("position","absolute");this.cssPosition=this.helper.css("position");d.extend(this.offset,{click:{left:a.pageX-this.offset.left,top:a.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()});this.originalPosition=this._generatePosition(a);this.originalPageX=a.pageX;this.originalPageY=a.pageY;b.cursorAt&&this._adjustOffsetFromHelper(b.cursorAt);this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]}; -this.helper[0]!=this.currentItem[0]&&this.currentItem.hide();this._createPlaceholder();b.containment&&this._setContainment();if(b.cursor){if(d("body").css("cursor"))this._storedCursor=d("body").css("cursor");d("body").css("cursor",b.cursor)}if(b.opacity){if(this.helper.css("opacity"))this._storedOpacity=this.helper.css("opacity");this.helper.css("opacity",b.opacity)}if(b.zIndex){if(this.helper.css("zIndex"))this._storedZIndex=this.helper.css("zIndex");this.helper.css("zIndex",b.zIndex)}if(this.scrollParent[0]!= -document&&this.scrollParent[0].tagName!="HTML")this.overflowOffset=this.scrollParent.offset();this._trigger("start",a,this._uiHash());this._preserveHelperProportions||this._cacheHelperProportions();if(!c)for(c=this.containers.length-1;c>=0;c--)this.containers[c]._trigger("activate",a,e._uiHash(this));if(d.ui.ddmanager)d.ui.ddmanager.current=this;d.ui.ddmanager&&!b.dropBehaviour&&d.ui.ddmanager.prepareOffsets(this,a);this.dragging=true;this.helper.addClass("ui-sortable-helper");this._mouseDrag(a); -return true},_mouseDrag:function(a){this.position=this._generatePosition(a);this.positionAbs=this._convertPositionTo("absolute");if(!this.lastPositionAbs)this.lastPositionAbs=this.positionAbs;if(this.options.scroll){var b=this.options,c=false;if(this.scrollParent[0]!=document&&this.scrollParent[0].tagName!="HTML"){if(this.overflowOffset.top+this.scrollParent[0].offsetHeight-a.pageY=0;b--){c=this.items[b];var e=c.item[0],f=this._intersectsWithPointer(c);if(f)if(e!=this.currentItem[0]&&this.placeholder[f==1?"next":"prev"]()[0]!=e&&!d.ui.contains(this.placeholder[0],e)&&(this.options.type=="semi-dynamic"?!d.ui.contains(this.element[0], -e):true)){this.direction=f==1?"down":"up";if(this.options.tolerance=="pointer"||this._intersectsWithSides(c))this._rearrange(a,c);else break;this._trigger("change",a,this._uiHash());break}}this._contactContainers(a);d.ui.ddmanager&&d.ui.ddmanager.drag(this,a);this._trigger("sort",a,this._uiHash());this.lastPositionAbs=this.positionAbs;return false},_mouseStop:function(a,b){if(a){d.ui.ddmanager&&!this.options.dropBehaviour&&d.ui.ddmanager.drop(this,a);if(this.options.revert){var c=this;b=c.placeholder.offset(); -c.reverting=true;d(this.helper).animate({left:b.left-this.offset.parent.left-c.margins.left+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollLeft),top:b.top-this.offset.parent.top-c.margins.top+(this.offsetParent[0]==document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){c._clear(a)})}else this._clear(a,b);return false}},cancel:function(){var a=this;if(this.dragging){this._mouseUp({target:null});this.options.helper=="original"?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"): -this.currentItem.show();for(var b=this.containers.length-1;b>=0;b--){this.containers[b]._trigger("deactivate",null,a._uiHash(this));if(this.containers[b].containerCache.over){this.containers[b]._trigger("out",null,a._uiHash(this));this.containers[b].containerCache.over=0}}}if(this.placeholder){this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.options.helper!="original"&&this.helper&&this.helper[0].parentNode&&this.helper.remove();d.extend(this,{helper:null, -dragging:false,reverting:false,_noFinalSort:null});this.domPosition.prev?d(this.domPosition.prev).after(this.currentItem):d(this.domPosition.parent).prepend(this.currentItem)}return this},serialize:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};d(b).each(function(){var e=(d(a.item||this).attr(a.attribute||"id")||"").match(a.expression||/(.+)[-=_](.+)/);if(e)c.push((a.key||e[1]+"[]")+"="+(a.key&&a.expression?e[1]:e[2]))});!c.length&&a.key&&c.push(a.key+"=");return c.join("&")}, -toArray:function(a){var b=this._getItemsAsjQuery(a&&a.connected),c=[];a=a||{};b.each(function(){c.push(d(a.item||this).attr(a.attribute||"id")||"")});return c},_intersectsWith:function(a){var b=this.positionAbs.left,c=b+this.helperProportions.width,e=this.positionAbs.top,f=e+this.helperProportions.height,g=a.left,h=g+a.width,i=a.top,k=i+a.height,j=this.offset.click.top,l=this.offset.click.left;j=e+j>i&&e+jg&&b+la[this.floating?"width":"height"]?j:g0?"down":"up")},_getDragHorizontalDirection:function(){var a=this.positionAbs.left-this.lastPositionAbs.left;return a!=0&&(a>0?"right":"left")},refresh:function(a){this._refreshItems(a);this.refreshPositions();return this},_connectWith:function(){var a=this.options;return a.connectWith.constructor==String?[a.connectWith]:a.connectWith},_getItemsAsjQuery:function(a){var b=[],c=[],e=this._connectWith(); -if(e&&a)for(a=e.length-1;a>=0;a--)for(var f=d(e[a]),g=f.length-1;g>=0;g--){var h=d.data(f[g],"sortable");if(h&&h!=this&&!h.options.disabled)c.push([d.isFunction(h.options.items)?h.options.items.call(h.element):d(h.options.items,h.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),h])}c.push([d.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):d(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), -this]);for(a=c.length-1;a>=0;a--)c[a][0].each(function(){b.push(this)});return d(b)},_removeCurrentsFromItems:function(){for(var a=this.currentItem.find(":data(sortable-item)"),b=0;b=0;f--)for(var g=d(e[f]),h=g.length-1;h>=0;h--){var i=d.data(g[h],"sortable");if(i&&i!=this&&!i.options.disabled){c.push([d.isFunction(i.options.items)?i.options.items.call(i.element[0],a,{item:this.currentItem}):d(i.options.items,i.element),i]);this.containers.push(i)}}for(f=c.length-1;f>=0;f--){a=c[f][1];e=c[f][0];h=0;for(g=e.length;h=0;b--){var c=this.items[b];if(!(c.instance!=this.currentContainer&&this.currentContainer&&c.item[0]!=this.currentItem[0])){var e=this.options.toleranceElement?d(this.options.toleranceElement,c.item):c.item;if(!a){c.width=e.outerWidth();c.height=e.outerHeight()}e=e.offset();c.left=e.left;c.top=e.top}}if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(b= -this.containers.length-1;b>=0;b--){e=this.containers[b].element.offset();this.containers[b].containerCache.left=e.left;this.containers[b].containerCache.top=e.top;this.containers[b].containerCache.width=this.containers[b].element.outerWidth();this.containers[b].containerCache.height=this.containers[b].element.outerHeight()}return this},_createPlaceholder:function(a){var b=a||this,c=b.options;if(!c.placeholder||c.placeholder.constructor==String){var e=c.placeholder;c.placeholder={element:function(){var f= -d(document.createElement(b.currentItem[0].nodeName)).addClass(e||b.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];if(!e)f.style.visibility="hidden";return f},update:function(f,g){if(!(e&&!c.forcePlaceholderSize)){g.height()||g.height(b.currentItem.innerHeight()-parseInt(b.currentItem.css("paddingTop")||0,10)-parseInt(b.currentItem.css("paddingBottom")||0,10));g.width()||g.width(b.currentItem.innerWidth()-parseInt(b.currentItem.css("paddingLeft")||0,10)-parseInt(b.currentItem.css("paddingRight")|| -0,10))}}}}b.placeholder=d(c.placeholder.element.call(b.element,b.currentItem));b.currentItem.after(b.placeholder);c.placeholder.update(b,b.placeholder)},_contactContainers:function(a){for(var b=null,c=null,e=this.containers.length-1;e>=0;e--)if(!d.ui.contains(this.currentItem[0],this.containers[e].element[0]))if(this._intersectsWith(this.containers[e].containerCache)){if(!(b&&d.ui.contains(this.containers[e].element[0],b.element[0]))){b=this.containers[e];c=e}}else if(this.containers[e].containerCache.over){this.containers[e]._trigger("out", -a,this._uiHash(this));this.containers[e].containerCache.over=0}if(b)if(this.containers.length===1){this.containers[c]._trigger("over",a,this._uiHash(this));this.containers[c].containerCache.over=1}else if(this.currentContainer!=this.containers[c]){b=1E4;e=null;for(var f=this.positionAbs[this.containers[c].floating?"left":"top"],g=this.items.length-1;g>=0;g--)if(d.ui.contains(this.containers[c].element[0],this.items[g].item[0])){var h=this.items[g][this.containers[c].floating?"left":"top"];if(Math.abs(h- -f)this.containment[2])f=this.containment[2]+this.offset.click.left;if(a.pageY-this.offset.click.top>this.containment[3])g=this.containment[3]+this.offset.click.top}if(b.grid){g=this.originalPageY+Math.round((g- -this.originalPageY)/b.grid[1])*b.grid[1];g=this.containment?!(g-this.offset.click.topthis.containment[3])?g:!(g-this.offset.click.topthis.containment[2])?f:!(f-this.offset.click.left=0;e--)if(d.ui.contains(this.containers[e].element[0],this.currentItem[0])&&!b){c.push(function(f){return function(g){f._trigger("receive",g,this._uiHash(this))}}.call(this,this.containers[e]));c.push(function(f){return function(g){f._trigger("update",g,this._uiHash(this))}}.call(this,this.containers[e]))}}for(e=this.containers.length-1;e>=0;e--){b||c.push(function(f){return function(g){f._trigger("deactivate",g,this._uiHash(this))}}.call(this, -this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop", -a,this._uiHash());for(e=0;e li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix"); -a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom"); -if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion", -function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a= -this.options;if(a.icons){c("").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex"); -this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons(); -b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target); -a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+ -c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options; -if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header); -if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(), -e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight|| -e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false", -"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.14", -animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/); -f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide", -paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery); -;/* - * jQuery UI Autocomplete 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Autocomplete - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.position.js - */ -(function(d){var e=0;d.widget("ui.autocomplete",{options:{appendTo:"body",autoFocus:false,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null},pending:0,_create:function(){var a=this,b=this.element[0].ownerDocument,g;this.element.addClass("ui-autocomplete-input").attr("autocomplete","off").attr({role:"textbox","aria-autocomplete":"list","aria-haspopup":"true"}).bind("keydown.autocomplete",function(c){if(!(a.options.disabled||a.element.attr("readonly"))){g= -false;var f=d.ui.keyCode;switch(c.keyCode){case f.PAGE_UP:a._move("previousPage",c);break;case f.PAGE_DOWN:a._move("nextPage",c);break;case f.UP:a._move("previous",c);c.preventDefault();break;case f.DOWN:a._move("next",c);c.preventDefault();break;case f.ENTER:case f.NUMPAD_ENTER:if(a.menu.active){g=true;c.preventDefault()}case f.TAB:if(!a.menu.active)return;a.menu.select(c);break;case f.ESCAPE:a.element.val(a.term);a.close(c);break;default:clearTimeout(a.searching);a.searching=setTimeout(function(){if(a.term!= -a.element.val()){a.selectedItem=null;a.search(null,c)}},a.options.delay);break}}}).bind("keypress.autocomplete",function(c){if(g){g=false;c.preventDefault()}}).bind("focus.autocomplete",function(){if(!a.options.disabled){a.selectedItem=null;a.previous=a.element.val()}}).bind("blur.autocomplete",function(c){if(!a.options.disabled){clearTimeout(a.searching);a.closing=setTimeout(function(){a.close(c);a._change(c)},150)}});this._initSource();this.response=function(){return a._response.apply(a,arguments)}; -this.menu=d("
      ").addClass("ui-autocomplete").appendTo(d(this.options.appendTo||"body",b)[0]).mousedown(function(c){var f=a.menu.element[0];d(c.target).closest(".ui-menu-item").length||setTimeout(function(){d(document).one("mousedown",function(h){h.target!==a.element[0]&&h.target!==f&&!d.ui.contains(f,h.target)&&a.close()})},1);setTimeout(function(){clearTimeout(a.closing)},13)}).menu({focus:function(c,f){f=f.item.data("item.autocomplete");false!==a._trigger("focus",c,{item:f})&&/^key/.test(c.originalEvent.type)&& -a.element.val(f.value)},selected:function(c,f){var h=f.item.data("item.autocomplete"),i=a.previous;if(a.element[0]!==b.activeElement){a.element.focus();a.previous=i;setTimeout(function(){a.previous=i;a.selectedItem=h},1)}false!==a._trigger("select",c,{item:h})&&a.element.val(h.value);a.term=a.element.val();a.close(c);a.selectedItem=h},blur:function(){a.menu.element.is(":visible")&&a.element.val()!==a.term&&a.element.val(a.term)}}).zIndex(this.element.zIndex()+1).css({top:0,left:0}).hide().data("menu"); -d.fn.bgiframe&&this.menu.element.bgiframe()},destroy:function(){this.element.removeClass("ui-autocomplete-input").removeAttr("autocomplete").removeAttr("role").removeAttr("aria-autocomplete").removeAttr("aria-haspopup");this.menu.element.remove();d.Widget.prototype.destroy.call(this)},_setOption:function(a,b){d.Widget.prototype._setOption.apply(this,arguments);a==="source"&&this._initSource();if(a==="appendTo")this.menu.element.appendTo(d(b||"body",this.element[0].ownerDocument)[0]);a==="disabled"&& -b&&this.xhr&&this.xhr.abort()},_initSource:function(){var a=this,b,g;if(d.isArray(this.options.source)){b=this.options.source;this.source=function(c,f){f(d.ui.autocomplete.filter(b,c.term))}}else if(typeof this.options.source==="string"){g=this.options.source;this.source=function(c,f){a.xhr&&a.xhr.abort();a.xhr=d.ajax({url:g,data:c,dataType:"json",autocompleteRequest:++e,success:function(h){this.autocompleteRequest===e&&f(h)},error:function(){this.autocompleteRequest===e&&f([])}})}}else this.source= -this.options.source},search:function(a,b){a=a!=null?a:this.element.val();this.term=this.element.val();if(a.length").data("item.autocomplete",b).append(d("").text(b.label)).appendTo(a)},_move:function(a,b){if(this.menu.element.is(":visible"))if(this.menu.first()&&/^previous/.test(a)||this.menu.last()&&/^next/.test(a)){this.element.val(this.term);this.menu.deactivate()}else this.menu[a](b);else this.search(null,b)},widget:function(){return this.menu.element}});d.extend(d.ui.autocomplete,{escapeRegex:function(a){return a.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, -"\\$&")},filter:function(a,b){var g=new RegExp(d.ui.autocomplete.escapeRegex(b),"i");return d.grep(a,function(c){return g.test(c.label||c.value||c)})}})})(jQuery); -(function(d){d.widget("ui.menu",{_create:function(){var e=this;this.element.addClass("ui-menu ui-widget ui-widget-content ui-corner-all").attr({role:"listbox","aria-activedescendant":"ui-active-menuitem"}).click(function(a){if(d(a.target).closest(".ui-menu-item a").length){a.preventDefault();e.select(a)}});this.refresh()},refresh:function(){var e=this;this.element.children("li:not(.ui-menu-item):has(a)").addClass("ui-menu-item").attr("role","menuitem").children("a").addClass("ui-corner-all").attr("tabindex", --1).mouseenter(function(a){e.activate(a,d(this).parent())}).mouseleave(function(){e.deactivate()})},activate:function(e,a){this.deactivate();if(this.hasScroll()){var b=a.offset().top-this.element.offset().top,g=this.element.scrollTop(),c=this.element.height();if(b<0)this.element.scrollTop(g+b);else b>=c&&this.element.scrollTop(g+b-c+a.height())}this.active=a.eq(0).children("a").addClass("ui-state-hover").attr("id","ui-active-menuitem").end();this._trigger("focus",e,{item:a})},deactivate:function(){if(this.active){this.active.children("a").removeClass("ui-state-hover").removeAttr("id"); -this._trigger("blur");this.active=null}},next:function(e){this.move("next",".ui-menu-item:first",e)},previous:function(e){this.move("prev",".ui-menu-item:last",e)},first:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},last:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},move:function(e,a,b){if(this.active){e=this.active[e+"All"](".ui-menu-item").eq(0);e.length?this.activate(b,e):this.activate(b,this.element.children(a))}else this.activate(b, -this.element.children(a))},nextPage:function(e){if(this.hasScroll())if(!this.active||this.last())this.activate(e,this.element.children(".ui-menu-item:first"));else{var a=this.active.offset().top,b=this.element.height(),g=this.element.children(".ui-menu-item").filter(function(){var c=d(this).offset().top-a-b+d(this).height();return c<10&&c>-10});g.length||(g=this.element.children(".ui-menu-item:last"));this.activate(e,g)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| -this.last()?":first":":last"))},previousPage:function(e){if(this.hasScroll())if(!this.active||this.first())this.activate(e,this.element.children(".ui-menu-item:last"));else{var a=this.active.offset().top,b=this.element.height();result=this.element.children(".ui-menu-item").filter(function(){var g=d(this).offset().top-a+b-d(this).height();return g<10&&g>-10});result.length||(result=this.element.children(".ui-menu-item:first"));this.activate(e,result)}else this.activate(e,this.element.children(".ui-menu-item").filter(!this.active|| -this.first()?":last":":first"))},hasScroll:function(){return this.element.height()").addClass("ui-button-text").html(this.options.label).appendTo(a.empty()).text(),e=this.options.icons,f=e.primary&&e.secondary,d=[];if(e.primary||e.secondary){if(this.options.text)d.push("ui-button-text-icon"+(f?"s":e.primary?"-primary":"-secondary"));e.primary&&a.prepend("");e.secondary&&a.append("");if(!this.options.text){d.push(f?"ui-button-icons-only": -"ui-button-icon-only");this.hasTitle||a.attr("title",c)}}else d.push("ui-button-text-only");a.addClass(d.join(" "))}}});b.widget("ui.buttonset",{options:{items:":button, :submit, :reset, :checkbox, :radio, a, :data(button)"},_create:function(){this.element.addClass("ui-buttonset")},_init:function(){this.refresh()},_setOption:function(a,c){a==="disabled"&&this.buttons.button("option",a,c);b.Widget.prototype._setOption.apply(this,arguments)},refresh:function(){var a=this.element.css("direction")=== -"ltr";this.buttons=this.element.find(this.options.items).filter(":ui-button").button("refresh").end().not(":ui-button").button().end().map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-all ui-corner-left ui-corner-right").filter(":first").addClass(a?"ui-corner-left":"ui-corner-right").end().filter(":last").addClass(a?"ui-corner-right":"ui-corner-left").end().end()},destroy:function(){this.element.removeClass("ui-buttonset");this.buttons.map(function(){return b(this).button("widget")[0]}).removeClass("ui-corner-left ui-corner-right").end().button("destroy"); -b.Widget.prototype.destroy.call(this)}})})(jQuery); -;/* - * jQuery UI Dialog 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Dialog - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - * jquery.ui.button.js - * jquery.ui.draggable.js - * jquery.ui.mouse.js - * jquery.ui.position.js - * jquery.ui.resizable.js - */ -(function(c,l){var m={buttons:true,height:true,maxHeight:true,maxWidth:true,minHeight:true,minWidth:true,width:true},n={maxHeight:true,maxWidth:true,minHeight:true,minWidth:true},o=c.attrFn||{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true,click:true};c.widget("ui.dialog",{options:{autoOpen:true,buttons:{},closeOnEscape:true,closeText:"close",dialogClass:"",draggable:true,hide:null,height:"auto",maxHeight:false,maxWidth:false,minHeight:150,minWidth:150,modal:false, -position:{my:"center",at:"center",collision:"fit",using:function(a){var b=c(this).css(a).offset().top;b<0&&c(this).css("top",a.top-b)}},resizable:true,show:null,stack:true,title:"",width:300,zIndex:1E3},_create:function(){this.originalTitle=this.element.attr("title");if(typeof this.originalTitle!=="string")this.originalTitle="";this.options.title=this.options.title||this.originalTitle;var a=this,b=a.options,d=b.title||" ",e=c.ui.dialog.getTitleId(a.element),g=(a.uiDialog=c("
      ")).appendTo(document.body).hide().addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+ -b.dialogClass).css({zIndex:b.zIndex}).attr("tabIndex",-1).css("outline",0).keydown(function(i){if(b.closeOnEscape&&i.keyCode&&i.keyCode===c.ui.keyCode.ESCAPE){a.close(i);i.preventDefault()}}).attr({role:"dialog","aria-labelledby":e}).mousedown(function(i){a.moveToTop(false,i)});a.element.show().removeAttr("title").addClass("ui-dialog-content ui-widget-content").appendTo(g);var f=(a.uiDialogTitlebar=c("
      ")).addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").prependTo(g), -h=c('').addClass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").hover(function(){h.addClass("ui-state-hover")},function(){h.removeClass("ui-state-hover")}).focus(function(){h.addClass("ui-state-focus")}).blur(function(){h.removeClass("ui-state-focus")}).click(function(i){a.close(i);return false}).appendTo(f);(a.uiDialogTitlebarCloseText=c("")).addClass("ui-icon ui-icon-closethick").text(b.closeText).appendTo(h);c("").addClass("ui-dialog-title").attr("id", -e).html(d).prependTo(f);if(c.isFunction(b.beforeclose)&&!c.isFunction(b.beforeClose))b.beforeClose=b.beforeclose;f.find("*").add(f).disableSelection();b.draggable&&c.fn.draggable&&a._makeDraggable();b.resizable&&c.fn.resizable&&a._makeResizable();a._createButtons(b.buttons);a._isOpen=false;c.fn.bgiframe&&g.bgiframe()},_init:function(){this.options.autoOpen&&this.open()},destroy:function(){var a=this;a.overlay&&a.overlay.destroy();a.uiDialog.hide();a.element.unbind(".dialog").removeData("dialog").removeClass("ui-dialog-content ui-widget-content").hide().appendTo("body"); -a.uiDialog.remove();a.originalTitle&&a.element.attr("title",a.originalTitle);return a},widget:function(){return this.uiDialog},close:function(a){var b=this,d,e;if(false!==b._trigger("beforeClose",a)){b.overlay&&b.overlay.destroy();b.uiDialog.unbind("keypress.ui-dialog");b._isOpen=false;if(b.options.hide)b.uiDialog.hide(b.options.hide,function(){b._trigger("close",a)});else{b.uiDialog.hide();b._trigger("close",a)}c.ui.dialog.overlay.resize();if(b.options.modal){d=0;c(".ui-dialog").each(function(){if(this!== -b.uiDialog[0]){e=c(this).css("z-index");isNaN(e)||(d=Math.max(d,e))}});c.ui.dialog.maxZ=d}return b}},isOpen:function(){return this._isOpen},moveToTop:function(a,b){var d=this,e=d.options;if(e.modal&&!a||!e.stack&&!e.modal)return d._trigger("focus",b);if(e.zIndex>c.ui.dialog.maxZ)c.ui.dialog.maxZ=e.zIndex;if(d.overlay){c.ui.dialog.maxZ+=1;d.overlay.$el.css("z-index",c.ui.dialog.overlay.maxZ=c.ui.dialog.maxZ)}a={scrollTop:d.element.attr("scrollTop"),scrollLeft:d.element.attr("scrollLeft")};c.ui.dialog.maxZ+= -1;d.uiDialog.css("z-index",c.ui.dialog.maxZ);d.element.attr(a);d._trigger("focus",b);return d},open:function(){if(!this._isOpen){var a=this,b=a.options,d=a.uiDialog;a.overlay=b.modal?new c.ui.dialog.overlay(a):null;a._size();a._position(b.position);d.show(b.show);a.moveToTop(true);b.modal&&d.bind("keypress.ui-dialog",function(e){if(e.keyCode===c.ui.keyCode.TAB){var g=c(":tabbable",this),f=g.filter(":first");g=g.filter(":last");if(e.target===g[0]&&!e.shiftKey){f.focus(1);return false}else if(e.target=== -f[0]&&e.shiftKey){g.focus(1);return false}}});c(a.element.find(":tabbable").get().concat(d.find(".ui-dialog-buttonpane :tabbable").get().concat(d.get()))).eq(0).focus();a._isOpen=true;a._trigger("open");return a}},_createButtons:function(a){var b=this,d=false,e=c("
      ").addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),g=c("
      ").addClass("ui-dialog-buttonset").appendTo(e);b.uiDialog.find(".ui-dialog-buttonpane").remove();typeof a==="object"&&a!==null&&c.each(a, -function(){return!(d=true)});if(d){c.each(a,function(f,h){h=c.isFunction(h)?{click:h,text:f}:h;var i=c('').click(function(){h.click.apply(b.element[0],arguments)}).appendTo(g);c.each(h,function(j,k){if(j!=="click")j in o?i[j](k):i.attr(j,k)});c.fn.button&&i.button()});e.appendTo(b.uiDialog)}},_makeDraggable:function(){function a(f){return{position:f.position,offset:f.offset}}var b=this,d=b.options,e=c(document),g;b.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close", -handle:".ui-dialog-titlebar",containment:"document",start:function(f,h){g=d.height==="auto"?"auto":c(this).height();c(this).height(c(this).height()).addClass("ui-dialog-dragging");b._trigger("dragStart",f,a(h))},drag:function(f,h){b._trigger("drag",f,a(h))},stop:function(f,h){d.position=[h.position.left-e.scrollLeft(),h.position.top-e.scrollTop()];c(this).removeClass("ui-dialog-dragging").height(g);b._trigger("dragStop",f,a(h));c.ui.dialog.overlay.resize()}})},_makeResizable:function(a){function b(f){return{originalPosition:f.originalPosition, -originalSize:f.originalSize,position:f.position,size:f.size}}a=a===l?this.options.resizable:a;var d=this,e=d.options,g=d.uiDialog.css("position");a=typeof a==="string"?a:"n,e,s,w,se,sw,ne,nw";d.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:d.element,maxWidth:e.maxWidth,maxHeight:e.maxHeight,minWidth:e.minWidth,minHeight:d._minHeight(),handles:a,start:function(f,h){c(this).addClass("ui-dialog-resizing");d._trigger("resizeStart",f,b(h))},resize:function(f,h){d._trigger("resize", -f,b(h))},stop:function(f,h){c(this).removeClass("ui-dialog-resizing");e.height=c(this).height();e.width=c(this).width();d._trigger("resizeStop",f,b(h));c.ui.dialog.overlay.resize()}}).css("position",g).find(".ui-resizable-se").addClass("ui-icon ui-icon-grip-diagonal-se")},_minHeight:function(){var a=this.options;return a.height==="auto"?a.minHeight:Math.min(a.minHeight,a.height)},_position:function(a){var b=[],d=[0,0],e;if(a){if(typeof a==="string"||typeof a==="object"&&"0"in a){b=a.split?a.split(" "): -[a[0],a[1]];if(b.length===1)b[1]=b[0];c.each(["left","top"],function(g,f){if(+b[g]===b[g]){d[g]=b[g];b[g]=f}});a={my:b.join(" "),at:b.join(" "),offset:d.join(" ")}}a=c.extend({},c.ui.dialog.prototype.options.position,a)}else a=c.ui.dialog.prototype.options.position;(e=this.uiDialog.is(":visible"))||this.uiDialog.show();this.uiDialog.css({top:0,left:0}).position(c.extend({of:window},a));e||this.uiDialog.hide()},_setOptions:function(a){var b=this,d={},e=false;c.each(a,function(g,f){b._setOption(g,f); -if(g in m)e=true;if(g in n)d[g]=f});e&&this._size();this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option",d)},_setOption:function(a,b){var d=this,e=d.uiDialog;switch(a){case "beforeclose":a="beforeClose";break;case "buttons":d._createButtons(b);break;case "closeText":d.uiDialogTitlebarCloseText.text(""+b);break;case "dialogClass":e.removeClass(d.options.dialogClass).addClass("ui-dialog ui-widget ui-widget-content ui-corner-all "+b);break;case "disabled":b?e.addClass("ui-dialog-disabled"): -e.removeClass("ui-dialog-disabled");break;case "draggable":var g=e.is(":data(draggable)");g&&!b&&e.draggable("destroy");!g&&b&&d._makeDraggable();break;case "position":d._position(b);break;case "resizable":(g=e.is(":data(resizable)"))&&!b&&e.resizable("destroy");g&&typeof b==="string"&&e.resizable("option","handles",b);!g&&b!==false&&d._makeResizable(b);break;case "title":c(".ui-dialog-title",d.uiDialogTitlebar).html(""+(b||" "));break}c.Widget.prototype._setOption.apply(d,arguments)},_size:function(){var a= -this.options,b,d,e=this.uiDialog.is(":visible");this.element.show().css({width:"auto",minHeight:0,height:0});if(a.minWidth>a.width)a.width=a.minWidth;b=this.uiDialog.css({height:"auto",width:a.width}).height();d=Math.max(0,a.minHeight-b);if(a.height==="auto")if(c.support.minHeight)this.element.css({minHeight:d,height:"auto"});else{this.uiDialog.show();a=this.element.css("height","auto").height();e||this.uiDialog.hide();this.element.height(Math.max(a,d))}else this.element.height(Math.max(a.height- -b,0));this.uiDialog.is(":data(resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())}});c.extend(c.ui.dialog,{version:"1.8.14",uuid:0,maxZ:0,getTitleId:function(a){a=a.attr("id");if(!a){this.uuid+=1;a=this.uuid}return"ui-dialog-title-"+a},overlay:function(a){this.$el=c.ui.dialog.overlay.create(a)}});c.extend(c.ui.dialog.overlay,{instances:[],oldInstances:[],maxZ:0,events:c.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(a){return a+".dialog-overlay"}).join(" "), -create:function(a){if(this.instances.length===0){setTimeout(function(){c.ui.dialog.overlay.instances.length&&c(document).bind(c.ui.dialog.overlay.events,function(d){if(c(d.target).zIndex()").addClass("ui-widget-overlay")).appendTo(document.body).css({width:this.width(), -height:this.height()});c.fn.bgiframe&&b.bgiframe();this.instances.push(b);return b},destroy:function(a){var b=c.inArray(a,this.instances);b!=-1&&this.oldInstances.push(this.instances.splice(b,1)[0]);this.instances.length===0&&c([document,window]).unbind(".dialog-overlay");a.remove();var d=0;c.each(this.instances,function(){d=Math.max(d,this.css("z-index"))});this.maxZ=d},height:function(){var a,b;if(c.browser.msie&&c.browser.version<7){a=Math.max(document.documentElement.scrollHeight,document.body.scrollHeight); -b=Math.max(document.documentElement.offsetHeight,document.body.offsetHeight);return a").appendTo(this.element).addClass("ui-slider-range ui-widget-header"+(a.range==="min"||a.range==="max"?" ui-slider-range-"+a.range:""))}for(var j=c.length;j"); -this.handles=c.add(d(e.join("")).appendTo(b.element));this.handle=this.handles.eq(0);this.handles.add(this.range).filter("a").click(function(g){g.preventDefault()}).hover(function(){a.disabled||d(this).addClass("ui-state-hover")},function(){d(this).removeClass("ui-state-hover")}).focus(function(){if(a.disabled)d(this).blur();else{d(".ui-slider .ui-state-focus").removeClass("ui-state-focus");d(this).addClass("ui-state-focus")}}).blur(function(){d(this).removeClass("ui-state-focus")});this.handles.each(function(g){d(this).data("index.ui-slider-handle", -g)});this.handles.keydown(function(g){var k=true,l=d(this).data("index.ui-slider-handle"),i,h,m;if(!b.options.disabled){switch(g.keyCode){case d.ui.keyCode.HOME:case d.ui.keyCode.END:case d.ui.keyCode.PAGE_UP:case d.ui.keyCode.PAGE_DOWN:case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:k=false;if(!b._keySliding){b._keySliding=true;d(this).addClass("ui-state-active");i=b._start(g,l);if(i===false)return}break}m=b.options.step;i=b.options.values&&b.options.values.length? -(h=b.values(l)):(h=b.value());switch(g.keyCode){case d.ui.keyCode.HOME:h=b._valueMin();break;case d.ui.keyCode.END:h=b._valueMax();break;case d.ui.keyCode.PAGE_UP:h=b._trimAlignValue(i+(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.PAGE_DOWN:h=b._trimAlignValue(i-(b._valueMax()-b._valueMin())/5);break;case d.ui.keyCode.UP:case d.ui.keyCode.RIGHT:if(i===b._valueMax())return;h=b._trimAlignValue(i+m);break;case d.ui.keyCode.DOWN:case d.ui.keyCode.LEFT:if(i===b._valueMin())return;h=b._trimAlignValue(i- -m);break}b._slide(g,l,h);return k}}).keyup(function(g){var k=d(this).data("index.ui-slider-handle");if(b._keySliding){b._keySliding=false;b._stop(g,k);b._change(g,k);d(this).removeClass("ui-state-active")}});this._refreshValue();this._animateOff=false},destroy:function(){this.handles.remove();this.range.remove();this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all").removeData("slider").unbind(".slider");this._mouseDestroy(); -return this},_mouseCapture:function(b){var a=this.options,c,f,e,j,g;if(a.disabled)return false;this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()};this.elementOffset=this.element.offset();c=this._normValueFromMouse({x:b.pageX,y:b.pageY});f=this._valueMax()-this._valueMin()+1;j=this;this.handles.each(function(k){var l=Math.abs(c-j.values(k));if(f>l){f=l;e=d(this);g=k}});if(a.range===true&&this.values(1)===a.min){g+=1;e=d(this.handles[g])}if(this._start(b,g)===false)return false; -this._mouseSliding=true;j._handleIndex=g;e.addClass("ui-state-active").focus();a=e.offset();this._clickOffset=!d(b.target).parents().andSelf().is(".ui-slider-handle")?{left:0,top:0}:{left:b.pageX-a.left-e.width()/2,top:b.pageY-a.top-e.height()/2-(parseInt(e.css("borderTopWidth"),10)||0)-(parseInt(e.css("borderBottomWidth"),10)||0)+(parseInt(e.css("marginTop"),10)||0)};this.handles.hasClass("ui-state-hover")||this._slide(b,g,c);return this._animateOff=true},_mouseStart:function(){return true},_mouseDrag:function(b){var a= -this._normValueFromMouse({x:b.pageX,y:b.pageY});this._slide(b,this._handleIndex,a);return false},_mouseStop:function(b){this.handles.removeClass("ui-state-active");this._mouseSliding=false;this._stop(b,this._handleIndex);this._change(b,this._handleIndex);this._clickOffset=this._handleIndex=null;return this._animateOff=false},_detectOrientation:function(){this.orientation=this.options.orientation==="vertical"?"vertical":"horizontal"},_normValueFromMouse:function(b){var a;if(this.orientation==="horizontal"){a= -this.elementSize.width;b=b.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)}else{a=this.elementSize.height;b=b.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)}a=b/a;if(a>1)a=1;if(a<0)a=0;if(this.orientation==="vertical")a=1-a;b=this._valueMax()-this._valueMin();return this._trimAlignValue(this._valueMin()+a*b)},_start:function(b,a){var c={handle:this.handles[a],value:this.value()};if(this.options.values&&this.options.values.length){c.value=this.values(a); -c.values=this.values()}return this._trigger("start",b,c)},_slide:function(b,a,c){var f;if(this.options.values&&this.options.values.length){f=this.values(a?0:1);if(this.options.values.length===2&&this.options.range===true&&(a===0&&c>f||a===1&&c1){this.options.values[b]=this._trimAlignValue(a);this._refreshValue();this._change(null,b)}else if(arguments.length)if(d.isArray(arguments[0])){c=this.options.values;f=arguments[0];for(e=0;e=this._valueMax())return this._valueMax();var a=this.options.step>0?this.options.step:1,c=(b-this._valueMin())%a;alignValue=b-c;if(Math.abs(c)*2>=a)alignValue+=c>0?a:-a;return parseFloat(alignValue.toFixed(5))},_valueMin:function(){return this.options.min},_valueMax:function(){return this.options.max}, -_refreshValue:function(){var b=this.options.range,a=this.options,c=this,f=!this._animateOff?a.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},a.animate); -if(h===1)c.range[f?"animate":"css"]({width:e-g+"%"},{queue:false,duration:a.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},a.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:a.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1, -1)[f?"animate":"css"]({width:e+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.14"})})(jQuery); -;/* - * jQuery UI Tabs 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Tabs - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"
      ",remove:null,select:null,show:null,spinner:"Loading…",tabTemplate:"
    • #{label}
    • "},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&& -e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b= -d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]|| -(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all"); -this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected= -this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active"); -if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected")); -this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+ -g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal", -function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")}; -this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected= --1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier."; -d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e= -d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, -e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); -j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove(); -if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null, -this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this}, -load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c, -"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this}, -url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.14"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k'))}function N(a){return a.bind("mouseout",function(b){b= -d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");b.length&&b.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(b){b=d(b.target).closest("button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a");if(!(d.datepicker._isDisabledDatepicker(J.inline?a.parent()[0]:J.input[0])||!b.length)){b.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");b.addClass("ui-state-hover"); -b.hasClass("ui-datepicker-prev")&&b.addClass("ui-datepicker-prev-hover");b.hasClass("ui-datepicker-next")&&b.addClass("ui-datepicker-next-hover")}})}function H(a,b){d.extend(a,b);for(var c in b)if(b[c]==null||b[c]==C)a[c]=b[c];return a}d.extend(d.ui,{datepicker:{version:"1.8.14"}});var A=(new Date).getTime(),J;d.extend(M.prototype,{markerClassName:"hasDatepicker",maxRows:4,log:function(){this.debug&&console.log.apply("",arguments)},_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(a){H(this._defaults, -a||{});return this},_attachDatepicker:function(a,b){var c=null;for(var e in this._defaults){var f=a.getAttribute("date:"+e);if(f){c=c||{};try{c[e]=eval(f)}catch(h){c[e]=f}}}e=a.nodeName.toLowerCase();f=e=="div"||e=="span";if(!a.id){this.uuid+=1;a.id="dp"+this.uuid}var i=this._newInst(d(a),f);i.settings=d.extend({},b||{},c||{});if(e=="input")this._connectDatepicker(a,i);else f&&this._inlineDatepicker(a,i)},_newInst:function(a,b){return{id:a[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\$1"),input:a,selectedDay:0, -selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:b,dpDiv:!b?this.dpDiv:N(d('
      '))}},_connectDatepicker:function(a,b){var c=d(a);b.append=d([]);b.trigger=d([]);if(!c.hasClass(this.markerClassName)){this._attachments(c,b);c.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(e,f,h){b.settings[f]= -h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});this._autoSize(b);d.data(a,"datepicker",b)}},_attachments:function(a,b){var c=this._get(b,"appendText"),e=this._get(b,"isRTL");b.append&&b.append.remove();if(c){b.append=d(''+c+"");a[e?"before":"after"](b.append)}a.unbind("focus",this._showDatepicker);b.trigger&&b.trigger.remove();c=this._get(b,"showOn");if(c=="focus"||c=="both")a.focus(this._showDatepicker);if(c=="button"||c=="both"){c= -this._get(b,"buttonText");var f=this._get(b,"buttonImage");b.trigger=d(this._get(b,"buttonImageOnly")?d("").addClass(this._triggerClass).attr({src:f,alt:c,title:c}):d('').addClass(this._triggerClass).html(f==""?c:d("").attr({src:f,alt:c,title:c})));a[e?"before":"after"](b.trigger);b.trigger.click(function(){d.datepicker._datepickerShowing&&d.datepicker._lastInput==a[0]?d.datepicker._hideDatepicker():d.datepicker._showDatepicker(a[0]);return false})}},_autoSize:function(a){if(this._get(a, -"autoSize")&&!a.inline){var b=new Date(2009,11,20),c=this._get(a,"dateFormat");if(c.match(/[DM]/)){var e=function(f){for(var h=0,i=0,g=0;gh){h=f[g].length;i=g}return i};b.setMonth(e(this._get(a,c.match(/MM/)?"monthNames":"monthNamesShort")));b.setDate(e(this._get(a,c.match(/DD/)?"dayNames":"dayNamesShort"))+20-b.getDay())}a.input.attr("size",this._formatDate(a,b).length)}},_inlineDatepicker:function(a,b){var c=d(a);if(!c.hasClass(this.markerClassName)){c.addClass(this.markerClassName).append(b.dpDiv).bind("setData.datepicker", -function(e,f,h){b.settings[f]=h}).bind("getData.datepicker",function(e,f){return this._get(b,f)});d.data(a,"datepicker",b);this._setDate(b,this._getDefaultDate(b),true);this._updateDatepicker(b);this._updateAlternate(b);b.dpDiv.show()}},_dialogDatepicker:function(a,b,c,e,f){a=this._dialogInst;if(!a){this.uuid+=1;this._dialogInput=d('');this._dialogInput.keydown(this._doKeyDown);d("body").append(this._dialogInput); -a=this._dialogInst=this._newInst(this._dialogInput,false);a.settings={};d.data(this._dialogInput[0],"datepicker",a)}H(a.settings,e||{});b=b&&b.constructor==Date?this._formatDate(a,b):b;this._dialogInput.val(b);this._pos=f?f.length?f:[f.pageX,f.pageY]:null;if(!this._pos)this._pos=[document.documentElement.clientWidth/2-100+(document.documentElement.scrollLeft||document.body.scrollLeft),document.documentElement.clientHeight/2-150+(document.documentElement.scrollTop||document.body.scrollTop)];this._dialogInput.css("left", -this._pos[0]+20+"px").css("top",this._pos[1]+"px");a.settings.onSelect=c;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);d.blockUI&&d.blockUI(this.dpDiv);d.data(this._dialogInput[0],"datepicker",a);return this},_destroyDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();d.removeData(a,"datepicker");if(e=="input"){c.append.remove();c.trigger.remove();b.removeClass(this.markerClassName).unbind("focus", -this._showDatepicker).unbind("keydown",this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else if(e=="div"||e=="span")b.removeClass(this.markerClassName).empty()}},_enableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=false;c.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else if(e=="div"||e=="span"){b= -b.children("."+this._inlineClass);b.children().removeClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f})}},_disableDatepicker:function(a){var b=d(a),c=d.data(a,"datepicker");if(b.hasClass(this.markerClassName)){var e=a.nodeName.toLowerCase();if(e=="input"){a.disabled=true;c.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5", -cursor:"default"})}else if(e=="div"||e=="span"){b=b.children("."+this._inlineClass);b.children().addClass("ui-state-disabled");b.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}this._disabledInputs=d.map(this._disabledInputs,function(f){return f==a?null:f});this._disabledInputs[this._disabledInputs.length]=a}},_isDisabledDatepicker:function(a){if(!a)return false;for(var b=0;b-1}},_doKeyUp:function(a){a=d.datepicker._getInst(a.target);if(a.input.val()!=a.lastVal)try{if(d.datepicker.parseDate(d.datepicker._get(a,"dateFormat"),a.input?a.input.val():null,d.datepicker._getFormatConfig(a))){d.datepicker._setDateFromField(a); -d.datepicker._updateAlternate(a);d.datepicker._updateDatepicker(a)}}catch(b){d.datepicker.log(b)}return true},_showDatepicker:function(a){a=a.target||a;if(a.nodeName.toLowerCase()!="input")a=d("input",a.parentNode)[0];if(!(d.datepicker._isDisabledDatepicker(a)||d.datepicker._lastInput==a)){var b=d.datepicker._getInst(a);if(d.datepicker._curInst&&d.datepicker._curInst!=b){d.datepicker._datepickerShowing&&d.datepicker._triggerOnClose(d.datepicker._curInst);d.datepicker._curInst.dpDiv.stop(true,true)}var c= -d.datepicker._get(b,"beforeShow");H(b.settings,c?c.apply(a,[a,b]):{});b.lastVal=null;d.datepicker._lastInput=a;d.datepicker._setDateFromField(b);if(d.datepicker._inDialog)a.value="";if(!d.datepicker._pos){d.datepicker._pos=d.datepicker._findPos(a);d.datepicker._pos[1]+=a.offsetHeight}var e=false;d(a).parents().each(function(){e|=d(this).css("position")=="fixed";return!e});if(e&&d.browser.opera){d.datepicker._pos[0]-=document.documentElement.scrollLeft;d.datepicker._pos[1]-=document.documentElement.scrollTop}c= -{left:d.datepicker._pos[0],top:d.datepicker._pos[1]};d.datepicker._pos=null;b.dpDiv.empty();b.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});d.datepicker._updateDatepicker(b);c=d.datepicker._checkOffset(b,c,e);b.dpDiv.css({position:d.datepicker._inDialog&&d.blockUI?"static":e?"fixed":"absolute",display:"none",left:c.left+"px",top:c.top+"px"});if(!b.inline){c=d.datepicker._get(b,"showAnim");var f=d.datepicker._get(b,"duration"),h=function(){var i=b.dpDiv.find("iframe.ui-datepicker-cover"); -if(i.length){var g=d.datepicker._getBorders(b.dpDiv);i.css({left:-g[0],top:-g[1],width:b.dpDiv.outerWidth(),height:b.dpDiv.outerHeight()})}};b.dpDiv.zIndex(d(a).zIndex()+1);d.datepicker._datepickerShowing=true;d.effects&&d.effects[c]?b.dpDiv.show(c,d.datepicker._get(b,"showOptions"),f,h):b.dpDiv[c||"show"](c?f:null,h);if(!c||!f)h();b.input.is(":visible")&&!b.input.is(":disabled")&&b.input.focus();d.datepicker._curInst=b}}},_updateDatepicker:function(a){this.maxRows=4;var b=d.datepicker._getBorders(a.dpDiv); -J=a;a.dpDiv.empty().append(this._generateHTML(a));var c=a.dpDiv.find("iframe.ui-datepicker-cover");c.length&&c.css({left:-b[0],top:-b[1],width:a.dpDiv.outerWidth(),height:a.dpDiv.outerHeight()});a.dpDiv.find("."+this._dayOverClass+" a").mouseover();b=this._getNumberOfMonths(a);c=b[1];a.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");c>1&&a.dpDiv.addClass("ui-datepicker-multi-"+c).css("width",17*c+"em");a.dpDiv[(b[0]!=1||b[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi"); -a.dpDiv[(this._get(a,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");a==d.datepicker._curInst&&d.datepicker._datepickerShowing&&a.input&&a.input.is(":visible")&&!a.input.is(":disabled")&&a.input[0]!=document.activeElement&&a.input.focus();if(a.yearshtml){var e=a.yearshtml;setTimeout(function(){e===a.yearshtml&&a.yearshtml&&a.dpDiv.find("select.ui-datepicker-year:first").replaceWith(a.yearshtml);e=a.yearshtml=null},0)}},_getBorders:function(a){var b=function(c){return{thin:1,medium:2,thick:3}[c]|| -c};return[parseFloat(b(a.css("border-left-width"))),parseFloat(b(a.css("border-top-width")))]},_checkOffset:function(a,b,c){var e=a.dpDiv.outerWidth(),f=a.dpDiv.outerHeight(),h=a.input?a.input.outerWidth():0,i=a.input?a.input.outerHeight():0,g=document.documentElement.clientWidth+d(document).scrollLeft(),j=document.documentElement.clientHeight+d(document).scrollTop();b.left-=this._get(a,"isRTL")?e-h:0;b.left-=c&&b.left==a.input.offset().left?d(document).scrollLeft():0;b.top-=c&&b.top==a.input.offset().top+ -i?d(document).scrollTop():0;b.left-=Math.min(b.left,b.left+e>g&&g>e?Math.abs(b.left+e-g):0);b.top-=Math.min(b.top,b.top+f>j&&j>f?Math.abs(f+i):0);return b},_findPos:function(a){for(var b=this._get(this._getInst(a),"isRTL");a&&(a.type=="hidden"||a.nodeType!=1||d.expr.filters.hidden(a));)a=a[b?"previousSibling":"nextSibling"];a=d(a).offset();return[a.left,a.top]},_triggerOnClose:function(a){var b=this._get(a,"onClose");if(b)b.apply(a.input?a.input[0]:null,[a.input?a.input.val():"",a])},_hideDatepicker:function(a){var b= -this._curInst;if(!(!b||a&&b!=d.data(a,"datepicker")))if(this._datepickerShowing){a=this._get(b,"showAnim");var c=this._get(b,"duration"),e=function(){d.datepicker._tidyDialog(b);this._curInst=null};d.effects&&d.effects[a]?b.dpDiv.hide(a,d.datepicker._get(b,"showOptions"),c,e):b.dpDiv[a=="slideDown"?"slideUp":a=="fadeIn"?"fadeOut":"hide"](a?c:null,e);a||e();d.datepicker._triggerOnClose(b);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute", -left:"0",top:"-100px"});if(d.blockUI){d.unblockUI();d("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(a){a.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(a){if(d.datepicker._curInst){a=d(a.target);a[0].id!=d.datepicker._mainDivId&&a.parents("#"+d.datepicker._mainDivId).length==0&&!a.hasClass(d.datepicker.markerClassName)&&!a.hasClass(d.datepicker._triggerClass)&&d.datepicker._datepickerShowing&&!(d.datepicker._inDialog&& -d.blockUI)&&d.datepicker._hideDatepicker()}},_adjustDate:function(a,b,c){a=d(a);var e=this._getInst(a[0]);if(!this._isDisabledDatepicker(a[0])){this._adjustInstDate(e,b+(c=="M"?this._get(e,"showCurrentAtPos"):0),c);this._updateDatepicker(e)}},_gotoToday:function(a){a=d(a);var b=this._getInst(a[0]);if(this._get(b,"gotoCurrent")&&b.currentDay){b.selectedDay=b.currentDay;b.drawMonth=b.selectedMonth=b.currentMonth;b.drawYear=b.selectedYear=b.currentYear}else{var c=new Date;b.selectedDay=c.getDate();b.drawMonth= -b.selectedMonth=c.getMonth();b.drawYear=b.selectedYear=c.getFullYear()}this._notifyChange(b);this._adjustDate(a)},_selectMonthYear:function(a,b,c){a=d(a);var e=this._getInst(a[0]);e._selectingMonthYear=false;e["selected"+(c=="M"?"Month":"Year")]=e["draw"+(c=="M"?"Month":"Year")]=parseInt(b.options[b.selectedIndex].value,10);this._notifyChange(e);this._adjustDate(a)},_clickMonthYear:function(a){var b=this._getInst(d(a)[0]);b.input&&b._selectingMonthYear&&setTimeout(function(){b.input.focus()},0);b._selectingMonthYear= -!b._selectingMonthYear},_selectDay:function(a,b,c,e){var f=d(a);if(!(d(e).hasClass(this._unselectableClass)||this._isDisabledDatepicker(f[0]))){f=this._getInst(f[0]);f.selectedDay=f.currentDay=d("a",e).html();f.selectedMonth=f.currentMonth=b;f.selectedYear=f.currentYear=c;this._selectDate(a,this._formatDate(f,f.currentDay,f.currentMonth,f.currentYear))}},_clearDate:function(a){a=d(a);this._getInst(a[0]);this._selectDate(a,"")},_selectDate:function(a,b){a=this._getInst(d(a)[0]);b=b!=null?b:this._formatDate(a); -a.input&&a.input.val(b);this._updateAlternate(a);var c=this._get(a,"onSelect");if(c)c.apply(a.input?a.input[0]:null,[b,a]);else a.input&&a.input.trigger("change");if(a.inline)this._updateDatepicker(a);else{this._hideDatepicker();this._lastInput=a.input[0];typeof a.input[0]!="object"&&a.input.focus();this._lastInput=null}},_updateAlternate:function(a){var b=this._get(a,"altField");if(b){var c=this._get(a,"altFormat")||this._get(a,"dateFormat"),e=this._getDate(a),f=this.formatDate(c,e,this._getFormatConfig(a)); -d(b).each(function(){d(this).val(f)})}},noWeekends:function(a){a=a.getDay();return[a>0&&a<6,""]},iso8601Week:function(a){a=new Date(a.getTime());a.setDate(a.getDate()+4-(a.getDay()||7));var b=a.getTime();a.setMonth(0);a.setDate(1);return Math.floor(Math.round((b-a)/864E5)/7)+1},parseDate:function(a,b,c){if(a==null||b==null)throw"Invalid arguments";b=typeof b=="object"?b.toString():b+"";if(b=="")return null;var e=(c?c.shortYearCutoff:null)||this._defaults.shortYearCutoff;e=typeof e!="string"?e:(new Date).getFullYear()% -100+parseInt(e,10);for(var f=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,h=(c?c.dayNames:null)||this._defaults.dayNames,i=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort,g=(c?c.monthNames:null)||this._defaults.monthNames,j=c=-1,l=-1,u=-1,k=false,o=function(p){(p=B+1-1){j=1;l=u;do{e=this._getDaysInMonth(c,j-1);if(l<=e)break;j++;l-=e}while(1)}v=this._daylightSavingAdjust(new Date(c,j-1,l));if(v.getFullYear()!=c||v.getMonth()+1!=j||v.getDate()!=l)throw"Invalid date";return v},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y", -TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*24*60*60*1E7,formatDate:function(a,b,c){if(!b)return"";var e=(c?c.dayNamesShort:null)||this._defaults.dayNamesShort,f=(c?c.dayNames:null)||this._defaults.dayNames,h=(c?c.monthNamesShort:null)||this._defaults.monthNamesShort;c=(c?c.monthNames:null)||this._defaults.monthNames;var i=function(o){(o=k+112?a.getHours()+2:0);return a},_setDate:function(a,b,c){var e=!b,f=a.selectedMonth,h=a.selectedYear;b=this._restrictMinMax(a,this._determineDate(a,b,new Date));a.selectedDay= -a.currentDay=b.getDate();a.drawMonth=a.selectedMonth=a.currentMonth=b.getMonth();a.drawYear=a.selectedYear=a.currentYear=b.getFullYear();if((f!=a.selectedMonth||h!=a.selectedYear)&&!c)this._notifyChange(a);this._adjustInstDate(a);if(a.input)a.input.val(e?"":this._formatDate(a))},_getDate:function(a){return!a.currentYear||a.input&&a.input.val()==""?null:this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay))},_generateHTML:function(a){var b=new Date;b=this._daylightSavingAdjust(new Date(b.getFullYear(), -b.getMonth(),b.getDate()));var c=this._get(a,"isRTL"),e=this._get(a,"showButtonPanel"),f=this._get(a,"hideIfNoPrevNext"),h=this._get(a,"navigationAsDateFormat"),i=this._getNumberOfMonths(a),g=this._get(a,"showCurrentAtPos"),j=this._get(a,"stepMonths"),l=i[0]!=1||i[1]!=1,u=this._daylightSavingAdjust(!a.currentDay?new Date(9999,9,9):new Date(a.currentYear,a.currentMonth,a.currentDay)),k=this._getMinMaxDate(a,"min"),o=this._getMinMaxDate(a,"max");g=a.drawMonth-g;var m=a.drawYear;if(g<0){g+=12;m--}if(o){var n= -this._daylightSavingAdjust(new Date(o.getFullYear(),o.getMonth()-i[0]*i[1]+1,o.getDate()));for(n=k&&nn;){g--;if(g<0){g=11;m--}}}a.drawMonth=g;a.drawYear=m;n=this._get(a,"prevText");n=!h?n:this.formatDate(n,this._daylightSavingAdjust(new Date(m,g-j,1)),this._getFormatConfig(a));n=this._canAdjustMonth(a,-1,m,g)?''+n+"":f?"":''+n+"";var s=this._get(a,"nextText");s=!h?s:this.formatDate(s,this._daylightSavingAdjust(new Date(m,g+j,1)),this._getFormatConfig(a));f=this._canAdjustMonth(a,+1,m,g)?''+s+"":f?"":''+s+"";j=this._get(a,"currentText");s=this._get(a,"gotoCurrent")&&a.currentDay?u:b;j=!h?j:this.formatDate(j,s,this._getFormatConfig(a));h=!a.inline?'":"";e=e?'
      '+(c?h:"")+(this._isInRange(a,s)?'":"")+(c?"":h)+"
      ":"";h=parseInt(this._get(a,"firstDay"),10);h=isNaN(h)?0:h;j=this._get(a,"showWeek");s=this._get(a,"dayNames");this._get(a,"dayNamesShort");var q=this._get(a,"dayNamesMin"),B= -this._get(a,"monthNames"),v=this._get(a,"monthNamesShort"),p=this._get(a,"beforeShowDay"),D=this._get(a,"showOtherMonths"),K=this._get(a,"selectOtherMonths");this._get(a,"calculateWeek");for(var E=this._getDefaultDate(a),w="",x=0;x1)switch(G){case 0:y+=" ui-datepicker-group-first";t=" ui-corner-"+(c?"right": -"left");break;case i[1]-1:y+=" ui-datepicker-group-last";t=" ui-corner-"+(c?"left":"right");break;default:y+=" ui-datepicker-group-middle";t="";break}y+='">'}y+='
      '+(/all|left/.test(t)&&x==0?c?f:n:"")+(/all|right/.test(t)&&x==0?c?n:f:"")+this._generateMonthYearHeader(a,g,m,k,o,x>0||G>0,B,v)+'
      ';var z=j?'": -"";for(t=0;t<7;t++){var r=(t+h)%7;z+="=5?' class="ui-datepicker-week-end"':"")+'>'+q[r]+""}y+=z+"";z=this._getDaysInMonth(m,g);if(m==a.selectedYear&&g==a.selectedMonth)a.selectedDay=Math.min(a.selectedDay,z);t=(this._getFirstDayOfMonth(m,g)-h+7)%7;z=Math.ceil((t+z)/7);this.maxRows=z=l?this.maxRows>z?this.maxRows:z:z;r=this._daylightSavingAdjust(new Date(m,g,1-t));for(var Q=0;Q";var R=!j?"":'";for(t=0;t<7;t++){var I=p?p.apply(a.input?a.input[0]:null,[r]):[true,""],F=r.getMonth()!=g,L=F&&!K||!I[0]||k&&ro;R+='";r.setDate(r.getDate()+1);r=this._daylightSavingAdjust(r)}y+=R+""}g++;if(g>11){g=0;m++}y+="
      '+this._get(a,"weekHeader")+"
      '+ -this._get(a,"calculateWeek")(r)+""+(F&&!D?" ":L?''+r.getDate()+"":''+ -r.getDate()+"")+"
      "+(l?""+(i[0]>0&&G==i[1]-1?'
      ':""):"");O+=y}w+=O}w+=e+(d.browser.msie&&parseInt(d.browser.version,10)<7&&!a.inline?'':"");a._keyEvent=false;return w},_generateMonthYearHeader:function(a,b,c,e,f,h,i,g){var j=this._get(a,"changeMonth"), -l=this._get(a,"changeYear"),u=this._get(a,"showMonthAfterYear"),k='
      ',o="";if(h||!j)o+=''+i[b]+"";else{i=e&&e.getFullYear()==c;var m=f&&f.getFullYear()==c;o+='"}u||(k+=o+(h||!(j&&l)?" ":""));if(!a.yearshtml){a.yearshtml="";if(h||!l)k+=''+c+"";else{g=this._get(a,"yearRange").split(":");var s=(new Date).getFullYear();i=function(q){q=q.match(/c[+-].*/)?c+parseInt(q.substring(1),10):q.match(/[+-].*/)?s+parseInt(q,10):parseInt(q,10);return isNaN(q)?s:q};b=i(g[0]);g=Math.max(b,i(g[1]||""));b=e?Math.max(b,e.getFullYear()):b;g=f?Math.min(g,f.getFullYear()): -g;for(a.yearshtml+='";k+=a.yearshtml;a.yearshtml=null}}k+=this._get(a,"yearSuffix");if(u)k+=(h||!(j&&l)?" ":"")+o;k+="
      ";return k},_adjustInstDate:function(a,b,c){var e=a.drawYear+(c== -"Y"?b:0),f=a.drawMonth+(c=="M"?b:0);b=Math.min(a.selectedDay,this._getDaysInMonth(e,f))+(c=="D"?b:0);e=this._restrictMinMax(a,this._daylightSavingAdjust(new Date(e,f,b)));a.selectedDay=e.getDate();a.drawMonth=a.selectedMonth=e.getMonth();a.drawYear=a.selectedYear=e.getFullYear();if(c=="M"||c=="Y")this._notifyChange(a)},_restrictMinMax:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");b=c&&ba?a:b},_notifyChange:function(a){var b=this._get(a,"onChangeMonthYear"); -if(b)b.apply(a.input?a.input[0]:null,[a.selectedYear,a.selectedMonth+1,a])},_getNumberOfMonths:function(a){a=this._get(a,"numberOfMonths");return a==null?[1,1]:typeof a=="number"?[1,a]:a},_getMinMaxDate:function(a,b){return this._determineDate(a,this._get(a,b+"Date"),null)},_getDaysInMonth:function(a,b){return 32-this._daylightSavingAdjust(new Date(a,b,32)).getDate()},_getFirstDayOfMonth:function(a,b){return(new Date(a,b,1)).getDay()},_canAdjustMonth:function(a,b,c,e){var f=this._getNumberOfMonths(a); -c=this._daylightSavingAdjust(new Date(c,e+(b<0?b:f[0]*f[1]),1));b<0&&c.setDate(this._getDaysInMonth(c.getFullYear(),c.getMonth()));return this._isInRange(a,c)},_isInRange:function(a,b){var c=this._getMinMaxDate(a,"min");a=this._getMinMaxDate(a,"max");return(!c||b.getTime()>=c.getTime())&&(!a||b.getTime()<=a.getTime())},_getFormatConfig:function(a){var b=this._get(a,"shortYearCutoff");b=typeof b!="string"?b:(new Date).getFullYear()%100+parseInt(b,10);return{shortYearCutoff:b,dayNamesShort:this._get(a, -"dayNamesShort"),dayNames:this._get(a,"dayNames"),monthNamesShort:this._get(a,"monthNamesShort"),monthNames:this._get(a,"monthNames")}},_formatDate:function(a,b,c,e){if(!b){a.currentDay=a.selectedDay;a.currentMonth=a.selectedMonth;a.currentYear=a.selectedYear}b=b?typeof b=="object"?b:this._daylightSavingAdjust(new Date(e,c,b)):this._daylightSavingAdjust(new Date(a.currentYear,a.currentMonth,a.currentDay));return this.formatDate(this._get(a,"dateFormat"),b,this._getFormatConfig(a))}});d.fn.datepicker= -function(a){if(!this.length)return this;if(!d.datepicker.initialized){d(document).mousedown(d.datepicker._checkExternalClick).find("body").append(d.datepicker.dpDiv);d.datepicker.initialized=true}var b=Array.prototype.slice.call(arguments,1);if(typeof a=="string"&&(a=="isDisabled"||a=="getDate"||a=="widget"))return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this[0]].concat(b));if(a=="option"&&arguments.length==2&&typeof arguments[1]=="string")return d.datepicker["_"+a+"Datepicker"].apply(d.datepicker, -[this[0]].concat(b));return this.each(function(){typeof a=="string"?d.datepicker["_"+a+"Datepicker"].apply(d.datepicker,[this].concat(b)):d.datepicker._attachDatepicker(this,a)})};d.datepicker=new M;d.datepicker.initialized=false;d.datepicker.uuid=(new Date).getTime();d.datepicker.version="1.8.14";window["DP_jQuery_"+A]=d})(jQuery); -;/* - * jQuery UI Progressbar 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function(b,d){b.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()});this.valueDiv=b("
      ").appendTo(this.element);this.oldValue=this._value();this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"); -this.valueDiv.remove();b.Widget.prototype.destroy.apply(this,arguments)},value:function(a){if(a===d)return this._value();this._setOption("value",a);return this},_setOption:function(a,c){if(a==="value"){this.options.value=c;this._refreshValue();this._value()===this.options.max&&this._trigger("complete")}b.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;if(typeof a!=="number")a=0;return Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100* -this._value()/this.options.max},_refreshValue:function(){var a=this.value(),c=this._percentage();if(this.oldValue!==a){this.oldValue=a;this._trigger("change")}this.valueDiv.toggle(a>this.min).toggleClass("ui-corner-right",a===this.options.max).width(c.toFixed(0)+"%");this.element.attr("aria-valuenow",a)}});b.extend(b.ui.progressbar,{version:"1.8.14"})})(jQuery); -;/* - * jQuery UI Effects 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/ - */ -jQuery.effects||function(f,j){function m(c){var a;if(c&&c.constructor==Array&&c.length==3)return c;if(a=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(c))return[parseInt(a[1],10),parseInt(a[2],10),parseInt(a[3],10)];if(a=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(c))return[parseFloat(a[1])*2.55,parseFloat(a[2])*2.55,parseFloat(a[3])*2.55];if(a=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(c))return[parseInt(a[1], -16),parseInt(a[2],16),parseInt(a[3],16)];if(a=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(c))return[parseInt(a[1]+a[1],16),parseInt(a[2]+a[2],16),parseInt(a[3]+a[3],16)];if(/rgba\(0, 0, 0, 0\)/.exec(c))return n.transparent;return n[f.trim(c).toLowerCase()]}function s(c,a){var b;do{b=f.curCSS(c,a);if(b!=""&&b!="transparent"||f.nodeName(c,"body"))break;a="backgroundColor"}while(c=c.parentNode);return m(b)}function o(){var c=document.defaultView?document.defaultView.getComputedStyle(this,null):this.currentStyle, -a={},b,d;if(c&&c.length&&c[0]&&c[c[0]])for(var e=c.length;e--;){b=c[e];if(typeof c[b]=="string"){d=b.replace(/\-(\w)/g,function(g,h){return h.toUpperCase()});a[d]=c[b]}}else for(b in c)if(typeof c[b]==="string")a[b]=c[b];return a}function p(c){var a,b;for(a in c){b=c[a];if(b==null||f.isFunction(b)||a in t||/scrollbar/.test(a)||!/color/i.test(a)&&isNaN(parseFloat(b)))delete c[a]}return c}function u(c,a){var b={_:0},d;for(d in a)if(c[d]!=a[d])b[d]=a[d];return b}function k(c,a,b,d){if(typeof c=="object"){d= -a;b=null;a=c;c=a.effect}if(f.isFunction(a)){d=a;b=null;a={}}if(typeof a=="number"||f.fx.speeds[a]){d=b;b=a;a={}}if(f.isFunction(b)){d=b;b=null}a=a||{};b=b||a.duration;b=f.fx.off?0:typeof b=="number"?b:b in f.fx.speeds?f.fx.speeds[b]:f.fx.speeds._default;d=d||a.complete;return[c,a,b,d]}function l(c){if(!c||typeof c==="number"||f.fx.speeds[c])return true;if(typeof c==="string"&&!f.effects[c])return true;return false}f.effects={};f.each(["backgroundColor","borderBottomColor","borderLeftColor","borderRightColor", -"borderTopColor","borderColor","color","outlineColor"],function(c,a){f.fx.step[a]=function(b){if(!b.colorInit){b.start=s(b.elem,a);b.end=m(b.end);b.colorInit=true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],10),255),0)+")"}});var n={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0, -0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211, -211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0],transparent:[255,255,255]},q=["add","remove","toggle"],t={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};f.effects.animateClass=function(c,a,b, -d){if(f.isFunction(b)){d=b;b=null}return this.queue(function(){var e=f(this),g=e.attr("style")||" ",h=p(o.call(this)),r,v=e.attr("class");f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});r=p(o.call(this));e.attr("class",v);e.animate(u(h,r),{queue:false,duration:a,easing:b,complete:function(){f.each(q,function(w,i){c[i]&&e[i+"Class"](c[i])});if(typeof e.attr("style")=="object"){e.attr("style").cssText="";e.attr("style").cssText=g}else e.attr("style",g);d&&d.apply(this,arguments);f.dequeue(this)}})})}; -f.fn.extend({_addClass:f.fn.addClass,addClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this, -[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.14",save:function(c,a){for(var b=0;b").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}); -c.wrap(b);b=c.parent();if(c.css("position")=="static"){b.css({position:"relative"});c.css({position:"relative"})}else{f.extend(a,{position:c.css("position"),zIndex:c.css("z-index")});f.each(["top","left","bottom","right"],function(d,e){a[e]=c.css(e);if(isNaN(parseInt(a[e],10)))a[e]="auto"});c.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})}return b.css(a).show()},removeWrapper:function(c){if(c.parent().is(".ui-effects-wrapper"))return c.parent().replaceWith(c);return c},setTransition:function(c, -a,b,d){d=d||{};f.each(a,function(e,g){unit=c.cssUnit(g);if(unit[0]>0)d[g]=unit[0]*b+unit[1]});return d}});f.fn.extend({effect:function(c){var a=k.apply(this,arguments),b={options:a[1],duration:a[2],callback:a[3]};a=b.options.mode;var d=f.effects[c];if(f.fx.off||!d)return a?this[a](b.duration,b.callback):this.each(function(){b.callback&&b.callback.call(this)});return d.call(this,b)},_show:f.fn.show,show:function(c){if(l(c))return this._show.apply(this,arguments);else{var a=k.apply(this,arguments); -a[1].mode="show";return this.effect.apply(this,a)}},_hide:f.fn.hide,hide:function(c){if(l(c))return this._hide.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%", -"pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d* -((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*(a/=e)*a*a*a+b},easeOutQuart:function(c,a,b,d,e){return-d*((a=a/e-1)*a*a*a-1)+b},easeInOutQuart:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a*a+b;return-d/2*((a-=2)*a*a*a-2)+b},easeInQuint:function(c,a,b,d,e){return d*(a/=e)*a*a*a*a+b},easeOutQuint:function(c,a,b,d,e){return d*((a=a/e-1)*a*a*a*a+1)+b},easeInOutQuint:function(c,a,b,d,e){if((a/= -e/2)<1)return d/2*a*a*a*a*a+b;return d/2*((a-=2)*a*a*a*a+2)+b},easeInSine:function(c,a,b,d,e){return-d*Math.cos(a/e*(Math.PI/2))+d+b},easeOutSine:function(c,a,b,d,e){return d*Math.sin(a/e*(Math.PI/2))+b},easeInOutSine:function(c,a,b,d,e){return-d/2*(Math.cos(Math.PI*a/e)-1)+b},easeInExpo:function(c,a,b,d,e){return a==0?b:d*Math.pow(2,10*(a/e-1))+b},easeOutExpo:function(c,a,b,d,e){return a==e?b+d:d*(-Math.pow(2,-10*a/e)+1)+b},easeInOutExpo:function(c,a,b,d,e){if(a==0)return b;if(a==e)return b+d;if((a/= -e/2)<1)return d/2*Math.pow(2,10*(a-1))+b;return d/2*(-Math.pow(2,-10*--a)+2)+b},easeInCirc:function(c,a,b,d,e){return-d*(Math.sqrt(1-(a/=e)*a)-1)+b},easeOutCirc:function(c,a,b,d,e){return d*Math.sqrt(1-(a=a/e-1)*a)+b},easeInOutCirc:function(c,a,b,d,e){if((a/=e/2)<1)return-d/2*(Math.sqrt(1-a*a)-1)+b;return d/2*(Math.sqrt(1-(a-=2)*a)+1)+b},easeInElastic:function(c,a,b,d,e){c=1.70158;var g=0,h=d;if(a==0)return b;if((a/=e)==1)return b+d;g||(g=e*0.3);if(h").css({position:"absolute",visibility:"visible",left:-f*(h/d),top:-e*(i/c)}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:h/d,height:i/c,left:g.left+f*(h/d)+(a.options.mode=="show"?(f-Math.floor(d/2))*(h/d):0),top:g.top+e*(i/c)+(a.options.mode=="show"?(e-Math.floor(c/2))*(i/c):0),opacity:a.options.mode=="show"?0:1}).animate({left:g.left+f*(h/d)+(a.options.mode=="show"?0:(f-Math.floor(d/2))*(h/d)),top:g.top+ -e*(i/c)+(a.options.mode=="show"?0:(e-Math.floor(c/2))*(i/c)),opacity:a.options.mode=="show"?1:0},a.duration||500);setTimeout(function(){a.options.mode=="show"?b.css({visibility:"visible"}):b.css({visibility:"visible"}).hide();a.callback&&a.callback.apply(b[0]);b.dequeue();j("div.ui-effects-explode").remove()},a.duration||500)})}})(jQuery); -;/* - * jQuery UI Effects Fade 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fade - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.fade=function(a){return this.queue(function(){var c=b(this),d=b.effects.setMode(c,a.options.mode||"hide");c.animate({opacity:d},{queue:false,duration:a.duration,easing:a.options.easing,complete:function(){a.callback&&a.callback.apply(this,arguments);c.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Fold 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Fold - * - * Depends: - * jquery.effects.core.js - */ -(function(c){c.effects.fold=function(a){return this.queue(function(){var b=c(this),j=["position","top","bottom","left","right"],d=c.effects.setMode(b,a.options.mode||"hide"),g=a.options.size||15,h=!!a.options.horizFirst,k=a.duration?a.duration/2:c.fx.speeds._default/2;c.effects.save(b,j);b.show();var e=c.effects.createWrapper(b).css({overflow:"hidden"}),f=d=="show"!=h,l=f?["width","height"]:["height","width"];f=f?[e.width(),e.height()]:[e.height(),e.width()];var i=/([0-9]+)%/.exec(g);if(i)g=parseInt(i[1], -10)/100*f[d=="hide"?0:1];if(d=="show")e.css(h?{height:0,width:g}:{height:g,width:0});h={};i={};h[l[0]]=d=="show"?f[0]:g;i[l[1]]=d=="show"?f[1]:0;e.animate(h,k,a.options.easing).animate(i,k,a.options.easing,function(){d=="hide"&&b.hide();c.effects.restore(b,j);c.effects.removeWrapper(b);a.callback&&a.callback.apply(b[0],arguments);b.dequeue()})})}})(jQuery); -;/* - * jQuery UI Effects Highlight 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Highlight - * - * Depends: - * jquery.effects.core.js - */ -(function(b){b.effects.highlight=function(c){return this.queue(function(){var a=b(this),e=["backgroundImage","backgroundColor","opacity"],d=b.effects.setMode(a,c.options.mode||"show"),f={backgroundColor:a.css("backgroundColor")};if(d=="hide")f.opacity=0;b.effects.save(a,e);a.show().css({backgroundImage:"none",backgroundColor:c.options.color||"#ffff99"}).animate(f,{queue:false,duration:c.duration,easing:c.options.easing,complete:function(){d=="hide"&&a.hide();b.effects.restore(a,e);d=="show"&&!b.support.opacity&& -this.style.removeAttribute("filter");c.callback&&c.callback.apply(this,arguments);a.dequeue()}})})}})(jQuery); -;/* - * jQuery UI Effects Pulsate 1.8.14 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Effects/Pulsate - * - * Depends: - * jquery.effects.core.js - */ -(function(d){d.effects.pulsate=function(a){return this.queue(function(){var b=d(this),c=d.effects.setMode(b,a.options.mode||"show");times=(a.options.times||5)*2-1;duration=a.duration?a.duration/2:d.fx.speeds._default/2;isVisible=b.is(":visible");animateTo=0;if(!isVisible){b.css("opacity",0).show();animateTo=1}if(c=="hide"&&isVisible||c=="show"&&!isVisible)times--;for(c=0;c').appendTo(document.body).addClass(a.options.className).css({top:d.top,left:d.left,height:b.innerHeight(),width:b.innerWidth(),position:"absolute"}).animate(c,a.duration,a.options.easing,function(){f.remove();a.callback&&a.callback.apply(b[0],arguments); -b.dequeue()})})}})(jQuery); -; \ No newline at end of file From 5a5b216ba0c2d58352364b9fc908f6547989ef72 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Fri, 30 Dec 2011 23:20:44 +0000 Subject: [PATCH 017/106] Fixed error message --- files/ajax/move.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/ajax/move.php b/files/ajax/move.php index 8a56a01548..c2490ecc6b 100644 --- a/files/ajax/move.php +++ b/files/ajax/move.php @@ -14,7 +14,7 @@ $target = $_GET["target"]; if(OC_Files::move($dir,$file,$target,$file)){ OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file ))); }else{ - OC_JSON::error(array("data" => array( "message" => "Could move $file" ))); + OC_JSON::error(array("data" => array( "message" => "Couldn't move $file" ))); } ?> From 1b146b85d2b645dc4ae4f16d9757ad4bd939c0e2 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 31 Dec 2011 01:34:22 +0100 Subject: [PATCH 018/106] Removed redundant DB queries. --- apps/contacts/lib/addressbook.php | 20 ++++++++++++++++---- apps/contacts/lib/vcard.php | 3 --- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index b3c981a541..78792f5f94 100644 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -189,9 +189,21 @@ class OC_Contacts_Addressbook{ public static function active($uid){ $active = self::activeIds($uid); $addressbooks = array(); - /* FIXME: Is there a way to prepare a statement 'WHERE id IN ([range])'? - * See OC_Contacts_VCard:all. - */ + $ids_sql = join(',', array_fill(0, count($active), '?')); + $prep = 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id IN ('.$ids_sql.') ORDER BY displayname'; + try { + $stmt = OC_DB::prepare( $prep ); + $result = $stmt->execute($active); + } catch(Exception $e) { + OC_Log::write('contacts','OC_Contacts_Addressbook:active:, exception: '.$e->getMessage(),OC_Log::DEBUG); + OC_Log::write('contacts','OC_Contacts_Addressbook:active, ids: '.join(',', $active),OC_Log::DEBUG); + OC_Log::write('contacts','OC_Contacts_Addressbook::active, SQL:'.$prep,OC_Log::DEBUG); + } + + while( $row = $result->fetchRow()){ + $addressbooks[] = $row; + } + /* foreach( $active as $aid ){ $stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_addressbooks WHERE id = ? ORDER BY displayname' ); $result = $stmt->execute(array($aid,)); @@ -199,7 +211,7 @@ class OC_Contacts_Addressbook{ while( $row = $result->fetchRow()){ $addressbooks[] = $row; } - } + }*/ return $addressbooks; } diff --git a/apps/contacts/lib/vcard.php b/apps/contacts/lib/vcard.php index 81519b3d05..beb291b481 100644 --- a/apps/contacts/lib/vcard.php +++ b/apps/contacts/lib/vcard.php @@ -47,9 +47,6 @@ class OC_Contacts_VCard{ * ['carddata'] */ public static function all($id){ - //$stmt = OC_DB::prepare( 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid = ? ORDER BY fullname' ); - //$result = $stmt->execute(array($id)); - if(is_array($id)) { $id_sql = join(',', array_fill(0, count($id), '?')); $prep = 'SELECT * FROM *PREFIX*contacts_cards WHERE addressbookid IN ('.$id_sql.') ORDER BY fullname'; From 2c4ab355ac3ace893cc06c645d4a8d25a63dbdc1 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sun, 1 Jan 2012 00:47:24 +0000 Subject: [PATCH 019/106] Shared folder no longer draggable or droppable --- files/js/files.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 53437453ff..8df7aa3535 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -11,8 +11,8 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); //drag/drop of files - $('#fileList tr td.filename').draggable(dragOptions); - $('#fileList tr[data-type="dir"] td.filename').droppable(folderDropOptions); + $('#fileList tr[data-file!=Shared] td.filename').draggable(dragOptions); + $('#fileList tr[data-type="dir"][data-file!=Shared] td.filename').droppable(folderDropOptions); $('div.crumb').droppable(crumbDropOptions); $('ul#apps>li:first-child').data('dir',''); $('ul#apps>li:first-child').droppable(crumbDropOptions); @@ -70,7 +70,9 @@ $(document).ready(function() { procesSelection(); } else { var filename=$(this).parent().parent().attr('data-file'); - if(!FileList.isLoading(filename)){ + var tr=$('tr').filterAttr('data-file',filename); + var renaming=tr.data('renaming') + if(!renaming && !FileList.isLoading(filename)){ var mime=$(this).parent().parent().data('mime'); var type=$(this).parent().parent().data('type'); var action=FileActions.getDefault(mime,type); From 06d2a87ee4759f3fc26e0f6b16027080036ba34a Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sun, 1 Jan 2012 00:52:53 +0000 Subject: [PATCH 020/106] Fix js error --- files/js/files.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 8df7aa3535..e37eac9bf6 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -11,8 +11,8 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); //drag/drop of files - $('#fileList tr[data-file!=Shared] td.filename').draggable(dragOptions); - $('#fileList tr[data-type="dir"][data-file!=Shared] td.filename').droppable(folderDropOptions); + $('#fileList tr[data-file!="Shared"] td.filename').draggable(dragOptions); + $('#fileList tr[data-type="dir"][data-file!="Shared"] td.filename').droppable(folderDropOptions); $('div.crumb').droppable(crumbDropOptions); $('ul#apps>li:first-child').data('dir',''); $('ul#apps>li:first-child').droppable(crumbDropOptions); @@ -70,9 +70,7 @@ $(document).ready(function() { procesSelection(); } else { var filename=$(this).parent().parent().attr('data-file'); - var tr=$('tr').filterAttr('data-file',filename); - var renaming=tr.data('renaming') - if(!renaming && !FileList.isLoading(filename)){ + if(!FileList.isLoading(filename)){ var mime=$(this).parent().parent().data('mime'); var type=$(this).parent().parent().data('type'); var action=FileActions.getDefault(mime,type); From e7de25434206a4849a7c7315d4d9926325c7b730 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sun, 1 Jan 2012 01:14:00 +0000 Subject: [PATCH 021/106] Fix missing ; --- files/js/files.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/js/files.js b/files/js/files.js index e37eac9bf6..88a07a0776 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -70,7 +70,9 @@ $(document).ready(function() { procesSelection(); } else { var filename=$(this).parent().parent().attr('data-file'); - if(!FileList.isLoading(filename)){ + var tr=$('tr').filterAttr('data-file',filename); + var renaming=tr.data('renaming'); + if(!renaming && !FileList.isLoading(filename)){ var mime=$(this).parent().parent().data('mime'); var type=$(this).parent().parent().data('type'); var action=FileActions.getDefault(mime,type); From 6207c0444be7c383838beb0ddc3d684ffee0262b Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 1 Jan 2012 17:57:26 +0100 Subject: [PATCH 022/106] Added class OC_Image --- lib/image.php | 297 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 297 insertions(+) create mode 100644 lib/image.php diff --git a/lib/image.php b/lib/image.php new file mode 100644 index 0000000000..4b63ea5ff3 --- /dev/null +++ b/lib/image.php @@ -0,0 +1,297 @@ + +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU AFFERO GENERAL PUBLIC LICENSE for more details. +* +* You should have received a copy of the GNU Affero General Public +* License along with this library. If not, see . +* +*/ + +/** + * Class for image manipulation + * Ideas: imagerotate, chunk_split(base64_encode()) + * + */ +class OC_Image { + static private $resource = false; // tmp resource. + static private $destroy = false; // if the resource is created withing the object. + /** + * @brief Constructor. + * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function. + * If a resource is passed it is the job of the caller to destroy it using imagedestroy($var) + * @returns bool False on error + */ + function __construct($imageref = null) { + OC_Log::write('core','OC_Image::__construct, start', OC_Log::DEBUG); + if(!function_exists('imagecreatefromjpeg')) { // FIXME: Find a better way to check for GD + OC_Log::write('core','OC_Image::__construct, GD module not installed', OC_Log::ERROR); + return false; + } + if(!is_null($imageref)) { + self::load($imageref); + } + } + + /** + * @brief Destructor. + */ + function __destruct() { + if(self::$resource && self::$destroy) { + imagedestroy(self::$resource); // Why does this issue a warning. + } + } + + /** + * @brief Prints the image. + */ + public function show() { + header('Content-Type: image/png'); + imagepng(self::$resource); + } + + /** + * @brief Prints the image when called as $image(). + */ + public function __invoke() { + self::show(); + } + + /** + * @returns Returns the image resource in any. + */ + public function imageResource() { + return self::$resource; + } + + /** + * @returns Returns a base64 encoded string suitable for embedding in a VCard. + */ + function __toString() { + ob_start(); + $res = imagepng(self::$resource); + if (!$res) { + OC_Log::write('core','OC_Image::_string. Error writing image',OC_Log::ERROR); + } + return chunk_split(base64_encode(ob_get_clean())); + } + + /** + * @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function. + * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function. + * If a resource is passed it is the job of the caller to destroy it using imagedestroy($var) + * @returns An image resource or false on error + */ + static public function load($imageref) { + if(self::loadFromFile($imageref) !== false) { + return self::$resource; + } elseif(self::loadFromBase64($imageref) !== false) { + return self::$resource; + } elseif(self::loadFromData($imageref) !== false) { + return self::$resource; + } elseif(self::loadFromResource($imageref) !== false) { + return self::$resource; + } else { + OC_Log::write('core','OC_Image::load, couldn\'t load anything. Giving up!', OC_Log::DEBUG); + return false; + } + } + + /** + * @brief Loads an image from a local file. + * @param $imageref The path to a local file. + * @returns An image resource or false on error + */ + static public function loadFromFile($imagepath=false) { + if(!is_string($imagepath)) { + return false; + } + if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) { + OC_Log::write('core','OC_Image::loadFromFile, couldn\'t load'.$imagepath, OC_Log::DEBUG); + return false; + } + self::$resource = imagecreatefromstring(file_get_contents($imagepath)); + self::$destroy = true; + return self::$resource; + } + + /** + * @brief Loads an image from a string of data. + * @param $str A string of image data as read from a file. + * @returns An image resource or false on error + */ + static public function loadFromData($str) { + if(is_resource($str)) { + return false; + } + self::$resource = imagecreatefromstring($str); + if(!self::$resource) { + OC_Log::write('core','OC_Image::loadFromData, couldn\'t load', OC_Log::DEBUG); + return false; + } + self::$destroy = true; + return self::$resource; + } + + /** + * @brief Loads an image from a base64 encoded string. + * @param $str A string base64 encoded string of image data. + * @returns An image resource or false on error + */ + static public function loadFromBase64($str) { + if(!is_string($str)) { + return false; + } + $data = base64_decode($str); + if($data) { // try to load from string data + self::$resource = imagecreatefromstring($data); + if(!self::$resource) { + OC_Log::write('core','OC_Image::loadFromBase64, couldn\'t load', OC_Log::DEBUG); + return false; + } + self::$destroy = true; + return self::$resource; + } else { + return false; + } + } + + /** + * @brief Checks if image resource is valid and assigns it to self::$resource. + * @param $res An image resource. + * @returns An image resource or false on error + */ + static public function loadFromResource($res) { + if(!is_resource($res)) { + return false; + } + self::$resource = $res; + } + + /** + * @brief Resizes the image preserving ratio. + * @param $maxsize The maximum size of either the width or height. + * @returns bool + */ + public function resize($maxsize) { + if(!self::$resource) { + OC_Log::write('core','OC_Image::resize, No image loaded', OC_Log::ERROR); + throw new Exception('OC_Image::resize, No image loaded!', self::ERR_NO_IMAGE); + } + $width_orig=imageSX(self::$resource); + $height_orig=imageSY(self::$resource); + $ratio_orig = $width_orig/$height_orig; + + if ($ratio_orig > 1) { + $new_height = round($maxsize/$ratio_orig); + $new_width = $maxsize; + } else { + $new_width = round($maxsize*$ratio_orig); + $new_height = $maxsize; + } + + $process = imagecreatetruecolor(round($new_width), round($new_height)); + if ($process == false) { + OC_Log::write('core','OC_Image::resize. Error creating true color image',OC_Log::ERROR); + imagedestroy($process); + return false; + } + + imagecopyresampled($process, self::$resource, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); + if ($process == false) { + OC_Log::write('core','OC_Image::resize. Error resampling process image '.$new_width.'x'.$new_height,OC_Log::ERROR); + imagedestroy($process); + return false; + } + self::$resource = $process; + return true; + } + + /** + * @brief Crops the image to the middle square. If the image is already square it just returns. + * @returns bool for success or failure + */ + public function centerCrop() { + if(!self::$resource) { + OC_Log::write('core','OC_Image::centerCrop, No image loaded', OC_Log::ERROR); + return false; + } + $width_orig=imageSX(self::$resource); + $height_orig=imageSY(self::$resource); + OC_Log::write('core','OC_Image::centerCrop. Original size: '.$width_orig.'x'.$height_orig, OC_Log::DEBUG); + if($width_orig === $height_orig) { + return true; + } + $ratio_orig = $width_orig/$height_orig; + OC_Log::write('core','OC_Image::centerCrop. Ratio: '.$ratio_orig, OC_Log::DEBUG); + $width = $height = min($width_orig, $height_orig); + OC_Log::write('core','OC_Image::centerCrop. New size: '.$width.'x'.$height, OC_Log::DEBUG); + + if ($ratio_orig > 1) { + $x = ($width_orig/2) - ($width/2); + $y = 0; + } else { + $y = ($height_orig/2) - ($height/2); + $x = 0; + } + $process = imagecreatetruecolor($width, $height); + if ($process == false) { + OC_Log::write('core','OC_Image::centerCrop. Error creating true color image',OC_Log::ERROR); + imagedestroy($process); + return false; + } + imagecopyresampled($process, self::$resource, 0, 0, $x, $y, $width, $height, $width, $height); + if ($process == false) { + OC_Log::write('core','OC_Image::centerCrop. Error resampling process image '.$width.'x'.$height,OC_Log::ERROR); + imagedestroy($process); + return false; + } + self::$resource = $process; + return true; + } + + /** + * @brief Crops the image from point $x$y with dimension $wx$h. + * @param $x Horizontal position + * @param $y Vertical position + * @param $w Width + * @param $h Hight + * @returns bool for success or failure + */ + public function crop($x, $y, $w, $h) { + if(!self::$resource) { + OC_Log::write('core','OC_Image::crop, No image loaded', OC_Log::ERROR); + return false; + } + $width_orig=imageSX(self::$resource); + $height_orig=imageSY(self::$resource); + //OC_Log::write('core','OC_Image::crop. Original size: '.$width_orig.'x'.$height_orig, OC_Log::DEBUG); + $process = imagecreatetruecolor($w, $h); + if ($process == false) { + OC_Log::write('core','OC_Image::crop. Error creating true color image',OC_Log::ERROR); + imagedestroy($process); + return false; + } + imagecopyresampled($process, self::$resource, 0, 0, $x, $y, $w, $h, $w, $h); + if ($process == false) { + OC_Log::write('core','OC_Image::crop. Error resampling process image '.$w.'x'.$h,OC_Log::ERROR); + imagedestroy($process); + return false; + } + self::$resource = $process; + return true; + } +} From c500c1e9307fd10f009f19351a101083969bfed2 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 1 Jan 2012 18:07:46 +0100 Subject: [PATCH 023/106] Removed some denug statements and an exception thrown. --- lib/image.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/image.php b/lib/image.php index 4b63ea5ff3..67290d21f3 100644 --- a/lib/image.php +++ b/lib/image.php @@ -189,7 +189,7 @@ class OC_Image { public function resize($maxsize) { if(!self::$resource) { OC_Log::write('core','OC_Image::resize, No image loaded', OC_Log::ERROR); - throw new Exception('OC_Image::resize, No image loaded!', self::ERR_NO_IMAGE); + return false; } $width_orig=imageSX(self::$resource); $height_orig=imageSY(self::$resource); @@ -231,14 +231,11 @@ class OC_Image { } $width_orig=imageSX(self::$resource); $height_orig=imageSY(self::$resource); - OC_Log::write('core','OC_Image::centerCrop. Original size: '.$width_orig.'x'.$height_orig, OC_Log::DEBUG); if($width_orig === $height_orig) { return true; } $ratio_orig = $width_orig/$height_orig; - OC_Log::write('core','OC_Image::centerCrop. Ratio: '.$ratio_orig, OC_Log::DEBUG); $width = $height = min($width_orig, $height_orig); - OC_Log::write('core','OC_Image::centerCrop. New size: '.$width.'x'.$height, OC_Log::DEBUG); if ($ratio_orig > 1) { $x = ($width_orig/2) - ($width/2); From 64a24191a3880af5b8c574eb2482d479f9024677 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 14:04:16 -0500 Subject: [PATCH 024/106] Fix return for empty Shared folder in opendir() --- apps/files_sharing/sharedstorage.php | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/apps/files_sharing/sharedstorage.php b/apps/files_sharing/sharedstorage.php index d78e273bf3..b0eaeecf72 100644 --- a/apps/files_sharing/sharedstorage.php +++ b/apps/files_sharing/sharedstorage.php @@ -79,20 +79,16 @@ class OC_Filestorage_Shared extends OC_Filestorage { if ($path == "" || $path == "/") { $path = $this->datadir.$path; $sharedItems = OC_Share::getItemsInFolder($path); - if (empty($sharedItems)) { - return false; - } else { - global $FAKEDIRS; - $files = array(); - foreach ($sharedItems as $item) { - // If item is in the root of the shared storage provider and the item exists add it to the fakedirs - if (dirname($item['target'])."/" == $path && $this->file_exists(basename($item['target']))) { - $files[] = basename($item['target']); - } + global $FAKEDIRS; + $files = array(); + foreach ($sharedItems as $item) { + // If item is in the root of the shared storage provider and the item exists add it to the fakedirs + if (dirname($item['target'])."/" == $path && $this->file_exists(basename($item['target']))) { + $files[] = basename($item['target']); } - $FAKEDIRS['shared'] = $files; - return opendir('fakedir://shared'); } + $FAKEDIRS['shared'] = $files; + return opendir('fakedir://shared'); } else { $source = $this->getSource($path); if ($source) { From 929ce2b56621ceda47b910a0fea5452f01812554 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 1 Jan 2012 20:06:35 +0100 Subject: [PATCH 025/106] Small fixes --- lib/image.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/image.php b/lib/image.php index 67290d21f3..0e1d1ee327 100644 --- a/lib/image.php +++ b/lib/image.php @@ -55,6 +55,15 @@ class OC_Image { } } + /** + * @brief Determine whether the object contains an image resource. + * returns bool + */ + function empty() { + if(self::$resource && self::$destroy) { + } + } + /** * @brief Prints the image. */ @@ -116,9 +125,6 @@ class OC_Image { * @returns An image resource or false on error */ static public function loadFromFile($imagepath=false) { - if(!is_string($imagepath)) { - return false; - } if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) { OC_Log::write('core','OC_Image::loadFromFile, couldn\'t load'.$imagepath, OC_Log::DEBUG); return false; From 19328fd8b2a7d050c040b5db2bf6fcc423eec1dc Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 15:56:33 -0500 Subject: [PATCH 026/106] Initial commit of common filestorage --- lib/filestoragecommon.php | 76 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 lib/filestoragecommon.php diff --git a/lib/filestoragecommon.php b/lib/filestoragecommon.php new file mode 100644 index 0000000000..347a92ec1f --- /dev/null +++ b/lib/filestoragecommon.php @@ -0,0 +1,76 @@ +. +*/ + +class OC_Filestorage_Common extends OC_Filestorage { + + public function __construct($parameters){} + public function mkdir($path){} + public function rmdir($path){} + public function opendir($path){} + public function is_dir($path){} + public function is_file($path){} + public function stat($path){} + public function filetype($path){} + public function filesize($path) { + $stat = $this->stat($path); + return $stat['size']; + } + public function is_readable($path){} + public function is_writeable($path){} + public function file_exists($path){} + public function readfile($path) { + echo $this->file_get_contents($path); + return $this->filesize($path); + } + public function filectime($path) { + $stat = $this->stat($path); + return $stat['ctime']; + } + public function filemtime($path) { + $stat = $this->stat($path); + return $stat['mtime']; + } + public function fileatime($path) { + $stat = $this->stat($path); + return $stat['atime']; + } + public function file_get_contents($path) { + $handle = $this->fopen($path, "r"); + return fread($handle, $this->filesize($path)); + } + public function file_put_contents($path,$data) { + $handle = $this->fopen($path, "w"); + return fwrite($handle, $data); + } + public function unlink($path){} + public function rename($path1,$path2){} + public function copy($path1,$path2){} + public function fopen($path,$mode){} + public function toTmpFile($path){} + public function fromTmpFile($tmpPath,$path){} + public function fromUploadedFile($tmpPath,$path){} + public function getMimeType($path){} + public function hash($type,$path,$raw){} + public function free_space($path){} + public function search($query){} + public function getLocalFile($path){} +} From 782d201191c79b400ece4109fbb0e194e23880e6 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 16:25:43 -0500 Subject: [PATCH 027/106] Move to branch --- lib/filestoragecommon.php | 76 --------------------------------------- 1 file changed, 76 deletions(-) delete mode 100644 lib/filestoragecommon.php diff --git a/lib/filestoragecommon.php b/lib/filestoragecommon.php deleted file mode 100644 index 347a92ec1f..0000000000 --- a/lib/filestoragecommon.php +++ /dev/null @@ -1,76 +0,0 @@ -. -*/ - -class OC_Filestorage_Common extends OC_Filestorage { - - public function __construct($parameters){} - public function mkdir($path){} - public function rmdir($path){} - public function opendir($path){} - public function is_dir($path){} - public function is_file($path){} - public function stat($path){} - public function filetype($path){} - public function filesize($path) { - $stat = $this->stat($path); - return $stat['size']; - } - public function is_readable($path){} - public function is_writeable($path){} - public function file_exists($path){} - public function readfile($path) { - echo $this->file_get_contents($path); - return $this->filesize($path); - } - public function filectime($path) { - $stat = $this->stat($path); - return $stat['ctime']; - } - public function filemtime($path) { - $stat = $this->stat($path); - return $stat['mtime']; - } - public function fileatime($path) { - $stat = $this->stat($path); - return $stat['atime']; - } - public function file_get_contents($path) { - $handle = $this->fopen($path, "r"); - return fread($handle, $this->filesize($path)); - } - public function file_put_contents($path,$data) { - $handle = $this->fopen($path, "w"); - return fwrite($handle, $data); - } - public function unlink($path){} - public function rename($path1,$path2){} - public function copy($path1,$path2){} - public function fopen($path,$mode){} - public function toTmpFile($path){} - public function fromTmpFile($tmpPath,$path){} - public function fromUploadedFile($tmpPath,$path){} - public function getMimeType($path){} - public function hash($type,$path,$raw){} - public function free_space($path){} - public function search($query){} - public function getLocalFile($path){} -} From 312e7993bb8edf95a746e62d9b3816d3a0e62fad Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 1 Jan 2012 23:26:24 +0100 Subject: [PATCH 028/106] Added image type specific loading and displaying. Added method 'valid()' to tell if image contains a valid resource. Renamed imageResource() to resource(). --- lib/image.php | 139 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 128 insertions(+), 11 deletions(-) diff --git a/lib/image.php b/lib/image.php index 0e1d1ee327..b23e3507c3 100644 --- a/lib/image.php +++ b/lib/image.php @@ -21,6 +21,18 @@ * */ +/** From user comments at http://dk2.php.net/manual/en/function.exif-imagetype.php + * Don't know if it can come in handy? +if ( ! function_exists( 'exif_imagetype' ) ) { + function exif_imagetype ( $filename ) { + if ( ( list($width, $height, $type, $attr) = getimagesize( $filename ) ) !== false ) { + return $type; + } + return false; + } +} +*/ + /** * Class for image manipulation * Ideas: imagerotate, chunk_split(base64_encode()) @@ -29,6 +41,7 @@ class OC_Image { static private $resource = false; // tmp resource. static private $destroy = false; // if the resource is created withing the object. + static private $imagetype = IMAGETYPE_PNG; // Default to png if file type isn't evident. /** * @brief Constructor. * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function. @@ -50,26 +63,69 @@ class OC_Image { * @brief Destructor. */ function __destruct() { - if(self::$resource && self::$destroy) { + if(is_resource(self::$resource) && self::$destroy) { imagedestroy(self::$resource); // Why does this issue a warning. } } /** * @brief Determine whether the object contains an image resource. - * returns bool + * @returns bool */ - function empty() { - if(self::$resource && self::$destroy) { - } + public function valid() { // apparently you can't name a method 'empty'... + $ret = is_resource(self::$resource); + return $ret; + } + + /** + * @brief Returns the MIME type of the image or an empty string if no image is loaded. + * @returns int + */ + public function mimeType() { + return is_resource(self::$resource) ? image_type_to_mime_type(self::$imagetype) : ''; + } + + /** + * @brief Returns the width of the image or -1 if no image is loaded. + * @returns int + */ + public function width() { + return is_resource(self::$resource) ? imagesx(self::$resource) : -1; + } + + /** + * @brief Returns the height of the image or -1 if no image is loaded. + * @returns int + */ + public function height() { + return is_resource(self::$resource) ? imagesy(self::$resource) : -1; } /** * @brief Prints the image. */ public function show() { - header('Content-Type: image/png'); - imagepng(self::$resource); + header('Content-Type: '.self::mimeType()); + switch(self::$imagetype) { + case IMAGETYPE_GIF: + imagegif(self::$resource); + break; + case IMAGETYPE_JPEG: + imagepng(self::$resource); + break; + case IMAGETYPE_PNG: + imagejpeg(self::$resource); + break; + case IMAGETYPE_XBM: + imagexbm(self::$resource); + break; + case IMAGETYPE_WBMP: + case IMAGETYPE_BMP: + imagewbmp(self::$resource); + break; + default: + imagepng(self::$resource); + } } /** @@ -82,7 +138,7 @@ class OC_Image { /** * @returns Returns the image resource in any. */ - public function imageResource() { + public function resource() { return self::$resource; } @@ -126,11 +182,72 @@ class OC_Image { */ static public function loadFromFile($imagepath=false) { if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) { - OC_Log::write('core','OC_Image::loadFromFile, couldn\'t load'.$imagepath, OC_Log::DEBUG); + OC_Log::write('core','OC_Image::loadFromFile, couldn\'t load', OC_Log::DEBUG); return false; } - self::$resource = imagecreatefromstring(file_get_contents($imagepath)); - self::$destroy = true; + $itype = exif_imagetype($imagepath); + switch($itype) { + case IMAGETYPE_GIF: + if (imagetypes() & IMG_GIF) { + self::$resource = imagecreatefromgif($imagepath); + } + break; + case IMAGETYPE_JPEG: + if (imagetypes() & IMG_JPG) { + self::$resource = imagecreatefromjpeg($imagepath); + } + break; + case IMAGETYPE_PNG: + if (imagetypes() & IMG_PNG) { + self::$resource = imagecreatefrompng($imagepath); + } + break; + case IMAGETYPE_XBM: + if (imagetypes() & IMG_XPM) { + self::$resource = imagecreatefromxbm($imagepath); + } + break; + case IMAGETYPE_WBMP: + case IMAGETYPE_BMP: + if (imagetypes() & IMG_WBMP) { + self::$resource = imagecreatefromwbmp($imagepath); + } + break; + /* + case IMAGETYPE_TIFF_II: // (intel byte order) + break; + case IMAGETYPE_TIFF_MM: // (motorola byte order) + break; + case IMAGETYPE_JPC: + break; + case IMAGETYPE_JP2: + break; + case IMAGETYPE_JPX: + break; + case IMAGETYPE_JB2: + break; + case IMAGETYPE_SWC: + break; + case IMAGETYPE_IFF: + break; + case IMAGETYPE_ICO: + break; + case IMAGETYPE_SWF: + break; + case IMAGETYPE_PSD: + break; + */ + default: + self::$resource = imagecreatefromstring(file_get_contents($imagepath)); + $itype = IMAGETYPE_PNG; + OC_Log::write('core','OC_Image::loadFromFile, Default', OC_Log::DEBUG); + break; + } + // if($this->valid()) { // FIXME: I get an error: "PHP Fatal error: Using $this when not in object context..." WTF? + if(self::valid()) { // And here I get a warning: "PHP Strict Standards: Non-static method OC_Image::valid() should not be called statically..." valid() shouldn't be a static member as it would fail on a non-instantiated class. + self::$imagetype = $itype; + self::$destroy = true; + } return self::$resource; } From db6738478b6e0efe5a2484151e01e37ae358ac18 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 1 Jan 2012 23:34:26 +0100 Subject: [PATCH 029/106] Mixed up two lines :-P --- lib/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/image.php b/lib/image.php index b23e3507c3..a8948956bf 100644 --- a/lib/image.php +++ b/lib/image.php @@ -111,10 +111,10 @@ class OC_Image { imagegif(self::$resource); break; case IMAGETYPE_JPEG: - imagepng(self::$resource); + imagejpeg(self::$resource); break; case IMAGETYPE_PNG: - imagejpeg(self::$resource); + imagepng(self::$resource); break; case IMAGETYPE_XBM: imagexbm(self::$resource); From 536bc3d3c52bb44d9768a20041ae9f284d4f6eae Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 1 Jan 2012 23:41:30 +0100 Subject: [PATCH 030/106] add jplayer source --- .../js/jQuery.jPlayer.2.1.0.source/Jplayer.as | 415 +++ .../jQuery.jPlayer.2.1.0.source/Jplayer.fla | Bin 0 -> 61952 bytes .../add-on/jplayer.playlist.js | 452 ++++ .../add-on/jquery.jplayer.inspector.js | 331 +++ .../happyworm/jPlayer/JplayerEvent.as | 69 + .../happyworm/jPlayer/JplayerMp3.as | 328 +++ .../happyworm/jPlayer/JplayerMp4.as | 413 +++ .../happyworm/jPlayer/JplayerStatus.as | 101 + .../jquery.jplayer.js | 2349 +++++++++++++++++ 9 files changed, 4458 insertions(+) create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.fla create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as create mode 100644 apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as new file mode 100644 index 0000000000..1178dacc34 --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.as @@ -0,0 +1,415 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Version: 2.1.0 + * Date: 1st September 2011 + * + * FlashVars expected: (AS3 property of: loaderInfo.parameters) + * id: (URL Encoded: String) Id of jPlayer instance + * vol: (Number) Sets the initial volume + * muted: (Boolean in a String) Sets the initial muted state + * jQuery: (URL Encoded: String) Sets the jQuery var name. Used with: someVar = jQuery.noConflict(true); + * + * Compiled using: Adobe Flex Compiler (mxmlc) Version 4.5.1 build 21328 + */ + +package { + import flash.system.Security; + import flash.external.ExternalInterface; + + import flash.utils.Timer; + import flash.events.TimerEvent; + + import flash.text.TextField; + import flash.text.TextFormat; + + import flash.events.KeyboardEvent; + + import flash.display.Sprite; + import happyworm.jPlayer.*; + + import flash.display.StageAlign; + import flash.display.StageScaleMode; + import flash.events.Event; + import flash.events.MouseEvent; + + import flash.ui.ContextMenu; + import flash.ui.ContextMenuItem; + import flash.events.ContextMenuEvent; + import flash.net.URLRequest; + import flash.net.navigateToURL; + + public class Jplayer extends Sprite { + private var jQuery:String; + private var sentNumberFractionDigits:uint = 2; + + public var commonStatus:JplayerStatus = new JplayerStatus(); // Used for inital ready event so volume is correct. + + private var myInitTimer:Timer = new Timer(100, 0); + + private var myMp3Player:JplayerMp3; + private var myMp4Player:JplayerMp4; + + private var isMp3:Boolean = false; + private var isVideo:Boolean = false; + + private var txLog:TextField; + private var debug:Boolean = false; // Set debug to false for release compile! + + public function Jplayer() { + flash.system.Security.allowDomain("*"); + + jQuery = loaderInfo.parameters.jQuery + "('#" + loaderInfo.parameters.id + "').jPlayer"; + commonStatus.volume = Number(loaderInfo.parameters.vol); + commonStatus.muted = loaderInfo.parameters.muted == "true"; + + stage.scaleMode = StageScaleMode.NO_SCALE; + stage.align = StageAlign.TOP_LEFT; + stage.addEventListener(Event.RESIZE, resizeHandler); + stage.addEventListener(MouseEvent.CLICK, clickHandler); + + var initialVolume:Number = commonStatus.volume; + if(commonStatus.muted) { + initialVolume = 0; + } + myMp3Player = new JplayerMp3(initialVolume); + addChild(myMp3Player); + + myMp4Player = new JplayerMp4(initialVolume); + addChild(myMp4Player); + + setupListeners(!isMp3, isMp3); // Set up the listeners to the default isMp3 state. + + // The ContextMenu only partially works. The menu select events never occur. + // Investigated and it is something to do with the way jPlayer inserts the Flash on the page. + // A simple test inserting the Jplayer.swf on a page using: 1) SWFObject 2.2 works. 2) AC_FL_RunContent() works. + // jPlayer Flash insertion is based on SWFObject 2.2 and the resaon behind this failure is not clear. The Flash insertion HTML on the page looks similar. + var myContextMenu:ContextMenu = new ContextMenu(); + myContextMenu.hideBuiltInItems(); + var menuItem_jPlayer:ContextMenuItem = new ContextMenuItem("jPlayer " + JplayerStatus.VERSION); + var menuItem_happyworm:ContextMenuItem = new ContextMenuItem("© 2009-2011 Happyworm Ltd", true); + menuItem_jPlayer.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_jPlayer); + menuItem_happyworm.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuSelectHandler_happyworm); + myContextMenu.customItems.push(menuItem_jPlayer, menuItem_happyworm); + contextMenu = myContextMenu; + + // Log console for dev compile option: debug + if(debug) { + txLog = new TextField(); + txLog.x = 5; + txLog.y = 5; + txLog.width = 540; + txLog.height = 390; + txLog.border = true; + txLog.background = true; + txLog.backgroundColor = 0xEEEEFF; + txLog.multiline = true; + txLog.text = "jPlayer " + JplayerStatus.VERSION; + txLog.visible = false; + this.addChild(txLog); + this.stage.addEventListener(KeyboardEvent.KEY_UP, keyboardHandler); + + myMp3Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler); + myMp4Player.addEventListener(JplayerEvent.DEBUG_MSG, debugMsgHandler); + } + + // Delay init() because Firefox 3.5.7+ developed a bug with local testing in Firebug. + myInitTimer.addEventListener(TimerEvent.TIMER, init); + myInitTimer.start(); + } + + private function init(e:TimerEvent):void { + myInitTimer.stop(); + if(ExternalInterface.available) { + ExternalInterface.addCallback("fl_setAudio_mp3", fl_setAudio_mp3); + ExternalInterface.addCallback("fl_setAudio_m4a", fl_setAudio_m4a); + ExternalInterface.addCallback("fl_setVideo_m4v", fl_setVideo_m4v); + ExternalInterface.addCallback("fl_clearMedia", fl_clearMedia); + ExternalInterface.addCallback("fl_load", fl_load); + ExternalInterface.addCallback("fl_play", fl_play); + ExternalInterface.addCallback("fl_pause", fl_pause); + ExternalInterface.addCallback("fl_play_head", fl_play_head); + ExternalInterface.addCallback("fl_volume", fl_volume); + ExternalInterface.addCallback("fl_mute", fl_mute); + + ExternalInterface.call(jQuery, "jPlayerFlashEvent", JplayerEvent.JPLAYER_READY, extractStatusData(commonStatus)); // See JplayerStatus() class for version number. + } + } + private function setupListeners(oldMP3:Boolean, newMP3:Boolean):void { + if(oldMP3 != newMP3) { + if(newMP3) { + listenToMp3(true); + listenToMp4(false); + } else { + listenToMp3(false); + listenToMp4(true); + } + } + } + private function listenToMp3(active:Boolean):void { + if(active) { + myMp3Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp3Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp3Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + } else { + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp3Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + } + } + private function listenToMp4(active:Boolean):void { + if(active) { + myMp4Player.addEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp4Player.addEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp4Player.addEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + + myMp4Player.addEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler + } else { + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ERROR, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PROGRESS, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_TIMEUPDATE, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_ENDED, jPlayerFlashEvent); + + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PLAY, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_PAUSE, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADSTART, jPlayerFlashEvent); + + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKING, jPlayerFlashEvent); + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_SEEKED, jPlayerFlashEvent); + + myMp4Player.removeEventListener(JplayerEvent.JPLAYER_LOADEDMETADATA, jPlayerMetaDataHandler); // Note the unique handler + } + } + private function fl_setAudio_mp3(src:String):Boolean { + if (src != null) { + log("fl_setAudio_mp3: "+src); + setupListeners(isMp3, true); + isMp3 = true; + isVideo = false; + myMp4Player.clearFile(); + myMp3Player.setFile(src); + return true; + } else { + log("fl_setAudio_mp3: null"); + return false; + } + } + private function fl_setAudio_m4a(src:String):Boolean { + if (src != null) { + log("fl_setAudio_m4a: "+src); + setupListeners(isMp3, false); + isMp3 = false; + isVideo = false; + myMp3Player.clearFile(); + myMp4Player.setFile(src); + return true; + } else { + log("fl_setAudio_m4a: null"); + return false; + } + } + private function fl_setVideo_m4v(src:String):Boolean { + if (src != null) { + log("fl_setVideo_m4v: "+src); + setupListeners(isMp3, false); + isMp3 = false; + isVideo = true; + myMp3Player.clearFile(); + myMp4Player.setFile(src); + return true; + } else { + log("fl_setVideo_m4v: null"); + return false; + } + } + private function fl_clearMedia():void { + log("clearMedia."); + myMp3Player.clearFile(); + myMp4Player.clearFile(); + } + private function fl_load():Boolean { + log("load."); + if(isMp3) { + return myMp3Player.load(); + } else { + return myMp4Player.load(); + } + } + private function fl_play(time:Number = NaN):Boolean { + log("play: time = " + time); + if(isMp3) { + return myMp3Player.play(time * 1000); // Flash uses milliseconds + } else { + return myMp4Player.play(time * 1000); // Flash uses milliseconds + } + } + private function fl_pause(time:Number = NaN):Boolean { + log("pause: time = " + time); + if(isMp3) { + return myMp3Player.pause(time * 1000); // Flash uses milliseconds + } else { + return myMp4Player.pause(time * 1000); // Flash uses milliseconds + } + } + private function fl_play_head(percent:Number):Boolean { + log("play_head: "+percent+"%"); + if(isMp3) { + return myMp3Player.playHead(percent); + } else { + return myMp4Player.playHead(percent); + } + } + private function fl_volume(v:Number):void { + log("volume: "+v); + commonStatus.volume = v; + if(!commonStatus.muted) { + myMp3Player.setVolume(v); + myMp4Player.setVolume(v); + } + } + private function fl_mute(mute:Boolean):void { + log("mute: "+mute); + commonStatus.muted = mute; + if(mute) { + myMp3Player.setVolume(0); + myMp4Player.setVolume(0); + } else { + myMp3Player.setVolume(commonStatus.volume); + myMp4Player.setVolume(commonStatus.volume); + } + } + private function jPlayerFlashEvent(e:JplayerEvent):void { + log("jPlayer Flash Event: " + e.type + ": " + e.target); + if(ExternalInterface.available) { + ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data)); + } + } + private function extractStatusData(data:JplayerStatus):Object { + var myStatus:Object = { + version: JplayerStatus.VERSION, + src: data.src, + paused: !data.isPlaying, // Changing this name requires inverting all assignments and conditional statements. + srcSet: data.srcSet, + seekPercent: data.seekPercent, + currentPercentRelative: data.currentPercentRelative, + currentPercentAbsolute: data.currentPercentAbsolute, + currentTime: data.currentTime / 1000, // JavaScript uses seconds + duration: data.duration / 1000, // JavaScript uses seconds + volume: commonStatus.volume, + muted: commonStatus.muted + }; + log("extractStatusData: sp="+myStatus.seekPercent+" cpr="+myStatus.currentPercentRelative+" cpa="+myStatus.currentPercentAbsolute+" ct="+myStatus.currentTime+" d="+myStatus.duration); + return myStatus; + } + private function jPlayerMetaDataHandler(e:JplayerEvent):void { + log("jPlayerMetaDataHandler:" + e.target); + if(ExternalInterface.available) { + resizeHandler(new Event(Event.RESIZE)); + ExternalInterface.call(jQuery, "jPlayerFlashEvent", e.type, extractStatusData(e.data)); + } + } + private function resizeHandler(e:Event):void { + log("resizeHandler: stageWidth = " + stage.stageWidth + " | stageHeight = " + stage.stageHeight); + + var mediaX:Number = 0; + var mediaY:Number = 0; + var mediaWidth:Number = 0; + var mediaHeight:Number = 0; + + if(stage.stageWidth > 0 && stage.stageHeight > 0 && myMp4Player.myVideo.width > 0 && myMp4Player.myVideo.height > 0) { + var aspectRatioStage:Number = stage.stageWidth / stage.stageHeight; + var aspectRatioVideo:Number = myMp4Player.myVideo.width / myMp4Player.myVideo.height; + if(aspectRatioStage < aspectRatioVideo) { + mediaWidth = stage.stageWidth; + mediaHeight = stage.stageWidth / aspectRatioVideo; + mediaX = 0; + mediaY = (stage.stageHeight - mediaHeight) / 2; + } else { + mediaWidth = stage.stageHeight * aspectRatioVideo; + mediaHeight = stage.stageHeight; + mediaX = (stage.stageWidth - mediaWidth) / 2; + mediaY = 0; + } + resizeEntity(myMp4Player, mediaX, mediaY, mediaWidth, mediaHeight); + } + if(debug && stage.stageWidth > 20 && stage.stageHeight > 20) { + txLog.width = stage.stageWidth - 10; + txLog.height = stage.stageHeight - 10; + } + } + private function resizeEntity(entity:Sprite, mediaX:Number, mediaY:Number, mediaWidth:Number, mediaHeight:Number):void { + entity.x = mediaX; + entity.y = mediaY; + entity.width = mediaWidth; + entity.height = mediaHeight; + } + private function clickHandler(e:MouseEvent):void { + if(isMp3) { + jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp3Player.myStatus, "click")) + } else { + jPlayerFlashEvent(new JplayerEvent(JplayerEvent.JPLAYER_CLICK, myMp4Player.myStatus, "click")) + } + } + // This event is never called. See comments in class constructor. + private function menuSelectHandler_jPlayer(e:ContextMenuEvent):void { + navigateToURL(new URLRequest("http://jplayer.org/"), "_blank"); + } + // This event is never called. See comments in class constructor. + private function menuSelectHandler_happyworm(e:ContextMenuEvent):void { + navigateToURL(new URLRequest("http://happyworm.com/"), "_blank"); + } + private function log(t:String):void { + if(debug) { + txLog.text = t + "\n" + txLog.text; + } + } + private function debugMsgHandler(e:JplayerEvent):void { + log(e.msg); + } + private function keyboardHandler(e:KeyboardEvent):void { + log("keyboardHandler: e.keyCode = " + e.keyCode); + switch(e.keyCode) { + case 68 : // d + txLog.visible = !txLog.visible; + log("Toggled log display: " + txLog.visible); + break; + case 76 : // l + if(e.ctrlKey && e.shiftKey) { + txLog.text = "Cleared log."; + } + break; + } + } + } +} diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.fla b/apps/media/js/jQuery.jPlayer.2.1.0.source/Jplayer.fla new file mode 100644 index 0000000000000000000000000000000000000000..61ae40d3ac2811ebcfd63b1ff3bb590f67984445 GIT binary patch literal 61952 zcmeHQU2Gl4b-omB%T6r+#c}-aYuRyRJEHg_$`Y%{qDje=Em^cETdpfNqR4wmS|TZv zm!cR1sE{B)A5tJdjH35VeQ019FyIyj64XFp^hrQ(&@^a@Joq6+fTBQw#3)dp1sb#8 zch1i2?(FZSX^~3jl5_8#-PtoU=bSm`%KJFa(@!$OY>xcG#_goawnV)~>+aLbVKXg2clLv3qD?=!q<<{hTF`B*9@m-ZI z9VGV_aFapbXRs)_Eh@u%fB+8hbvob`^%P3yq!V&%al=+ zhvk}2QC{~t`|j_|&Hs;n+3tfN#vl@phwwX$bO`A%((_0oNJo%fKzb4BDAF;cmynJl zjUv5_bOLD%=_JxCNUtKDLV6A950PF+`Xi*%NN*thG151Y&LE8=okf~JnnbE0)sd!< zrjcfl-bA9fo=2KRnnRjLx`6Z+(gG5DP6KHP=_1lH65Cbuxt9I^{U7)I?R)6|BKm>+ zZ$$sU8MN8x{{LS$pc3o!iSoEzl;&Qe2lz{yzZHqcx8U~+NMA&{6=@sNZAiBx!3C(? ziF6mzmyqs8`ZCfzNMAv^7wJBv`;i_%dJyR$q=%6nL8>A>inJZ+F{H(-#{wUFAQCN z-+wzm58BR7B#I=vrQtvONjv=abiMwh1t!J=*-0E_*9L~TnCs=_~`gbZ6SK% z@WS|PkVEe{S-aE-^!R1S3es)2$S44Sd^##Wg>v`=$B+MJb@dr45`2CFrO_eU0Y2NO zaM>0+Zojt!M>h__md(H>p6B^nLuhB^Ias{&u#m^Z%2o~n4Q_<=;-7j#KY|U1{M|y) zmJgvfVXe;t^9n5NLZvFu60GbDtZ5Y%cV5oE346XIIaYA?1?0boGzRO;dR-7d`6!Og z0v<5KxGd-o#RunlKfkMtI@6LEa@WpG{1uWA@ z`DIO^u1ly9xike_69Em+qXu7kU7%HzW48Qjr8 zzB%0Ys+6{fatZUkF`OZH(#shJ4vvwEat8e=BKM|8@YH2ZQ12ZCgHL!IbmiduL%2Xo zj8BjS+U;2+^d{!y$$z0q4nEP6%sKw@d{~A>rdclI2WcBJJ($)p*dcn5s&K}$x&V+< z?;gh=k+Li#{_t~I)7CBa49^zjC@xb*o$Zw=1#hyi=MA0G>qTn-l{Gv+u{2woYtTg8 zcU#_=8I0UYeX0G8V{7>sA)sp!Es@95ubnvhAHhkwogy*3fk~Vb3-BsF1_Rlyxqf=$ zua22qbY~(u%U!L|}9NS^3(X5o3 zg^?DQB_0OdNUI2yZgnk$$%~Sz@seJKozE)aD9Tq~=s0Ld{?HNu2U8n(22np+@NvwD zB=9(N%&QOWW&?bgh6SC6*F||5#`mnyv4`Jxxg32(DE$(0HsEuS&*vn!Q2hZn_b~FE zg`7^|Po~(?>y1dU&|AL#Y2y z{QfdhOdptu~UP!l>B z=S5DmuS>h0h+{0TamIj^x{w?>0{u9Qy4aSsjWxt|LV7|C^0EX9P+lz7FDGSs9#XX= zT<0wM5NbouRNA*St|@@!EAIV=Dwl8<`v7H!V~FS|33qHe9AKP|U7>q~tBz(Xk}2AT zdGyqiC~FFOojP+4{e3Zz5#h(z;`}JWslA$9rA}8Ws@BwYS=v3=9^O|_GmckOQlz!J z+r>cto)Qx8i`1AQ&3R{`Wk5m_8WSF@h^_=btN^bF==m?gx{pBj_PsGmL6yc{NCf< z%YM&M-U4#7Z*Y`mYz*=%r4oHB*H2(MP9HC$5yRFSo<}VE7vuf43pHJa4o68&pD0rj zZCu@vyhvH8(oqI4sW^|>jnKEE<(^mOGALQKVft8%Dc8F0BYHck_EkoR&pc*dKKaFd^8e0qGUZS-WMq zx#I`I#BXB<|n`Chgd4@j7v%xesWZ%b9EdM zus5@W(3eeUF~>^gd6nwT=*Uw>JKCF^UXjmBwOgzc$2($c@9c$!*ol6}eo}?jR;|W) zMl(7BMVxx(my&AD9hobyTghkkxk*Ti<;^2;-sEGWeo?Q5_LjW1cpR^uR*YVMmRCNE zD@SO^h7TQLDZxwyg#ZM8=ahahAgTfiI4gFS1jawkI(UN!vJqT5!ImhE-q3VBt_+ zhgd47)G`tmjuMF_O>XmLs$DtA$JV|a6j8PW#s^*NS7DC zXHYMKe+x2(3cPcrzN6cV?0#tDtrV=m4^ED>skP@y=^~CfMRz(Qi!#!uqoe|B*B#gF zj$TemU!sT4@e93a^(P}E2WR|T)E`EG z%dB-l*`2#ZE90omewE?1ICGq3WYPF^W$Zfh$}@~7+n4!JlNU(2aqbr8u`SiIX$N9`-`fU}Z5gG@kL3k+h&=EBp>s$z*$#5Oi z7-ld|F$`zs(6-=-sapDVvD4(&ge}9!J6e>O;nyWixUz;TJDRby<$_%p_vt+v~ylpW>ct_ z9W3QXYT>FH(Y3d^8kBT4&nc|DJRP@`Mg9Lc`u&{DjIn>}vuGZr^isCP=_^Ip>5Z4d z>pagZ!ds|OSXakCEYow6^WT=P&geK_!i+5Cu6}UpS0oo)Pr`mQ58iODXBM&>nQcvs z+PG+wGeXOOjMJZ_XUUnJs9muwywjC0wdH)`t7~_)G?B&a>3R7kqr0l%DC!)p*>=|K zbjX^o#N0En$HszqzAPh%yWMhiyuseak!T8C68@03hjSNP$xTU$KA$Evo}u(OS~H4U zM-rTAkFT!dY?Y;^qqp-lW~SbCYLSnnoR6L_xg~Y?nxE+Q zKa>phfcIjCdQ7;^dG=a#wo2{fL#}K^C8Z>e#L74JI^zvS*HI)SyrYk@lXxN>wjxJX z9a$^Vo~#G`*vP11UFHl>*0q z&hK&Y*}jPXM_#stDcvWrZFcNqejiT9MO&<^MS-=Gy>KsU>CBPlV;+RBz;&UtJh2s< zZQ8Q%DY}j?^&Jk>hBb10j3T=jK5rmr7Xpt+Yshy{KFi8LT{EXooz-S?Wh^~VU0JEN zFz#^`)tB>w#%l}5foON?d}on9%+UFX6;)APmSHIq>%Q2N`Q);2eV@bqBK;HBeVkFL zql|$2j-OS=?oL4_>(*n9^uolLPjjLqr$3b`h1R`5w>fmk(@fMHOBjK$7Yzb4`9ps# z;z2lLt~_kUALcCYdHm5cF+Ql7O&9;k8H?m=w}LTOLSEEgR6AwnFbuS)Eqi1L^?C`s zI)afQ-$>B+#KthU@lDX-6=>=anD%gBZqwVP2>LAc(~2*;;_r*^-^t1!G5t1cDn7O-i+5dm8U zJR=|shGxD*5HF%jH3C$9f_aC*+$Wg#0~E}Cf_Vs_VD1ylhXD%aKEXT!P%zgmX1TX6 znC~{I>VlaC=~cnp4^S}I1vASP%yq$h5TIaoNY~eglI5e#cL~d@S8%V=N-|%vV4YVd z0qVU?f^Pr}NJsE>fC1?Uz6LNL9l@&r1+!C)KEXT+E-9@9^C<3ATD5rZXype1s#OJl zixXfM;4Gd7#1@jJrxh|OZ8_adVJY+D}1v7ahm>ts9>maRsw1F<^c$K76 z;`9;xz6Ir8Qc|xrdG#E?fOG^&*no5d&j1WaNALr4Z=YbkVp`M}V78=FRF-rE-!KjA zTO~*yNdxN@f@F%+sxFwX8q7|6>r&@YWR+UgTfCP%QdEMOz3d(7IC0`Mn@wcqM>69# z04tiAS4ldhMjyc+TCh&=dlnQ_q+~!kUY!FNkdELqz<_iF-!qx}1oIVKlgxdB`TG_O zFq^9_-g_=29YOLaARWOE4d%LF{=lHB3+5}9Rsm*9Iz?qkN09v}jdZP63s?F1D21?< z3a^rM+WbC(e{R7#K?Z4&&B1qCxHsaIEd^#Z_vbOhfuSNjC>6-y1l{6h;0=I>cB zz-&7#QISUh=?GGurQEt;e$U)n7tG|5W){rkk%9qc14^CQkJ3m-!=j}7B$af$O43Pt zp+x}xg$3&be_+8T!9TTNi{NDoN68 zSwPqU-1|PRN1;twJu%KA0UVy@Vh(0R07ofDLWiiXumSFyZ$=njmG>dvwFh6WT!OVj6 zs$lL0D40{|-q@Z9Xj}#QlB%Oe0d5m---W1?8!ZyWP z{Q_45($N5YY>5+C=Rn6c#ait!8n`LeigsVhZHl#`Z}tvZ))LHgAp+77^RJOrs?iEC z2luuFGkGMaT7sE8Qcy6{HxtaOg85ef1JV&Qc_f)v1I#9~U}itkdj&K5k%EGmq!Z8~ z9lAO&XUSxZU?x+3Nv5m{=AQu!NJoQ99tBcIko_ni z9YG4epjr(u8&rasq!Y{zaUgWKmram@oU2fxxcU=w6^a2M?Y`1VtQCDTrIlDK_I;@a znv2Xdiwat6rR^2WAK|K$3mt>ZZJ6QX&S@#&Dg)bu$1O}-f3xWBxD8ICq)@AQcR_jhtv3~|$z zJ1RpjpB!A8oS7f1H5xN>Q`{gDWxR%}cGz0TglC6r3ZfOdDrY#=Qs$$GD6zboRN$R* z9KnEdtIK!ouRMz$q)WceVX}u0OSuq<)1h-R$+r6GcAVo&N}O^#g+&#|V49ENo+0F$ z#+4B)GviW;G5o%SX}Ssgp2PP(+_N3{4`8c8+V24*K2YTpKc_US0-r}Y+=Aqi;OBx6 zT?#c2oHx050T=HuSQ;pUH3}C`Rf9#|ID&c+?5 zVs?%A$VVS19RPQ9Ppq9HJv&8uPU5&933aNvXql zZe4mnIWCl7$*fTyBs{Aw*?5cU!$pF8;IgugbxFe+uLn75`dzx5U+aD`33*TUiVNsp z3y{EY!#w8O1upWj4D}p)G&kjA@94pAcJJVw1E4hfgg$gV04d-GH||2yU0BRca}@87 zx&)e(OT)C;>8rZo7_3l|%H?&>tZ1aNx{i;jxa2}LWL$%nFLM$7a0Ohdf%05Xvj`5F zZ5qP`9n|G<9%N}?){1!QpNSHAwNmV9)+MeN$&CR#oFgr$mH6@%x8NCuu2z0^K{wEk z7=X=v2KxIj=(!L2dN2NZ<%l+uTWjtGv>WG!p{Jh1Q4hWcp|^%`Uq8-U?8y%@UGZ{_ASGHL7q zwPEPx=%QXeS~tCr`oryqSz0$*CsR(S6$ZeQa6#7r950|8^$sS5irIP7s8v)NrJ%T{ ztq1p`^-eE!E%jf97fg#+qzzMzNhdMnXdg}ByI6Y5}YR~s&e)y2LI)Ga!?XxGb( z)-bP(qB=+Y8_Kim&7?`n#>@XAWd9;Kym7L>9#$sG!)qh^Wjyt0t$x2{KTXf_N`u2KQv;AU2)W;h@ zS=Z90Swvv{33$58CUt(P4%bxtp}Y@O-zY>X#I&0*S5t`=!+a%G#N?xdu;b}HI) zipJ^DygHXgY+A0F0W>p%ZaGPNc>SD7qxSVv`)EylOQO`+9LJs~n}ZM0T6msBsj)eZ zJx?|VAELGJJc&|ca~yk~Yz{s|YvFkkrN-ts_B`1fe2CV<^CU`*&2hX|o^WO$xsHiX z7j)IqGM@5q9a3}!6_-WXFk1|PxCcw|uy|zrVr{Z|cBMKvIe)fRJ$!zAak_eHW^QtR zd9m8l-PK(^yEJotvf96APqi^KTbr0)nrl?QQSIsL?%lJuyLT@`o#J!(#e?5Q)YU79 z$l9T2+WF=!Tp8Gj#D!cpB5?&B*S)nH|C8}weGE{t`}+C#_@6%hr;q=sakUs1*2n*Z z5|_`lj{o@>HxP)295O3q+X;w^HObVzZA9k0jOHT6B7|}UV}8uhc1sbOZoV(;n50+j zdWrw}n;9Sf)5rge?&*~ozmdD1`1qekK?NWGb5tHD>(1BCZc>@@le?GTb|3#UjP%Q$ zvwi$e?yy|6AD7u5D7q&gcO}!kHZhr?y8(yKK>{A@}hY~@`?B^U}g5`(wAYV5mI*PO6(Np*>p0`J(zF6Vof2Qrj`8*a1*MpatlUzO`d?oMMqxiy|^{kw@g+;r?`uLw2v5(t~ zbQ0gemVJaCZ}?)EkN?@gCJ|127iVARGMe9vV%yU~WiZ>FfK^vI{V2abntjQw7Ib#$ z&%Zlk$7W~W<05~H%i=jg9ml+zkN@f8e-_D0xJ$Z^|H;>NvtoFJqeR=gAB&HK^7qW< z3^!+z)X#DD;HKSf3mbRfZosZg<5hM>xaIubFurHS0}v0)(Hlh`KnaYANE+^}eLOOv zkN+7T>2M@09-0%As*F|g@jt^EY|429l25;v(L4B3bP(TKZT9wfzbuk`?eRYTCpRU6 z9&$!*MRT$lUdtMGus1$knOQjI_3=OX94E_OjiFcg_@4vV>VumrsV3%FEJeC}{Lhpb zB#qg`7oC0lPi|GirvrRtTDRNE>UCyDvS3`ghPh4?Nrc{Knw~CGJ3H5^7@W~*-W*+K zbTvoM=lj5X_1wq*lt@0bv`);O@*_1L|1+!qnRrLKnV!-0+%SvtBA_{w;~$pkIm!8N z+Yg;_R{k818Ta}4pL`PL<9|-We`7qWEP2kS8$5PHm&zIbiy1N=5d$ps}eEiP~ z7}v(1AW+L7;DwL>3Ce^s0A`+@8y0E2Me&Gy{7-0-yyt~J{-=r6>EnNLEW7#rta3Be+fz6f>;D3QJhjtD4`z6hQX5Cc68c65oLkN*j3`1qfJY}lwU zc*CBded-_%!wRWf`S_oaKIr3rLN+czGDMBkB|6z800}Bpm*`|Z{%1fOAOBNhw2EvX z{Fq2i5PuA|3*h@uGAc+Coy^Do3>IZ(EkN*j3`1qeb{-^eca2v8P<|z6L-4fGnf+2XBXr&TZGI6Jm z|H(BJV|Xgz<9{Nml#l<(Xj~>*rpE0^Myy-L0;^@j=kxJD!(Av%B$VtJou4H#lg3EP z#+|kgWm=7*u{wSHPriu27ms}WPapr(K1sW>K2b?ET9A+b zxqi_~-R*%i>S&(L(P*W|@tA&NqDDnyrk1Nkacj!NLsNgi$Nw~Rh{pZ9wz1kY@^My# zxHN8uzMMJIxNQbg7`HIrbMo;&qp{F@{Lcm!+?11jAOF+zyy$Pd7v{yK{VXG_sHVy* zV=bD)jqd5=f37{6bv%}4xqh|Yu{6_5&6bRKozo+6ejZWKLtlFUtj`Do`�DN>v0;j*NSUn@AEC$So)`x?s<|%m5n{;d9tze zPb=N?B#kN?d(QJ@W9gq(y5~t6RW|mV=gG#>Kdp4nlQgPq>^aYqjirBD>1*Z5riuT# Lr)S@~#Q*$1&)N_z literal 0 HcmV?d00001 diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js b/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js new file mode 100644 index 0000000000..0eaa0ddf3d --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jplayer.playlist.js @@ -0,0 +1,452 @@ +/* + * Playlist Object for the jPlayer Plugin + * http://www.jplayer.org + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Version: 2.1.0 (jPlayer 2.1.0) + * Date: 1st September 2011 + */ + +/* Code verified using http://www.jshint.com/ */ +/*jshint asi:false, bitwise:false, boss:false, browser:true, curly:true, debug:false, eqeqeq:true, eqnull:false, evil:false, forin:false, immed:false, jquery:true, laxbreak:false, newcap:true, noarg:true, noempty:true, nonew:true, nomem:false, onevar:false, passfail:false, plusplus:false, regexp:false, undef:true, sub:false, strict:false, white:false */ +/*global jPlayerPlaylist: true, jQuery:false, alert:false */ + +(function($, undefined) { + + jPlayerPlaylist = function(cssSelector, playlist, options) { + var self = this; + + this.current = 0; + this.loop = false; // Flag used with the jPlayer repeat event + this.shuffled = false; + this.removing = false; // Flag is true during remove animation, disabling the remove() method until complete. + + this.cssSelector = $.extend({}, this._cssSelector, cssSelector); // Object: Containing the css selectors for jPlayer and its cssSelectorAncestor + this.options = $.extend(true, {}, this._options, options); // Object: The jPlayer constructor options for this playlist and the playlist options + + this.playlist = []; // Array of Objects: The current playlist displayed (Un-shuffled or Shuffled) + this.original = []; // Array of Objects: The original playlist + + this._initPlaylist(playlist); // Copies playlist to this.original. Then mirrors this.original to this.playlist. Creating two arrays, where the element pointers match. (Enables pointer comparison.) + + // Setup the css selectors for the extra interface items used by the playlist. + this.cssSelector.title = this.cssSelector.cssSelectorAncestor + " .jp-title"; // Note that the text is written to the decendant li node. + this.cssSelector.playlist = this.cssSelector.cssSelectorAncestor + " .jp-playlist"; + this.cssSelector.next = this.cssSelector.cssSelectorAncestor + " .jp-next"; + this.cssSelector.previous = this.cssSelector.cssSelectorAncestor + " .jp-previous"; + this.cssSelector.shuffle = this.cssSelector.cssSelectorAncestor + " .jp-shuffle"; + this.cssSelector.shuffleOff = this.cssSelector.cssSelectorAncestor + " .jp-shuffle-off"; + + // Override the cssSelectorAncestor given in options + this.options.cssSelectorAncestor = this.cssSelector.cssSelectorAncestor; + + // Override the default repeat event handler + this.options.repeat = function(event) { + self.loop = event.jPlayer.options.loop; + }; + + // Create a ready event handler to initialize the playlist + $(this.cssSelector.jPlayer).bind($.jPlayer.event.ready, function(event) { + self._init(); + }); + + // Create an ended event handler to move to the next item + $(this.cssSelector.jPlayer).bind($.jPlayer.event.ended, function(event) { + self.next(); + }); + + // Create a play event handler to pause other instances + $(this.cssSelector.jPlayer).bind($.jPlayer.event.play, function(event) { + $(this).jPlayer("pauseOthers"); + }); + + // Create a resize event handler to show the title in full screen mode. + $(this.cssSelector.jPlayer).bind($.jPlayer.event.resize, function(event) { + if(event.jPlayer.options.fullScreen) { + $(self.cssSelector.title).show(); + } else { + $(self.cssSelector.title).hide(); + } + }); + + // Create click handlers for the extra buttons that do playlist functions. + $(this.cssSelector.previous).click(function() { + self.previous(); + $(this).blur(); + return false; + }); + + $(this.cssSelector.next).click(function() { + self.next(); + $(this).blur(); + return false; + }); + + $(this.cssSelector.shuffle).click(function() { + self.shuffle(true); + return false; + }); + $(this.cssSelector.shuffleOff).click(function() { + self.shuffle(false); + return false; + }).hide(); + + // Put the title in its initial display state + if(!this.options.fullScreen) { + $(this.cssSelector.title).hide(); + } + + // Remove the empty
    • from the page HTML. Allows page to be valid HTML, while not interfereing with display animations + $(this.cssSelector.playlist + " ul").empty(); + + // Create .live() handlers for the playlist items along with the free media and remove controls. + this._createItemHandlers(); + + // Instance jPlayer + $(this.cssSelector.jPlayer).jPlayer(this.options); + }; + + jPlayerPlaylist.prototype = { + _cssSelector: { // static object, instanced in constructor + jPlayer: "#jquery_jplayer_1", + cssSelectorAncestor: "#jp_container_1" + }, + _options: { // static object, instanced in constructor + playlistOptions: { + autoPlay: false, + loopOnPrevious: false, + shuffleOnLoop: true, + enableRemoveControls: false, + displayTime: 'slow', + addTime: 'fast', + removeTime: 'fast', + shuffleTime: 'slow', + itemClass: "jp-playlist-item", + freeGroupClass: "jp-free-media", + freeItemClass: "jp-playlist-item-free", + removeItemClass: "jp-playlist-item-remove" + } + }, + option: function(option, value) { // For changing playlist options only + if(value === undefined) { + return this.options.playlistOptions[option]; + } + + this.options.playlistOptions[option] = value; + + switch(option) { + case "enableRemoveControls": + this._updateControls(); + break; + case "itemClass": + case "freeGroupClass": + case "freeItemClass": + case "removeItemClass": + this._refresh(true); // Instant + this._createItemHandlers(); + break; + } + return this; + }, + _init: function() { + var self = this; + this._refresh(function() { + if(self.options.playlistOptions.autoPlay) { + self.play(self.current); + } else { + self.select(self.current); + } + }); + }, + _initPlaylist: function(playlist) { + this.current = 0; + this.shuffled = false; + this.removing = false; + this.original = $.extend(true, [], playlist); // Copy the Array of Objects + this._originalPlaylist(); + }, + _originalPlaylist: function() { + var self = this; + this.playlist = []; + // Make both arrays point to the same object elements. Gives us 2 different arrays, each pointing to the same actual object. ie., Not copies of the object. + $.each(this.original, function(i,v) { + self.playlist[i] = self.original[i]; + }); + }, + _refresh: function(instant) { + /* instant: Can be undefined, true or a function. + * undefined -> use animation timings + * true -> no animation + * function -> use animation timings and excute function at half way point. + */ + var self = this; + + if(instant && !$.isFunction(instant)) { + $(this.cssSelector.playlist + " ul").empty(); + $.each(this.playlist, function(i,v) { + $(self.cssSelector.playlist + " ul").append(self._createListItem(self.playlist[i])); + }); + this._updateControls(); + } else { + var displayTime = $(this.cssSelector.playlist + " ul").children().length ? this.options.playlistOptions.displayTime : 0; + + $(this.cssSelector.playlist + " ul").slideUp(displayTime, function() { + var $this = $(this); + $(this).empty(); + + $.each(self.playlist, function(i,v) { + $this.append(self._createListItem(self.playlist[i])); + }); + self._updateControls(); + if($.isFunction(instant)) { + instant(); + } + if(self.playlist.length) { + $(this).slideDown(self.options.playlistOptions.displayTime); + } else { + $(this).show(); + } + }); + } + }, + _createListItem: function(media) { + var self = this; + + // Wrap the
    • contents in a
      + var listItem = "
    • "; + + // Create remove control + listItem += "×"; + + // Create links to free media + if(media.free) { + var first = true; + listItem += "("; + $.each(media, function(property,value) { + if($.jPlayer.prototype.format[property]) { // Check property is a media format. + if(first) { + first = false; + } else { + listItem += " | "; + } + listItem += "" + property + ""; + } + }); + listItem += ")"; + } + + // The title is given next in the HTML otherwise the float:right on the free media corrupts in IE6/7 + listItem += "" + media.title + (media.artist ? " " : "") + ""; + listItem += "
    • "; + + return listItem; + }, + _createItemHandlers: function() { + var self = this; + // Create .live() handlers for the playlist items + $(this.cssSelector.playlist + " a." + this.options.playlistOptions.itemClass).die("click").live("click", function() { + var index = $(this).parent().parent().index(); + if(self.current !== index) { + self.play(index); + } else { + $(self.cssSelector.jPlayer).jPlayer("play"); + } + $(this).blur(); + return false; + }); + + // Create .live() handlers that disable free media links to force access via right click + $(self.cssSelector.playlist + " a." + this.options.playlistOptions.freeItemClass).die("click").live("click", function() { + $(this).parent().parent().find("." + self.options.playlistOptions.itemClass).click(); + $(this).blur(); + return false; + }); + + // Create .live() handlers for the remove controls + $(self.cssSelector.playlist + " a." + this.options.playlistOptions.removeItemClass).die("click").live("click", function() { + var index = $(this).parent().parent().index(); + self.remove(index); + $(this).blur(); + return false; + }); + }, + _updateControls: function() { + if(this.options.playlistOptions.enableRemoveControls) { + $(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).show(); + } else { + $(this.cssSelector.playlist + " ." + this.options.playlistOptions.removeItemClass).hide(); + } + if(this.shuffled) { + $(this.cssSelector.shuffleOff).show(); + $(this.cssSelector.shuffle).hide(); + } else { + $(this.cssSelector.shuffleOff).hide(); + $(this.cssSelector.shuffle).show(); + } + }, + _highlight: function(index) { + if(this.playlist.length && index !== undefined) { + $(this.cssSelector.playlist + " .jp-playlist-current").removeClass("jp-playlist-current"); + $(this.cssSelector.playlist + " li:nth-child(" + (index + 1) + ")").addClass("jp-playlist-current").find(".jp-playlist-item").addClass("jp-playlist-current"); + $(this.cssSelector.title + " li").html(this.playlist[index].title + (this.playlist[index].artist ? " " : "")); + } + }, + setPlaylist: function(playlist) { + this._initPlaylist(playlist); + this._init(); + }, + add: function(media, playNow) { + $(this.cssSelector.playlist + " ul").append(this._createListItem(media)).find("li:last-child").hide().slideDown(this.options.playlistOptions.addTime); + this._updateControls(); + this.original.push(media); + this.playlist.push(media); // Both array elements share the same object pointer. Comforms with _initPlaylist(p) system. + + if(playNow) { + this.play(this.playlist.length - 1); + } else { + if(this.original.length === 1) { + this.select(0); + } + } + }, + remove: function(index) { + var self = this; + + if(index === undefined) { + this._initPlaylist([]); + this._refresh(function() { + $(self.cssSelector.jPlayer).jPlayer("clearMedia"); + }); + return true; + } else { + + if(this.removing) { + return false; + } else { + index = (index < 0) ? self.original.length + index : index; // Negative index relates to end of array. + if(0 <= index && index < this.playlist.length) { + this.removing = true; + + $(this.cssSelector.playlist + " li:nth-child(" + (index + 1) + ")").slideUp(this.options.playlistOptions.removeTime, function() { + $(this).remove(); + + if(self.shuffled) { + var item = self.playlist[index]; + $.each(self.original, function(i,v) { + if(self.original[i] === item) { + self.original.splice(i, 1); + return false; // Exit $.each + } + }); + self.playlist.splice(index, 1); + } else { + self.original.splice(index, 1); + self.playlist.splice(index, 1); + } + + if(self.original.length) { + if(index === self.current) { + self.current = (index < self.original.length) ? self.current : self.original.length - 1; // To cope when last element being selected when it was removed + self.select(self.current); + } else if(index < self.current) { + self.current--; + } + } else { + $(self.cssSelector.jPlayer).jPlayer("clearMedia"); + self.current = 0; + self.shuffled = false; + self._updateControls(); + } + + self.removing = false; + }); + } + return true; + } + } + }, + select: function(index) { + index = (index < 0) ? this.original.length + index : index; // Negative index relates to end of array. + if(0 <= index && index < this.playlist.length) { + this.current = index; + this._highlight(index); + $(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); + } else { + this.current = 0; + } + }, + play: function(index) { + index = (index < 0) ? this.original.length + index : index; // Negative index relates to end of array. + if(0 <= index && index < this.playlist.length) { + if(this.playlist.length) { + this.select(index); + $(this.cssSelector.jPlayer).jPlayer("play"); + } + } else if(index === undefined) { + $(this.cssSelector.jPlayer).jPlayer("play"); + } + }, + pause: function() { + $(this.cssSelector.jPlayer).jPlayer("pause"); + }, + next: function() { + var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; + + if(this.loop) { + // See if we need to shuffle before looping to start, and only shuffle if more than 1 item. + if(index === 0 && this.shuffled && this.options.playlistOptions.shuffleOnLoop && this.playlist.length > 1) { + this.shuffle(true, true); // playNow + } else { + this.play(index); + } + } else { + // The index will be zero if it just looped round + if(index > 0) { + this.play(index); + } + } + }, + previous: function() { + var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; + + if(this.loop && this.options.playlistOptions.loopOnPrevious || index < this.playlist.length - 1) { + this.play(index); + } + }, + shuffle: function(shuffled, playNow) { + var self = this; + + if(shuffled === undefined) { + shuffled = !this.shuffled; + } + + if(shuffled || shuffled !== this.shuffled) { + + $(this.cssSelector.playlist + " ul").slideUp(this.options.playlistOptions.shuffleTime, function() { + self.shuffled = shuffled; + if(shuffled) { + self.playlist.sort(function() { + return 0.5 - Math.random(); + }); + } else { + self._originalPlaylist(); + } + self._refresh(true); // Instant + + if(playNow || !$(self.cssSelector.jPlayer).data("jPlayer").status.paused) { + self.play(0); + } else { + self.select(0); + } + + $(this).slideDown(self.options.playlistOptions.shuffleTime); + }); + } + } + }; +})(jQuery); diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js b/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js new file mode 100644 index 0000000000..46c090a1b0 --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/add-on/jquery.jplayer.inspector.js @@ -0,0 +1,331 @@ +/* + * jPlayerInspector Plugin for jPlayer (2.0.0+) Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Version: 1.0.3 + * Date: 7th August 2011 + * + * For use with jPlayer Version: 2.0.29 + * + * Note: Declare inspector instances after jPlayer instances. ie., Otherwise the jPlayer instance is nonsense. + */ + +(function($, undefined) { + $.jPlayerInspector = {}; + $.jPlayerInspector.i = 0; + $.jPlayerInspector.defaults = { + jPlayer: undefined, // The jQuery selector of the jPlayer instance to inspect. + idPrefix: "jplayer_inspector_", + visible: false + }; + + var methods = { + init: function(options) { + var self = this; + var $this = $(this); + + var config = $.extend({}, $.jPlayerInspector.defaults, options); + $(this).data("jPlayerInspector", config); + + config.id = $(this).attr("id"); + config.jPlayerId = config.jPlayer.attr("id"); + + config.windowId = config.idPrefix + "window_" + $.jPlayerInspector.i; + config.statusId = config.idPrefix + "status_" + $.jPlayerInspector.i; + config.configId = config.idPrefix + "config_" + $.jPlayerInspector.i; + config.toggleId = config.idPrefix + "toggle_" + $.jPlayerInspector.i; + config.eventResetId = config.idPrefix + "event_reset_" + $.jPlayerInspector.i; + config.updateId = config.idPrefix + "update_" + $.jPlayerInspector.i; + config.eventWindowId = config.idPrefix + "event_window_" + $.jPlayerInspector.i; + + config.eventId = {}; + config.eventJq = {}; + config.eventTimeout = {}; + config.eventOccurrence = {}; + + $.each($.jPlayer.event, function(eventName,eventType) { + config.eventId[eventType] = config.idPrefix + "event_" + eventName + "_" + $.jPlayerInspector.i; + config.eventOccurrence[eventType] = 0; + }); + + var structure = + '

      ' + (config.visible ? "Hide" : "Show") + ' jPlayer Inspector

      ' + + '
      ' + + '
      ' + + '
      ' + + '

      jPlayer events that have occurred over the past 1 second:' + + '
      (Backgrounds: Never occurred Occurred before Occurred Multiple occurrences reset)

      '; + + // MJP: Would use the next 3 lines for ease, but the events are just slapped on the page. + // $.each($.jPlayer.event, function(eventName,eventType) { + // structure += '
      ' + eventName + '
      '; + // }); + + var eventStyle = "float:left;margin:0 5px 5px 0;padding:0 5px;border:1px dotted #000;"; + // MJP: Doing it longhand so order and layout easier to control. + structure += + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + '
      ' + + + '
      '; + + // MJP: Would like a check here in case we missed an event. + + // MJP: Check fails, since it is not on the page yet. +/* $.each($.jPlayer.event, function(eventName,eventType) { + if($("#" + config.eventId[eventType])[0] === undefined) { + structure += '
      ' + eventName + '
      '; + } + }); +*/ + structure += + '
      ' + + '

      Update jPlayer Inspector

      ' + + '
      ' + + '
      '; + $(this).html(structure); + + config.windowJq = $("#" + config.windowId); + config.statusJq = $("#" + config.statusId); + config.configJq = $("#" + config.configId); + config.toggleJq = $("#" + config.toggleId); + config.eventResetJq = $("#" + config.eventResetId); + config.updateJq = $("#" + config.updateId); + + $.each($.jPlayer.event, function(eventName,eventType) { + config.eventJq[eventType] = $("#" + config.eventId[eventType]); + config.eventJq[eventType].text(eventName + " (" + config.eventOccurrence[eventType] + ")"); // Sets the text to the event name and (0); + + config.jPlayer.bind(eventType + ".jPlayerInspector", function(e) { + config.eventOccurrence[e.type]++; + if(config.eventOccurrence[e.type] > 1) { + config.eventJq[e.type].css("background-color","#ff9"); + } else { + config.eventJq[e.type].css("background-color","#9f9"); + } + config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")"); + // The timer to handle the color + clearTimeout(config.eventTimeout[e.type]); + config.eventTimeout[e.type] = setTimeout(function() { + config.eventJq[e.type].css("background-color","#fff"); + }, 1000); + // The timer to handle the occurences. + setTimeout(function() { + config.eventOccurrence[e.type]--; + config.eventJq[e.type].text(eventName + " (" + config.eventOccurrence[e.type] + ")"); + }, 1000); + if(config.visible) { // Update the status, if inspector open. + $this.jPlayerInspector("updateStatus"); + } + }); + }); + + config.jPlayer.bind($.jPlayer.event.ready + ".jPlayerInspector", function(e) { + $this.jPlayerInspector("updateConfig"); + }); + + config.toggleJq.click(function() { + if(config.visible) { + $(this).text("Show"); + config.windowJq.hide(); + config.statusJq.empty(); + config.configJq.empty(); + } else { + $(this).text("Hide"); + config.windowJq.show(); + config.updateJq.click(); + } + config.visible = !config.visible; + $(this).blur(); + return false; + }); + + config.eventResetJq.click(function() { + $.each($.jPlayer.event, function(eventName,eventType) { + config.eventJq[eventType].css("background-color","#eee"); + }); + $(this).blur(); + return false; + }); + + config.updateJq.click(function() { + $this.jPlayerInspector("updateStatus"); + $this.jPlayerInspector("updateConfig"); + return false; + }); + + if(!config.visible) { + config.windowJq.hide(); + } else { + // config.updateJq.click(); + } + + $.jPlayerInspector.i++; + + return this; + }, + destroy: function() { + $(this).data("jPlayerInspector") && $(this).data("jPlayerInspector").jPlayer.unbind(".jPlayerInspector"); + $(this).empty(); + }, + updateConfig: function() { // This displays information about jPlayer's configuration in inspector + + var jPlayerInfo = "

      This jPlayer instance is running in your browser where:
      " + + for(i = 0; i < $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions.length; i++) { + var solution = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").solutions[i]; + jPlayerInfo += " jPlayer's " + solution + " solution is"; + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].used) { + jPlayerInfo += " being used and will support:"; + for(format in $(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support) { + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer")[solution].support[format]) { + jPlayerInfo += " " + format; + } + } + jPlayerInfo += "
      "; + } else { + jPlayerInfo += " not required
      "; + } + } + jPlayerInfo += "

      "; + + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.active) { + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) { + jPlayerInfo += "Problem with jPlayer since both HTML5 and Flash are active."; + } else { + jPlayerInfo += "The HTML5 is active."; + } + } else { + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").flash.active) { + jPlayerInfo += "The Flash is active."; + } else { + jPlayerInfo += "No solution is currently active. jPlayer needs a setMedia()."; + } + } + jPlayerInfo += "

      "; + + var formatType = $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.formatType; + jPlayerInfo += "

      status.formatType = '" + formatType + "'
      "; + if(formatType) { + jPlayerInfo += "Browser canPlay('" + $.jPlayer.prototype.format[formatType].codec + "')"; + } else { + jPlayerInfo += "

      "; + } + + jPlayerInfo += "

      status.src = '" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.src + "'

      "; + + jPlayerInfo += "

      status.media = {
      "; + for(prop in $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media) { + jPlayerInfo += " " + prop + ": " + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.media[prop] + "
      "; // Some are strings + } + jPlayerInfo += "};

      " + + + "

      Raw browser test for HTML5 support. Should equal a function if HTML5 is available.
      "; + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.audio.available) { + jPlayerInfo += "htmlElement.audio.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.audio.canPlayType) +"
      " + } + if($(this).data("jPlayerInspector").jPlayer.data("jPlayer").html.video.available) { + jPlayerInfo += "htmlElement.video.canPlayType = " + (typeof $(this).data("jPlayerInspector").jPlayer.data("jPlayer").htmlElement.video.canPlayType) +""; + } + jPlayerInfo += "

      "; + + jPlayerInfo += "

      This instance is using the constructor options:
      " + + "$('#" + $(this).data("jPlayerInspector").jPlayer.data("jPlayer").internal.self.id + "').jPlayer({
      " + + + " swfPath: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "swfPath") + "',
      " + + + " solution: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "solution") + "',
      " + + + " supplied: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "supplied") + "',
      " + + + " preload: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "preload") + "',
      " + + + " volume: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "volume") + ",
      " + + + " muted: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "muted") + ",
      " + + + " backgroundColor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "backgroundColor") + "',
      " + + + " cssSelectorAncestor: '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelectorAncestor") + "',
      " + + + " cssSelector: {"; + + var cssSelector = $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector"); + for(prop in cssSelector) { + + // jPlayerInfo += "
        " + prop + ": '" + cssSelector[prop] + "'," // This works too of course, but want to use option method for deep keys. + jPlayerInfo += "
        " + prop + ": '" + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "cssSelector." + prop) + "'," + } + + jPlayerInfo = jPlayerInfo.slice(0, -1); // Because the sloppy comma was bugging me. + + jPlayerInfo += "
       },
      " + + + " errorAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "errorAlerts") + ",
      " + + + " warningAlerts: " + $(this).data("jPlayerInspector").jPlayer.jPlayer("option", "warningAlerts") + "
      " + + + "});

      "; + $(this).data("jPlayerInspector").configJq.html(jPlayerInfo); + return this; + }, + updateStatus: function() { // This displays information about jPlayer's status in the inspector + $(this).data("jPlayerInspector").statusJq.html( + "

      jPlayer is " + + ($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.paused ? "paused" : "playing") + + " at time: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentTime*10)/10 + "s." + + " (d: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.duration*10)/10 + "s" + + ", sp: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.seekPercent) + "%" + + ", cpr: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentRelative) + "%" + + ", cpa: " + Math.floor($(this).data("jPlayerInspector").jPlayer.data("jPlayer").status.currentPercentAbsolute) + "%)

      " + ); + return this; + } + }; + $.fn.jPlayerInspector = function( method ) { + // Method calling logic + if ( methods[method] ) { + return methods[ method ].apply( this, Array.prototype.slice.call( arguments, 1 )); + } else if ( typeof method === 'object' || ! method ) { + return methods.init.apply( this, arguments ); + } else { + $.error( 'Method ' + method + ' does not exist on jQuery.jPlayerInspector' ); + } + }; +})(jQuery); diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as new file mode 100644 index 0000000000..addb97a7ae --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerEvent.as @@ -0,0 +1,69 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 8th August 2011 + */ + +package happyworm.jPlayer { + import flash.events.Event; + + public class JplayerEvent extends Event { + + // The event strings must match those in the JavaScript's $.jPlayer.event object + + public static const JPLAYER_READY:String = "jPlayer_ready"; + public static const JPLAYER_FLASHRESET:String = "jPlayer_flashreset"; // Handled in JavaScript + public static const JPLAYER_RESIZE:String = "jPlayer_resize"; // Handled in JavaScript + public static const JPLAYER_REPEAT:String = "jPlayer_repeat"; // Handled in JavaScript + public static const JPLAYER_CLICK:String = "jPlayer_click"; + public static const JPLAYER_ERROR:String = "jPlayer_error"; + public static const JPLAYER_WARNING:String = "jPlayer_warning"; // Currently not used by the flash solution + + public static const JPLAYER_LOADSTART:String = "jPlayer_loadstart"; + public static const JPLAYER_PROGRESS:String = "jPlayer_progress"; + public static const JPLAYER_SUSPEND:String = "jPlayer_suspend"; // Not implemented + public static const JPLAYER_ABORT:String = "jPlayer_abort"; // Not implemented + public static const JPLAYER_EMPTIED:String = "jPlayer_emptied"; // Not implemented + public static const JPLAYER_STALLED:String = "jPlayer_stalled"; // Not implemented + public static const JPLAYER_PLAY:String = "jPlayer_play"; + public static const JPLAYER_PAUSE:String = "jPlayer_pause"; + public static const JPLAYER_LOADEDMETADATA:String = "jPlayer_loadedmetadata"; // MP3 has no equivilent + public static const JPLAYER_LOADEDDATA:String = "jPlayer_loadeddata"; // Not implemented + public static const JPLAYER_WAITING:String = "jPlayer_waiting"; // Not implemented + public static const JPLAYER_PLAYING:String = "jPlayer_playing"; // Not implemented + public static const JPLAYER_CANPLAY:String = "jPlayer_canplay"; // Not implemented + public static const JPLAYER_CANPLAYTHROUGH:String = "jPlayer_canplaythrough"; // Not implemented + public static const JPLAYER_SEEKING:String = "jPlayer_seeking"; + public static const JPLAYER_SEEKED:String = "jPlayer_seeked"; + public static const JPLAYER_TIMEUPDATE:String = "jPlayer_timeupdate"; + public static const JPLAYER_ENDED:String = "jPlayer_ended"; + public static const JPLAYER_RATECHANGE:String = "jPlayer_ratechange"; // Not implemented + public static const JPLAYER_DURATIONCHANGE:String = "jPlayer_durationchange"; // Not implemented + public static const JPLAYER_VOLUMECHANGE:String = "jPlayer_volumechange"; // See JavaScript + + // Events used internal to jPlayer's Flash. + public static const DEBUG_MSG:String = "debug_msg"; + + public var data:JplayerStatus; + public var msg:String = "" + + public function JplayerEvent(type:String, data:JplayerStatus, msg:String = "", bubbles:Boolean = false, cancelable:Boolean = false) { + super(type, bubbles, cancelable); + this.data = data; + this.msg = msg; + } + public override function clone():Event { + return new JplayerEvent(type, data, msg, bubbles, cancelable); + } + public override function toString():String { + return formatToString("JplayerEvent", "type", "bubbles", "cancelable", "eventPhase", "data", "msg"); + } + } +} \ No newline at end of file diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as new file mode 100644 index 0000000000..8c51d5b763 --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp3.as @@ -0,0 +1,328 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 1st September 2011 + */ + +package happyworm.jPlayer { + import flash.display.Sprite; + + import flash.media.Sound; + import flash.media.SoundChannel; + import flash.media.SoundLoaderContext; + import flash.media.SoundTransform; + import flash.net.URLRequest; + import flash.utils.Timer; + import flash.errors.IOError; + import flash.events.*; + + public class JplayerMp3 extends Sprite { + private var mySound:Sound = new Sound(); + private var myChannel:SoundChannel = new SoundChannel(); + private var myContext:SoundLoaderContext = new SoundLoaderContext(3000, false); + private var myTransform:SoundTransform = new SoundTransform(); + private var myRequest:URLRequest = new URLRequest(); + + private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over. + + public var myStatus:JplayerStatus = new JplayerStatus(); + + public function JplayerMp3(volume:Number) { + timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler); + progressTimer.addEventListener(TimerEvent.TIMER, progressHandler); + seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler); + setVolume(volume); + } + public function setFile(src:String):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "setFile: " + src)); + if(myStatus.isPlaying) { + myChannel.stop(); + progressUpdates(false); + timeUpdates(false); + } + try { + mySound.close(); + } catch (err:IOError) { + // Occurs if the file is either yet to be opened or has finished downloading. + } + mySound = null; + mySound = new Sound(); + mySound.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); + mySound.addEventListener(Event.OPEN, loadOpen); + mySound.addEventListener(Event.COMPLETE, loadComplete); + myRequest = new URLRequest(src); + myStatus.reset(); + myStatus.src = src; + myStatus.srcSet = true; + timeUpdateEvent(); + } + public function clearFile():void { + setFile(""); + myStatus.srcSet = false; + } + private function errorHandler(err:IOErrorEvent):void { + // MP3 player needs to stop progress and timeupdate events as they are started before the error occurs. + // NB: The MP4 player works differently and the error occurs before they are started. + progressUpdates(false); + timeUpdates(false); + myStatus.error(); // Resets status except the src, and it sets srcError property. + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus)); + } + private function loadOpen(e:Event):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadOpen:")); + myStatus.loading(); + if(myStatus.playOnLoad) { + myStatus.playOnLoad = false; // Capture the flag + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); // So loadstart event happens before play event occurs. + play(); + } else { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); + pause(); + } + progressUpdates(true); + } + private function loadComplete(e:Event):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "loadComplete:")); + myStatus.loaded(); + progressUpdates(false); + progressEvent(); + } + private function soundCompleteHandler(e:Event):void { + myStatus.pausePosition = 0; + myStatus.isPlaying = false; + timeUpdates(false); + timeUpdateEvent(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus)); + } + private function progressUpdates(active:Boolean):void { + // Using a timer rather than Flash's load progress event, because that event gave data at about 200Hz. The 10Hz timer is closer to HTML5 norm. + if(active) { + progressTimer.start(); + } else { + progressTimer.stop(); + } + } + private function progressHandler(e:TimerEvent):void { + progressEvent(); + } + private function progressEvent():void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:")); + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus)); + } + private function timeUpdates(active:Boolean):void { + if(active) { + timeUpdateTimer.start(); + } else { + timeUpdateTimer.stop(); + } + } + private function timeUpdateHandler(e:TimerEvent):void { + timeUpdateEvent(); + } + private function timeUpdateEvent():void { + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus)); + } + private function seeking(active:Boolean):void { + if(active) { + if(!myStatus.isSeeking) { + seekingEvent(); + seekingTimer.start(); + } + } else { + seekingTimer.stop(); + } + } + private function seekingHandler(e:TimerEvent):void { + if(myStatus.pausePosition <= getDuration()) { + seekedEvent(); + seeking(false); + if(myStatus.playOnSeek) { + myStatus.playOnSeek = false; // Capture the flag. + play(); + } + } else if(myStatus.isLoaded && (myStatus.pausePosition > getDuration())) { + // Illegal seek time + seeking(false); + seekedEvent(); + pause(0); + } + } + private function seekingEvent():void { + myStatus.isSeeking = true; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus)); + } + private function seekedEvent():void { + myStatus.isSeeking = false; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus)); + } + public function load():Boolean { + if(myStatus.loadRequired()) { + myStatus.startingDownload(); + mySound.load(myRequest, myContext); + return true; + } else { + return false; + } + } + public function play(time:Number = NaN):Boolean { + var wasPlaying:Boolean = myStatus.isPlaying; + + if(!isNaN(time) && myStatus.srcSet) { + if(myStatus.isPlaying) { + myChannel.stop(); + myStatus.isPlaying = false; + } + myStatus.pausePosition = time; + } + + if(myStatus.isStartingDownload) { + myStatus.playOnLoad = true; // Raise flag, captured in loadOpen() + return true; + } else if(myStatus.loadRequired()) { + myStatus.playOnLoad = true; // Raise flag, captured in loadOpen() + return load(); + } else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) { + if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end. + myStatus.pausePosition = 0; + timeUpdates(false); + timeUpdateEvent(); + if(wasPlaying) { // For when playing and then get a play(huge) + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + } else if(myStatus.pausePosition > getDuration()) { + myStatus.playOnSeek = true; + seeking(true); + } else { + myStatus.isPlaying = true; // Set immediately before playing. Could affects events. + myChannel = mySound.play(myStatus.pausePosition); + myChannel.soundTransform = myTransform; + myChannel.addEventListener(Event.SOUND_COMPLETE, soundCompleteHandler); + timeUpdates(true); + if(!wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus)); + } + } + return true; + } else { + return false; + } + } + public function pause(time:Number = NaN):Boolean { + myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before loadOpen() event. + myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set. + + var wasPlaying:Boolean = myStatus.isPlaying; + + // To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem. + var alreadyPausedAtTime:Boolean = false; + if(!isNaN(time) && myStatus.pausePosition == time) { + alreadyPausedAtTime = true; + } + + if(myStatus.isPlaying) { + myStatus.isPlaying = false; + myChannel.stop(); + if(myChannel.position > 0) { // Required otherwise a fast play then pause causes myChannel.position to equal zero and not the correct value. ie., When it happens leave pausePosition alone. + myStatus.pausePosition = myChannel.position; + } + } + + if(!isNaN(time) && myStatus.srcSet) { + myStatus.pausePosition = time; + } + + if(wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + + if(myStatus.isStartingDownload) { + return true; + } else if(myStatus.loadRequired()) { + if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation. + return load(); + } else { + return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required. + } + } else if(myStatus.isLoading || myStatus.isLoaded) { + if(myStatus.isLoaded && myStatus.pausePosition > getDuration()) { // The time is invalid, ie., past the end. + myStatus.pausePosition = 0; + } else if(myStatus.pausePosition > getDuration()) { + seeking(true); + } + timeUpdates(false); + // Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop. + // Neither pause() nor pause(time) will cause a timeupdate loop. + if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) { + timeUpdateEvent(); + } + return true; + } else { + return false; + } + } + public function playHead(percent:Number):Boolean { + var time:Number = percent * getDuration() / 100; + if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) { + return play(time); + } else { + return pause(time); + } + } + public function setVolume(v:Number):void { + myStatus.volume = v; + myTransform.volume = v; + myChannel.soundTransform = myTransform; + } + private function updateStatusValues():void { + myStatus.seekPercent = 100 * getLoadRatio(); + myStatus.currentTime = getCurrentTime(); + myStatus.currentPercentRelative = 100 * getCurrentRatioRel(); + myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs(); + myStatus.duration = getDuration(); + } + public function getLoadRatio():Number { + if((myStatus.isLoading || myStatus.isLoaded) && mySound.bytesTotal > 0) { + return mySound.bytesLoaded / mySound.bytesTotal; + } else { + return 0; + } + } + public function getDuration():Number { + if(mySound.length > 0) { + return mySound.length; + } else { + return 0; + } + } + public function getCurrentTime():Number { + if(myStatus.isPlaying) { + return myChannel.position; + } else { + return myStatus.pausePosition; + } + } + public function getCurrentRatioRel():Number { + if((getDuration() > 0) && (getCurrentTime() <= getDuration())) { + return getCurrentTime() / getDuration(); + } else { + return 0; + } + } + public function getCurrentRatioAbs():Number { + return getCurrentRatioRel() * getLoadRatio(); + } + } +} diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as new file mode 100644 index 0000000000..dcdc0655d0 --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerMp4.as @@ -0,0 +1,413 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 7th August 2011 + */ + +package happyworm.jPlayer { + import flash.display.Sprite; + + import flash.media.Video; + import flash.media.SoundTransform; + + import flash.net.NetConnection; + import flash.net.NetStream; + + import flash.utils.Timer; + + import flash.events.NetStatusEvent; + import flash.events.SecurityErrorEvent; + import flash.events.TimerEvent; + + public class JplayerMp4 extends Sprite { + + public var myVideo:Video = new Video(); + private var myConnection:NetConnection; + private var myStream:NetStream; + + private var myTransform:SoundTransform = new SoundTransform(); + + public var myStatus:JplayerStatus = new JplayerStatus(); + + private var timeUpdateTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var progressTimer:Timer = new Timer(250, 0); // Matched to HTML event freq + private var seekingTimer:Timer = new Timer(100, 0); // Internal: How often seeking is checked to see if it is over. + + public function JplayerMp4(volume:Number) { + myConnection = new NetConnection(); + myConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + myConnection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); + myVideo.smoothing = true; + this.addChild(myVideo); + + timeUpdateTimer.addEventListener(TimerEvent.TIMER, timeUpdateHandler); + progressTimer.addEventListener(TimerEvent.TIMER, progressHandler); + seekingTimer.addEventListener(TimerEvent.TIMER, seekingHandler); + + myStatus.volume = volume; + } + private function progressUpdates(active:Boolean):void { + if(active) { + progressTimer.start(); + } else { + progressTimer.stop(); + } + } + private function progressHandler(e:TimerEvent):void { + if(myStatus.isLoading) { + if(getLoadRatio() == 1) { // Close as can get to a loadComplete event since client.onPlayStatus only works with FMS + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressHandler: loadComplete")); + myStatus.loaded(); + progressUpdates(false); + } + } + progressEvent(); + } + private function progressEvent():void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "progressEvent:")); + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PROGRESS, myStatus)); + } + private function timeUpdates(active:Boolean):void { + if(active) { + timeUpdateTimer.start(); + } else { + timeUpdateTimer.stop(); + } + } + private function timeUpdateHandler(e:TimerEvent):void { + timeUpdateEvent(); + } + private function timeUpdateEvent():void { + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_TIMEUPDATE, myStatus)); + } + private function seeking(active:Boolean):void { + if(active) { + if(!myStatus.isSeeking) { + seekingEvent(); + } + seekingTimer.start(); + } else { + if(myStatus.isSeeking) { + seekedEvent(); + } + seekingTimer.stop(); + } + } + private function seekingHandler(e:TimerEvent):void { + if(getSeekTimeRatio() <= getLoadRatio()) { + seeking(false); + if(myStatus.playOnSeek) { + myStatus.playOnSeek = false; // Capture the flag. + play(myStatus.pausePosition); // Must pass time or the seek time is never set. + } else { + pause(myStatus.pausePosition); // Must pass time or the stream.time is read. + } + } else if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { + // Illegal seek time + seeking(false); + pause(0); + } + } + private function seekingEvent():void { + myStatus.isSeeking = true; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKING, myStatus)); + } + private function seekedEvent():void { + myStatus.isSeeking = false; + updateStatusValues(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_SEEKED, myStatus)); + } + private function netStatusHandler(e:NetStatusEvent):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "netStatusHandler: '" + e.info.code + "'")); + switch(e.info.code) { + case "NetConnection.Connect.Success": + connectStream(); + break; + case "NetStream.Play.Start": + // This event code occurs once, when the media is opened. Equiv to loadOpen() in mp3 player. + myStatus.loading(); + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADSTART, myStatus)); + progressUpdates(true); + // See onMetaDataHandler() for other condition, since duration is vital. + break; + case "NetStream.Play.Stop": + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "NetStream.Play.Stop: getDuration() - getCurrentTime() = " + (getDuration() - getCurrentTime()))); + + // Check if media is at the end (or close) otherwise this was due to download bandwidth stopping playback. ie., Download is not fast enough. + if(Math.abs(getDuration() - getCurrentTime()) < 150) { // Testing found 150ms worked best for M4A files, where playHead(99.9) caused a stuck state due to firing with ~116ms left to play. + endedEvent(); + } + break; + case "NetStream.Seek.InvalidTime": + // Used for capturing invalid set times and clicks on the end of the progress bar. + endedEvent(); + break; + case "NetStream.Play.StreamNotFound": + myStatus.error(); // Resets status except the src, and it sets srcError property. + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ERROR, myStatus)); + break; + } + // "NetStream.Seek.Notify" event code is not very useful. It occurs after every seek(t) command issued and does not appear to wait for the media to be ready. + } + private function endedEvent():void { + var wasPlaying:Boolean = myStatus.isPlaying; + pause(0); + timeUpdates(false); + timeUpdateEvent(); + if(wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_ENDED, myStatus)); + } + } + private function securityErrorHandler(event:SecurityErrorEvent):void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "securityErrorHandler.")); + } + private function connectStream():void { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "connectStream.")); + var customClient:Object = new Object(); + customClient.onMetaData = onMetaDataHandler; + // customClient.onPlayStatus = onPlayStatusHandler; // According to the forums and my tests, onPlayStatus only works with FMS (Flash Media Server). + myStream = null; + myStream = new NetStream(myConnection); + myStream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); + myStream.client = customClient; + myVideo.attachNetStream(myStream); + setVolume(myStatus.volume); + myStream.play(myStatus.src); + } + public function setFile(src:String):void { + if(myStream != null) { + myStream.close(); + } + myVideo.clear(); + progressUpdates(false); + timeUpdates(false); + + myStatus.reset(); + myStatus.src = src; + myStatus.srcSet = true; + timeUpdateEvent(); + } + public function clearFile():void { + setFile(""); + myStatus.srcSet = false; + } + public function load():Boolean { + if(myStatus.loadRequired()) { + myStatus.startingDownload(); + myConnection.connect(null); + return true; + } else { + return false; + } + } + public function play(time:Number = NaN):Boolean { + var wasPlaying:Boolean = myStatus.isPlaying; + + if(!isNaN(time) && myStatus.srcSet) { + if(myStatus.isPlaying) { + myStream.pause(); + myStatus.isPlaying = false; + } + myStatus.pausePosition = time; + } + + if(myStatus.isStartingDownload) { + myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler() + return true; + } else if(myStatus.loadRequired()) { + myStatus.playOnLoad = true; // Raise flag, captured in onMetaDataHandler() + return load(); + } else if((myStatus.isLoading || myStatus.isLoaded) && !myStatus.isPlaying) { + if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end. + myStream.pause(); // Since it is playing by default at this point. + myStatus.pausePosition = 0; + myStream.seek(0); + timeUpdates(false); + timeUpdateEvent(); + if(wasPlaying) { // For when playing and then get a play(huge) + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + } else if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount + myStatus.playOnSeek = true; + seeking(true); + myStream.pause(); // Since it is playing by default at this point. + } else { + if(!isNaN(time)) { // Avoid using seek() when it is already correct. + myStream.seek(myStatus.pausePosition/1000); // Since time is in ms and seek() takes seconds + } + myStatus.isPlaying = true; // Set immediately before playing. Could affects events. + myStream.resume(); + timeUpdates(true); + if(!wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PLAY, myStatus)); + } + } + return true; + } else { + return false; + } + } + public function pause(time:Number = NaN):Boolean { + myStatus.playOnLoad = false; // Reset flag in case load/play issued immediately before this command, ie., before onMetadata() event. + myStatus.playOnSeek = false; // Reset flag in case play(time) issued before the command and is still seeking to time set. + + var wasPlaying:Boolean = myStatus.isPlaying; + + // To avoid possible loops with timeupdate and pause(time). A pause() does not have the problem. + var alreadyPausedAtTime:Boolean = false; + if(!isNaN(time) && myStatus.pausePosition == time) { + alreadyPausedAtTime = true; + } + + // Need to wait for metadata to load before ever issuing a pause. The metadata handler will call this function if needed, when ready. + if(myStream != null && myStatus.metaDataReady) { // myStream is a null until the 1st media is loaded. ie., The 1st ever setMedia being followed by a pause() or pause(t). + myStream.pause(); + } + if(myStatus.isPlaying) { + myStatus.isPlaying = false; + myStatus.pausePosition = myStream.time * 1000; + } + + if(!isNaN(time) && myStatus.srcSet) { + myStatus.pausePosition = time; + } + + if(wasPlaying) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_PAUSE, myStatus)); + } + + if(myStatus.isStartingDownload) { + return true; + } else if(myStatus.loadRequired()) { + if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation. + return load(); + } else { + return true; // Technically the pause(0) succeeded. ie., It did nothing, since nothing was required. + } + } else if(myStatus.isLoading || myStatus.isLoaded) { + if(myStatus.metaDataReady && myStatus.pausePosition > myStatus.duration) { // The time is invalid, ie., past the end. + myStatus.pausePosition = 0; + myStream.seek(0); + seekedEvent(); // Deals with seeking effect when using setMedia() then pause(huge). NB: There is no preceeding seeking event. + } else if(!isNaN(time)) { + if(getSeekTimeRatio() > getLoadRatio()) { // Use an estimate based on the downloaded amount + seeking(true); + } else { + if(myStatus.metaDataReady) { // Otherwise seek(0) will stop the metadata loading. + myStream.seek(myStatus.pausePosition/1000); + } + } + } + timeUpdates(false); + // Need to be careful with timeupdate event, otherwise a pause in a timeupdate event can cause a loop. + // Neither pause() nor pause(time) will cause a timeupdate loop. + if(wasPlaying || !isNaN(time) && !alreadyPausedAtTime) { + timeUpdateEvent(); + } + return true; + } else { + return false; + } + } + public function playHead(percent:Number):Boolean { + var time:Number = percent * getDuration() * getLoadRatio() / 100; + if(myStatus.isPlaying || myStatus.playOnLoad || myStatus.playOnSeek) { + return play(time); + } else { + return pause(time); + } + } + public function setVolume(v:Number):void { + myStatus.volume = v; + myTransform.volume = v; + if(myStream != null) { + myStream.soundTransform = myTransform; + } + } + private function updateStatusValues():void { + myStatus.seekPercent = 100 * getLoadRatio(); + myStatus.currentTime = getCurrentTime(); + myStatus.currentPercentRelative = 100 * getCurrentRatioRel(); + myStatus.currentPercentAbsolute = 100 * getCurrentRatioAbs(); + myStatus.duration = getDuration(); + } + public function getLoadRatio():Number { + if((myStatus.isLoading || myStatus.isLoaded) && myStream.bytesTotal > 0) { + return myStream.bytesLoaded / myStream.bytesTotal; + } else { + return 0; + } + } + public function getDuration():Number { + return myStatus.duration; // Set from meta data. + } + public function getCurrentTime():Number { + if(myStatus.isPlaying) { + return myStream.time * 1000; + } else { + return myStatus.pausePosition; + } + } + public function getCurrentRatioRel():Number { + if((getLoadRatio() > 0) && (getCurrentRatioAbs() <= getLoadRatio())) { + return getCurrentRatioAbs() / getLoadRatio(); + } else { + return 0; + } + } + public function getCurrentRatioAbs():Number { + if(getDuration() > 0) { + return getCurrentTime() / getDuration(); + } else { + return 0; + } + } + public function getSeekTimeRatio():Number { + if(getDuration() > 0) { + return myStatus.pausePosition / getDuration(); + } else { + return 1; + } + } + public function onMetaDataHandler(info:Object):void { // Used in connectStream() in myStream.client object. + // This event occurs when jumping to the start of static files! ie., seek(0) will cause this event to occur. + if(!myStatus.metaDataReady) { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: " + info.duration + " | " + info.width + "x" + info.height)); + + myStatus.metaDataReady = true; // Set flag so that this event only effects jPlayer the 1st time. + myStatus.metaData = info; + myStatus.duration = info.duration * 1000; // Only available via Meta Data. + if(info.width != undefined) { + myVideo.width = info.width; + } + if(info.height != undefined) { + myVideo.height = info.height; + } + + if(myStatus.playOnLoad) { + myStatus.playOnLoad = false; // Capture the flag + if(myStatus.pausePosition > 0 ) { // Important for setMedia followed by play(time). + play(myStatus.pausePosition); + } else { + play(); // Not always sending pausePosition avoids the extra seek(0) for a normal play() command. + } + } else { + pause(myStatus.pausePosition); // Always send the pausePosition. Important for setMedia() followed by pause(time). Deals with not reading stream.time with setMedia() and play() immediately followed by stop() or pause(0) + } + this.dispatchEvent(new JplayerEvent(JplayerEvent.JPLAYER_LOADEDMETADATA, myStatus)); + } else { + this.dispatchEvent(new JplayerEvent(JplayerEvent.DEBUG_MSG, myStatus, "onMetaDataHandler: Already read (NO EFFECT)")); + } + } + } +} diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as new file mode 100644 index 0000000000..5cc1e1ff4b --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/happyworm/jPlayer/JplayerStatus.as @@ -0,0 +1,101 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.happyworm.com/jquery/jplayer + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Date: 1st September 2011 + */ + +package happyworm.jPlayer { + public class JplayerStatus { + + public static const VERSION:String = "2.1.0"; // The version of the Flash jPlayer entity. + + public var volume:Number = 0.5; // Not affected by reset() + public var muted:Boolean = false; // Not affected by reset() + + public var src:String; + public var srcError:Boolean; + + public var srcSet:Boolean; + public var isPlaying:Boolean; + public var isSeeking:Boolean; + + public var playOnLoad:Boolean; + public var playOnSeek:Boolean; + + public var isStartingDownload:Boolean; + public var isLoading:Boolean; + public var isLoaded:Boolean; + + public var pausePosition:Number; + + public var seekPercent:Number; + public var currentTime:Number; + public var currentPercentRelative:Number; + public var currentPercentAbsolute:Number; + public var duration:Number; + + public var metaDataReady:Boolean; + public var metaData:Object; + + public function JplayerStatus() { + reset(); + } + public function reset():void { + src = ""; + srcError = false; + + srcSet = false; + isPlaying = false; + isSeeking = false; + + playOnLoad = false; + playOnSeek = false; + + isStartingDownload = false; + isLoading = false; + isLoaded = false; + + pausePosition = 0; + + seekPercent = 0; + currentTime = 0; + currentPercentRelative = 0; + currentPercentAbsolute = 0; + duration = 0; + + metaDataReady = false; + metaData = {}; + } + public function error():void { + var srcSaved:String = src; + reset(); + src = srcSaved; + srcError = true; + } + public function loadRequired():Boolean { + return (srcSet && !isStartingDownload && !isLoading && !isLoaded); + } + public function startingDownload():void { + isStartingDownload = true; + isLoading = false; + isLoaded = false; + } + public function loading():void { + isStartingDownload = false; + isLoading = true; + isLoaded = false; + } + public function loaded():void { + isStartingDownload = false; + isLoading = false; + isLoaded = true; + } + } +} diff --git a/apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js b/apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js new file mode 100644 index 0000000000..9d41a12ee6 --- /dev/null +++ b/apps/media/js/jQuery.jPlayer.2.1.0.source/jquery.jplayer.js @@ -0,0 +1,2349 @@ +/* + * jPlayer Plugin for jQuery JavaScript Library + * http://www.jplayer.org + * + * Copyright (c) 2009 - 2011 Happyworm Ltd + * Dual licensed under the MIT and GPL licenses. + * - http://www.opensource.org/licenses/mit-license.php + * - http://www.gnu.org/copyleft/gpl.html + * + * Author: Mark J Panaghiston + * Version: 2.1.0 + * Date: 1st September 2011 + */ + +/* Code verified using http://www.jshint.com/ */ +/*jshint asi:false, bitwise:false, boss:false, browser:true, curly:true, debug:false, eqeqeq:true, eqnull:false, evil:false, forin:false, immed:false, jquery:true, laxbreak:false, newcap:true, noarg:true, noempty:true, nonew:true, nomem:false, onevar:false, passfail:false, plusplus:false, regexp:false, undef:true, sub:false, strict:false, white:false */ +/*global jQuery:false, ActiveXObject:false, alert:false */ + +(function($, undefined) { + + // Adapted from jquery.ui.widget.js (1.8.7): $.widget.bridge + $.fn.jPlayer = function( options ) { + var name = "jPlayer"; + var isMethodCall = typeof options === "string", + args = Array.prototype.slice.call( arguments, 1 ), + returnValue = this; + + // allow multiple hashes to be passed on init + options = !isMethodCall && args.length ? + $.extend.apply( null, [ true, options ].concat(args) ) : + options; + + // prevent calls to internal methods + if ( isMethodCall && options.charAt( 0 ) === "_" ) { + return returnValue; + } + + if ( isMethodCall ) { + this.each(function() { + var instance = $.data( this, name ), + methodValue = instance && $.isFunction( instance[options] ) ? + instance[ options ].apply( instance, args ) : + instance; + if ( methodValue !== instance && methodValue !== undefined ) { + returnValue = methodValue; + return false; + } + }); + } else { + this.each(function() { + var instance = $.data( this, name ); + if ( instance ) { + // instance.option( options || {} )._init(); // Orig jquery.ui.widget.js code: Not recommend for jPlayer. ie., Applying new options to an existing instance (via the jPlayer constructor) and performing the _init(). The _init() is what concerns me. It would leave a lot of event handlers acting on jPlayer instance and the interface. + instance.option( options || {} ); // The new constructor only changes the options. Changing options only has basic support atm. + } else { + $.data( this, name, new $.jPlayer( options, this ) ); + } + }); + } + + return returnValue; + }; + + $.jPlayer = function( options, element ) { + // allow instantiation without initializing for simple inheritance + if ( arguments.length ) { + this.element = $(element); + this.options = $.extend(true, {}, + this.options, + options + ); + var self = this; + this.element.bind( "remove.jPlayer", function() { + self.destroy(); + }); + this._init(); + } + }; + // End of: (Adapted from jquery.ui.widget.js (1.8.7)) + + // Emulated HTML5 methods and properties + $.jPlayer.emulateMethods = "load play pause"; + $.jPlayer.emulateStatus = "src readyState networkState currentTime duration paused ended playbackRate"; + $.jPlayer.emulateOptions = "muted volume"; + + // Reserved event names generated by jPlayer that are not part of the HTML5 Media element spec + $.jPlayer.reservedEvent = "ready flashreset resize repeat error warning"; + + // Events generated by jPlayer + $.jPlayer.event = { + ready: "jPlayer_ready", + flashreset: "jPlayer_flashreset", // Similar to the ready event if the Flash solution is set to display:none and then shown again or if it's reloaded for another reason by the browser. For example, using CSS position:fixed on Firefox for the full screen feature. + resize: "jPlayer_resize", // Occurs when the size changes through a full/restore screen operation or if the size/sizeFull options are changed. + repeat: "jPlayer_repeat", // Occurs when the repeat status changes. Usually through clicks on the repeat button of the interface. + click: "jPlayer_click", // Occurs when the user clicks on one of the following: poster image, html video, flash video. + error: "jPlayer_error", // Event error code in event.jPlayer.error.type. See $.jPlayer.error + warning: "jPlayer_warning", // Event warning code in event.jPlayer.warning.type. See $.jPlayer.warning + + // Other events match HTML5 spec. + loadstart: "jPlayer_loadstart", + progress: "jPlayer_progress", + suspend: "jPlayer_suspend", + abort: "jPlayer_abort", + emptied: "jPlayer_emptied", + stalled: "jPlayer_stalled", + play: "jPlayer_play", + pause: "jPlayer_pause", + loadedmetadata: "jPlayer_loadedmetadata", + loadeddata: "jPlayer_loadeddata", + waiting: "jPlayer_waiting", + playing: "jPlayer_playing", + canplay: "jPlayer_canplay", + canplaythrough: "jPlayer_canplaythrough", + seeking: "jPlayer_seeking", + seeked: "jPlayer_seeked", + timeupdate: "jPlayer_timeupdate", + ended: "jPlayer_ended", + ratechange: "jPlayer_ratechange", + durationchange: "jPlayer_durationchange", + volumechange: "jPlayer_volumechange" + }; + + $.jPlayer.htmlEvent = [ // These HTML events are bubbled through to the jPlayer event, without any internal action. + "loadstart", + // "progress", // jPlayer uses internally before bubbling. + // "suspend", // jPlayer uses internally before bubbling. + "abort", + // "error", // jPlayer uses internally before bubbling. + "emptied", + "stalled", + // "play", // jPlayer uses internally before bubbling. + // "pause", // jPlayer uses internally before bubbling. + "loadedmetadata", + "loadeddata", + // "waiting", // jPlayer uses internally before bubbling. + // "playing", // jPlayer uses internally before bubbling. + "canplay", + "canplaythrough", + // "seeking", // jPlayer uses internally before bubbling. + // "seeked", // jPlayer uses internally before bubbling. + // "timeupdate", // jPlayer uses internally before bubbling. + // "ended", // jPlayer uses internally before bubbling. + "ratechange" + // "durationchange" // jPlayer uses internally before bubbling. + // "volumechange" // jPlayer uses internally before bubbling. + ]; + + $.jPlayer.pause = function() { + $.each($.jPlayer.prototype.instances, function(i, element) { + if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event. + element.jPlayer("pause"); + } + }); + }; + + $.jPlayer.timeFormat = { + showHour: false, + showMin: true, + showSec: true, + padHour: false, + padMin: true, + padSec: true, + sepHour: ":", + sepMin: ":", + sepSec: "" + }; + + $.jPlayer.convertTime = function(s) { + var myTime = new Date(s * 1000); + var hour = myTime.getUTCHours(); + var min = myTime.getUTCMinutes(); + var sec = myTime.getUTCSeconds(); + var strHour = ($.jPlayer.timeFormat.padHour && hour < 10) ? "0" + hour : hour; + var strMin = ($.jPlayer.timeFormat.padMin && min < 10) ? "0" + min : min; + var strSec = ($.jPlayer.timeFormat.padSec && sec < 10) ? "0" + sec : sec; + return (($.jPlayer.timeFormat.showHour) ? strHour + $.jPlayer.timeFormat.sepHour : "") + (($.jPlayer.timeFormat.showMin) ? strMin + $.jPlayer.timeFormat.sepMin : "") + (($.jPlayer.timeFormat.showSec) ? strSec + $.jPlayer.timeFormat.sepSec : ""); + }; + + // Adapting jQuery 1.4.4 code for jQuery.browser. Required since jQuery 1.3.2 does not detect Chrome as webkit. + $.jPlayer.uaBrowser = function( userAgent ) { + var ua = userAgent.toLowerCase(); + + // Useragent RegExp + var rwebkit = /(webkit)[ \/]([\w.]+)/; + var ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/; + var rmsie = /(msie) ([\w.]+)/; + var rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/; + + var match = rwebkit.exec( ua ) || + ropera.exec( ua ) || + rmsie.exec( ua ) || + ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || + []; + + return { browser: match[1] || "", version: match[2] || "0" }; + }; + + // Platform sniffer for detecting mobile devices + $.jPlayer.uaPlatform = function( userAgent ) { + var ua = userAgent.toLowerCase(); + + // Useragent RegExp + var rplatform = /(ipad|iphone|ipod|android|blackberry|playbook|windows ce|webos)/; + var rtablet = /(ipad|playbook)/; + var randroid = /(android)/; + var rmobile = /(mobile)/; + + var platform = rplatform.exec( ua ) || []; + var tablet = rtablet.exec( ua ) || + !rmobile.exec( ua ) && randroid.exec( ua ) || + []; + + if(platform[1]) { + platform[1] = platform[1].replace(/\s/g, "_"); // Change whitespace to underscore. Enables dot notation. + } + + return { platform: platform[1] || "", tablet: tablet[1] || "" }; + }; + + $.jPlayer.browser = { + }; + $.jPlayer.platform = { + }; + + var browserMatch = $.jPlayer.uaBrowser(navigator.userAgent); + if ( browserMatch.browser ) { + $.jPlayer.browser[ browserMatch.browser ] = true; + $.jPlayer.browser.version = browserMatch.version; + } + var platformMatch = $.jPlayer.uaPlatform(navigator.userAgent); + if ( platformMatch.platform ) { + $.jPlayer.platform[ platformMatch.platform ] = true; + $.jPlayer.platform.mobile = !platformMatch.tablet; + $.jPlayer.platform.tablet = !!platformMatch.tablet; + } + + $.jPlayer.prototype = { + count: 0, // Static Variable: Change it via prototype. + version: { // Static Object + script: "2.1.0", + needFlash: "2.1.0", + flash: "unknown" + }, + options: { // Instanced in $.jPlayer() constructor + swfPath: "js", // Path to Jplayer.swf. Can be relative, absolute or server root relative. + solution: "html, flash", // Valid solutions: html, flash. Order defines priority. 1st is highest, + supplied: "mp3", // Defines which formats jPlayer will try and support and the priority by the order. 1st is highest, + preload: 'metadata', // HTML5 Spec values: none, metadata, auto. + volume: 0.8, // The volume. Number 0 to 1. + muted: false, + wmode: "opaque", // Valid wmode: window, transparent, opaque, direct, gpu. + backgroundColor: "#000000", // To define the jPlayer div and Flash background color. + cssSelectorAncestor: "#jp_container_1", + cssSelector: { // * denotes properties that should only be required when video media type required. _cssSelector() would require changes to enable splitting these into Audio and Video defaults. + videoPlay: ".jp-video-play", // * + play: ".jp-play", + pause: ".jp-pause", + stop: ".jp-stop", + seekBar: ".jp-seek-bar", + playBar: ".jp-play-bar", + mute: ".jp-mute", + unmute: ".jp-unmute", + volumeBar: ".jp-volume-bar", + volumeBarValue: ".jp-volume-bar-value", + volumeMax: ".jp-volume-max", + currentTime: ".jp-current-time", + duration: ".jp-duration", + fullScreen: ".jp-full-screen", // * + restoreScreen: ".jp-restore-screen", // * + repeat: ".jp-repeat", + repeatOff: ".jp-repeat-off", + gui: ".jp-gui", // The interface used with autohide feature. + noSolution: ".jp-no-solution" // For error feedback when jPlayer cannot find a solution. + }, + fullScreen: false, + autohide: { + restored: false, // Controls the interface autohide feature. + full: true, // Controls the interface autohide feature. + fadeIn: 200, // Milliseconds. The period of the fadeIn anim. + fadeOut: 600, // Milliseconds. The period of the fadeOut anim. + hold: 1000 // Milliseconds. The period of the pause before autohide beings. + }, + loop: false, + repeat: function(event) { // The default jPlayer repeat event handler + if(event.jPlayer.options.loop) { + $(this).unbind(".jPlayerRepeat").bind($.jPlayer.event.ended + ".jPlayer.jPlayerRepeat", function() { + $(this).jPlayer("play"); + }); + } else { + $(this).unbind(".jPlayerRepeat"); + } + }, + nativeVideoControls: { + // Works well on standard browsers. + // Phone and tablet browsers can have problems with the controls disappearing. + }, + noFullScreen: { + msie: /msie [0-6]/, + ipad: /ipad.*?os [0-4]/, + iphone: /iphone/, + ipod: /ipod/, + android_pad: /android [0-3](?!.*?mobile)/, + android_phone: /android.*?mobile/, + blackberry: /blackberry/, + windows_ce: /windows ce/, + webos: /webos/ + }, + noVolume: { + ipad: /ipad/, + iphone: /iphone/, + ipod: /ipod/, + android_pad: /android(?!.*?mobile)/, + android_phone: /android.*?mobile/, + blackberry: /blackberry/, + windows_ce: /windows ce/, + webos: /webos/, + playbook: /playbook/ + }, + verticalVolume: false, // Calculate volume from the bottom of the volume bar. Default is from the left. Also volume affects either width or height. + // globalVolume: false, // Not implemented: Set to make volume changes affect all jPlayer instances + // globalMute: false, // Not implemented: Set to make mute changes affect all jPlayer instances + idPrefix: "jp", // Prefix for the ids of html elements created by jPlayer. For flash, this must not include characters: . - + * / \ + noConflict: "jQuery", + emulateHtml: false, // Emulates the HTML5 Media element on the jPlayer element. + errorAlerts: false, + warningAlerts: false + }, + optionsAudio: { + size: { + width: "0px", + height: "0px", + cssClass: "" + }, + sizeFull: { + width: "0px", + height: "0px", + cssClass: "" + } + }, + optionsVideo: { + size: { + width: "480px", + height: "270px", + cssClass: "jp-video-270p" + }, + sizeFull: { + width: "100%", + height: "100%", + cssClass: "jp-video-full" + } + }, + instances: {}, // Static Object + status: { // Instanced in _init() + src: "", + media: {}, + paused: true, + format: {}, + formatType: "", + waitForPlay: true, // Same as waitForLoad except in case where preloading. + waitForLoad: true, + srcSet: false, + video: false, // True if playing a video + seekPercent: 0, + currentPercentRelative: 0, + currentPercentAbsolute: 0, + currentTime: 0, + duration: 0, + readyState: 0, + networkState: 0, + playbackRate: 1, + ended: 0 + +/* Persistant status properties created dynamically at _init(): + width + height + cssClass + nativeVideoControls + noFullScreen + noVolume +*/ + }, + + internal: { // Instanced in _init() + ready: false + // instance: undefined + // domNode: undefined + // htmlDlyCmdId: undefined + // autohideId: undefined + }, + solution: { // Static Object: Defines the solutions built in jPlayer. + html: true, + flash: true + }, + // 'MPEG-4 support' : canPlayType('video/mp4; codecs="mp4v.20.8"') + format: { // Static Object + mp3: { + codec: 'audio/mpeg; codecs="mp3"', + flashCanPlay: true, + media: 'audio' + }, + m4a: { // AAC / MP4 + codec: 'audio/mp4; codecs="mp4a.40.2"', + flashCanPlay: true, + media: 'audio' + }, + oga: { // OGG + codec: 'audio/ogg; codecs="vorbis"', + flashCanPlay: false, + media: 'audio' + }, + wav: { // PCM + codec: 'audio/wav; codecs="1"', + flashCanPlay: false, + media: 'audio' + }, + webma: { // WEBM + codec: 'audio/webm; codecs="vorbis"', + flashCanPlay: false, + media: 'audio' + }, + fla: { // FLV / F4A + codec: 'audio/x-flv', + flashCanPlay: true, + media: 'audio' + }, + m4v: { // H.264 / MP4 + codec: 'video/mp4; codecs="avc1.42E01E, mp4a.40.2"', + flashCanPlay: true, + media: 'video' + }, + ogv: { // OGG + codec: 'video/ogg; codecs="theora, vorbis"', + flashCanPlay: false, + media: 'video' + }, + webmv: { // WEBM + codec: 'video/webm; codecs="vorbis, vp8"', + flashCanPlay: false, + media: 'video' + }, + flv: { // FLV / F4V + codec: 'video/x-flv', + flashCanPlay: true, + media: 'video' + } + }, + _init: function() { + var self = this; + + this.element.empty(); + + this.status = $.extend({}, this.status); // Copy static to unique instance. + this.internal = $.extend({}, this.internal); // Copy static to unique instance. + + this.internal.domNode = this.element.get(0); + + this.formats = []; // Array based on supplied string option. Order defines priority. + this.solutions = []; // Array based on solution string option. Order defines priority. + this.require = {}; // Which media types are required: video, audio. + + this.htmlElement = {}; // DOM elements created by jPlayer + this.html = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array. + this.html.audio = {}; + this.html.video = {}; + this.flash = {}; // In _init()'s this.desired code and setmedia(): Accessed via this[solution], where solution from this.solutions array. + + this.css = {}; + this.css.cs = {}; // Holds the css selector strings + this.css.jq = {}; // Holds jQuery selectors. ie., $(css.cs.method) + + this.ancestorJq = []; // Holds jQuery selector of cssSelectorAncestor. Init would use $() instead of [], but it is only 1.4+ + + this.options.volume = this._limitValue(this.options.volume, 0, 1); // Limit volume value's bounds. + + // Create the formats array, with prority based on the order of the supplied formats string + $.each(this.options.supplied.toLowerCase().split(","), function(index1, value1) { + var format = value1.replace(/^\s+|\s+$/g, ""); //trim + if(self.format[format]) { // Check format is valid. + var dupFound = false; + $.each(self.formats, function(index2, value2) { // Check for duplicates + if(format === value2) { + dupFound = true; + return false; + } + }); + if(!dupFound) { + self.formats.push(format); + } + } + }); + + // Create the solutions array, with prority based on the order of the solution string + $.each(this.options.solution.toLowerCase().split(","), function(index1, value1) { + var solution = value1.replace(/^\s+|\s+$/g, ""); //trim + if(self.solution[solution]) { // Check solution is valid. + var dupFound = false; + $.each(self.solutions, function(index2, value2) { // Check for duplicates + if(solution === value2) { + dupFound = true; + return false; + } + }); + if(!dupFound) { + self.solutions.push(solution); + } + } + }); + + this.internal.instance = "jp_" + this.count; + this.instances[this.internal.instance] = this.element; + + // Check the jPlayer div has an id and create one if required. Important for Flash to know the unique id for comms. + if(!this.element.attr("id")) { + this.element.attr("id", this.options.idPrefix + "_jplayer_" + this.count); + } + + this.internal.self = $.extend({}, { + id: this.element.attr("id"), + jq: this.element + }); + this.internal.audio = $.extend({}, { + id: this.options.idPrefix + "_audio_" + this.count, + jq: undefined + }); + this.internal.video = $.extend({}, { + id: this.options.idPrefix + "_video_" + this.count, + jq: undefined + }); + this.internal.flash = $.extend({}, { + id: this.options.idPrefix + "_flash_" + this.count, + jq: undefined, + swf: this.options.swfPath + (this.options.swfPath.toLowerCase().slice(-4) !== ".swf" ? (this.options.swfPath && this.options.swfPath.slice(-1) !== "/" ? "/" : "") + "Jplayer.swf" : "") + }); + this.internal.poster = $.extend({}, { + id: this.options.idPrefix + "_poster_" + this.count, + jq: undefined + }); + + // Register listeners defined in the constructor + $.each($.jPlayer.event, function(eventName,eventType) { + if(self.options[eventName] !== undefined) { + self.element.bind(eventType + ".jPlayer", self.options[eventName]); // With .jPlayer namespace. + self.options[eventName] = undefined; // Destroy the handler pointer copy on the options. Reason, events can be added/removed in other ways so this could be obsolete and misleading. + } + }); + + // Determine if we require solutions for audio, video or both media types. + this.require.audio = false; + this.require.video = false; + $.each(this.formats, function(priority, format) { + self.require[self.format[format].media] = true; + }); + + // Now required types are known, finish the options default settings. + if(this.require.video) { + this.options = $.extend(true, {}, + this.optionsVideo, + this.options + ); + } else { + this.options = $.extend(true, {}, + this.optionsAudio, + this.options + ); + } + this._setSize(); // update status and jPlayer element size + + // Determine the status for Blocklisted options. + this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); + this.status.noFullScreen = this._uaBlocklist(this.options.noFullScreen); + this.status.noVolume = this._uaBlocklist(this.options.noVolume); + + // The native controls are only for video and are disabled when audio is also used. + this._restrictNativeVideoControls(); + + // Create the poster image. + this.htmlElement.poster = document.createElement('img'); + this.htmlElement.poster.id = this.internal.poster.id; + this.htmlElement.poster.onload = function() { // Note that this did not work on Firefox 3.6: poster.addEventListener("onload", function() {}, false); Did not investigate x-browser. + if(!self.status.video || self.status.waitForPlay) { + self.internal.poster.jq.show(); + } + }; + this.element.append(this.htmlElement.poster); + this.internal.poster.jq = $("#" + this.internal.poster.id); + this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height}); + this.internal.poster.jq.hide(); + this.internal.poster.jq.bind("click.jPlayer", function() { + self._trigger($.jPlayer.event.click); + }); + + // Generate the required media elements + this.html.audio.available = false; + if(this.require.audio) { // If a supplied format is audio + this.htmlElement.audio = document.createElement('audio'); + this.htmlElement.audio.id = this.internal.audio.id; + this.html.audio.available = !!this.htmlElement.audio.canPlayType && this._testCanPlayType(this.htmlElement.audio); // Test is for IE9 on Win Server 2008. + } + this.html.video.available = false; + if(this.require.video) { // If a supplied format is video + this.htmlElement.video = document.createElement('video'); + this.htmlElement.video.id = this.internal.video.id; + this.html.video.available = !!this.htmlElement.video.canPlayType && this._testCanPlayType(this.htmlElement.video); // Test is for IE9 on Win Server 2008. + } + + this.flash.available = this._checkForFlash(10); + + this.html.canPlay = {}; + this.flash.canPlay = {}; + $.each(this.formats, function(priority, format) { + self.html.canPlay[format] = self.html[self.format[format].media].available && "" !== self.htmlElement[self.format[format].media].canPlayType(self.format[format].codec); + self.flash.canPlay[format] = self.format[format].flashCanPlay && self.flash.available; + }); + this.html.desired = false; + this.flash.desired = false; + $.each(this.solutions, function(solutionPriority, solution) { + if(solutionPriority === 0) { + self[solution].desired = true; + } else { + var audioCanPlay = false; + var videoCanPlay = false; + $.each(self.formats, function(formatPriority, format) { + if(self[self.solutions[0]].canPlay[format]) { // The other solution can play + if(self.format[format].media === 'video') { + videoCanPlay = true; + } else { + audioCanPlay = true; + } + } + }); + self[solution].desired = (self.require.audio && !audioCanPlay) || (self.require.video && !videoCanPlay); + } + }); + // This is what jPlayer will support, based on solution and supplied. + this.html.support = {}; + this.flash.support = {}; + $.each(this.formats, function(priority, format) { + self.html.support[format] = self.html.canPlay[format] && self.html.desired; + self.flash.support[format] = self.flash.canPlay[format] && self.flash.desired; + }); + // If jPlayer is supporting any format in a solution, then the solution is used. + this.html.used = false; + this.flash.used = false; + $.each(this.solutions, function(solutionPriority, solution) { + $.each(self.formats, function(formatPriority, format) { + if(self[solution].support[format]) { + self[solution].used = true; + return false; + } + }); + }); + + // Init solution active state and the event gates to false. + this._resetActive(); + this._resetGate(); + + // Set up the css selectors for the control and feedback entities. + this._cssSelectorAncestor(this.options.cssSelectorAncestor); + + // If neither html nor flash are being used by this browser, then media playback is not possible. Trigger an error event. + if(!(this.html.used || this.flash.used)) { + this._error( { + type: $.jPlayer.error.NO_SOLUTION, + context: "{solution:'" + this.options.solution + "', supplied:'" + this.options.supplied + "'}", + message: $.jPlayer.errorMsg.NO_SOLUTION, + hint: $.jPlayer.errorHint.NO_SOLUTION + }); + if(this.css.jq.noSolution.length) { + this.css.jq.noSolution.show(); + } + } else { + if(this.css.jq.noSolution.length) { + this.css.jq.noSolution.hide(); + } + } + + // Add the flash solution if it is being used. + if(this.flash.used) { + var htmlObj, + flashVars = 'jQuery=' + encodeURI(this.options.noConflict) + '&id=' + encodeURI(this.internal.self.id) + '&vol=' + this.options.volume + '&muted=' + this.options.muted; + + // Code influenced by SWFObject 2.2: http://code.google.com/p/swfobject/ + // Non IE browsers have an initial Flash size of 1 by 1 otherwise the wmode affected the Flash ready event. + + if($.browser.msie && Number($.browser.version) <= 8) { + var objStr = ''; + + var paramStr = [ + '', + '', + '', + '', + '' + ]; + + htmlObj = document.createElement(objStr); + for(var i=0; i < paramStr.length; i++) { + htmlObj.appendChild(document.createElement(paramStr[i])); + } + } else { + var createParam = function(el, n, v) { + var p = document.createElement("param"); + p.setAttribute("name", n); + p.setAttribute("value", v); + el.appendChild(p); + }; + + htmlObj = document.createElement("object"); + htmlObj.setAttribute("id", this.internal.flash.id); + htmlObj.setAttribute("data", this.internal.flash.swf); + htmlObj.setAttribute("type", "application/x-shockwave-flash"); + htmlObj.setAttribute("width", "1"); // Non-zero + htmlObj.setAttribute("height", "1"); // Non-zero + createParam(htmlObj, "flashvars", flashVars); + createParam(htmlObj, "allowscriptaccess", "always"); + createParam(htmlObj, "bgcolor", this.options.backgroundColor); + createParam(htmlObj, "wmode", this.options.wmode); + } + + this.element.append(htmlObj); + this.internal.flash.jq = $(htmlObj); + } + + // Add the HTML solution if being used. + if(this.html.used) { + + // The HTML Audio handlers + if(this.html.audio.available) { + this._addHtmlEventListeners(this.htmlElement.audio, this.html.audio); + this.element.append(this.htmlElement.audio); + this.internal.audio.jq = $("#" + this.internal.audio.id); + } + + // The HTML Video handlers + if(this.html.video.available) { + this._addHtmlEventListeners(this.htmlElement.video, this.html.video); + this.element.append(this.htmlElement.video); + this.internal.video.jq = $("#" + this.internal.video.id); + if(this.status.nativeVideoControls) { + this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); + } else { + this.internal.video.jq.css({'width':'0px', 'height':'0px'}); // Using size 0x0 since a .hide() causes issues in iOS + } + this.internal.video.jq.bind("click.jPlayer", function() { + self._trigger($.jPlayer.event.click); + }); + } + } + + // Create the bridge that emulates the HTML Media element on the jPlayer DIV + if( this.options.emulateHtml ) { + this._emulateHtmlBridge(); + } + + if(this.html.used && !this.flash.used) { // If only HTML, then emulate flash ready() call after 100ms. + setTimeout( function() { + self.internal.ready = true; + self.version.flash = "n/a"; + self._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option. + self._trigger($.jPlayer.event.ready); + }, 100); + } + + // Initialize the interface components with the options. + this._updateNativeVideoControls(); // Must do this first, otherwise there is a bizarre bug in iOS 4.3.2, where the native controls are not shown. Fails in iOS if called after _updateButtons() below. Works if called later in setMedia too, so it odd. + this._updateInterface(); + this._updateButtons(false); + this._updateAutohide(); + this._updateVolume(this.options.volume); + this._updateMute(this.options.muted); + if(this.css.jq.videoPlay.length) { + this.css.jq.videoPlay.hide(); + } + + $.jPlayer.prototype.count++; // Change static variable via prototype. + }, + destroy: function() { + // MJP: The background change remains. Would need to store the original to restore it correctly. + // MJP: The jPlayer element's size change remains. + + // Clear the media to reset the GUI and stop any downloads. Streams on some browsers had persited. (Chrome) + this.clearMedia(); + // Remove the size/sizeFull cssClass from the cssSelectorAncestor + this._removeUiClass(); + // Remove the times from the GUI + if(this.css.jq.currentTime.length) { + this.css.jq.currentTime.text(""); + } + if(this.css.jq.duration.length) { + this.css.jq.duration.text(""); + } + // Remove any bindings from the interface controls. + $.each(this.css.jq, function(fn, jq) { + // Check selector is valid before trying to execute method. + if(jq.length) { + jq.unbind(".jPlayer"); + } + }); + // Remove the click handlers for $.jPlayer.event.click + this.internal.poster.jq.unbind(".jPlayer"); + if(this.internal.video.jq) { + this.internal.video.jq.unbind(".jPlayer"); + } + // Destroy the HTML bridge. + if(this.options.emulateHtml) { + this._destroyHtmlBridge(); + } + this.element.removeData("jPlayer"); // Remove jPlayer data + this.element.unbind(".jPlayer"); // Remove all event handlers created by the jPlayer constructor + this.element.empty(); // Remove the inserted child elements + + delete this.instances[this.internal.instance]; // Clear the instance on the static instance object + }, + enable: function() { // Plan to implement + // options.disabled = false + }, + disable: function () { // Plan to implement + // options.disabled = true + }, + _testCanPlayType: function(elem) { + // IE9 on Win Server 2008 did not implement canPlayType(), but it has the property. + try { + elem.canPlayType(this.format.mp3.codec); // The type is irrelevant. + return true; + } catch(err) { + return false; + } + }, + _uaBlocklist: function(list) { + // list : object with properties that are all regular expressions. Property names are irrelevant. + // Returns true if the user agent is matched in list. + var ua = navigator.userAgent.toLowerCase(), + block = false; + + $.each(list, function(p, re) { + if(re && re.test(ua)) { + block = true; + return false; // exit $.each. + } + }); + return block; + }, + _restrictNativeVideoControls: function() { + // Fallback to noFullScreen when nativeVideoControls is true and audio media is being used. Affects when both media types are used. + if(this.require.audio) { + if(this.status.nativeVideoControls) { + this.status.nativeVideoControls = false; + this.status.noFullScreen = true; + } + } + }, + _updateNativeVideoControls: function() { + if(this.html.video.available && this.html.used) { + // Turn the HTML Video controls on/off + this.htmlElement.video.controls = this.status.nativeVideoControls; + // Show/hide the jPlayer GUI. + this._updateAutohide(); + // For when option changed. The poster image is not updated, as it is dealt with in setMedia(). Acceptable degradation since seriously doubt these options will change on the fly. Can again review later. + if(this.status.nativeVideoControls && this.require.video) { + this.internal.poster.jq.hide(); + this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); + } else if(this.status.waitForPlay && this.status.video) { + this.internal.poster.jq.show(); + this.internal.video.jq.css({'width': '0px', 'height': '0px'}); + } + } + }, + _addHtmlEventListeners: function(mediaElement, entity) { + var self = this; + mediaElement.preload = this.options.preload; + mediaElement.muted = this.options.muted; + mediaElement.volume = this.options.volume; + + // Create the event listeners + // Only want the active entity to affect jPlayer and bubble events. + // Using entity.gate so that object is referenced and gate property always current + + mediaElement.addEventListener("progress", function() { + if(entity.gate) { + self._getHtmlStatus(mediaElement); + self._updateInterface(); + self._trigger($.jPlayer.event.progress); + } + }, false); + mediaElement.addEventListener("timeupdate", function() { + if(entity.gate) { + self._getHtmlStatus(mediaElement); + self._updateInterface(); + self._trigger($.jPlayer.event.timeupdate); + } + }, false); + mediaElement.addEventListener("durationchange", function() { + if(entity.gate) { + self.status.duration = this.duration; + self._getHtmlStatus(mediaElement); + self._updateInterface(); + self._trigger($.jPlayer.event.durationchange); + } + }, false); + mediaElement.addEventListener("play", function() { + if(entity.gate) { + self._updateButtons(true); + self._html_checkWaitForPlay(); // So the native controls update this variable and puts the hidden interface in the correct state. Affects toggling native controls. + self._trigger($.jPlayer.event.play); + } + }, false); + mediaElement.addEventListener("playing", function() { + if(entity.gate) { + self._updateButtons(true); + self._seeked(); + self._trigger($.jPlayer.event.playing); + } + }, false); + mediaElement.addEventListener("pause", function() { + if(entity.gate) { + self._updateButtons(false); + self._trigger($.jPlayer.event.pause); + } + }, false); + mediaElement.addEventListener("waiting", function() { + if(entity.gate) { + self._seeking(); + self._trigger($.jPlayer.event.waiting); + } + }, false); + mediaElement.addEventListener("seeking", function() { + if(entity.gate) { + self._seeking(); + self._trigger($.jPlayer.event.seeking); + } + }, false); + mediaElement.addEventListener("seeked", function() { + if(entity.gate) { + self._seeked(); + self._trigger($.jPlayer.event.seeked); + } + }, false); + mediaElement.addEventListener("volumechange", function() { + if(entity.gate) { + // Read the values back from the element as the Blackberry PlayBook shares the volume with the physical buttons master volume control. + // However, when tested 6th July 2011, those buttons do not generate an event. The physical play/pause button does though. + self.options.volume = mediaElement.volume; + self.options.muted = mediaElement.muted; + self._updateMute(); + self._updateVolume(); + self._trigger($.jPlayer.event.volumechange); + } + }, false); + mediaElement.addEventListener("suspend", function() { // Seems to be the only way of capturing that the iOS4 browser did not actually play the media from the page code. ie., It needs a user gesture. + if(entity.gate) { + self._seeked(); + self._trigger($.jPlayer.event.suspend); + } + }, false); + mediaElement.addEventListener("ended", function() { + if(entity.gate) { + // Order of the next few commands are important. Change the time and then pause. + // Solves a bug in Firefox, where issuing pause 1st causes the media to play from the start. ie., The pause is ignored. + if(!$.jPlayer.browser.webkit) { // Chrome crashes if you do this in conjunction with a setMedia command in an ended event handler. ie., The playlist demo. + self.htmlElement.media.currentTime = 0; // Safari does not care about this command. ie., It works with or without this line. (Both Safari and Chrome are Webkit.) + } + self.htmlElement.media.pause(); // Pause otherwise a click on the progress bar will play from that point, when it shouldn't, since it stopped playback. + self._updateButtons(false); + self._getHtmlStatus(mediaElement, true); // With override true. Otherwise Chrome leaves progress at full. + self._updateInterface(); + self._trigger($.jPlayer.event.ended); + } + }, false); + mediaElement.addEventListener("error", function() { + if(entity.gate) { + self._updateButtons(false); + self._seeked(); + if(self.status.srcSet) { // Deals with case of clearMedia() causing an error event. + clearTimeout(self.internal.htmlDlyCmdId); // Clears any delayed commands used in the HTML solution. + self.status.waitForLoad = true; // Allows the load operation to try again. + self.status.waitForPlay = true; // Reset since a play was captured. + if(self.status.video && !self.status.nativeVideoControls) { + self.internal.video.jq.css({'width':'0px', 'height':'0px'}); + } + if(self._validString(self.status.media.poster) && !self.status.nativeVideoControls) { + self.internal.poster.jq.show(); + } + if(self.css.jq.videoPlay.length) { + self.css.jq.videoPlay.show(); + } + self._error( { + type: $.jPlayer.error.URL, + context: self.status.src, // this.src shows absolute urls. Want context to show the url given. + message: $.jPlayer.errorMsg.URL, + hint: $.jPlayer.errorHint.URL + }); + } + } + }, false); + // Create all the other event listeners that bubble up to a jPlayer event from html, without being used by jPlayer. + $.each($.jPlayer.htmlEvent, function(i, eventType) { + mediaElement.addEventListener(this, function() { + if(entity.gate) { + self._trigger($.jPlayer.event[eventType]); + } + }, false); + }); + }, + _getHtmlStatus: function(media, override) { + var ct = 0, d = 0, cpa = 0, sp = 0, cpr = 0; + + if(media.duration) { // Fixes the duration bug in iOS, where the durationchange event occurs when media.duration is not always correct. + this.status.duration = media.duration; + } + ct = media.currentTime; + cpa = (this.status.duration > 0) ? 100 * ct / this.status.duration : 0; + if((typeof media.seekable === "object") && (media.seekable.length > 0)) { + sp = (this.status.duration > 0) ? 100 * media.seekable.end(media.seekable.length-1) / this.status.duration : 100; + cpr = 100 * media.currentTime / media.seekable.end(media.seekable.length-1); + } else { + sp = 100; + cpr = cpa; + } + + if(override) { + ct = 0; + cpr = 0; + cpa = 0; + } + + this.status.seekPercent = sp; + this.status.currentPercentRelative = cpr; + this.status.currentPercentAbsolute = cpa; + this.status.currentTime = ct; + + this.status.readyState = media.readyState; + this.status.networkState = media.networkState; + this.status.playbackRate = media.playbackRate; + this.status.ended = media.ended; + }, + _resetStatus: function() { + this.status = $.extend({}, this.status, $.jPlayer.prototype.status); // Maintains the status properties that persist through a reset. + }, + _trigger: function(eventType, error, warning) { // eventType always valid as called using $.jPlayer.event.eventType + var event = $.Event(eventType); + event.jPlayer = {}; + event.jPlayer.version = $.extend({}, this.version); + event.jPlayer.options = $.extend(true, {}, this.options); // Deep copy + event.jPlayer.status = $.extend(true, {}, this.status); // Deep copy + event.jPlayer.html = $.extend(true, {}, this.html); // Deep copy + event.jPlayer.flash = $.extend(true, {}, this.flash); // Deep copy + if(error) { + event.jPlayer.error = $.extend({}, error); + } + if(warning) { + event.jPlayer.warning = $.extend({}, warning); + } + this.element.trigger(event); + }, + jPlayerFlashEvent: function(eventType, status) { // Called from Flash + if(eventType === $.jPlayer.event.ready) { + if(!this.internal.ready) { + this.internal.ready = true; + this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Once Flash generates the ready event, minimise to zero as it is not affected by wmode anymore. + + this.version.flash = status.version; + if(this.version.needFlash !== this.version.flash) { + this._error( { + type: $.jPlayer.error.VERSION, + context: this.version.flash, + message: $.jPlayer.errorMsg.VERSION + this.version.flash, + hint: $.jPlayer.errorHint.VERSION + }); + } + this._trigger($.jPlayer.event.repeat); // Trigger the repeat event so its handler can initialize itself with the loop option. + this._trigger(eventType); + } else { + // This condition occurs if the Flash is hidden and then shown again. + // Firefox also reloads the Flash if the CSS position changes. position:fixed is used for full screen. + + // Only do this if the Flash is the solution being used at the moment. Affects Media players where both solution may be being used. + if(this.flash.gate) { + + // Send the current status to the Flash now that it is ready (available) again. + if(this.status.srcSet) { + + // Need to read original status before issuing the setMedia command. + var currentTime = this.status.currentTime, + paused = this.status.paused; + + this.setMedia(this.status.media); + if(currentTime > 0) { + if(paused) { + this.pause(currentTime); + } else { + this.play(currentTime); + } + } + } + this._trigger($.jPlayer.event.flashreset); + } + } + } + if(this.flash.gate) { + switch(eventType) { + case $.jPlayer.event.progress: + this._getFlashStatus(status); + this._updateInterface(); + this._trigger(eventType); + break; + case $.jPlayer.event.timeupdate: + this._getFlashStatus(status); + this._updateInterface(); + this._trigger(eventType); + break; + case $.jPlayer.event.play: + this._seeked(); + this._updateButtons(true); + this._trigger(eventType); + break; + case $.jPlayer.event.pause: + this._updateButtons(false); + this._trigger(eventType); + break; + case $.jPlayer.event.ended: + this._updateButtons(false); + this._trigger(eventType); + break; + case $.jPlayer.event.click: + this._trigger(eventType); // This could be dealt with by the default + break; + case $.jPlayer.event.error: + this.status.waitForLoad = true; // Allows the load operation to try again. + this.status.waitForPlay = true; // Reset since a play was captured. + if(this.status.video) { + this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); + } + if(this._validString(this.status.media.poster)) { + this.internal.poster.jq.show(); + } + if(this.css.jq.videoPlay.length && this.status.video) { + this.css.jq.videoPlay.show(); + } + if(this.status.video) { // Set up for another try. Execute before error event. + this._flash_setVideo(this.status.media); + } else { + this._flash_setAudio(this.status.media); + } + this._updateButtons(false); + this._error( { + type: $.jPlayer.error.URL, + context:status.src, + message: $.jPlayer.errorMsg.URL, + hint: $.jPlayer.errorHint.URL + }); + break; + case $.jPlayer.event.seeking: + this._seeking(); + this._trigger(eventType); + break; + case $.jPlayer.event.seeked: + this._seeked(); + this._trigger(eventType); + break; + case $.jPlayer.event.ready: + // The ready event is handled outside the switch statement. + // Captured here otherwise 2 ready events would be generated if the ready event handler used setMedia. + break; + default: + this._trigger(eventType); + } + } + return false; + }, + _getFlashStatus: function(status) { + this.status.seekPercent = status.seekPercent; + this.status.currentPercentRelative = status.currentPercentRelative; + this.status.currentPercentAbsolute = status.currentPercentAbsolute; + this.status.currentTime = status.currentTime; + this.status.duration = status.duration; + + // The Flash does not generate this information in this release + this.status.readyState = 4; // status.readyState; + this.status.networkState = 0; // status.networkState; + this.status.playbackRate = 1; // status.playbackRate; + this.status.ended = false; // status.ended; + }, + _updateButtons: function(playing) { + if(playing !== undefined) { + this.status.paused = !playing; + if(this.css.jq.play.length && this.css.jq.pause.length) { + if(playing) { + this.css.jq.play.hide(); + this.css.jq.pause.show(); + } else { + this.css.jq.play.show(); + this.css.jq.pause.hide(); + } + } + } + if(this.css.jq.restoreScreen.length && this.css.jq.fullScreen.length) { + if(this.status.noFullScreen) { + this.css.jq.fullScreen.hide(); + this.css.jq.restoreScreen.hide(); + } else if(this.options.fullScreen) { + this.css.jq.fullScreen.hide(); + this.css.jq.restoreScreen.show(); + } else { + this.css.jq.fullScreen.show(); + this.css.jq.restoreScreen.hide(); + } + } + if(this.css.jq.repeat.length && this.css.jq.repeatOff.length) { + if(this.options.loop) { + this.css.jq.repeat.hide(); + this.css.jq.repeatOff.show(); + } else { + this.css.jq.repeat.show(); + this.css.jq.repeatOff.hide(); + } + } + }, + _updateInterface: function() { + if(this.css.jq.seekBar.length) { + this.css.jq.seekBar.width(this.status.seekPercent+"%"); + } + if(this.css.jq.playBar.length) { + this.css.jq.playBar.width(this.status.currentPercentRelative+"%"); + } + if(this.css.jq.currentTime.length) { + this.css.jq.currentTime.text($.jPlayer.convertTime(this.status.currentTime)); + } + if(this.css.jq.duration.length) { + this.css.jq.duration.text($.jPlayer.convertTime(this.status.duration)); + } + }, + _seeking: function() { + if(this.css.jq.seekBar.length) { + this.css.jq.seekBar.addClass("jp-seeking-bg"); + } + }, + _seeked: function() { + if(this.css.jq.seekBar.length) { + this.css.jq.seekBar.removeClass("jp-seeking-bg"); + } + }, + _resetGate: function() { + this.html.audio.gate = false; + this.html.video.gate = false; + this.flash.gate = false; + }, + _resetActive: function() { + this.html.active = false; + this.flash.active = false; + }, + setMedia: function(media) { + + /* media[format] = String: URL of format. Must contain all of the supplied option's video or audio formats. + * media.poster = String: Video poster URL. + * media.subtitles = String: * NOT IMPLEMENTED * URL of subtitles SRT file + * media.chapters = String: * NOT IMPLEMENTED * URL of chapters SRT file + * media.stream = Boolean: * NOT IMPLEMENTED * Designating actual media streams. ie., "false/undefined" for files. Plan to refresh the flash every so often. + */ + + var self = this, + supported = false, + posterChanged = this.status.media.poster !== media.poster; // Compare before reset. Important for OSX Safari as this.htmlElement.poster.src is absolute, even if original poster URL was relative. + + this._resetMedia(); + this._resetGate(); + this._resetActive(); + + $.each(this.formats, function(formatPriority, format) { + var isVideo = self.format[format].media === 'video'; + $.each(self.solutions, function(solutionPriority, solution) { + if(self[solution].support[format] && self._validString(media[format])) { // Format supported in solution and url given for format. + var isHtml = solution === 'html'; + + if(isVideo) { + if(isHtml) { + self.html.video.gate = true; + self._html_setVideo(media); + self.html.active = true; + } else { + self.flash.gate = true; + self._flash_setVideo(media); + self.flash.active = true; + } + if(self.css.jq.videoPlay.length) { + self.css.jq.videoPlay.show(); + } + self.status.video = true; + } else { + if(isHtml) { + self.html.audio.gate = true; + self._html_setAudio(media); + self.html.active = true; + } else { + self.flash.gate = true; + self._flash_setAudio(media); + self.flash.active = true; + } + if(self.css.jq.videoPlay.length) { + self.css.jq.videoPlay.hide(); + } + self.status.video = false; + } + + supported = true; + return false; // Exit $.each + } + }); + if(supported) { + return false; // Exit $.each + } + }); + + if(supported) { + if(!(this.status.nativeVideoControls && this.html.video.gate)) { + // Set poster IMG if native video controls are not being used + // Note: With IE the IMG onload event occurs immediately when cached. + // Note: Poster hidden by default in _resetMedia() + if(this._validString(media.poster)) { + if(posterChanged) { // Since some browsers do not generate img onload event. + this.htmlElement.poster.src = media.poster; + } else { + this.internal.poster.jq.show(); + } + } + } + this.status.srcSet = true; + this.status.media = $.extend({}, media); + this._updateButtons(false); + this._updateInterface(); + } else { // jPlayer cannot support any formats provided in this browser + // Send an error event + this._error( { + type: $.jPlayer.error.NO_SUPPORT, + context: "{supplied:'" + this.options.supplied + "'}", + message: $.jPlayer.errorMsg.NO_SUPPORT, + hint: $.jPlayer.errorHint.NO_SUPPORT + }); + } + }, + _resetMedia: function() { + this._resetStatus(); + this._updateButtons(false); + this._updateInterface(); + this._seeked(); + this.internal.poster.jq.hide(); + + clearTimeout(this.internal.htmlDlyCmdId); + + if(this.html.active) { + this._html_resetMedia(); + } else if(this.flash.active) { + this._flash_resetMedia(); + } + }, + clearMedia: function() { + this._resetMedia(); + + if(this.html.active) { + this._html_clearMedia(); + } else if(this.flash.active) { + this._flash_clearMedia(); + } + + this._resetGate(); + this._resetActive(); + }, + load: function() { + if(this.status.srcSet) { + if(this.html.active) { + this._html_load(); + } else if(this.flash.active) { + this._flash_load(); + } + } else { + this._urlNotSetError("load"); + } + }, + play: function(time) { + time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler + if(this.status.srcSet) { + if(this.html.active) { + this._html_play(time); + } else if(this.flash.active) { + this._flash_play(time); + } + } else { + this._urlNotSetError("play"); + } + }, + videoPlay: function(e) { // Handles clicks on the play button over the video poster + this.play(); + }, + pause: function(time) { + time = (typeof time === "number") ? time : NaN; // Remove jQuery event from click handler + if(this.status.srcSet) { + if(this.html.active) { + this._html_pause(time); + } else if(this.flash.active) { + this._flash_pause(time); + } + } else { + this._urlNotSetError("pause"); + } + }, + pauseOthers: function() { + var self = this; + $.each(this.instances, function(i, element) { + if(self.element !== element) { // Do not this instance. + if(element.data("jPlayer").status.srcSet) { // Check that media is set otherwise would cause error event. + element.jPlayer("pause"); + } + } + }); + }, + stop: function() { + if(this.status.srcSet) { + if(this.html.active) { + this._html_pause(0); + } else if(this.flash.active) { + this._flash_pause(0); + } + } else { + this._urlNotSetError("stop"); + } + }, + playHead: function(p) { + p = this._limitValue(p, 0, 100); + if(this.status.srcSet) { + if(this.html.active) { + this._html_playHead(p); + } else if(this.flash.active) { + this._flash_playHead(p); + } + } else { + this._urlNotSetError("playHead"); + } + }, + _muted: function(muted) { + this.options.muted = muted; + if(this.html.used) { + this._html_mute(muted); + } + if(this.flash.used) { + this._flash_mute(muted); + } + + // The HTML solution generates this event from the media element itself. + if(!this.html.video.gate && !this.html.audio.gate) { + this._updateMute(muted); + this._updateVolume(this.options.volume); + this._trigger($.jPlayer.event.volumechange); + } + }, + mute: function(mute) { // mute is either: undefined (true), an event object (true) or a boolean (muted). + mute = mute === undefined ? true : !!mute; + this._muted(mute); + }, + unmute: function(unmute) { // unmute is either: undefined (true), an event object (true) or a boolean (!muted). + unmute = unmute === undefined ? true : !!unmute; + this._muted(!unmute); + }, + _updateMute: function(mute) { + if(mute === undefined) { + mute = this.options.muted; + } + if(this.css.jq.mute.length && this.css.jq.unmute.length) { + if(this.status.noVolume) { + this.css.jq.mute.hide(); + this.css.jq.unmute.hide(); + } else if(mute) { + this.css.jq.mute.hide(); + this.css.jq.unmute.show(); + } else { + this.css.jq.mute.show(); + this.css.jq.unmute.hide(); + } + } + }, + volume: function(v) { + v = this._limitValue(v, 0, 1); + this.options.volume = v; + + if(this.html.used) { + this._html_volume(v); + } + if(this.flash.used) { + this._flash_volume(v); + } + + // The HTML solution generates this event from the media element itself. + if(!this.html.video.gate && !this.html.audio.gate) { + this._updateVolume(v); + this._trigger($.jPlayer.event.volumechange); + } + }, + volumeBar: function(e) { // Handles clicks on the volumeBar + if(this.css.jq.volumeBar.length) { + var offset = this.css.jq.volumeBar.offset(), + x = e.pageX - offset.left, + w = this.css.jq.volumeBar.width(), + y = this.css.jq.volumeBar.height() - e.pageY + offset.top, + h = this.css.jq.volumeBar.height(); + + if(this.options.verticalVolume) { + this.volume(y/h); + } else { + this.volume(x/w); + } + } + if(this.options.muted) { + this._muted(false); + } + }, + volumeBarValue: function(e) { // Handles clicks on the volumeBarValue + this.volumeBar(e); + }, + _updateVolume: function(v) { + if(v === undefined) { + v = this.options.volume; + } + v = this.options.muted ? 0 : v; + + if(this.status.noVolume) { + if(this.css.jq.volumeBar.length) { + this.css.jq.volumeBar.hide(); + } + if(this.css.jq.volumeBarValue.length) { + this.css.jq.volumeBarValue.hide(); + } + if(this.css.jq.volumeMax.length) { + this.css.jq.volumeMax.hide(); + } + } else { + if(this.css.jq.volumeBar.length) { + this.css.jq.volumeBar.show(); + } + if(this.css.jq.volumeBarValue.length) { + this.css.jq.volumeBarValue.show(); + this.css.jq.volumeBarValue[this.options.verticalVolume ? "height" : "width"]((v*100)+"%"); + } + if(this.css.jq.volumeMax.length) { + this.css.jq.volumeMax.show(); + } + } + }, + volumeMax: function() { // Handles clicks on the volume max + this.volume(1); + if(this.options.muted) { + this._muted(false); + } + }, + _cssSelectorAncestor: function(ancestor) { + var self = this; + this.options.cssSelectorAncestor = ancestor; + this._removeUiClass(); + this.ancestorJq = ancestor ? $(ancestor) : []; // Would use $() instead of [], but it is only 1.4+ + if(ancestor && this.ancestorJq.length !== 1) { // So empty strings do not generate the warning. + this._warning( { + type: $.jPlayer.warning.CSS_SELECTOR_COUNT, + context: ancestor, + message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.ancestorJq.length + " found for cssSelectorAncestor.", + hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT + }); + } + this._addUiClass(); + $.each(this.options.cssSelector, function(fn, cssSel) { + self._cssSelector(fn, cssSel); + }); + }, + _cssSelector: function(fn, cssSel) { + var self = this; + if(typeof cssSel === 'string') { + if($.jPlayer.prototype.options.cssSelector[fn]) { + if(this.css.jq[fn] && this.css.jq[fn].length) { + this.css.jq[fn].unbind(".jPlayer"); + } + this.options.cssSelector[fn] = cssSel; + this.css.cs[fn] = this.options.cssSelectorAncestor + " " + cssSel; + + if(cssSel) { // Checks for empty string + this.css.jq[fn] = $(this.css.cs[fn]); + } else { + this.css.jq[fn] = []; // To comply with the css.jq[fn].length check before its use. As of jQuery 1.4 could have used $() for an empty set. + } + + if(this.css.jq[fn].length) { + var handler = function(e) { + self[fn](e); + $(this).blur(); + return false; + }; + this.css.jq[fn].bind("click.jPlayer", handler); // Using jPlayer namespace + } + + if(cssSel && this.css.jq[fn].length !== 1) { // So empty strings do not generate the warning. ie., they just remove the old one. + this._warning( { + type: $.jPlayer.warning.CSS_SELECTOR_COUNT, + context: this.css.cs[fn], + message: $.jPlayer.warningMsg.CSS_SELECTOR_COUNT + this.css.jq[fn].length + " found for " + fn + " method.", + hint: $.jPlayer.warningHint.CSS_SELECTOR_COUNT + }); + } + } else { + this._warning( { + type: $.jPlayer.warning.CSS_SELECTOR_METHOD, + context: fn, + message: $.jPlayer.warningMsg.CSS_SELECTOR_METHOD, + hint: $.jPlayer.warningHint.CSS_SELECTOR_METHOD + }); + } + } else { + this._warning( { + type: $.jPlayer.warning.CSS_SELECTOR_STRING, + context: cssSel, + message: $.jPlayer.warningMsg.CSS_SELECTOR_STRING, + hint: $.jPlayer.warningHint.CSS_SELECTOR_STRING + }); + } + }, + seekBar: function(e) { // Handles clicks on the seekBar + if(this.css.jq.seekBar) { + var offset = this.css.jq.seekBar.offset(); + var x = e.pageX - offset.left; + var w = this.css.jq.seekBar.width(); + var p = 100*x/w; + this.playHead(p); + } + }, + playBar: function(e) { // Handles clicks on the playBar + this.seekBar(e); + }, + repeat: function() { // Handle clicks on the repeat button + this._loop(true); + }, + repeatOff: function() { // Handle clicks on the repeatOff button + this._loop(false); + }, + _loop: function(loop) { + if(this.options.loop !== loop) { + this.options.loop = loop; + this._updateButtons(); + this._trigger($.jPlayer.event.repeat); + } + }, + + // Plan to review the cssSelector method to cope with missing associated functions accordingly. + + currentTime: function(e) { // Handles clicks on the text + // Added to avoid errors using cssSelector system for the text + }, + duration: function(e) { // Handles clicks on the text + // Added to avoid errors using cssSelector system for the text + }, + gui: function(e) { // Handles clicks on the gui + // Added to avoid errors using cssSelector system for the gui + }, + noSolution: function(e) { // Handles clicks on the error message + // Added to avoid errors using cssSelector system for no-solution + }, + + // Options code adapted from ui.widget.js (1.8.7). Made changes so the key can use dot notation. To match previous getData solution in jPlayer 1. + option: function(key, value) { + var options = key; + + // Enables use: options(). Returns a copy of options object + if ( arguments.length === 0 ) { + return $.extend( true, {}, this.options ); + } + + if(typeof key === "string") { + var keys = key.split("."); + + // Enables use: options("someOption") Returns a copy of the option. Supports dot notation. + if(value === undefined) { + + var opt = $.extend(true, {}, this.options); + for(var i = 0; i < keys.length; i++) { + if(opt[keys[i]] !== undefined) { + opt = opt[keys[i]]; + } else { + this._warning( { + type: $.jPlayer.warning.OPTION_KEY, + context: key, + message: $.jPlayer.warningMsg.OPTION_KEY, + hint: $.jPlayer.warningHint.OPTION_KEY + }); + return undefined; + } + } + return opt; + } + + // Enables use: options("someOptionObject", someObject}). Creates: {someOptionObject:someObject} + // Enables use: options("someOption", someValue). Creates: {someOption:someValue} + // Enables use: options("someOptionObject.someOption", someValue). Creates: {someOptionObject:{someOption:someValue}} + + options = {}; + var opts = options; + + for(var j = 0; j < keys.length; j++) { + if(j < keys.length - 1) { + opts[keys[j]] = {}; + opts = opts[keys[j]]; + } else { + opts[keys[j]] = value; + } + } + } + + // Otherwise enables use: options(optionObject). Uses original object (the key) + + this._setOptions(options); + + return this; + }, + _setOptions: function(options) { + var self = this; + $.each(options, function(key, value) { // This supports the 2 level depth that the options of jPlayer has. Would review if we ever need more depth. + self._setOption(key, value); + }); + + return this; + }, + _setOption: function(key, value) { + var self = this; + + // The ability to set options is limited at this time. + + switch(key) { + case "volume" : + this.volume(value); + break; + case "muted" : + this._muted(value); + break; + case "cssSelectorAncestor" : + this._cssSelectorAncestor(value); // Set and refresh all associations for the new ancestor. + break; + case "cssSelector" : + $.each(value, function(fn, cssSel) { + self._cssSelector(fn, cssSel); // NB: The option is set inside this function, after further validity checks. + }); + break; + case "fullScreen" : + if(this.options[key] !== value) { // if changed + this._removeUiClass(); + this.options[key] = value; + this._refreshSize(); + } + break; + case "size" : + if(!this.options.fullScreen && this.options[key].cssClass !== value.cssClass) { + this._removeUiClass(); + } + this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. + this._refreshSize(); + break; + case "sizeFull" : + if(this.options.fullScreen && this.options[key].cssClass !== value.cssClass) { + this._removeUiClass(); + } + this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. + this._refreshSize(); + break; + case "autohide" : + this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. + this._updateAutohide(); + break; + case "loop" : + this._loop(value); + break; + case "nativeVideoControls" : + this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. + this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); + this._restrictNativeVideoControls(); + this._updateNativeVideoControls(); + break; + case "noFullScreen" : + this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. + this.status.nativeVideoControls = this._uaBlocklist(this.options.nativeVideoControls); // Need to check again as noFullScreen can depend on this flag and the restrict() can override it. + this.status.noFullScreen = this._uaBlocklist(this.options.noFullScreen); + this._restrictNativeVideoControls(); + this._updateButtons(); + break; + case "noVolume" : + this.options[key] = $.extend({}, this.options[key], value); // store a merged copy of it, incase not all properties changed. + this.status.noVolume = this._uaBlocklist(this.options.noVolume); + this._updateVolume(); + this._updateMute(); + break; + case "emulateHtml" : + if(this.options[key] !== value) { // To avoid multiple event handlers being created, if true already. + this.options[key] = value; + if(value) { + this._emulateHtmlBridge(); + } else { + this._destroyHtmlBridge(); + } + } + break; + } + + return this; + }, + // End of: (Options code adapted from ui.widget.js) + + _refreshSize: function() { + this._setSize(); // update status and jPlayer element size + this._addUiClass(); // update the ui class + this._updateSize(); // update internal sizes + this._updateButtons(); + this._updateAutohide(); + this._trigger($.jPlayer.event.resize); + }, + _setSize: function() { + // Determine the current size from the options + if(this.options.fullScreen) { + this.status.width = this.options.sizeFull.width; + this.status.height = this.options.sizeFull.height; + this.status.cssClass = this.options.sizeFull.cssClass; + } else { + this.status.width = this.options.size.width; + this.status.height = this.options.size.height; + this.status.cssClass = this.options.size.cssClass; + } + + // Set the size of the jPlayer area. + this.element.css({'width': this.status.width, 'height': this.status.height}); + }, + _addUiClass: function() { + if(this.ancestorJq.length) { + this.ancestorJq.addClass(this.status.cssClass); + } + }, + _removeUiClass: function() { + if(this.ancestorJq.length) { + this.ancestorJq.removeClass(this.status.cssClass); + } + }, + _updateSize: function() { + // The poster uses show/hide so can simply resize it. + this.internal.poster.jq.css({'width': this.status.width, 'height': this.status.height}); + + // Video html or flash resized if necessary at this time, or if native video controls being used. + if(!this.status.waitForPlay && this.html.active && this.status.video || this.html.video.available && this.html.used && this.status.nativeVideoControls) { + this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); + } + else if(!this.status.waitForPlay && this.flash.active && this.status.video) { + this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height}); + } + }, + _updateAutohide: function() { + var self = this, + event = "mousemove.jPlayer", + namespace = ".jPlayerAutohide", + eventType = event + namespace, + handler = function() { + self.css.jq.gui.fadeIn(self.options.autohide.fadeIn, function() { + clearTimeout(self.internal.autohideId); + self.internal.autohideId = setTimeout( function() { + self.css.jq.gui.fadeOut(self.options.autohide.fadeOut); + }, self.options.autohide.hold); + }); + }; + + if(this.css.jq.gui.length) { + + // End animations first so that its callback is executed now. + // Otherwise an in progress fadeIn animation still has the callback to fadeOut again. + this.css.jq.gui.stop(true, true); + + // Removes the fadeOut operation from the fadeIn callback. + clearTimeout(this.internal.autohideId); + + this.element.unbind(namespace); + this.css.jq.gui.unbind(namespace); + + if(!this.status.nativeVideoControls) { + if(this.options.fullScreen && this.options.autohide.full || !this.options.fullScreen && this.options.autohide.restored) { + this.element.bind(eventType, handler); + this.css.jq.gui.bind(eventType, handler); + this.css.jq.gui.hide(); + } else { + this.css.jq.gui.show(); + } + } else { + this.css.jq.gui.hide(); + } + } + }, + fullScreen: function() { + this._setOption("fullScreen", true); + }, + restoreScreen: function() { + this._setOption("fullScreen", false); + }, + _html_initMedia: function() { + this.htmlElement.media.src = this.status.src; + + if(this.options.preload !== 'none') { + this._html_load(); // See function for comments + } + this._trigger($.jPlayer.event.timeupdate); // The flash generates this event for its solution. + }, + _html_setAudio: function(media) { + var self = this; + // Always finds a format due to checks in setMedia() + $.each(this.formats, function(priority, format) { + if(self.html.support[format] && media[format]) { + self.status.src = media[format]; + self.status.format[format] = true; + self.status.formatType = format; + return false; + } + }); + this.htmlElement.media = this.htmlElement.audio; + this._html_initMedia(); + }, + _html_setVideo: function(media) { + var self = this; + // Always finds a format due to checks in setMedia() + $.each(this.formats, function(priority, format) { + if(self.html.support[format] && media[format]) { + self.status.src = media[format]; + self.status.format[format] = true; + self.status.formatType = format; + return false; + } + }); + if(this.status.nativeVideoControls) { + this.htmlElement.video.poster = this._validString(media.poster) ? media.poster : ""; + } + this.htmlElement.media = this.htmlElement.video; + this._html_initMedia(); + }, + _html_resetMedia: function() { + if(this.htmlElement.media) { + if(this.htmlElement.media.id === this.internal.video.id && !this.status.nativeVideoControls) { + this.internal.video.jq.css({'width':'0px', 'height':'0px'}); + } + this.htmlElement.media.pause(); + } + }, + _html_clearMedia: function() { + if(this.htmlElement.media) { + this.htmlElement.media.src = ""; + this.htmlElement.media.load(); // Stops an old, "in progress" download from continuing the download. Triggers the loadstart, error and emptied events, due to the empty src. Also an abort event if a download was in progress. + } + }, + _html_load: function() { + // This function remains to allow the early HTML5 browsers to work, such as Firefox 3.6 + // A change in the W3C spec for the media.load() command means that this is no longer necessary. + // This command should be removed and actually causes minor undesirable effects on some browsers. Such as loading the whole file and not only the metadata. + if(this.status.waitForLoad) { + this.status.waitForLoad = false; + this.htmlElement.media.load(); + } + clearTimeout(this.internal.htmlDlyCmdId); + }, + _html_play: function(time) { + var self = this; + this._html_load(); // Loads if required and clears any delayed commands. + + this.htmlElement.media.play(); // Before currentTime attempt otherwise Firefox 4 Beta never loads. + + if(!isNaN(time)) { + try { + this.htmlElement.media.currentTime = time; + } catch(err) { + this.internal.htmlDlyCmdId = setTimeout(function() { + self.play(time); + }, 100); + return; // Cancel execution and wait for the delayed command. + } + } + this._html_checkWaitForPlay(); + }, + _html_pause: function(time) { + var self = this; + + if(time > 0) { // We do not want the stop() command, which does pause(0), causing a load operation. + this._html_load(); // Loads if required and clears any delayed commands. + } else { + clearTimeout(this.internal.htmlDlyCmdId); + } + + // Order of these commands is important for Safari (Win) and IE9. Pause then change currentTime. + this.htmlElement.media.pause(); + + if(!isNaN(time)) { + try { + this.htmlElement.media.currentTime = time; + } catch(err) { + this.internal.htmlDlyCmdId = setTimeout(function() { + self.pause(time); + }, 100); + return; // Cancel execution and wait for the delayed command. + } + } + if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button. + this._html_checkWaitForPlay(); + } + }, + _html_playHead: function(percent) { + var self = this; + this._html_load(); // Loads if required and clears any delayed commands. + try { + if((typeof this.htmlElement.media.seekable === "object") && (this.htmlElement.media.seekable.length > 0)) { + this.htmlElement.media.currentTime = percent * this.htmlElement.media.seekable.end(this.htmlElement.media.seekable.length-1) / 100; + } else if(this.htmlElement.media.duration > 0 && !isNaN(this.htmlElement.media.duration)) { + this.htmlElement.media.currentTime = percent * this.htmlElement.media.duration / 100; + } else { + throw "e"; + } + } catch(err) { + this.internal.htmlDlyCmdId = setTimeout(function() { + self.playHead(percent); + }, 100); + return; // Cancel execution and wait for the delayed command. + } + if(!this.status.waitForLoad) { + this._html_checkWaitForPlay(); + } + }, + _html_checkWaitForPlay: function() { + if(this.status.waitForPlay) { + this.status.waitForPlay = false; + if(this.css.jq.videoPlay.length) { + this.css.jq.videoPlay.hide(); + } + if(this.status.video) { + this.internal.poster.jq.hide(); + this.internal.video.jq.css({'width': this.status.width, 'height': this.status.height}); + } + } + }, + _html_volume: function(v) { + if(this.html.audio.available) { + this.htmlElement.audio.volume = v; + } + if(this.html.video.available) { + this.htmlElement.video.volume = v; + } + }, + _html_mute: function(m) { + if(this.html.audio.available) { + this.htmlElement.audio.muted = m; + } + if(this.html.video.available) { + this.htmlElement.video.muted = m; + } + }, + _flash_setAudio: function(media) { + var self = this; + try { + // Always finds a format due to checks in setMedia() + $.each(this.formats, function(priority, format) { + if(self.flash.support[format] && media[format]) { + switch (format) { + case "m4a" : + case "fla" : + self._getMovie().fl_setAudio_m4a(media[format]); + break; + case "mp3" : + self._getMovie().fl_setAudio_mp3(media[format]); + break; + } + self.status.src = media[format]; + self.status.format[format] = true; + self.status.formatType = format; + return false; + } + }); + + if(this.options.preload === 'auto') { + this._flash_load(); + this.status.waitForLoad = false; + } + } catch(err) { this._flashError(err); } + }, + _flash_setVideo: function(media) { + var self = this; + try { + // Always finds a format due to checks in setMedia() + $.each(this.formats, function(priority, format) { + if(self.flash.support[format] && media[format]) { + switch (format) { + case "m4v" : + case "flv" : + self._getMovie().fl_setVideo_m4v(media[format]); + break; + } + self.status.src = media[format]; + self.status.format[format] = true; + self.status.formatType = format; + return false; + } + }); + + if(this.options.preload === 'auto') { + this._flash_load(); + this.status.waitForLoad = false; + } + } catch(err) { this._flashError(err); } + }, + _flash_resetMedia: function() { + this.internal.flash.jq.css({'width':'0px', 'height':'0px'}); // Must do via CSS as setting attr() to zero causes a jQuery error in IE. + this._flash_pause(NaN); + }, + _flash_clearMedia: function() { + try { + this._getMovie().fl_clearMedia(); + } catch(err) { this._flashError(err); } + }, + _flash_load: function() { + try { + this._getMovie().fl_load(); + } catch(err) { this._flashError(err); } + this.status.waitForLoad = false; + }, + _flash_play: function(time) { + try { + this._getMovie().fl_play(time); + } catch(err) { this._flashError(err); } + this.status.waitForLoad = false; + this._flash_checkWaitForPlay(); + }, + _flash_pause: function(time) { + try { + this._getMovie().fl_pause(time); + } catch(err) { this._flashError(err); } + if(time > 0) { // Avoids a setMedia() followed by stop() or pause(0) hiding the video play button. + this.status.waitForLoad = false; + this._flash_checkWaitForPlay(); + } + }, + _flash_playHead: function(p) { + try { + this._getMovie().fl_play_head(p); + } catch(err) { this._flashError(err); } + if(!this.status.waitForLoad) { + this._flash_checkWaitForPlay(); + } + }, + _flash_checkWaitForPlay: function() { + if(this.status.waitForPlay) { + this.status.waitForPlay = false; + if(this.css.jq.videoPlay.length) { + this.css.jq.videoPlay.hide(); + } + if(this.status.video) { + this.internal.poster.jq.hide(); + this.internal.flash.jq.css({'width': this.status.width, 'height': this.status.height}); + } + } + }, + _flash_volume: function(v) { + try { + this._getMovie().fl_volume(v); + } catch(err) { this._flashError(err); } + }, + _flash_mute: function(m) { + try { + this._getMovie().fl_mute(m); + } catch(err) { this._flashError(err); } + }, + _getMovie: function() { + return document[this.internal.flash.id]; + }, + _checkForFlash: function (version) { + // Function checkForFlash adapted from FlashReplace by Robert Nyman + // http://code.google.com/p/flashreplace/ + var flashIsInstalled = false; + var flash; + if(window.ActiveXObject){ + try{ + flash = new ActiveXObject(("ShockwaveFlash.ShockwaveFlash." + version)); + flashIsInstalled = true; + } + catch(e){ + // Throws an error if the version isn't available + } + } + else if(navigator.plugins && navigator.mimeTypes.length > 0){ + flash = navigator.plugins["Shockwave Flash"]; + if(flash){ + var flashVersion = navigator.plugins["Shockwave Flash"].description.replace(/.*\s(\d+\.\d+).*/, "$1"); + if(flashVersion >= version){ + flashIsInstalled = true; + } + } + } + return flashIsInstalled; + }, + _validString: function(url) { + return (url && typeof url === "string"); // Empty strings return false + }, + _limitValue: function(value, min, max) { + return (value < min) ? min : ((value > max) ? max : value); + }, + _urlNotSetError: function(context) { + this._error( { + type: $.jPlayer.error.URL_NOT_SET, + context: context, + message: $.jPlayer.errorMsg.URL_NOT_SET, + hint: $.jPlayer.errorHint.URL_NOT_SET + }); + }, + _flashError: function(error) { + var errorType; + if(!this.internal.ready) { + errorType = "FLASH"; + } else { + errorType = "FLASH_DISABLED"; + } + this._error( { + type: $.jPlayer.error[errorType], + context: this.internal.flash.swf, + message: $.jPlayer.errorMsg[errorType] + error.message, + hint: $.jPlayer.errorHint[errorType] + }); + // Allow the audio player to recover if display:none and then shown again, or with position:fixed on Firefox. + // This really only affects audio in a media player, as an audio player could easily move the jPlayer element away from such issues. + this.internal.flash.jq.css({'width':'1px', 'height':'1px'}); + }, + _error: function(error) { + this._trigger($.jPlayer.event.error, error); + if(this.options.errorAlerts) { + this._alert("Error!" + (error.message ? "\n\n" + error.message : "") + (error.hint ? "\n\n" + error.hint : "") + "\n\nContext: " + error.context); + } + }, + _warning: function(warning) { + this._trigger($.jPlayer.event.warning, undefined, warning); + if(this.options.warningAlerts) { + this._alert("Warning!" + (warning.message ? "\n\n" + warning.message : "") + (warning.hint ? "\n\n" + warning.hint : "") + "\n\nContext: " + warning.context); + } + }, + _alert: function(message) { + alert("jPlayer " + this.version.script + " : id='" + this.internal.self.id +"' : " + message); + }, + _emulateHtmlBridge: function() { + var self = this, + methods = $.jPlayer.emulateMethods; + + // Emulate methods on jPlayer's DOM element. + $.each( $.jPlayer.emulateMethods.split(/\s+/g), function(i, name) { + self.internal.domNode[name] = function(arg) { + self[name](arg); + }; + + }); + + // Bubble jPlayer events to its DOM element. + $.each($.jPlayer.event, function(eventName,eventType) { + var nativeEvent = true; + $.each( $.jPlayer.reservedEvent.split(/\s+/g), function(i, name) { + if(name === eventName) { + nativeEvent = false; + return false; + } + }); + if(nativeEvent) { + self.element.bind(eventType + ".jPlayer.jPlayerHtml", function() { // With .jPlayer & .jPlayerHtml namespaces. + self._emulateHtmlUpdate(); + var domEvent = document.createEvent("Event"); + domEvent.initEvent(eventName, false, true); + self.internal.domNode.dispatchEvent(domEvent); + }); + } + // The error event would require a special case + }); + + // IE9 has a readyState property on all elements. The document should have it, but all (except media) elements inherit it in IE9. This conflicts with Popcorn, which polls the readyState. + }, + _emulateHtmlUpdate: function() { + var self = this; + + $.each( $.jPlayer.emulateStatus.split(/\s+/g), function(i, name) { + self.internal.domNode[name] = self.status[name]; + }); + $.each( $.jPlayer.emulateOptions.split(/\s+/g), function(i, name) { + self.internal.domNode[name] = self.options[name]; + }); + }, + _destroyHtmlBridge: function() { + var self = this; + + // Bridge event handlers are also removed by destroy() through .jPlayer namespace. + this.element.unbind(".jPlayerHtml"); // Remove all event handlers created by the jPlayer bridge. So you can change the emulateHtml option. + + // Remove the methods and properties + var emulated = $.jPlayer.emulateMethods + " " + $.jPlayer.emulateStatus + " " + $.jPlayer.emulateOptions; + $.each( emulated.split(/\s+/g), function(i, name) { + delete self.internal.domNode[name]; + }); + } + }; + + $.jPlayer.error = { + FLASH: "e_flash", + FLASH_DISABLED: "e_flash_disabled", + NO_SOLUTION: "e_no_solution", + NO_SUPPORT: "e_no_support", + URL: "e_url", + URL_NOT_SET: "e_url_not_set", + VERSION: "e_version" + }; + + $.jPlayer.errorMsg = { + FLASH: "jPlayer's Flash fallback is not configured correctly, or a command was issued before the jPlayer Ready event. Details: ", // Used in: _flashError() + FLASH_DISABLED: "jPlayer's Flash fallback has been disabled by the browser due to the CSS rules you have used. Details: ", // Used in: _flashError() + NO_SOLUTION: "No solution can be found by jPlayer in this browser. Neither HTML nor Flash can be used.", // Used in: _init() + NO_SUPPORT: "It is not possible to play any media format provided in setMedia() on this browser using your current options.", // Used in: setMedia() + URL: "Media URL could not be loaded.", // Used in: jPlayerFlashEvent() and _addHtmlEventListeners() + URL_NOT_SET: "Attempt to issue media playback commands, while no media url is set.", // Used in: load(), play(), pause(), stop() and playHead() + VERSION: "jPlayer " + $.jPlayer.prototype.version.script + " needs Jplayer.swf version " + $.jPlayer.prototype.version.needFlash + " but found " // Used in: jPlayerReady() + }; + + $.jPlayer.errorHint = { + FLASH: "Check your swfPath option and that Jplayer.swf is there.", + FLASH_DISABLED: "Check that you have not display:none; the jPlayer entity or any ancestor.", + NO_SOLUTION: "Review the jPlayer options: support and supplied.", + NO_SUPPORT: "Video or audio formats defined in the supplied option are missing.", + URL: "Check media URL is valid.", + URL_NOT_SET: "Use setMedia() to set the media URL.", + VERSION: "Update jPlayer files." + }; + + $.jPlayer.warning = { + CSS_SELECTOR_COUNT: "e_css_selector_count", + CSS_SELECTOR_METHOD: "e_css_selector_method", + CSS_SELECTOR_STRING: "e_css_selector_string", + OPTION_KEY: "e_option_key" + }; + + $.jPlayer.warningMsg = { + CSS_SELECTOR_COUNT: "The number of css selectors found did not equal one: ", + CSS_SELECTOR_METHOD: "The methodName given in jPlayer('cssSelector') is not a valid jPlayer method.", + CSS_SELECTOR_STRING: "The methodCssSelector given in jPlayer('cssSelector') is not a String or is empty.", + OPTION_KEY: "The option requested in jPlayer('option') is undefined." + }; + + $.jPlayer.warningHint = { + CSS_SELECTOR_COUNT: "Check your css selector and the ancestor.", + CSS_SELECTOR_METHOD: "Check your method name.", + CSS_SELECTOR_STRING: "Check your css selector is a string.", + OPTION_KEY: "Check your option name." + }; +})(jQuery); From 1415cb8d196761b4f3b0ecb567aa2377fb417840 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 1 Jan 2012 23:45:22 +0100 Subject: [PATCH 031/106] add infieldlabel source --- core/js/jquery.infieldlabel.js | 140 +++++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100755 core/js/jquery.infieldlabel.js diff --git a/core/js/jquery.infieldlabel.js b/core/js/jquery.infieldlabel.js new file mode 100755 index 0000000000..f6a67b66ce --- /dev/null +++ b/core/js/jquery.infieldlabel.js @@ -0,0 +1,140 @@ +/* + * In-Field Label jQuery Plugin + * http://fuelyourcoding.com/scripts/infield.html + * + * Copyright (c) 2009 Doug Neiner + * Dual licensed under the MIT and GPL licenses. + * Uses the same license as jQuery, see: + * http://docs.jquery.com/License + * + * @version 0.1 + */ +(function($){ + + $.InFieldLabels = function(label,field, options){ + // To avoid scope issues, use 'base' instead of 'this' + // to reference this class from internal events and functions. + var base = this; + + // Access to jQuery and DOM versions of each element + base.$label = $(label); + base.label = label; + + base.$field = $(field); + base.field = field; + + base.$label.data("InFieldLabels", base); + base.showing = true; + + base.init = function(){ + // Merge supplied options with default options + base.options = $.extend({},$.InFieldLabels.defaultOptions, options); + + // Check if the field is already filled in + if(base.$field.val() != ""){ + base.$label.hide(); + base.showing = false; + }; + + base.$field.focus(function(){ + base.fadeOnFocus(); + }).blur(function(){ + base.checkForEmpty(true); + }).bind('keydown.infieldlabel',function(e){ + // Use of a namespace (.infieldlabel) allows us to + // unbind just this method later + base.hideOnChange(e); + }).change(function(e){ + base.checkForEmpty(); + }).bind('onPropertyChange', function(){ + base.checkForEmpty(); + }); + }; + + // If the label is currently showing + // then fade it down to the amount + // specified in the settings + base.fadeOnFocus = function(){ + if(base.showing){ + base.setOpacity(base.options.fadeOpacity); + }; + }; + + base.setOpacity = function(opacity){ + base.$label.stop().animate({ opacity: opacity }, base.options.fadeDuration); + base.showing = (opacity > 0.0); + }; + + // Checks for empty as a fail safe + // set blur to true when passing from + // the blur event + base.checkForEmpty = function(blur){ + if(base.$field.val() == ""){ + base.prepForShow(); + base.setOpacity( blur ? 1.0 : base.options.fadeOpacity ); + } else { + base.setOpacity(0.0); + }; + }; + + base.prepForShow = function(e){ + if(!base.showing) { + // Prepare for a animate in... + base.$label.css({opacity: 0.0}).show(); + + // Reattach the keydown event + base.$field.bind('keydown.infieldlabel',function(e){ + base.hideOnChange(e); + }); + }; + }; + + base.hideOnChange = function(e){ + if( + (e.keyCode == 16) || // Skip Shift + (e.keyCode == 9) // Skip Tab + ) return; + + if(base.showing){ + base.$label.hide(); + base.showing = false; + }; + + // Remove keydown event to save on CPU processing + base.$field.unbind('keydown.infieldlabel'); + }; + + // Run the initialization method + base.init(); + }; + + $.InFieldLabels.defaultOptions = { + fadeOpacity: 0.5, // Once a field has focus, how transparent should the label be + fadeDuration: 300 // How long should it take to animate from 1.0 opacity to the fadeOpacity + }; + + + $.fn.inFieldLabels = function(options){ + return this.each(function(){ + // Find input or textarea based on for= attribute + // The for attribute on the label must contain the ID + // of the input or textarea element + var for_attr = $(this).attr('for'); + if( !for_attr ) return; // Nothing to attach, since the for field wasn't used + + + // Find the referenced input or textarea element + var $field = $( + "input#" + for_attr + "[type='text']," + + "input#" + for_attr + "[type='password']," + + "textarea#" + for_attr + ); + + if( $field.length == 0) return; // Again, nothing to attach + + // Only create object for input[text], input[password], or textarea + (new $.InFieldLabels(this, $field[0], options)); + }); + }; + +})(jQuery); \ No newline at end of file From a9bab168f5e43bfa5fe1523aab80faf1bc02cd58 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 18:40:32 -0500 Subject: [PATCH 032/106] Replace canRead()/canWrite() with is_readable()/is_writeable() for proper permission checks --- lib/filestorage/local.php | 4 +-- lib/filesystem.php | 61 +++++++++++++++------------------------ 2 files changed, 25 insertions(+), 40 deletions(-) diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 9e29f85071..02746fa6c6 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -50,10 +50,10 @@ class OC_Filestorage_Local extends OC_Filestorage{ } } public function is_readable($path){ - return is_readable($this->datadir.$path); + return true; } public function is_writeable($path){ - return is_writeable($this->datadir.$path); + return true; } public function file_exists($path){ return file_exists($this->datadir.$path); diff --git a/lib/filesystem.php b/lib/filesystem.php index cae8ead5b1..9b3dde1ae0 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -130,35 +130,6 @@ class OC_Filesystem{ return $internalPath; } - /** - * check if the current users has the right premissions to read a file - * @param string path - * @return bool - */ - static private function canRead($path){ - if(substr($path,0,1)!=='/'){ - $path='/'.$path; - } - if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){ - return false; - } - return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there - } - /** - * check if the current users has the right premissions to write a file - * @param string path - * @return bool - */ - static private function canWrite($path){ - if(substr($path,0,1)!=='/'){ - $path='/'.$path; - } - if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){ - return false; - } - return true;//dummy untill premissions are correctly implemented, also the correcty value because for now users are locked in their seperate data dir and can read/write everything in there - } - /** * mount an OC_Filestorage in our virtual filesystem * @param OC_Filestorage storage @@ -228,7 +199,7 @@ class OC_Filesystem{ */ static public function getLocalFile($path){ $parent=substr($path,0,strrpos($path,'/')); - if(self::canRead($parent) and $storage=self::getStorage($path)){ + if(self::is_readable($parent) and $storage=self::getStorage($path)){ return $storage->getLocalFile(self::getInternalPath($path)); } } @@ -267,10 +238,24 @@ class OC_Filesystem{ return self::basicOperation('readfile',$path,array('read')); } static public function is_readable($path){ - return self::basicOperation('is_readable',$path); + if(substr($path,0,1)!=='/'){ + $path='/'.$path; + } + if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){ + return false; + } + $storage=self::getStorage($path); + return $storage->is_readable($path); } static public function is_writeable($path){ - return self::basicOperation('is_writeable',$path); + if(substr($path,0,1)!=='/'){ + $path='/'.$path; + } + if(strstr($path,'/../') || strrchr($path, '/') === '/..' ){ + return false; + } + $storage=self::getStorage($path); + return $storage->is_writeable($path); } static public function file_exists($path){ if($path=='/'){ @@ -297,7 +282,7 @@ class OC_Filesystem{ return self::basicOperation('unlink',$path,array('delete')); } static public function rename($path1,$path2){ - if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::canWrite($path1) and self::canWrite($path2)){ + if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::is_writeable($path1) and self::is_writeable($path2)){ $run=true; OC_Hook::emit( 'OC_Filesystem', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); if($run){ @@ -318,7 +303,7 @@ class OC_Filesystem{ } } static public function copy($path1,$path2){ - if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::canRead($path1) and self::canWrite($path2)){ + if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::is_readable($path1) and self::is_writeable($path2)){ $run=true; OC_Hook::emit( 'OC_Filesystem', 'copy', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); $exists=self::file_exists($path2); @@ -373,13 +358,13 @@ class OC_Filesystem{ return self::basicOperation('fopen',$path,$hooks,$mode); } static public function toTmpFile($path){ - if(OC_FileProxy::runPreProxies('toTmpFile',$path) and self::canRead($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies('toTmpFile',$path) and self::is_readable($path) and $storage=self::getStorage($path)){ OC_Hook::emit( 'OC_Filesystem', 'read', array( 'path' => $path)); return $storage->toTmpFile(self::getInternalPath($path)); } } static public function fromTmpFile($tmpFile,$path){ - if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::is_writeable($path) and $storage=self::getStorage($path)){ $run=true; $exists=self::file_exists($path); if(!$exists){ @@ -399,7 +384,7 @@ class OC_Filesystem{ } } static public function fromUploadedFile($tmpFile,$path){ - if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::canWrite($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::is_writeable($path) and $storage=self::getStorage($path)){ $run=true; $exists=self::file_exists($path); if(!$exists){ @@ -462,7 +447,7 @@ class OC_Filesystem{ * @return mixed */ private static function basicOperation($operation,$path,$hooks=array(),$extraParam=null){ - if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::canRead($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies($operation,$path, $extraParam) and self::is_readable($path) and $storage=self::getStorage($path)){ $interalPath=self::getInternalPath($path); $run=true; foreach($hooks as $hook){ From a8789ebe2975564bee851b895d636d7503135257 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 2 Jan 2012 00:43:27 +0100 Subject: [PATCH 033/106] Removed static declaration from loadFrom* methods. --- lib/image.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/image.php b/lib/image.php index a8948956bf..21580f40b8 100644 --- a/lib/image.php +++ b/lib/image.php @@ -160,7 +160,7 @@ class OC_Image { * If a resource is passed it is the job of the caller to destroy it using imagedestroy($var) * @returns An image resource or false on error */ - static public function load($imageref) { + public function load($imageref) { if(self::loadFromFile($imageref) !== false) { return self::$resource; } elseif(self::loadFromBase64($imageref) !== false) { @@ -180,7 +180,7 @@ class OC_Image { * @param $imageref The path to a local file. * @returns An image resource or false on error */ - static public function loadFromFile($imagepath=false) { + public function loadFromFile($imagepath=false) { if(!is_file($imagepath) || !file_exists($imagepath) || !is_readable($imagepath)) { OC_Log::write('core','OC_Image::loadFromFile, couldn\'t load', OC_Log::DEBUG); return false; @@ -243,8 +243,7 @@ class OC_Image { OC_Log::write('core','OC_Image::loadFromFile, Default', OC_Log::DEBUG); break; } - // if($this->valid()) { // FIXME: I get an error: "PHP Fatal error: Using $this when not in object context..." WTF? - if(self::valid()) { // And here I get a warning: "PHP Strict Standards: Non-static method OC_Image::valid() should not be called statically..." valid() shouldn't be a static member as it would fail on a non-instantiated class. + if($this->valid()) { self::$imagetype = $itype; self::$destroy = true; } @@ -256,7 +255,7 @@ class OC_Image { * @param $str A string of image data as read from a file. * @returns An image resource or false on error */ - static public function loadFromData($str) { + public function loadFromData($str) { if(is_resource($str)) { return false; } @@ -274,7 +273,7 @@ class OC_Image { * @param $str A string base64 encoded string of image data. * @returns An image resource or false on error */ - static public function loadFromBase64($str) { + public function loadFromBase64($str) { if(!is_string($str)) { return false; } @@ -297,7 +296,7 @@ class OC_Image { * @param $res An image resource. * @returns An image resource or false on error */ - static public function loadFromResource($res) { + public function loadFromResource($res) { if(!is_resource($res)) { return false; } From 470bab9c682fdbe4dcb331f2f6a00b3a9aefc929 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 18:45:26 -0500 Subject: [PATCH 034/106] Fix typo in move error message --- files/ajax/move.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/files/ajax/move.php b/files/ajax/move.php index 8a56a01548..3517901c6c 100644 --- a/files/ajax/move.php +++ b/files/ajax/move.php @@ -14,7 +14,7 @@ $target = $_GET["target"]; if(OC_Files::move($dir,$file,$target,$file)){ OC_JSON::success(array("data" => array( "dir" => $dir, "files" => $file ))); }else{ - OC_JSON::error(array("data" => array( "message" => "Could move $file" ))); + OC_JSON::error(array("data" => array( "message" => "Could not move $file" ))); } ?> From 4374d55e5e020a1f2673a18991be6f2560e9f2c3 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 19:59:24 -0500 Subject: [PATCH 035/106] Correct local permissions checks --- lib/filestorage/local.php | 4 ++-- lib/filesystem.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/filestorage/local.php b/lib/filestorage/local.php index 02746fa6c6..cfc2715978 100644 --- a/lib/filestorage/local.php +++ b/lib/filestorage/local.php @@ -50,10 +50,10 @@ class OC_Filestorage_Local extends OC_Filestorage{ } } public function is_readable($path){ - return true; + return is_readable($this->datadir.$path); } public function is_writeable($path){ - return true; + return is_writable($this->datadir.$path); } public function file_exists($path){ return file_exists($this->datadir.$path); diff --git a/lib/filesystem.php b/lib/filesystem.php index 9b3dde1ae0..1205a6aa51 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -245,7 +245,7 @@ class OC_Filesystem{ return false; } $storage=self::getStorage($path); - return $storage->is_readable($path); + return $storage->is_readable(self::getInternalPath($path)); } static public function is_writeable($path){ if(substr($path,0,1)!=='/'){ @@ -255,7 +255,7 @@ class OC_Filesystem{ return false; } $storage=self::getStorage($path); - return $storage->is_writeable($path); + return $storage->is_writeable(self::getInternalPath($path)); } static public function file_exists($path){ if($path=='/'){ From e6739d230eec61af1ee99c4c17b53195552fe809 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Mon, 2 Jan 2012 11:35:50 +0100 Subject: [PATCH 036/106] add function to detect always the timezone --- apps/calendar/ajax/gettimezonedetection.php | 11 +++++++++++ apps/calendar/ajax/guesstimezone.php | 13 +++++++++++-- apps/calendar/ajax/timezonedetection.php | 17 +++++++++++++++++ apps/calendar/index.php | 2 +- apps/calendar/js/geo.js | 2 +- apps/calendar/js/settings.js | 11 +++++++++++ apps/calendar/templates/settings.php | 2 +- 7 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 apps/calendar/ajax/gettimezonedetection.php create mode 100644 apps/calendar/ajax/timezonedetection.php diff --git a/apps/calendar/ajax/gettimezonedetection.php b/apps/calendar/ajax/gettimezonedetection.php new file mode 100644 index 0000000000..ae58370712 --- /dev/null +++ b/apps/calendar/ajax/gettimezonedetection.php @@ -0,0 +1,11 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +require_once ("../../../lib/base.php"); +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); +OC_JSON::success(array('detection' => OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file diff --git a/apps/calendar/ajax/guesstimezone.php b/apps/calendar/ajax/guesstimezone.php index 07aadc5cb1..41aea26985 100755 --- a/apps/calendar/ajax/guesstimezone.php +++ b/apps/calendar/ajax/guesstimezone.php @@ -1,6 +1,6 @@ + * Copyright (c) 2011, 2012 Georg Ehrke * This file is licensed under the Affero General Public License version 3 or * later. * See the COPYING-README file. @@ -24,10 +24,19 @@ OC_JSON::checkAppEnabled('calendar'); $l = new OC_L10N('calendar'); $lat = $_GET['lat']; $long = $_GET['long']; +if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'position') == $lat . '-' . $long && OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone') != null){ + OC_JSON::success(); + exit; +} +OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'position', $lat . '-' . $long); $geolocation = file_get_contents('http://ws.geonames.org/timezone?lat=' . $lat . '&lng=' . $long); //Information are by Geonames (http://www.geonames.org) and licensed under the Creative Commons Attribution 3.0 License $geoxml = simplexml_load_string($geolocation); $geoarray = make_array_out_of_xml($geoxml); +if($geoarray['timezone']['timezoneId'] == OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone')){ + OC_JSON::success(); + exit; +} if(in_array($geoarray['timezone']['timezoneId'], DateTimeZone::listIdentifiers())){ OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $geoarray['timezone']['timezoneId']); $message = array('message'=> $l->t('New Timezone:') . $geoarray['timezone']['timezoneId']); @@ -36,4 +45,4 @@ if(in_array($geoarray['timezone']['timezoneId'], DateTimeZone::listIdentifiers() OC_JSON::error(); } -?> \ No newline at end of file +?> diff --git a/apps/calendar/ajax/timezonedetection.php b/apps/calendar/ajax/timezonedetection.php new file mode 100644 index 0000000000..77e4c4f6eb --- /dev/null +++ b/apps/calendar/ajax/timezonedetection.php @@ -0,0 +1,17 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ +require_once ("../../../lib/base.php"); +OC_JSON::checkLoggedIn(); +OC_JSON::checkAppEnabled('calendar'); +if($_POST['timezonedetection'] == 'on'){ + OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezonedetection', 'true'); +}else{ + OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezonedetection', 'false'); +} +OC_JSON::success(); + diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 7561f987b2..a2042afddf 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -32,7 +32,7 @@ if(OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'currentview', 'mont OC_Util::addScript('3rdparty/fullcalendar', 'fullcalendar'); OC_Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); -if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null){ +if(OC_Preferences::getValue(OC_USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezonedetection') == 'true'){ OC_UTIL::addScript('calendar', 'geo'); } OC_Util::addScript('calendar', 'calendar'); diff --git a/apps/calendar/js/geo.js b/apps/calendar/js/geo.js index 744d960b75..ae6a971e93 100755 --- a/apps/calendar/js/geo.js +++ b/apps/calendar/js/geo.js @@ -8,7 +8,7 @@ if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { $.getJSON(OC.filePath('calendar', 'ajax', 'guesstimezone.php?lat=' + position.coords.latitude + '&long=' + position.coords.longitude + ''), function(data){ - if (data.status == 'success'){ + if (data.status == 'success' && typeof(data.message) != 'undefined'){ $('#notification').html(data.message); $('#notification').attr('title', 'CC BY 3.0 by Geonames.org'); $('#notification').slideDown(); diff --git a/apps/calendar/js/settings.js b/apps/calendar/js/settings.js index 6c00be06b3..613e2d030d 100644 --- a/apps/calendar/js/settings.js +++ b/apps/calendar/js/settings.js @@ -8,6 +8,12 @@ $(document).ready(function(){ }); return false; }); + $('#timezonedetection').change( function(){ + var post = $('#timezonedetection').serialize(); + $.post( OC.filePath('calendar', 'ajax', 'timezonedetection.php'), post, function(data){ + + }); + }); $("#timezone").chosen(); $("#firstdayofweek").change( function(){ var data = $("#firstdayofweek").serialize(); @@ -52,6 +58,11 @@ $(document).ready(function(){ $.getJSON(OC.filePath('calendar', 'ajax', 'duration.php'), function(jsondata, status) { $("#duration").val(jsondata.duration); }); + $.getJSON(OC.filePath('calendar', 'ajax', 'gettimezonedetection.php'), function(jsondata, status){ + if(jsondata.detection == 'true'){ + $('#timezonedetection').attr('checked', 'checked'); + } + }); $("#weekend").change( function(){ var data = $("#weekend").serialize(); $.post( OC.filePath('calendar', 'ajax', 'setdaysofweekend.php'), data, function(data){ diff --git a/apps/calendar/templates/settings.php b/apps/calendar/templates/settings.php index 56fb55d235..fc8e0e061d 100644 --- a/apps/calendar/templates/settings.php +++ b/apps/calendar/templates/settings.php @@ -27,7 +27,7 @@ $continent=$ex[0]; echo ''; endforeach;?> - + From 0730077840a82a67a491780257089dfe7c7f64e2 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Mon, 2 Jan 2012 17:07:10 +0000 Subject: [PATCH 044/106] Used data-read and data-wite when binding drag and drop events --- files/js/files.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 88a07a0776..6044541d4a 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -11,8 +11,8 @@ $(document).ready(function() { $('#file_action_panel').attr('activeAction', false); //drag/drop of files - $('#fileList tr[data-file!="Shared"] td.filename').draggable(dragOptions); - $('#fileList tr[data-type="dir"][data-file!="Shared"] td.filename').droppable(folderDropOptions); + $('#fileList tr td.filename').draggable(dragOptions); + $('#fileList tr[data-type="dir"][data-read="false"][data-write="false"] td.filename').droppable(folderDropOptions); $('div.crumb').droppable(crumbDropOptions); $('ul#apps>li:first-child').data('dir',''); $('ul#apps>li:first-child').droppable(crumbDropOptions); From ebe3ae58cffa8c16ef2b1b74c5b7a9228a5495ff Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Mon, 2 Jan 2012 18:08:20 +0000 Subject: [PATCH 045/106] removed data-read and fixed droppable logic --- files/js/files.js | 2 +- files/templates/part.list.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/files/js/files.js b/files/js/files.js index 6044541d4a..7c04245c22 100644 --- a/files/js/files.js +++ b/files/js/files.js @@ -12,7 +12,7 @@ $(document).ready(function() { //drag/drop of files $('#fileList tr td.filename').draggable(dragOptions); - $('#fileList tr[data-type="dir"][data-read="false"][data-write="false"] td.filename').droppable(folderDropOptions); + $('#fileList tr[data-type="dir"][data-write="true"] td.filename').droppable(folderDropOptions); $('div.crumb').droppable(crumbDropOptions); $('ul#apps>li:first-child').data('dir',''); $('ul#apps>li:first-child').droppable(crumbDropOptions); diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 81ba24dac9..a364862119 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -1,5 +1,4 @@ - ' data-read='' data-write=''> + ' data-write=''> From b8cffbc0eec099e0fb7ffbb53e7fc1dc5bbc4035 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 2 Jan 2012 23:17:15 +0100 Subject: [PATCH 046/106] OC_Image::__invoke didn't return anything thus causing contacts/thumbnail.php to spit out lots of error messages. --- lib/image.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/image.php b/lib/image.php index b797f331f4..e09486be08 100644 --- a/lib/image.php +++ b/lib/image.php @@ -178,7 +178,7 @@ class OC_Image { * @brief Prints the image when called as $image(). */ public function __invoke() { - self::show(); + return self::show(); } /** From 4c8f17ad4747592cc01525c663de32962552cf18 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 3 Jan 2012 04:55:19 +0100 Subject: [PATCH 047/106] don't try to use mod_rewrite when it isn't enabled having a broken web/card/caldav is much better as having no ownCloud at all :) --- .htaccess | 2 ++ lib/setup.php | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.htaccess b/.htaccess index b181f8b845..86a2de6b94 100644 --- a/.htaccess +++ b/.htaccess @@ -5,6 +5,8 @@ php_value post_max_size 512M php_value memory_limit 512M SetEnv htaccessWorking true + RewriteEngine on RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last] + Options -Indexes diff --git a/lib/setup.php b/lib/setup.php index 8afe0070e9..b53c626c9a 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -275,7 +275,7 @@ class OC_Setup { $content.= "php_value post_max_size 512M\n"; $content.= "SetEnv htaccessWorking true\n"; $content.= "\n"; - $content.= "\n"; + $content.= ""; $content.= "RewriteEngine on\n"; $content.= "RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]\n"; $content.= "\n"; From 9e9bc1430b6b31be67a346421c1989c2d44fad11 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 3 Jan 2012 15:55:38 +0100 Subject: [PATCH 048/106] don't check if the target path is writable for operations that can create a new file fixes file upload --- lib/filesystem.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/filesystem.php b/lib/filesystem.php index 627f494c93..44401260c5 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -283,7 +283,7 @@ class OC_Filesystem{ return self::basicOperation('unlink',$path,array('delete')); } static public function rename($path1,$path2){ - if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::is_writeable($path1) and self::is_writeable($path2)){ + if(OC_FileProxy::runPreProxies('rename',$path1,$path2) and self::is_writeable($path1) and self::isValidPath($path2)){ $run=true; OC_Hook::emit( 'OC_Filesystem', 'rename', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); if($run){ @@ -304,7 +304,7 @@ class OC_Filesystem{ } } static public function copy($path1,$path2){ - if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::is_readable($path1) and self::is_writeable($path2)){ + if(OC_FileProxy::runPreProxies('copy',$path1,$path2) and self::is_readable($path1) and self::isValidPath($path2)){ $run=true; OC_Hook::emit( 'OC_Filesystem', 'copy', array( 'oldpath' => $path1 ,'newpath'=>$path2, 'run' => &$run)); $exists=self::file_exists($path2); @@ -365,7 +365,7 @@ class OC_Filesystem{ } } static public function fromTmpFile($tmpFile,$path){ - if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::is_writeable($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies('copy',$tmpFile,$path) and self::isValidPath($path) and $storage=self::getStorage($path)){ $run=true; $exists=self::file_exists($path); if(!$exists){ @@ -385,7 +385,7 @@ class OC_Filesystem{ } } static public function fromUploadedFile($tmpFile,$path){ - if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::is_writeable($path) and $storage=self::getStorage($path)){ + if(OC_FileProxy::runPreProxies('fromUploadedFile',$tmpFile,$path) and self::isValidPath($path) and $storage=self::getStorage($path)){ $run=true; $exists=self::file_exists($path); if(!$exists){ From 868a3b5364af550492794f2093ce0aa07b938c6c Mon Sep 17 00:00:00 2001 From: prcrst Date: Tue, 3 Jan 2012 12:37:33 +0100 Subject: [PATCH 049/106] Fix sqlite detection for Ubuntu 11.10 --- lib/util.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/util.php b/lib/util.php index 9cf78da6e9..009119b54a 100644 --- a/lib/util.php +++ b/lib/util.php @@ -175,7 +175,7 @@ class OC_Util { $errors=array(); //check for database drivers - if(!is_callable('sqlite_open') and !is_callable('mysql_connect') and !is_callable('pg_connect')){ + if(!(is_callable('sqlite_open') or class_exists('SQLite3')) and !is_callable('mysql_connect') and !is_callable('pg_connect')){ $errors[]=array('error'=>'No database drivers (sqlite, mysql, or postgresql) installed.
      ','hint'=>'');//TODO: sane hint } $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); From e0a058c732cc9d1f279cd6604623d9bf7c196744 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Tue, 3 Jan 2012 17:23:50 +0100 Subject: [PATCH 050/106] remove error output if symlink already exists. this can happen if a user removed config.php to trigger the setup wizzard --- apps/user_webfinger/appinfo/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_webfinger/appinfo/install.php b/apps/user_webfinger/appinfo/install.php index 079043cd10..f570a3a249 100644 --- a/apps/user_webfinger/appinfo/install.php +++ b/apps/user_webfinger/appinfo/install.php @@ -3,4 +3,4 @@ $appInfoDir = __DIR__; $thisAppDir = dirname($appInfoDir); $appsDir = dirname($thisAppDir); $ownCloudDir = dirname($appsDir); -symlink($thisAppDir, $ownCloudDir.'/.well-known'); +@symlink($thisAppDir, $ownCloudDir.'/.well-known'); From b6d66c4727e50ab9e9ade0e804e3fda98a120dd3 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Wed, 4 Jan 2012 15:19:16 -0500 Subject: [PATCH 051/106] Remove the keys in preferences when a user is deleted - Thanks rogerc --- lib/user.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/user.php b/lib/user.php index 0a5881ec0f..34f44f572e 100644 --- a/lib/user.php +++ b/lib/user.php @@ -169,7 +169,8 @@ class OC_User { foreach( OC_Group::getUserGroups( $uid ) as $i ){ OC_Group::removeFromGroup( $uid, $i ); } - + // Delete the user's keys in preferences + OC_Preferences::deleteUser($uid); // Emit and exit OC_Hook::emit( "OC_User", "post_deleteUser", array( "uid" => $uid )); return true; From 48a8f2a793d2154c7f9d963fda679e0c380cb273 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 4 Jan 2012 22:56:58 +0100 Subject: [PATCH 052/106] Content type header was sent when saving image to disk. --- lib/image.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/image.php b/lib/image.php index e09486be08..32568a2540 100644 --- a/lib/image.php +++ b/lib/image.php @@ -125,7 +125,7 @@ class OC_Image { */ public function save($filepath=null) { - if($filepath === null && $this->filepath === null) { + if($filepath === null && self::$filepath === null) { OC_Log::write('core','OC_Image::save. save() called with no path.', OC_Log::ERROR); return false; } elseif($filepath === null && $this->filepath !== null) { @@ -138,8 +138,8 @@ class OC_Image { * @brief Outputs/saves the image. */ private function _output($filepath=null, $really=false) { - header('Content-Type: '.self::mimeType()); if($really === false) { + header('Content-Type: '.self::mimeType()); $filepath = null; // Just being cautious ;-) } else { if(!is_writable(dirname($filepath))) { From d80b477ab55c459cc80cf091c80f81082b7d78f9 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 4 Jan 2012 23:31:32 +0100 Subject: [PATCH 053/106] Wrong permission checking on file save. --- lib/image.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/image.php b/lib/image.php index 32568a2540..f120328b0e 100644 --- a/lib/image.php +++ b/lib/image.php @@ -143,10 +143,10 @@ class OC_Image { $filepath = null; // Just being cautious ;-) } else { if(!is_writable(dirname($filepath))) { - OC_Log::write('core','OC_Image::save. Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR); + OC_Log::write('core','OC_Image::_output. Directory \''.dirname($filepath).'\' is not writable.', OC_Log::ERROR); return false; - } elseif(is_writable(dirname($filepath)) && !is_writable($filepath)) { - OC_Log::write('core','OC_Image::save. File \''.$filepath.'\' is not writable.', OC_Log::ERROR); + } elseif(is_writable(dirname($filepath)) && file_exists($filepath) && !is_writable($filepath)) { + OC_Log::write('core','OC_Image::_output. File \''.$filepath.'\' is not writable.', OC_Log::ERROR); return false; } } From a88cc91ad923e6d7d128cf08e25bca645dfade00 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 17:05:30 +0100 Subject: [PATCH 054/106] fix end for repeating events --- apps/calendar/ajax/editeventform.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index 4783fcca89..f605f33edb 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -163,16 +163,16 @@ if($data['repeating'] == 1){ } $repeat['interval'] = $rrulearr['INTERVAL']; if(array_key_exists('COUNT', $rrulearr)){ - $end = 'count'; - $count = $rrulearr['COUNT']; + $repeat['end'] = 'count'; + $repeat['count'] = $rrulearr['COUNT']; }elseif(array_key_exists('UNTIL', $rrulearr)){ - $end = 'date'; + $repeat['end'] = 'date'; $endbydate_day = substr($rrulearr['UNTIL'], 6, 2); $endbydate_month = substr($rrulearr['UNTIL'], 4, 2); $endbydate_year = substr($rrulearr['UNTIL'], 0, 4); - $endbydate = $endbydate_day . $endbydate_month . $endbydate_year; + $repeat['date'] = $endbydate_day . '-' . $endbydate_month . '-' . $endbydate_year; }else{ - $end = 'never'; + $repeat['end'] = 'never'; } if(array_key_exists('weekdays', $repeat)){ $repeat_weekdays_ = array(); From d3a0c7354c710f21cadd64493419aab73874649e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 17:09:01 +0100 Subject: [PATCH 055/106] fix repeat rule for every weekday --- apps/calendar/lib/object.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index b53feb0bf0..c834dad0f4 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -670,7 +670,7 @@ class OC_Calendar_Object{ } break; case 'weekday': - $rrule .= 'FREQ=DAILY'; + $rrule .= 'FREQ=WEEKLY'; $rrule .= ';BYDAY=MO,TU,WE,TH,FR'; break; case 'biweekly': From 2f86a6203adc82e1221873ed72a0ac60c340d65b Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Thu, 5 Jan 2012 17:42:40 +0100 Subject: [PATCH 056/106] Added fixOrientation method which rotates the image based on EXIF data. --- lib/image.php | 84 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/lib/image.php b/lib/image.php index f120328b0e..45b6ad3918 100644 --- a/lib/image.php +++ b/lib/image.php @@ -42,8 +42,7 @@ function ellipsis($str, $maxlen) { } /** - * Class for image manipulation - * Ideas: imagerotate, chunk_split(base64_encode()) + * Class for basic image manipulation * */ class OC_Image { @@ -200,6 +199,87 @@ class OC_Image { return chunk_split(base64_encode(ob_get_clean())); } + /** + * @brief Fixes orientation based on EXIF data. + * @returns bool. + */ + public function fixOrientation() { + if(!is_resource(self::$resource)) { + OC_Log::write('core','OC_Image::fixOrientation() No image loaded.', OC_Log::DEBUG); + return false; + } + if(is_null(self::$filepath) || !is_readable(self::$filepath)) { + OC_Log::write('core','OC_Image::fixOrientation() No readable file path set.', OC_Log::DEBUG); + return false; + } + $exif = exif_read_data(self::$filepath, 'IFD0'); + if(!$exif) { + return false; + } + if(!isset($exif['Orientation'])) { + return true; // Nothing to fix + } + $o = $exif['Orientation']; + OC_Log::write('core','OC_Image::fixOrientation() Orientation: '.$o, OC_Log::DEBUG); + $rotate = 0; + $flip = false; + switch($o) { + case 1: + $rotate = 0; + $flip = false; + break; + case 2: // Not tested + $rotate = 0; + $flip = true; + break; + case 3: + $rotate = 180; + $flip = false; + break; + case 4: // Not tested + $rotate = 180; + $flip = true; + break; + case 5: // Not tested + $rotate = 90; + $flip = true; + break; + case 6: + //$rotate = 90; + $rotate = 270; + $flip = false; + break; + case 7: // Not tested + $rotate = 270; + $flip = true; + break; + case 8: + $rotate = 270; + $flip = false; + break; + } + if($rotate) { + $res = imagerotate(self::$resource, $rotate, -1); + if($res) { + if(imagealphablending($res, true)) { + if(imagesavealpha($res, true)) { + self::$resource = $res; + return true; + } else { + OC_Log::write('core','OC_Image::fixOrientation() Error during alphasaving.', OC_Log::DEBUG); + return false; + } + } else { + OC_Log::write('core','OC_Image::fixOrientation() Error during alphablending.', OC_Log::DEBUG); + return false; + } + } else { + OC_Log::write('core','OC_Image::fixOrientation() Error during oriention fixing.', OC_Log::DEBUG); + return false; + } + } + } + /** * @brief Loads an image from a local file, a base64 encoded string or a resource created by an imagecreate* function. * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function. From edc9a150aa5cbf6898e9fadf1fdb6ba4babe8ed8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 17:49:09 +0100 Subject: [PATCH 057/106] fix editeventdialog for monthly repeating events with a specific weekday and weeknumber combination --- apps/calendar/ajax/editeventform.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index f605f33edb..a387062632 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -67,22 +67,22 @@ if($data['repeating'] == 1){ if(strlen($rrulearr['BYDAY']) == 2){ $repeat['weekdays'] = array($rrulearr['BYDAY']); }elseif(strlen($rrulearr['BYDAY']) == 3){ - $repeat['weekofmonth'] = substr($rrulearr['BYDAY'] , 0, 1); - $repeat['weekdays'] = array(substr($rrulearr['BYDAY'] , 1, 2)); + $repeat['weekofmonth'] = substr($rrulearr['BYDAY'], 0, 1); + $repeat['weekdays'] = array(substr($rrulearr['BYDAY'], 1, 2)); }elseif(strlen($rrulearr['BYDAY']) == 4){ - $repeat['weekofmonth'] = substr($rrulearr['BYDAY'] , 0, 2); - $repeat['weekdays'] = array(substr($rrulearr['BYDAY'] , 2, 2)); + $repeat['weekofmonth'] = substr($rrulearr['BYDAY'], 0, 2); + $repeat['weekdays'] = array(substr($rrulearr['BYDAY'], 2, 2)); } }else{ $byday_days = explode(',', $rrulearr['BYDAY']); foreach($byday_days as $byday_day){ if(strlen($byday_day) == 2){ $repeat['weekdays'][] = $byday_day; - }elseif(strlen($rrulearr['BYDAY']) == 3){ + }elseif(strlen($byday_day) == 3){ $repeat['weekofmonth'] = substr($byday_day , 0, 1); $repeat['weekdays'][] = substr($byday_day , 1, 2); - }elseif(strlen($rrulearr['BYDAY']) == 4){ - $repeat['byweekno'] = substr($byday_day , 0, 2); + }elseif(strlen($byday_day) == 4){ + $repeat['weekofmonth'] = substr($byday_day , 0, 2); $repeat['weekdays'][] = substr($byday_day , 2, 2); } } From a01a3d412c9dff2f3221b0b60307026a027ae5e8 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 17:53:13 +0100 Subject: [PATCH 058/106] fix autodetection for the week of the month --- apps/calendar/lib/object.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index c834dad0f4..cbb1badf80 100644 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -683,7 +683,8 @@ class OC_Calendar_Object{ break; }elseif($request['advanced_month_select'] == 'weekday'){ if($request['weekofmonthoptions'] == 'auto'){ - $weekofmonth = floor($request['weekofmonthoptions']/7); + list($_day, $_month, $_year) = explode('-', $from); + $weekofmonth = floor($_day/7); }else{ $weekofmonth = $request['weekofmonthoptions']; } From be9ca44d07a129671bd5ce53d64ef22da93d5ae9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 20:19:07 +0100 Subject: [PATCH 059/106] fix bug in 3rdparty lib --- 3rdparty/when/When.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/3rdparty/when/When.php b/3rdparty/when/When.php index 5f97f0eb9b..f8bb9db0f6 100755 --- a/3rdparty/when/When.php +++ b/3rdparty/when/When.php @@ -586,7 +586,7 @@ class When } } } - elseif($this->gobyday || $interval == "month") + elseif($this->gobyday && $interval == "month") { $_mdays = range(1, date('t',mktime(0,0,0,$month,1,$year))); foreach($_mdays as $_mday) @@ -621,7 +621,7 @@ class When if($interval == "month") { - $this->try_date->modify('last day of ' . $this->interval . ' ' . $interval); + $this->try_date->modify('+1 month'); } else { From 486694c2ec63d9164c43c66946473fc9403c5343 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 20:54:44 +0100 Subject: [PATCH 060/106] fix js for repeating events --- apps/calendar/js/calendar.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/calendar/js/calendar.js b/apps/calendar/js/calendar.js index d776f5c3fb..ae586661cc 100644 --- a/apps/calendar/js/calendar.js +++ b/apps/calendar/js/calendar.js @@ -279,9 +279,9 @@ Calendar={ minWidth:'auto' }); Calendar.UI.repeat('end'); - Calendar.UI.repeat('repeat'); Calendar.UI.repeat('month'); Calendar.UI.repeat('year'); + Calendar.UI.repeat('repeat'); } if(task == 'end'){ $('#byoccurrences').css('display', 'none'); @@ -304,12 +304,14 @@ Calendar={ $('#advanced_bymonthday').css('display', 'none'); if($('#repeat option:selected').val() == 'monthly'){ $('#advanced_month').css('display', 'block'); + Calendar.UI.repeat('month'); } if($('#repeat option:selected').val() == 'weekly'){ $('#advanced_weekday').css('display', 'block'); } if($('#repeat option:selected').val() == 'yearly'){ $('#advanced_year').css('display', 'block'); + Calendar.UI.repeat('year'); } if($('#repeat option:selected').val() == 'doesnotrepeat'){ $('#advanced_options_repeating').slideUp('slow'); @@ -341,6 +343,7 @@ Calendar={ $('#advanced_weekday').css('display', 'block'); } } + }, Calendar:{ overview:function(){ From cb445deb5f986da3a785999225d28ece4d043ec5 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Thu, 5 Jan 2012 21:02:11 +0100 Subject: [PATCH 061/106] fix login check in ajax files --- apps/calendar/ajax/editeventform.php | 4 +++- apps/calendar/ajax/importdialog.php | 4 +++- apps/calendar/ajax/neweventform.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/apps/calendar/ajax/editeventform.php b/apps/calendar/ajax/editeventform.php index a387062632..95cae39c1c 100644 --- a/apps/calendar/ajax/editeventform.php +++ b/apps/calendar/ajax/editeventform.php @@ -8,7 +8,9 @@ require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); +if(!OC_USER::isLoggedIn()) { + die(''); +} OC_JSON::checkAppEnabled('calendar'); $id = $_GET['id']; diff --git a/apps/calendar/ajax/importdialog.php b/apps/calendar/ajax/importdialog.php index 8d8430da7a..983a3d95a8 100644 --- a/apps/calendar/ajax/importdialog.php +++ b/apps/calendar/ajax/importdialog.php @@ -10,7 +10,9 @@ require_once('../../../lib/base.php'); $l10n = new OC_L10N('calendar'); -OC_JSON::checkLoggedIn(); +if(!OC_USER::isLoggedIn()) { + die(''); +} OC_JSON::checkAppEnabled('calendar'); $tmpl = new OC_Template('calendar', 'part.import'); diff --git a/apps/calendar/ajax/neweventform.php b/apps/calendar/ajax/neweventform.php index 88468dd3db..3870c879b0 100644 --- a/apps/calendar/ajax/neweventform.php +++ b/apps/calendar/ajax/neweventform.php @@ -8,7 +8,9 @@ require_once('../../../lib/base.php'); -OC_JSON::checkLoggedIn(); +if(!OC_USER::isLoggedIn()) { + die(''); +} OC_JSON::checkAppEnabled('calendar'); if (!isset($_POST['start'])){ From f18e866a1e152a1fb13cb883d89d8efde413cea9 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 6 Jan 2012 14:36:24 +0100 Subject: [PATCH 062/106] improve search function --- apps/calendar/index.php | 3 +++ apps/calendar/lib/search.php | 27 ++++++++++++++++++++++++--- apps/calendar/templates/calendar.php | 10 ++++++++++ 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/apps/calendar/index.php b/apps/calendar/index.php index a2042afddf..e8e214c0b7 100644 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -42,4 +42,7 @@ OC_Util::addStyle('', 'jquery.multiselect'); OC_App::setActiveNavigationEntry('calendar_index'); $tmpl = new OC_Template('calendar', 'calendar', 'user'); $tmpl->assign('eventSources', $eventSources); +if(array_key_exists('showevent', $_GET)){ + $tmpl->assign('showevent', $_GET['showevent']); +} $tmpl->printPage(); diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php index 41faf49a51..425c93c733 100644 --- a/apps/calendar/lib/search.php +++ b/apps/calendar/lib/search.php @@ -12,15 +12,36 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{ }else{ $searchquery[] = $query; } + $user_timezone = OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); + $l = new OC_l10n('calendar'); foreach($calendars as $calendar){ $objects = OC_Calendar_Object::all($calendar['id']); foreach($objects as $object){ - if(substr_count(strtolower($object['summary']), strtolower($query)) > 0){//$name,$text,$link,$type - $results[]=new OC_Search_Result($object['summary'],'','#','Cal.'); + if(substr_count(strtolower($object['summary']), strtolower($query)) > 0){ + $calendardata = OC_VObject::parse($object['calendardata']); + $vevent = $calendardata->VEVENT; + $dtstart = $vevent->DTSTART; + $dtend = OC_Calendar_Object::getDTEndFromVEvent($vevent); + $start_dt = $dtstart->getDateTime(); + $start_dt->setTimezone(new DateTimeZone($user_timezone)); + $end_dt = $dtend->getDateTime(); + $end_dt->setTimezone(new DateTimeZone($user_timezone)); + if ($dtstart->getDateType() == Sabre_VObject_Element_DateTime::DATE){ + $end_dt->modify('-1 sec'); + if($start_dt->format('d.m.Y') != $end_dt->format('d.m.Y')){ + $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y') . ' - ' . $end_dt->format('d.m.Y'); + }else{ + $info = $l->t('Date') . ': ' . $start_dt->format('d.m.Y'); + } + }else{ + $info = $l->t('Date') . ': ' . $start_dt->format('d.m.y H:i') . ' - ' . $end_dt->format('d.m.y H:i'); + } + $link = OC_Helper::linkTo('apps/calendar', 'index.php?showevent='.urlencode($object['id'])); + $results[]=new OC_Search_Result($object['summary'],$info, $link,$l->t('Cal.'));//$name,$text,$link,$type } } } return $results; } } -new OC_Search_Provider_Calendar(); \ No newline at end of file +new OC_Search_Provider_Calendar(); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 13bc8bc1bb..92c1b8a778 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -18,6 +18,16 @@ var missing_field_startsbeforeends = 't('The event ends before it starts') ?>'; var missing_field_dberror = 't('There was a database fail') ?>'; var totalurl = '/calendars'; + $(document).ready(function() { + + });
      From f9db4249a3a7b73f6c712cfa32b029e6d09595f5 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Fri, 6 Jan 2012 17:21:24 +0100 Subject: [PATCH 063/106] add a formfactor session variable which is autodetected but can also manually overwritten via a get variable. currently we have: * default -> the normal desktop browser interface * mobile -> interface for smartphones * tablet -> interface for tablets * standalone -> the default interface but without header, footer and sidebar. just the application. useful to use just a specific app on the desktop in a standalone window. In the future we should adapt the userinterface to the specific formfactor. --- lib/base.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/lib/base.php b/lib/base.php index 700236c96c..0954e3615b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -70,6 +70,31 @@ class OC{ } } + /** + * autodetects the formfactor of the used device + * default -> the normal desktop browser interface + * mobile -> interface for smartphones + * tablet -> interface for tablets + * standalone -> the default interface but without header, footer and sidebar. just the application. useful to ue just a specific app on the desktop in a standalone window. + */ + public static function detectFormfactor(){ + // please add more useragent strings for other devices + if(isset($_SERVER['HTTP_USER_AGENT'])){ + if(stripos($_SERVER['HTTP_USER_AGENT'],'ipad')>0) { + $mode='tablet'; + }elseif(stripos($_SERVER['HTTP_USER_AGENT'],'iphone')>0){ + $mode='mobile'; + }elseif((stripos($_SERVER['HTTP_USER_AGENT'],'N9')>0) and (stripos($_SERVER['HTTP_USER_AGENT'],'nokia')>0)){ + $mode='mobile'; + }else{ + $mode='default'; + } + }else{ + $mode='default'; + } + return($mode); + } + public static function init(){ // register autoloader spl_autoload_register(array('OC','autoload')); @@ -130,6 +155,16 @@ class OC{ ini_set('session.cookie_httponly','1;'); session_start(); + // if the formfactor is not yet autodetected do the autodetection now. For possible forfactors check the detectFormfactor documentation + if(!isset($_SESSION['formfactor'])){ + $_SESSION['formfactor']=OC::detectFormfactor(); + } + // allow manual override via GET parameter + if(isset($_GET['formfactor'])){ + $_SESSION['formfactor']=$_GET['formfactor']; + } + + // Add the stuff we need always OC_Util::addScript( "jquery-1.6.4.min" ); OC_Util::addScript( "jquery-ui-1.8.14.custom.min" ); @@ -214,5 +249,7 @@ if(!function_exists('get_temp_dir')) { require_once('fakedirstream.php'); + + // FROM search.php new OC_Search_Provider_File(); From 47a275f3897bef9bb766f5b19c017f5072afef78 Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Fri, 6 Jan 2012 18:04:24 +0000 Subject: [PATCH 064/106] Use parameter --- lib/db.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/db.php b/lib/db.php index bcfe320665..c7085a975e 100644 --- a/lib/db.php +++ b/lib/db.php @@ -279,7 +279,7 @@ class OC_DB { 'output' => $file, 'end_of_line' => "\n" ); - self::$schema->dumpDatabase( $definition, $dump_options, MDB2_SCHEMA_DUMP_STRUCTURE ); + self::$schema->dumpDatabase( $definition, $dump_options, $mode ); return true; } From d485a70e7df602e85506ad94103df00f8bb3f765 Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Fri, 6 Jan 2012 19:08:35 +0100 Subject: [PATCH 065/106] finish the application store feature so that users can download and install ownCloud apps from our website. there is still a small problem with write permissions. will look into this later --- lib/app.php | 11 ++++++++++- lib/ocsclient.php | 27 +++++++++++++++++++++++++++ settings/apps.php | 32 ++++++++++++++++---------------- 3 files changed, 53 insertions(+), 17 deletions(-) diff --git a/lib/app.php b/lib/app.php index b1aa8ba354..1873e1136c 100644 --- a/lib/app.php +++ b/lib/app.php @@ -94,7 +94,15 @@ class OC_App{ */ public static function enable( $app ){ if(!OC_Installer::isInstalled($app)){ - OC_Installer::installShippedApp($app); + // check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string + if(!is_numeric($app)){ + OC_Installer::installShippedApp($app); + }else{ + $download=OC_OCSClient::getApplicationDownload($app,1); + if(isset($download['downloadlink']) and $download['downloadlink']<>'') { + OC_Installer::installApp(array('source'=>'http','href'=>$download['downloadlink'])); + } + } } OC_Appconfig::setValue( $app, 'enabled', 'yes' ); } @@ -107,6 +115,7 @@ class OC_App{ * This function set an app as disabled in appconfig. */ public static function disable( $app ){ + // check if app is a shiped app or not. if not delete OC_Appconfig::setValue( $app, 'enabled', 'no' ); } diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 072fd236fe..9d5932fb72 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -130,6 +130,33 @@ class OC_OCSClient{ return $app; } + /** + * @brief Get the download url for an application from the OCS server + * @returns array with application data + * + * This function returns an download url for an applications from the OCS server + */ + public static function getApplicationDownload($id,$item){ + $url='http://api.apps.owncloud.com/v1/content/download/'.urlencode($id).'/'.urlencode($item); + + $xml=@file_get_contents($url); + if($xml==FALSE){ + OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); + return NULL; + } + $data=simplexml_load_string($xml); + + $tmp=$data->data->content; + $app=array(); + if(isset($tmp->downloadlink)) { + $app['downloadlink']=$tmp->downloadlink; + }else{ + $app['downloadlink']=''; + } + return $app; + } + + /** * @brief Get all the knowledgebase entries from the OCS server * @returns array with q and a data diff --git a/settings/apps.php b/settings/apps.php index 12a7bf7720..40b72639cd 100644 --- a/settings/apps.php +++ b/settings/apps.php @@ -51,22 +51,22 @@ function app_sort($a, $b){ } usort($apps, 'app_sort'); -// dissabled for now -// $catagoryNames=OC_OCSClient::getCategories(); -// if(is_array($catagoryNames)){ -// $categories=array_keys($catagoryNames); -// $externalApps=OC_OCSClient::getApplications($categories); -// foreach($externalApps as $app){ -// $apps[]=array( -// 'name'=>$app['name'], -// 'id'=>$app['id'], -// 'active'=>false, -// 'description'=>$app['description'], -// 'author'=>$app['personid'], -// 'license'=>$app['license'], -// ); -// } -// } +// apps from external repo via OCS + $catagoryNames=OC_OCSClient::getCategories(); + if(is_array($catagoryNames)){ + $categories=array_keys($catagoryNames); + $externalApps=OC_OCSClient::getApplications($categories); + foreach($externalApps as $app){ + $apps[]=array( + 'name'=>$app['name'], + 'id'=>$app['id'], + 'active'=>false, + 'description'=>$app['description'], + 'author'=>$app['personid'], + 'license'=>$app['license'], + ); + } + } From 064d6b8a2cbb4d1c25f5c762eac2d8cf373b526e Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Fri, 6 Jan 2012 21:56:47 +0100 Subject: [PATCH 066/106] update calendar pot file --- l10n/templates/calendar.pot | 312 +++++++++++++++++++++++++++++------- 1 file changed, 250 insertions(+), 62 deletions(-) diff --git a/l10n/templates/calendar.pot b/l10n/templates/calendar.pot index 56fce2285e..ce255816ed 100644 --- a/l10n/templates/calendar.pot +++ b/l10n/templates/calendar.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-10-22 13:05+0200\n" +"POT-Creation-Date: 2012-01-06 21:55+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,8 +17,8 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ajax/editeventform.php:26 -msgid "Wrong calendar" +#: ajax/guesstimezone.php:42 +msgid "New Timezone:" msgstr "" #: ajax/settimezone.php:22 @@ -29,168 +29,312 @@ msgstr "" msgid "Invalid request" msgstr "" -#: appinfo/app.php:21 templates/calendar.php:11 -#: templates/part.eventform.php:21 +#: appinfo/app.php:20 templates/calendar.php:13 +#: templates/part.eventform.php:20 msgid "Calendar" msgstr "" -#: js/calendar.js:153 -msgid "ddd d MMMM[ yyyy]{ -[ddd d] MMMM yyyy}" +#: lib/app.php:19 +msgid "Wrong calendar" msgstr "" -#: js/calendar.js:155 -msgid "ddd d MMMM[ yyyy] HH:mm{ -[ ddd d MMMM yyyy] HH:mm}" -msgstr "" - -#: lib/object.php:344 +#: lib/app.php:60 lib/object.php:332 msgid "Birthday" msgstr "" -#: lib/object.php:345 +#: lib/app.php:61 lib/object.php:333 msgid "Business" msgstr "" -#: lib/object.php:346 +#: lib/app.php:62 lib/object.php:334 msgid "Call" msgstr "" -#: lib/object.php:347 +#: lib/app.php:63 lib/object.php:335 msgid "Clients" msgstr "" -#: lib/object.php:348 +#: lib/app.php:64 lib/object.php:336 msgid "Deliverer" msgstr "" -#: lib/object.php:349 +#: lib/app.php:65 lib/object.php:337 msgid "Holidays" msgstr "" -#: lib/object.php:350 +#: lib/app.php:66 lib/object.php:338 msgid "Ideas" msgstr "" -#: lib/object.php:351 +#: lib/app.php:67 lib/object.php:339 msgid "Journey" msgstr "" -#: lib/object.php:352 +#: lib/app.php:68 lib/object.php:340 msgid "Jubilee" msgstr "" -#: lib/object.php:353 +#: lib/app.php:69 lib/object.php:341 msgid "Meeting" msgstr "" -#: lib/object.php:354 +#: lib/app.php:70 lib/object.php:342 msgid "Other" msgstr "" -#: lib/object.php:355 +#: lib/app.php:71 lib/object.php:343 msgid "Personal" msgstr "" -#: lib/object.php:356 +#: lib/app.php:72 lib/object.php:344 msgid "Projects" msgstr "" -#: lib/object.php:357 +#: lib/app.php:73 lib/object.php:345 msgid "Questions" msgstr "" -#: lib/object.php:358 +#: lib/app.php:74 lib/object.php:346 msgid "Work" msgstr "" -#: lib/object.php:365 +#: lib/object.php:353 msgid "Does not repeat" msgstr "" -#: lib/object.php:366 +#: lib/object.php:354 msgid "Daily" msgstr "" -#: lib/object.php:367 +#: lib/object.php:355 msgid "Weekly" msgstr "" -#: lib/object.php:368 +#: lib/object.php:356 msgid "Every Weekday" msgstr "" -#: lib/object.php:369 +#: lib/object.php:357 msgid "Bi-Weekly" msgstr "" -#: lib/object.php:370 +#: lib/object.php:358 msgid "Monthly" msgstr "" -#: lib/object.php:371 +#: lib/object.php:359 msgid "Yearly" msgstr "" +#: lib/object.php:366 +msgid "never" +msgstr "" + +#: lib/object.php:367 +msgid "by occurrences" +msgstr "" + +#: lib/object.php:368 +msgid "by date" +msgstr "" + +#: lib/object.php:375 +msgid "by monthday" +msgstr "" + +#: lib/object.php:376 +msgid "by weekday" +msgstr "" + +#: lib/object.php:383 +msgid "Monday" +msgstr "" + +#: lib/object.php:384 +msgid "Tuesday" +msgstr "" + +#: lib/object.php:385 +msgid "Wednesday" +msgstr "" + +#: lib/object.php:386 +msgid "Thursday" +msgstr "" + +#: lib/object.php:387 +msgid "Friday" +msgstr "" + +#: lib/object.php:388 +msgid "Saturday" +msgstr "" + #: lib/object.php:389 +msgid "Sunday" +msgstr "" + +#: lib/object.php:396 +msgid "events week of month" +msgstr "" + +#: lib/object.php:397 +msgid "first" +msgstr "" + +#: lib/object.php:398 +msgid "second" +msgstr "" + +#: lib/object.php:399 +msgid "third" +msgstr "" + +#: lib/object.php:400 +msgid "fourth" +msgstr "" + +#: lib/object.php:401 +msgid "fifth" +msgstr "" + +#: lib/object.php:402 +msgid "last" +msgstr "" + +#: lib/object.php:424 +msgid "January" +msgstr "" + +#: lib/object.php:425 +msgid "February" +msgstr "" + +#: lib/object.php:426 +msgid "March" +msgstr "" + +#: lib/object.php:427 +msgid "April" +msgstr "" + +#: lib/object.php:428 +msgid "May" +msgstr "" + +#: lib/object.php:429 +msgid "June" +msgstr "" + +#: lib/object.php:430 +msgid "July" +msgstr "" + +#: lib/object.php:431 +msgid "August" +msgstr "" + +#: lib/object.php:432 +msgid "September" +msgstr "" + +#: lib/object.php:433 +msgid "October" +msgstr "" + +#: lib/object.php:434 +msgid "November" +msgstr "" + +#: lib/object.php:435 +msgid "December" +msgstr "" + +#: lib/object.php:441 +msgid "by events date" +msgstr "" + +#: lib/object.php:442 +msgid "by yearday(s)" +msgstr "" + +#: lib/object.php:443 +msgid "by weeknumber(s)" +msgstr "" + +#: lib/object.php:444 +msgid "by day and month" +msgstr "" + +#: lib/object.php:467 msgid "Not an array" msgstr "" -#: templates/calendar.php:8 +#: lib/search.php:32 lib/search.php:34 lib/search.php:37 +msgid "Date" +msgstr "" + +#: lib/search.php:40 +msgid "Cal." +msgstr "" + +#: templates/calendar.php:10 msgid "All day" msgstr "" -#: templates/calendar.php:9 +#: templates/calendar.php:11 msgid "Missing fields" msgstr "" -#: templates/calendar.php:10 templates/part.eventform.php:3 +#: templates/calendar.php:12 templates/part.eventform.php:3 msgid "Title" msgstr "" -#: templates/calendar.php:12 +#: templates/calendar.php:14 msgid "From Date" msgstr "" -#: templates/calendar.php:13 +#: templates/calendar.php:15 msgid "From Time" msgstr "" -#: templates/calendar.php:14 +#: templates/calendar.php:16 msgid "To Date" msgstr "" -#: templates/calendar.php:15 +#: templates/calendar.php:17 msgid "To Time" msgstr "" -#: templates/calendar.php:16 +#: templates/calendar.php:18 msgid "The event ends before it starts" msgstr "" -#: templates/calendar.php:17 +#: templates/calendar.php:19 msgid "There was a database fail" msgstr "" -#: templates/calendar.php:23 +#: templates/calendar.php:37 msgid "Week" msgstr "" -#: templates/calendar.php:24 +#: templates/calendar.php:38 msgid "Month" msgstr "" -#: templates/calendar.php:25 +#: templates/calendar.php:39 msgid "List" msgstr "" -#: templates/calendar.php:30 +#: templates/calendar.php:44 msgid "Today" msgstr "" -#: templates/calendar.php:31 +#: templates/calendar.php:45 msgid "Calendars" msgstr "" -#: templates/calendar.php:48 +#: templates/calendar.php:63 msgid "There was a fail, while parsing the file." msgstr "" @@ -216,7 +360,7 @@ msgid "Edit" msgstr "" #: templates/part.choosecalendar.rowfields.php:4 -#: templates/part.editevent.php:8 +#: templates/part.editevent.php:9 msgid "Delete" msgstr "" @@ -244,7 +388,7 @@ msgstr "" msgid "Save" msgstr "" -#: templates/part.editcalendar.php:42 templates/part.editevent.php:7 +#: templates/part.editcalendar.php:42 templates/part.editevent.php:8 #: templates/part.newevent.php:6 msgid "Submit" msgstr "" @@ -257,7 +401,7 @@ msgstr "" msgid "Edit an event" msgstr "" -#: templates/part.editevent.php:9 +#: templates/part.editevent.php:10 msgid "Export" msgstr "" @@ -273,43 +417,83 @@ msgstr "" msgid "Select category" msgstr "" -#: templates/part.eventform.php:39 +#: templates/part.eventform.php:37 msgid "All Day Event" msgstr "" -#: templates/part.eventform.php:43 +#: templates/part.eventform.php:41 msgid "From" msgstr "" -#: templates/part.eventform.php:51 +#: templates/part.eventform.php:49 msgid "To" msgstr "" -#: templates/part.eventform.php:59 +#: templates/part.eventform.php:57 msgid "Advanced options" msgstr "" -#: templates/part.eventform.php:64 +#: templates/part.eventform.php:61 msgid "Repeat" msgstr "" -#: templates/part.eventform.php:80 -msgid "Attendees" +#: templates/part.eventform.php:68 +msgid "Advanced" msgstr "" -#: templates/part.eventform.php:87 +#: templates/part.eventform.php:112 +msgid "Select weekdays" +msgstr "" + +#: templates/part.eventform.php:125 templates/part.eventform.php:138 +msgid "Select days" +msgstr "" + +#: templates/part.eventform.php:130 +msgid "and the events day of year." +msgstr "" + +#: templates/part.eventform.php:143 +msgid "and the events day of month." +msgstr "" + +#: templates/part.eventform.php:151 +msgid "Select months" +msgstr "" + +#: templates/part.eventform.php:164 +msgid "Select weeks" +msgstr "" + +#: templates/part.eventform.php:169 +msgid "and the events week of year." +msgstr "" + +#: templates/part.eventform.php:175 +msgid "Interval" +msgstr "" + +#: templates/part.eventform.php:181 +msgid "End" +msgstr "" + +#: templates/part.eventform.php:193 +msgid "occurrences" +msgstr "" + +#: templates/part.eventform.php:208 msgid "Location" msgstr "" -#: templates/part.eventform.php:89 +#: templates/part.eventform.php:210 msgid "Location of the Event" msgstr "" -#: templates/part.eventform.php:95 +#: templates/part.eventform.php:216 msgid "Description" msgstr "" -#: templates/part.eventform.php:96 +#: templates/part.eventform.php:218 msgid "Description of the Event" msgstr "" @@ -353,6 +537,10 @@ msgstr "" msgid "Timezone" msgstr "" +#: templates/settings.php:30 +msgid "Check always for changes of the timezone" +msgstr "" + #: templates/settings.php:32 msgid "Timeformat" msgstr "" From 33847dd1018bc21ac5b3b2b646e10c2a549828fc Mon Sep 17 00:00:00 2001 From: Frank Karlitschek Date: Sat, 7 Jan 2012 13:33:53 +0100 Subject: [PATCH 067/106] enable gallery and admin_export by default at least for the alpha and beta. --- apps/admin_export/appinfo/info.xml | 1 + apps/gallery/appinfo/info.xml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/admin_export/appinfo/info.xml b/apps/admin_export/appinfo/info.xml index c4a2a9b398..df8a07c2f5 100644 --- a/apps/admin_export/appinfo/info.xml +++ b/apps/admin_export/appinfo/info.xml @@ -7,4 +7,5 @@ AGPL Thomas Schmidt 2 + diff --git a/apps/gallery/appinfo/info.xml b/apps/gallery/appinfo/info.xml index 054ddb6f13..154b5fcf7a 100644 --- a/apps/gallery/appinfo/info.xml +++ b/apps/gallery/appinfo/info.xml @@ -7,4 +7,5 @@ Bartosz Przybylski 2 - \ No newline at end of file + + From 67a8ae084a6d755d27b8b936bee572c91dd84ac4 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 7 Jan 2012 14:31:47 +0100 Subject: [PATCH 068/106] fix search function --- apps/calendar/templates/calendar.php | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 92c1b8a778..50d3d70347 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -25,6 +25,7 @@ $date = substr($data['startdate'], 0, 10); list($year, $month, $day) = explode('-', $date); echo '$(\'#calendar_holder\').fullCalendar(\'gotoDate\', ' . $year . ', ' . --$month . ', ' . $day . ');'; + echo '$(\'#dialog_holder\').load(OC.filePath(\'calendar\', \'ajax\', \'editeventform.php\') + \'?id=\' + ' . $_['showevent'] . ' , Calendar.UI.startEventDialog);'; } ?> }); From c3cda81577a396960fa69b651f27bad2828e0c30 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sat, 7 Jan 2012 18:30:32 +0100 Subject: [PATCH 069/106] update calendar pot file --- apps/calendar/l10n/xgettextfiles | 3 +- apps/calendar/templates/lAfix.php | 39 +++++++++ l10n/templates/calendar.pot | 128 ++++++++++++++++++++++++------ 3 files changed, 143 insertions(+), 27 deletions(-) create mode 100644 apps/calendar/templates/lAfix.php diff --git a/apps/calendar/l10n/xgettextfiles b/apps/calendar/l10n/xgettextfiles index 27b8e45719..a8c2601045 100644 --- a/apps/calendar/l10n/xgettextfiles +++ b/apps/calendar/l10n/xgettextfiles @@ -8,4 +8,5 @@ ../templates/part.eventform.php ../templates/part.import.php ../templates/part.newevent.php -../templates/settings.php \ No newline at end of file +../templates/settings.php +../templates/lAfix.php \ No newline at end of file diff --git a/apps/calendar/templates/lAfix.php b/apps/calendar/templates/lAfix.php new file mode 100644 index 0000000000..61025ae6de --- /dev/null +++ b/apps/calendar/templates/lAfix.php @@ -0,0 +1,39 @@ +t('Sunday'); +$l->t('Monday'); +$l->t('Tuesday'); +$l->t('Wednesday'); +$l->t('Thursday'); +$l->t('Friday'); +$l->t('Saturday'); +$l->t('Sun.'); +$l->t('Mon.'); +$l->t('Tue.'); +$l->t('Wed.'); +$l->t('Thu.'); +$l->t('Fri.'); +$l->t('Sat.'); +$l->t('January'); +$l->t('February'); +$l->t('March'); +$l->t('April'); +$l->t('May'); +$l->t('June'); +$l->t('July'); +$l->t('August'); +$l->t('September'); +$l->t('October'); +$l->t('November'); +$l->t('December'); +$l->t('Jan.'); +$l->t('Feb.'); +$l->t('Mar.'); +$l->t('Apr.'); +$l->t('May.'); +$l->t('Jun.'); +$l->t('Jul.'); +$l->t('Aug.'); +$l->t('Sep.'); +$l->t('Oct.'); +$l->t('Nov.'); +$l->t('Dec.'); \ No newline at end of file diff --git a/l10n/templates/calendar.pot b/l10n/templates/calendar.pot index ce255816ed..7941082926 100644 --- a/l10n/templates/calendar.pot +++ b/l10n/templates/calendar.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2012-01-06 21:55+0100\n" +"POT-Creation-Date: 2012-01-07 18:29+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -146,31 +146,31 @@ msgstr "" msgid "by weekday" msgstr "" -#: lib/object.php:383 +#: lib/object.php:383 templates/lAfix.php:3 msgid "Monday" msgstr "" -#: lib/object.php:384 +#: lib/object.php:384 templates/lAfix.php:4 msgid "Tuesday" msgstr "" -#: lib/object.php:385 +#: lib/object.php:385 templates/lAfix.php:5 msgid "Wednesday" msgstr "" -#: lib/object.php:386 +#: lib/object.php:386 templates/lAfix.php:6 msgid "Thursday" msgstr "" -#: lib/object.php:387 +#: lib/object.php:387 templates/lAfix.php:7 msgid "Friday" msgstr "" -#: lib/object.php:388 +#: lib/object.php:388 templates/lAfix.php:8 msgid "Saturday" msgstr "" -#: lib/object.php:389 +#: lib/object.php:389 templates/lAfix.php:2 msgid "Sunday" msgstr "" @@ -202,51 +202,51 @@ msgstr "" msgid "last" msgstr "" -#: lib/object.php:424 +#: lib/object.php:424 templates/lAfix.php:16 msgid "January" msgstr "" -#: lib/object.php:425 +#: lib/object.php:425 templates/lAfix.php:17 msgid "February" msgstr "" -#: lib/object.php:426 +#: lib/object.php:426 templates/lAfix.php:18 msgid "March" msgstr "" -#: lib/object.php:427 +#: lib/object.php:427 templates/lAfix.php:19 msgid "April" msgstr "" -#: lib/object.php:428 +#: lib/object.php:428 templates/lAfix.php:20 msgid "May" msgstr "" -#: lib/object.php:429 +#: lib/object.php:429 templates/lAfix.php:21 msgid "June" msgstr "" -#: lib/object.php:430 +#: lib/object.php:430 templates/lAfix.php:22 msgid "July" msgstr "" -#: lib/object.php:431 +#: lib/object.php:431 templates/lAfix.php:23 msgid "August" msgstr "" -#: lib/object.php:432 +#: lib/object.php:432 templates/lAfix.php:24 msgid "September" msgstr "" -#: lib/object.php:433 +#: lib/object.php:433 templates/lAfix.php:25 msgid "October" msgstr "" -#: lib/object.php:434 +#: lib/object.php:434 templates/lAfix.php:26 msgid "November" msgstr "" -#: lib/object.php:435 +#: lib/object.php:435 templates/lAfix.php:27 msgid "December" msgstr "" @@ -314,30 +314,106 @@ msgstr "" msgid "There was a database fail" msgstr "" -#: templates/calendar.php:37 +#: templates/calendar.php:38 msgid "Week" msgstr "" -#: templates/calendar.php:38 +#: templates/calendar.php:39 msgid "Month" msgstr "" -#: templates/calendar.php:39 +#: templates/calendar.php:40 msgid "List" msgstr "" -#: templates/calendar.php:44 +#: templates/calendar.php:45 msgid "Today" msgstr "" -#: templates/calendar.php:45 +#: templates/calendar.php:46 msgid "Calendars" msgstr "" -#: templates/calendar.php:63 +#: templates/calendar.php:64 msgid "There was a fail, while parsing the file." msgstr "" +#: templates/lAfix.php:9 +msgid "Sun." +msgstr "" + +#: templates/lAfix.php:10 +msgid "Mon." +msgstr "" + +#: templates/lAfix.php:11 +msgid "Tue." +msgstr "" + +#: templates/lAfix.php:12 +msgid "Wed." +msgstr "" + +#: templates/lAfix.php:13 +msgid "Thu." +msgstr "" + +#: templates/lAfix.php:14 +msgid "Fri." +msgstr "" + +#: templates/lAfix.php:15 +msgid "Sat." +msgstr "" + +#: templates/lAfix.php:28 +msgid "Jan." +msgstr "" + +#: templates/lAfix.php:29 +msgid "Feb." +msgstr "" + +#: templates/lAfix.php:30 +msgid "Mar." +msgstr "" + +#: templates/lAfix.php:31 +msgid "Apr." +msgstr "" + +#: templates/lAfix.php:32 +msgid "May." +msgstr "" + +#: templates/lAfix.php:33 +msgid "Jun." +msgstr "" + +#: templates/lAfix.php:34 +msgid "Jul." +msgstr "" + +#: templates/lAfix.php:35 +msgid "Aug." +msgstr "" + +#: templates/lAfix.php:36 +msgid "Sep." +msgstr "" + +#: templates/lAfix.php:37 +msgid "Oct." +msgstr "" + +#: templates/lAfix.php:38 +msgid "Nov." +msgstr "" + +#: templates/lAfix.php:39 +msgid "Dec." +msgstr "" + #: templates/part.choosecalendar.php:1 msgid "Choose active calendars" msgstr "" From 9ed3c31fc99fbd33576363a79d51f5be66dc2969 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sun, 8 Jan 2012 00:14:34 +0100 Subject: [PATCH 070/106] automatic adding of photo to album, feedback for user while scanning, general cleanup --- apps/gallery/ajax/galleryOp.php | 4 +- apps/gallery/ajax/scanForAlbums.php | 2 +- apps/gallery/appinfo/app.php | 3 ++ apps/gallery/appinfo/database.xml | 6 +++ apps/gallery/css/styles.css | 69 +++++------------------------ apps/gallery/js/album_cover.js | 4 ++ apps/gallery/lib/album.php | 17 ++++--- apps/gallery/lib/hooks_handlers.php | 36 +++++++++++++++ apps/gallery/lib/photo.php | 2 + apps/gallery/lib/scanner.php | 6 +-- apps/gallery/templates/index.php | 5 ++- 11 files changed, 82 insertions(+), 72 deletions(-) create mode 100644 apps/gallery/lib/hooks_handlers.php diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php index cd7cab202b..8a006dda63 100644 --- a/apps/gallery/ajax/galleryOp.php +++ b/apps/gallery/ajax/galleryOp.php @@ -1,6 +1,6 @@ "Unknown operation")); } } -?> \ No newline at end of file +?> diff --git a/apps/gallery/ajax/scanForAlbums.php b/apps/gallery/ajax/scanForAlbums.php index f603cbb497..b1f0a433a4 100644 --- a/apps/gallery/ajax/scanForAlbums.php +++ b/apps/gallery/ajax/scanForAlbums.php @@ -5,6 +5,6 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); OC_Gallery_Scanner::cleanUp(); -OC_JSON::success(array('albums' => OC_Gallery_Scanner::scan(''))); +OC_JSON::success(array('albums' => OC_Gallery_Scanner::scan('/'))); ?> diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php index 2b1ab857af..3a2dbcb43a 100644 --- a/apps/gallery/appinfo/app.php +++ b/apps/gallery/appinfo/app.php @@ -2,6 +2,7 @@ OC::$CLASSPATH['OC_Gallery_Album'] = 'apps/gallery/lib/album.php'; OC::$CLASSPATH['OC_Gallery_Photo'] = 'apps/gallery/lib/photo.php'; OC::$CLASSPATH['OC_Gallery_Scanner'] = 'apps/gallery/lib/scanner.php'; +OC::$CLASSPATH['OC_Gallery_Hooks_Handlers'] = 'apps/gallery/lib/hooks_handlers.php'; OC_App::register(array( 'order' => 20, @@ -28,4 +29,6 @@ OC_App::addNavigationEntry( array( } new OC_GallerySearchProvider(); + +require_once('apps/gallery/lib/hooks_handlers.php'); ?> diff --git a/apps/gallery/appinfo/database.xml b/apps/gallery/appinfo/database.xml index fd55b3a6fb..db88e4c1b5 100644 --- a/apps/gallery/appinfo/database.xml +++ b/apps/gallery/appinfo/database.xml @@ -27,6 +27,12 @@ true 100 + + album_path + text + true + 100 + diff --git a/apps/gallery/css/styles.css b/apps/gallery/css/styles.css index 53c3c0901d..cc343ba0d0 100644 --- a/apps/gallery/css/styles.css +++ b/apps/gallery/css/styles.css @@ -1,60 +1,11 @@ -div#gallery_list { - margin: 90pt 20pt; -} -div#gallery_list.leftcontent { - padding-top: 15px; - margin: 0; - text-align: center; -} +div#gallery_list { margin: 90pt 20pt; } +div#gallery_list.leftcontent { padding-top: 15px; margin: 0; text-align: center; } +div#gallery_album_box { width: 200px; text-align: center; border: 0; display: inline-block; margin: 5pt; vertical-align: top; padding: 10px; border: solid 1px black; position: relative; overflow: hidden; color: #999; } +div#gallery_album_box:hover { color: black; } +.leftcontent div#gallery_album_box { margin: 5px; } +div#gallery_album_box h1 { font-size: 12pt; font-family: Verdana; } +div#gallery_album_cover { width: 199px; height: 199px; border: solid 1pt #999; padding: 0; } +div#gallery_control_overlay { border: 0; position:absolute; right: 10pt; background-color: #333; opacity: 0.5; visibility:hidden; padding: 0 5pt; } +div#gallery_control_overlay a { color:white; } +#gallery_images { padding:10px 5px; } -div#gallery_album_box { - width: 200px; - text-align: center; - border: 0; - display: inline-block; - margin: 5pt; - vertical-align: top; - padding: 10px; - border: solid 1px black; - position: relative; - overflow: hidden; - color: #999; -} - -div#gallery_album_box:hover { - color: black; -} - -.leftcontent div#gallery_album_box { - margin: 5px; -} - -div#gallery_album_box h1 { - font-size: 12pt; - font-family: Verdana; -} - -div#gallery_album_cover { - width: 199px; - height: 199px; - border: solid 1pt #999; - padding: 0; -} - -div#gallery_control_overlay { - border: 0; - position:absolute; - right: 10pt; - background-color: #333; - opacity: 0.5; - visibility:hidden; - padding: 0 5pt; -} - -div#gallery_control_overlay a { - color:white; -} - -#gallery_images { -padding:10px 5px; -} diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index 619aa391c5..f6cb2da310 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -31,7 +31,11 @@ function createNewAlbum() { } function scanForAlbums() { + $("#notification").fadeIn(); + $("#notification").slideDown(); $.getJSON('ajax/scanForAlbums.php', function(r) { + $("#notification").fadeOut(); + $("#notification").slideUp(); if (r.status == 'success') { window.location.reload(true); } else { diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php index 0999429c5d..98876b891c 100644 --- a/apps/gallery/lib/album.php +++ b/apps/gallery/lib/album.php @@ -1,9 +1,9 @@ execute(array($owner, $name)); + public static function create($owner, $name, $path){ + $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path) VALUES (?, ?, ?)'); + $stmt->execute(array($owner, $name, $path)); } public static function rename($oldname, $newname, $owner) { @@ -22,14 +22,21 @@ class OC_Gallery_Album { return $stmt->execute($args); } - public static function find($owner, $name=null){ + public static function find($owner, $name=null, $path=null){ $sql = 'SELECT * FROM *PREFIX*gallery_albums WHERE uid_owner = ?'; $args = array($owner); if (!is_null($name)){ $sql .= ' AND album_name = ?'; $args[] = $name; - } + } + if (!is_null($path)){ + $sql .= ' AND album_path = ?'; + $args[] = $path; + } $stmt = OC_DB::prepare($sql); return $stmt->execute($args); } + } + +?> diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php new file mode 100644 index 0000000000..5d1e7502aa --- /dev/null +++ b/apps/gallery/lib/hooks_handlers.php @@ -0,0 +1,36 @@ +numRows() == 0) { + $new_album_name = trim(str_replace('/', '.', $fullpath)); + if ($new_album_name == '.') $new_album_name = 'main'; + OC_Gallery_Album::create(OC_User::getUser(), $new_album_name, $path); + $album = OC_Gallery_Album::find(OC_User::getUser(), null, $path); + } + $album = $album->fetchRow(); + $albumId = $album['album_id']; + OC_Gallery_Photo::create($albumId, $fullpath); + + } +} + +?> diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index 97d159935f..a89a56981f 100644 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -25,4 +25,6 @@ class OC_Gallery_Photo{ .' AND photos.album_id = albums.album_id'); return $stmt->execute(array($owner, $album_name)); } + } + diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index 59c34b8e69..f754f91300 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -21,13 +21,13 @@ class OC_Gallery_Scanner { public static function scanDir($path, &$albums) { $current_album = array('name'=> $path, 'imagesCount' => 0, 'images' => array()); $current_album['name'] = str_replace('/', '.', str_replace(OC::$CONFIG_DATADIRECTORY, '', $current_album['name'])); - $current_album['name'] = ($current_album['name']==='') ? + $current_album['name'] = ($current_album['name']==='.') ? 'main' : trim($current_album['name'],'.'); if ($dh = OC_Filesystem::opendir($path)) { while (($filename = readdir($dh)) !== false) { - $filepath = $path.'/'.$filename; + $filepath = ($path[strlen($path)-1]=='/'?$path:$path.'/').$filename; if (substr($filename, 0, 1) == '.') continue; if (OC_Filesystem::is_dir($filepath)) { self::scanDir($filepath, $albums); @@ -41,7 +41,7 @@ class OC_Gallery_Scanner { $result = OC_Gallery_Album::find(OC_User::getUser(), $current_album['name']); if ($result->numRows() == 0 && count($current_album['images'])) { - OC_Gallery_Album::create(OC_User::getUser(), $current_album['name']); + OC_Gallery_Album::create(OC_User::getUser(), $current_album['name'], $path); $result = OC_Gallery_Album::find(OC_User::getUser(), $current_album['name']); } $albumId = $result->fetchRow(); diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php index 0e89e44876..7c6e91a468 100644 --- a/apps/gallery/templates/index.php +++ b/apps/gallery/templates/index.php @@ -4,9 +4,10 @@ OC_Util::addScript('gallery', 'albums'); OC_Util::addScript('gallery', 'album_cover'); ?> +
      - -
      + +
      From e51957b4ded8f538180e55581f4c757d2688aaa5 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sun, 8 Jan 2012 00:22:28 +0100 Subject: [PATCH 071/106] gallery version bump to force db update --- apps/gallery/appinfo/info.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/gallery/appinfo/info.xml b/apps/gallery/appinfo/info.xml index 154b5fcf7a..ba51bf0bd5 100644 --- a/apps/gallery/appinfo/info.xml +++ b/apps/gallery/appinfo/info.xml @@ -2,9 +2,9 @@ gallery Gallery - 0.1 + 0.2 AGPL - Bartosz Przybylski + Bartek Przybylski 2 From 6b95d7427a7d29dd60bc8f464a04b2a004de9eaf Mon Sep 17 00:00:00 2001 From: Cloud Dumper Date: Fri, 6 Jan 2012 11:01:32 +0100 Subject: [PATCH 072/106] Sort results from music collection getters. Albums and artists are now ordered by name, song by track number and name. --- apps/media/lib_collection.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/media/lib_collection.php b/apps/media/lib_collection.php index caa3ac3f47..1240f1de2f 100644 --- a/apps/media/lib_collection.php +++ b/apps/media/lib_collection.php @@ -127,7 +127,7 @@ class OC_MEDIA_COLLECTION{ $search='%'; } $query=OC_DB::prepare("SELECT DISTINCT *PREFIX*media_artists.artist_name AS artist_name , *PREFIX*media_artists.artist_id AS artist_id FROM *PREFIX*media_artists - INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=?"); + INNER JOIN *PREFIX*media_songs ON *PREFIX*media_artists.artist_id=*PREFIX*media_songs.song_artist WHERE artist_name LIKE ? AND *PREFIX*media_songs.song_user=? ORDER BY artist_name"); return $query->execute(array($search,self::$uid))->fetchAll(); } @@ -160,7 +160,7 @@ class OC_MEDIA_COLLECTION{ */ static public function getAlbums($artist=0,$search='%',$exact=false){ $cmd="SELECT DISTINCT *PREFIX*media_albums.album_name AS album_name , *PREFIX*media_albums.album_artist AS album_artist , *PREFIX*media_albums.album_id AS album_id - FROM *PREFIX*media_albums INNER JOIN *PREFIX*media_songs ON *PREFIX*media_albums.album_id=*PREFIX*media_songs.song_album WHERE *PREFIX*media_songs.song_user=? "; + FROM *PREFIX*media_albums INNER JOIN *PREFIX*media_songs ON *PREFIX*media_albums.album_id=*PREFIX*media_songs.song_album WHERE *PREFIX*media_songs.song_user=? ORDER BY album_name"; $params=array(self::$uid); if($artist!=0){ $cmd.="AND *PREFIX*media_albums.album_artist = ? "; @@ -233,7 +233,7 @@ class OC_MEDIA_COLLECTION{ }else{ $searchString=''; } - $query=OC_DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_user=? $artistString $albumString $searchString"); + $query=OC_DB::prepare("SELECT * FROM *PREFIX*media_songs WHERE song_user=? $artistString $albumString $searchString ORDER BY song_track, song_name"); return $query->execute($params)->fetchAll(); } @@ -378,4 +378,4 @@ class OC_MEDIA_COLLECTION{ } } -?> \ No newline at end of file +?> From 5b57cd310e08b00c7bfc3821a3c2d6d8b48405b5 Mon Sep 17 00:00:00 2001 From: Cloud Dumper Date: Fri, 6 Jan 2012 11:29:15 +0100 Subject: [PATCH 073/106] Also use track_number to retrieve song track. This adds support for id3v2 tags such as TRACK/TOTAL. --- apps/media/lib_scanner.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php index c2bea2d836..320b1f7919 100644 --- a/apps/media/lib_scanner.php +++ b/apps/media/lib_scanner.php @@ -120,7 +120,20 @@ class OC_MEDIA_SCANNER{ $title=stripslashes($data['comments']['title'][0]); } $size=$data['filesize']; - $track=(isset($data['comments']['track']))?$data['comments']['track'][0]:0; + if (isset($data['comments']['track'])) + { + $track = $data['comments']['track'][0]; + } + else if (isset($data['comments']['track_number'])) + { + $track = $data['comments']['track_number'][0]; + $track = explode('/',$track); + $track = $track[0]; + } + else + { + $track = 0; + } $length=isset($data['playtime_seconds'])?round($data['playtime_seconds']):0; } if(!isset(self::$artists[$artist])){ From 2de3b4bd1738cfce48d7c003316e13e988819898 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sun, 8 Jan 2012 01:32:11 +0100 Subject: [PATCH 074/106] rename and delete hooks --- apps/gallery/lib/hooks_handlers.php | 65 ++++++++++++++++++++++++++--- apps/gallery/lib/photo.php | 15 ++++++- 2 files changed, 74 insertions(+), 6 deletions(-) diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 5d1e7502aa..1bddaf363e 100644 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -1,6 +1,8 @@ numRows() == 0) { - $new_album_name = trim(str_replace('/', '.', $fullpath)); - if ($new_album_name == '.') $new_album_name = 'main'; - OC_Gallery_Album::create(OC_User::getUser(), $new_album_name, $path); - $album = OC_Gallery_Album::find(OC_User::getUser(), null, $path); + $album = self::createAlbum($path); } $album = $album->fetchRow(); $albumId = $album['album_id']; - OC_Gallery_Photo::create($albumId, $fullpath); + $photo = OC_Gallery_Photo::find($albumId, $fullpath); + if ($photo->numRows() == 0) { // don't duplicate photo entries + OC_Log::write(self::$APP_TAG, 'Adding new photo to album', OC_Log::DEBUG); + OC_Gallery_Photo::create($albumId, $fullpath); + } } + + public static function removePhoto($params) { + $path = $params['path']; + if (!self::isPhoto($path)) return; + OC_Gallery_Photo::removeByPath($path); + } + + public static function renamePhoto($params) { + $olddir = substr($params['oldpath'], 0, strrpos($params['oldpath'], '/')); + $newdir = substr($params['newpath'], 0, strrpos($params['newpath'], '/')); + if (!self::isPhoto($params['newpath'])) return; + $album; + $newAlbumId; + $oldAlbumId; + if ($olddir == $newdir) { + // album changing is not needed + $album = OC_Gallery_Album::find(OC_User::getUser(), null, $olddir); + if ($album->numRows() == 0) { + $album = self::createAlbum($newdir); + } + $album = $album->fetchRow(); + $newAlbumId = $oldAlbumId = $album['album_id']; + } else { + $newalbum = OC_Gallery_Album::find(OC_User::getUser(), null, $newdir); + $oldalbum = OC_Gallery_Album::find(OC_User::getUser(), null, $olddir); + + if ($newalbum->numRows() == 0) { + $newalbum = self::createAlbum($newdir); + } + $newalbum = $newalbum->fetchRow(); + if ($oldalbum->numRows() == 0) { + OC_Gallery_Photo::create($newalbum['album_id'], $params['newpath']); + return; + } + $oldalbum = $oldalbum->fetchRow(); + $newAlbumId = $newalbum['album_id']; + $oldAlbumId = $oldalbum['album_id']; + + } + OC_Gallery_Photo::changePath($oldAlbumId, $newAlbumId, $params['oldpath'], $params['newpath']); + } } ?> diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index a89a56981f..f8a640819a 100644 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -8,7 +8,6 @@ class OC_Gallery_Photo{ public static function find($albumId, $img=null){ $sql = 'SELECT * FROM *PREFIX*gallery_photos WHERE album_id = ?'; $args = array($albumId); - $args = array($albumId); if (!is_null($img)){ $sql .= ' AND file_path = ?'; $args[] = $img; @@ -26,5 +25,19 @@ class OC_Gallery_Photo{ return $stmt->execute(array($owner, $album_name)); } + public static function removeByPath($path) { + $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE file_path = ?'); + $stmt->execute(array($path)); + } + + public static function removeById($id) { + $stmt = OC_DB::prepare('DELETE FROM *PREFIX*gallery_photos WHERE photo_id = ?'); + $stmt->execute(array($id)); + } + + public static function changePath($oldAlbumId, $newAlbumId, $oldpath, $newpath) { + $stmt = OC_DB::prepare("UPDATE *PREFIX*gallery_photos SET file_path = ?, album_id = ? WHERE album_id = ? and file_path = ?"); + $stmt->execute(array($newpath, $newAlbumId, $oldAlbumId, $oldpath)); + } } From 6c09d9e0f8a22c77ff6ebf83e4e44de3aeb6be3e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sat, 12 Nov 2011 18:06:07 +0100 Subject: [PATCH 075/106] some fixes in the sqlite3 driver --- lib/MDB2/Driver/Manager/sqlite3.php | 2 +- lib/MDB2/Driver/Reverse/sqlite3.php | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php index c5c19a90fb..7e30755fc3 100644 --- a/lib/MDB2/Driver/Manager/sqlite3.php +++ b/lib/MDB2/Driver/Manager/sqlite3.php @@ -798,7 +798,7 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common return $db; } - $query = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL ORDER BY name"; + $query = "SELECT name FROM sqlite_master WHERE type='table' AND sql NOT NULL AND name!='sqlite_sequence' ORDER BY name"; $table_names = $db->queryCol($query); if (PEAR::isError($table_names)) { return $table_names; diff --git a/lib/MDB2/Driver/Reverse/sqlite3.php b/lib/MDB2/Driver/Reverse/sqlite3.php index d5595da84c..33e5b59026 100644 --- a/lib/MDB2/Driver/Reverse/sqlite3.php +++ b/lib/MDB2/Driver/Reverse/sqlite3.php @@ -69,7 +69,7 @@ class MDB2_Driver_Reverse_sqlite3 extends MDB2_Driver_Reverse_Common return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'unexpected empty table column definition list', __FUNCTION__); } - $regexp = '/^\s*([^\s]+) +(CHAR|VARCHAR|VARCHAR2|TEXT|BOOLEAN|SMALLINT|INT|INTEGER|DECIMAL|BIGINT|DOUBLE|FLOAT|DATETIME|DATE|TIME|LONGTEXT|LONGBLOB)( ?\(([1-9][0-9]*)(:([1-9][0-9]*))?\))?( NULL| NOT NULL)?( UNSIGNED)?( NULL| NOT NULL)?( PRIMARY KEY)?( DEFAULT (\'[^\']*\'|[^ ]+))?( NULL| NOT NULL)?( PRIMARY KEY)?(\s*\-\-.*)?$/i'; + $regexp = '/^\s*([^\s]+) +(CHAR|VARCHAR|VARCHAR2|TEXT|BOOLEAN|SMALLINT|INT|INTEGER|DECIMAL|BIGINT|DOUBLE|FLOAT|DATETIME|DATE|TIME|LONGTEXT|LONGBLOB)( ?\(([1-9][0-9]*)(:([1-9][0-9]*))?\))?( NULL| NOT NULL)?( UNSIGNED)?( NULL| NOT NULL)?( PRIMARY KEY)?( AUTOINCREMENT)?( DEFAULT (\'[^\']*\'|[^ ]+))?( NULL| NOT NULL)?( PRIMARY KEY)?(\s*\-\-.*)?$/i'; $regexp2 = '/^\s*([^ ]+) +(PRIMARY|UNIQUE|CHECK)$/i'; for ($i=0, $j=0; $i<$count; ++$i) { if (!preg_match($regexp, trim($column_sql[$i]), $matches)) { @@ -90,11 +90,16 @@ class MDB2_Driver_Reverse_sqlite3 extends MDB2_Driver_Reverse_Common if (isset($matches[8]) && strlen($matches[8])) { $columns[$j]['unsigned'] = true; } - if (isset($matches[9]) && strlen($matches[9])) { + if (isset($matches[10]) && strlen($matches[10])) { $columns[$j]['autoincrement'] = true; + $columns[$j]['notnull']=true; } - if (isset($matches[12]) && strlen($matches[12])) { - $default = $matches[12]; + if (isset($matches[10]) && strlen($matches[10])) { + $columns[$j]['autoincrement'] = true; + $columns[$j]['notnull']=true; + } + if (isset($matches[13]) && strlen($matches[13])) { + $default = $matches[13]; if (strlen($default) && $default[0]=="'") { $default = str_replace("''", "'", substr($default, 1, strlen($default)-2)); } @@ -107,8 +112,8 @@ class MDB2_Driver_Reverse_sqlite3 extends MDB2_Driver_Reverse_Common $columns[$j]['notnull'] = ($matches[7] === ' NOT NULL'); } else if (isset($matches[9]) && strlen($matches[9])) { $columns[$j]['notnull'] = ($matches[9] === ' NOT NULL'); - } else if (isset($matches[13]) && strlen($matches[13])) { - $columns[$j]['notnull'] = ($matches[13] === ' NOT NULL'); + } else if (isset($matches[14]) && strlen($matches[14])) { + $columns[$j]['notnull'] = ($matches[14] === ' NOT NULL'); } ++$j; } From 91a9688d0742b5c1af7d0b52da7a57e49e1e3e45 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 13 Nov 2011 16:06:29 +0100 Subject: [PATCH 076/106] minor changes to mysql setup --- lib/setup.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index b53c626c9a..d454c17599 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -160,8 +160,8 @@ class OC_Setup { //add prefix to the postgresql user name to prevent collissions $dbusername='oc_'.$username; - //hash the password so we don't need to store the admin config in the config file - $dbpassword=md5(time().$password); + //create a new password so we don't need to store the admin config in the config file + $dbpassword=md5(time()); self::pg_createDBUser($dbusername, $dbpassword, $connection); @@ -221,7 +221,7 @@ class OC_Setup { } public static function createDatabase($name,$user,$connection) { - //we cant user OC_BD functions here because we need to connect as the administrative user. + //we cant use OC_BD functions here because we need to connect as the administrative user. $query = "CREATE DATABASE IF NOT EXISTS `$name`"; $result = mysql_query($query, $connection); if(!$result) { @@ -243,7 +243,7 @@ class OC_Setup { } public static function pg_createDatabase($name,$user,$connection) { - //we cant user OC_BD functions here because we need to connect as the administrative user. + //we cant use OC_BD functions here because we need to connect as the administrative user. $query = "CREATE DATABASE $name OWNER $user"; $result = pg_query($connection, $query); if(!$result) { From 9a4e37483b9c6d7c6e287a9c95a408fc0249e8f9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 13 Nov 2011 16:08:47 +0100 Subject: [PATCH 077/106] small fix in sqlite3 driver --- lib/MDB2/Driver/Manager/sqlite3.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php index 7e30755fc3..71b9597d20 100644 --- a/lib/MDB2/Driver/Manager/sqlite3.php +++ b/lib/MDB2/Driver/Manager/sqlite3.php @@ -168,9 +168,6 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common if (PEAR::isError($query_fields)) { return $query_fields; } - if (!empty($options['primary'])) { - $query_fields.= ', PRIMARY KEY ('.implode(', ', array_keys($options['primary'])).')'; - } if (!empty($options['foreign_keys'])) { foreach ($options['foreign_keys'] as $fkname => $fkdef) { if (empty($fkdef)) { From ecf6f2ca2f74abbfdc72788c502ef5a015dc890a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 13 Nov 2011 16:16:21 +0100 Subject: [PATCH 078/106] automatically upgrade the main database on version number increase (doesnt work with sqlite for now) --- lib/base.php | 10 ++++++++-- lib/db.php | 9 ++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib/base.php b/lib/base.php index 0954e3615b..803c0118e2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -152,6 +152,12 @@ class OC{ } } + $installedVersion=OC_Config::getValue('version','0.0.0'); + $currentVersion=implode('.',OC_Util::getVersion()); + if (version_compare($currentVersion, $installedVersion, '>')) { + OC_DB::updateDbFromStructure('../db_structure.xml'); + } + ini_set('session.cookie_httponly','1;'); session_start(); @@ -230,8 +236,6 @@ if( !isset( $RUNTIME_NOAPPS )){ $RUNTIME_NOAPPS = false; } -OC::init(); - if(!function_exists('get_temp_dir')) { function get_temp_dir() { if( $temp=ini_get('upload_tmp_dir') ) return $temp; @@ -247,6 +251,8 @@ if(!function_exists('get_temp_dir')) { } } +OC::init(); + require_once('fakedirstream.php'); diff --git a/lib/db.php b/lib/db.php index c7085a975e..05ed8398b7 100644 --- a/lib/db.php +++ b/lib/db.php @@ -338,7 +338,6 @@ class OC_DB { * @param $file file to read structure from */ public static function updateDbFromStructure($file){ - $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" ); $CONFIG_DBTABLEPREFIX = OC_Config::getValue( "dbtableprefix", "oc_" ); $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); @@ -347,17 +346,17 @@ class OC_DB { // read file $content = file_get_contents( $file ); + $previousSchema = self::$schema->getDefinitionFromDatabase(); + // Make changes and save them to a temporary file $file2 = tempnam( get_temp_dir(), 'oc_db_scheme_' ); - $content = str_replace( '*dbname*', $CONFIG_DBNAME, $content ); + $content = str_replace( '*dbname*', $previousSchema['name'], $content ); $content = str_replace( '*dbprefix*', $CONFIG_DBTABLEPREFIX, $content ); if( $CONFIG_DBTYPE == 'pgsql' ){ //mysql support it too but sqlite doesn't $content = str_replace( '0000-00-00 00:00:00', 'CURRENT_TIMESTAMP', $content ); } file_put_contents( $file2, $content ); - $previousSchema = self::$schema->getDefinitionFromDatabase(); - $op = $schema->updateDatabase($file2, $previousSchema, array(), false); - + $op = self::$schema->updateDatabase($file2, $previousSchema, array(), false); if (PEAR::isError($op)) { $error = $op->getMessage(); OC_Log::write('core','Failed to update database structure ('.$error.')',OC_Log::FATAL); From 09a53170a309677b344b25d9820ef038a0e87929 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 15 Nov 2011 15:58:12 +0100 Subject: [PATCH 079/106] fixes in the sqlite manager driver --- lib/MDB2/Driver/Manager/sqlite3.php | 72 ++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php index 71b9597d20..a6fde69d6c 100644 --- a/lib/MDB2/Driver/Manager/sqlite3.php +++ b/lib/MDB2/Driver/Manager/sqlite3.php @@ -531,9 +531,26 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common return MDB2_OK; } + if (empty($changes['remove']) and empty($changes['rename']) and empty($changes['change']) ){//if only rename or add changes are required, we can use ALTER TABLE + $query = ''; + if (!empty($changes['name'])) { + $change_name = $db->quoteIdentifier($changes['name'], true); + $query = 'RENAME TO ' . $change_name; + $db->exec("ALTER TABLE $name $query"); + } + + if (!empty($changes['add']) && is_array($changes['add'])) { + foreach ($changes['add'] as $field_name => $field) { + $query= 'ADD ' . $db->getDeclaration($field['type'], $field_name, $field); + $db->exec("ALTER TABLE $name $query"); + } + } + return MDB2_OK; + } + $db->loadModule('Reverse', null, true); - // actually sqlite 2.x supports no ALTER TABLE at all .. so we emulate it + // for other operations we need to emulate them with sqlite3 $fields = $db->manager->listTableFields($name); if (PEAR::isError($fields)) { return $fields; @@ -633,16 +650,10 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common } } + //rename the old table so we can create the new one + $db->exec("ALTER TABLE $name RENAME TO __$name"); $data = null; - if (!empty($select_fields)) { - $query = 'SELECT '.implode(', ', $select_fields).' FROM '.$db->quoteIdentifier($name, true); - $data = $db->queryAll($query, null, MDB2_FETCHMODE_ORDERED); - } - $result = $this->dropTable($name); - if (PEAR::isError($result)) { - return $result; - } $result = $this->createTable($name_new, $fields, $options); if (PEAR::isError($result)) { @@ -657,20 +668,35 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common $this->createConstraint($name_new, $constraint, $definition); } - if (!empty($select_fields) && !empty($data)) { - $query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true); - $query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')'; - $query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')'; - $stmt =$db->prepare($query, null, MDB2_PREPARE_MANIP); - if (PEAR::isError($stmt)) { - return $stmt; - } - foreach ($data as $row) { - $result = $stmt->execute($row); - if (PEAR::isError($result)) { - return $result; - } - } + //fill the new table with data from the old one + if (!empty($select_fields)) { + $query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true); + $query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')'; + $query .= ' SELECT '.implode(', ', $select_fields).' FROM '.$db->quoteIdentifier('__'.$name, true); + $db->exec($query); + } + +// if (!empty($select_fields) && !empty($data)) { +// $query = 'INSERT INTO '.$db->quoteIdentifier($name_new, true); +// $query.= '('.implode(', ', array_slice(array_keys($fields), 0, count($select_fields))).')'; +// $query.=' VALUES (?'.str_repeat(', ?', (count($select_fields) - 1)).')'; +// $stmt =$db->prepare($query, null, MDB2_PREPARE_MANIP); +// if (PEAR::isError($stmt)) { +// return $stmt; +// } +// foreach ($data as $row) { +// $result = $stmt->execute($row); +// if (PEAR::isError($result)) { +// return $result; +// } +// } +// } + echo "changes $name"; + + //remove the old table + $result = $this->dropTable('__'.$name); + if (PEAR::isError($result)) { + return $result; } return MDB2_OK; } From c6aa0f9854a2e598c6bb2cd2d0b6ffce7a9c6e64 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 15 Nov 2011 15:59:01 +0100 Subject: [PATCH 080/106] set the installed version after updating the database --- lib/base.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/base.php b/lib/base.php index 803c0118e2..7b42d56f52 100644 --- a/lib/base.php +++ b/lib/base.php @@ -156,6 +156,7 @@ class OC{ $currentVersion=implode('.',OC_Util::getVersion()); if (version_compare($currentVersion, $installedVersion, '>')) { OC_DB::updateDbFromStructure('../db_structure.xml'); + OC_Config::setValue('version',implode('.',OC_Util::getVersion())); } ini_set('session.cookie_httponly','1;'); From 001d06f2ff4a641ff76b4d67a3a33cbdbf5b2bb5 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 15 Nov 2011 16:08:08 +0100 Subject: [PATCH 081/106] fix errors during database migration --- lib/MDB2/Driver/Manager/sqlite3.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/MDB2/Driver/Manager/sqlite3.php b/lib/MDB2/Driver/Manager/sqlite3.php index a6fde69d6c..8f4e1312eb 100644 --- a/lib/MDB2/Driver/Manager/sqlite3.php +++ b/lib/MDB2/Driver/Manager/sqlite3.php @@ -660,13 +660,15 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common return $result; } - foreach ($indexes as $index => $definition) { - $this->createIndex($name_new, $index, $definition); - } + //these seem to only give errors - foreach ($constraints as $constraint => $definition) { - $this->createConstraint($name_new, $constraint, $definition); - } +// foreach ($indexes as $index => $definition) { +// $this->createIndex($name_new, $index, $definition); +// } + +// foreach ($constraints as $constraint => $definition) { +// $this->createConstraint($name_new, $constraint, $definition); +// } //fill the new table with data from the old one if (!empty($select_fields)) { @@ -691,7 +693,6 @@ class MDB2_Driver_Manager_sqlite3 extends MDB2_Driver_Manager_Common // } // } // } - echo "changes $name"; //remove the old table $result = $this->dropTable('__'.$name); From fea68e08b4f0aa52ebd051e4428ff5abd8284f5c Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 11 Dec 2011 22:08:01 +0100 Subject: [PATCH 082/106] update apps when their version number increases --- lib/app.php | 29 +++++++++++++++++++++++++++++ lib/base.php | 2 ++ 2 files changed, 31 insertions(+) diff --git a/lib/app.php b/lib/app.php index 1873e1136c..6b35cdffec 100644 --- a/lib/app.php +++ b/lib/app.php @@ -371,4 +371,33 @@ class OC_App{ } return $apps; } + + /** + * check if any apps need updating and update those + */ + public static function updateApps(){ + // The rest comes here + $apps = OC_Appconfig::getApps(); + foreach( $apps as $app ){ + $installedVersion=OC_Appconfig::getValue($app,'installed_version'); + $appInfo=OC_App::getAppInfo($app); + $currentVersion=$appInfo['version']; + if (version_compare($currentVersion, $installedVersion, '>')) { + OC_App::updateApp($app); + } + } + } + + /** + * update the database for the app and call the update script + * @param string appid + */ + public static function updateApp($appid){ + if(file_exists(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/database.xml')){ + OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/database.xml'); + } + if(file_exists(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/update.php')){ + include OC::$SERVERROOT.'/apps/'.$file.'/appinfo/update.php'; + } + } } diff --git a/lib/base.php b/lib/base.php index 7b42d56f52..c3965c9cd3 100644 --- a/lib/base.php +++ b/lib/base.php @@ -159,6 +159,8 @@ class OC{ OC_Config::setValue('version',implode('.',OC_Util::getVersion())); } + OC_App::updateApps(); + ini_set('session.cookie_httponly','1;'); session_start(); From 010bfa11e363928f4c3a6d8518cbab0e79e28149 Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Sun, 1 Jan 2012 16:58:51 -0500 Subject: [PATCH 083/106] Fix updateApp() and add extra check to updateApps() --- lib/app.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/app.php b/lib/app.php index 6b35cdffec..13c4cef32b 100644 --- a/lib/app.php +++ b/lib/app.php @@ -381,9 +381,11 @@ class OC_App{ foreach( $apps as $app ){ $installedVersion=OC_Appconfig::getValue($app,'installed_version'); $appInfo=OC_App::getAppInfo($app); - $currentVersion=$appInfo['version']; - if (version_compare($currentVersion, $installedVersion, '>')) { - OC_App::updateApp($app); + if (isset($appInfo['version'])) { + $currentVersion=$appInfo['version']; + if (version_compare($currentVersion, $installedVersion, '>')) { + OC_App::updateApp($app); + } } } } @@ -393,11 +395,11 @@ class OC_App{ * @param string appid */ public static function updateApp($appid){ - if(file_exists(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/database.xml')){ - OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/database.xml'); + if(file_exists(OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/database.xml')){ + OC_DB::updateDbFromStructure(OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/database.xml'); } - if(file_exists(OC::$SERVERROOT.'/apps/'.$file.'/appinfo/update.php')){ - include OC::$SERVERROOT.'/apps/'.$file.'/appinfo/update.php'; + if(file_exists(OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/update.php')){ + include OC::$SERVERROOT.'/apps/'.$appid.'/appinfo/update.php'; } } } From 034cf19159c828d242fbb3128fda6db815a75ca6 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 02:57:52 +0100 Subject: [PATCH 084/106] allow changing database backends between PDO and MDB2 --- lib/db.php | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/lib/db.php b/lib/db.php index 05ed8398b7..58a478ba0c 100644 --- a/lib/db.php +++ b/lib/db.php @@ -71,7 +71,14 @@ class OC_DB { /** * connect to the database using pdo */ - private static function connectPDO(){ + public static function connectPDO(){ + if(self::$connection){ + if(self::$backend==self::BACKEND_MDB2){ + self::disconnect(); + }else{ + return; + } + } // The global data we need $name = OC_Config::getValue( "dbname", "owncloud" ); $host = OC_Config::getValue( "dbhost", "" ); @@ -113,7 +120,14 @@ class OC_DB { /** * connect to the database using mdb2 */ - static private function connectMDB2(){ + public static function connectMDB2(){ + if(self::$connection){ + if(self::$backend==self::BACKEND_PDO){ + self::disconnect(); + }else{ + return; + } + } // The global data we need $name = OC_Config::getValue( "dbname", "owncloud" ); $host = OC_Config::getValue( "dbhost", "" ); @@ -255,8 +269,8 @@ class OC_DB { self::$connection->disconnect(); } self::$connection=false; - self::$mdb2=false; - self::$pdo=false; + self::$MDB2=false; + self::$PDO=false; } return true; @@ -374,6 +388,7 @@ class OC_DB { private static function connectScheme(){ // We need a mdb2 database connection self::connectMDB2(); + self::$MDB2->loadModule('Manager'); // Connect if this did not happen before if(!self::$schema){ From 21c4515465748f4ed38a4dc14382d22649711c08 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sun, 8 Jan 2012 11:01:25 +0100 Subject: [PATCH 085/106] rename fix, licence header added --- apps/gallery/ajax/cover.php | 22 ++++++++++++++++++++++ apps/gallery/ajax/createAlbum.php | 22 ++++++++++++++++++++++ apps/gallery/ajax/galleryOp.php | 22 ++++++++++++++++++++++ apps/gallery/ajax/getAlbums.php | 22 ++++++++++++++++++++++ apps/gallery/ajax/getCovers.php | 22 ++++++++++++++++++++++ apps/gallery/ajax/scanForAlbums.php | 21 +++++++++++++++++++++ apps/gallery/ajax/thumbnail.php | 22 ++++++++++++++++++++++ apps/gallery/appinfo/app.php | 22 ++++++++++++++++++++++ apps/gallery/appinfo/info.xml | 2 +- apps/gallery/index.php | 22 ++++++++++++++++++++++ apps/gallery/lib/album.php | 21 +++++++++++++++++++++ apps/gallery/lib/hooks_handlers.php | 28 +++++++++++++++++++++++++--- apps/gallery/lib/images_utils.php | 22 ++++++++++++++++++++++ apps/gallery/lib/photo.php | 21 +++++++++++++++++++++ apps/gallery/lib/scanner.php | 21 +++++++++++++++++++++ 15 files changed, 308 insertions(+), 4 deletions(-) diff --git a/apps/gallery/ajax/cover.php b/apps/gallery/ajax/cover.php index d83f4daaa5..181a919375 100644 --- a/apps/gallery/ajax/cover.php +++ b/apps/gallery/ajax/cover.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/ajax/createAlbum.php b/apps/gallery/ajax/createAlbum.php index 9413b54718..152f5834bc 100644 --- a/apps/gallery/ajax/createAlbum.php +++ b/apps/gallery/ajax/createAlbum.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php index 8a006dda63..3d1ed1f33c 100644 --- a/apps/gallery/ajax/galleryOp.php +++ b/apps/gallery/ajax/galleryOp.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); require_once(OC::$CLASSPATH['OC_Gallery_Album']); OC_JSON::checkLoggedIn(); diff --git a/apps/gallery/ajax/getAlbums.php b/apps/gallery/ajax/getAlbums.php index e4736076fe..9e9c6ef496 100644 --- a/apps/gallery/ajax/getAlbums.php +++ b/apps/gallery/ajax/getAlbums.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/ajax/getCovers.php b/apps/gallery/ajax/getCovers.php index db7c8e9fcd..4db73d0fbf 100644 --- a/apps/gallery/ajax/getCovers.php +++ b/apps/gallery/ajax/getCovers.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/ajax/scanForAlbums.php b/apps/gallery/ajax/scanForAlbums.php index b1f0a433a4..b8ed639d9d 100644 --- a/apps/gallery/ajax/scanForAlbums.php +++ b/apps/gallery/ajax/scanForAlbums.php @@ -1,5 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/ajax/thumbnail.php b/apps/gallery/ajax/thumbnail.php index d937691fa0..6d25c7a253 100644 --- a/apps/gallery/ajax/thumbnail.php +++ b/apps/gallery/ajax/thumbnail.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/appinfo/app.php b/apps/gallery/appinfo/app.php index 3a2dbcb43a..9c665fd350 100644 --- a/apps/gallery/appinfo/app.php +++ b/apps/gallery/appinfo/app.php @@ -1,4 +1,26 @@ . +* +*/ + OC::$CLASSPATH['OC_Gallery_Album'] = 'apps/gallery/lib/album.php'; OC::$CLASSPATH['OC_Gallery_Photo'] = 'apps/gallery/lib/photo.php'; OC::$CLASSPATH['OC_Gallery_Scanner'] = 'apps/gallery/lib/scanner.php'; diff --git a/apps/gallery/appinfo/info.xml b/apps/gallery/appinfo/info.xml index ba51bf0bd5..c275f39bb2 100644 --- a/apps/gallery/appinfo/info.xml +++ b/apps/gallery/appinfo/info.xml @@ -6,6 +6,6 @@ AGPL Bartek Przybylski 2 - + Gallery application for ownCloud diff --git a/apps/gallery/index.php b/apps/gallery/index.php index 0cd795bac0..822a5b8e14 100644 --- a/apps/gallery/index.php +++ b/apps/gallery/index.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../lib/base.php'); OC_Util::checkLoggedIn(); diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php index 98876b891c..a94eff3acd 100644 --- a/apps/gallery/lib/album.php +++ b/apps/gallery/lib/album.php @@ -1,5 +1,26 @@ . +* +*/ + class OC_Gallery_Album { public static function create($owner, $name, $path){ $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_albums (uid_owner, album_name, album_path) VALUES (?, ?, ?)'); diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 1bddaf363e..b6aa8a400c 100644 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -1,5 +1,26 @@ . +* +*/ + OC_Hook::connect("OC_Filesystem", "post_write", "OC_Gallery_Hooks_Handlers", "addPhotoFromPath"); OC_Hook::connect("OC_Filesystem", "delete", "OC_Gallery_Hooks_Handlers", "removePhoto"); OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Gallery_Hooks_Handlers", "renamePhoto"); @@ -18,7 +39,8 @@ class OC_Gallery_Hooks_Handlers { private static function createAlbum($path) { $new_album_name = trim(str_replace('/', '.', $path), '.'); - if ($new_album_name == '') $new_album_name = 'main'; + if ($new_album_name == '') + $new_album_name = 'main'; OC_Log::write(self::$APP_TAG, 'Creating new album '.$new_album_name, OC_Log::DEBUG); OC_Gallery_Album::create(OC_User::getUser(), $new_album_name, $path); @@ -53,8 +75,8 @@ class OC_Gallery_Hooks_Handlers { } public static function renamePhoto($params) { - $olddir = substr($params['oldpath'], 0, strrpos($params['oldpath'], '/')); - $newdir = substr($params['newpath'], 0, strrpos($params['newpath'], '/')); + $olddir = substr($params['oldpath'], 0, strrpos($params['oldpath'], '/')+1); + $newdir = substr($params['newpath'], 0, strrpos($params['newpath'], '/')+1); if (!self::isPhoto($params['newpath'])) return; $album; $newAlbumId; diff --git a/apps/gallery/lib/images_utils.php b/apps/gallery/lib/images_utils.php index cb46bf3f16..0cfa52eb56 100644 --- a/apps/gallery/lib/images_utils.php +++ b/apps/gallery/lib/images_utils.php @@ -1,4 +1,26 @@ . +* +*/ + require_once('../../../lib/base.php'); OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('gallery'); diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index f8a640819a..23887098e0 100644 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -1,5 +1,26 @@ . +* +*/ + class OC_Gallery_Photo{ public static function create($albumId, $img){ $stmt = OC_DB::prepare('INSERT INTO *PREFIX*gallery_photos (album_id, file_path) VALUES (?, ?)'); diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index f754f91300..3eba9260ac 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -1,5 +1,26 @@ . +* +*/ + require_once('base.php'); // base lib require_once('images_utils.php'); From c2392bbace7511dfa424513ba88a8d76f3ee620c Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Sun, 8 Jan 2012 11:25:08 +0100 Subject: [PATCH 086/106] db overwriting, gallery creating fix --- apps/gallery/appinfo/database.xml | 2 +- apps/gallery/lib/hooks_handlers.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/apps/gallery/appinfo/database.xml b/apps/gallery/appinfo/database.xml index db88e4c1b5..ccdfad9433 100644 --- a/apps/gallery/appinfo/database.xml +++ b/apps/gallery/appinfo/database.xml @@ -2,7 +2,7 @@ *dbname* true - false + true latin1
      *dbprefix*gallery_albums diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index b6aa8a400c..65f3faaeea 100644 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -32,6 +32,7 @@ class OC_Gallery_Hooks_Handlers { private static $APP_TAG = "Gallery"; private static function isPhoto($filename) { + OC_Log::write(self::$APP_TAG, "Checking file ".$filename." with mimetype ".OC_Filesystem::getMimeType($filename), OC_Log::DEBUG); if (substr(OC_Filesystem::getMimeType($filename), 0, 6) == "image/") return 1; return 0; @@ -53,6 +54,7 @@ class OC_Gallery_Hooks_Handlers { $fullpath = $params['path']; OC_Log::write(self::$APP_TAG, 'Adding file with path '. $fullpath, OC_Log::DEBUG); $path = substr($fullpath, 0, strrpos($fullpath, '/')); + if ($path == '') $path = '/'; $album = OC_Gallery_Album::find(OC_User::getUser(), null, $path); if ($album->numRows() == 0) { @@ -75,9 +77,12 @@ class OC_Gallery_Hooks_Handlers { } public static function renamePhoto($params) { - $olddir = substr($params['oldpath'], 0, strrpos($params['oldpath'], '/')+1); - $newdir = substr($params['newpath'], 0, strrpos($params['newpath'], '/')+1); + $olddir = substr($params['oldpath'], 0, strrpos($params['oldpath'], '/')); + $newdir = substr($params['newpath'], 0, strrpos($params['newpath'], '/')); + if ($olddir == '') $olddir = '/'; + if ($newdir == '') $newdir = '/'; if (!self::isPhoto($params['newpath'])) return; + OC_Log::write(self::$APP_TAG, 'Moving photo from '.$params['oldpath'].' to '.$params['newpath'], OC_Log::DEBUG); $album; $newAlbumId; $oldAlbumId; From 76b193c69818187b5d52fdcd3d07873c343aa5d9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 13:01:41 +0100 Subject: [PATCH 087/106] don't try to upgrade what isn't installed --- lib/base.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/base.php b/lib/base.php index c3965c9cd3..854b91b0c1 100644 --- a/lib/base.php +++ b/lib/base.php @@ -152,14 +152,16 @@ class OC{ } } - $installedVersion=OC_Config::getValue('version','0.0.0'); - $currentVersion=implode('.',OC_Util::getVersion()); - if (version_compare($currentVersion, $installedVersion, '>')) { - OC_DB::updateDbFromStructure('../db_structure.xml'); - OC_Config::setValue('version',implode('.',OC_Util::getVersion())); - } + if(OC_Config::getValue('installed', false)){ + $installedVersion=OC_Config::getValue('version','0.0.0'); + $currentVersion=implode('.',OC_Util::getVersion()); + if (version_compare($currentVersion, $installedVersion, '>')) { + OC_DB::updateDbFromStructure('../db_structure.xml'); + OC_Config::setValue('version',implode('.',OC_Util::getVersion())); + } - OC_App::updateApps(); + OC_App::updateApps(); + } ini_set('session.cookie_httponly','1;'); session_start(); From a4e14b49b14b2215037806ded362b2ded0e61465 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 13:16:11 +0100 Subject: [PATCH 088/106] load reverse driver when updating database --- lib/db.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/db.php b/lib/db.php index 58a478ba0c..b901cc8b51 100644 --- a/lib/db.php +++ b/lib/db.php @@ -389,6 +389,7 @@ class OC_DB { // We need a mdb2 database connection self::connectMDB2(); self::$MDB2->loadModule('Manager'); + self::$MDB2->loadModule('Reverse'); // Connect if this did not happen before if(!self::$schema){ From 4d1ed7e05f5efc589b7fb6031661ccda496cee76 Mon Sep 17 00:00:00 2001 From: Cloud Dumper Date: Sat, 7 Jan 2012 23:41:51 +0100 Subject: [PATCH 089/106] Improve music playlist rendering. This change: * bolds currently playing song in playlist; * forces song names in playlist to one line, ellipsize after (...); * adds jQuery tipsies to get the whole song name, along with the artist name, and the album the song is coming from. No need to split this changeset into three different ones for the sake of atomicity. Two first elements were on the priorities / bug list available there: http://gitorious.org/owncloud/pages/Home --- apps/media/css/music.css | 4 ++-- apps/media/js/playlist.js | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/media/css/music.css b/apps/media/css/music.css index a6738058be..41ade44a66 100644 --- a/apps/media/css/music.css +++ b/apps/media/css/music.css @@ -22,11 +22,11 @@ div.jp-volume-bar-value { background:#ccc; width:0; height:0.4em; } #collection li.album,#collection li.song { margin-left:3em; } #leftcontent img.remove { display:none; float:right; cursor:pointer; } #leftcontent li:hover img.remove { display:inline; } -#leftcontent li {white-space: normal; } +#leftcontent li div.label { float: left; width: 200px; overflow: hidden; text-overflow: ellipsis; } #collection li button { float:right; } #collection li,#playlist li { list-style-type:none; } .template { display:none; } -.collection_playing { background:#eee; } +.collection_playing { background:#eee; font-weight: bold; } #collection li { padding-right:10px; } #searchresults input.play, #searchresults input.add { float:left; height:1em; width:1em; } diff --git a/apps/media/js/playlist.js b/apps/media/js/playlist.js index 57180b3be7..089065989a 100644 --- a/apps/media/js/playlist.js +++ b/apps/media/js/playlist.js @@ -1,11 +1,23 @@ PlayList.render=function(){ $('#playlist').show(); + + /* + * We should not empty() PlayList.parent() but thorougly manage its + * elements instead because some code might be attached to those. + * JQuery tipsies are one of them. The following line make sure they + * are all removed before we delete the associated
    • . + */ + $(".tipsy").remove(); + PlayList.parent.empty(); for(var i=0;i'); - li.append(item.name); - li.attr('class', 'jp-playlist-' + i); + li.attr('class', 'jp-playlist-' + i); + li.attr('title', item.artist + ' - ' + item.name + '
      (' + item.album + ')'); + var div = $('
      ' + item.name + '
      '); + li.append(div); + $('.jp-playlist-' + i).tipsy({gravity:'w', fade:true, live:true, html:true}); var img=$(''); img.click(function(event){ event.stopPropagation(); From ae711168c3308e013c0d24cc7f832ff91077e911 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 14:07:12 +0100 Subject: [PATCH 090/106] improve detection for mysql databases --- lib/setup.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index d454c17599..a65dc9453c 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -103,7 +103,7 @@ class OC_Setup { //use the admin login data for the new database user //add prefix to the mysql user name to prevent collissions - $dbusername=substr('oc_mysql_'.$username,0,16); + $dbusername=substr('oc_'.$username,0,16); //hash the password so we don't need to store the admin config in the config file $dbpassword=md5(time().$password); @@ -124,9 +124,12 @@ class OC_Setup { } //fill the database if needed - $query="SELECT * FROM $dbname.{$dbtableprefix}users"; + $query="select count(*) from information_schema.tables where table_schema='$dbname' AND table_name = '{$dbtableprefix}users';"; $result = mysql_query($query,$connection); - if(!$result) { + if($result){ + $row=mysql_fetch_row($result); + } + if(!$result or $row[0]==0) { OC_DB::createDbFromStructure('db_structure.xml'); } mysql_close($connection); From 49337e0ad1db8ecf8244f057f729241d923ac2ff Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 14:25:38 +0100 Subject: [PATCH 091/106] dont create a new user when it already exists --- lib/setup.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index a65dc9453c..ebe7a45a1f 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -98,26 +98,33 @@ class OC_Setup { ); } else { + $oldUser=OC_Config::getValue('dbuser', false); + $oldPassword=OC_Config::getValue('dbpassword', false); + $query="SELECT user FROM mysql.user WHERE user='$dbuser'"; //this should be enough to check for admin rights in mysql if(mysql_query($query, $connection)) { //use the admin login data for the new database user //add prefix to the mysql user name to prevent collissions $dbusername=substr('oc_'.$username,0,16); - //hash the password so we don't need to store the admin config in the config file - $dbpassword=md5(time().$password); - - self::createDBUser($dbusername, $dbpassword, $connection); - - OC_Config::setValue('dbuser', $dbusername); - OC_Config::setValue('dbpassword', $dbpassword); + if($dbusername!=$oldUser){ + //hash the password so we don't need to store the admin config in the config file + $dbpassword=md5(time().$password); + + self::createDBUser($dbusername, $dbpassword, $connection); + + OC_Config::setValue('dbuser', $dbusername); + OC_Config::setValue('dbpassword', $dbpassword); + } //create the database self::createDatabase($dbname, $dbusername, $connection); } else { - OC_Config::setValue('dbuser', $dbuser); - OC_Config::setValue('dbpassword', $dbpass); + if($dbuser!=$oldUser){ + OC_Config::setValue('dbuser', $dbuser); + OC_Config::setValue('dbpassword', $dbpass); + } //create the database self::createDatabase($dbname, $dbuser, $connection); From 9c6248443adf4be29cf9e85a8f7baca846bcb1d9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 14:35:23 +0100 Subject: [PATCH 092/106] dont overwrite the database with the gallery database --- apps/gallery/appinfo/database.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/gallery/appinfo/database.xml b/apps/gallery/appinfo/database.xml index ccdfad9433..db88e4c1b5 100644 --- a/apps/gallery/appinfo/database.xml +++ b/apps/gallery/appinfo/database.xml @@ -2,7 +2,7 @@ *dbname* true - true + false latin1
    • *dbprefix*gallery_albums From a9aabd1c8d8acce429a66779d1fe69025a317a83 Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 8 Jan 2012 16:41:36 +0100 Subject: [PATCH 093/106] 3rdparty: fix bug in when --- 3rdparty/when/When.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/3rdparty/when/When.php b/3rdparty/when/When.php index f8bb9db0f6..5eaf3dec69 100755 --- a/3rdparty/when/When.php +++ b/3rdparty/when/When.php @@ -621,7 +621,19 @@ class When if($interval == "month") { - $this->try_date->modify('+1 month'); + + $this->try_date->modify('first day of next month'); + if((int) date('t', $this->try_date->format('U')) > (int) $this->start_date->format('j')){ + $this->try_date->modify('+' . (int) $this->start_date->format('j') - 1 . ' day'); + }else{ + $this->try_date->modify('+' . (int) date('t', $this->try_date->format('U')) - 1 . ' day'); + } + //$this->try_date->setDate(date('y/n/j', mktime(0,0,0,$this->try_date->format('j'), $this->try_date->format('n') + 1, $year = $this->try_date->format('Y')))); + //echo date('t', $this->try_date->format('U')) . '-' . $this->try_date->format('U') . ' '; + /*$month_day = $this->try_date->format('j'); + $month = $this->try_date->format('n'); + $year = $this->try_date->format('Y');*/ + } else { From 9e105d9bd756ef079c407772cba4d67f1a5193fe Mon Sep 17 00:00:00 2001 From: Georg Ehrke Date: Sun, 8 Jan 2012 16:44:15 +0100 Subject: [PATCH 094/106] remove old code in comments --- 3rdparty/when/When.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/3rdparty/when/When.php b/3rdparty/when/When.php index 5eaf3dec69..d54f296ed6 100755 --- a/3rdparty/when/When.php +++ b/3rdparty/when/When.php @@ -628,12 +628,6 @@ class When }else{ $this->try_date->modify('+' . (int) date('t', $this->try_date->format('U')) - 1 . ' day'); } - //$this->try_date->setDate(date('y/n/j', mktime(0,0,0,$this->try_date->format('j'), $this->try_date->format('n') + 1, $year = $this->try_date->format('Y')))); - //echo date('t', $this->try_date->format('U')) . '-' . $this->try_date->format('U') . ' '; - /*$month_day = $this->try_date->format('j'); - $month = $this->try_date->format('n'); - $year = $this->try_date->format('Y');*/ - } else { From 041e3575d157e1ac0886473c962af10726ae7e67 Mon Sep 17 00:00:00 2001 From: Kshitij Parajuli Date: Sun, 8 Jan 2012 11:00:30 -0500 Subject: [PATCH 095/106] When a music file is playing, the page title gets modified. --- apps/media/js/player.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/media/js/player.js b/apps/media/js/player.js index 3c022e9f8c..1f76356fd9 100644 --- a/apps/media/js/player.js +++ b/apps/media/js/player.js @@ -93,9 +93,11 @@ var PlayList={ ended:PlayList.next, pause:function(){ localStorage.setItem(oc_current_user+'oc_playlist_playing','false'); + document.title = "ownCloud"; }, - play:function(){ + play:function(event){ localStorage.setItem(oc_current_user+'oc_playlist_playing','true'); + document.title = "\u25b8 " + event.jPlayer.status.media.name + " - " + event.jPlayer.status.media.artist + " - ownCloud"; }, supplied:type, ready:function(){ From 13784bee18ace83adc10d869e949420b797ac03f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 17:29:35 +0100 Subject: [PATCH 096/106] mp3info is giving to much trouble, get rid of it --- apps/media/lib_scanner.php | 112 ++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 65 deletions(-) diff --git a/apps/media/lib_scanner.php b/apps/media/lib_scanner.php index 320b1f7919..4039cce09e 100644 --- a/apps/media/lib_scanner.php +++ b/apps/media/lib_scanner.php @@ -30,7 +30,6 @@ class OC_MEDIA_SCANNER{ //these are used to store which artists and albums we found, it can save a lot of addArtist/addAlbum calls static private $artists=array(); static private $albums=array();//stored as "$artist/$album" to allow albums with the same name from different artists - static private $useMp3Info=null; /** * scan a folder for music @@ -70,72 +69,55 @@ class OC_MEDIA_SCANNER{ * @return boolean */ public static function scanFile($path){ - if(is_null(self::$useMp3Info)){ - self::$useMp3Info=OC_Helper::canExecute("mp3info"); - } $file=OC_Filesystem::getLocalFile($path); - if(substr($path,-3)=='mp3' and self::$useMp3Info){//use the command line tool id3info if possible - $output=array(); - $size=filesize($file); - exec('mp3info -p "%a\n%l\n%t\n%n\n%S" "'.$file.'"',$output); - if(count($output)>4){ - $artist=$output[0]; - $album=$output[1]; - $title=$output[2]; - $track=$output[3]; - $length=$output[4]; - }else{ - return; //invalid mp3 file - } - }else{ - if(!self::isMusic($path)){ - return; - } - if(!self::$getID3){ - self::$getID3=@new getID3(); - self::$getID3->encoding='UTF-8'; - } - $data=@self::$getID3->analyze($file); - getid3_lib::CopyTagsToComments($data); - if(!isset($data['comments'])){ - OC_Log::write('media',"error reading id3 tags in '$file'",OC_Log::WARN); - return; - } - if(!isset($data['comments']['artist'])){ - OC_Log::write('media',"error reading artist tag in '$file'",OC_Log::WARN); - $artist='unknown'; - }else{ - $artist=stripslashes($data['comments']['artist'][0]); - } - if(!isset($data['comments']['album'])){ - OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN); - $album='unknown'; - }else{ - $album=stripslashes($data['comments']['album'][0]); - } - if(!isset($data['comments']['title'])){ - OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN); - $title='unknown'; - }else{ - $title=stripslashes($data['comments']['title'][0]); - } - $size=$data['filesize']; - if (isset($data['comments']['track'])) - { - $track = $data['comments']['track'][0]; - } - else if (isset($data['comments']['track_number'])) - { - $track = $data['comments']['track_number'][0]; - $track = explode('/',$track); - $track = $track[0]; - } - else - { - $track = 0; - } - $length=isset($data['playtime_seconds'])?round($data['playtime_seconds']):0; + if(!self::isMusic($path)){ + return; } + if(!self::$getID3){ + self::$getID3=@new getID3(); + self::$getID3->encoding='UTF-8'; + } + $data=@self::$getID3->analyze($file); + getid3_lib::CopyTagsToComments($data); + if(!isset($data['comments'])){ + OC_Log::write('media',"error reading id3 tags in '$file'",OC_Log::WARN); + return; + } + if(!isset($data['comments']['artist'])){ + OC_Log::write('media',"error reading artist tag in '$file'",OC_Log::WARN); + $artist='unknown'; + }else{ + $artist=stripslashes($data['comments']['artist'][0]); + } + if(!isset($data['comments']['album'])){ + OC_Log::write('media',"error reading album tag in '$file'",OC_Log::WARN); + $album='unknown'; + }else{ + $album=stripslashes($data['comments']['album'][0]); + } + if(!isset($data['comments']['title'])){ + OC_Log::write('media',"error reading title tag in '$file'",OC_Log::WARN); + $title='unknown'; + }else{ + $title=stripslashes($data['comments']['title'][0]); + } + $size=$data['filesize']; + if (isset($data['comments']['track'])) + { + $track = $data['comments']['track'][0]; + } + else if (isset($data['comments']['track_number'])) + { + $track = $data['comments']['track_number'][0]; + $track = explode('/',$track); + $track = $track[0]; + } + else + { + $track = 0; + } + $length=isset($data['playtime_seconds'])?round($data['playtime_seconds']):0; + if(!isset(self::$artists[$artist])){ $artistId=OC_MEDIA_COLLECTION::addArtist($artist); self::$artists[$artist]=$artistId; From ed5fb902bd1391d2fc2adb3c4e5cb25fcb16b93e Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 17:30:33 +0100 Subject: [PATCH 097/106] remove mp3info from dependency check --- apps/admin_dependencies_chk/settings.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apps/admin_dependencies_chk/settings.php b/apps/admin_dependencies_chk/settings.php index 34028056db..ce90dd604c 100644 --- a/apps/admin_dependencies_chk/settings.php +++ b/apps/admin_dependencies_chk/settings.php @@ -44,12 +44,6 @@ $modules[] =array( 'modules'=> array('gallery'), 'message'=> $l->t('The php-gd module is needed to create thumbnails of your images')); -$modules[] =array( - 'status' => OC_Helper::canExecute("mp3info") ? 'ok' : 'warning', - 'part'=> 'mp3info', - 'modules'=> array('media'), - 'message'=> $l->t('The program mp3info is useful to discover ID3 tags of your music files')); - $modules[] =array( 'status' => function_exists("ldap_bind") ? 'ok' : 'error', 'part'=> 'php-ldap', From 37f5a8cdb4d2486982117c5d5984a253c2192e0b Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 17:49:53 +0100 Subject: [PATCH 098/106] improve pgsql database detection --- lib/setup.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/setup.php b/lib/setup.php index ebe7a45a1f..1b74e94519 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -190,9 +190,12 @@ class OC_Setup { } //fill the database if needed - $query = "SELECT relname FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1"; + $query = "select count(*) FROM pg_class WHERE relname='{$dbtableprefix}users' limit 1"; $result = pg_query($connection, $query); - if(!$result) { + if($result){ + $row = pg_fetch_row($result); + } + if(!$result or $row[0]==0) { OC_DB::createDbFromStructure('db_structure.xml'); } pg_close($connection); From fbb126cdd9c2fd790ed23be3b370b1ae3efb8ba8 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Sun, 8 Jan 2012 19:58:08 +0100 Subject: [PATCH 099/106] save updated version number of apps after updating --- lib/app.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/app.php b/lib/app.php index 13c4cef32b..de7d82ce95 100644 --- a/lib/app.php +++ b/lib/app.php @@ -385,6 +385,7 @@ class OC_App{ $currentVersion=$appInfo['version']; if (version_compare($currentVersion, $installedVersion, '>')) { OC_App::updateApp($app); + OC_Appconfig::setValue($app,'installed_version',$appInfo['version']); } } } From 5e40653713eed01d96841dc93e11534b46a443ee Mon Sep 17 00:00:00 2001 From: Tom Needham Date: Sun, 8 Jan 2012 21:18:21 +0000 Subject: [PATCH 100/106] Missing line return --- lib/setup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/setup.php b/lib/setup.php index 1b74e94519..9a40c36f62 100644 --- a/lib/setup.php +++ b/lib/setup.php @@ -288,7 +288,7 @@ class OC_Setup { $content.= "php_value post_max_size 512M\n"; $content.= "SetEnv htaccessWorking true\n"; $content.= "\n"; - $content.= ""; + $content.= "\n"; $content.= "RewriteEngine on\n"; $content.= "RewriteRule .* - [env=HTTP_AUTHORIZATION:%{HTTP:Authorization},last]\n"; $content.= "\n"; From d91a4fcaf3ffc0783f7aef6767d7b15773808eb5 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 2 Jan 2012 20:24:05 +0100 Subject: [PATCH 101/106] Changed SQL queries for looking up contacts to only query once and sort at the same time. --- apps/contacts/ajax/addcard.php | 1 - apps/contacts/ajax/contacts.php | 15 --------------- apps/contacts/index.php | 17 ----------------- 3 files changed, 33 deletions(-) diff --git a/apps/contacts/ajax/addcard.php b/apps/contacts/ajax/addcard.php index 54c455e515..9d782246a0 100644 --- a/apps/contacts/ajax/addcard.php +++ b/apps/contacts/ajax/addcard.php @@ -61,6 +61,5 @@ foreach( $add as $propname){ $vcard->addProperty($propname, $value, $prop_parameters); } $id = OC_Contacts_VCard::add($aid,$vcard->serialize()); -OC_Log::write('contacts','ajax/addcard.php - adding id: '.$id,OC_Log::DEBUG); OC_Contacts_App::renderDetails($id, $vcard); diff --git a/apps/contacts/ajax/contacts.php b/apps/contacts/ajax/contacts.php index 54ad3e4c10..cf86764105 100644 --- a/apps/contacts/ajax/contacts.php +++ b/apps/contacts/ajax/contacts.php @@ -12,21 +12,6 @@ OC_JSON::checkAppEnabled('contacts'); $ids = OC_Contacts_Addressbook::activeIds(OC_User::getUser()); $contacts = OC_Contacts_VCard::all($ids); -//OC_Log::write('contacts','contacts.php: '.count($contacts).' contacts.',OC_Log::DEBUG); -/* -$addressbooks = OC_Contacts_Addressbook::active(OC_User::getUser()); -$contacts = array(); -foreach( $addressbooks as $addressbook ){ - $addressbookcontacts = OC_Contacts_VCard::all($addressbook['id']); - foreach( $addressbookcontacts as $contact ){ - if(is_null($contact['fullname'])){ - continue; - } - $contacts[] = $contact; - } -} -usort($contacts,'contacts_namesort'); -*/ $tmpl = new OC_TEMPLATE("contacts", "part.contacts"); $tmpl->assign('contacts', $contacts); $page = $tmpl->fetchPage(); diff --git a/apps/contacts/index.php b/apps/contacts/index.php index 5ab6f293ab..b392b195a9 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -42,23 +42,6 @@ OC_App::setActiveNavigationEntry( 'contacts_index' ); // Load a specific user? $id = isset( $_GET['id'] ) ? $_GET['id'] : null; -/* -// sort addressbooks (use contactsort) -usort($addressbooks,'contacts_namesort'); - -$contacts = array(); -foreach( $addressbooks as $addressbook ){ - $addressbookcontacts = OC_Contacts_VCard::all($addressbook['id']); - foreach( $addressbookcontacts as $contact ){ - if(is_null($contact['fullname'])){ - continue; - } - $contacts[] = $contact; - } -} - -usort($contacts,'contacts_namesort'); -*/ $details = array(); // FIXME: This cannot work..? From 85ab3b3924b0e66f3cb3f4e84222b08dd3d882bc Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 2 Jan 2012 22:34:52 +0100 Subject: [PATCH 102/106] Modified thumbnail.php to use OC_Image. Cut out 50 loc ;-) --- apps/contacts/thumbnail.php | 104 +++++++++++------------------------- 1 file changed, 31 insertions(+), 73 deletions(-) diff --git a/apps/contacts/thumbnail.php b/apps/contacts/thumbnail.php index bf0a6e96a5..622718d65c 100644 --- a/apps/contacts/thumbnail.php +++ b/apps/contacts/thumbnail.php @@ -2,8 +2,8 @@ /** * ownCloud - Addressbook * - * @author Jakob Sack - * @copyright 2011 Jakob Sack mail@jakobsack.de + * @author Thomas Tanghus + * @copyright 2011-2012 Thomas Tanghus * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE @@ -26,7 +26,7 @@ OC_Util::checkLoggedIn(); OC_Util::checkAppEnabled('contacts'); if(!function_exists('imagecreatefromjpeg')) { - OC_Log::write('contacts','GD module not installed',OC_Log::ERROR); + OC_Log::write('contacts','thumbnail.php. GD module not installed',OC_Log::DEBUG); header('Content-Type: image/png'); // TODO: Check if it works to read the file and echo the content. return 'img/person.png'; @@ -46,13 +46,16 @@ $l10n = new OC_L10N('contacts'); $card = OC_Contacts_VCard::find( $id ); if( $card === false ){ - echo $l10n->t('Contact could not be found.'); + OC_Log::write('contacts','thumbnail.php. Contact could not be found.',OC_Log::ERROR); + //echo $l10n->t('Contact could not be found.'); exit(); } +// FIXME: Is this check necessary? It just takes up CPU time. $addressbook = OC_Contacts_Addressbook::find( $card['addressbookid'] ); if( $addressbook === false || $addressbook['userid'] != OC_USER::getUser()){ - echo $l10n->t('This is not your contact.'); // This is a weird error, why would it come up? (Better feedback for users?) + OC_Log::write('contacts','thumbnail.php. Wrong contact/addressbook - WTF?',OC_Log::ERROR); + //echo $l10n->t('This is not your contact.'); // This is a weird error, why would it come up? (Better feedback for users?) exit(); } @@ -60,17 +63,14 @@ $content = OC_VObject::parse($card['carddata']); // invalid vcard if( is_null($content)){ - echo $l10n->t('This card is not RFC compatible.'); + OC_Log::write('contacts','thumbnail.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR); + getStandardImage(); exit(); } -// define the width and height for the thumbnail -// note that theese dimmensions are considered the maximum dimmension and are not fixed, -// because we have to keep the image ratio intact or it will be deformed -$thumbnail_width = 23; -$thumbnail_height = 23; +$thumbnail_size = 23; -// Photo :-) +// Finf the photo from VCard. foreach($content->children as $child){ if($child->name == 'PHOTO'){ foreach($child->parameters as $parameter){ @@ -78,73 +78,31 @@ foreach($content->children as $child){ $mime = $parameter->value; } } - $data = base64_decode($child->value); - $src_img = imagecreatefromstring($data); - if ($src_img !== false) { - //gets the dimmensions of the image - $width_orig=imageSX($src_img); - $height_orig=imageSY($src_img); - $ratio_orig = $width_orig/$height_orig; - - if ($thumbnail_width/$thumbnail_height > $ratio_orig) { - $new_height = $thumbnail_width/$ratio_orig; - $new_width = $thumbnail_width; - } else { - $new_width = $thumbnail_height*$ratio_orig; - $new_height = $thumbnail_height; - } - - $x_mid = $new_width/2; //horizontal middle - $y_mid = $new_height/2; //vertical middle - - $process = imagecreatetruecolor(round($new_width), round($new_height)); - if ($process == false) { + $image = new OC_Image(); + if($image->loadFromBase64($child->value)) { + if($image->centerCrop()) { + if($image->resize($thumbnail_size)) { + if(!$image()) { + OC_Log::write('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OC_Log::ERROR); + getStandardImage(); + exit(); + } + } else { + OC_Log::write('contacts','thumbnail.php. Couldn\'t resize thumbnail for ID '.$id,OC_Log::ERROR); + getStandardImage(); + exit(); + } + }else{ + OC_Log::write('contacts','thumbnail.php. Couldn\'t crop thumbnail for ID '.$id,OC_Log::ERROR); getStandardImage(); - //echo 'Error creating process image: '.$new_width.'x'.$new_height; - OC_Log::write('contacts','Error creating process image for '.$id.' '.$new_width.'x'.$new_height,OC_Log::ERROR); - imagedestroy($process); - imagedestroy($src_img); exit(); } - - imagecopyresampled($process, $src_img, 0, 0, 0, 0, $new_width, $new_height, $width_orig, $height_orig); - if ($process == false) { - getStandardImage(); - //echo 'Error resampling process image: '.$new_width.'x'.$new_height; - OC_Log::write('contacts','Error resampling process image for '.$id.' '.$new_width.'x'.$new_height,OC_Log::ERROR); - imagedestroy($process); - imagedestroy($src_img); - exit(); - } - $thumb = imagecreatetruecolor($thumbnail_width, $thumbnail_height); - if ($process == false) { - getStandardImage(); - //echo 'Error creating thumb image: '.$thumbnail_width.'x'.$thumbnail_height; - OC_Log::write('contacts','Error creating thumb image for '.$id.' '.$thumbnail_width.'x'.$thumbnail_height,OC_Log::ERROR); - imagedestroy($process); - imagedestroy($src_img); - exit(); - } - imagecopyresampled($thumb, $process, 0, 0, ($x_mid-($thumbnail_width/2)), ($y_mid-($thumbnail_height/2)), $thumbnail_width, $thumbnail_height, $thumbnail_width, $thumbnail_height); - if ($thumb !== false) { - header('Content-Type: image/png'); - imagepng($thumb); - } else { - getStandardImage(); - OC_Log::write('contacts','Error resampling thumb image for '.$id.' '.$thumbnail_width.'x'.$thumbnail_height,OC_Log::ERROR); - //echo 'An error occurred resampling thumb.'; - } - imagedestroy($thumb); - imagedestroy($process); - imagedestroy($src_img); - } - else { + } else { + OC_Log::write('contacts','thumbnail.php. Couldn\'t load image string for ID '.$id,OC_Log::ERROR); getStandardImage(); + exit(); } exit(); } } getStandardImage(); - -// Not found :-( -//echo $l10n->t('This card does not contain a photo.'); From 47548fb8c612b5a61b00b03b525fd168fe940451 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 2 Jan 2012 23:14:58 +0100 Subject: [PATCH 103/106] Fixed showing first contact if non is selected. --- apps/contacts/index.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apps/contacts/index.php b/apps/contacts/index.php index b392b195a9..b7c88236a8 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -45,11 +45,17 @@ $id = isset( $_GET['id'] ) ? $_GET['id'] : null; $details = array(); // FIXME: This cannot work..? -if( !is_null($id)/* || count($contacts)*/){ - if(is_null($id)) $id = $contacts[0]['id']; - $vcard = OC_Contacts_App::getContactVCard($id); - $details = OC_Contacts_VCard::structureContact($vcard); +if(is_null($id) && count($contacts) > 0) { + $id = $contacts[0]['id']; } +$vcard = OC_Contacts_App::getContactVCard($id); +$details = OC_Contacts_VCard::structureContact($vcard); + +// if( !is_null($id)/* || count($contacts)*/){ +// if(is_null($id)) $id = $contacts[0]['id']; +// $vcard = OC_Contacts_App::getContactVCard($id); +// $details = OC_Contacts_VCard::structureContact($vcard); +// } // Include Style and Script OC_Util::addScript('contacts','interface'); From 604ca61d78881e3a1a0a41e4b50ef4cb7c1eeaf0 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Wed, 4 Jan 2012 22:36:34 +0100 Subject: [PATCH 104/106] Some cleanup, better error messages and such. --- apps/contacts/index.php | 7 ++++--- apps/contacts/js/interface.js | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/apps/contacts/index.php b/apps/contacts/index.php index b7c88236a8..0b705e71b5 100644 --- a/apps/contacts/index.php +++ b/apps/contacts/index.php @@ -48,9 +48,10 @@ $details = array(); if(is_null($id) && count($contacts) > 0) { $id = $contacts[0]['id']; } -$vcard = OC_Contacts_App::getContactVCard($id); -$details = OC_Contacts_VCard::structureContact($vcard); - +if(!is_null($id)) { + $vcard = OC_Contacts_App::getContactVCard($id); + $details = OC_Contacts_VCard::structureContact($vcard); +} // if( !is_null($id)/* || count($contacts)*/){ // if(is_null($id)) $id = $contacts[0]['id']; // $vcard = OC_Contacts_App::getContactVCard($id); diff --git a/apps/contacts/js/interface.js b/apps/contacts/js/interface.js index 35639ef6cc..b9f75bdf71 100644 --- a/apps/contacts/js/interface.js +++ b/apps/contacts/js/interface.js @@ -1,3 +1,29 @@ +/** + * ownCloud - Addressbook + * + * @author Jakob Sack + * @copyright 2011 Jakob Sack mail@jakobsack.de + * @copyright 2011-2012 Thomas Tanghus + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU AFFERO GENERAL PUBLIC LICENSE for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this library. If not, see . + * + * TODO: + * If you add a contact, its thumbnail doesnt show in the list. But when you add another one it shows up, but not for the second contact added. + * Place a new contact in correct alphabetic order + */ + + Contacts={ UI:{ showCardDAVUrl:function(username, bookname){ From 978a08ab1c5e425210e8128e6d8efa432d593571 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 9 Jan 2012 01:17:04 +0100 Subject: [PATCH 105/106] Fixed Phone types not being saved correctly when adding them. --- apps/contacts/ajax/addproperty.php | 20 ++++++++++++++++++- apps/contacts/templates/part.property.php | 5 ++--- .../templates/part.setpropertyform.php | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/apps/contacts/ajax/addproperty.php b/apps/contacts/ajax/addproperty.php index 98877805b4..0122cf019c 100644 --- a/apps/contacts/ajax/addproperty.php +++ b/apps/contacts/ajax/addproperty.php @@ -34,13 +34,31 @@ $name = $_POST['name']; $value = $_POST['value']; $parameters = isset($_POST['parameters'])?$_POST['parameters']:array(); -$property = $vcard->addProperty($name, $value, $parameters); +$property = $vcard->addProperty($name, $value); //, $parameters); $line = count($vcard->children) - 1; +// Apparently Sabre_VObject_Parameter doesn't do well with multiple values or I don't know how to do it. Tanghus. +foreach ($parameters as $key=>$element) { + if(is_array($element) && strtoupper($key) == 'TYPE') { + // FIXME: Maybe this doesn't only apply for TYPE? + // And it probably shouldn't be done here anyways :-/ + foreach($element as $e){ + if($e != '' && !is_null($e)){ + $vcard->children[$line]->parameters[] = new Sabre_VObject_Parameter($key,$e); + } + } + } +} + OC_Contacts_VCard::edit($id,$vcard->serialize()); +$adr_types = OC_Contacts_App::getTypesOfProperty('ADR'); +$phone_types = OC_Contacts_App::getTypesOfProperty('TEL'); + $tmpl = new OC_Template('contacts','part.property'); +$tmpl->assign('adr_types',$adr_types); +$tmpl->assign('phone_types',$phone_types); $tmpl->assign('property',OC_Contacts_VCard::structureProperty($property,$line)); $page = $tmpl->fetchPage(); diff --git a/apps/contacts/templates/part.property.php b/apps/contacts/templates/part.property.php index d930a9ca99..e401039750 100644 --- a/apps/contacts/templates/part.property.php +++ b/apps/contacts/templates/part.property.php @@ -25,15 +25,14 @@ t(ucwords(strtolower($type))); } - endforeach; + } $label = join(' ', $types); ?> () diff --git a/apps/contacts/templates/part.setpropertyform.php b/apps/contacts/templates/part.setpropertyform.php index 8635d7db1c..3e0b8d49b5 100644 --- a/apps/contacts/templates/part.setpropertyform.php +++ b/apps/contacts/templates/part.setpropertyform.php @@ -45,7 +45,7 @@

      From 5f04b41ea6085ee8ab9cfc58ecfc4dd5290a57d6 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sun, 8 Jan 2012 15:35:29 +0100 Subject: [PATCH 106/106] Just a comment ;-) --- lib/image.php | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/image.php b/lib/image.php index 45b6ad3918..bdfa1fefd7 100644 --- a/lib/image.php +++ b/lib/image.php @@ -200,6 +200,7 @@ class OC_Image { } /** + * (I'm open for suggestions on better method name ;) * @brief Fixes orientation based on EXIF data. * @returns bool. */