Merge pull request #9 from chamilo/1.9.x

1.9.x
1.9.x
ycastillo 12 years ago
commit 9105cfcc30
  1. 7
      archive/index.html
  2. 5
      composer.json
  3. 7
      main/cron/import_csv.php
  4. 44
      main/document/document.php
  5. 75
      main/exercice/exercise.class.php
  6. 62
      main/inc/ajax/lp.ajax.php
  7. 2
      main/inc/lib/course.lib.php
  8. 2
      main/inc/lib/database.constants.inc.php
  9. 136
      main/inc/lib/database.lib.php
  10. 29
      main/inc/lib/display.lib.php
  11. 17
      main/inc/lib/document.lib.php
  12. 5
      main/inc/lib/fckeditor/editor/js/fckeditorcode_ie.js
  13. 58
      main/inc/lib/fileUpload.lib.php
  14. 9404
      main/inc/lib/javascript/jquery.js
  15. BIN
      main/inc/lib/javascript/mediaelement/background.png
  16. BIN
      main/inc/lib/javascript/mediaelement/bigplay.png
  17. 1
      main/inc/lib/javascript/mediaelement/bigplay.svg
  18. BIN
      main/inc/lib/javascript/mediaelement/controls-ted.png
  19. BIN
      main/inc/lib/javascript/mediaelement/controls-wmp-bg.png
  20. BIN
      main/inc/lib/javascript/mediaelement/controls-wmp.png
  21. BIN
      main/inc/lib/javascript/mediaelement/controls.png
  22. 1
      main/inc/lib/javascript/mediaelement/controls.svg
  23. BIN
      main/inc/lib/javascript/mediaelement/flashmediaelement-cdn.swf
  24. BIN
      main/inc/lib/javascript/mediaelement/flashmediaelement.swf
  25. 9597
      main/inc/lib/javascript/mediaelement/jquery.js
  26. BIN
      main/inc/lib/javascript/mediaelement/loading.gif
  27. 5067
      main/inc/lib/javascript/mediaelement/mediaelement-and-player.js
  28. 173
      main/inc/lib/javascript/mediaelement/mediaelement-and-player.min.js
  29. 1902
      main/inc/lib/javascript/mediaelement/mediaelement.js
  30. 68
      main/inc/lib/javascript/mediaelement/mediaelement.min.js
  31. 870
      main/inc/lib/javascript/mediaelement/mediaelementplayer.css
  32. 3163
      main/inc/lib/javascript/mediaelement/mediaelementplayer.js
  33. 1
      main/inc/lib/javascript/mediaelement/mediaelementplayer.min.css
  34. 103
      main/inc/lib/javascript/mediaelement/mediaelementplayer.min.js
  35. 289
      main/inc/lib/javascript/mediaelement/mejs-skins.css
  36. BIN
      main/inc/lib/javascript/mediaelement/silverlightmediaelement.xap
  37. 475
      main/inc/lib/javascript/rtc/RecordRTC.js
  38. 101
      main/inc/lib/lp_item.lib.php
  39. 5
      main/inc/lib/main_api.lib.php
  40. 49
      main/inc/lib/sessionmanager.lib.php
  41. 8
      main/inc/lib/template.lib.php
  42. 124
      main/inc/lib/wami-recorder/record_document.php
  43. 6
      main/inc/lib/wami-recorder/recorder.js
  44. 18
      main/install/install.lib.php
  45. 53
      main/newscorm/learnpath.class.php
  46. 91
      main/newscorm/lp_add_audio.php
  47. 189
      main/newscorm/lp_ajax_switch_item.php
  48. 17
      main/newscorm/lp_nav.php
  49. 94
      main/newscorm/lp_view.php
  50. 17
      main/newscorm/scorm_api.php
  51. 77
      main/template/default/layout/footer.tpl
  52. 1
      main/template/default/learnpath/lp_upload_audio.tpl
  53. 188
      main/template/default/learnpath/record_voice.tpl
  54. 129
      main/work/add_document.php
  55. 104
      main/work/add_user.php
  56. 35
      main/work/download.php
  57. 3
      main/work/downloadfolder.inc.php
  58. 7
      main/work/edit.php
  59. 11
      main/work/upload.php
  60. 2
      main/work/view.php
  61. 186
      main/work/work.lib.php
  62. 2
      main/work/work.php
  63. 16
      main/work/work_list.php
  64. 12
      main/work/work_list_all.php
  65. 3
      main/work/work_list_others.php
  66. 11
      vendor/alchemy/binary-driver/.travis.yml
  67. 61
      vendor/alchemy/binary-driver/CHANGELOG.md
  68. 21
      vendor/alchemy/binary-driver/LICENSE
  69. 190
      vendor/alchemy/binary-driver/README.md
  70. 38
      vendor/alchemy/binary-driver/composer.json
  71. 31
      vendor/alchemy/binary-driver/phpunit.xml.dist
  72. 220
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/AbstractBinary.php
  73. 76
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/BinaryDriverTestCase.php
  74. 66
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/BinaryInterface.php
  75. 107
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Configuration.php
  76. 29
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ConfigurationAwareInterface.php
  77. 58
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ConfigurationInterface.php
  78. 16
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Exception/ExceptionInterface.php
  79. 16
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Exception/ExecutableNotFoundException.php
  80. 16
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Exception/ExecutionFailureException.php
  81. 16
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Exception/InvalidArgumentException.php
  82. 58
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Listeners/DebugListener.php
  83. 32
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Listeners/ListenerInterface.php
  84. 88
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/Listeners/Listeners.php
  85. 177
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessBuilderFactory.php
  86. 29
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessBuilderFactoryAwareInterface.php
  87. 65
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessBuilderFactoryInterface.php
  88. 104
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php
  89. 29
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunnerAwareInterface.php
  90. 33
      vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunnerInterface.php
  91. 297
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/AbstractBinaryTest.php
  92. 97
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/AbstractProcessBuilderFactoryTest.php
  93. 78
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/ConfigurationTest.php
  94. 66
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/LTSProcessBuilderFactoryTest.php
  95. 33
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/Listeners/DebugListenerTest.php
  96. 92
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/Listeners/ListenersTest.php
  97. 15
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/NONLTSProcessBuilderFactoryTest.php
  98. 208
      vendor/alchemy/binary-driver/tests/Alchemy/Tests/BinaryDriver/ProcessRunnerTest.php
  99. 4
      vendor/alchemy/binary-driver/tests/bootstrap.php
  100. 7
      vendor/autoload.php
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1,7 +0,0 @@
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
</body></html>

@ -0,0 +1,5 @@
{
"require": {
"php-ffmpeg/php-ffmpeg": "0.3.x-dev@dev"
}
}

@ -538,6 +538,10 @@ class ImportCsv
*/
private function importSessions($file)
{
$avoid = null;
if (isset($this->conditions['importSessions']) && isset($this->conditions['importSessions']['update'])) {
$avoid = $this->conditions['importSessions']['update'];
}
$result = SessionManager::importCSV(
$file,
true,
@ -547,7 +551,8 @@ class ImportCsv
$this->extraFieldIdNameList['session'],
$this->daysCoachAccessBeforeBeginning,
$this->daysCoachAccessAfterBeginning,
$this->defaultSessionVisibility
$this->defaultSessionVisibility,
$avoid
);
if (!empty($result['error_message'])) {

@ -162,7 +162,7 @@ switch ($action) {
}
exit;
break;
case 'downloadfolder' :
case 'downloadfolder':
if (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin()) {
$document_data = DocumentManager::get_document_data_by_id($document_id, api_get_course_id());
@ -177,7 +177,7 @@ switch ($action) {
exit;
}
break;
case 'export_to_pdf' :
case 'export_to_pdf':
if (api_get_setting('students_export2pdf') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin()) {
DocumentManager::export_to_pdf($document_id, $course_code);
}
@ -205,7 +205,10 @@ switch ($action) {
if (empty($parent_id)) {
$parent_id = 0;
}
$file_link = Display::url(get_lang('SeeFile'), api_get_path(WEB_CODE_PATH).'social/myfiles.php?cidReq='.$cidReq.'&amp;id_session='.$id_session.'&amp;gidReq='.$gidReq.'&amp;parent_id='.$parent_id);
$file_link = Display::url(
get_lang('SeeFile'),
api_get_path(WEB_CODE_PATH).'social/myfiles.php?cidReq='.$cidReq.'&amp;id_session='.$id_session.'&amp;gidReq='.$gidReq.'&amp;parent_id='.$parent_id
);
if (file_exists($copyfile)) {
$message = get_lang('CopyAlreadyDone').'</p><p>';
@ -323,8 +326,9 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isse
$qr_code_filename = api_get_path(SYS_ARCHIVE_PATH).$filename;
$temp_folder = api_get_path(SYS_ARCHIVE_PATH).'certificate_preview';
if (!is_dir($temp_folder))
if (!is_dir($temp_folder)) {
mkdir($temp_folder, api_get_permissions_for_new_directories());
}
$qr_code_web_filename = api_get_path(WEB_ARCHIVE_PATH).$filename;
@ -342,8 +346,10 @@ if (isset($_GET['curdirpath']) && $_GET['curdirpath'] == '/certificates' && isse
Display::display_reduced_header();
echo '<style>body {background:none;}</style><style media="print" type="text/css"> #print_div { visibility:hidden; } </style>';
echo '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div"><img src="../img/printmgr.gif" alt="'.get_lang('Print').'"/>'.get_lang('Print').'</a>';
echo '<style>body {background:none;}</style>
<style media="print" type="text/css"> #print_div { visibility:hidden; } </style>';
echo '<a href="javascript:window.print();" style="float:right; padding:4px;" id="print_div">
<img src="../img/printmgr.gif" alt="'.get_lang('Print').'"/>'.get_lang('Print').'</a>';
if (is_file($qr_code_filename) && is_readable($qr_code_filename)) {
$new_content_html = str_replace('((certificate_barcode))', Display::img($qr_code_web_filename), $new_content_html);
}
@ -486,7 +492,7 @@ $docs_and_folders = DocumentManager::get_all_document_data($_course, $curdirpath
$count = 1;
$jquery = null;
if (!empty($docs_and_folders))
if (!empty($docs_and_folders)) {
foreach ($docs_and_folders as $file) {
if ($file['filetype'] == 'file') {
$path_info = pathinfo($file['path']);
@ -508,6 +514,7 @@ if (!empty($docs_and_folders))
}
}
}
}
$htmlHeadXtra[] = '<script>
$(document).ready( function() {
@ -538,7 +545,12 @@ if (!empty($_SESSION['_gid'])) {
/* MOVE FILE OR DIRECTORY */
//Only teacher and all users into their group and each user into his/her shared folder
if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id) || is_my_shared_folder(api_get_user_id(), Security::remove_XSS($_POST['move_to']), $session_id)) {
if (
$is_allowed_to_edit ||
$group_member_with_upload_rights ||
is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id) ||
is_my_shared_folder(api_get_user_id(), Security::remove_XSS($_POST['move_to']), $session_id)
) {
if (isset($_GET['move']) && $_GET['move'] != '') {
$my_get_move = intval($_REQUEST['move']);
@ -682,7 +694,8 @@ if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_fold
}
foreach ($_POST['path'] as $index => & $path) {
if (in_array($path, array('/audio', '/flash', '/images', '/shared_folder', '/video', '/chat_files', '/certificates'))) {
$items = array('/audio', '/flash', '/images', '/shared_folder', '/video', '/chat_files', '/certificates');
if (in_array($path, $items)) {
continue;
} else {
$delete_document = DocumentManager::delete_document($_course, $path, $base_work_dir);
@ -910,7 +923,6 @@ if ($is_certificate_mode && $curdirpath != '/certificates') {
<?php
}
$column_show = array();
if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder(api_get_user_id(), $curdirpath, $session_id)) {
@ -1008,7 +1020,11 @@ $table_footer = '';
$total_size = 0;
if (isset($docs_and_folders) && is_array($docs_and_folders)) {
if (api_get_group_id() == 0 || ( api_is_allowed_to_edit() || GroupManager::is_subscribed(api_get_user_id(), api_get_group_id()) || GroupManager :: is_tutor_of_group(api_get_user_id(), api_get_group_id()))) {
if (
api_get_group_id() == 0 ||
( api_is_allowed_to_edit() || GroupManager::is_subscribed(api_get_user_id(), api_get_group_id()) ||
GroupManager :: is_tutor_of_group(api_get_user_id(), api_get_group_id()))
) {
// Create a sortable table with our data
$sortable_data = array();
@ -1068,7 +1084,11 @@ if (isset($docs_and_folders) && is_array($docs_and_folders)) {
$session_img = api_get_session_image($document_data['session_id'], $_user['status']);
// Document title with link
$row[] = create_document_link($document_data, false, null, $is_visible).$session_img.'<br />'.$invisibility_span_open.'<i>'.nl2br(htmlspecialchars($document_data['comment'], ENT_QUOTES, $charset)).'</i>'.$invisibility_span_close.$user_link;
$row[] = create_document_link($document_data, false, null, $is_visible).
$session_img.'<br />'.$invisibility_span_open.
'<i>'.nl2br(htmlspecialchars($document_data['comment'], ENT_QUOTES, $charset)).'</i>'.
$invisibility_span_close.
$user_link;
// Comments => display comment under the document name
$display_size = format_file_size($size);

@ -376,7 +376,7 @@ class Exercise {
/**
* returns random answers status.
*
* @author - Juan Carlos Ra�a
* @author - Juan Carlos Rana
*/
function selectRandomAnswers() {
return $this->random_answers;
@ -634,7 +634,7 @@ class Exercise {
/**
* sets to 0 if answers are not selected randomly
* if answers are selected randomly
* @author - Juan Carlos Ra�a
* @author - Juan Carlos Rana
* @param - integer $random_answers - random answers
*/
function updateRandomAnswers($random_answers) {
@ -1264,6 +1264,7 @@ class Exercise {
$this->random_answers=0;
}
$this->save($type);
}
function search_engine_save() {
@ -1540,7 +1541,7 @@ class Exercise {
$lp_id = 0;
}
if (empty($lp_item_id)) {
$lp_item_id = 0;
$lp_item_id = 0;
}
if (empty($lp_item_view_id)) {
$lp_item_view_id = 0;
@ -3681,16 +3682,16 @@ class Exercise {
$questionList = array();
$tabCategoryQuestions = Testcategory::getQuestionsByCat($this->id);
$isRandomByCategory = $this->selectRandomByCat();
// on tri les categories en fonction du terme entre [] en tête de la description de la catégorie
// on tri les categories en fonction du terme entre [] en tete de la description de la categorie
/*
* ex de catégories :
* [biologie] Maîtriser les mécanismes de base de la génétique
* [biologie] Relier les moyens de défenses et les agents infectieux
* [biologie] Savoir où est produite l'énergie dans les cellules et sous quelle forme
* [chimie] Classer les molécules suivant leur pouvoir oxydant ou réducteur
* [chimie] Connaître la définition de la théorie acide/base selon Brönsted
* [chimie] Connaître les charges des particules
* On veut dans l'ordre des groupes définis par le terme entre crochet au début du titre de la catégorie
* [biologie] Maitriser les mecanismes de base de la genetique
* [biologie] Relier les moyens de depenses et les agents infectieux
* [biologie] Savoir ou est produite l'enrgie dans les cellules et sous quelle forme
* [chimie] Classer les molles suivant leur pouvoir oxydant ou reacteur
* [chimie] Connaître la denition de la theoie acide/base selon Brönsted
* [chimie] Connaître les charges des particules
* On veut dans l'ordre des groupes definis par le terme entre crochet au debut du titre de la categorie
*/
// If test option is Grouped By Categories
if ($isRandomByCategory == 2) {
@ -3897,4 +3898,56 @@ class Exercise {
}
return $list;
}
/**
* Calculate the max_score of the quiz, depending of question inside, and quiz advanced option
*/
public function get_max_score() {
$out_max_score = 0;
$tab_question_list = $this->selectQuestionList(true); // list of question's id !!! the array key start at 1 !!!
// test is randomQuestions - see field random of test
if ($this->random > 0 && $this->randomByCat == 0) {
$nb_random_questions = $this->random;
$tab_questions_score = array();
for ($i=1; $i <= count($tab_question_list); $i++) {
$tmpobj_question = Question::read($tab_question_list[$i]);
$tab_questions_score[] = $tmpobj_question->weighting;
}
rsort($tab_questions_score);
// add the first $nb_random_questions value of score array to get max_score
for ($i=0; $i < min($nb_random_questions, count($tab_questions_score)); $i++) {
$out_max_score += $tab_questions_score[$i];
}
}
// test is random by category
// get the $nb_random_questions best score question of each category
else if ($this->random > 0 && $this->randomByCat > 0) {
$nb_random_questions = $this->random;
$tab_categories_scores = array();
for ($i=1; $i <= count($tab_question_list); $i++) {
$question_category_id = Testcategory::getCategoryForQuestion($tab_question_list[$i]);
if (!is_array($tab_categories_scores[$question_category_id])) {
$tab_categories_scores[$question_category_id] = array();
}
$tmpobj_question = Question::read($tab_question_list[$i]);
$tab_categories_scores[$question_category_id][] = $tmpobj_question->weighting;
}
// here we've got an array with first key, the category_id, second key, score of question for this cat
while (list($key, $tab_scores) = each($tab_categories_scores)) {
rsort($tab_scores);
for ($i=0; $i < min($nb_random_questions, count($tab_scores)); $i++) {
$out_max_score += $tab_scores[$i];
}
}
}
// standart test, just add each question score
else {
for ($i=1; $i <= count($tab_question_list); $i++) {
$tmpobj_question = Question::read($tab_question_list[$i]);
$out_max_score += $tmpobj_question->weighting;
}
}
return $out_max_score;
}
}

@ -27,7 +27,7 @@ switch ($action) {
$sections = explode('^', $new_order);
$new_array = array();
$i = 0;
foreach ($sections as $items) {
if (!empty($items)) {
list($id, $parent_id) = explode('|', $items);
@ -54,8 +54,66 @@ switch ($action) {
}
Display::display_confirmation_message(get_lang('Saved'));
}
break;
case 'record_audio':
if (api_is_allowed_to_edit(null, true) == false) {
exit;
}
/** @var Learnpath $lp */
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
$course_info = api_get_course_info();
$lpPathInfo = $lp->generate_lp_folder($course_info);
if (empty($lpPathInfo)) {
exit;
}
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php';
foreach (array('video', 'audio') as $type) {
if (isset($_FILES["${type}-blob"])) {
$fileName = $_POST["${type}-filename"];
//$file = $_FILES["${type}-blob"]["tmp_name"];
$file = $_FILES["${type}-blob"];
$fileInfo = pathinfo($fileName);
$file['name'] = 'rec_'.date('Y-m-d_His').'_'.uniqid().'.'.$fileInfo['extension'];
$file['file'] = $file;
$lpPathInfo['dir'] = api_remove_trailing_slash($lpPathInfo['dir']);
$result = DocumentManager::upload_document(
$file,
$lpPathInfo['dir'],
$file['name'],
null,
0,
'overwrite',
false,
false
);
if (!empty($result) && is_array($result)) {
$newDocId = $result['id'];
$courseId = $result['c_id'];
$lp->set_modified_on();
$lpItem = new learnpathItem($_REQUEST['lp_item_id']);
$lpItem->add_audio_from_documents($newDocId);
$data = DocumentManager::get_document_data_by_id($newDocId, $course_info['code']);
echo $data['document_url'];
exit;
}
}
}
break;
default:
echo '';
}
exit;
exit;

@ -282,7 +282,7 @@ class CourseManager {
// Unsubscribe user from all blogs in the course.
Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_REL_USER)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")");
Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)."WHERE c_id = $course_id AND user_id IN (".$user_ids.")");
Database::query("DELETE FROM ".Database::get_course_table(TABLE_BLOGS_TASKS_REL_USER)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")");
//Deleting users in forum_notification and mailqueue course tables
$sql_delete_forum_notification = "DELETE FROM ".Database::get_course_table(TABLE_FORUM_NOTIFICATION)." WHERE c_id = $course_id AND user_id IN (".$user_ids.")";

@ -165,6 +165,8 @@ define('TABLE_TOOL_INTRO', 'tool_intro');
define('TABLE_SCORMDOC', 'scormdocument');
define('TABLE_STUDENT_PUBLICATION', 'student_publication');
define('TABLE_STUDENT_PUBLICATION_ASSIGNMENT', 'student_publication_assignment');
define('TABLE_STUDENT_PUBLICATION_REL_DOCUMENT', 'student_publication_rel_document');
define('TABLE_STUDENT_PUBLICATION_REL_USER', 'student_publication_rel_user');
// Course forum tables
define('TABLE_FORUM_CATEGORY', 'forum_category');

@ -23,7 +23,7 @@ require_once 'database.constants.inc.php';
* @package chamilo.database
*/
class Database {
/* Variable use only in the installation process to log errors. See the Database::query function */
static $log_queries = false;
@ -136,7 +136,7 @@ class Database {
/**
* A more generic method than the other get_main_xxx_table methods,
* This one returns the correct complete name of any table of the main
* This one returns the correct complete name of any table of the main
* database of which you pass the short name as a parameter.
* Please, define table names as constants in this library and use them
* instead of directly using magic words in your tool code.
@ -145,14 +145,14 @@ class Database {
*/
public static function get_main_table($short_table_name) {
return self::format_table_name(
self::get_main_database(),
self::get_main_database(),
$short_table_name);
}
/**
* A more generic method than the older get_course_xxx_table methods,
* This one can return the correct complete name of any course table of
* This one can return the correct complete name of any course table of
* which you pass the short name as a parameter.
* Please, define table names as constants in this library and use them
* instead of directly using magic words in your tool code.
@ -162,7 +162,7 @@ class Database {
* - if you don't specify this, you work on the current course.
*/
public static function get_course_table($short_table_name, $extra = null) {
//forces fatal errors so we can debug more easily
//forces fatal errors so we can debug more easily
if (!empty($extra)) {
var_dump($extra);
//@todo remove this
@ -174,7 +174,7 @@ class Database {
}
/**
* This generic method returns the correct and complete name of any
* This generic method returns the correct and complete name of any
* statistic table of which you pass the short name as a parameter.
* Please, define table names as constants in this library and use them
* instead of directly using magic words in your tool code.
@ -272,9 +272,9 @@ class Database {
* @author Roan Embrechts
*
* @todo What's the use of this method. I think this is better removed.
* There should be consistency in the variable names and the
* There should be consistency in the variable names and the
* use throughout the scripts
* for the database name we should consistently use or db_name
* for the database name we should consistently use or db_name
* or database (db_name probably being the better one)
*/
public static function generate_abstract_course_field_names($result_array) {
@ -343,7 +343,7 @@ class Database {
* @return int The number of rows in the given table.
*/
public static function count_rows($table) {
$obj = self::fetch_object(self::query("SELECT COUNT(*) AS n FROM $table")); //
$obj = self::fetch_object(self::query("SELECT COUNT(*) AS n FROM $table")); //
return $obj->n;
}
@ -400,7 +400,7 @@ class Database {
if (!isset($parameters['client_flags'])) {
$parameters['client_flags'] = 0;
}
$persistent = isset($parameters['persistent']) ? $parameters['persistent'] : null;
$server = isset($parameters['server']) ? $parameters['server'] : null;
$username = isset($parameters['username']) ? $parameters['username'] : null;
@ -415,7 +415,7 @@ class Database {
/**
* Returns error number from the last operation done on the database server.
* @param resource $connection (optional) The database server connection,
* @param resource $connection (optional) The database server connection,
* for detailed description see the method query().
* @return int Returns the error number from the last database (operation, or 0 (zero) if no error occurred.
*/
@ -677,20 +677,20 @@ class Database {
$line = $file;
$file = $connection;
$connection = null;
}
}
//@todo remove this before the stable release
//Check if the table contains a c_ (means a course id)
if (api_get_setting('server_type')==='test' && strpos($query, 'c_')) {
//Check if the table contains inner joins
if (
//Check if the table contains inner joins
if (
strpos($query, 'assoc_handle') === false &&
strpos($query, 'olpc_peru_filter') === false &&
strpos($query, 'allow_public_certificates') === false &&
strpos($query, 'DROP TABLE IF EXISTS') === false &&
strpos($query, 'thematic_advance') === false &&
strpos($query, 'thematic_plan') === false &&
strpos($query, 'track_c_countries') === false &&
strpos($query, 'DROP TABLE IF EXISTS') === false &&
strpos($query, 'thematic_advance') === false &&
strpos($query, 'thematic_plan') === false &&
strpos($query, 'track_c_countries') === false &&
strpos($query, 'track_c_os') === false &&
strpos($query, 'track_c_providers') === false &&
strpos($query, 'track_c_referers') === false &&
@ -704,7 +704,7 @@ class Database {
strpos($query, 'wcag_anysurfer_public_pages') === false &&
strpos($query, 'specific_field') === false &&
strpos($query, 'down_doc_path') === false &&
strpos($query, 'INNER JOIN') === false &&
strpos($query, 'INNER JOIN') === false &&
strpos($query, 'inner join') === false &&
strpos($query, 'left join') === false &&
strpos($query, 'LEFT JOIN') === false &&
@ -715,19 +715,19 @@ class Database {
strpos($query, 'c_id') === false &&
strpos($query, 'create table') === false &&
strpos($query, 'CREATE TABLE') === false &&
strpos($query, 'AUTO_INCREMENT') === false
strpos($query, 'AUTO_INCREMENT') === false
) {
//@todo remove this
echo '<pre>';
$message = '<h4>Dev message: please add the c_id field in this query or report this error in support.chamilo.org </h4>';
$message .= $query;
$message .= $query;
echo $message;
echo '</pre>';
echo '</pre>';
//error_log($message);
}
}
if (!($result = $use_default_connection ? @mysql_query($query) : @mysql_query($query, $connection))) {
}
}
if (!($result = $use_default_connection ? mysql_query($query) : mysql_query($query, $connection))) {
$backtrace = debug_backtrace(); // Retrieving information about the caller statement.
if (isset($backtrace[0])) {
$caller = & $backtrace[0];
@ -772,18 +772,18 @@ class Database {
$info .= '</pre>';
echo $info;
}
if (isset(self::$log_queries) && self::$log_queries) {
error_log("---------------- SQL error ---------------- ");
error_log($query);
error_log('error #'.self::errno($connection));
error_log('error: '.self::error($connection));
$info = 'FILE: ' .(empty($file) ? ' unknown ' : $file);
error_log('error: '.self::error($connection));
$info = 'FILE: ' .(empty($file) ? ' unknown ' : $file);
$info .= ' +'.(empty($line) ? ' unknown ' : $line);
error_log($info);
if (empty($type)) {
if (!empty($function)) {
$info = 'FUNCTION: ' . $function;
@ -792,7 +792,7 @@ class Database {
} else {
if (!empty($class) && !empty($function)) {
$info = 'CLASS: ' . $class.' METHOD: '.$function;
error_log($info);
error_log($info);
}
}
error_log("---------------- end ----------------");
@ -1005,7 +1005,7 @@ class Database {
if ($_configuration['single_database']) {
$table_name = '`'.$database.'`.`'.$table.'`';
} else {
$table_name = '`'.$database.$_configuration['db_glue'].$table.'`';
$table_name = '`'.$database.$_configuration['db_glue'].$table.'`';
}
return $table_name;
}
@ -1141,7 +1141,7 @@ class Database {
/**
* Experimental useful database finder
* @todo lot of stuff to do here
* @todo known issues, it doesn't work when using LIKE conditions
* @todo known issues, it doesn't work when using LIKE conditions
* @example array('where'=> array('course_code LIKE "?%"'))
* @example array('where'=> array('type = ? AND category = ?' => array('setting', 'Plugins'))
* @example array('where'=> array('name = "Julio" AND lastname = "montoya"))
@ -1149,7 +1149,7 @@ class Database {
public static function select($columns, $table_name, $conditions = array(), $type_result = 'all', $option = 'ASSOC') {
$conditions = self::parse_conditions($conditions);
//@todo we could do a describe here to check the columns ...
$clean_columns = '';
if (is_array($columns)) {
@ -1187,32 +1187,32 @@ class Database {
* @param array
* @todo lot of stuff to do here
*/
static function parse_conditions($conditions) {
static function parse_conditions($conditions) {
if (empty($conditions)) {
return '';
}
$return_value = $where_return = '';
foreach ($conditions as $type_condition => $condition_data) {
$return_value = $where_return = '';
foreach ($conditions as $type_condition => $condition_data) {
if ($condition_data == false) {
continue;
}
$type_condition = strtolower($type_condition);
switch ($type_condition) {
case 'where':
foreach ($condition_data as $condition => $value_array) {
case 'where':
foreach ($condition_data as $condition => $value_array) {
if (is_array($value_array)) {
$clean_values = array();
$clean_values = array();
foreach($value_array as $item) {
$item = Database::escape_string($item);
$clean_values[]= $item;
}
} else {
$value_array = Database::escape_string($value_array);
$clean_values = $value_array;
$clean_values = $value_array;
}
if (!empty($condition) && $clean_values != '') {
if (!empty($condition) && $clean_values != '') {
$condition = str_replace('%',"'@percentage@'", $condition); //replace "%"
$condition = str_replace("'?'","%s", $condition);
$condition = str_replace("?","%s", $condition);
@ -1221,25 +1221,25 @@ class Database {
$condition = str_replace("%s","'%s'", $condition);
$condition = str_replace("@-@","@%s@", $condition);
//Treat conditons as string
$condition = vsprintf($condition, $clean_values);
$condition = str_replace('@percentage@','%', $condition); //replace "%"
//Treat conditons as string
$condition = vsprintf($condition, $clean_values);
$condition = str_replace('@percentage@','%', $condition); //replace "%"
$where_return .= $condition;
}
}
}
if (!empty($where_return)) {
$return_value = " WHERE $where_return" ;
}
break;
case 'order':
case 'order':
$order_array = $condition_data;
if (!empty($order_array)) {
// 'order' => 'id desc, name desc'
$order_array = self::escape_string($order_array);
$new_order_array = explode(',', $order_array);
$new_order_array = explode(',', $order_array);
$temp_value = array();
foreach($new_order_array as $element) {
@ -1252,25 +1252,25 @@ class Database {
$order = 'DESC';
if (in_array($element[1], array('desc', 'asc'))) {
$order = $element[1];
}
$temp_value[]= $element[0].' '.$order.' ';
}
$temp_value[]= $element[0].' '.$order.' ';
} else {
//by default DESC
$temp_value[]= $element[0].' DESC ';
$temp_value[]= $element[0].' DESC ';
}
}
if (!empty($temp_value)) {
$return_value .= ' ORDER BY '.implode(', ', $temp_value);
$return_value .= ' ORDER BY '.implode(', ', $temp_value);
} else {
//$return_value .= '';
}
}
}
}
break;
case 'limit':
$limit_array = explode(',', $condition_data);
if (!empty($limit_array)) {
if (count($limit_array) > 1) {
if (count($limit_array) > 1) {
$return_value .= ' LIMIT '.intval($limit_array[0]).' , '.intval($limit_array[1]);
} else {
$return_value .= ' LIMIT '.intval($limit_array[0]);
@ -1305,7 +1305,7 @@ class Database {
/**
* Experimental useful database update
* @param string table name use Database::get_main_table
* @param array array with values to updates, keys are the fields in the database: Example: $params['name'] = 'Julio'; $params['lastname'] = 'Montoya';
* @param array array with values to updates, keys are the fields in the database: Example: $params['name'] = 'Julio'; $params['lastname'] = 'Montoya';
* @param array where conditions i.e array('id = ?' =>'4')
* @todo lot of stuff to do here
*/
@ -1316,9 +1316,9 @@ class Database {
//Cleaning attributes
$count = 1;
foreach ($attributes as $key=>$value) {
if (!is_array($value))
$value = self::escape_string($value);
$update_sql .= "$key = '$value' ";
if ($count < count($attributes)) {
@ -1328,7 +1328,7 @@ class Database {
}
if (!empty($update_sql)) {
//Parsing and cleaning the where conditions
$where_return = self::parse_where_conditions($where_conditions);
$where_return = self::parse_where_conditions($where_conditions);
$sql = "UPDATE $table_name SET $update_sql $where_return ";
if ($show_query) { var_dump($sql); }
$result = self::query($sql);
@ -1337,7 +1337,7 @@ class Database {
}
}
return false;
}
}
/*
DEPRECATED METHODS

@ -1550,4 +1550,33 @@ class Display {
</div> </div>';
return $html;
}
public static function getMediaPlayer($file, $params = array())
{
$fileInfo = pathinfo($file);
switch ($fileInfo['extension']) {
case 'mp3':
case 'webm':
$autoplay = null;
if (isset($params['autoplay']) && $params['autoplay'] == 'true') {
$autoplay = 'autoplay';
}
$width = isset($params['width']) ? 'width="'.$params['width'].'"' : null;
$id = isset($params['id']) ? $params['id'] : $fileInfo['basename'];
$class = isset($params['class']) ? ' class="'.$params['class'].'"' : null;
$html = '<audio id="'.$id.'" '.$class.' controls '.$autoplay.' '.$width.' src="'.$file.'" >';
$html .= '<object width="'.$params['width'].'" height="50" type="application/x-shockwave-flash" data="'.api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/flashmediaelement.swf">
<param name="movie" value="'.api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/flashmediaelement.swf" />
<param name="flashvars" value="controls=true&file='.$fileInfo['basename'].'" />
</object>';
$html .= '</audio>';
return $html;
break;
}
return null;
}
} //end class Display

@ -521,6 +521,7 @@ class DocumentManager {
if ($result !== false && Database::num_rows($result) != 0) {
while ($row = Database::fetch_array($result, 'ASSOC')) {
if (api_is_coach()) {
//Looking for course items that are invisible to hide it in the session
if (in_array($row['id'], array_keys($doc_list))) {
@ -553,7 +554,8 @@ class DocumentManager {
$document_data[$row['id']] = $row;
}
//Only for the student we filter the results see BT#1652
// Only for the student we filter the results see BT#1652
if (!api_is_coach() && !$is_allowed_to_edit) {
$ids_to_remove = array();
$my_repeat_ids = $temp = array();
@ -579,7 +581,6 @@ class DocumentManager {
}
}
}
foreach ($doc_list as $key => $row) {
if (in_array($row['visibility'], array('0', '2')) && !in_array($row['id'], $my_repeat_ids)) {
$ids_to_remove[] = $row['id'];
@ -1027,12 +1028,13 @@ class DocumentManager {
/**
* Gets the document data with a given id
*
* @param array $_course
* @param string $path
* @todo load parent_id
* @return int id of document / false if no doc found
* @param int id
* @param string course code
* @param bool load parents?
* @return array document content
*/
public static function get_document_data_by_id($id, $course_code, $load_parents = false) {
public static function get_document_data_by_id($id, $course_code, $load_parents = false)
{
$course_info = api_get_course_info($course_code);
$course_id = $course_info['real_id'];
@ -2249,6 +2251,7 @@ class DocumentManager {
if (isset($files['file'])) {
$upload_ok = process_uploaded_file($files['file'], $show_output);
if ($upload_ok) {
// File got on the server without problems, now process it
$new_path = handle_uploaded_document($course_info, $files['file'], $base_work_dir, $path, api_get_user_id(), api_get_group_id(), null, $unzip, $if_exists, $show_output);

File diff suppressed because one or more lines are too long

@ -89,34 +89,36 @@ function get_document_title($name) {
*/
function process_uploaded_file($uploaded_file, $show_output = true) {
// Checking the error code sent with the file upload.
switch ($uploaded_file['error']) {
case 1:
// The uploaded file exceeds the upload_max_filesize directive in php.ini.
if ($show_output)
Display::display_error_message(get_lang('UplExceedMaxServerUpload').ini_get('upload_max_filesize'));
return false;
case 2:
// The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
// Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor).
$max_file_size = intval($_POST['MAX_FILE_SIZE']);
if ($show_output) {
Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size));
}
return false;
case 3:
// The uploaded file was only partially uploaded.
if ($show_output) {
Display::display_error_message(get_lang('UplPartialUpload').' '.get_lang('PleaseTryAgain'));
}
return false;
case 4:
// No file was uploaded.
if ($show_output) {
Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst'));
}
return false;
}
if (isset($uploaded_file['error'])) {
switch ($uploaded_file['error']) {
case 1:
// The uploaded file exceeds the upload_max_filesize directive in php.ini.
if ($show_output) {
Display::display_error_message(get_lang('UplExceedMaxServerUpload').ini_get('upload_max_filesize'));
}
return false;
case 2:
// The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
// Not used at the moment, but could be handy if we want to limit the size of an upload (e.g. image upload in html editor).
$max_file_size = intval($_POST['MAX_FILE_SIZE']);
if ($show_output) {
Display::display_error_message(get_lang('UplExceedMaxPostSize'). format_file_size($max_file_size));
}
return false;
case 3:
// The uploaded file was only partially uploaded.
if ($show_output) {
Display::display_error_message(get_lang('UplPartialUpload').' '.get_lang('PleaseTryAgain'));
}
return false;
case 4:
// No file was uploaded.
if ($show_output) {
Display::display_error_message(get_lang('UplNoFileUploaded').' '. get_lang('UplSelectFileFirst'));
}
return false;
}
}
if (!file_exists($uploaded_file['tmp_name'])) {
// No file was uploaded.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?> <!-- Generator: Adobe Fireworks CS6, Export SVG Extension by Aaron Beall (http://fireworks.abeall.com) . Version: 0.6.1 --> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> <svg id="bigplay-gradient.fw-Page%201" viewBox="0 0 100 200" style="background-color:#ffffff00" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x="0px" y="0px" width="100px" height="200px" > <defs> <radialGradient id="gradient1" cx="50%" cy="50%" r="50%"> <stop stop-color="#222222" stop-opacity="0" offset="70%"/> <stop stop-color="#222222" stop-opacity="0.0118" offset="70.202%"/> <stop stop-color="#333333" stop-opacity="1" offset="85%"/> <stop stop-color="#333333" stop-opacity="0" offset="100%"/> </radialGradient> <radialGradient id="gradient2" cx="50%" cy="50%" r="50%"> <stop stop-color="#bbbbbb" stop-opacity="0" offset="70%"/> <stop stop-color="#bbbbbb" stop-opacity="0.0118" offset="70.202%"/> <stop stop-color="#bbbbbb" stop-opacity="1" offset="85%"/> <stop stop-color="#bbbbbb" stop-opacity="0" offset="100%"/> </radialGradient> <filter id="filter1" x="-100%" y="-100%" width="300%" height="300%"> <!-- Glow --> <feColorMatrix result="out" in="SourceGraphic" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.251 0"/> <feMorphology result="out" in="out" operator="dilate" radius="3"/> <feGaussianBlur result="out" in="out" stdDeviation="1.5"/> <feBlend in="SourceGraphic" in2="out" mode="normal" result="Glow1"/> </filter> <filter id="filter2" x="-100%" y="-100%" width="300%" height="300%"> <!-- Glow --> <feColorMatrix result="out" in="SourceGraphic" type="matrix" values="0 0 0 0.8667 0 0 0 0 0.8667 0 0 0 0 0.8667 0 0 0 0 0.251 0"/> <feMorphology result="out" in="out" operator="dilate" radius="3"/> <feGaussianBlur result="out" in="out" stdDeviation="1.5"/> <feBlend in="SourceGraphic" in2="out" mode="normal" result="Glow2"/> </filter> </defs> <g id="Background"> </g> <g id="dark%20shadow"> <path d="M 22 50 C 22 34.5358 34.5358 22 50 22 C 65.4642 22 78 34.5358 78 50 C 78 65.4642 65.4642 78 50 78 C 34.5358 78 22 65.4642 22 50 ZM 5 50 C 5 74.8531 25.1469 95 50 95 C 74.8531 95 95 74.8531 95 50 C 95 25.1469 74.8531 5 50 5 C 25.1469 5 5 25.1469 5 50 Z" fill="url(#gradient1)"/> <path d="M 22 150 C 22 134.5358 34.5358 122 50 122 C 65.4642 122 78 134.5358 78 150 C 78 165.4642 65.4642 178 50 178 C 34.5358 178 22 165.4642 22 150 ZM 5 150 C 5 174.8531 25.1469 195 50 195 C 74.8531 195 95 174.8531 95 150 C 95 125.1469 74.8531 105 50 105 C 25.1469 105 5 125.1469 5 150 Z" fill="url(#gradient2)"/> </g> <g id="dark"> <path id="Polygon" filter="url(#filter1)" d="M 72.5 49.5 L 38.75 68.9856 L 38.75 30.0144 L 72.5 49.5 Z" fill="#ffffff"/> <path id="Ellipse" d="M 13 50.5 C 13 29.7891 29.7891 13 50.5 13 C 71.2109 13 88 29.7891 88 50.5 C 88 71.2109 71.2109 88 50.5 88 C 29.7891 88 13 71.2109 13 50.5 Z" stroke="#ffffff" stroke-width="5" fill="none"/> </g> <g id="light"> <path id="Polygon2" filter="url(#filter2)" d="M 72.5 149.5 L 38.75 168.9856 L 38.75 130.0144 L 72.5 149.5 Z" fill="#ffffff"/> <path id="Ellipse2" d="M 13 150.5 C 13 129.7891 29.7891 113 50.5 113 C 71.2109 113 88 129.7891 88 150.5 C 88 171.211 71.2109 188 50.5 188 C 29.7891 188 13 171.211 13 150.5 Z" stroke="#ffffff" stroke-width="5" fill="none"/> </g> </svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 10 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

@ -0,0 +1,173 @@
/*!
* MediaElement.js
* HTML5 <video> and <audio> shim and player
* http://mediaelementjs.com/
*
* Creates a JavaScript object that mimics HTML5 MediaElement API
* for browsers that don't understand HTML5 or can't play the provided codec
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
*
* Copyright 2010-2013, John Dyer (http://j.hn)
* License: MIT
*
*/var mejs=mejs||{};mejs.version="2.13.0";mejs.meIndex=0;
mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo",
"video/x-vimeo"]}]};
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g,h=document.getElementsByTagName("script"),l=h.length,j=a.length;b<l;b++){f=h[b].src;c=f.lastIndexOf("/");if(c>-1){g=f.substring(c+
1);f=f.substring(0,c+1)}else{g=f;f=""}for(c=0;c<j;c++){e=a[c];e=g.indexOf(e);if(e>-1){d=f;break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d==
"undefined")d=25;a=a.split(":");b=parseInt(a[0],10);var e=parseInt(a[1],10),f=parseInt(a[2],10),g=0,h=0;if(c)g=parseInt(a[3])/d;return h=b*3600+e*60+f+g},convertSMPTEtoSeconds:function(a){if(typeof a!="string")return false;a=a.replace(",",".");var b=0,c=a.indexOf(".")!=-1?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++){d=1;if(e>0)d=Math.pow(60,e);b+=Number(a[e])*d}return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);if(b&&/object|embed/i.test(b.nodeName))if(mejs.MediaFeatures.isIE){b.style.display=
"none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,f=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isBustedNativeHTTPS=location.protocol==="https:"&&(d.match(/android [12]\./)!==null||d.match(/macintosh.* version.* safari/)!==null);a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=
-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window&&window.ontouchstart!=null;a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<f.length;c++)e=document.createElement(f[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;
try{e.canPlayType("video/mp4")}catch(g){a.supportsMediaTag=false}a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=
false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(h){if(a.hasWebkitNativeFullScreen)h.webkitRequestFullScreen();else a.hasMozNativeFullScreen&&h.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();
else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.src=c.src;break}}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={};this.attributes={}};
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably"}return""},
positionFullscreenButton:function(a,b,c){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
this.src=mejs.Utility.absolutizeUrl(a);break}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
this.setFullscreen(false)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},dispatchEvent:function(a){var b,c,d=this.events[a];if(d){c=Array.prototype.slice.call(arguments,1);for(b=0;b<d.length;b++)d[b].apply(null,c)}},hasAttribute:function(a){return a in
this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id);mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}};
mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},unregisterPluginElement:function(a){delete this.pluginMediaElements[a];delete this.htmlMediaElements[a]},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];if(b){switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id);
b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,c)}},fireEvent:function(a,b,c){var d,e;if(a=this.pluginMediaElements[a]){b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}}};
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,httpsBasicAuthSite:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,enablePseudoStreaming:false,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,
defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),f=e==="audio"||e==="video",g=f?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];g=typeof g=="undefined"||g===null||g==""?null:g;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"?
"none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,f,g);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}},
determinePlayback:function(a,b,c,d,e){var f=[],g,h,l,j={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")f.push({type:b.type,url:e});else for(g=0;g<b.type.length;g++)f.push({type:b.type[g],url:e});else if(e!==null){l=this.formatType(e,a.getAttribute("type"));f.push({type:l,url:e})}else for(g=0;g<a.childNodes.length;g++){h=a.childNodes[g];if(h.nodeType==1&&h.tagName.toLowerCase()=="source"){e=h.getAttribute("src");
l=this.formatType(e,h.getAttribute("type"));h=h.getAttribute("media");if(!h||!window.matchMedia||window.matchMedia&&window.matchMedia(h).matches)f.push({type:l,url:e})}}if(!d&&f.length>0&&f[0].url!==null&&this.getTypeFromFile(f[0].url).indexOf("audio")>-1)j.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="native")&&!(mejs.MediaFeatures.isBustedNativeHTTPS&&
b.httpsBasicAuthSite===true)){if(!d){g=document.createElement(j.isVideo?"video":"audio");a.parentNode.insertBefore(g,a);a.style.display="none";j.htmlMediaElement=a=g}for(g=0;g<f.length;g++)if(a.canPlayType(f[g].type).replace(/no/,"")!==""||a.canPlayType(f[g].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){j.method="native";j.url=f[g].url;break}if(j.method==="native"){if(j.url!==null)a.src=j.url;if(b.mode!=="auto_plugin")return j}}if(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="shim")for(g=
0;g<f.length;g++){l=f[g].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];h=mejs.plugins[e];for(c=0;c<h.length;c++){k=h[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(l==k.types[d]){j.method=e;j.url=f[g].url;return j}}}}if(b.mode==="auto_plugin"&&j.method==="native")return j;if(j.method===""&&f.length>0)j.url=f[0].url;return j},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},
getTypeFromFile:function(a){a=a.split("?")[0];a=a.substring(a.lastIndexOf(".")+1).toLowerCase();return(/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+this.getTypeFromExtension(a)},getTypeFromExtension:function(a){switch(a){case "mp4":case "m4v":return"mp4";case "webm":case "webma":case "webmv":return"webm";case "ogg":case "oga":case "ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className=
"me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(f){}e.innerHTML=b.customError?b.customError:c!==""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>";d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,f){c=a.htmlMediaElement;var g=1,h=1,l="me_"+a.method+"_"+mejs.meIndex++,j=new mejs.PluginMediaElement(l,a.method,a.url),k=document.createElement("div"),
m;j.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&j.setAttribute(n.name,n.value)}for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(a.isVideo){g=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;h=b.pluginHeight>0?b.pluginHeight:b.videoHeight>
0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;g=mejs.Utility.encodeUrl(g);h=mejs.Utility.encodeUrl(h)}else if(b.enablePluginDebug){g=320;h=240}j.success=b.success;mejs.MediaPluginBridge.registerPluginElement(l,j,c);k.className="me-plugin";k.id=l+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+l,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+
g,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+h,"pseudostreamstart="+b.pseudoStreamingStartQueryParam];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");b.enablePseudoStreaming&&d.push("pseudostreaming=true");f&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML=
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+l+'" name="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="initParams" value="'+d.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=
document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.join("&amp;")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else k.innerHTML=
'<embed id="'+l+'" name="'+l+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+g+'" height="'+h+'" class="mejs-shim"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:j,pluginId:l,
videoId:b,height:h,width:g};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":j.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<iframe src="http://player.vimeo.com/video/'+j.vimeoid+'?portrait=0&byline=0&title=0" width="'+g+'" height="'+h+'" frameborder="0" class="mejs-shim"></iframe>'}c.style.display="none";c.removeAttribute("autoplay");return j},updateNative:function(a,
b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};
mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="//www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
a;var b,c="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid="+a.pluginId+"&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+
c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=
document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;
c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
(function(a,b){var c={locale:{language:"",strings:{}},methods:{}};c.locale.getLanguage=function(){return c.locale.language||navigator.language};if(typeof mejsL10n!="undefined")c.locale.language=mejsL10n.language;c.locale.INIT_LANGUAGE=c.locale.getLanguage();c.methods.checkPlain=function(d){var e,f,g={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"};d=String(d);for(e in g)if(g.hasOwnProperty(e)){f=RegExp(e,"g");d=d.replace(f,g[e])}return d};c.methods.formatString=function(d,e){for(var f in e){switch(f.charAt(0)){case "@":e[f]=
c.methods.checkPlain(e[f]);break;case "!":break;default:e[f]='<em class="placeholder">'+c.methods.checkPlain(e[f])+"</em>"}d=d.replace(f,e[f])}return d};c.methods.t=function(d,e,f){if(c.locale.strings&&c.locale.strings[f.context]&&c.locale.strings[f.context][d])d=c.locale.strings[f.context][d];if(e)d=c.methods.formatString(d,e);return d};c.t=function(d,e,f){if(typeof d==="string"&&d.length>0){var g=c.locale.getLanguage();f=f||{context:g};return c.methods.t(d,e,f)}else throw{name:"InvalidArgumentException",
message:"First argument is either not a string or empty."};};b.i18n=c})(document,mejs);(function(a){if(typeof mejsL10n!="undefined")a[mejsL10n.language]=mejsL10n.strings})(mejs.i18n.locale.strings);(function(a){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schlie\u00dfen"}})(mejs.i18n.locale.strings);
(function(a){a.zh={Fullscreen:"\u5168\u87a2\u5e55","Go Fullscreen":"\u5168\u5c4f\u6a21\u5f0f","Turn off Fullscreen":"\u9000\u51fa\u5168\u5c4f\u6a21\u5f0f",Close:"\u95dc\u9589"}})(mejs.i18n.locale.strings);
/*!
* MediaElementPlayer
* http://mediaelementjs.com/
*
* Creates a controller bar for HTML5 <video> add <audio> tags
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
*
* Copyright 2010-2013, John Dyer (http://j.hn/)
* License: MIT
*
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
(function(f){mejs.MepDefaults={poster:"",showPosterWhenEnded:false,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return a.duration*0.05},defaultSeekForwardInterval:function(a){return a.duration*0.05},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,autoRewind:true,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,
hideVideoControlsOnLoad:false,clickToPlayPause:true,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-
0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!=
"undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};mejs.mepIndex=0;mejs.players={};mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);this.id="mep_"+mejs.mepIndex++;
mejs.players[this.id]=this;this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(d,g){a.meReady(d,g)},error:function(d){a.handleError(d)}}),e=a.media.tagName.toLowerCase();a.isDynamic=e!=="audio"&&e!=="video";a.isVideo=a.isDynamic?a.options.isVideo:e!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls",
"controls");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(b.isAndroid&&a.options.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.container=f('<div id="'+a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);
a.container.addClass((b.isAndroid?"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=a.isVideo?"video":"audio";e=b.substring(0,
1).toUpperCase()+b.substring(1);a.width=a.options[b+"Width"]>0||a.options[b+"Width"].toString().indexOf("%")>-1?a.options[b+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+e+"Width"];a.height=a.options[b+"Height"]>0||a.options[b+"Height"].toString().indexOf("%")>-1?a.options[b+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==
null?a.$media.attr("height"):a.options["default"+e+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.width;c.pluginHeight=a.height}mejs.MediaElement(a.$media[0],c);typeof a.container!="undefined"&&a.controlsAreVisible&&a.container.trigger("controlsshown")},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true;b.container.trigger("controlsshown")});
b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true;b.container.trigger("controlsshown")}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!(!b.controlsAreVisible||b.options.alwaysShowControls))if(a){b.controls.stop(true,
true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")});b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")}},
controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!="undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);
this.controlsEnabled=true},meReady:function(a,b){var c=this,e=mejs.MediaFeatures,d=b.getAttribute("autoplay");d=!(typeof d=="undefined"||d===null||d==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(e.isAndroid&&c.options.AndroidUseNativeControls)&&!(e.isiPad&&c.options.iPadUseNativeControls)&&!(e.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);
c.findTracks();for(g in c.options.features){e=c.options.features[g];if(c["build"+e])try{c["build"+e](c,c.controls,c.layers,c.media)}catch(k){}}c.container.trigger("controlsready");c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{mejs.MediaElementPlayer.prototype.clickToPlayPauseCallback=function(){if(c.options.clickToPlayPause)c.media.paused?
c.media.play():c.media.pause()};c.media.addEventListener("click",c.clickToPlayPauseCallback,false);c.container.bind("mouseenter mouseover",function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&
c.startControlsTimer(1E3)})}c.options.hideVideoControlsOnLoad&&c.hideControls(false);d&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",function(j){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&!isNaN(j.target.videoHeight)){c.setPlayerSize(j.target.videoWidth,j.target.videoHeight);c.setControlsSize();c.media.setVideoSize(j.target.videoWidth,j.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var j in mejs.players){var m=
mejs.players[j];m.id!=c.id&&c.options.pauseOtherPlayers&&!m.paused&&!m.ended&&m.pause();m.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",function(){if(c.options.autoRewind)try{c.media.setCurrentTime(0)}catch(j){}c.media.pause();c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&
c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);c.globalBind("resize",function(){c.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(d&&a.pluginType=="native"){a.load();
a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||parseInt(this.$node.css("max-width").replace(/px/,""),10)/this.$node.offsetParent().width()===
1||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo?this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth:this.options.defaultAudioWidth,e=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight:this.options.defaultAudioHeight,d=this.container.parent().closest(":visible").width();c=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/c,10):e;if(this.container.parent()[0].tagName.toLowerCase()===
"body"){d=f(window).width();c=f(window).height()}if(c!=0&&d!=0){this.container.width(d).height(c);this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)}d=this.layers.find(".mejs-overlay-play");c=d.find(".mejs-overlay-button");
d.height(this.container.height()-this.controls.height());c.css("margin-top","-"+(c.height()/2-this.controls.height()/2).toString()+"px")},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),e=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var d=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){d.each(function(){var g=f(this);if(g.css("position")!=
"absolute"&&g.is(":visible"))a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-c.width())}c.width(b);e.width(b-(e.outerWidth(true)-e.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,e){var d=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},
false);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a);b.css({"background-image":"url("+a+")"})},buildoverlays:function(a,b,c,e){var d=this;if(a.isVideo){var g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),
k=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),j=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){if(d.options.clickToPlayPause)e.paused?e.play():e.pause()});e.addEventListener("play",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);e.addEventListener("playing",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();
k.hide()},false);e.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||j.show()},false);e.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("canplay",
function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("error",function(){g.hide();b.find(".mejs-time-buffering").hide();k.show();k.find("mejs-overlay-error").html("Error loading this resource")},false)}},buildkeyboard:function(a,b,c,e){this.globalBind("keydown",function(d){if(a.hasFocus&&a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var j=a.options.keyActions[g],m=0,q=j.keys.length;m<q;m++)if(d.keyCode==j.keys[m]){d.preventDefault();
j.action(a,e,d.keyCode);return false}return true});this.globalBind("click",function(d){if(f(d.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(c,e){e=f(e);a.tracks.push({srclang:e.attr("srclang")?e.attr("srclang").toLowerCase():"",src:e.attr("src"),kind:e.attr("kind"),label:e.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,
this.height);this.setControlsSize()},play:function(){this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b;for(a in this.options.features){b=
this.options.features[a];if(this["clean"+b])try{this["clean"+b](this)}catch(c){}}if(this.isDynamic)this.$node.insertBefore(this.container);else{this.$media.prop("controls",true);this.$node.clone().show().insertBefore(this.container);this.$node.remove()}this.media.pluginType!=="native"&&this.media.remove();delete mejs.players[this.id];this.container.remove();this.globalUnbind();delete this.node.player}};(function(){function a(c,e){var d={d:[],w:[]};f.each((c||"").split(" "),function(g,k){var j=k+"."+
e;if(j.indexOf(".")===0){d.d.push(j);d.w.push(j)}else d[b.test(k)?"w":"d"].push(j)});d.d=d.d.join(" ");d.w=d.w.join(" ");return d}var b=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,e,d){c=a(c,this.id);c.d&&f(document).bind(c.d,e,d);c.w&&f(window).bind(c.w,e,d)};mejs.MediaElementPlayer.prototype.globalUnbind=function(c,e){c=a(c,this.id);c.d&&f(document).unbind(c.d,e);c.w&&f(window).unbind(c.w,
e)}})();if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){a===false?this.each(function(){var b=jQuery(this).data("mediaelementplayer");b&&b.remove();jQuery(this).removeData("mediaelementplayer")}):this.each(function(){jQuery(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,a))});return this};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{playpauseText:mejs.i18n.t("Play/Pause")});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,e){var d=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'" aria-label="'+this.options.playpauseText+'"></button></div>').appendTo(b).click(function(g){g.preventDefault();e.paused?e.play():e.pause();return false});e.addEventListener("play",function(){d.removeClass("mejs-play").addClass("mejs-pause")},
false);e.addEventListener("playing",function(){d.removeClass("mejs-play").addClass("mejs-pause")},false);e.addEventListener("pause",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false);e.addEventListener("paused",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,e){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'" aria-label="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){e.paused||e.pause();if(e.currentTime>0){e.setCurrentTime(0);e.pause();b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left",
"0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
(function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,e){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(b);b.find(".mejs-time-buffering").hide();var d=
this,g=b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var k=b.find(".mejs-time-current"),j=b.find(".mejs-time-handle"),m=b.find(".mejs-time-float"),q=b.find(".mejs-time-float-current"),p=function(h){h=h.pageX;var l=g.offset(),r=g.outerWidth(true),n=0,o=n=0;if(e.duration){if(h<l.left)h=l.left;else if(h>r+l.left)h=r+l.left;o=h-l.left;n=o/r;n=n<=0.02?0:n*e.duration;t&&n!==e.currentTime&&e.setCurrentTime(n);if(!mejs.MediaFeatures.hasTouch){m.css("left",o);q.html(mejs.Utility.secondsToTimeCode(n));
m.show()}}},t=false;g.bind("mousedown",function(h){if(h.which===1){t=true;p(h);d.globalBind("mousemove.dur",function(l){p(l)});d.globalBind("mouseup.dur",function(){t=false;m.hide();d.globalUnbind(".dur")});return false}}).bind("mouseenter",function(){d.globalBind("mousemove.dur",function(h){p(h)});mejs.MediaFeatures.hasTouch||m.show()}).bind("mouseleave",function(){if(!t){d.globalUnbind(".dur");m.hide()}});e.addEventListener("progress",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);
e.addEventListener("timeupdate",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);d.loaded=c;d.total=g;d.current=k;d.handle=j},setProgressRail:function(a){var b=a!=undefined?a.target:this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==null){c=Math.min(1,
Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=Math.round(this.total.width()*this.media.currentTime/this.media.duration),b=a-Math.round(this.handle.outerWidth(true)/2);this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,e){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,b,
c,e){if(b.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");e.addEventListener("timeupdate",function(){a.updateDuration()},
false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){this.container.toggleClass("mejs-long-video",this.media.duration>3600);if(this.durationD&&(this.options.duration>0||this.media.duration))this.durationD.html(mejs.Utility.secondsToTimeCode(this.options.duration>0?this.options.duration:
this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("Mute Toggle"),hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,e){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var d=this,g=d.isVideo?d.options.videoVolume:d.options.audioVolume,k=g=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+
'" aria-label="'+d.options.muteText+'"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+'" aria-label="'+d.options.muteText+'"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(b),
j=d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),m=d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),q=d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),p=d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),t=function(n,o){if(!j.is(":visible")&&typeof o=="undefined"){j.show();t(n,true);j.hide()}else{n=Math.max(0,n);n=Math.min(n,1);n==0?k.removeClass("mejs-mute").addClass("mejs-unmute"):k.removeClass("mejs-unmute").addClass("mejs-mute");
if(g=="vertical"){var s=m.height(),u=m.position(),v=s-s*n;p.css("top",Math.round(u.top+v-p.height()/2));q.height(s-v);q.css("top",u.top+v)}else{s=m.width();u=m.position();s=s*n;p.css("left",Math.round(u.left+s-p.width()/2));q.width(Math.round(s))}}},h=function(n){var o=null,s=m.offset();if(g=="vertical"){o=m.height();parseInt(m.css("top").replace(/px/,""),10);o=(o-(n.pageY-s.top))/o;if(s.top==0||s.left==0)return}else{o=m.width();o=(n.pageX-s.left)/o}o=Math.max(0,o);o=Math.min(o,1);t(o);o==0?e.setMuted(true):
e.setMuted(false);e.setVolume(o)},l=false,r=false;k.hover(function(){j.show();r=true},function(){r=false;!l&&g=="vertical"&&j.hide()});j.bind("mouseover",function(){r=true}).bind("mousedown",function(n){h(n);d.globalBind("mousemove.vol",function(o){h(o)});d.globalBind("mouseup.vol",function(){l=false;d.globalUnbind(".vol");!r&&g=="vertical"&&j.hide()});l=true;return false});k.find("button").click(function(){e.setMuted(!e.muted)});e.addEventListener("volumechange",function(){if(!l)if(e.muted){t(0);
k.removeClass("mejs-mute").addClass("mejs-unmute")}else{t(e.volume);k.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(d.container.is(":visible")){t(a.options.startVolume);a.options.startVolume===0&&e.setMuted(true);e.pluginType==="native"&&e.setVolume(a.options.startVolume)}}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,isInIframe:false,buildfullscreen:function(a,b,c,e){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;if(mejs.MediaFeatures.hasTrueNativeFullScreen){c=function(){if(a.isFullScreen)if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=true;a.setControlsSize()}else{a.isNativeFullScreen=
false;a.exitFullScreen()}};mejs.MediaFeatures.hasMozNativeFullScreen?a.globalBind(mejs.MediaFeatures.fullScreenEventName,c):a.container.bind(mejs.MediaFeatures.fullScreenEventName,c)}var d=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+d.id+'" title="'+d.options.fullscreenText+'" aria-label="'+d.options.fullscreenText+'"></button></div>').appendTo(b);if(d.media.pluginType==="native"||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&
mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;if(function(){var h=document.createElement("x"),l=document.documentElement,r=window.getComputedStyle;if(!("pointerEvents"in h.style))return false;h.style.pointerEvents="auto";h.style.pointerEvents="x";l.appendChild(h);r=r&&r(h,"").pointerEvents==="auto";l.removeChild(h);return!!r}()&&!mejs.MediaFeatures.isOpera){var j=false,m=function(){if(j){for(var h in q)q[h].hide();g.css("pointer-events",
"");d.controls.css("pointer-events","");d.media.removeEventListener("click",d.clickToPlayPauseCallback);j=false}},q={};b=["top","left","right","bottom"];var p,t=function(){var h=g.offset().left-d.container.offset().left,l=g.offset().top-d.container.offset().top,r=g.outerWidth(true),n=g.outerHeight(true),o=d.container.width(),s=d.container.height();for(p in q)q[p].css({position:"absolute",top:0,left:0});q.top.width(o).height(l);q.left.width(h).height(n).css({top:l});q.right.width(o-h-r).height(n).css({top:l,
left:h+r});q.bottom.width(o).height(s-n-l).css({top:l+n})};d.globalBind("resize",function(){t()});p=0;for(c=b.length;p<c;p++)q[b[p]]=f('<div class="mejs-fullscreen-hover" />').appendTo(d.container).mouseover(m).hide();g.on("mouseover",function(){if(!d.isFullScreen){var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,false);g.css("pointer-events","none");d.controls.css("pointer-events","none");d.media.addEventListener("click",d.clickToPlayPauseCallback);for(p in q)q[p].show();
t();j=true}});e.addEventListener("fullscreenchange",function(){d.isFullScreen=!d.isFullScreen;d.isFullScreen?d.media.removeEventListener("click",d.clickToPlayPauseCallback):d.media.addEventListener("click",d.clickToPlayPauseCallback);m()});d.globalBind("mousemove",function(h){if(j){var l=g.offset();if(h.pageY<l.top||h.pageY>l.top+g.outerHeight(true)||h.pageX<l.left||h.pageX>l.left+g.outerWidth(true)){g.css("pointer-events","");d.controls.css("pointer-events","");j=false}}})}else g.on("mouseover",
function(){if(k!==null){clearTimeout(k);delete k}var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,true)}).on("mouseout",function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){e.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;d.globalBind("keydown",function(h){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||d.isFullScreen)&&h.keyCode==27)a.exitFullScreen()})}},cleanfullscreen:function(a){a.exitFullScreen()},
containerSizeTimeout:null,enterFullScreen:function(){var a=this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){f(document.documentElement).addClass("mejs-fullscreen");normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function c(){if(a.isNativeFullScreen)f(window).width()!==
screen.width?a.exitFullScreen():setTimeout(c,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,
"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");a.containerSizeTimeout=setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.media.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find(".mejs-shim").width("100%").height("100%");a.media.setVideoSize(f(window).width(),
f(window).height())}a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){clearTimeout(this.containerSizeTimeout);if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();
f(document.documentElement).removeClass("mejs-fullscreen");this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(this.media.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find(".mejs-shim").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");
this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),hideCaptionsButtonWhenEmpty:true,toggleCaptionsButtonWhenOnlyOne:false,slidesSelector:""});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,e){if(a.tracks.length!=0){var d;if(this.domNode.textTracks)for(d=this.domNode.textTracks.length-1;d>=0;d--)this.domNode.textTracks[d].mode="hidden";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).hide();a.captions=
f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover"><span class="mejs-captions-text"></span></div></div>').prependTo(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'" aria-label="'+this.options.tracksText+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+
a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">'+mejs.i18n.t("None")+"</label></li></ul></div></div>").appendTo(b);for(d=b=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&b++;this.options.toggleCaptionsButtonWhenOnlyOne&&b==1?a.captionsButton.on("click",function(){a.setTrack(a.selectedTrack==null?a.tracks[0].srclang:"none")}):a.captionsButton.hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},
function(){f(this).find(".mejs-captions-selector").css("visibility","hidden")}).on("click","input[type=radio]",function(){lang=this.value;a.setTrack(lang)});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):a.container.bind("controlsshown",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});
a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(d=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&a.addTrackButton(a.tracks[d].srclang,a.tracks[d].label);a.loadNextTrack();e.addEventListener("timeupdate",function(){a.displayCaptions()},false);if(a.options.slidesSelector!=""){a.slidesContainer=f(a.options.slidesSelector);e.addEventListener("timeupdate",function(){a.displaySlides()},false)}e.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
"visible");a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight())}},function(){a.hasChapters&&!e.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden")}},setTrack:function(a){var b;if(a=="none"){this.selectedTrack=null;this.captionsButton.removeClass("mejs-captions-enabled")}else for(b=0;b<this.tracks.length;b++)if(this.tracks[b].srclang==a){this.selectedTrack==
null&&this.captionsButton.addClass("mejs-captions-enabled");this.selectedTrack=this.tracks[b];this.captions.attr("lang",this.selectedTrack.srclang);this.displayCaptions();break}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else{this.isLoadingTrack=false;this.checkForTracks()}},loadTrack:function(a){var b=this,c=b.tracks[a];f.ajax({url:c.src,dataType:"text",success:function(e){c.entries=typeof e=="string"&&
/<tt\s+xml/ig.exec(e)?mejs.TrackFormatParser.dfxp.parse(e):mejs.TrackFormatParser.webvvt.parse(e);c.isLoaded=true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack();c.kind=="chapters"&&b.media.addEventListener("play",function(){b.media.duration>0&&b.displayChapters(c)},false);c.kind=="slides"&&b.setupSlides(c)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+a+"]").prop("disabled",false).siblings("label").html(b);
this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},
adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},checkForTracks:function(){var a=false;if(this.options.hideCaptionsButtonWhenEmpty){for(i=0;i<this.tracks.length;i++)if(this.tracks[i].kind=="subtitles"){a=true;break}if(!a){this.captionsButton.hide();this.setControlsSize()}}},displayCaptions:function(){if(typeof this.tracks!=
"undefined"){var a,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);this.captions.show().height(0);return}this.captions.hide()}},setupSlides:function(a){this.slides=a;this.slides.entries.imgs=[this.slides.entries.text.length];this.showSlide(0)},showSlide:function(a){if(!(typeof this.tracks=="undefined"||typeof this.slidesContainer==
"undefined")){var b=this,c=b.slides.entries.text[a],e=b.slides.entries.imgs[a];if(typeof e=="undefined"||typeof e.fadeIn=="undefined")b.slides.entries.imgs[a]=e=f('<img src="'+c+'">').on("load",function(){e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()});else!e.is(":visible")&&!e.is(":animated")&&e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if(typeof this.slides!="undefined"){var a=this.slides,b;for(b=0;b<a.entries.times.length;b++)if(this.media.currentTime>=
a.entries.times[b].start&&this.media.currentTime<=a.entries.times[b].stop){this.showSlide(b);break}}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind=="chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,e,d=e=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){e=a.entries.times[c].stop-a.entries.times[c].start;e=Math.floor(e/b.media.duration*100);if(e+d>100||c==a.entries.times.length-
1&&e+d<100)e=100-d;b.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[c].start+'" style="left: '+d.toString()+"%;width: "+e.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"&ndash;"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));d+=e}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
b.media.paused&&b.media.play()});b.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",
ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={webvvt:{pattern_identifier:/^([a-zA-z]+-)?[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
parse:function(a){var b=0;a=mejs.TrackFormatParser.split2(a,/\r?\n/);for(var c={text:[],times:[]},e,d;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((e=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;d=a[b];for(b++;a[b]!==""&&b<a.length;){d=d+"\n"+a[b];b++}d=f.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1' target='_blank'>$1</a>");c.text.push(d);c.times.push({start:mejs.Utility.convertSMPTEtoSeconds(e[1])==0?0.2:mejs.Utility.convertSMPTEtoSeconds(e[1]),
stop:mejs.Utility.convertSMPTEtoSeconds(e[3]),settings:e[5]})}}return c}},dfxp:{parse:function(a){a=f(a).filter("tt");var b=0;b=a.children("div").eq(0);var c=b.find("p");b=a.find("#"+b.attr("style"));var e,d;a={text:[],times:[]};if(b.length){d=b.removeAttr("id").get(0).attributes;if(d.length){e={};for(b=0;b<d.length;b++)e[d[b].name.split(":")[1]]=d[b].value}}for(b=0;b<c.length;b++){var g;d={start:null,stop:null,style:null};if(c.eq(b).attr("begin"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin"));
if(!d.start&&c.eq(b-1).attr("end"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end"));if(c.eq(b).attr("end"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end"));if(!d.stop&&c.eq(b+1).attr("begin"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b+1).attr("begin"));if(e){g="";for(var k in e)g+=k+":"+e[k]+";"}if(g)d.style=g;if(d.start==0)d.start=0.2;a.times.push(d);d=f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
"<a href='$1' target='_blank'>$1</a>");a.text.push(d);if(a.times.start==0)a.times.start=2}return a}},split2:function(a,b){return a.split(b)}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,b){var c=[],e="",d;for(d=0;d<a.length;d++){e+=a.substring(d,d+1);if(b.test(e)){c.push(e.replace(b,""));e=""}}c.push(e);return c}})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?mejs.i18n.t("Turn off Fullscreen"):mejs.i18n.t("Go Fullscreen")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("Unmute"):mejs.i18n.t("Mute")},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return mejs.i18n.t("Download Video")},
click:function(a){window.location.href=a.media.currentSrc}}]});f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},
isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,
b){for(var c=this,e="",d=c.options.contextMenuItems,g=0,k=d.length;g<k;g++)if(d[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var j=d[g].render(c);if(j!=null)e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+j+"</div>"}c.contextMenu.empty().append(f(e)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var m=f(this),q=parseInt(m.data("itemindex"),10),p=c.options.contextMenuItems[q];typeof p.show!=
"undefined"&&p.show(m,c);m.click(function(){typeof p.click!="undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});f.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,c){var e=this.container.find('link[rel="postroll"]').attr("href");if(typeof e!=="undefined"){a.postroll=f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+this.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide();this.media.addEventListener("ended",
function(){f.ajax({dataType:"html",url:e,success:function(d){c.find(".mejs-postroll-layer-content").html(d)}});a.postroll.show()},false)}}})})(mejs.$);

File diff suppressed because it is too large Load Diff

@ -0,0 +1,68 @@
/*!
* MediaElement.js
* HTML5 <video> and <audio> shim and player
* http://mediaelementjs.com/
*
* Creates a JavaScript object that mimics HTML5 MediaElement API
* for browsers that don't understand HTML5 or can't play the provided codec
* Can play MP4 (H.264), Ogg, WebM, FLV, WMV, WMA, ACC, and MP3
*
* Copyright 2010-2013, John Dyer (http://j.hn)
* License: MIT
*
*/var mejs=mejs||{};mejs.version="2.13.0";mejs.meIndex=0;
mejs.plugins={silverlight:[{version:[3,0],types:["video/mp4","video/m4v","video/mov","video/wmv","audio/wma","audio/m4a","audio/mp3","audio/wav","audio/mpeg"]}],flash:[{version:[9,0,124],types:["video/mp4","video/m4v","video/mov","video/flv","video/rtmp","video/x-flv","audio/flv","audio/x-flv","audio/mp3","audio/m4a","audio/mpeg","video/youtube","video/x-youtube"]}],youtube:[{version:null,types:["video/youtube","video/x-youtube","audio/youtube","audio/x-youtube"]}],vimeo:[{version:null,types:["video/vimeo",
"video/x-vimeo"]}]};
mejs.Utility={encodeUrl:function(a){return encodeURIComponent(a)},escapeHTML:function(a){return a.toString().split("&").join("&amp;").split("<").join("&lt;").split('"').join("&quot;")},absolutizeUrl:function(a){var b=document.createElement("div");b.innerHTML='<a href="'+this.escapeHTML(a)+'">x</a>';return b.firstChild.href},getScriptPath:function(a){for(var b=0,c,d="",e="",f,g,h=document.getElementsByTagName("script"),l=h.length,j=a.length;b<l;b++){f=h[b].src;c=f.lastIndexOf("/");if(c>-1){g=f.substring(c+
1);f=f.substring(0,c+1)}else{g=f;f=""}for(c=0;c<j;c++){e=a[c];e=g.indexOf(e);if(e>-1){d=f;break}}if(d!=="")break}return d},secondsToTimeCode:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d=="undefined")d=25;var e=Math.floor(a/3600)%24,f=Math.floor(a/60)%60,g=Math.floor(a%60);a=Math.floor((a%1*d).toFixed(3));return(b||e>0?(e<10?"0"+e:e)+":":"")+(f<10?"0"+f:f)+":"+(g<10?"0"+g:g)+(c?":"+(a<10?"0"+a:a):"")},timeCodeToSeconds:function(a,b,c,d){if(typeof c=="undefined")c=false;else if(typeof d==
"undefined")d=25;a=a.split(":");b=parseInt(a[0],10);var e=parseInt(a[1],10),f=parseInt(a[2],10),g=0,h=0;if(c)g=parseInt(a[3])/d;return h=b*3600+e*60+f+g},convertSMPTEtoSeconds:function(a){if(typeof a!="string")return false;a=a.replace(",",".");var b=0,c=a.indexOf(".")!=-1?a.split(".")[1].length:0,d=1;a=a.split(":").reverse();for(var e=0;e<a.length;e++){d=1;if(e>0)d=Math.pow(60,e);b+=Number(a[e])*d}return Number(b.toFixed(c))},removeSwf:function(a){var b=document.getElementById(a);if(b&&/object|embed/i.test(b.nodeName))if(mejs.MediaFeatures.isIE){b.style.display=
"none";(function(){b.readyState==4?mejs.Utility.removeObjectInIE(a):setTimeout(arguments.callee,10)})()}else b.parentNode.removeChild(b)},removeObjectInIE:function(a){if(a=document.getElementById(a)){for(var b in a)if(typeof a[b]=="function")a[b]=null;a.parentNode.removeChild(a)}}};
mejs.PluginDetector={hasPluginVersion:function(a,b){var c=this.plugins[a];b[1]=b[1]||0;b[2]=b[2]||0;return c[0]>b[0]||c[0]==b[0]&&c[1]>b[1]||c[0]==b[0]&&c[1]==b[1]&&c[2]>=b[2]?true:false},nav:window.navigator,ua:window.navigator.userAgent.toLowerCase(),plugins:[],addPlugin:function(a,b,c,d,e){this.plugins[a]=this.detectPlugin(b,c,d,e)},detectPlugin:function(a,b,c,d){var e=[0,0,0],f;if(typeof this.nav.plugins!="undefined"&&typeof this.nav.plugins[a]=="object"){if((c=this.nav.plugins[a].description)&&
!(typeof this.nav.mimeTypes!="undefined"&&this.nav.mimeTypes[b]&&!this.nav.mimeTypes[b].enabledPlugin)){e=c.replace(a,"").replace(/^\s+/,"").replace(/\sr/gi,".").split(".");for(a=0;a<e.length;a++)e[a]=parseInt(e[a].match(/\d+/),10)}}else if(typeof window.ActiveXObject!="undefined")try{if(f=new ActiveXObject(c))e=d(f)}catch(g){}return e}};
mejs.PluginDetector.addPlugin("flash","Shockwave Flash","application/x-shockwave-flash","ShockwaveFlash.ShockwaveFlash",function(a){var b=[];if(a=a.GetVariable("$version")){a=a.split(" ")[1].split(",");b=[parseInt(a[0],10),parseInt(a[1],10),parseInt(a[2],10)]}return b});
mejs.PluginDetector.addPlugin("silverlight","Silverlight Plug-In","application/x-silverlight-2","AgControl.AgControl",function(a){var b=[0,0,0,0],c=function(d,e,f,g){for(;d.isVersionSupported(e[0]+"."+e[1]+"."+e[2]+"."+e[3]);)e[f]+=g;e[f]-=g};c(a,b,0,1);c(a,b,1,1);c(a,b,2,1E4);c(a,b,2,1E3);c(a,b,2,100);c(a,b,2,10);c(a,b,2,1);c(a,b,3,1);return b});
mejs.MediaFeatures={init:function(){var a=this,b=document,c=mejs.PluginDetector.nav,d=mejs.PluginDetector.ua.toLowerCase(),e,f=["source","track","audio","video"];a.isiPad=d.match(/ipad/i)!==null;a.isiPhone=d.match(/iphone/i)!==null;a.isiOS=a.isiPhone||a.isiPad;a.isAndroid=d.match(/android/i)!==null;a.isBustedAndroid=d.match(/android 2\.[12]/)!==null;a.isBustedNativeHTTPS=location.protocol==="https:"&&(d.match(/android [12]\./)!==null||d.match(/macintosh.* version.* safari/)!==null);a.isIE=c.appName.toLowerCase().indexOf("microsoft")!=
-1;a.isChrome=d.match(/chrome/gi)!==null;a.isFirefox=d.match(/firefox/gi)!==null;a.isWebkit=d.match(/webkit/gi)!==null;a.isGecko=d.match(/gecko/gi)!==null&&!a.isWebkit;a.isOpera=d.match(/opera/gi)!==null;a.hasTouch="ontouchstart"in window&&window.ontouchstart!=null;a.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect;for(c=0;c<f.length;c++)e=document.createElement(f[c]);a.supportsMediaTag=typeof e.canPlayType!=="undefined"||a.isBustedAndroid;
try{e.canPlayType("video/mp4")}catch(g){a.supportsMediaTag=false}a.hasSemiNativeFullScreen=typeof e.webkitEnterFullscreen!=="undefined";a.hasWebkitNativeFullScreen=typeof e.webkitRequestFullScreen!=="undefined";a.hasMozNativeFullScreen=typeof e.mozRequestFullScreen!=="undefined";a.hasTrueNativeFullScreen=a.hasWebkitNativeFullScreen||a.hasMozNativeFullScreen;a.nativeFullScreenEnabled=a.hasTrueNativeFullScreen;if(a.hasMozNativeFullScreen)a.nativeFullScreenEnabled=e.mozFullScreenEnabled;if(this.isChrome)a.hasSemiNativeFullScreen=
false;if(a.hasTrueNativeFullScreen){a.fullScreenEventName=a.hasWebkitNativeFullScreen?"webkitfullscreenchange":"mozfullscreenchange";a.isFullScreen=function(){if(e.mozRequestFullScreen)return b.mozFullScreen;else if(e.webkitRequestFullScreen)return b.webkitIsFullScreen};a.requestFullScreen=function(h){if(a.hasWebkitNativeFullScreen)h.webkitRequestFullScreen();else a.hasMozNativeFullScreen&&h.mozRequestFullScreen()};a.cancelFullScreen=function(){if(a.hasWebkitNativeFullScreen)document.webkitCancelFullScreen();
else a.hasMozNativeFullScreen&&document.mozCancelFullScreen()}}if(a.hasSemiNativeFullScreen&&d.match(/mac os x 10_5/i)){a.hasNativeFullScreen=false;a.hasSemiNativeFullScreen=false}}};mejs.MediaFeatures.init();
mejs.HtmlMediaElement={pluginType:"native",isFullScreen:false,setCurrentTime:function(a){this.currentTime=a},setMuted:function(a){this.muted=a},setVolume:function(a){this.volume=a},stop:function(){this.pause()},setSrc:function(a){for(var b=this.getElementsByTagName("source");b.length>0;)this.removeChild(b[0]);if(typeof a=="string")this.src=a;else{var c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.src=c.src;break}}}},setVideoSize:function(a,b){this.width=a;this.height=b}};
mejs.PluginMediaElement=function(a,b,c){this.id=a;this.pluginType=b;this.src=c;this.events={};this.attributes={}};
mejs.PluginMediaElement.prototype={pluginElement:null,pluginType:"",isFullScreen:false,playbackRate:-1,defaultPlaybackRate:-1,seekable:[],played:[],paused:true,ended:false,seeking:false,duration:0,error:null,tagName:"",muted:false,volume:1,currentTime:0,play:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.playVideo():this.pluginApi.playMedia();this.paused=false}},load:function(){if(this.pluginApi!=null){this.pluginType!="youtube"&&this.pluginApi.loadMedia();this.paused=
false}},pause:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.pauseVideo():this.pluginApi.pauseMedia();this.paused=true}},stop:function(){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.stopVideo():this.pluginApi.stopMedia();this.paused=true}},canPlayType:function(a){var b,c,d,e=mejs.plugins[this.pluginType];for(b=0;b<e.length;b++){d=e[b];if(mejs.PluginDetector.hasPluginVersion(this.pluginType,d.version))for(c=0;c<d.types.length;c++)if(a==d.types[c])return"probably"}return""},
positionFullscreenButton:function(a,b,c){this.pluginApi!=null&&this.pluginApi.positionFullscreenButton&&this.pluginApi.positionFullscreenButton(Math.floor(a),Math.floor(b),c)},hideFullscreenButton:function(){this.pluginApi!=null&&this.pluginApi.hideFullscreenButton&&this.pluginApi.hideFullscreenButton()},setSrc:function(a){if(typeof a=="string"){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(a));this.src=mejs.Utility.absolutizeUrl(a)}else{var b,c;for(b=0;b<a.length;b++){c=a[b];if(this.canPlayType(c.type)){this.pluginApi.setSrc(mejs.Utility.absolutizeUrl(c.src));
this.src=mejs.Utility.absolutizeUrl(a);break}}}},setCurrentTime:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.seekTo(a):this.pluginApi.setCurrentTime(a);this.currentTime=a}},setVolume:function(a){if(this.pluginApi!=null){this.pluginType=="youtube"?this.pluginApi.setVolume(a*100):this.pluginApi.setVolume(a);this.volume=a}},setMuted:function(a){if(this.pluginApi!=null){if(this.pluginType=="youtube"){a?this.pluginApi.mute():this.pluginApi.unMute();this.muted=a;this.dispatchEvent("volumechange")}else this.pluginApi.setMuted(a);
this.muted=a}},setVideoSize:function(a,b){if(this.pluginElement.style){this.pluginElement.style.width=a+"px";this.pluginElement.style.height=b+"px"}this.pluginApi!=null&&this.pluginApi.setVideoSize&&this.pluginApi.setVideoSize(a,b)},setFullscreen:function(a){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.pluginApi.setFullscreen(a)},enterFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&this.setFullscreen(true)},exitFullScreen:function(){this.pluginApi!=null&&this.pluginApi.setFullscreen&&
this.setFullscreen(false)},addEventListener:function(a,b){this.events[a]=this.events[a]||[];this.events[a].push(b)},removeEventListener:function(a,b){if(!a){this.events={};return true}var c=this.events[a];if(!c)return true;if(!b){this.events[a]=[];return true}for(i=0;i<c.length;i++)if(c[i]===b){this.events[a].splice(i,1);return true}return false},dispatchEvent:function(a){var b,c,d=this.events[a];if(d){c=Array.prototype.slice.call(arguments,1);for(b=0;b<d.length;b++)d[b].apply(null,c)}},hasAttribute:function(a){return a in
this.attributes},removeAttribute:function(a){delete this.attributes[a]},getAttribute:function(a){if(this.hasAttribute(a))return this.attributes[a];return""},setAttribute:function(a,b){this.attributes[a]=b},remove:function(){mejs.Utility.removeSwf(this.pluginElement.id);mejs.MediaPluginBridge.unregisterPluginElement(this.pluginElement.id)}};
mejs.MediaPluginBridge={pluginMediaElements:{},htmlMediaElements:{},registerPluginElement:function(a,b,c){this.pluginMediaElements[a]=b;this.htmlMediaElements[a]=c},unregisterPluginElement:function(a){delete this.pluginMediaElements[a];delete this.htmlMediaElements[a]},initPlugin:function(a){var b=this.pluginMediaElements[a],c=this.htmlMediaElements[a];if(b){switch(b.pluginType){case "flash":b.pluginElement=b.pluginApi=document.getElementById(a);break;case "silverlight":b.pluginElement=document.getElementById(b.id);
b.pluginApi=b.pluginElement.Content.MediaElementJS}b.pluginApi!=null&&b.success&&b.success(b,c)}},fireEvent:function(a,b,c){var d,e;if(a=this.pluginMediaElements[a]){b={type:b,target:a};for(d in c){a[d]=c[d];b[d]=c[d]}e=c.bufferedTime||0;b.target.buffered=b.buffered={start:function(){return 0},end:function(){return e},length:1};a.dispatchEvent(b.type,b)}}};
mejs.MediaElementDefaults={mode:"auto",plugins:["flash","silverlight","youtube","vimeo"],enablePluginDebug:false,httpsBasicAuthSite:false,type:"",pluginPath:mejs.Utility.getScriptPath(["mediaelement.js","mediaelement.min.js","mediaelement-and-player.js","mediaelement-and-player.min.js"]),flashName:"flashmediaelement.swf",flashStreamer:"",enablePluginSmoothing:false,enablePseudoStreaming:false,pseudoStreamingStartQueryParam:"start",silverlightName:"silverlightmediaelement.xap",defaultVideoWidth:480,
defaultVideoHeight:270,pluginWidth:-1,pluginHeight:-1,pluginVars:[],timerRate:250,startVolume:0.8,success:function(){},error:function(){}};mejs.MediaElement=function(a,b){return mejs.HtmlMediaElementShim.create(a,b)};
mejs.HtmlMediaElementShim={create:function(a,b){var c=mejs.MediaElementDefaults,d=typeof a=="string"?document.getElementById(a):a,e=d.tagName.toLowerCase(),f=e==="audio"||e==="video",g=f?d.getAttribute("src"):d.getAttribute("href");e=d.getAttribute("poster");var h=d.getAttribute("autoplay"),l=d.getAttribute("preload"),j=d.getAttribute("controls"),k;for(k in b)c[k]=b[k];g=typeof g=="undefined"||g===null||g==""?null:g;e=typeof e=="undefined"||e===null?"":e;l=typeof l=="undefined"||l===null||l==="false"?
"none":l;h=!(typeof h=="undefined"||h===null||h==="false");j=!(typeof j=="undefined"||j===null||j==="false");k=this.determinePlayback(d,c,mejs.MediaFeatures.supportsMediaTag,f,g);k.url=k.url!==null?mejs.Utility.absolutizeUrl(k.url):"";if(k.method=="native"){if(mejs.MediaFeatures.isBustedAndroid){d.src=k.url;d.addEventListener("click",function(){d.play()},false)}return this.updateNative(k,c,h,l)}else if(k.method!=="")return this.createPlugin(k,c,e,h,l,j);else{this.createErrorMessage(k,c,e);return this}},
determinePlayback:function(a,b,c,d,e){var f=[],g,h,l,j={method:"",url:"",htmlMediaElement:a,isVideo:a.tagName.toLowerCase()!="audio"},k;if(typeof b.type!="undefined"&&b.type!=="")if(typeof b.type=="string")f.push({type:b.type,url:e});else for(g=0;g<b.type.length;g++)f.push({type:b.type[g],url:e});else if(e!==null){l=this.formatType(e,a.getAttribute("type"));f.push({type:l,url:e})}else for(g=0;g<a.childNodes.length;g++){h=a.childNodes[g];if(h.nodeType==1&&h.tagName.toLowerCase()=="source"){e=h.getAttribute("src");
l=this.formatType(e,h.getAttribute("type"));h=h.getAttribute("media");if(!h||!window.matchMedia||window.matchMedia&&window.matchMedia(h).matches)f.push({type:l,url:e})}}if(!d&&f.length>0&&f[0].url!==null&&this.getTypeFromFile(f[0].url).indexOf("audio")>-1)j.isVideo=false;if(mejs.MediaFeatures.isBustedAndroid)a.canPlayType=function(m){return m.match(/video\/(mp4|m4v)/gi)!==null?"maybe":""};if(c&&(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="native")&&!(mejs.MediaFeatures.isBustedNativeHTTPS&&
b.httpsBasicAuthSite===true)){if(!d){g=document.createElement(j.isVideo?"video":"audio");a.parentNode.insertBefore(g,a);a.style.display="none";j.htmlMediaElement=a=g}for(g=0;g<f.length;g++)if(a.canPlayType(f[g].type).replace(/no/,"")!==""||a.canPlayType(f[g].type.replace(/mp3/,"mpeg")).replace(/no/,"")!==""){j.method="native";j.url=f[g].url;break}if(j.method==="native"){if(j.url!==null)a.src=j.url;if(b.mode!=="auto_plugin")return j}}if(b.mode==="auto"||b.mode==="auto_plugin"||b.mode==="shim")for(g=
0;g<f.length;g++){l=f[g].type;for(a=0;a<b.plugins.length;a++){e=b.plugins[a];h=mejs.plugins[e];for(c=0;c<h.length;c++){k=h[c];if(k.version==null||mejs.PluginDetector.hasPluginVersion(e,k.version))for(d=0;d<k.types.length;d++)if(l==k.types[d]){j.method=e;j.url=f[g].url;return j}}}}if(b.mode==="auto_plugin"&&j.method==="native")return j;if(j.method===""&&f.length>0)j.url=f[0].url;return j},formatType:function(a,b){return a&&!b?this.getTypeFromFile(a):b&&~b.indexOf(";")?b.substr(0,b.indexOf(";")):b},
getTypeFromFile:function(a){a=a.split("?")[0];a=a.substring(a.lastIndexOf(".")+1).toLowerCase();return(/(mp4|m4v|ogg|ogv|webm|webmv|flv|wmv|mpeg|mov)/gi.test(a)?"video":"audio")+"/"+this.getTypeFromExtension(a)},getTypeFromExtension:function(a){switch(a){case "mp4":case "m4v":return"mp4";case "webm":case "webma":case "webmv":return"webm";case "ogg":case "oga":case "ogv":return"ogg";default:return a}},createErrorMessage:function(a,b,c){var d=a.htmlMediaElement,e=document.createElement("div");e.className=
"me-cannotplay";try{e.style.width=d.width+"px";e.style.height=d.height+"px"}catch(f){}e.innerHTML=b.customError?b.customError:c!==""?'<a href="'+a.url+'"><img src="'+c+'" width="100%" height="100%" /></a>':'<a href="'+a.url+'"><span>'+mejs.i18n.t("Download File")+"</span></a>";d.parentNode.insertBefore(e,d);d.style.display="none";b.error(d)},createPlugin:function(a,b,c,d,e,f){c=a.htmlMediaElement;var g=1,h=1,l="me_"+a.method+"_"+mejs.meIndex++,j=new mejs.PluginMediaElement(l,a.method,a.url),k=document.createElement("div"),
m;j.tagName=c.tagName;for(m=0;m<c.attributes.length;m++){var n=c.attributes[m];n.specified==true&&j.setAttribute(n.name,n.value)}for(m=c.parentNode;m!==null&&m.tagName.toLowerCase()!="body";){if(m.parentNode.tagName.toLowerCase()=="p"){m.parentNode.parentNode.insertBefore(m,m.parentNode);break}m=m.parentNode}if(a.isVideo){g=b.pluginWidth>0?b.pluginWidth:b.videoWidth>0?b.videoWidth:c.getAttribute("width")!==null?c.getAttribute("width"):b.defaultVideoWidth;h=b.pluginHeight>0?b.pluginHeight:b.videoHeight>
0?b.videoHeight:c.getAttribute("height")!==null?c.getAttribute("height"):b.defaultVideoHeight;g=mejs.Utility.encodeUrl(g);h=mejs.Utility.encodeUrl(h)}else if(b.enablePluginDebug){g=320;h=240}j.success=b.success;mejs.MediaPluginBridge.registerPluginElement(l,j,c);k.className="me-plugin";k.id=l+"_container";a.isVideo?c.parentNode.insertBefore(k,c):document.body.insertBefore(k,document.body.childNodes[0]);d=["id="+l,"isvideo="+(a.isVideo?"true":"false"),"autoplay="+(d?"true":"false"),"preload="+e,"width="+
g,"startvolume="+b.startVolume,"timerrate="+b.timerRate,"flashstreamer="+b.flashStreamer,"height="+h,"pseudostreamstart="+b.pseudoStreamingStartQueryParam];if(a.url!==null)a.method=="flash"?d.push("file="+mejs.Utility.encodeUrl(a.url)):d.push("file="+a.url);b.enablePluginDebug&&d.push("debug=true");b.enablePluginSmoothing&&d.push("smoothing=true");b.enablePseudoStreaming&&d.push("pseudostreaming=true");f&&d.push("controls=true");if(b.pluginVars)d=d.concat(b.pluginVars);switch(a.method){case "silverlight":k.innerHTML=
'<object data="data:application/x-silverlight-2," type="application/x-silverlight-2" id="'+l+'" name="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="initParams" value="'+d.join(",")+'" /><param name="windowless" value="true" /><param name="background" value="black" /><param name="minRuntimeVersion" value="3.0.0.0" /><param name="autoUpgrade" value="true" /><param name="source" value="'+b.pluginPath+b.silverlightName+'" /></object>';break;case "flash":if(mejs.MediaFeatures.isIE){a=
document.createElement("div");k.appendChild(a);a.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+l+'" width="'+g+'" height="'+h+'" class="mejs-shim"><param name="movie" value="'+b.pluginPath+b.flashName+"?x="+new Date+'" /><param name="flashvars" value="'+d.join("&amp;")+'" /><param name="quality" value="high" /><param name="bgcolor" value="#000000" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else k.innerHTML=
'<embed id="'+l+'" name="'+l+'" play="true" loop="false" quality="high" bgcolor="#000000" wmode="transparent" allowScriptAccess="always" allowFullScreen="true" type="application/x-shockwave-flash" pluginspage="//www.macromedia.com/go/getflashplayer" src="'+b.pluginPath+b.flashName+'" flashvars="'+d.join("&")+'" width="'+g+'" height="'+h+'" class="mejs-shim"></embed>';break;case "youtube":b=a.url.substr(a.url.lastIndexOf("=")+1);youtubeSettings={container:k,containerId:k.id,pluginMediaElement:j,pluginId:l,
videoId:b,height:h,width:g};mejs.PluginDetector.hasPluginVersion("flash",[10,0,0])?mejs.YouTubeApi.createFlash(youtubeSettings):mejs.YouTubeApi.enqueueIframe(youtubeSettings);break;case "vimeo":j.vimeoid=a.url.substr(a.url.lastIndexOf("/")+1);k.innerHTML='<iframe src="http://player.vimeo.com/video/'+j.vimeoid+'?portrait=0&byline=0&title=0" width="'+g+'" height="'+h+'" frameborder="0" class="mejs-shim"></iframe>'}c.style.display="none";c.removeAttribute("autoplay");return j},updateNative:function(a,
b){var c=a.htmlMediaElement,d;for(d in mejs.HtmlMediaElement)c[d]=mejs.HtmlMediaElement[d];b.success(c,c);return c}};
mejs.YouTubeApi={isIframeStarted:false,isIframeLoaded:false,loadIframeApi:function(){if(!this.isIframeStarted){var a=document.createElement("script");a.src="//www.youtube.com/player_api";var b=document.getElementsByTagName("script")[0];b.parentNode.insertBefore(a,b);this.isIframeStarted=true}},iframeQueue:[],enqueueIframe:function(a){if(this.isLoaded)this.createIframe(a);else{this.loadIframeApi();this.iframeQueue.push(a)}},createIframe:function(a){var b=a.pluginMediaElement,c=new YT.Player(a.containerId,
{height:a.height,width:a.width,videoId:a.videoId,playerVars:{controls:0},events:{onReady:function(){a.pluginMediaElement.pluginApi=c;mejs.MediaPluginBridge.initPlugin(a.pluginId);setInterval(function(){mejs.YouTubeApi.createEvent(c,b,"timeupdate")},250)},onStateChange:function(d){mejs.YouTubeApi.handleStateChange(d.data,c,b)}}})},createEvent:function(a,b,c){c={type:c,target:b};if(a&&a.getDuration){b.currentTime=c.currentTime=a.getCurrentTime();b.duration=c.duration=a.getDuration();c.paused=b.paused;
c.ended=b.ended;c.muted=a.isMuted();c.volume=a.getVolume()/100;c.bytesTotal=a.getVideoBytesTotal();c.bufferedBytes=a.getVideoBytesLoaded();var d=c.bufferedBytes/c.bytesTotal*c.duration;c.target.buffered=c.buffered={start:function(){return 0},end:function(){return d},length:1}}b.dispatchEvent(c.type,c)},iFrameReady:function(){for(this.isIframeLoaded=this.isLoaded=true;this.iframeQueue.length>0;)this.createIframe(this.iframeQueue.pop())},flashPlayers:{},createFlash:function(a){this.flashPlayers[a.pluginId]=
a;var b,c="//www.youtube.com/apiplayer?enablejsapi=1&amp;playerapiid="+a.pluginId+"&amp;version=3&amp;autoplay=0&amp;controls=0&amp;modestbranding=1&loop=0";if(mejs.MediaFeatures.isIE){b=document.createElement("div");a.container.appendChild(b);b.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" id="'+a.pluginId+'" width="'+a.width+'" height="'+a.height+'" class="mejs-shim"><param name="movie" value="'+
c+'" /><param name="wmode" value="transparent" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /></object>'}else a.container.innerHTML='<object type="application/x-shockwave-flash" id="'+a.pluginId+'" data="'+c+'" width="'+a.width+'" height="'+a.height+'" style="visibility: visible; " class="mejs-shim"><param name="allowScriptAccess" value="always"><param name="wmode" value="transparent"></object>'},flashReady:function(a){var b=this.flashPlayers[a],c=
document.getElementById(a),d=b.pluginMediaElement;d.pluginApi=d.pluginElement=c;mejs.MediaPluginBridge.initPlugin(a);c.cueVideoById(b.videoId);a=b.containerId+"_callback";window[a]=function(e){mejs.YouTubeApi.handleStateChange(e,c,d)};c.addEventListener("onStateChange",a);setInterval(function(){mejs.YouTubeApi.createEvent(c,d,"timeupdate")},250)},handleStateChange:function(a,b,c){switch(a){case -1:c.paused=true;c.ended=true;mejs.YouTubeApi.createEvent(b,c,"loadedmetadata");break;case 0:c.paused=false;
c.ended=true;mejs.YouTubeApi.createEvent(b,c,"ended");break;case 1:c.paused=false;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"play");mejs.YouTubeApi.createEvent(b,c,"playing");break;case 2:c.paused=true;c.ended=false;mejs.YouTubeApi.createEvent(b,c,"pause");break;case 3:mejs.YouTubeApi.createEvent(b,c,"progress")}}};function onYouTubePlayerAPIReady(){mejs.YouTubeApi.iFrameReady()}function onYouTubePlayerReady(a){mejs.YouTubeApi.flashReady(a)}window.mejs=mejs;window.MediaElement=mejs.MediaElement;
(function(a,b){var c={locale:{language:"",strings:{}},methods:{}};c.locale.getLanguage=function(){return c.locale.language||navigator.language};if(typeof mejsL10n!="undefined")c.locale.language=mejsL10n.language;c.locale.INIT_LANGUAGE=c.locale.getLanguage();c.methods.checkPlain=function(d){var e,f,g={"&":"&amp;",'"':"&quot;","<":"&lt;",">":"&gt;"};d=String(d);for(e in g)if(g.hasOwnProperty(e)){f=RegExp(e,"g");d=d.replace(f,g[e])}return d};c.methods.formatString=function(d,e){for(var f in e){switch(f.charAt(0)){case "@":e[f]=
c.methods.checkPlain(e[f]);break;case "!":break;default:e[f]='<em class="placeholder">'+c.methods.checkPlain(e[f])+"</em>"}d=d.replace(f,e[f])}return d};c.methods.t=function(d,e,f){if(c.locale.strings&&c.locale.strings[f.context]&&c.locale.strings[f.context][d])d=c.locale.strings[f.context][d];if(e)d=c.methods.formatString(d,e);return d};c.t=function(d,e,f){if(typeof d==="string"&&d.length>0){var g=c.locale.getLanguage();f=f||{context:g};return c.methods.t(d,e,f)}else throw{name:"InvalidArgumentException",
message:"First argument is either not a string or empty."};};b.i18n=c})(document,mejs);(function(a){if(typeof mejsL10n!="undefined")a[mejsL10n.language]=mejsL10n.strings})(mejs.i18n.locale.strings);(function(a){a.de={Fullscreen:"Vollbild","Go Fullscreen":"Vollbild an","Turn off Fullscreen":"Vollbild aus",Close:"Schlie\u00dfen"}})(mejs.i18n.locale.strings);
(function(a){a.zh={Fullscreen:"\u5168\u87a2\u5e55","Go Fullscreen":"\u5168\u5c4f\u6a21\u5f0f","Turn off Fullscreen":"\u9000\u51fa\u5168\u5c4f\u6a21\u5f0f",Close:"\u95dc\u9589"}})(mejs.i18n.locale.strings);

@ -0,0 +1,870 @@
.mejs-container {
position: relative;
background: #000;
font-family: Helvetica, Arial;
text-align: left;
vertical-align: top;
text-indent: 0;
}
.me-plugin {
position: absolute;
}
.mejs-embed, .mejs-embed body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background: #000;
overflow: hidden;
}
.mejs-fullscreen {
/* set it to not show scroll bars so 100% will work */
overflow: hidden !important;
}
.mejs-container-fullscreen {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
z-index: 1000;
}
.mejs-container-fullscreen .mejs-mediaelement,
.mejs-container-fullscreen video {
width: 100%;
height: 100%;
}
.mejs-clear {
clear: both;
}
/* Start: LAYERS */
.mejs-background {
position: absolute;
top: 0;
left: 0;
}
.mejs-mediaelement {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
.mejs-poster {
position: absolute;
top: 0;
left: 0;
background-size: contain ;
background-position: 50% 50% ;
background-repeat: no-repeat ;
}
:root .mejs-poster img {
display: none ;
}
.mejs-poster img {
border: 0;
padding: 0;
border: 0;
}
.mejs-overlay {
position: absolute;
top: 0;
left: 0;
}
.mejs-overlay-play {
cursor: pointer;
}
.mejs-overlay-button {
position: absolute;
top: 50%;
left: 50%;
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
background: url(bigplay.svg) no-repeat;
}
.no-svg .mejs-overlay-button {
background-image: url(bigplay.png);
}
.mejs-overlay:hover .mejs-overlay-button {
background-position: 0 -100px ;
}
.mejs-overlay-loading {
position: absolute;
top: 50%;
left: 50%;
width: 80px;
height: 80px;
margin: -40px 0 0 -40px;
background: #333;
background: url(background.png);
background: rgba(0, 0, 0, 0.9);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.9)), to(rgba(0,0,0,0.9)));
background: -webkit-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
background: -moz-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
background: -o-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
background: -ms-linear-gradient(top, rgba(50,50,50,0.9), rgba(0,0,0,0.9));
background: linear-gradient(rgba(50,50,50,0.9), rgba(0,0,0,0.9));
}
.mejs-overlay-loading span {
display: block;
width: 80px;
height: 80px;
background: transparent url(loading.gif) 50% 50% no-repeat;
}
/* End: LAYERS */
/* Start: CONTROL BAR */
.mejs-container .mejs-controls {
position: absolute;
list-style-type: none;
margin: 0;
padding: 0;
bottom: 0;
left: 0;
background: url(background.png);
background: rgba(0, 0, 0, 0.7);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
background: -webkit-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
height: 30px;
width: 100%;
}
.mejs-container .mejs-controls div {
list-style-type: none;
background-image: none;
display: block;
float: left;
margin: 0;
padding: 0;
width: 26px;
height: 26px;
font-size: 11px;
line-height: 11px;
font-family: Helvetica, Arial;
border: 0;
}
.mejs-controls .mejs-button button {
cursor: pointer;
display: block;
font-size: 0;
line-height: 0;
text-decoration: none;
margin: 7px 5px;
padding: 0;
position: absolute;
height: 16px;
width: 16px;
border: 0;
background: transparent url(controls.svg) no-repeat;
}
.no-svg .mejs-controls .mejs-button button {
background-image: url(controls.png);
}
/* :focus for accessibility */
.mejs-controls .mejs-button button:focus {
outline: solid 1px yellow;
}
/* End: CONTROL BAR */
/* Start: Time (Current / Duration) */
.mejs-container .mejs-controls .mejs-time {
color: #fff;
display: block;
height: 17px;
width: auto;
padding: 8px 3px 0 3px ;
overflow: hidden;
text-align: center;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
.mejs-container .mejs-controls .mejs-time span {
color: #fff;
font-size: 11px;
line-height: 12px;
display: block;
float: left;
margin: 1px 2px 0 0;
width: auto;
}
/* End: Time (Current / Duration) */
/* Start: Play/Pause/Stop */
.mejs-controls .mejs-play button {
background-position: 0 0;
}
.mejs-controls .mejs-pause button {
background-position: 0 -16px;
}
.mejs-controls .mejs-stop button {
background-position: -112px 0;
}
/* Start: Play/Pause/Stop */
/* Start: Progress Bar */
.mejs-controls div.mejs-time-rail {
direction: ltr;
width: 200px;
padding-top: 5px;
}
.mejs-controls .mejs-time-rail span {
display: block;
position: absolute;
width: 180px;
height: 10px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
cursor: pointer;
}
.mejs-controls .mejs-time-rail .mejs-time-total {
margin: 5px;
background: #333;
background: rgba(50,50,50,0.8);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
}
.mejs-controls .mejs-time-rail .mejs-time-buffering {
width: 100%;
background-image: -o-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -webkit-gradient(linear, 0 100%, 100% 0, color-stop(0.25, rgba(255, 255, 255, 0.15)), color-stop(0.25, transparent), color-stop(0.5, transparent), color-stop(0.5, rgba(255, 255, 255, 0.15)), color-stop(0.75, rgba(255, 255, 255, 0.15)), color-stop(0.75, transparent), to(transparent));
background-image: -webkit-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -moz-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -ms-linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(-45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-webkit-background-size: 15px 15px;
-moz-background-size: 15px 15px;
-o-background-size: 15px 15px;
background-size: 15px 15px;
-webkit-animation: buffering-stripes 2s linear infinite;
-moz-animation: buffering-stripes 2s linear infinite;
-ms-animation: buffering-stripes 2s linear infinite;
-o-animation: buffering-stripes 2s linear infinite;
animation: buffering-stripes 2s linear infinite;
}
@-webkit-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@-moz-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@-ms-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@-o-keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
@keyframes buffering-stripes { from {background-position: 0 0;} to {background-position: 30px 0;} }
.mejs-controls .mejs-time-rail .mejs-time-loaded {
background: #3caac8;
background: rgba(60,170,200,0.8);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(44,124,145,0.8)), to(rgba(78,183,212,0.8)));
background: -webkit-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
background: -moz-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
background: -o-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
background: -ms-linear-gradient(top, rgba(44,124,145,0.8), rgba(78,183,212,0.8));
background: linear-gradient(rgba(44,124,145,0.8), rgba(78,183,212,0.8));
width: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-current {
background: #fff;
background: rgba(255,255,255,0.8);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
width: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-handle {
display: none;
position: absolute;
margin: 0;
width: 10px;
background: #fff;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
cursor: pointer;
border: solid 2px #333;
top: -2px;
text-align: center;
}
.mejs-controls .mejs-time-rail .mejs-time-float {
position: absolute;
display: none;
background: #eee;
width: 36px;
height: 17px;
border: solid 1px #333;
top: -26px;
margin-left: -18px;
text-align: center;
color: #111;
}
.mejs-controls .mejs-time-rail .mejs-time-float-current {
margin: 2px;
width: 30px;
display: block;
text-align: center;
left: 0;
}
.mejs-controls .mejs-time-rail .mejs-time-float-corner {
position: absolute;
display: block;
width: 0;
height: 0;
line-height: 0;
border: solid 5px #eee;
border-color: #eee transparent transparent transparent;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
top: 15px;
left: 13px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float {
width: 48px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-current {
width: 44px;
}
.mejs-long-video .mejs-controls .mejs-time-rail .mejs-time-float-corner {
left: 18px;
}
/*
.mejs-controls .mejs-time-rail:hover .mejs-time-handle {
visibility:visible;
}
*/
/* End: Progress Bar */
/* Start: Fullscreen */
.mejs-controls .mejs-fullscreen-button button {
background-position: -32px 0;
}
.mejs-controls .mejs-unfullscreen button {
background-position: -32px -16px;
}
/* End: Fullscreen */
/* Start: Mute/Volume */
.mejs-controls .mejs-volume-button {
}
.mejs-controls .mejs-mute button {
background-position: -16px -16px;
}
.mejs-controls .mejs-unmute button {
background-position: -16px 0;
}
.mejs-controls .mejs-volume-button {
position: relative;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider {
display: none;
height: 115px;
width: 25px;
background: url(background.png);
background: rgba(50, 50, 50, 0.7);
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
top: -115px;
left: 0;
z-index: 1;
position: absolute;
margin: 0;
}
.mejs-controls .mejs-volume-button:hover {
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
border-radius: 0 0 4px 4px;
}
/*
.mejs-controls .mejs-volume-button:hover .mejs-volume-slider {
display: block;
}
*/
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-total {
position: absolute;
left: 11px;
top: 8px;
width: 2px;
height: 100px;
background: #ddd;
background: rgba(255, 255, 255, 0.5);
margin: 0;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-current {
position: absolute;
left: 11px;
top: 8px;
width: 2px;
height: 100px;
background: #ddd;
background: rgba(255, 255, 255, 0.9);
margin: 0;
}
.mejs-controls .mejs-volume-button .mejs-volume-slider .mejs-volume-handle {
position: absolute;
left: 4px;
top: -3px;
width: 16px;
height: 6px;
background: #ddd;
background: rgba(255, 255, 255, 0.9);
cursor: N-resize;
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
border-radius: 1px;
margin: 0;
}
/* horizontal version */
.mejs-controls div.mejs-horizontal-volume-slider {
height: 26px;
width: 60px;
position: relative;
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-total {
position: absolute;
left: 0;
top: 11px;
width: 50px;
height: 8px;
margin: 0;
padding: 0;
font-size: 1px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background: #333;
background: rgba(50,50,50,0.8);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(30,30,30,0.8)), to(rgba(60,60,60,0.8)));
background: -webkit-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: -moz-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: -o-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: -ms-linear-gradient(top, rgba(30,30,30,0.8), rgba(60,60,60,0.8));
background: linear-gradient(rgba(30,30,30,0.8), rgba(60,60,60,0.8));
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-current {
position: absolute;
left: 0;
top: 11px;
width: 50px;
height: 8px;
margin: 0;
padding: 0;
font-size: 1px;
-webkit-border-radius: 2px;
-moz-border-radius: 2px;
border-radius: 2px;
background: #fff;
background: rgba(255,255,255,0.8);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(255,255,255,0.9)), to(rgba(200,200,200,0.8)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: -moz-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: -o-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: -ms-linear-gradient(top, rgba(255,255,255,0.9), rgba(200,200,200,0.8));
background: linear-gradient(rgba(255,255,255,0.9), rgba(200,200,200,0.8));
}
.mejs-controls .mejs-horizontal-volume-slider .mejs-horizontal-volume-handle {
display: none;
}
/* End: Mute/Volume */
/* Start: Track (Captions and Chapters) */
.mejs-controls .mejs-captions-button {
position: relative;
}
.mejs-controls .mejs-captions-button button {
background-position: -48px 0;
}
.mejs-controls .mejs-captions-button .mejs-captions-selector {
visibility: hidden;
position: absolute;
bottom: 26px;
right: -10px;
width: 130px;
height: 100px;
background: url(background.png);
background: rgba(50,50,50,0.7);
border: solid 1px transparent;
padding: 10px;
overflow: hidden;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
/*
.mejs-controls .mejs-captions-button:hover .mejs-captions-selector {
visibility: visible;
}
*/
.mejs-controls .mejs-captions-button .mejs-captions-selector ul {
margin: 0;
padding: 0;
display: block;
list-style-type: none !important;
overflow: hidden;
}
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li {
margin: 0 0 6px 0;
padding: 0;
list-style-type: none !important;
display: block;
color: #fff;
overflow: hidden;
}
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li input {
clear: both;
float: left;
margin: 3px 3px 0 5px;
}
.mejs-controls .mejs-captions-button .mejs-captions-selector ul li label {
width: 100px;
float: left;
padding: 4px 0 0 0;
line-height: 15px;
font-family: helvetica, arial;
font-size: 10px;
}
.mejs-controls .mejs-captions-button .mejs-captions-translations {
font-size: 10px;
margin: 0 0 5px 0;
}
.mejs-chapters {
position: absolute;
top: 0;
left: 0;
-xborder-right: solid 1px #fff;
width: 10000px;
z-index: 1;
}
.mejs-chapters .mejs-chapter {
position: absolute;
float: left;
background: #222;
background: rgba(0, 0, 0, 0.7);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(50,50,50,0.7)), to(rgba(0,0,0,0.7)));
background: -webkit-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: -moz-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: -o-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: -ms-linear-gradient(top, rgba(50,50,50,0.7), rgba(0,0,0,0.7));
background: linear-gradient(rgba(50,50,50,0.7), rgba(0,0,0,0.7));
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#323232,endColorstr=#000000);
overflow: hidden;
border: 0;
}
.mejs-chapters .mejs-chapter .mejs-chapter-block {
font-size: 11px;
color: #fff;
padding: 5px;
display: block;
border-right: solid 1px #333;
border-bottom: solid 1px #333;
cursor: pointer;
}
.mejs-chapters .mejs-chapter .mejs-chapter-block-last {
border-right: none;
}
.mejs-chapters .mejs-chapter .mejs-chapter-block:hover {
background: #666;
background: rgba(102,102,102, 0.7);
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(rgba(102,102,102,0.7)), to(rgba(50,50,50,0.6)));
background: -webkit-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
background: -moz-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
background: -o-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
background: -ms-linear-gradient(top, rgba(102,102,102,0.7), rgba(50,50,50,0.6));
background: linear-gradient(rgba(102,102,102,0.7), rgba(50,50,50,0.6));
filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr=#666666,endColorstr=#323232);
}
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-title {
font-size: 12px;
font-weight: bold;
display: block;
white-space: nowrap;
text-overflow: ellipsis;
margin: 0 0 3px 0;
line-height: 12px;
}
.mejs-chapters .mejs-chapter .mejs-chapter-block .ch-timespan {
font-size: 12px;
line-height: 12px;
margin: 3px 0 4px 0;
display: block;
white-space: nowrap;
text-overflow: ellipsis;
}
.mejs-captions-layer {
position: absolute;
bottom: 0;
left: 0;
text-align:center;
line-height: 22px;
font-size: 12px;
color: #fff;
}
.mejs-captions-layer a {
color: #fff;
text-decoration: underline;
}
.mejs-captions-layer[lang=ar] {
font-size: 20px;
font-weight: normal;
}
.mejs-captions-position {
position: absolute;
width: 100%;
bottom: 15px;
left: 0;
}
.mejs-captions-position-hover {
bottom: 45px;
}
.mejs-captions-text {
padding: 3px 5px;
background: url(background.png);
background: rgba(20, 20, 20, 0.8);
}
/* End: Track (Captions and Chapters) */
/* Start: Error */
.me-cannotplay {
}
.me-cannotplay a {
color: #fff;
font-weight: bold;
}
.me-cannotplay span {
padding: 15px;
display: block;
}
/* End: Error */
/* Start: Loop */
.mejs-controls .mejs-loop-off button {
background-position: -64px -16px;
}
.mejs-controls .mejs-loop-on button {
background-position: -64px 0;
}
/* End: Loop */
/* Start: backlight */
.mejs-controls .mejs-backlight-off button {
background-position: -80px -16px;
}
.mejs-controls .mejs-backlight-on button {
background-position: -80px 0;
}
/* End: backlight */
/* Start: Picture Controls */
.mejs-controls .mejs-picturecontrols-button {
background-position: -96px 0;
}
/* End: Picture Controls */
/* context menu */
.mejs-contextmenu {
position: absolute;
width: 150px;
padding: 10px;
border-radius: 4px;
top: 0;
left: 0;
background: #fff;
border: solid 1px #999;
z-index: 1001; /* make sure it shows on fullscreen */
}
.mejs-contextmenu .mejs-contextmenu-separator {
height: 1px;
font-size: 0;
margin: 5px 6px;
background: #333;
}
.mejs-contextmenu .mejs-contextmenu-item {
font-family: Helvetica, Arial;
font-size: 12px;
padding: 4px 6px;
cursor: pointer;
color: #333;
}
.mejs-contextmenu .mejs-contextmenu-item:hover {
background: #2C7C91;
color: #fff;
}
/* Start: Source Chooser */
.mejs-controls .mejs-sourcechooser-button {
position: relative;
}
.mejs-controls .mejs-sourcechooser-button button {
background-position: -128px 0;
}
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector {
visibility: hidden;
position: absolute;
bottom: 26px;
right: -10px;
width: 130px;
height: 100px;
background: url(background.png);
background: rgba(50,50,50,0.7);
border: solid 1px transparent;
padding: 10px;
overflow: hidden;
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul {
margin: 0;
padding: 0;
display: block;
list-style-type: none !important;
overflow: hidden;
}
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li {
margin: 0 0 6px 0;
padding: 0;
list-style-type: none !important;
display: block;
color: #fff;
overflow: hidden;
}
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li input {
clear: both;
float: left;
margin: 3px 3px 0 5px;
}
.mejs-controls .mejs-sourcechooser-button .mejs-sourcechooser-selector ul li label {
width: 100px;
float: left;
padding: 4px 0 0 0;
line-height: 15px;
font-family: helvetica, arial;
font-size: 10px;
}
/* End: Source Chooser */
/* Start: Postroll */
.mejs-postroll-layer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
background: url(background.png);
background: rgba(50,50,50,0.7);
z-index: 1000;
overflow: hidden;
}
.mejs-postroll-layer-content {
width: 100%;
height: 100%;
}
.mejs-postroll-close {
position: absolute;
right: 0;
top: 0;
background: url(background.png);
background: rgba(50,50,50,0.7);
color: #fff;
padding: 4px;
z-index: 100;
cursor: pointer;
}
/* End: Postroll */

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

@ -0,0 +1,103 @@
/*!
* MediaElementPlayer
* http://mediaelementjs.com/
*
* Creates a controller bar for HTML5 <video> add <audio> tags
* using jQuery and MediaElement.js (HTML5 Flash/Silverlight wrapper)
*
* Copyright 2010-2013, John Dyer (http://j.hn/)
* License: MIT
*
*/if(typeof jQuery!="undefined")mejs.$=jQuery;else if(typeof ender!="undefined")mejs.$=ender;
(function(f){mejs.MepDefaults={poster:"",showPosterWhenEnded:false,defaultVideoWidth:480,defaultVideoHeight:270,videoWidth:-1,videoHeight:-1,defaultAudioWidth:400,defaultAudioHeight:30,defaultSeekBackwardInterval:function(a){return a.duration*0.05},defaultSeekForwardInterval:function(a){return a.duration*0.05},audioWidth:-1,audioHeight:-1,startVolume:0.8,loop:false,autoRewind:true,enableAutosize:true,alwaysShowHours:false,showTimecodeFrameCount:false,framesPerSecond:25,autosizeProgress:true,alwaysShowControls:false,
hideVideoControlsOnLoad:false,clickToPlayPause:true,iPadUseNativeControls:false,iPhoneUseNativeControls:false,AndroidUseNativeControls:false,features:["playpause","current","progress","duration","tracks","volume","fullscreen"],isVideo:true,enableKeyboard:true,pauseOtherPlayers:true,keyActions:[{keys:[32,179],action:function(a,b){b.paused||b.ended?b.play():b.pause()}},{keys:[38],action:function(a,b){b.setVolume(Math.min(b.volume+0.1,1))}},{keys:[40],action:function(a,b){b.setVolume(Math.max(b.volume-
0.1,0))}},{keys:[37,227],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.max(b.currentTime-a.options.defaultSeekBackwardInterval(b),0);b.setCurrentTime(c)}}},{keys:[39,228],action:function(a,b){if(!isNaN(b.duration)&&b.duration>0){if(a.isVideo){a.showControls();a.startControlsTimer()}var c=Math.min(b.currentTime+a.options.defaultSeekForwardInterval(b),b.duration);b.setCurrentTime(c)}}},{keys:[70],action:function(a){if(typeof a.enterFullScreen!=
"undefined")a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}}]};mejs.mepIndex=0;mejs.players={};mejs.MediaElementPlayer=function(a,b){if(!(this instanceof mejs.MediaElementPlayer))return new mejs.MediaElementPlayer(a,b);this.$media=this.$node=f(a);this.node=this.media=this.$media[0];if(typeof this.node.player!="undefined")return this.node.player;else this.node.player=this;if(typeof b=="undefined")b=this.$node.data("mejsoptions");this.options=f.extend({},mejs.MepDefaults,b);this.id="mep_"+mejs.mepIndex++;
mejs.players[this.id]=this;this.init();return this};mejs.MediaElementPlayer.prototype={hasFocus:false,controlsAreVisible:true,init:function(){var a=this,b=mejs.MediaFeatures,c=f.extend(true,{},a.options,{success:function(d,g){a.meReady(d,g)},error:function(d){a.handleError(d)}}),e=a.media.tagName.toLowerCase();a.isDynamic=e!=="audio"&&e!=="video";a.isVideo=a.isDynamic?a.options.isVideo:e!=="audio"&&a.options.isVideo;if(b.isiPad&&a.options.iPadUseNativeControls||b.isiPhone&&a.options.iPhoneUseNativeControls){a.$media.attr("controls",
"controls");if(b.isiPad&&a.media.getAttribute("autoplay")!==null){a.media.load();a.media.play()}}else if(!(b.isAndroid&&a.options.AndroidUseNativeControls)){a.$media.removeAttr("controls");a.container=f('<div id="'+a.id+'" class="mejs-container '+(mejs.MediaFeatures.svg?"svg":"no-svg")+'"><div class="mejs-inner"><div class="mejs-mediaelement"></div><div class="mejs-layers"></div><div class="mejs-controls"></div><div class="mejs-clear"></div></div></div>').addClass(a.$media[0].className).insertBefore(a.$media);
a.container.addClass((b.isAndroid?"mejs-android ":"")+(b.isiOS?"mejs-ios ":"")+(b.isiPad?"mejs-ipad ":"")+(b.isiPhone?"mejs-iphone ":"")+(a.isVideo?"mejs-video ":"mejs-audio "));if(b.isiOS){b=a.$media.clone();a.container.find(".mejs-mediaelement").append(b);a.$media.remove();a.$node=a.$media=b;a.node=a.media=b[0]}else a.container.find(".mejs-mediaelement").append(a.$media);a.controls=a.container.find(".mejs-controls");a.layers=a.container.find(".mejs-layers");b=a.isVideo?"video":"audio";e=b.substring(0,
1).toUpperCase()+b.substring(1);a.width=a.options[b+"Width"]>0||a.options[b+"Width"].toString().indexOf("%")>-1?a.options[b+"Width"]:a.media.style.width!==""&&a.media.style.width!==null?a.media.style.width:a.media.getAttribute("width")!==null?a.$media.attr("width"):a.options["default"+e+"Width"];a.height=a.options[b+"Height"]>0||a.options[b+"Height"].toString().indexOf("%")>-1?a.options[b+"Height"]:a.media.style.height!==""&&a.media.style.height!==null?a.media.style.height:a.$media[0].getAttribute("height")!==
null?a.$media.attr("height"):a.options["default"+e+"Height"];a.setPlayerSize(a.width,a.height);c.pluginWidth=a.width;c.pluginHeight=a.height}mejs.MediaElement(a.$media[0],c);typeof a.container!="undefined"&&a.controlsAreVisible&&a.container.trigger("controlsshown")},showControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!b.controlsAreVisible){if(a){b.controls.css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true;b.container.trigger("controlsshown")});
b.container.find(".mejs-control").css("visibility","visible").stop(true,true).fadeIn(200,function(){b.controlsAreVisible=true})}else{b.controls.css("visibility","visible").css("display","block");b.container.find(".mejs-control").css("visibility","visible").css("display","block");b.controlsAreVisible=true;b.container.trigger("controlsshown")}b.setControlsSize()}},hideControls:function(a){var b=this;a=typeof a=="undefined"||a;if(!(!b.controlsAreVisible||b.options.alwaysShowControls))if(a){b.controls.stop(true,
true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")});b.container.find(".mejs-control").stop(true,true).fadeOut(200,function(){f(this).css("visibility","hidden").css("display","block")})}else{b.controls.css("visibility","hidden").css("display","block");b.container.find(".mejs-control").css("visibility","hidden").css("display","block");b.controlsAreVisible=false;b.container.trigger("controlshidden")}},
controlsTimer:null,startControlsTimer:function(a){var b=this;a=typeof a!="undefined"?a:1500;b.killControlsTimer("start");b.controlsTimer=setTimeout(function(){b.hideControls();b.killControlsTimer("hide")},a)},killControlsTimer:function(){if(this.controlsTimer!==null){clearTimeout(this.controlsTimer);delete this.controlsTimer;this.controlsTimer=null}},controlsEnabled:true,disableControls:function(){this.killControlsTimer();this.hideControls(false);this.controlsEnabled=false},enableControls:function(){this.showControls(false);
this.controlsEnabled=true},meReady:function(a,b){var c=this,e=mejs.MediaFeatures,d=b.getAttribute("autoplay");d=!(typeof d=="undefined"||d===null||d==="false");var g;if(!c.created){c.created=true;c.media=a;c.domNode=b;if(!(e.isAndroid&&c.options.AndroidUseNativeControls)&&!(e.isiPad&&c.options.iPadUseNativeControls)&&!(e.isiPhone&&c.options.iPhoneUseNativeControls)){c.buildposter(c,c.controls,c.layers,c.media);c.buildkeyboard(c,c.controls,c.layers,c.media);c.buildoverlays(c,c.controls,c.layers,c.media);
c.findTracks();for(g in c.options.features){e=c.options.features[g];if(c["build"+e])try{c["build"+e](c,c.controls,c.layers,c.media)}catch(k){}}c.container.trigger("controlsready");c.setPlayerSize(c.width,c.height);c.setControlsSize();if(c.isVideo){if(mejs.MediaFeatures.hasTouch)c.$media.bind("touchstart",function(){if(c.controlsAreVisible)c.hideControls(false);else c.controlsEnabled&&c.showControls(false)});else{mejs.MediaElementPlayer.prototype.clickToPlayPauseCallback=function(){if(c.options.clickToPlayPause)c.media.paused?
c.media.play():c.media.pause()};c.media.addEventListener("click",c.clickToPlayPauseCallback,false);c.container.bind("mouseenter mouseover",function(){if(c.controlsEnabled)if(!c.options.alwaysShowControls){c.killControlsTimer("enter");c.showControls();c.startControlsTimer(2500)}}).bind("mousemove",function(){if(c.controlsEnabled){c.controlsAreVisible||c.showControls();c.options.alwaysShowControls||c.startControlsTimer(2500)}}).bind("mouseleave",function(){c.controlsEnabled&&!c.media.paused&&!c.options.alwaysShowControls&&
c.startControlsTimer(1E3)})}c.options.hideVideoControlsOnLoad&&c.hideControls(false);d&&!c.options.alwaysShowControls&&c.hideControls();c.options.enableAutosize&&c.media.addEventListener("loadedmetadata",function(j){if(c.options.videoHeight<=0&&c.domNode.getAttribute("height")===null&&!isNaN(j.target.videoHeight)){c.setPlayerSize(j.target.videoWidth,j.target.videoHeight);c.setControlsSize();c.media.setVideoSize(j.target.videoWidth,j.target.videoHeight)}},false)}a.addEventListener("play",function(){for(var j in mejs.players){var m=
mejs.players[j];m.id!=c.id&&c.options.pauseOtherPlayers&&!m.paused&&!m.ended&&m.pause();m.hasFocus=false}c.hasFocus=true},false);c.media.addEventListener("ended",function(){if(c.options.autoRewind)try{c.media.setCurrentTime(0)}catch(j){}c.media.pause();c.setProgressRail&&c.setProgressRail();c.setCurrentRail&&c.setCurrentRail();if(c.options.loop)c.media.play();else!c.options.alwaysShowControls&&c.controlsEnabled&&c.showControls()},false);c.media.addEventListener("loadedmetadata",function(){c.updateDuration&&
c.updateDuration();c.updateCurrent&&c.updateCurrent();if(!c.isFullScreen){c.setPlayerSize(c.width,c.height);c.setControlsSize()}},false);setTimeout(function(){c.setPlayerSize(c.width,c.height);c.setControlsSize()},50);c.globalBind("resize",function(){c.isFullScreen||mejs.MediaFeatures.hasTrueNativeFullScreen&&document.webkitIsFullScreen||c.setPlayerSize(c.width,c.height);c.setControlsSize()});c.media.pluginType=="youtube"&&c.container.find(".mejs-overlay-play").hide()}if(d&&a.pluginType=="native"){a.load();
a.play()}if(c.options.success)typeof c.options.success=="string"?window[c.options.success](c.media,c.domNode,c):c.options.success(c.media,c.domNode,c)}},handleError:function(a){this.controls.hide();this.options.error&&this.options.error(a)},setPlayerSize:function(a,b){if(typeof a!="undefined")this.width=a;if(typeof b!="undefined")this.height=b;if(this.height.toString().indexOf("%")>0||this.$node.css("max-width")==="100%"||parseInt(this.$node.css("max-width").replace(/px/,""),10)/this.$node.offsetParent().width()===
1||this.$node[0].currentStyle&&this.$node[0].currentStyle.maxWidth==="100%"){var c=this.isVideo?this.media.videoWidth&&this.media.videoWidth>0?this.media.videoWidth:this.options.defaultVideoWidth:this.options.defaultAudioWidth,e=this.isVideo?this.media.videoHeight&&this.media.videoHeight>0?this.media.videoHeight:this.options.defaultVideoHeight:this.options.defaultAudioHeight,d=this.container.parent().closest(":visible").width();c=this.isVideo||!this.options.autosizeProgress?parseInt(d*e/c,10):e;if(this.container.parent()[0].tagName.toLowerCase()===
"body"){d=f(window).width();c=f(window).height()}if(c!=0&&d!=0){this.container.width(d).height(c);this.$media.add(this.container.find(".mejs-shim")).width("100%").height("100%");this.isVideo&&this.media.setVideoSize&&this.media.setVideoSize(d,c);this.layers.children(".mejs-layer").width("100%").height("100%")}}else{this.container.width(this.width).height(this.height);this.layers.children(".mejs-layer").width(this.width).height(this.height)}d=this.layers.find(".mejs-overlay-play");c=d.find(".mejs-overlay-button");
d.height(this.container.height()-this.controls.height());c.css("margin-top","-"+(c.height()/2-this.controls.height()/2).toString()+"px")},setControlsSize:function(){var a=0,b=0,c=this.controls.find(".mejs-time-rail"),e=this.controls.find(".mejs-time-total");this.controls.find(".mejs-time-current");this.controls.find(".mejs-time-loaded");var d=c.siblings();if(this.options&&!this.options.autosizeProgress)b=parseInt(c.css("width"));if(b===0||!b){d.each(function(){var g=f(this);if(g.css("position")!=
"absolute"&&g.is(":visible"))a+=f(this).outerWidth(true)});b=this.controls.width()-a-(c.outerWidth(true)-c.width())}c.width(b);e.width(b-(e.outerWidth(true)-e.width()));this.setProgressRail&&this.setProgressRail();this.setCurrentRail&&this.setCurrentRail()},buildposter:function(a,b,c,e){var d=f('<div class="mejs-poster mejs-layer"></div>').appendTo(c);b=a.$media.attr("poster");if(a.options.poster!=="")b=a.options.poster;b!==""&&b!=null?this.setPoster(b):d.hide();e.addEventListener("play",function(){d.hide()},
false);a.options.showPosterWhenEnded&&a.options.autoRewind&&e.addEventListener("ended",function(){d.show()},false)},setPoster:function(a){var b=this.container.find(".mejs-poster"),c=b.find("img");if(c.length==0)c=f('<img width="100%" height="100%" />').appendTo(b);c.attr("src",a);b.css({"background-image":"url("+a+")"})},buildoverlays:function(a,b,c,e){var d=this;if(a.isVideo){var g=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-loading"><span></span></div></div>').hide().appendTo(c),
k=f('<div class="mejs-overlay mejs-layer"><div class="mejs-overlay-error"></div></div>').hide().appendTo(c),j=f('<div class="mejs-overlay mejs-layer mejs-overlay-play"><div class="mejs-overlay-button"></div></div>').appendTo(c).click(function(){if(d.options.clickToPlayPause)e.paused?e.play():e.pause()});e.addEventListener("play",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();k.hide()},false);e.addEventListener("playing",function(){j.hide();g.hide();b.find(".mejs-time-buffering").hide();
k.hide()},false);e.addEventListener("seeking",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("seeked",function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("pause",function(){mejs.MediaFeatures.isiPhone||j.show()},false);e.addEventListener("waiting",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("loadeddata",function(){g.show();b.find(".mejs-time-buffering").show()},false);e.addEventListener("canplay",
function(){g.hide();b.find(".mejs-time-buffering").hide()},false);e.addEventListener("error",function(){g.hide();b.find(".mejs-time-buffering").hide();k.show();k.find("mejs-overlay-error").html("Error loading this resource")},false)}},buildkeyboard:function(a,b,c,e){this.globalBind("keydown",function(d){if(a.hasFocus&&a.options.enableKeyboard)for(var g=0,k=a.options.keyActions.length;g<k;g++)for(var j=a.options.keyActions[g],m=0,q=j.keys.length;m<q;m++)if(d.keyCode==j.keys[m]){d.preventDefault();
j.action(a,e,d.keyCode);return false}return true});this.globalBind("click",function(d){if(f(d.target).closest(".mejs-container").length==0)a.hasFocus=false})},findTracks:function(){var a=this,b=a.$media.find("track");a.tracks=[];b.each(function(c,e){e=f(e);a.tracks.push({srclang:e.attr("srclang")?e.attr("srclang").toLowerCase():"",src:e.attr("src"),kind:e.attr("kind"),label:e.attr("label")||"",entries:[],isLoaded:false})})},changeSkin:function(a){this.container[0].className="mejs-container "+a;this.setPlayerSize(this.width,
this.height);this.setControlsSize()},play:function(){this.media.play()},pause:function(){try{this.media.pause()}catch(a){}},load:function(){this.media.load()},setMuted:function(a){this.media.setMuted(a)},setCurrentTime:function(a){this.media.setCurrentTime(a)},getCurrentTime:function(){return this.media.currentTime},setVolume:function(a){this.media.setVolume(a)},getVolume:function(){return this.media.volume},setSrc:function(a){this.media.setSrc(a)},remove:function(){var a,b;for(a in this.options.features){b=
this.options.features[a];if(this["clean"+b])try{this["clean"+b](this)}catch(c){}}if(this.isDynamic)this.$node.insertBefore(this.container);else{this.$media.prop("controls",true);this.$node.clone().show().insertBefore(this.container);this.$node.remove()}this.media.pluginType!=="native"&&this.media.remove();delete mejs.players[this.id];this.container.remove();this.globalUnbind();delete this.node.player}};(function(){function a(c,e){var d={d:[],w:[]};f.each((c||"").split(" "),function(g,k){var j=k+"."+
e;if(j.indexOf(".")===0){d.d.push(j);d.w.push(j)}else d[b.test(k)?"w":"d"].push(j)});d.d=d.d.join(" ");d.w=d.w.join(" ");return d}var b=/^((after|before)print|(before)?unload|hashchange|message|o(ff|n)line|page(hide|show)|popstate|resize|storage)\b/;mejs.MediaElementPlayer.prototype.globalBind=function(c,e,d){c=a(c,this.id);c.d&&f(document).bind(c.d,e,d);c.w&&f(window).bind(c.w,e,d)};mejs.MediaElementPlayer.prototype.globalUnbind=function(c,e){c=a(c,this.id);c.d&&f(document).unbind(c.d,e);c.w&&f(window).unbind(c.w,
e)}})();if(typeof jQuery!="undefined")jQuery.fn.mediaelementplayer=function(a){a===false?this.each(function(){var b=jQuery(this).data("mediaelementplayer");b&&b.remove();jQuery(this).removeData("mediaelementplayer")}):this.each(function(){jQuery(this).data("mediaelementplayer",new mejs.MediaElementPlayer(this,a))});return this};f(document).ready(function(){f(".mejs-player").mediaelementplayer()});window.MediaElementPlayer=mejs.MediaElementPlayer})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{playpauseText:mejs.i18n.t("Play/Pause")});f.extend(MediaElementPlayer.prototype,{buildplaypause:function(a,b,c,e){var d=f('<div class="mejs-button mejs-playpause-button mejs-play" ><button type="button" aria-controls="'+this.id+'" title="'+this.options.playpauseText+'" aria-label="'+this.options.playpauseText+'"></button></div>').appendTo(b).click(function(g){g.preventDefault();e.paused?e.play():e.pause();return false});e.addEventListener("play",function(){d.removeClass("mejs-play").addClass("mejs-pause")},
false);e.addEventListener("playing",function(){d.removeClass("mejs-play").addClass("mejs-pause")},false);e.addEventListener("pause",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false);e.addEventListener("paused",function(){d.removeClass("mejs-pause").addClass("mejs-play")},false)}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{stopText:"Stop"});f.extend(MediaElementPlayer.prototype,{buildstop:function(a,b,c,e){f('<div class="mejs-button mejs-stop-button mejs-stop"><button type="button" aria-controls="'+this.id+'" title="'+this.options.stopText+'" aria-label="'+this.options.stopText+'"></button></div>').appendTo(b).click(function(){e.paused||e.pause();if(e.currentTime>0){e.setCurrentTime(0);e.pause();b.find(".mejs-time-current").width("0px");b.find(".mejs-time-handle").css("left",
"0px");b.find(".mejs-time-float-current").html(mejs.Utility.secondsToTimeCode(0));b.find(".mejs-currenttime").html(mejs.Utility.secondsToTimeCode(0));c.find(".mejs-poster").show()}})}})})(mejs.$);
(function(f){f.extend(MediaElementPlayer.prototype,{buildprogress:function(a,b,c,e){f('<div class="mejs-time-rail"><span class="mejs-time-total"><span class="mejs-time-buffering"></span><span class="mejs-time-loaded"></span><span class="mejs-time-current"></span><span class="mejs-time-handle"></span><span class="mejs-time-float"><span class="mejs-time-float-current">00:00</span><span class="mejs-time-float-corner"></span></span></span></div>').appendTo(b);b.find(".mejs-time-buffering").hide();var d=
this,g=b.find(".mejs-time-total");c=b.find(".mejs-time-loaded");var k=b.find(".mejs-time-current"),j=b.find(".mejs-time-handle"),m=b.find(".mejs-time-float"),q=b.find(".mejs-time-float-current"),p=function(h){h=h.pageX;var l=g.offset(),r=g.outerWidth(true),n=0,o=n=0;if(e.duration){if(h<l.left)h=l.left;else if(h>r+l.left)h=r+l.left;o=h-l.left;n=o/r;n=n<=0.02?0:n*e.duration;t&&n!==e.currentTime&&e.setCurrentTime(n);if(!mejs.MediaFeatures.hasTouch){m.css("left",o);q.html(mejs.Utility.secondsToTimeCode(n));
m.show()}}},t=false;g.bind("mousedown",function(h){if(h.which===1){t=true;p(h);d.globalBind("mousemove.dur",function(l){p(l)});d.globalBind("mouseup.dur",function(){t=false;m.hide();d.globalUnbind(".dur")});return false}}).bind("mouseenter",function(){d.globalBind("mousemove.dur",function(h){p(h)});mejs.MediaFeatures.hasTouch||m.show()}).bind("mouseleave",function(){if(!t){d.globalUnbind(".dur");m.hide()}});e.addEventListener("progress",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);
e.addEventListener("timeupdate",function(h){a.setProgressRail(h);a.setCurrentRail(h)},false);d.loaded=c;d.total=g;d.current=k;d.handle=j},setProgressRail:function(a){var b=a!=undefined?a.target:this.media,c=null;if(b&&b.buffered&&b.buffered.length>0&&b.buffered.end&&b.duration)c=b.buffered.end(0)/b.duration;else if(b&&b.bytesTotal!=undefined&&b.bytesTotal>0&&b.bufferedBytes!=undefined)c=b.bufferedBytes/b.bytesTotal;else if(a&&a.lengthComputable&&a.total!=0)c=a.loaded/a.total;if(c!==null){c=Math.min(1,
Math.max(0,c));this.loaded&&this.total&&this.loaded.width(this.total.width()*c)}},setCurrentRail:function(){if(this.media.currentTime!=undefined&&this.media.duration)if(this.total&&this.handle){var a=Math.round(this.total.width()*this.media.currentTime/this.media.duration),b=a-Math.round(this.handle.outerWidth(true)/2);this.current.width(a);this.handle.css("left",b)}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{duration:-1,timeAndDurationSeparator:"<span> | </span>"});f.extend(MediaElementPlayer.prototype,{buildcurrent:function(a,b,c,e){f('<div class="mejs-time"><span class="mejs-currenttime">'+(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00")+"</span></div>").appendTo(b);this.currenttime=this.controls.find(".mejs-currenttime");e.addEventListener("timeupdate",function(){a.updateCurrent()},false)},buildduration:function(a,b,
c,e){if(b.children().last().find(".mejs-currenttime").length>0)f(this.options.timeAndDurationSeparator+'<span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span>").appendTo(b.find(".mejs-time"));else{b.find(".mejs-currenttime").parent().addClass("mejs-currenttime-container");
f('<div class="mejs-time mejs-duration-container"><span class="mejs-duration">'+(this.options.duration>0?mejs.Utility.secondsToTimeCode(this.options.duration,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25):(a.options.alwaysShowHours?"00:":"")+(a.options.showTimecodeFrameCount?"00:00:00":"00:00"))+"</span></div>").appendTo(b)}this.durationD=this.controls.find(".mejs-duration");e.addEventListener("timeupdate",function(){a.updateDuration()},
false)},updateCurrent:function(){if(this.currenttime)this.currenttime.html(mejs.Utility.secondsToTimeCode(this.media.currentTime,this.options.alwaysShowHours||this.media.duration>3600,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))},updateDuration:function(){this.container.toggleClass("mejs-long-video",this.media.duration>3600);if(this.durationD&&(this.options.duration>0||this.media.duration))this.durationD.html(mejs.Utility.secondsToTimeCode(this.options.duration>0?this.options.duration:
this.media.duration,this.options.alwaysShowHours,this.options.showTimecodeFrameCount,this.options.framesPerSecond||25))}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{muteText:mejs.i18n.t("Mute Toggle"),hideVolumeOnTouchDevices:true,audioVolume:"horizontal",videoVolume:"vertical"});f.extend(MediaElementPlayer.prototype,{buildvolume:function(a,b,c,e){if(!(mejs.MediaFeatures.hasTouch&&this.options.hideVolumeOnTouchDevices)){var d=this,g=d.isVideo?d.options.videoVolume:d.options.audioVolume,k=g=="horizontal"?f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+
'" aria-label="'+d.options.muteText+'"></button></div><div class="mejs-horizontal-volume-slider"><div class="mejs-horizontal-volume-total"></div><div class="mejs-horizontal-volume-current"></div><div class="mejs-horizontal-volume-handle"></div></div>').appendTo(b):f('<div class="mejs-button mejs-volume-button mejs-mute"><button type="button" aria-controls="'+d.id+'" title="'+d.options.muteText+'" aria-label="'+d.options.muteText+'"></button><div class="mejs-volume-slider"><div class="mejs-volume-total"></div><div class="mejs-volume-current"></div><div class="mejs-volume-handle"></div></div></div>').appendTo(b),
j=d.container.find(".mejs-volume-slider, .mejs-horizontal-volume-slider"),m=d.container.find(".mejs-volume-total, .mejs-horizontal-volume-total"),q=d.container.find(".mejs-volume-current, .mejs-horizontal-volume-current"),p=d.container.find(".mejs-volume-handle, .mejs-horizontal-volume-handle"),t=function(n,o){if(!j.is(":visible")&&typeof o=="undefined"){j.show();t(n,true);j.hide()}else{n=Math.max(0,n);n=Math.min(n,1);n==0?k.removeClass("mejs-mute").addClass("mejs-unmute"):k.removeClass("mejs-unmute").addClass("mejs-mute");
if(g=="vertical"){var s=m.height(),u=m.position(),v=s-s*n;p.css("top",Math.round(u.top+v-p.height()/2));q.height(s-v);q.css("top",u.top+v)}else{s=m.width();u=m.position();s=s*n;p.css("left",Math.round(u.left+s-p.width()/2));q.width(Math.round(s))}}},h=function(n){var o=null,s=m.offset();if(g=="vertical"){o=m.height();parseInt(m.css("top").replace(/px/,""),10);o=(o-(n.pageY-s.top))/o;if(s.top==0||s.left==0)return}else{o=m.width();o=(n.pageX-s.left)/o}o=Math.max(0,o);o=Math.min(o,1);t(o);o==0?e.setMuted(true):
e.setMuted(false);e.setVolume(o)},l=false,r=false;k.hover(function(){j.show();r=true},function(){r=false;!l&&g=="vertical"&&j.hide()});j.bind("mouseover",function(){r=true}).bind("mousedown",function(n){h(n);d.globalBind("mousemove.vol",function(o){h(o)});d.globalBind("mouseup.vol",function(){l=false;d.globalUnbind(".vol");!r&&g=="vertical"&&j.hide()});l=true;return false});k.find("button").click(function(){e.setMuted(!e.muted)});e.addEventListener("volumechange",function(){if(!l)if(e.muted){t(0);
k.removeClass("mejs-mute").addClass("mejs-unmute")}else{t(e.volume);k.removeClass("mejs-unmute").addClass("mejs-mute")}},false);if(d.container.is(":visible")){t(a.options.startVolume);a.options.startVolume===0&&e.setMuted(true);e.pluginType==="native"&&e.setVolume(a.options.startVolume)}}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{usePluginFullScreen:true,newWindowCallback:function(){return""},fullscreenText:mejs.i18n.t("Fullscreen")});f.extend(MediaElementPlayer.prototype,{isFullScreen:false,isNativeFullScreen:false,isInIframe:false,buildfullscreen:function(a,b,c,e){if(a.isVideo){a.isInIframe=window.location!=window.parent.location;if(mejs.MediaFeatures.hasTrueNativeFullScreen){c=function(){if(a.isFullScreen)if(mejs.MediaFeatures.isFullScreen()){a.isNativeFullScreen=true;a.setControlsSize()}else{a.isNativeFullScreen=
false;a.exitFullScreen()}};mejs.MediaFeatures.hasMozNativeFullScreen?a.globalBind(mejs.MediaFeatures.fullScreenEventName,c):a.container.bind(mejs.MediaFeatures.fullScreenEventName,c)}var d=this,g=f('<div class="mejs-button mejs-fullscreen-button"><button type="button" aria-controls="'+d.id+'" title="'+d.options.fullscreenText+'" aria-label="'+d.options.fullscreenText+'"></button></div>').appendTo(b);if(d.media.pluginType==="native"||!d.options.usePluginFullScreen&&!mejs.MediaFeatures.isFirefox)g.click(function(){mejs.MediaFeatures.hasTrueNativeFullScreen&&
mejs.MediaFeatures.isFullScreen()||a.isFullScreen?a.exitFullScreen():a.enterFullScreen()});else{var k=null;if(function(){var h=document.createElement("x"),l=document.documentElement,r=window.getComputedStyle;if(!("pointerEvents"in h.style))return false;h.style.pointerEvents="auto";h.style.pointerEvents="x";l.appendChild(h);r=r&&r(h,"").pointerEvents==="auto";l.removeChild(h);return!!r}()&&!mejs.MediaFeatures.isOpera){var j=false,m=function(){if(j){for(var h in q)q[h].hide();g.css("pointer-events",
"");d.controls.css("pointer-events","");d.media.removeEventListener("click",d.clickToPlayPauseCallback);j=false}},q={};b=["top","left","right","bottom"];var p,t=function(){var h=g.offset().left-d.container.offset().left,l=g.offset().top-d.container.offset().top,r=g.outerWidth(true),n=g.outerHeight(true),o=d.container.width(),s=d.container.height();for(p in q)q[p].css({position:"absolute",top:0,left:0});q.top.width(o).height(l);q.left.width(h).height(n).css({top:l});q.right.width(o-h-r).height(n).css({top:l,
left:h+r});q.bottom.width(o).height(s-n-l).css({top:l+n})};d.globalBind("resize",function(){t()});p=0;for(c=b.length;p<c;p++)q[b[p]]=f('<div class="mejs-fullscreen-hover" />').appendTo(d.container).mouseover(m).hide();g.on("mouseover",function(){if(!d.isFullScreen){var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,false);g.css("pointer-events","none");d.controls.css("pointer-events","none");d.media.addEventListener("click",d.clickToPlayPauseCallback);for(p in q)q[p].show();
t();j=true}});e.addEventListener("fullscreenchange",function(){d.isFullScreen=!d.isFullScreen;d.isFullScreen?d.media.removeEventListener("click",d.clickToPlayPauseCallback):d.media.addEventListener("click",d.clickToPlayPauseCallback);m()});d.globalBind("mousemove",function(h){if(j){var l=g.offset();if(h.pageY<l.top||h.pageY>l.top+g.outerHeight(true)||h.pageX<l.left||h.pageX>l.left+g.outerWidth(true)){g.css("pointer-events","");d.controls.css("pointer-events","");j=false}}})}else g.on("mouseover",
function(){if(k!==null){clearTimeout(k);delete k}var h=g.offset(),l=a.container.offset();e.positionFullscreenButton(h.left-l.left,h.top-l.top,true)}).on("mouseout",function(){if(k!==null){clearTimeout(k);delete k}k=setTimeout(function(){e.hideFullscreenButton()},1500)})}a.fullscreenBtn=g;d.globalBind("keydown",function(h){if((mejs.MediaFeatures.hasTrueNativeFullScreen&&mejs.MediaFeatures.isFullScreen()||d.isFullScreen)&&h.keyCode==27)a.exitFullScreen()})}},cleanfullscreen:function(a){a.exitFullScreen()},
containerSizeTimeout:null,enterFullScreen:function(){var a=this;if(!(a.media.pluginType!=="native"&&(mejs.MediaFeatures.isFirefox||a.options.usePluginFullScreen))){f(document.documentElement).addClass("mejs-fullscreen");normalHeight=a.container.height();normalWidth=a.container.width();if(a.media.pluginType==="native")if(mejs.MediaFeatures.hasTrueNativeFullScreen){mejs.MediaFeatures.requestFullScreen(a.container[0]);a.isInIframe&&setTimeout(function c(){if(a.isNativeFullScreen)f(window).width()!==
screen.width?a.exitFullScreen():setTimeout(c,500)},500)}else if(mejs.MediaFeatures.hasSemiNativeFullScreen){a.media.webkitEnterFullscreen();return}if(a.isInIframe){var b=a.options.newWindowCallback(this);if(b!=="")if(mejs.MediaFeatures.hasTrueNativeFullScreen)setTimeout(function(){if(!a.isNativeFullScreen){a.pause();window.open(b,a.id,"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no")}},250);else{a.pause();window.open(b,a.id,
"top=0,left=0,width="+screen.availWidth+",height="+screen.availHeight+",resizable=yes,scrollbars=no,status=no,toolbar=no");return}}a.container.addClass("mejs-container-fullscreen").width("100%").height("100%");a.containerSizeTimeout=setTimeout(function(){a.container.css({width:"100%",height:"100%"});a.setControlsSize()},500);if(a.media.pluginType==="native")a.$media.width("100%").height("100%");else{a.container.find(".mejs-shim").width("100%").height("100%");a.media.setVideoSize(f(window).width(),
f(window).height())}a.layers.children("div").width("100%").height("100%");a.fullscreenBtn&&a.fullscreenBtn.removeClass("mejs-fullscreen").addClass("mejs-unfullscreen");a.setControlsSize();a.isFullScreen=true}},exitFullScreen:function(){clearTimeout(this.containerSizeTimeout);if(this.media.pluginType!=="native"&&mejs.MediaFeatures.isFirefox)this.media.setFullscreen(false);else{if(mejs.MediaFeatures.hasTrueNativeFullScreen&&(mejs.MediaFeatures.isFullScreen()||this.isFullScreen))mejs.MediaFeatures.cancelFullScreen();
f(document.documentElement).removeClass("mejs-fullscreen");this.container.removeClass("mejs-container-fullscreen").width(normalWidth).height(normalHeight);if(this.media.pluginType==="native")this.$media.width(normalWidth).height(normalHeight);else{this.container.find(".mejs-shim").width(normalWidth).height(normalHeight);this.media.setVideoSize(normalWidth,normalHeight)}this.layers.children("div").width(normalWidth).height(normalHeight);this.fullscreenBtn.removeClass("mejs-unfullscreen").addClass("mejs-fullscreen");
this.setControlsSize();this.isFullScreen=false}}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{startLanguage:"",tracksText:mejs.i18n.t("Captions/Subtitles"),hideCaptionsButtonWhenEmpty:true,toggleCaptionsButtonWhenOnlyOne:false,slidesSelector:""});f.extend(MediaElementPlayer.prototype,{hasChapters:false,buildtracks:function(a,b,c,e){if(a.tracks.length!=0){var d;if(this.domNode.textTracks)for(d=this.domNode.textTracks.length-1;d>=0;d--)this.domNode.textTracks[d].mode="hidden";a.chapters=f('<div class="mejs-chapters mejs-layer"></div>').prependTo(c).hide();a.captions=
f('<div class="mejs-captions-layer mejs-layer"><div class="mejs-captions-position mejs-captions-position-hover"><span class="mejs-captions-text"></span></div></div>').prependTo(c).hide();a.captionsText=a.captions.find(".mejs-captions-text");a.captionsButton=f('<div class="mejs-button mejs-captions-button"><button type="button" aria-controls="'+this.id+'" title="'+this.options.tracksText+'" aria-label="'+this.options.tracksText+'"></button><div class="mejs-captions-selector"><ul><li><input type="radio" name="'+
a.id+'_captions" id="'+a.id+'_captions_none" value="none" checked="checked" /><label for="'+a.id+'_captions_none">'+mejs.i18n.t("None")+"</label></li></ul></div></div>").appendTo(b);for(d=b=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&b++;this.options.toggleCaptionsButtonWhenOnlyOne&&b==1?a.captionsButton.on("click",function(){a.setTrack(a.selectedTrack==null?a.tracks[0].srclang:"none")}):a.captionsButton.hover(function(){f(this).find(".mejs-captions-selector").css("visibility","visible")},
function(){f(this).find(".mejs-captions-selector").css("visibility","hidden")}).on("click","input[type=radio]",function(){lang=this.value;a.setTrack(lang)});a.options.alwaysShowControls?a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover"):a.container.bind("controlsshown",function(){a.container.find(".mejs-captions-position").addClass("mejs-captions-position-hover")}).bind("controlshidden",function(){e.paused||a.container.find(".mejs-captions-position").removeClass("mejs-captions-position-hover")});
a.trackToLoad=-1;a.selectedTrack=null;a.isLoadingTrack=false;for(d=0;d<a.tracks.length;d++)a.tracks[d].kind=="subtitles"&&a.addTrackButton(a.tracks[d].srclang,a.tracks[d].label);a.loadNextTrack();e.addEventListener("timeupdate",function(){a.displayCaptions()},false);if(a.options.slidesSelector!=""){a.slidesContainer=f(a.options.slidesSelector);e.addEventListener("timeupdate",function(){a.displaySlides()},false)}e.addEventListener("loadedmetadata",function(){a.displayChapters()},false);a.container.hover(function(){if(a.hasChapters){a.chapters.css("visibility",
"visible");a.chapters.fadeIn(200).height(a.chapters.find(".mejs-chapter").outerHeight())}},function(){a.hasChapters&&!e.paused&&a.chapters.fadeOut(200,function(){f(this).css("visibility","hidden");f(this).css("display","block")})});a.node.getAttribute("autoplay")!==null&&a.chapters.css("visibility","hidden")}},setTrack:function(a){var b;if(a=="none"){this.selectedTrack=null;this.captionsButton.removeClass("mejs-captions-enabled")}else for(b=0;b<this.tracks.length;b++)if(this.tracks[b].srclang==a){this.selectedTrack==
null&&this.captionsButton.addClass("mejs-captions-enabled");this.selectedTrack=this.tracks[b];this.captions.attr("lang",this.selectedTrack.srclang);this.displayCaptions();break}},loadNextTrack:function(){this.trackToLoad++;if(this.trackToLoad<this.tracks.length){this.isLoadingTrack=true;this.loadTrack(this.trackToLoad)}else{this.isLoadingTrack=false;this.checkForTracks()}},loadTrack:function(a){var b=this,c=b.tracks[a];f.ajax({url:c.src,dataType:"text",success:function(e){c.entries=typeof e=="string"&&
/<tt\s+xml/ig.exec(e)?mejs.TrackFormatParser.dfxp.parse(e):mejs.TrackFormatParser.webvvt.parse(e);c.isLoaded=true;b.enableTrackButton(c.srclang,c.label);b.loadNextTrack();c.kind=="chapters"&&b.media.addEventListener("play",function(){b.media.duration>0&&b.displayChapters(c)},false);c.kind=="slides"&&b.setupSlides(c)},error:function(){b.loadNextTrack()}})},enableTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("input[value="+a+"]").prop("disabled",false).siblings("label").html(b);
this.options.startLanguage==a&&f("#"+this.id+"_captions_"+a).click();this.adjustLanguageBox()},addTrackButton:function(a,b){if(b==="")b=mejs.language.codes[a]||a;this.captionsButton.find("ul").append(f('<li><input type="radio" name="'+this.id+'_captions" id="'+this.id+"_captions_"+a+'" value="'+a+'" disabled="disabled" /><label for="'+this.id+"_captions_"+a+'">'+b+" (loading)</label></li>"));this.adjustLanguageBox();this.container.find(".mejs-captions-translations option[value="+a+"]").remove()},
adjustLanguageBox:function(){this.captionsButton.find(".mejs-captions-selector").height(this.captionsButton.find(".mejs-captions-selector ul").outerHeight(true)+this.captionsButton.find(".mejs-captions-translations").outerHeight(true))},checkForTracks:function(){var a=false;if(this.options.hideCaptionsButtonWhenEmpty){for(i=0;i<this.tracks.length;i++)if(this.tracks[i].kind=="subtitles"){a=true;break}if(!a){this.captionsButton.hide();this.setControlsSize()}}},displayCaptions:function(){if(typeof this.tracks!=
"undefined"){var a,b=this.selectedTrack;if(b!=null&&b.isLoaded)for(a=0;a<b.entries.times.length;a++)if(this.media.currentTime>=b.entries.times[a].start&&this.media.currentTime<=b.entries.times[a].stop){this.captionsText.html(b.entries.text[a]);this.captions.show().height(0);return}this.captions.hide()}},setupSlides:function(a){this.slides=a;this.slides.entries.imgs=[this.slides.entries.text.length];this.showSlide(0)},showSlide:function(a){if(!(typeof this.tracks=="undefined"||typeof this.slidesContainer==
"undefined")){var b=this,c=b.slides.entries.text[a],e=b.slides.entries.imgs[a];if(typeof e=="undefined"||typeof e.fadeIn=="undefined")b.slides.entries.imgs[a]=e=f('<img src="'+c+'">').on("load",function(){e.appendTo(b.slidesContainer).hide().fadeIn().siblings(":visible").fadeOut()});else!e.is(":visible")&&!e.is(":animated")&&e.fadeIn().siblings(":visible").fadeOut()}},displaySlides:function(){if(typeof this.slides!="undefined"){var a=this.slides,b;for(b=0;b<a.entries.times.length;b++)if(this.media.currentTime>=
a.entries.times[b].start&&this.media.currentTime<=a.entries.times[b].stop){this.showSlide(b);break}}},displayChapters:function(){var a;for(a=0;a<this.tracks.length;a++)if(this.tracks[a].kind=="chapters"&&this.tracks[a].isLoaded){this.drawChapters(this.tracks[a]);this.hasChapters=true;break}},drawChapters:function(a){var b=this,c,e,d=e=0;b.chapters.empty();for(c=0;c<a.entries.times.length;c++){e=a.entries.times[c].stop-a.entries.times[c].start;e=Math.floor(e/b.media.duration*100);if(e+d>100||c==a.entries.times.length-
1&&e+d<100)e=100-d;b.chapters.append(f('<div class="mejs-chapter" rel="'+a.entries.times[c].start+'" style="left: '+d.toString()+"%;width: "+e.toString()+'%;"><div class="mejs-chapter-block'+(c==a.entries.times.length-1?" mejs-chapter-block-last":"")+'"><span class="ch-title">'+a.entries.text[c]+'</span><span class="ch-time">'+mejs.Utility.secondsToTimeCode(a.entries.times[c].start)+"&ndash;"+mejs.Utility.secondsToTimeCode(a.entries.times[c].stop)+"</span></div></div>"));d+=e}b.chapters.find("div.mejs-chapter").click(function(){b.media.setCurrentTime(parseFloat(f(this).attr("rel")));
b.media.paused&&b.media.play()});b.chapters.show()}});mejs.language={codes:{af:"Afrikaans",sq:"Albanian",ar:"Arabic",be:"Belarusian",bg:"Bulgarian",ca:"Catalan",zh:"Chinese","zh-cn":"Chinese Simplified","zh-tw":"Chinese Traditional",hr:"Croatian",cs:"Czech",da:"Danish",nl:"Dutch",en:"English",et:"Estonian",tl:"Filipino",fi:"Finnish",fr:"French",gl:"Galician",de:"German",el:"Greek",ht:"Haitian Creole",iw:"Hebrew",hi:"Hindi",hu:"Hungarian",is:"Icelandic",id:"Indonesian",ga:"Irish",it:"Italian",ja:"Japanese",
ko:"Korean",lv:"Latvian",lt:"Lithuanian",mk:"Macedonian",ms:"Malay",mt:"Maltese",no:"Norwegian",fa:"Persian",pl:"Polish",pt:"Portuguese",ro:"Romanian",ru:"Russian",sr:"Serbian",sk:"Slovak",sl:"Slovenian",es:"Spanish",sw:"Swahili",sv:"Swedish",tl:"Tagalog",th:"Thai",tr:"Turkish",uk:"Ukrainian",vi:"Vietnamese",cy:"Welsh",yi:"Yiddish"}};mejs.TrackFormatParser={webvvt:{pattern_identifier:/^([a-zA-z]+-)?[0-9]+$/,pattern_timecode:/^([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{1,3})?) --\> ([0-9]{2}:[0-9]{2}:[0-9]{2}([,.][0-9]{3})?)(.*)$/,
parse:function(a){var b=0;a=mejs.TrackFormatParser.split2(a,/\r?\n/);for(var c={text:[],times:[]},e,d;b<a.length;b++)if(this.pattern_identifier.exec(a[b])){b++;if((e=this.pattern_timecode.exec(a[b]))&&b<a.length){b++;d=a[b];for(b++;a[b]!==""&&b<a.length;){d=d+"\n"+a[b];b++}d=f.trim(d).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,"<a href='$1' target='_blank'>$1</a>");c.text.push(d);c.times.push({start:mejs.Utility.convertSMPTEtoSeconds(e[1])==0?0.2:mejs.Utility.convertSMPTEtoSeconds(e[1]),
stop:mejs.Utility.convertSMPTEtoSeconds(e[3]),settings:e[5]})}}return c}},dfxp:{parse:function(a){a=f(a).filter("tt");var b=0;b=a.children("div").eq(0);var c=b.find("p");b=a.find("#"+b.attr("style"));var e,d;a={text:[],times:[]};if(b.length){d=b.removeAttr("id").get(0).attributes;if(d.length){e={};for(b=0;b<d.length;b++)e[d[b].name.split(":")[1]]=d[b].value}}for(b=0;b<c.length;b++){var g;d={start:null,stop:null,style:null};if(c.eq(b).attr("begin"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("begin"));
if(!d.start&&c.eq(b-1).attr("end"))d.start=mejs.Utility.convertSMPTEtoSeconds(c.eq(b-1).attr("end"));if(c.eq(b).attr("end"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b).attr("end"));if(!d.stop&&c.eq(b+1).attr("begin"))d.stop=mejs.Utility.convertSMPTEtoSeconds(c.eq(b+1).attr("begin"));if(e){g="";for(var k in e)g+=k+":"+e[k]+";"}if(g)d.style=g;if(d.start==0)d.start=0.2;a.times.push(d);d=f.trim(c.eq(b).html()).replace(/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig,
"<a href='$1' target='_blank'>$1</a>");a.text.push(d);if(a.times.start==0)a.times.start=2}return a}},split2:function(a,b){return a.split(b)}};if("x\n\ny".split(/\n/gi).length!=3)mejs.TrackFormatParser.split2=function(a,b){var c=[],e="",d;for(d=0;d<a.length;d++){e+=a.substring(d,d+1);if(b.test(e)){c.push(e.replace(b,""));e=""}}c.push(e);return c}})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{contextMenuItems:[{render:function(a){if(typeof a.enterFullScreen=="undefined")return null;return a.isFullScreen?mejs.i18n.t("Turn off Fullscreen"):mejs.i18n.t("Go Fullscreen")},click:function(a){a.isFullScreen?a.exitFullScreen():a.enterFullScreen()}},{render:function(a){return a.media.muted?mejs.i18n.t("Unmute"):mejs.i18n.t("Mute")},click:function(a){a.media.muted?a.setMuted(false):a.setMuted(true)}},{isSeparator:true},{render:function(){return mejs.i18n.t("Download Video")},
click:function(a){window.location.href=a.media.currentSrc}}]});f.extend(MediaElementPlayer.prototype,{buildcontextmenu:function(a){a.contextMenu=f('<div class="mejs-contextmenu"></div>').appendTo(f("body")).hide();a.container.bind("contextmenu",function(b){if(a.isContextMenuEnabled){b.preventDefault();a.renderContextMenu(b.clientX-1,b.clientY-1);return false}});a.container.bind("click",function(){a.contextMenu.hide()});a.contextMenu.bind("mouseleave",function(){a.startContextMenuTimer()})},cleancontextmenu:function(a){a.contextMenu.remove()},
isContextMenuEnabled:true,enableContextMenu:function(){this.isContextMenuEnabled=true},disableContextMenu:function(){this.isContextMenuEnabled=false},contextMenuTimeout:null,startContextMenuTimer:function(){var a=this;a.killContextMenuTimer();a.contextMenuTimer=setTimeout(function(){a.hideContextMenu();a.killContextMenuTimer()},750)},killContextMenuTimer:function(){var a=this.contextMenuTimer;if(a!=null){clearTimeout(a);delete a}},hideContextMenu:function(){this.contextMenu.hide()},renderContextMenu:function(a,
b){for(var c=this,e="",d=c.options.contextMenuItems,g=0,k=d.length;g<k;g++)if(d[g].isSeparator)e+='<div class="mejs-contextmenu-separator"></div>';else{var j=d[g].render(c);if(j!=null)e+='<div class="mejs-contextmenu-item" data-itemindex="'+g+'" id="element-'+Math.random()*1E6+'">'+j+"</div>"}c.contextMenu.empty().append(f(e)).css({top:b,left:a}).show();c.contextMenu.find(".mejs-contextmenu-item").each(function(){var m=f(this),q=parseInt(m.data("itemindex"),10),p=c.options.contextMenuItems[q];typeof p.show!=
"undefined"&&p.show(m,c);m.click(function(){typeof p.click!="undefined"&&p.click(c);c.contextMenu.hide()})});setTimeout(function(){c.killControlsTimer("rev3")},100)}})})(mejs.$);
(function(f){f.extend(mejs.MepDefaults,{postrollCloseText:mejs.i18n.t("Close")});f.extend(MediaElementPlayer.prototype,{buildpostroll:function(a,b,c){var e=this.container.find('link[rel="postroll"]').attr("href");if(typeof e!=="undefined"){a.postroll=f('<div class="mejs-postroll-layer mejs-layer"><a class="mejs-postroll-close" onclick="$(this).parent().hide();return false;">'+this.options.postrollCloseText+'</a><div class="mejs-postroll-layer-content"></div></div>').prependTo(c).hide();this.media.addEventListener("ended",
function(){f.ajax({dataType:"html",url:e,success:function(d){c.find(".mejs-postroll-layer-content").html(d)}});a.postroll.show()},false)}}})})(mejs.$);

@ -0,0 +1,289 @@
/* TED player */
.mejs-container.mejs-ted {
}
.mejs-ted .mejs-controls {
background: #eee;
height: 65px;
}
.mejs-ted .mejs-button,
.mejs-ted .mejs-time {
position: absolute;
background: #ddd;
}
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-total {
background-color: none;
background: url(controls-ted.png) repeat-x 0 -52px;
height: 6px;
}
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-buffering {
height: 6px;
}
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-loaded {
background-color: none;
background: url(controls-ted.png) repeat-x 0 -52px;
width: 0;
height: 6px;
}
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-current {
width: 0;
height: 6px;
background-color: none;
background: url(controls-ted.png) repeat-x 0 -59px;
}
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-handle {
display: block;
margin: 0;
width: 14px;
height: 21px;
top: -7px;
border: 0;
background: url(controls-ted.png) no-repeat 0 0;
}
.mejs-ted .mejs-controls .mejs-time-rail .mejs-time-float {
display: none;
}
.mejs-ted .mejs-controls .mejs-playpause-button {
top: 29px;
left: 9px;
width: 49px;
height: 28px;
}
.mejs-ted .mejs-controls .mejs-playpause-button button {
width: 49px;
height: 28px;
background: url(controls-ted.png) no-repeat -50px -23px;
margin: 0;
padding: 0;
}
.mejs-ted .mejs-controls .mejs-pause button {
background-position: 0 -23px;
}
.mejs-ted .mejs-controls .mejs-fullscreen-button {
top: 34px;
right: 9px;
width: 17px;
height: 15px;
background : none;
}
.mejs-ted .mejs-controls .mejs-fullscreen-button button {
width: 19px;
height: 17px;
background: transparent url(controls-ted.png) no-repeat 0 -66px;
margin: 0;
padding: 0;
}
.mejs-ted .mejs-controls .mejs-unfullscreen button {
background: transparent url(controls-ted.png) no-repeat -21px -66px;
margin: 0;
padding: 0;
}
.mejs-ted .mejs-controls .mejs-volume-button {
top: 30px;
right: 35px;
width: 24px;
height: 22px;
}
.mejs-ted .mejs-controls .mejs-mute button {
background: url(controls-ted.png) no-repeat -15px 0;
width: 24px;
height: 22px;
margin: 0;
padding: 0;
}
.mejs-ted .mejs-controls .mejs-unmute button {
background: url(controls-ted.png) no-repeat -40px 0;
width: 24px;
height: 22px;
margin: 0;
padding: 0;
}
.mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-slider {
background: #fff;
border: solid 1px #aaa;
border-width: 1px 1px 0 1px;
width: 22px;
height: 65px;
top: -65px;
}
.mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-total {
background: url(controls-ted.png) repeat-y -41px -66px;
left: 8px;
width: 6px;
height: 50px;
}
.mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-current {
left: 8px;
width: 6px;
background: url(controls-ted.png) repeat-y -48px -66px;
height: 50px;
}
.mejs-ted .mejs-controls .mejs-volume-button .mejs-volume-handle {
display: none;
}
.mejs-ted .mejs-controls .mejs-time span {
color: #333;
}
.mejs-ted .mejs-controls .mejs-currenttime-container {
position: absolute;
top: 32px;
right: 100px;
border: solid 1px #999;
background: #fff;
color: #333;
padding-top: 2px;
border-radius: 3px;
color: #333;
}
.mejs-ted .mejs-controls .mejs-duration-container {
position: absolute;
top: 32px;
right: 65px;
border: solid 1px #999;
background: #fff;
color: #333;
padding-top: 2px;
border-radius: 3px;
color: #333;
}
.mejs-ted .mejs-controls .mejs-time button{
color: #333;
}
.mejs-ted .mejs-controls .mejs-captions-button {
display: none;
}
/* END: TED player */
/* WMP player */
.mejs-container.mejs-wmp {
}
.mejs-wmp .mejs-controls {
background: transparent url(controls-wmp-bg.png) center 16px no-repeat;
height: 65px;
}
.mejs-wmp .mejs-button,
.mejs-wmp .mejs-time {
position: absolute;
background: transparent;
}
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-total {
background-color: transparent;
border: solid 1px #ccc;
height: 3px;
}
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-buffering {
height: 3px;
}
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-loaded {
background-color: rgba(255,255,255,0.3);
width: 0;
height: 3px;
}
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-current {
width: 0;
height: 1px;
background-color: #014CB6;
border: solid 1px #7FC9FA;
border-width: 1px 0;
border-color: #7FC9FA #fff #619FF2 #fff;
}
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-handle {
display: block;
margin: 0;
width: 16px;
height: 9px;
top: -3px;
border: 0;
background: url(controls-wmp.png) no-repeat 0 -80px;
}
.mejs-wmp .mejs-controls .mejs-time-rail .mejs-time-float {
display: none;
}
.mejs-wmp .mejs-controls .mejs-playpause-button {
top: 10px;
left: 50%;
margin: 10px 0 0 -20px;
width: 40px;
height: 40px;
}
.mejs-wmp .mejs-controls .mejs-playpause-button button {
width: 40px;
height: 40px;
background: url(controls-wmp.png) no-repeat 0 0;
margin: 0;
padding: 0;
}
.mejs-wmp .mejs-controls .mejs-pause button {
background-position: 0 -40px;
}
.mejs-wmp .mejs-controls .mejs-currenttime-container {
position: absolute;
top: 25px;
left: 50%;
margin-left: -93px;
}
.mejs-wmp .mejs-controls .mejs-duration-container {
position: absolute;
top: 25px;
left: 50%;
margin-left: -58px;
}
.mejs-wmp .mejs-controls .mejs-volume-button {
top: 32px;
right: 50%;
margin-right: -55px;
width: 20px;
height: 15px;
}
.mejs-wmp .mejs-controls .mejs-volume-button button {
margin: 0;
padding: 0;
background: url(controls-wmp.png) no-repeat -42px -17px;
width: 20px;
height: 15px;
}
.mejs-wmp .mejs-controls .mejs-unmute button {
margin: 0;
padding: 0;
background: url(controls-wmp.png) no-repeat -42px 0;
width: 20px;
height: 15px;
}
.mejs-wmp .mejs-controls .mejs-volume-button .mejs-volume-slider {
background: rgba(102,102,102,0.6);
}
.mejs-wmp .mejs-controls .mejs-fullscreen-button {
top: 32px;
right: 50%;
margin-right: -82px;
width: 15px;
height: 14px;
}
.mejs-wmp .mejs-controls .mejs-fullscreen-button button {
margin: 0;
padding: 0;
background: url(controls-wmp.png) no-repeat -63px 0;
width: 15px;
height: 14px;
}
.mejs-wmp .mejs-controls .mejs-captions-button {
display: none;
}
/* END: WMP player */

File diff suppressed because one or more lines are too long

@ -0,0 +1,101 @@
<?php
/**
* Class lp_item
* made to manipulate datas of lp_item table
*
* This class is still incomplte
* You can add lp_item database manipulation function here
*
*/
class LpItem {
public $c_id=0;
public $id=0;
public $lp_id=0;
public $item_type="";
public $ref="";
public $title="";
public $description="";
public $path="";
public $min_score=0;
public $max_score=0;
public $mastery_score=0;
public $parent_item_id=0;
public $previous_item_id=0;
public $next_item_id=0;
public $display_order=0;
public $prerequisite="";
public $parameters="";
public $launch_data="";
public $max_time_allowed="";
public $terms="";
public $search_did=0;
public $audio="";
public function __construct($in_c_id=0, $in_id=0) {
if ($in_c_id > 0 && $in_id >0) {
$item_view_table = Database::get_course_table(TABLE_LP_ITEM);
$sql = "SELECT * FROM $item_view_table WHERE c_id=".Database::escape_string($in_c_id)."
AND id=".Database::escape_string($in_id);
$res = Database::query($sql);
$data = Database::fetch_array($res);
if (Database::num_rows($res) > 0) {
$this->c_id = $data['c_id'];
$this->id = $data['id'];
$this->lp_id = $data['lp_id'];
$this->item_type = $data['item_type'];
$this->ref = $data['ref'];
$this->title = $data['title'];
$this->description = $data['description'];
$this->path = $data['path'];
$this->min_score = $data['min_score'];
$this->max_score = $data['max_score'];
$this->mastery_score = $data['mastery_score'];
$this->parent_item_id = $data['parent_item_id'];
$this->previous_item_id = $data['previous_item_id'];
$this->next_item_id = $data['next_item_id'];
$this->display_order = $data['display_order'];
$this->prerequisite = $data['prerequisite'];
$this->parameters = $data['parameters'];
$this->launch_data = $data['launch_data'];
$this->max_time_allowed = $data['max_time_allowed'];
$this->terms = $data['terms'];
$this->search_did = $data['search_did'];
$this->audio = $data['audio'];
}
}
}
public function update_in_bdd() {
$item_view_table = Database::get_course_table(TABLE_LP_ITEM);
if ($this->c_id > 0 && $this->id > 0) {
$sql = "UPDATE $item_view_table SET
lp_id = '".Database::escape_string($this->lp_id)."' ,
item_type = '".Database::escape_string($this->item_type)."' ,
ref = '".Database::escape_string($this->ref)."' ,
title = '".Database::escape_string($this->title)."' ,
description = '".Database::escape_string($this->description)."' ,
path = '".Database::escape_string($this->path)."' ,
min_score = '".Database::escape_string($this->min_score)."' ,
max_score = '".Database::escape_string($this->max_score)."' ,
mastery_score = '".Database::escape_string($this->mastery_score)."' ,
parent_item_id = '".Database::escape_string($this->parent_item_id)."' ,
previous_item_id = '".Database::escape_string($this->previous_item_id)."' ,
next_item_id = '".Database::escape_string($this->next_item_id)."' ,
display_order = '".Database::escape_string($this->display_order)."' ,
prerequisite = '".Database::escape_string($this->prerequisite)."' ,
parameters = '".Database::escape_string($this->parameters)."' ,
launch_data = '".Database::escape_string($this->launch_data)."' ,
max_time_allowed = '".Database::escape_string($this->max_time_allowed)."' ,
terms = '".Database::escape_string($this->terms)."' ,
search_did = '".Database::escape_string($this->search_did)."' ,
audio = '".Database::escape_string($this->audio)."'
WHERE c_id=".$this->c_id." AND id=".$this->id;
Database::query($sql);
}
}
}

@ -2364,6 +2364,11 @@ function api_is_coach($session_id = 0, $course_code = null) {
$session_id = api_get_session_id();
}
// The student preview was on
if (isset($_SESSION['studentview']) && $_SESSION['studentview'] == "studentview") {
return false;
}
if (!empty($course_code)) {
$course_code = Database::escape_string($course_code);
} else {

@ -302,7 +302,7 @@ class SessionManager
if (!empty($options['order'])) {
$query .= " ORDER BY ".$options['order'];
}
$result = Database::query($query);
$formatted_sessions = array();
if (Database::num_rows($result)) {
@ -1887,7 +1887,8 @@ class SessionManager
$extraFieldId = null,
$daysCoachAccessBeforeBeginning = null,
$daysCoachAccessAfterBeginning = null,
$sessionVisibility = 1
$sessionVisibility = 1,
$fieldsToAvoidUpdate = array()
)
{
$content = file($file);
@ -2033,7 +2034,7 @@ class SessionManager
$my_session_result = true;
}
} else {
$my_session_result = self::get_session_by_name($session_name);
$my_session_result = self::get_session_by_name($enreg['SessionName']);
}
if ($my_session_result === false) {
@ -2045,11 +2046,13 @@ class SessionManager
date_start = '$date_start',
date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'".$extraParameters;
session_category_id = '$session_category_id' ".$extraParameters;
Database::query($sql_session);
// We get the last insert id.
$my_session_result = SessionManager::get_session_by_name($session_name);
$my_session_result = SessionManager::get_session_by_name($enreg['SessionName']);
$session_id = $my_session_result['id'];
if ($debug) {
@ -2066,30 +2069,28 @@ class SessionManager
}
} else {
$params = array(
'id_coach' => $coach_id,
'date_start' => $date_start,
'date_end' => $date_end,
'visibility' => $visibility,
'session_category_id' => $session_category_id
);
if (!empty($fieldsToAvoidUpdate)) {
foreach ($fieldsToAvoidUpdate as $field) {
unset($params[$field]);
}
}
if (isset($sessionId) && !empty($sessionId)) {
// The session already exists, update it then.
$sql_session = "UPDATE $tbl_session SET
id_coach = '$coach_id',
date_start = '$date_start',
date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'
WHERE id = '$sessionId'";
//name = '$session_name'
Database::query($sql_session);
Database::update($tbl_session, $params, array('id = ?' => $sessionId));
$session_id = $sessionId;
} else {
Database::update($tbl_session, $params, array("name = '?' " => $enreg['SessionName']));
// The session already exists, update it then.
$sql_session = "UPDATE $tbl_session SET
id_coach = '$coach_id',
date_start = '$date_start',
date_end = '$date_end',
visibility = '$visibility',
session_category_id = '$session_category_id'
WHERE name = '$session_name'";
Database::query($sql_session);
$row = Database::query("SELECT id FROM $tbl_session WHERE name='$session_name'");
$row = Database::query("SELECT id FROM $tbl_session WHERE name = '$session_name'");
list($session_id) = Database::fetch_array($row);
}

@ -421,6 +421,7 @@ class Template
}
$css[] = api_get_path(WEB_CSS_PATH).'font_awesome/css/font-awesome.css';
$css[] = api_get_path(WEB_LIBRARY_PATH).'javascript/mediaelement/mediaelementplayer.css';
$css_file_to_string = null;
foreach ($css as $file) {
@ -470,10 +471,11 @@ class Template
//JS files
$js_files = array(
'modernizr.js',
'jquery.min.js',
'jquery.js',
'chosen/chosen.jquery.min.js',
'thickbox.js',
'bootstrap/bootstrap.js',
'mediaelement/mediaelement-and-player.min.js'
);
if (api_is_global_chat_enabled()) {
@ -645,9 +647,7 @@ class Template
if (api_get_setting('show_link_bug_notification') == 'true' && $this->user_is_logged_in) {
$bug_notification_link = '<li class="report">
<a href="http://support.chamilo.org/projects/chamilo-18/wiki/How_to_report_bugs" target="_blank">
<img src="'.api_get_path(
WEB_IMG_PATH
).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang(
<img src="'.api_get_path(WEB_IMG_PATH).'bug.large.png" style="vertical-align: middle;" alt="'.get_lang('ReportABug').'" title="'.get_lang(
'ReportABug'
).'"/></a>
</li>';

@ -1,29 +1,30 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
////Add security from Chamilo
// Add security from Chamilo
api_protect_course_script();
api_block_anonymous_users();
//
# Save the audio to a URL-accessible directory for playback.
parse_str($_SERVER['QUERY_STRING'], $params);
if(isset($params['waminame']) && isset($params['wamidir']) && isset($params['wamiuserid'])) {
$waminame = $params['waminame'];
$wamidir = $params['wamidir'];
$wamiuserid = $params['wamiuserid'];
}
else {
api_not_allowed();
die();
if (isset($params['waminame']) && isset($params['wamidir']) && isset($params['wamiuserid'])) {
$waminame = $params['waminame'];
$wamidir = $params['wamidir'];
$wamiuserid = $params['wamiuserid'];
} else {
api_not_allowed();
die();
}
if ($wamiuserid!= api_get_user_id() || api_get_user_id()==0 || $wamiuserid==0) {
api_not_allowed();
die();
if ($wamiuserid != api_get_user_id() || api_get_user_id() == 0 || $wamiuserid == 0) {
api_not_allowed();
die();
}
//clean
$waminame = Security::remove_XSS($waminame);
@ -31,47 +32,96 @@ $waminame = Database::escape_string($waminame);
$waminame = addslashes(trim($waminame));
$waminame = replace_dangerous_char($waminame, 'strict');
$waminame = disable_dangerous_file($waminame);
$wamidir = Security::remove_XSS($wamidir);
$wamidir = Security::remove_XSS($wamidir);
$content = file_get_contents('php://input');
if (empty($content)) {
exit;
}
//security extension
$ext = explode('.', $waminame);
$ext = strtolower($ext[sizeof($ext) - 1]);
if($ext!= 'wav'){
die();
if ($ext != 'wav') {
die();
}
//Do not use here check Fileinfo method because return: text/plain
$dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$saveDir=$dirBaseDocuments.$wamidir;
$dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$saveDir = $dirBaseDocuments.$wamidir;
$current_session_id = api_get_session_id();
$groupId=$_SESSION['_gid'];
$groupId = api_get_group_id();
//avoid duplicates
$waminame_to_save=$waminame;
$title_to_save=str_replace('_',' ',$waminame);
$waminame_noex=basename($waminame, ".wav");
if (file_exists($saveDir.'/'.$waminame_noex.'.'.$ext)){
$i = 1;
while (file_exists($saveDir.'/'.$waminame_noex.'_'.$i.'.'.$ext)) $i++;
$waminame_to_save = $waminame_noex . '_' . $i . '.'.$ext;
$title_to_save = $waminame_noex . '_' . $i . '.'.$ext;
$title_to_save = str_replace('_',' ',$title_to_save);
$waminame_to_save = $waminame;
$title_to_save = str_replace('_', ' ', $waminame);
$waminame_noex = basename($waminame, ".wav");
if (file_exists($saveDir.'/'.$waminame_noex.'.'.$ext)) {
$i = 1;
while (file_exists($saveDir.'/'.$waminame_noex.'_'.$i.'.'.$ext)) {
$i++;
}
$waminame_to_save = $waminame_noex.'_'.$i.'.'.$ext;
$title_to_save = $waminame_noex.'_'.$i.'.'.$ext;
$title_to_save = str_replace('_', ' ', $title_to_save);
}
$documentPath = $saveDir.'/'.$waminame_to_save;
//add to disk
// Add to disk
$fh = fopen($documentPath, 'w') or die("can't open file");
fwrite($fh, $content);
fclose($fh);
//add document to database
$doc_id = add_document($_course, $wamidir.'/'.$waminame_to_save, 'file', filesize($documentPath), $title_to_save);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
?>
$addToLP = false;
if (isset($_REQUEST['lp_item_id']) && !empty($_REQUEST['lp_item_id'])) {
$lpItemId = $_REQUEST['lp_item_id'];
$lp = isset($_SESSION['oLP']) ? $_SESSION['oLP'] : null;
if (!empty($lp)) {
$addToLP = true;
// Converts wav into mp3
require_once '../../../../vendor/autoload.php';
$ffmpeg = \FFMpeg\FFMpeg::create();
$oldWavFile = $documentPath;
if (file_exists($oldWavFile)) {
$video = $ffmpeg->open($documentPath);
$waminame_to_save = str_replace('wav', 'mp3', $waminame_to_save);
$documentPath = $saveDir.'/'.$waminame_to_save;
$title_to_save = $waminame_to_save;
$result = $video->save(new FFMpeg\Format\Audio\Mp3(), $documentPath);
if ($result) {
unlink($oldWavFile);
}
}
}
}
if (file_exists($documentPath)) {
// Add document to database
$newDocId = add_document($_course, $wamidir.'/'.$waminame_to_save, 'file', filesize($documentPath), $title_to_save);
api_item_property_update(
$_course,
TOOL_DOCUMENT,
$newDocId,
'DocumentAdded',
api_get_user_id(),
$groupId,
null,
null,
null,
$current_session_id
);
if ($addToLP) {
$lp->set_modified_on();
$lpItem = new learnpathItem($lpItemId);
$lpItem->add_audio_from_documents($newDocId);
}
}

@ -75,7 +75,9 @@ Wami.setup = function(options) {
// Detecting the OS is a big no-no in Javascript programming, but
// I can't think of a better way to know if wmode is supported or
// not... since NOT supporting it (like Flash on Ubuntu) is a bug.
return (navigator.platform.indexOf("Linux") == -1);
//return (navigator.platform.indexOf("Linux") == -1);
// Chamilo change
return true;
}
function setOptions(options) {
@ -125,7 +127,7 @@ Wami.setup = function(options) {
var container = document.createElement('div');
container.style.position = 'absolute';
_options.cid = Wami.createID();
_options.cid = Wami.createID();
container.setAttribute('id', _options.cid);
var swfdiv = document.createElement('div');

@ -93,6 +93,18 @@ function check_php_setting($php_setting, $recommended_value, $return_success = f
}
}
/**
* This function return the value of a php.ini setting if not "" or if exists, otherwise return false
*/
function check_php_setting_exists($php_setting) {
if (ini_get($php_setting) != "") {
return ini_get($php_setting);
}
return false;
}
/**
* Returns a textual value ('ON' or 'OFF') based on a requester 2-state ini- configuration setting.
*
@ -1056,6 +1068,12 @@ function display_requirements($installType, $badUpdatePath, $updatePath = '', $u
// SERVER REQUIREMENTS
echo '<div class="RequirementHeading"><h2>'.get_lang('ServerRequirements').'</h2>';
$timezone = check_php_setting_exists("date.timezone");
if (!$timezone) {
echo "<div class='warning-message'>".Display::return_icon('warning.png',get_lang('Warning'),'',ICON_SIZE_MEDIUM).get_lang("DateTimezoneSettingNotSet")."</div>";
}
echo '<div class="RequirementText">'.get_lang('ServerRequirementsInfo').'</div>';
echo '<div class="RequirementContent">';
echo '<table class="table">

@ -1995,15 +1995,16 @@ class learnpath {
* Returns the HTML necessary to print a mediaplayer block inside a page
* @return string The mediaplayer HTML
*/
public function get_mediaplayer($autostart='true') {
public function get_mediaplayer($autostart = 'true')
{
$course_id = api_get_course_int_id();
global $_course;
$tbl_lp_item = Database :: get_course_table(TABLE_LP_ITEM);
$tbl_lp_item_view = Database :: get_course_table(TABLE_LP_ITEM_VIEW);
// Getting all the information about the item.
$sql = "SELECT * FROM " . $tbl_lp_item . " as lp INNER JOIN " . $tbl_lp_item_view . " as lp_view on lp.id = lp_view.lp_item_id " .
"WHERE lp.id = '" . $_SESSION['oLP']->current . "' AND
$sql = "SELECT * FROM ".$tbl_lp_item." as lp INNER JOIN ".$tbl_lp_item_view." as lp_view on lp.id = lp_view.lp_item_id ".
"WHERE lp.id = '".$_SESSION['oLP']->current."' AND
lp.c_id = $course_id AND
lp_view.c_id = $course_id";
$result = Database::query($sql);
@ -2031,20 +2032,27 @@ class learnpath {
$autostart_audio = 'true';
}
$courseInfo = api_get_course_info();
$audio = $row['audio'];
$file = '../../courses/'.$courseInfo['path'].'/document/audio/'.$audio;
if (!file_exists($file)) {
$lpPathInfo = $_SESSION['oLP']->generate_lp_folder(api_get_course_info());
$file = '../../courses/'.$_course['path'].'/document'.$lpPathInfo['dir'].$audio;
}
$player = Display::getMediaPlayer($file, array('id' => 'lp_audio_media_player', 'autoplay' => $autostart_audio, 'width' => '100%'));
// The mp3 player.
$output = '<div id="container">';
$output .= '<script type="text/javascript" src="../inc/lib/mediaplayer/swfobject.js"></script>';
$output .= '<script type="text/javascript">
var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","file=' . api_get_path(WEB_COURSE_PATH) . $_course['path'] . '/document/audio/' . $row['audio'] . '&autostart=' . $autostart_audio.'");
s1.write("container");
</script>
</div>';
$output .= $player;
$output .= '</div>';
}
return $output;
}
/**
* This function checks if the learnpath is visible for student after the progress of its prerequisite is completed, and considering time availability
* @param int Learnpath id
@ -2822,7 +2830,7 @@ class learnpath {
// The anchor will let us center the TOC on the currently viewed item &^D
if ($item['type'] != 'dokeos_module' && $item['type'] != 'dokeos_chapter') {
$html .= '<div class="' . $style_item . '" style="padding-left: ' . ($item['level'] * 1.5) . 'em; padding-right:' . ($item['level'] / 2) . 'em" title="' . $item['description'] . '" >';
$html .= '<a name="atoc_' . $item['id'] . '" />';
$html .= '<a name="atoc_' . $item['id'] . '" ></a>';
} else {
$html .= '<div class="' . $style_item . '" style="padding-left: ' . ($item['level'] * 2) . 'em; padding-right:' . ($item['level'] * 1.5) . 'em" title="' . $item['description'] . '" >';
}
@ -4914,7 +4922,8 @@ class learnpath {
public function return_new_tree($update_audio = 'false', $drop_element_here = false) {
$ajax_url = api_get_path(WEB_AJAX_PATH).'lp.ajax.php';
echo '<script>
$return = '<script>
var newOrderData= "";
function processChildren(parentId) {
//Loop through the children of the UL element defined by the parentId
@ -5247,7 +5256,7 @@ class learnpath {
}
}
$return = '<div class="lp_tree well">';
$return .= '<div class="lp_tree well">';
$return .= '<ul id="lp_item_list">';
$return .='<h4>'.$this->name.'</h4><br>';
@ -5304,7 +5313,8 @@ class learnpath {
* This function builds the action menu
* @return void
*/
public function build_action_menu() {
public function build_action_menu($returnContent = false)
{
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
$gradebook = isset($_GET['gradebook']) ? Security :: remove_XSS($_GET['gradebook']) : null;
@ -5334,6 +5344,10 @@ class learnpath {
);
$return .= Display::group_button(get_lang('PrerequisitesOptions'), $buttons);
$return .= '</div>';
if ($returnContent) {
return $return;
}
echo $return;
}
@ -7880,6 +7894,15 @@ class learnpath {
//$return .= '<td class="radio"' . (($arrLP[$i]['item_type'] != TOOL_HOTPOTATOES) ? ' colspan="3"' : '') . ' />';
if ($arrLP[$i]['item_type'] == TOOL_QUIZ) {
// lets update max_score Quiz information depending of the Quiz Advanced properties
require_once api_get_path(LIBRARY_PATH)."lp_item.lib.php";
$tmp_obj_lp_item = new LpItem($course_id, $arrLP[$i]['id']);
$tmp_obj_exercice = new Exercise();
$tmp_obj_exercice->read($tmp_obj_lp_item->path);
$tmp_obj_lp_item->max_score = $tmp_obj_exercice->get_max_score();
$tmp_obj_lp_item->update_in_bdd();
$arrLP[$i]['max_score'] = $tmp_obj_lp_item->max_score;
$return .= '<td class="exercise" style="border:1px solid #ccc;">';
$return .= '<center><input size="4" maxlength="3" name="min_' . $arrLP[$i]['id'] . '" type="text" value="' . (($arrLP[$i]['id'] == $preq_id) ? $preq_mastery : 0) . '" /></center>';
$return .= '</td>';

@ -13,8 +13,9 @@ $this_section = SECTION_COURSES;
api_protect_course_script();
include 'learnpath_functions.inc.php';
include 'resourcelinker.inc.php';
require_once 'learnpath_functions.inc.php';
require_once 'resourcelinker.inc.php';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
@ -28,7 +29,9 @@ $action = isset($_GET['action']) ? $_GET['action'] : null;
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' && $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script language='JavaScript' type='text/javascript'> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
$htmlHeadXtra[] = "<script>
window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\";
</script>";
}
if ((!$is_allowed_to_edit) || ($isStudentView)) {
error_log('New LP - User not authorized in lp_add_item.php');
@ -43,9 +46,9 @@ if (isset($_SESSION['gradebook'])) {
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
@ -64,7 +67,7 @@ switch ($type) {
break;
}
if ($action == 'add_item' && $type == 'document' ) {
if ($action == 'add_item' && $type == 'document') {
$interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated'));
}
@ -75,53 +78,71 @@ if (empty($lp_item_id)) {
api_not_allowed();
}
Display::display_header(null, 'Path');
$lp_item = new learnpathItem($lp_item_id);
$tpl = new Template($tool_name);
$form = new FormValidator('add_audio', 'post', api_get_self().'?action=add_audio&id='.$lp_item_id, null, array('enctype' => 'multipart/form-data'));
$suredel = trim(get_lang('AreYouSureToDelete'));
/* DISPLAY SECTION */
echo $_SESSION['oLP']->build_action_menu();
$file = null;
$lpPathInfo = $_SESSION['oLP']->generate_lp_folder(api_get_course_info());
echo '<div class="row-fluid" style="overflow:hidden">';
echo '<div id="lp_sidebar" class="span4">';
echo $_SESSION['oLP']->return_new_tree(null, true);
if (isset($lp_item->audio) && !empty($lp_item->audio)) {
$file = '../../courses/'.$_course['path'].'/document/audio/'.$lp_item->audio;
if (!file_exists($file)) {
$file = '../../courses/'.$_course['path'].'/document'.$lpPathInfo['dir'].$lp_item->audio;
}
}
$page = $_SESSION['oLP']->build_action_menu(true);
$page .= '<div class="row-fluid" style="overflow:hidden">';
$page .= '<div id="lp_sidebar" class="span4">';
$page .= $_SESSION['oLP']->return_new_tree(null, true);
// Show the template list.
echo '</div>';
$page .= '</div>';
echo '<div id="doc_form" class="span8">';
$page .= '<div id="doc_form" class="span8">';
$lp_item = new learnpathItem($lp_item_id);
$form = new FormValidator('add_audio', 'post', api_get_self().'?action=add_audio&id='.$lp_item_id, null, array('enctype' => 'multipart/form-data'));
$form->addElement('header', get_lang('RecordYourVoice'));
$tpl->assign('lp_item_id', $lp_item_id);
$tpl->assign('lp_dir', api_remove_trailing_slash($lpPathInfo['dir']));
$voiceContent = $tpl->fetch('default/learnpath/record_voice.tpl');
$form->addElement('html', $voiceContent);
$form->addElement('header', get_lang('UplUpload'));
$form->addElement('html', $lp_item->get_title());
$form->addElement('file', 'file', get_lang('AudioFile'), 'style="width: 250px"');
$form->addElement('hidden', 'id', $lp_item_id);
if (isset($lp_item->audio) && !empty($lp_item->audio)) {
if (!empty($file)) {
$form->addElement('checkbox', 'delete_file', null, get_lang('RemoveAudio'));
}
$form->addElement('hidden', 'id', $lp_item_id);
$player = '<script type="text/javascript" src="../inc/lib/mediaplayer/swfobject.js"></script>';
$player .= '<div id="preview"></div><script type="text/javascript">
var s1 = new SWFObject("../inc/lib/mediaplayer/player.swf","ply","250","20","9","#FFFFFF");
s1.addParam("allowscriptaccess","always");
s1.addParam("flashvars","file=../../courses/' . $_course['path'] . '/document/audio/' . $lp_item->audio . '");
s1.write("preview");
</script>';
$form->addElement('label', get_lang('Preview'), $player);
if (!empty($file)) {
$audioPlayer = '<div id="preview">'.Display::getMediaPlayer($file)."</div>";
$form->addElement('label', get_lang('Preview'), $audioPlayer);
}
$form->addElement('button', 'submit', get_lang('Edit'));
$course_info = api_get_course_info();
$document_tree = DocumentManager::get_document_preview($course_info, null, null, 0, false, '/audio', 'lp_controller.php?action=add_audio&id='.$lp_item_id);
$form->display();
$page .= $form->return_form();
$page .= '<legend>'.get_lang('SelectAnAudioFileFromDocuments').'</legend>';
$page .= $document_tree;
$page .= '</div>';
echo '<legend>'.get_lang('SelectAnAudioFileFromDocuments').'</legend>';
echo $document_tree;
echo '</div>';
$page .= '</div>';
echo '</div>';
/* FOOTER */
Display::display_footer();
$tpl->assign('content', $page);
$content = $tpl->fetch('default/learnpath/lp_upload_audio.tpl');
$tpl->display_one_col_template();

@ -27,10 +27,16 @@ require_once 'back_compat.inc.php';
* @param integer Current item ID
* @param integer New item ID
*/
function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_item) {
$debug = 0;
function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_item)
{
$debug = 0;
$return = '';
if ($debug > 0) { error_log('In xajax_switch_item_details('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')', 0); }
if ($debug > 0) {
error_log(
'In xajax_switch_item_details('.$lp_id.','.$user_id.','.$view_id.','.$current_item.','.$next_item.')',
0
);
}
//$objResponse = new xajaxResponse();
/*$item_id may be one of:
* -'next'
@ -47,16 +53,24 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
require_once 'aiccItem.class.php';
$mylp = '';
if (isset($_SESSION['lpobject'])) {
if ($debug > 1) { error_log('$_SESSION[lpobject] is set', 0); }
if ($debug > 1) {
error_log('$_SESSION[lpobject] is set', 0);
}
$oLP = unserialize($_SESSION['lpobject']);
if (!is_object($oLP)) {
if ($debug > 1) { error_log(print_r($oLP,true), 0); }
if ($debug > 2) { error_log('Building new lp', 0); }
if ($debug > 1) {
error_log(print_r($oLP, true), 0);
}
if ($debug > 2) {
error_log('Building new lp', 0);
}
unset($oLP);
$code = api_get_course_id();
$mylp = new learnpath($code,$lp_id,$user_id);
$mylp = new learnpath($code, $lp_id, $user_id);
} else {
if ($debug > 1) { error_log('Reusing session lp', 0); }
if ($debug > 1) {
error_log('Reusing session lp', 0);
}
$mylp = $oLP;
}
}
@ -66,31 +80,39 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
$mylp->set_current_item($current_item);
$mylp->next();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
if ($debug > 1) {
error_log('In {next} - next item is '.$new_item_id.'(current: '.$current_item.')', 0);
}
break;
case 'previous':
$mylp->set_current_item($current_item);
$mylp->previous();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
if ($debug > 1) {
error_log('In {previous} - next item is '.$new_item_id.'(current: '.$current_item.')', 0);
}
break;
case 'first':
$mylp->set_current_item($current_item);
$mylp->first();
$new_item_id = $mylp->get_current_item_id();
if ($debug > 1) { error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
if ($debug > 1) {
error_log('In {first} - next item is '.$new_item_id.'(current: '.$current_item.')', 0);
}
break;
case 'last':
break;
default:
// Should be filtered to check it's not hacked.
if($next_item == $current_item){
if ($next_item == $current_item) {
// If we're opening the same item again.
$mylp->items[$current_item]->restart();
}
$new_item_id = $next_item;
$mylp->set_current_item($new_item_id);
if ($debug > 1) { error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')', 0); }
if ($debug > 1) {
error_log('In {default} - next item is '.$new_item_id.'(current: '.$current_item.')', 0);
}
break;
}
$mylp->start_current_item(true);
@ -101,7 +123,9 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
if (is_object($mylp->items[$new_item_id])) {
$mylpi = $mylp->items[$new_item_id];
} else {
if ($debug > 1) { error_log('In switch_item_details - generating new item object', 0); }
if ($debug > 1) {
error_log('In switch_item_details - generating new item object', 0);
}
$mylpi = new learnpathItem($new_item_id, $user_id);
$mylpi->set_lp_view($view_id);
}
@ -115,15 +139,17 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
* -suspend_data
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if ($mymax === '') { $mymax = "''"; }
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js');
$mymastery_score = $mylpi->get_mastery_score();
$mymax = $mylpi->get_max();
if ($mymax === '') {
$mymax = "''";
}
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
$mylesson_location = $mylpi->get_lesson_location();
$mytotal_time = $mylpi->get_scorm_time('js');
$mymastery_score = $mylpi->get_mastery_score();
$mymax_time_allowed = $mylpi->get_max_time_allowed();
$mylaunch_data = $mylpi->get_launch_data();
$mylaunch_data = $mylpi->get_launch_data();
/*
if ($mylpi->get_type() == 'asset') {
// Temporary measure to save completion of an asset. Later on, Chamilo should trigger something on unload, maybe... (even though that would mean the last item cannot be completed)
@ -132,11 +158,11 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
$mylpi->save();
}
*/
$mysession_time = $mylpi->get_total_time();
$mysuspend_data = $mylpi->get_suspend_data();
$mysession_time = $mylpi->get_total_time();
$mysuspend_data = $mylpi->get_suspend_data();
$mylesson_location = $mylpi->get_lesson_location();
$myic = $mylpi->get_interactions_count();
$myistring = '';
$myic = $mylpi->get_interactions_count();
$myistring = '';
for ($i = 0; $i < $myic; $i++) {
$myistring .= ",[".$i.",'','','','','','','']";
}
@ -153,21 +179,21 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
* with both SCORM and proper learning path tracking.
*/
$return .=
"olms.score=".$myscore.";" .
"olms.max=".$mymax.";" .
"olms.min=".$mymin.";" .
"olms.lesson_status='".$mylesson_status."';" .
"olms.lesson_location='".$mylesson_location."';" .
"olms.session_time='".$mysession_time."';" .
"olms.suspend_data='".$mysuspend_data."';" .
"olms.total_time = '".$mytotal_time."';" .
"olms.mastery_score = '".$mymastery_score."';" .
"olms.max_time_allowed = '".$mymax_time_allowed."';" .
"olms.launch_data = '".$mylaunch_data."';" .
"olms.interactions = new Array(".$myistring.");" .
"olms.item_objectives = new Array();" .
"olms.G_lastError = 0;" .
"olms.G_LastErrorMessage = 'No error';" ;
"olms.score=".$myscore.";".
"olms.max=".$mymax.";".
"olms.min=".$mymin.";".
"olms.lesson_status='".$mylesson_status."';".
"olms.lesson_location='".$mylesson_location."';".
"olms.session_time='".$mysession_time."';".
"olms.suspend_data='".$mysuspend_data."';".
"olms.total_time = '".$mytotal_time."';".
"olms.mastery_score = '".$mymastery_score."';".
"olms.max_time_allowed = '".$mymax_time_allowed."';".
"olms.launch_data = '".$mylaunch_data."';".
"olms.interactions = new Array(".$myistring.");".
"olms.item_objectives = new Array();".
"olms.G_lastError = 0;".
"olms.G_LastErrorMessage = 'No error';";
/*
* and re-initialise the rest
* -lms_lp_id
@ -179,56 +205,57 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
* -lms_view_id
* -lms_user_id
*/
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data();
$mytotal = $mylp->get_total_items_count_without_chapters();
$mycomplete = $mylp->get_complete_items_count();
$myprogress_mode = $mylp->get_progress_bar_mode();
$myprogress_mode = ($myprogress_mode == '' ? '%' : $myprogress_mode);
$mynext = $mylp->get_next_item_id();
$myprevious = $mylp->get_previous_item_id();
$myitemtype = $mylpi->get_type();
$mylesson_mode = $mylpi->get_lesson_mode();
$mycredit = $mylpi->get_credit();
$mylaunch_data = $mylpi->get_launch_data();
$myinteractions_count = $mylpi->get_interactions_count();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
$myobjectives_count = $mylpi->get_objectives_count();
$mycore_exit = $mylpi->get_core_exit();
$return .=
//"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";" .
"olms.lms_item_id=".$new_item_id.";" .
"olms.lms_old_item_id=0;" .
//"lms_been_synchronized=0;" .
"olms.lms_initialized=0;" .
//"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";" .
"olms.lms_user_id=".$user_id.";" .
"olms.next_item=".$new_item_id.";" . // This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";" .
"olms.lms_previous_item=".$myprevious.";" .
"olms.lms_item_type = '".$myitemtype."';" .
"olms.lms_item_credit = '".$mycredit."';" .
"olms.lms_item_lesson_mode = '".$mylesson_mode."';" .
"olms.lms_item_launch_data = '".$mylaunch_data."';" .
"olms.lms_item_interactions_count = '".$myinteractions_count."';" .
"olms.lms_item_objectives_count = '".$myinteractions_count."';" .
"olms.lms_item_core_exit = '".$mycore_exit."';" .
"olms.asset_timer = 0;";
//"saved_lesson_status='not attempted';" .
"olms.lms_lp_id=".$lp_id.";".
"olms.lms_item_id=".$new_item_id.";".
"olms.lms_old_item_id=0;".
//"lms_been_synchronized=0;" .
"olms.lms_initialized=0;".
//"lms_total_lessons=".$mytotal.";" .
//"lms_complete_lessons=".$mycomplete.";" .
//"lms_progress_bar_mode='".$myprogress_mode."';" .
"olms.lms_view_id=".$view_id.";".
"olms.lms_user_id=".$user_id.";".
"olms.next_item=".$new_item_id.";". // This one is very important to replace possible literal strings.
"olms.lms_next_item=".$mynext.";".
"olms.lms_previous_item=".$myprevious.";".
"olms.lms_item_type = '".$myitemtype."';".
"olms.lms_item_credit = '".$mycredit."';".
"olms.lms_item_lesson_mode = '".$mylesson_mode."';".
"olms.lms_item_launch_data = '".$mylaunch_data."';".
"olms.lms_item_interactions_count = '".$myinteractions_count."';".
"olms.lms_item_objectives_count = '".$myinteractions_count."';".
"olms.lms_item_core_exit = '".$mycore_exit."';".
"olms.asset_timer = 0;";
$return .= "update_toc('unhighlight','".$current_item."');".
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
"update_toc('highlight','".$new_item_id."');".
"update_toc('$mylesson_status','".$new_item_id."');".
"update_progress_bar('$mycomplete','$mytotal','$myprogress_mode');";
$mylp->set_error_msg('');
$mylp->prerequisites_match(); // Check the prerequisites are all complete.
if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
if ($debug > 1) {
error_log('Prereq_match() returned '.htmlentities($mylp->error), 0);
}
$_SESSION['scorm_item_id'] = $new_item_id; // Save the new item ID for the exercise tool to use.
$_SESSION['lpobject'] = serialize($mylp);
$_SESSION['lpobject'] = serialize($mylp);
return $return;
//return $objResponse;
}
echo switch_item_details($_REQUEST['lid'], $_REQUEST['uid'], $_REQUEST['vid'], $_REQUEST['iid'], $_REQUEST['next']);

@ -23,7 +23,7 @@ require_once 'scorm.class.php';
require_once 'aicc.class.php';
$htmlHeadXtra[] = '<script>
var chamilo_xajax_handler = window.parent.oxajax;
var chamilo_xajax_handler = window.parent.oxajax;
</script>';
$progress_bar = '';
@ -50,7 +50,7 @@ if (isset($_SESSION['lpobject'])) {
$mycourselptheme = null;
if (api_get_setting('allow_course_theme') == 'true') {
$mycourselptheme = api_get_course_setting('allow_learning_path_theme');
$mycourselptheme = api_get_course_setting('allow_learning_path_theme');
}
if (!empty($lp_theme_css) && !empty($mycourselptheme) && $mycourselptheme != -1 && $mycourselptheme == 1) {
@ -65,4 +65,15 @@ if (isset($_SESSION['lpobject'])) {
}
session_write_close();
?>
<span><?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?></span>
<script type="text/javascript">
$(document).ready(function() {
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer({
success: function(player, node) {
}
});
});
</script>
<span>
<?php echo (!empty($mediaplayer)) ? $mediaplayer : '&nbsp;' ?>
</span>

@ -70,33 +70,22 @@ $platform_theme = api_get_setting('stylesheets'); // Plataform's css.
$my_style = $platform_theme;
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.lp_minipanel.js" type="text/javascript" language="javascript"></script>';
/*
* already added in lp_controller.php
if (api_get_setting('show_glossary_in_documents') == 'ismanual' || api_get_setting('show_glossary_in_documents') == 'isautomatic' ) {
$htmlHeadXtra[] = '<script type="text/javascript">
<!--
var jQueryFrameReadyConfigPath = \''.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.min.js\';
-->
</script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.frameready.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/jquery.highlight.js" type="text/javascript" language="javascript"></script>';
}*/
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
$(document).ready(function() {
$("div#log_content_cleaner").bind("click", function() {
$("div#log_content").empty();
});
//jQuery("video:not(.skip), audio:not(.skip)").mediaelementplayer();
});
var chamilo_xajax_handler = window.oxajax;
</script>';
if ($_SESSION['oLP']->mode == 'embedframe' || $_SESSION['oLP']->get_hide_toc_frame()==1 ) {
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
toogle_minipanel();
});
</script>';
$(document).ready(function() {
toogle_minipanel();
});
</script>';
}
//Impress js
@ -225,7 +214,6 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
if ($safe_id == strval(intval($safe_id)) && $safe_item_id == strval(intval($safe_item_id))) {
$sql = 'SELECT start_date, exe_date, exe_result, exe_weighting FROM ' . $TBL_TRACK_EXERCICES . ' WHERE exe_id = '.$safe_exe_id;
if ($debug) error_log($sql);
$res = Database::query($sql);
$row_dates = Database::fetch_array($res);
@ -237,12 +225,10 @@ if ($type_quiz && !empty($_REQUEST['exeId']) && isset($lp_id) && isset($_GET['lp
$max_score = (float)$row_dates['exe_weighting'];
$sql_upd_max_score = "UPDATE $TBL_LP_ITEM SET max_score = '$max_score' WHERE c_id = $course_id AND id = '".$safe_item_id."'";
if ($debug) error_log($sql_upd_max_score);
Database::query($sql_upd_max_score);
$sql_last_attempt = "SELECT id FROM $TBL_LP_ITEM_VIEW WHERE c_id = $course_id AND lp_item_id = '$safe_item_id' AND lp_view_id = '".$_SESSION['oLP']->lp_view_id."' order by id desc limit 1";
$res_last_attempt = Database::query($sql_last_attempt);
if ($debug) error_log($sql_last_attempt);
if (Database::num_rows($res_last_attempt)) {
$row_last_attempt = Database::fetch_row($res_last_attempt);
@ -321,22 +307,25 @@ $res_media= Database::query($sql);
if (Database::num_rows($res_media) > 0) {
while ($row_media= Database::fetch_array($res_media)) {
if (!empty($row_media['audio'])) {$show_audioplayer = true; break;}
if (!empty($row_media['audio'])) {
$show_audioplayer = true;
break;
}
}
}
echo '<div id="learning_path_main" style="width:100%;height:100%;">';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
if ($is_allowed_to_edit) {
echo '<div id="learning_path_breadcrumb_zone">';
global $interbreadcrumb;
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
//$interbreadcrumb[] = array('type' => 'right', 'url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => get_lang('Edit'), 'class' => 'btn btn-mini btn-warning');
echo return_breadcrumb($interbreadcrumb, null, null);
echo '</div>';
}
$is_allowed_to_edit = api_is_allowed_to_edit(null, true, false, false);
if ($is_allowed_to_edit) {
echo '<div id="learning_path_breadcrumb_zone">';
global $interbreadcrumb;
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list&isStudentView=false', 'name' => get_lang('LearningPaths'));
$interbreadcrumb[] = array('url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => $_SESSION['oLP']->get_name());
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Preview'));
//$interbreadcrumb[] = array('type' => 'right', 'url' => api_get_self()."?action=add_item&type=step&lp_id=".$_SESSION['oLP']->lp_id."&isStudentView=false", 'name' => get_lang('Edit'), 'class' => 'btn btn-mini btn-warning');
echo return_breadcrumb($interbreadcrumb, null, null);
echo '</div>';
}
echo '<div id="learning_path_left_zone" style="'.$display_none.'"> ';
echo '<div id="header">
<table>
@ -475,23 +464,28 @@ echo '<div id="learning_path_main" style="width:100%;height:100%;">';
?>
$.frameReady(function(){
// $("<div>I am a div courses</div>").prependTo("body");
}, "top.content_name",
{ load: [
{type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
{type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
] }
);
<?php
}
}
?>
}
window.onload = updateContentHeight;
window.onresize = updateContentHeight;
-->
},
"top.content_name",
{
load: [
{type:"script", id:"_fr1", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.min.js"},
{type:"script", id:"_fr4", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.min.js"},
{type:"stylesheet", id:"_fr5", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery-ui/smoothness/jquery-ui-1.8.21.custom.css"},
{type:"script", id:"_fr2", src:"<?php echo api_get_path(WEB_LIBRARY_PATH); ?>javascript/jquery.highlight.js"}
]}
);
<?php
}
}
?>}
$(document).ready(function() {
updateContentHeight();
$(window).resize(function() {
updateContentHeight();
});
});
//window.onload = updateContentHeight;
//window.onresize = updateContentHeight;
</script>
<?php
// Restore a global setting.

@ -268,7 +268,10 @@ function LMSInitialize() {
url: "lp_ajax_initialize.php",
data: params,
dataType: 'script',
async: false
async: false,
success:function(data) {
jQuery("video:not(.skip), audio:not(.skip)").mediaelementplayer();
}
});
olms.lms_initialized = 1;
@ -294,7 +297,7 @@ function LMSInitialize() {
logit_scorm('LMSInitialize() with params: '+log);
if (olms.lms_lp_type == 1 || olms.lms_item_type == 'asset' || olms.lms_item_type == 'document') {
if (olms.lms_lp_type == 1 || olms.lms_item_type == 'asset' || olms.lms_item_type == 'document') {
xajax_start_timer();
}
@ -1455,7 +1458,7 @@ function switch_item(current_item, next_item){
}
<?php } else { ?>
console.log('loading '+mysrc+' in frame');
log_in_log('loading '+mysrc+' in frame');
cont_f.attr("src",mysrc);
<?php } ?>
@ -1463,17 +1466,25 @@ function switch_item(current_item, next_item){
xajax_start_timer();
}
//(4) refresh the audio player if needed
$.ajax({
type: "POST",
url: "lp_nav.php",
data: "",
beforeSend: function() {
$.each($('audio'), function () {
var player = new MediaElementPlayer($(this));
player.pause();
});
},
success: function(tmp_data) {
if ($("#lp_media_file").length != 0) {
$("#lp_media_file").html(tmp_data);
}
}
});
return true;
}

@ -1,58 +1,58 @@
<footer> <!-- start of #footer section -->
<footer> <!-- start of #footer section -->
<div class="container">
<div class="row">
<div id="footer_left" class="span4">
<div class="row">
<div id="footer_left" class="span4">
{% if session_teachers is not null %}
<div id="session_teachers">
{{ session_teachers }}
{{ session_teachers }}
</div>
{% endif %}
{% if teachers is not null %}
<div id="teachers">
{{ teachers }}
{{ teachers }}
</div>
{% endif %}
{# Plugins for footer section #}
{# Plugins for footer section #}
{% if plugin_footer_left is not null %}
<div id="plugin_footer_left">
{{ plugin_footer_left }}
</div>
{{ plugin_footer_left }}
</div>
{% endif %}
&nbsp;
</div>
<div id="footer_center" class="span4">
{# Plugins for footer section #}
{# Plugins for footer section #}
{% if plugin_footer_center is not null %}
<div id="plugin_footer_center">
{{ plugin_footer_center }}
{{ plugin_footer_center }}
</div>
{% endif %}
&nbsp;
</div>
<div id="footer_right" class="span4">
<div id="footer_right" class="span4">
{% if administrator_name is not null %}
<div id="admin_name">
{{ administrator_name }}
{{ administrator_name }}
</div>
{% endif %}
<div id="software_name">
<div id="software_name">
{{ "Platform"|get_lang }} <a href="{{_p.web}}" target="_blank">{{_s.software_name}} {{_s.system_version}}</a>
&copy; {{ "now"|date("Y") }}
&copy; {{ "now"|date("Y") }}
</div>
{# Plugins for footer section #}
{% if plugin_footer_right is not null %}
{# Plugins for footer section #}
{% if plugin_footer_right is not null %}
<div id="plugin_footer_right">
{{ plugin_footer_right }}
</div>
{{ plugin_footer_right }}
</div>
{% endif %}
&nbsp;
</div><!-- end of #footer_right -->
</div><!-- end of #row -->
</div><!-- end of #row -->
</div><!-- end of #container -->
</footer>
@ -62,34 +62,41 @@
<script>
/* Makes row highlighting possible */
$(document).ready( function() {
//Chosen select
$(".chzn-select").chosen({disable_search_threshold: 10});
//Table highlight
// Chosen select
$(".chzn-select").chosen({
disable_search_threshold: 10
});
// Mediaelement
jQuery('video:not(.skip), audio:not(.skip)').mediaelementplayer(/* Options */);
// Table highlight.
$("form .data_table input:checkbox").click(function() {
if ($(this).is(":checked")) {
$(this).parentsUntil("tr").parent().addClass("row_selected");
} else {
$(this).parentsUntil("tr").parent().removeClass("row_selected");
}
}
});
/* For non HTML5 browsers */
if ($("#formLogin".length > 1)) {
$("input[name=login]").focus();
}
/* For IOS users */
$('.autocapitalize_off').attr('autocapitalize', 'off');
//Tool tip (in exercises)
var tip_options = {
placement : 'right'
}
$('.boot-tooltip').tooltip(tip_options);
});
</script>
{% endraw %}
{{ execution_stats }}
</script>
{{ execution_stats }}

@ -0,0 +1,188 @@
<script type="text/javascript" src="{{ _p.web_lib }}javascript/rtc/RecordRTC.js"></script>
<script type="text/javascript" src="{{ _p.web_lib }}swfobject/swfobject.js"></script>
<script type="text/javascript" src="{{ _p.web_lib }}wami-recorder/recorder.js"></script>
<script type="text/javascript" src="{{ _p.web_lib }}wami-recorder/gui.js"></script>
<div id="rtc">
<audio class="skip" id="audio" autoplay="" loop="" controls=""></audio>
<span id="progress-info"></span>
<br />
<a id="record" class="btn btn-danger" >{{ 'RecordAudio' | get_lang }}</a>
<button id="stop" class="btn" disabled="">{{ 'StopRecordingAudio' | get_lang }}</button>
</div>
<div id="wami" style="float:left">
<a id="record-wami" class="btn btn-info">{{ 'ActivateAudioRecorder' | get_lang }}</a>
<br />
<div id="wami-recorder">
</div>
<div id="start-recording" class="alert" style="display:none">
{{ "StartSpeaking" | get_lang }}
</div>
</div>
<script>
function setupRecorder() {
Wami.setup({
id : "wami",
onReady : setupGUI,
swfUrl : "{{ _p.web_lib }}wami-recorder/Wami.swf"
});
$('#wami-recorder').css('margin-bottom', '150px');
}
function setupGUI() {
var uniq = 'rec_' + (new Date()).getTime() + ".wav";
var gui = new Wami.GUI({
id : "wami-recorder",
recordUrl : "{{ _p.web_lib }}wami-recorder/record_document.php?lp_item_id={{ lp_item_id }}&waminame="+uniq+"&wamidir={{ lp_dir }}&wamiuserid={{ _u.user_id }}",
//playUrl : "https://wami-recorder.appspot.com/audio",
buttonUrl : "{{ _p.web_lib }}wami-recorder/buttons.png",
buttonNoUrl: "{{ _p.web_img }}blank.gif",
onRecordStart : function() {
//console.log('Record starts');
$('#start-recording').show();
},
onRecordFinish: function() {
$('#start-recording').hide();
window.location.reload();
},
onError : function() {
},
singleButton : true
});
gui.setPlayEnabled(false);
}
</script>
<script>
$(document).ready(function() {
var isChrome = navigator.webkitGetUserMedia;
//isChrome = false;
if (isChrome) {
$('#rtc').show();
$('#wami').hide();
} else {
$('#rtc').hide();
$('#wami').show();
var recordWami = $('#record-wami');
recordWami.on('click', function() {
setupRecorder();
return false;
});
}
var format = 'webm'; // or wav
var record = $('#record');
var stop = document.getElementById('stop');
var preview = document.getElementById('audio');
var progressInfo = document.getElementById('progress-info');
var previewBlock = document.getElementById('preview');
function postBlob(blob, fileType, fileName) {
// FormData
var formData = new FormData();
formData.append(fileType + '-filename', fileName);
formData.append(fileType + '-blob', blob);
// progress-bar
var hr = document.createElement('hr');
progressInfo.appendChild(hr);
var strong = document.createElement('strong');
strong.innerHTML = fileType + ' upload progress: ';
progressInfo.appendChild(strong);
var progress = document.createElement('progress');
progressInfo.appendChild(progress);
// POST the Blob
$.ajax({
url:'{{ _p.web_ajax }}lp.ajax.php?a=record_audio&lp_item_id={{ lp_item_id }}',
data: formData,
processData: false,
contentType: false,
type: 'POST',
success:function(fileURL) {
window.location.reload();
progressInfo.appendChild(document.createElement('hr'));
var mediaElement = document.createElement(fileType);
mediaElement.src = fileURL;
mediaElement.controls = true;
var uniq = 'id' + (new Date()).getTime();
mediaElement.id = uniq;
$(previewBlock).html('');
previewBlock.appendChild(mediaElement);
mediaElement.play();
$(progressInfo).html('');
window.location.reload();
}
});
}
var recordAudio, recordVideo;
record.on('click', function() {
record.disabled = true;
var myURL = (window.URL || window.webkitURL || {});
if (navigator.getUserMedia) {
navigator.getUserMedia({
audio: true,
video: false
},
function(stream) {
if (window.IsChrome) stream = new window.MediaStream(stream.getAudioTracks());
preview.src = myURL.createObjectURL(stream);
console.log(preview.src);
preview.play();
recordAudio = RecordRTC(stream, {
type: 'audio'
});
recordAudio.startRecording();
/*recordVideo = RecordRTC(stream, {
type: 'video'
});*/
//recordVideo.startRecording();
stop.disabled = false;
},
function(err) {
console.log("The following error occured: " + err);
return false;
});
}
});
stop.onclick = function() {
record.disabled = false;
stop.disabled = true;
var fileName = Math.round(Math.random() * 99999999) + 99999999;
recordAudio.stopRecording();
postBlob(recordAudio.getBlob(), 'audio', fileName + '.' + format);
//recordVideo.stopRecording();
//PostBlob(recordVideo.getBlob(), 'video', fileName + '.webm');
preview.src = '';
};
});
</script>

@ -0,0 +1,129 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
// Including necessary files
require_once 'work.lib.php';
if (ADD_DOCUMENT_TO_WORK == false) {
exit;
}
$current_course_tool = TOOL_STUDENTPUBLICATION;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
$docId = isset($_GET['document_id']) ? intval($_GET['document_id']) : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
if (empty($workId)) {
api_not_allowed(true);
}
$my_folder_data = get_work_data_by_id($workId);
if (empty($my_folder_data)) {
api_not_allowed(true);
}
$work_data = get_work_assignment_by_id($workId);
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
$courseInfo = api_get_course_info();
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddDocument'));
$error_message = null;
switch ($action) {
case 'delete':
if (!empty($workId) && !empty($docId)) {
deleteDocumentToWork($docId, $workId, api_get_course_int_id());
$url = api_get_path(WEB_CODE_PATH).'work/add_document.php?id='.$workId;
header('Location: '.$url);
exit;
}
break;
}
Display :: display_header(null);
if (empty($docId)) {
echo Display::page_subheader(get_lang('DocumentsAdded'));
$documents = getAllDocumentToWork($workId, api_get_course_int_id());
if (!empty($documents)) {
echo '<div class="well">';
foreach ($documents as $doc) {
$documentId = $doc['document_id'];
$docData = DocumentManager::get_document_data_by_id($documentId, $courseInfo['code']);
if ($docData) {
$url = api_get_path(WEB_CODE_PATH).'work/add_document.php?action=delete&id='.$workId.'&document_id='.$documentId;
$link = Display::url(get_lang('Delete'), $url);
echo $docData['title'].' '.$link.'<br />';
}
}
echo '</div>';
}
$document_tree = DocumentManager::get_document_preview($courseInfo, null, null, 0, false, '/', api_get_path(WEB_CODE_PATH).'work/add_document.php?id='.$workId);
echo Display::page_subheader(get_lang('DocumentToAdd'));
echo $document_tree;
echo '<hr /><div class="clear"></div>';
} else {
$documentInfo = DocumentManager::get_document_data_by_id($docId, $courseInfo['code']);
$form = new FormValidator('add_doc', 'post', api_get_path(WEB_CODE_PATH).'work/add_document.php?id='.$workId.'&document_id='.$docId);
$form->addElement('header', get_lang('AddDocument'));
$form->addElement('hidden', 'add_doc', '1');
$form->addElement('hidden', 'id', $workId);
$form->addElement('hidden', 'document_id', $docId);
$form->addElement('label', get_lang('File'), $documentInfo['title']);
$form->addElement('style_submit_button', 'submit', get_lang('Add'));
$form->display();
if ($form->validate()) {
$values = $form->exportValues();
$workId = $values['id'];
$docId = $values['document_id'];
$data = getDocumentToWork($docId, $workId, api_get_course_int_id());
if (empty($data)) {
addDocumentToWork($docId, $workId, api_get_course_int_id());
Display::display_confirmation_message(get_lang('Added'));
} else {
Display::display_warning_message(get_lang('DocumentAlreadyAdded'));
}
}
}
/*
*
CREATE TABLE IF NOT EXISTS c_student_publication_rel_document (
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
work_id INT NOT NULL,
document_id INT NOT NULL,
c_id INT NOT NULL
);
CREATE TABLE IF NOT EXISTS c_student_publication_rel_user (
id INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
work_id INT NOT NULL,
user_id INT NOT NULL,
c_id INT NOT NULL
);
*/

@ -0,0 +1,104 @@
<?php
/* For licensing terms, see /license.txt */
use ChamiloSession as Session;
$language_file = array('exercice', 'work', 'document', 'admin', 'gradebook');
require_once '../inc/global.inc.php';
// Including necessary files
require_once 'work.lib.php';
if (ADD_DOCUMENT_TO_WORK == false) {
exit;
}
$current_course_tool = TOOL_STUDENTPUBLICATION;
$workId = isset($_GET['id']) ? intval($_GET['id']) : null;
$userId = isset($_GET['user_id']) ? intval($_GET['user_id']) : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
if (empty($workId)) {
api_not_allowed(true);
}
$my_folder_data = get_work_data_by_id($workId);
if (empty($my_folder_data)) {
api_not_allowed(true);
}
$work_data = get_work_assignment_by_id($workId);
if (!api_is_allowed_to_edit()) {
api_not_allowed(true);
}
$courseInfo = api_get_course_info();
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq(), 'name' => get_lang('StudentPublications'));
$interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'work/work_list_all.php?'.api_get_cidreq().'&id='.$workId, 'name' => $my_folder_data['title']);
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('AddUser'));
$error_message = null;
switch ($action) {
case 'add':
$data = getUserToWork($userId, $workId, api_get_course_int_id());
if (empty($data)) {
addUserToWork($userId, $workId, api_get_course_int_id());
}
$url = api_get_path(WEB_CODE_PATH).'work/add_user.php?id='.$workId;
header('Location: '.$url);
exit;
break;
case 'delete':
if (!empty($workId) && !empty($userId)) {
deleteUserToWork($userId, $workId, api_get_course_int_id());
$url = api_get_path(WEB_CODE_PATH).'work/add_user.php?id='.$workId;
header('Location: '.$url);
exit;
}
break;
}
Display :: display_header(null);
echo Display::page_subheader(get_lang('UsersAdded'));
$items = getAllUserToWork($workId, api_get_course_int_id());
$usersAdded = array();
if (!empty($items)) {
echo '<div class="well">';
foreach ($items as $data) {
$myUserId = $data['user_id'];
$usersAdded[] = $myUserId;
$userInfo = api_get_user_info($myUserId);
$url = api_get_path(WEB_CODE_PATH).'work/add_user.php?action=delete&id='.$workId.'&user_id='.$myUserId;
$link = Display::url(get_lang('Delete'), $url);
echo $userInfo['complete_name'].' '.$link.'<br />';
}
echo '</div>';
}
$userList = CourseManager::get_user_list_from_course_code($courseInfo['code'], api_get_session_id(), null, null, STUDENT);
echo Display::page_subheader(get_lang('UserToAdd'));
if (!empty($userList)) {
echo '<div class="well">';
foreach ($userList as $user) {
if (in_array($user['user_id'], $usersAdded)) {
continue;
}
$userName = api_get_person_name($user['firstname'], $user['lastname']);
$url = api_get_path(WEB_CODE_PATH).'work/add_user.php?action=add&id='.$workId.'&user_id='.$user['user_id'];
$link = Display::url(get_lang('Add'), $url);
echo $userName.' '.$link.'<br />';
}
echo '</div>';
}
echo '<hr /><div class="clear"></div>';

@ -12,6 +12,8 @@
session_cache_limiter('public');
require_once '../inc/global.inc.php';
require_once 'work.lib.php';
$current_course_tool = TOOL_STUDENTPUBLICATION;
$this_section = SECTION_COURSES;
@ -29,26 +31,29 @@ $id = intval($_GET['id']);
$course_info = api_get_course_info();
if (empty($course_info)) {
api_not_allowed(true);
api_not_allowed(true);
}
$tbl_student_publication = Database::get_course_table(TABLE_STUDENT_PUBLICATION);
if (!empty($course_info['real_id'])) {
if (!empty($course_info['real_id'])) {
$sql = 'SELECT * FROM '.$tbl_student_publication.' WHERE c_id = '.$course_info['real_id'].' AND id = "'.$id.'"';
$result = Database::query($sql);
if ($result && Database::num_rows($result)) {
$row = Database::fetch_array($result, 'ASSOC');
if ($result && Database::num_rows($result)) {
$row = Database::fetch_array($result, 'ASSOC');
$full_file_name = api_get_path(SYS_COURSE_PATH).api_get_course_path().'/'.$row['url'];
$item_info = api_get_item_property_info(api_get_course_int_id(), 'work', $row['id']);
$item_info = api_get_item_property_info(api_get_course_int_id(), 'work', $row['id']);
allowOnlySubscribedUser(api_get_user_id(), $row['parent_id'], $course_info['real_id']);
if (empty($item_info)) {
exit;
}
/*
field show_score in table course : 0 => New documents are visible for all users
1 => New documents are only visible for the teacher(s)
1 => New documents are only visible for the teacher(s)
field visibility in table item_property : 0 => eye closed, invisible for all students
1 => eye open
field accepted in table c_student_publication : 0 => eye closed, invisible for all students
@ -56,24 +61,24 @@ if (!empty($course_info['real_id'])) {
(we should have visibility == accepted , otherwise there is an inconsistency in the Database)
field value in table c_course_setting : 0 => Allow learners to delete their own publications = NO
1 => Allow learners to delete their own publications = YES
+------------------+------------------------------+----------------------------+
|Can download work?| doc visible for all = 0 | doc visible for all = 1|
+------------------+------------------------------+----------------------------+
| visibility = 0 | editor only | editor only |
| | | |
+------------------+------------------------------+----------------------------+
+------------------+------------------------------+----------------------------+
| visibility = 1 | editor | editor |
| | + owner of the work | + any student |
+------------------+------------------------------+----------------------------+
+------------------+------------------------------+----------------------------+
(editor = teacher + admin + anybody with right api_is_allowed_to_edit)
*/
$work_is_visible = ($item_info['visibility'] == 1 && $row['accepted'] == 1);
$doc_visible_for_all = ($course_info['show_score'] == 1);
$is_editor = api_is_allowed_to_edit(true,true,true);
$student_is_owner_of_work = ($row['user_id'] == api_get_user_id());
if ($is_editor
|| (!$doc_visible_for_all && $work_is_visible && $student_is_owner_of_work)
|| ($doc_visible_for_all && $work_is_visible)) {
@ -84,7 +89,7 @@ if (!empty($course_info['real_id'])) {
}
} else {
api_not_allowed();
}
}
}
}
exit;
exit;

@ -71,6 +71,9 @@ if (api_is_allowed_to_edit()) {
} else {
$courseInfo = api_get_course_info();
allowOnlySubscribedUser(api_get_user_id(), $work_id, $courseInfo['real_id']);
$userCondition = null;
// All users

@ -147,7 +147,7 @@ if ($is_allowed_to_edit && !empty($item_id)) {
}
}
$form->addElement('hidden', 'active', 1);
$form->addElement('hidden', 'active', 1);
$form->addElement('hidden', 'accepted', 1);
$form->addElement('hidden', 'item_to_edit', $item_id);
$form->addElement('hidden', 'sec_token', $token);
@ -178,9 +178,10 @@ if ($form->validate()) {
if ($is_author) {
$work_data = get_work_data_by_id($item_to_edit_id);
if (!empty($_POST['title']))
if (!empty($_POST['title'])) {
$title = isset($_POST['title']) ? $_POST['title'] : $work_data['title'];
$description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
}
$description = isset($_POST['description']) ? $_POST['description'] : $work_data['description'];
if ($is_allowed_to_edit && ($_POST['qualification'] !='' )) {
$add_to_update = ', qualificator_id ='."'".api_get_user_id()."',";

@ -26,6 +26,7 @@ $work_table = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
$is_allowed_to_edit = api_is_allowed_to_edit();
$course_id = api_get_course_int_id();
$user_id = api_get_user_id();
$userInfo = api_get_user_info();
$session_id = api_get_session_id();
$course_code = api_get_course_id();
$course_info = api_get_course_info();
@ -35,6 +36,8 @@ if (empty($work_id)) {
api_not_allowed(true);
}
allowOnlySubscribedUser($user_id, $work_id, $course_id);
$parent_data = $my_folder_data = get_work_data_by_id($work_id);
if (empty($parent_data)) {
@ -119,7 +122,7 @@ $form->addElement('header', $form_title);
$show_progress_bar = false;
if ($submitGroupWorkUrl) {
// For user comming from group space to publish his work
// For user coming from group space to publish his work
$realUrl = str_replace($_configuration['root_sys'], api_get_path(WEB_PATH), str_replace("\\", '/', realpath($submitGroupWorkUrl)));
$form->addElement('hidden', 'newWorkUrl', $submitGroupWorkUrl);
$text_document = $form->addElement('text', 'document', get_lang('Document'));
@ -160,6 +163,12 @@ if ($show_progress_bar) {
$form->add_real_progress_bar('uploadWork', 'file');
}
$documentTemplateData = getDocumentTemplateFromWork($work_id, $course_info);
if (!empty($documentTemplateData)) {
$defaults['title'] = $userInfo['complete_name'].'_'.$documentTemplateData['title'].'_'.substr(api_get_utc_datetime(), 0, 10);
$defaults['description'] = $documentTemplateData['file_content'];
}
$form->setDefaults($defaults);
$error_message = null;
$_course = api_get_course_info();

@ -20,6 +20,8 @@ $interbreadcrumb[] = array ('url' => 'work.php', 'name' => get_lang('StudentPubl
$my_folder_data = get_work_data_by_id($work['parent_id']);
$course_info = api_get_course_info();
allowOnlySubscribedUser(api_get_user_id(), $work['parent_id'], $course_info['real_id']);
if (user_is_author($id) || $course_info['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1) {
$url_dir = 'work.php?&id=' . $my_folder_data['id'];
$interbreadcrumb[] = array ('url' => $url_dir,'name' => $my_folder_data['title']);

@ -17,6 +17,8 @@ require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php';
require_once api_get_path(LIBRARY_PATH).'fileDisplay.lib.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
define('ADD_DOCUMENT_TO_WORK', false);
/**
* Displays action links (for admins, authorized groups members and authorized students)
* @param string Current dir
@ -491,6 +493,7 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
$group_id = api_get_group_id();
if (is_array($work_parents)) {
foreach ($work_parents as $work_parent) {
$sql_select_directory = "SELECT
@ -805,36 +808,14 @@ function display_student_publications_list($id, $my_folder_data, $work_parents,
if (api_is_allowed_to_edit()) {
$cant_files = get_count_work($work_data['id']);
/*$sql_document = "SELECT count(*)
FROM $work_table w INNER JOIN $user_table u ON w.user_id = u.user_id
WHERE w.c_id = $course_id AND w.parent_id = ".$work_data['id']." AND w.active IN (0, 1)";*/
} else {
$cant_files = get_count_work($work_data['id'], api_get_user_id());
/*
$user_filter = "user_id = ".api_get_user_id()." AND ";
if ($course_info['show_score'] == 0) {
$user_filter = null;
$isSubscribed = userIsSubscribedToWork(api_get_user_id(), $work_data['id'], $course_id);
if ($isSubscribed == false) {
continue;
}
$sql_document = "SELECT count(*) FROM $work_table s, $iprop_table p
WHERE s.c_id = $course_id AND
p.c_id = $course_id AND
s.id = p.ref AND
p.tool='work' AND
s.accepted='1' AND
$user_filter
parent_id = ".$work_data['id']." AND
active = 1 AND
parent_id = ".$work_parent->id."";*/
$cant_files = get_count_work($work_data['id'], api_get_user_id());
}
//count documents
/*$res_document = Database::query($sql_document);
$count_document = Database::fetch_row($res_document);
$cant_files = $count_document[0];*/
$text_file = get_lang('FilesUpload');
if ($cant_files == 1) {
@ -1793,7 +1774,8 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
if ($work['contains_file']) {
$link_to_download = '<a href="download.php?id='.$item_id.'">'.Display::return_icon('save.png', get_lang('Save'),array(), ICON_SIZE_SMALL).'</a> ';
} else {
$link_to_download = '<a href="view.php?id='.$item_id.'">'.Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a> ';
//api_get_cidreq()
//$link_to_download = '<a href="view.php?id='.$item_id.'">'.Display::return_icon('default.png', get_lang('View'),array(), ICON_SIZE_SMALL).'</a> ';
}
$send_to = Portfolio::share('work', $work['id'], array('style' => 'white-space:nowrap;'));
@ -1849,7 +1831,7 @@ function get_work_user_list($start, $limit, $column, $direction, $work_id, $wher
$action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
}
if (api_get_course_setting('student_delete_own_publication') == 1) {
$action .= '<a href="'.$url.'work.php?'.api_get_cidreq().'&action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
$action .= ' <a href="'.$url.'work.php?'.api_get_cidreq().'&action=delete&amp;item_id='.$item_id.'" onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES))."'".')) return false;" title="'.get_lang('Delete').'" >'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
}
} else {
$action .= Display::return_icon('edit_na.png', get_lang('Modify'),array(), ICON_SIZE_SMALL);
@ -2140,3 +2122,151 @@ function display_list_users_without_publication($task_id, $studentId = null)
$column_show[] = 1;
Display::display_sortable_config_table('work', $table_header, $data, $sorting_options, $paging_options, $my_params, $column_show);
}
// Document to work
function addDocumentToWork($documentId, $workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
$params = array(
'document_id' => $documentId,
'work_id' => $workId,
'c_id' => $courseId
);
Database::insert($table, $params);
}
function getDocumentToWork($documentId, $workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
$params = array(
'document_id = ? and work_id = ? and c_id = ?' => array($documentId, $workId, $courseId)
);
return Database::select('*', $table, array('where' => $params));
}
function getAllDocumentToWork($workId, $courseId)
{
if (ADD_DOCUMENT_TO_WORK == false) {
return array();
}
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
$params = array(
'work_id = ? and c_id = ?' => array($workId, $courseId)
);
return Database::select('*', $table, array('where' => $params));
}
function deleteDocumentToWork($documentId, $workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_DOCUMENT);
$params = array(
'document_id = ? and work_id = ? and c_id = ?' => array($documentId, $workId, $courseId)
);
Database::delete($table, $params);
}
// User to work
function addUserToWork($userId, $workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
$params = array(
'user_id' => $userId,
'work_id' => $workId,
'c_id' => $courseId
);
Database::insert($table, $params);
}
function getUserToWork($userId, $workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
$params = array(
'user_id = ? and work_id = ? and c_id = ?' => array($userId, $workId, $courseId)
);
return Database::select('*', $table, array('where' => $params));
}
function getAllUserToWork($workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
$params = array(
'work_id = ? and c_id = ?' => array($workId, $courseId)
);
return Database::select('*', $table, array('where' => $params));
}
function userAddedToWork($userId, $workId, $courseId)
{
/*$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
$params = array(
'user_id = ? and work_id = ? and c_id = ?' => array($userId, $workId, $courseId)
);
$result = Database::select('count(*)', $table, array('where' => $params));*/
}
function deleteUserToWork($userId, $workId, $courseId)
{
$table = Database::get_course_table(TABLE_STUDENT_PUBLICATION_REL_USER);
$params = array(
'user_id = ? and work_id = ? and c_id = ?' => array($userId, $workId, $courseId)
);
Database::delete($table, $params);
}
function userIsSubscribedToWork($userId, $workId, $courseId)
{
if (ADD_DOCUMENT_TO_WORK == false) {
return true;
}
$subscribedUsers = getAllUserToWork($workId, $courseId);
if (empty($subscribedUsers)) {
return true;
} else {
$subscribedUsersIdList = array();
foreach ($subscribedUsers as $item) {
$subscribedUsersIdList[] = $item['user_id'];
}
if (in_array($userId, $subscribedUsersIdList)) {
return true;
}
}
return false;
}
function allowOnlySubscribedUser($userId, $workId, $courseId)
{
if (ADD_DOCUMENT_TO_WORK == false) {
return true;
}
if (api_is_platform_admin() || api_is_allowed_to_edit()) {
return true;
}
if (userIsSubscribedToWork($userId, $workId, $courseId) == false) {
api_not_allowed(true);
}
}
function getDocumentTemplateFromWork($workId, $courseInfo)
{
$documents = getAllDocumentToWork($workId, $courseInfo['real_id']);
if (!empty($documents)) {
foreach ($documents as $doc) {
$docData = DocumentManager::get_document_data_by_id($doc['document_id'], $courseInfo['code']);
$fileInfo = pathinfo($docData['path']);
if ($fileInfo['extension'] == 'html') {
if (file_exists($docData['absolute_path']) && is_file($docData['absolute_path'])) {
$docData['file_content'] = file_get_contents($docData['absolute_path']);
return $docData;
}
}
}
}
return array();
}

@ -788,6 +788,8 @@ switch ($action) {
echo $table->toHtml();
echo '</div>';
} else {
display_student_publications_list($work_id, $my_folder_data, $work_parents, $origin, $add_query, null);
}

@ -35,6 +35,7 @@ $courseInfo = api_get_course_info();
$htmlHeadXtra[] = api_get_jqgrid_js();
$url_dir = api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq();
allowOnlySubscribedUser(api_get_user_id(), $workId, $courseInfo['real_id']);
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);
@ -77,6 +78,21 @@ if (!empty($my_folder_data['description'])) {
echo '<p><div><strong>'.get_lang('Description').':</strong><p>'.Security::remove_XSS($my_folder_data['description']).'</p></div></p>';
}
$documents = getAllDocumentToWork($workId, $courseInfo['real_id']);
if (!empty($documents)) {
$docContent = '<ul class="nav nav-list well">';
$docContent .= '<li class="nav-header">'.get_lang('Documents').'</li>';
foreach ($documents as $doc) {
$docData = DocumentManager::get_document_data_by_id($doc['document_id'], $courseInfo['code']);
if ($docData) {
$docContent .= '<li><a target="_blank" href="'.$docData['url'].'">'.$docData['title'].'</a></li>';
}
}
$docContent .= '</ul><br />';
echo $docContent;
}
$check_qualification = intval($my_folder_data['qualification']);
if (!empty($work_data['enable_qualification']) && !empty($check_qualification)) {

@ -66,10 +66,18 @@ echo '<div class="actions">';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/work.php?'.api_get_cidreq().'&origin='.$origin.'&gradebook='.$gradebook.'">'.Display::return_icon('back.png', get_lang('BackToWorksList'),'',ICON_SIZE_MEDIUM).'</a>';
if (api_is_allowed_to_session_edit(false, true) && !empty($workId)) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/upload.php?'.api_get_cidreq().'&id='.$workId.'&origin='.$origin.'&gradebook='.$gradebook.'">';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'),'',ICON_SIZE_MEDIUM).'</a>';
echo Display::return_icon('upload_file.png', get_lang('UploadADocument'), '', ICON_SIZE_MEDIUM).'</a>';
if (ADD_DOCUMENT_TO_WORK) {
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_document.php?'.api_get_cidreq().'&id='.$workId.'">';
echo Display::return_icon('new_document.png', get_lang('AddDocument'), '', ICON_SIZE_MEDIUM).'</a>';
echo '<a href="'.api_get_path(WEB_CODE_PATH).'work/add_user.php?'.api_get_cidreq().'&id='.$workId.'">';
echo Display::return_icon('user.png', get_lang('AddUser'), '', ICON_SIZE_MEDIUM).'</a>';
}
$display_output .= '<a href="'.api_get_path(WEB_CODE_PATH).'work/work_missing.php?'.api_get_cidreq().'&amp;id='.$workId.'&amp;curdirpath='.$cur_dir_path.'&amp;origin='.$origin.'&amp;gradebook='.$gradebook.'&amp;list=without">'.
Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'),'',ICON_SIZE_MEDIUM)."</a>\n";
Display::return_icon('exercice_uncheck.png', get_lang('ViewUsersWithoutTask'), '', ICON_SIZE_MEDIUM)."</a>";
$count = get_count_work($workId);
if ($count > 0) {
$display_output .= '<a href="downloadfolder.inc.php?id='.$workId.'">'.Display::return_icon('save_pack.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_MEDIUM).'</a>';

@ -38,8 +38,9 @@ if ($courseInfo['show_score'] == 1) {
api_not_allowed(true);
}
$htmlHeadXtra[] = api_get_jqgrid_js();
allowOnlySubscribedUser(api_get_user_id(), $workId, $courseInfo['real_id']);
$htmlHeadXtra[] = api_get_jqgrid_js();
if (!empty($group_id)) {
$group_properties = GroupManager :: get_group_properties($group_id);

@ -0,0 +1,11 @@
language: php
before_script:
- composer self-update
- composer install --dev --prefer-source
php:
- 5.3.3
- 5.3
- 5.4
- 5.5

@ -0,0 +1,61 @@
CHANGELOG
---------
* 1.5.0 (2013-06-21)
* BC Break : ConfigurationInterface::get does not throw exceptions anymore
in case the key does not exist. Second argument is a default value to return
in case the key does not exist.
* 1.4.1 (2013-05-23)
* Add third parameter to BinaryInterface::command method to pass a listener or
an array of listener that will be registered just the time of the command.
* 1.4.0 (2013-05-11)
* Extract process run management to ProcessRunner.
* Add support for process listeners.
* Provides bundled DebugListener.
* Add BinaryInterface::command method.
* BC break : ProcessRunnerInterface::run now takes an SplObjectStorage containing
listeners as second argument.
* BC break : BinaryInterface no longer implements LoggerAwareInterface
as it is now supported by ProcessRunner.
* 1.3.4 (2013-04-26)
* Add BinaryDriver::run method.
* 1.3.3 (2013-04-26)
* Add BinaryDriver::createProcessMock method.
* 1.3.2 (2013-04-26)
* Add BinaryDriverTestCase for testing BinaryDriver implementations.
* 1.3.1 (2013-04-24)
* Add timeouts handling
* 1.3.0 (2013-04-24)
* Add BinaryInterface and AbstractBinary
* 1.2.1 (2013-04-24)
* Add ConfigurationAwareInterface
* Add ProcessBuilderAwareInterface
* 1.2.0 (2013-04-24)
* Add BinaryDriver\Configuration
* 1.1.0 (2013-04-24)
* Add support for timeouts via `setTimeout` method
* 1.0.0 (2013-04-23)
* First stable version.

@ -0,0 +1,21 @@
BinaryDriver is released with MIT License :
Copyright (c) 2013 Alchemy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

@ -0,0 +1,190 @@
# Binary Driver
Binary-Driver is a set of PHP tools to build binary drivers.
[![Build Status](https://travis-ci.org/alchemy-fr/BinaryDriver.png?branch=master)](https://travis-ci.org/alchemy-fr/BinaryDriver)
## Why ?
You may wonder *Why building a library while I can use `exec` or
[symfony/process](https://github.com/symfony/Process) ?*.
Here is a simple answer :
- If you use `exec`, `passthru`, `system`, `proc_open` or any low level process
handling in PHP, you should have a look to [symfony/process](https://github.com/symfony/Process)
component that will provide an OO portable, testable and secure interface to
deal with this. It seems easy at first approach, but if you look at this
component [unit tests](https://github.com/symfony/Process/tree/master/Tests),
you will see that handling process in a simple interface can easily become a
nightmare.
- If you already use symfony/process, and want to build binary drivers, you
will always have the same common set of methods and objects to configure, log,
debug, and generate processes.
This library is a base to implement any binary driver with this common set of
needs.
## AbstractBinary
`AbstractBinary` provides an abstract class to build a binary driver. It implements
`BinaryInterface`.
Implementation example :
```php
use Alchemy\BinaryDriver\AbstractBinary;
class LsDriver extends AbstractBinary
{
public function getName()
{
return 'ls driver';
}
}
$parser = new LsParser();
$driver = Driver::load('ls');
// will return the output of `ls -a -l`
$parser->parse($driver->command(array('-a', '-l')));
```
### Binary detection troubleshooting
If you are using Nginx with PHP-fpm, executable detection may not work because of an empty `$_ENV['path']`.
To avoid having an empty `PATH` environment variable, add the following line to your `fastcgi_params`
config file (replace `/your/current/path/` with the output of `printenv PATH`) :
```
fastcgi_param PATH /your/current/path
```
## Logging
You can log events with a `Psr\Log\LoggerInterface` by passing it in the load
method as second argument :
```php
$logger = new Monolog\Logger('driver');
$driver = Driver::load('ls', $logger);
```
## Listeners
You can add custom listeners on processes.
Listeners are built on top of [Evenement](https://github.com/igorw/evenement)
and must implement `Alchemy\BinaryDriver\ListenerInterface`.
```php
use Symfony\Component\Process\Process;
class DebugListener extends EventEmitter implements ListenerInterface
{
public function handle($type, $data)
{
foreach (explode(PHP_EOL, $data) as $line) {
$this->emit($type === Process::ERR ? 'error' : 'out', array($line));
}
}
public function forwardedEvents()
{
// forward 'error' events to the BinaryInterface
return array('error');
}
}
$listener = new DebugListener();
$driver = CustomImplementation::load('php');
// adds listener
$driver->listen($listener);
$driver->on('error', function ($line) {
echo '[ERROR] ' . $line . PHP_EOL;
});
// removes listener
$driver->unlisten($listener);
```
### Bundled listeners
The debug listener is a simple listener to catch `stderr` and `stdout` outputs ;
read the implementation for customization.
```php
use Alchemy\BinaryDriver\Listeners\DebugListener;
$driver = CustomImplementation::load('php');
$driver->listen(new DebugListener());
$driver->on('debug', function ($line) {
echo $line;
});
```
## ProcessBuilderFactory
ProcessBuilderFactory ease spawning processes by generating Symfony [Process]
(http://symfony.com/doc/master/components/process.html) objects.
```php
use Alchemy\BinaryDriver\ProcessBuilderFactory;
$factory = new ProcessBuilderFactory('/usr/bin/php');
// return a Symfony\Component\Process\Process
$process = $factory->create('-v');
// echoes '/usr/bin/php' '-v'
echo $process->getCommandLine();
$process = $factory->create(array('-r', 'echo "Hello !";'));
// echoes '/usr/bin/php' '-r' 'echo "Hello !";'
echo $process->getCommandLine();
```
## Configuration
A simple configuration object, providing an `ArrayAccess` and `IteratorAggregate`
interface.
```php
use Alchemy\BinaryDriver\Configuration;
$conf = new Configuration(array('timeout' => 0));
echo $conf->get('timeout');
if ($conf->has('param')) {
$conf->remove('param');
}
$conf->set('timeout', 20);
$conf->all();
```
Same example using the `ArrayAccess` interface :
```php
use Alchemy\BinaryDriver\Configuration;
$conf = new Configuration(array('timeout' => 0));
echo $conf['timeout'];
if (isset($conf['param'])) {
unset($conf['param']);
}
$conf['timeout'] = 20;
```
## License
This project is released under the MIT license.

@ -0,0 +1,38 @@
{
"name": "alchemy/binary-driver",
"type": "library",
"description": "A set of tools to build binary drivers",
"keywords": ["binary", "driver"],
"license": "MIT",
"authors": [
{
"name": "Nicolas Le Goff",
"email": "legoff.n@gmail.com"
},
{
"name": "Romain Neutron",
"email": "imprec@gmail.com",
"homepage": "http://www.lickmychip.com/"
},
{
"name": "Phraseanet Team",
"email": "info@alchemy.fr",
"homepage": "http://www.phraseanet.com/"
}
],
"require": {
"php" : ">=5.3.3",
"evenement/evenement" : "~1.0",
"monolog/monolog" : "~1.3",
"psr/log" : "~1.0",
"symfony/process" : "~2.0"
},
"require-dev": {
"phpunit/phpunit" : "~3.7"
},
"autoload": {
"psr-0": {
"Alchemy": "src"
}
}
}

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="true"
verbose="false"
bootstrap="tests/bootstrap.php"
>
<php>
<ini name="display_errors" value="on"/>
</php>
<testsuites>
<testsuite>
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<blacklist>
<directory>vendor</directory>
<directory>tests</directory>
</blacklist>
</filter>
</phpunit>

@ -0,0 +1,220 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
use Alchemy\BinaryDriver\Exception\ExecutableNotFoundException;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use Alchemy\BinaryDriver\Listeners\Listeners;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use Evenement\EventEmitter;
use Monolog\Logger;
use Monolog\Handler\NullHandler;
use Psr\Log\LoggerInterface;
use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Process\Process;
abstract class AbstractBinary extends EventEmitter implements BinaryInterface
{
/** @var ConfigurationInterface */
protected $configuration;
/** @var ProcessBuilderFactoryInterface */
protected $factory;
/** @var ProcessRunner */
private $processRunner;
/** @var Listeners */
private $listenersManager;
public function __construct(ProcessBuilderFactoryInterface $factory, LoggerInterface $logger, ConfigurationInterface $configuration)
{
$this->factory = $factory;
$this->configuration = $configuration;
$this->processRunner = new ProcessRunner($logger, $this->getName());
$this->listenersManager = new Listeners();
$this->applyProcessConfiguration();
}
/**
* {@inheritdoc}
*/
public function listen(ListenerInterface $listener)
{
$this->listenersManager->register($listener, $this);
return $this;
}
/**
* {@inheritdoc}
*/
public function unlisten(ListenerInterface $listener)
{
$this->listenersManager->unregister($listener, $this);
return $this;
}
/**
* {@inheritdoc}
*/
public function getConfiguration()
{
return $this->configuration;
}
/**
* {@inheritdoc}
*
* @return BinaryInterface
*/
public function setConfiguration(ConfigurationInterface $configuration)
{
$this->configuration = $configuration;
$this->applyProcessConfiguration();
return $this;
}
/**
* {@inheritdoc}
*/
public function getProcessBuilderFactory()
{
return $this->factory;
}
/**
* {@inheritdoc}
*
* @return BinaryInterface
*/
public function setProcessBuilderFactory(ProcessBuilderFactoryInterface $factory)
{
$this->factory = $factory;
$this->applyProcessConfiguration();
return $this;
}
/**
* {@inheritdoc}
*/
public function getProcessRunner()
{
return $this->processRunner;
}
/**
* {@inheritdoc}
*/
public function setProcessRunner(ProcessRunnerInterface $runner)
{
$this->processRunner = $runner;
return $this;
}
/**
* {@inheritdoc}
*/
public function command($command, $bypassErrors = false, $listeners = null)
{
if (!is_array($command)) {
$command = array($command);
}
return $this->run($this->factory->create($command), $bypassErrors, $listeners);
}
/**
* {@inheritdoc}
*/
public static function load($binaries, LoggerInterface $logger = null, $configuration = array())
{
$finder = new ExecutableFinder();
$binary = null;
$binaries = is_array($binaries) ? $binaries : array($binaries);
foreach ($binaries as $candidate) {
if (file_exists($candidate) && is_executable($candidate)) {
$binary = $candidate;
break;
}
if (null !== $binary = $finder->find($candidate)) {
break;
}
}
if (null === $binary) {
throw new ExecutableNotFoundException(sprintf(
'Executable not found, proposed : %s', implode(', ', $binaries)
));
}
if (null === $logger) {
$logger = new Logger(__NAMESPACE__ . ' logger');
$logger->pushHandler(new NullHandler());
}
$configuration = $configuration instanceof ConfigurationInterface ? $configuration : new Configuration($configuration);
return new static(new ProcessBuilderFactory($binary), $logger, $configuration);
}
/**
* Returns the name of the driver
*
* @return string
*/
abstract public function getName();
/**
* Executes a process, logs events
*
* @param Process $process
* @param Boolean $bypassErrors Set to true to disable throwing ExecutionFailureExceptions
* @param ListenerInterface|array $listeners A listener or an array of listener to register for this unique run
*
* @return string The Process output
*
* @throws ExecutionFailureException in case of process failure.
*/
protected function run(Process $process, $bypassErrors = false, $listeners = null)
{
if (null !== $listeners) {
if (!is_array($listeners)) {
$listeners = array($listeners);
}
$listenersManager = clone $this->listenersManager;
foreach ($listeners as $listener) {
$listenersManager->register($listener, $this);
}
} else {
$listenersManager = $this->listenersManager;
}
return $this->processRunner->run($process, $listenersManager->storage, $bypassErrors);
}
private function applyProcessConfiguration()
{
if ($this->configuration->has('timeout')) {
$this->factory->setTimeout($this->configuration->get('timeout'));
}
return $this;
}
}

@ -0,0 +1,76 @@
<?php
namespace Alchemy\BinaryDriver;
use Psr\Log\LoggerInterface;
use Symfony\Component\Process\Process;
/**
* Convenient PHPUnit methods for testing BinaryDriverInterface implementations.
*/
class BinaryDriverTestCase extends \PHPUnit_Framework_TestCase
{
/**
* @return ProcessBuilderFactoryInterface
*/
public function createProcessBuilderFactoryMock()
{
return $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
}
/**
* @param integer $runs The number of runs expected
* @param Boolean $success True if the process expects to be successfull
* @param string $commandLine The commandline executed
* @param string $output The process output
* @param string $error The process error output
*
* @return Process
*/
public function createProcessMock($runs = 1, $success = true, $commandLine = null, $output = null, $error = null, $callback = false)
{
$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
->getMock();
$builder = $process->expects($this->exactly($runs))
->method('run');
if (true === $callback) {
$builder->with($this->isInstanceOf('Closure'));
}
$process->expects($this->any())
->method('isSuccessful')
->will($this->returnValue($success));
foreach (array(
'getOutput' => $output,
'getErrorOutput' => $error,
'getCommandLine' => $commandLine,
) as $command => $value) {
$process
->expects($this->any())
->method($command)
->will($this->returnValue($value));
}
return $process;
}
/**
* @return LoggerInterface
*/
public function createLoggerMock()
{
return $this->getMock('Psr\Log\LoggerInterface');
}
/**
* @return ConfigurationInterface
*/
public function createConfigurationMock()
{
return $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
}
}

@ -0,0 +1,66 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
use Alchemy\BinaryDriver\Exception\ExecutableNotFoundException;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use Psr\Log\LoggerInterface;
use Evenement\EventEmitterInterface;
interface BinaryInterface extends ConfigurationAwareInterface, ProcessBuilderFactoryAwareInterface, ProcessRunnerAwareInterface, EventEmitterInterface
{
/**
* Adds a listener to the binary driver
*
* @param ListenerInterface $listener
*
* @return BinaryInterface
*/
public function listen(ListenerInterface $listener);
/**
* Removes a listener from the binary driver
*
* @param ListenerInterface $listener
*
* @return BinaryInterface
*/
public function unlisten(ListenerInterface $listener);
/**
* Runs a command against the driver.
*
* Calling this method on a `ls` driver with the command `-a` would run `ls -a`.
*
* @param array|string $command A command or an array of command
* @param Boolean $bypassErrors If set to true, an erronous process will not throw an exception
* @param ListenerInterface|array $listeners A listener or an array of listeners to register for this unique run
*
* @return string The command output
*
* @throws ExecutionFailureException in case of process failure.
*/
public function command($command, $bypassErrors = false, $listeners = null);
/**
* Loads a binary
*
* @param string|array $binaries A binary name or an array of binary names
* @param null||LoggerInterface $logger A Logger
* @param array|ConfigurationInterface $configuration The configuration
*
* @throws ExecutableNotFoundException In case none of the binaries were found
*
* @return BinaryInterface
*/
public static function load($binaries, LoggerInterface $logger = null, $configuration = array());
}

@ -0,0 +1,107 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
class Configuration implements ConfigurationInterface
{
private $data;
public function __construct(array $data = array())
{
$this->data = $data;
}
/**
* {@inheritdoc}
*/
public function getIterator()
{
return new \ArrayIterator($this->data);
}
/**
* {@inheritdoc}
*/
public function get($key, $default = null)
{
return isset($this->data[$key]) ? $this->data[$key] : $default;
}
/**
* {@inheritdoc}
*/
public function set($key, $value)
{
$this->data[$key] = $value;
return $this;
}
/**
* {@inheritdoc}
*/
public function has($key)
{
return array_key_exists($key, $this->data);
}
/**
* {@inheritdoc}
*/
public function remove($key)
{
$value = $this->get($key);
unset($this->data[$key]);
return $value;
}
/**
* {@inheritdoc}
*/
public function all()
{
return $this->data;
}
/**
* {@inheritdoc}
*/
public function offsetExists($offset)
{
return $this->has($offset);
}
/**
* {@inheritdoc}
*/
public function offsetGet($offset)
{
return $this->get($offset);
}
/**
* {@inheritdoc}
*/
public function offsetSet($offset, $value)
{
$this->set($offset, $value);
}
/**
* {@inheritdoc}
*/
public function offsetUnset($offset)
{
$this->remove($offset);
}
}

@ -0,0 +1,29 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
interface ConfigurationAwareInterface
{
/**
* Returns the configuration
*
* @return ConfigurationInterface
*/
public function getConfiguration();
/**
* Set the configuration
*
* @param ConfigurationInterface $configuration
*/
public function setConfiguration(ConfigurationInterface $configuration);
}

@ -0,0 +1,58 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
interface ConfigurationInterface extends \ArrayAccess, \IteratorAggregate
{
/**
* Returns the value given a key from configuration
*
* @param string $key
* @param mixed $default The default value in case the key does not exist
*
* @return mixed
*/
public function get($key, $default = null);
/**
* Set a value to configuration
*
* @param string $key The key
* @param mixed $value The value corresponding to the key
*/
public function set($key, $value);
/**
* Tells if Configuration contains `$key`
*
* @param string $key
*
* @return Boolean
*/
public function has($key);
/**
* Removes a value given a key
*
* @param string $key
*
* @return mixed The previous value
*/
public function remove($key);
/**
* Returns all values set in the configuration
*
* @return array
*/
public function all();
}

@ -0,0 +1,16 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver\Exception;
interface ExceptionInterface
{
}

@ -0,0 +1,16 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver\Exception;
class ExecutableNotFoundException extends \RuntimeException implements ExceptionInterface
{
}

@ -0,0 +1,16 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver\Exception;
class ExecutionFailureException extends \RuntimeException implements ExceptionInterface
{
}

@ -0,0 +1,16 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver\Exception;
class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
{
}

@ -0,0 +1,58 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver\Listeners;
use Evenement\EventEmitter;
use Symfony\Component\Process\Process;
class DebugListener extends EventEmitter implements ListenerInterface
{
private $prefixOut;
private $prefixErr;
private $eventOut;
private $eventErr;
public function __construct($prefixOut = '[OUT] ', $prefixErr = '[ERROR] ', $eventOut = 'debug', $eventErr = 'debug')
{
$this->prefixOut = $prefixOut;
$this->prefixErr = $prefixErr;
$this->eventOut = $eventOut;
$this->eventErr = $eventErr;
}
/**
* {@inheritdoc}
*/
public function handle($type, $data)
{
if (Process::ERR === $type) {
$this->emitLines($this->eventErr, $this->prefixErr, $data);
} elseif (Process::OUT === $type) {
$this->emitLines($this->eventOut, $this->prefixOut, $data);
}
}
/**
* {@inheritdoc}
*/
public function forwardedEvents()
{
return array_unique(array($this->eventErr, $this->eventOut));
}
private function emitLines($event, $prefix, $lines)
{
foreach (explode("\n", $lines) as $line) {
$this->emit($event, array($prefix . $line));
}
}
}

@ -0,0 +1,32 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver\Listeners;
use Evenement\EventEmitterInterface;
interface ListenerInterface extends EventEmitterInterface
{
/**
* Handle the output of a ProcessRunner
*
* @param string $type The data type, one of Process::ERR, Process::OUT constants
* @param string $data The output
*/
public function handle($type, $data);
/**
* An array of events that should be forwarded to BinaryInterface
*
* @return array
*/
public function forwardedEvents();
}

@ -0,0 +1,88 @@
<?php
namespace Alchemy\BinaryDriver\Listeners;
use SplObjectStorage;
use Evenement\EventEmitter;
class Listeners extends EventEmitter
{
/** @var SplObjectStorage */
public $storage;
public function __construct()
{
$this->storage = new SplObjectStorage();
}
public function __clone()
{
$storage = $this->storage;
$this->storage = new SplObjectStorage();
$this->storage->addAll($storage);
}
/**
* Registers a listener, pass the listener events to the target.
*
* @param ListenerInterface $listener
* @param null|EventEmitter $target
*
* @return ListenersInterface
*/
public function register(ListenerInterface $listener, EventEmitter $target = null)
{
$EElisteners = array();
if (null !== $target) {
$EElisteners = $this->forwardEvents($listener, $target, $listener->forwardedEvents());
}
$this->storage->attach($listener, $EElisteners);
return $this;
}
/**
* Unregisters a listener, removes the listener events from the target.
*
* @param ListenerInterface $listener
*
* @return ListenersInterface
*
* @throws InvalidArgumentException In case the listener is not registered
*/
public function unregister(ListenerInterface $listener)
{
if (!isset($this->storage[$listener])) {
throw new InvalidArgumentException('Listener is not registered.');
}
foreach ($this->storage[$listener] as $event => $EElistener) {
$listener->removeListener($event, $EElistener);
}
$this->storage->detach($listener);
return $this;
}
private function forwardEvents($source, $target, array $events)
{
$EElisteners = array();
foreach ($events as $event) {
$listener = $this->createListener($event, $target);
$source->on($event, $EElisteners[$event] = $listener);
}
return $EElisteners;
}
private function createListener($event, $target)
{
return function () use ($event, $target) {
$target->emit($event, func_get_args());
};
}
}

@ -0,0 +1,177 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
use Alchemy\BinaryDriver\Exception\InvalidArgumentException;
use Symfony\Component\Process\ProcessBuilder;
class ProcessBuilderFactory implements ProcessBuilderFactoryInterface
{
/**
* The binary path
*
* @var String
*/
protected $binary;
/**
* The timeout for the generated processes
*
* @var integer|float
*/
private $timeout;
/**
* An internal ProcessBuilder.
*
* Note that this one is used only if Symfony ProcessBuilder has method
* setPrefix (2.3)
*
* @var ProcessBuilder
*/
private $builder;
/**
* Tells whether Symfony LTS ProcessBuilder should be emulated or not.
*
* This symfony version provided a brand new ::setPrefix method.
*
* @var Boolean
*/
public static $emulateSfLTS;
/**
* Constructor
*
* @param String $binary The path to the binary
*
* @throws InvalidArgumentException In case binary path is invalid
*/
public function __construct($binary)
{
$this->detectEmulation();
if (!self::$emulateSfLTS) {
$this->builder = new ProcessBuilder();
}
$this->useBinary($binary);
}
/**
* Covenient method for unit testing
*
* @return type
*/
public function getBuilder()
{
return $this->builder;
}
/**
* Covenient method for unit testing
*
* @param ProcessBuilder $builder
* @return ProcessBuilderFactory
*/
public function setBuilder(ProcessBuilder $builder)
{
$this->builder = $builder;
return $this;
}
/**
* @inheritdoc
*/
public function getBinary()
{
return $this->binary;
}
/**
* @inheritdoc
*/
public function useBinary($binary)
{
if (!is_executable($binary)) {
throw new InvalidArgumentException(sprintf('`%s` is not an executable binary', $binary));
}
$this->binary = $binary;
if (!static::$emulateSfLTS) {
$this->builder->setPrefix($binary);
}
return $this;
}
/**
* @inheritdoc
*/
public function setTimeout($timeout)
{
$this->timeout = $timeout;
if (!static::$emulateSfLTS) {
$this->builder->setTimeout($this->timeout);
}
return $this;
}
/**
* @inheritdoc
*/
public function getTimeout()
{
return $this->timeout;
}
/**
* @inheritdoc
*/
public function create($arguments = array())
{
if (null === $this->binary) {
throw new InvalidArgumentException('No binary set');
}
if (!is_array($arguments)) {
$arguments = array($arguments);
}
if (static::$emulateSfLTS) {
array_unshift($arguments, $this->binary);
return ProcessBuilder::create($arguments)
->setTimeout($this->timeout)
->getProcess();
} else {
return $this->builder
->setArguments($arguments)
->getProcess();
}
}
private function detectEmulation()
{
if (null !== static::$emulateSfLTS) {
return $this;
}
static::$emulateSfLTS = !method_exists('Symfony\Component\Process\ProcessBuilder', 'setPrefix');
return $this;
}
}

@ -0,0 +1,29 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
interface ProcessBuilderFactoryAwareInterface
{
/**
* Returns the current process builder factory
*
* @return ProcessBuilderFactoryInterface
*/
public function getProcessBuilderFactory();
/**
* Set a process builder factory
*
* @param ProcessBuilderFactoryInterface $factory
*/
public function setProcessBuilderFactory(ProcessBuilderFactoryInterface $factory);
}

@ -0,0 +1,65 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
use Alchemy\BinaryDriver\Exception\InvalidArgumentException;
use Symfony\Component\Process\Process;
interface ProcessBuilderFactoryInterface
{
/**
* Returns a new instance of Symfony Process
*
* @param string|array $arguments An argument or an array of arguments
*
* @return Process
*
* @throws InvalidArgumentException
*/
public function create($arguments = array());
/**
* Returns the path to the binary that is used
*
* @return String
*/
public function getBinary();
/**
* Sets the path to the binary
*
* @param String $binary A path to a binary
*
* @return ProcessBuilderFactoryInterface
*
* @throws InvalidArgumentException In case binary is not executable
*/
public function useBinary($binary);
/**
* Set the default timeout to apply on created processes.
*
* @param integer|float $timeout
*
* @return ProcessBuilderFactoryInterface
*
* @throws InvalidArgumentException In case the timeout is not valid
*/
public function setTimeout($timeout);
/**
* Returns the current timeout applied to the created processes.
*
* @return integer|float
*/
public function getTimeout();
}

@ -0,0 +1,104 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use Psr\Log\LoggerInterface;
use SplObjectStorage;
use Symfony\Component\Process\Exception\RuntimeException;
use Symfony\Component\Process\Process;
class ProcessRunner implements ProcessRunnerInterface
{
/** @var LoggerInterface */
private $logger;
/** @var string */
private $name;
public function __construct(LoggerInterface $logger, $name)
{
$this->logger = $logger;
$this->name = $name;
}
/**
* {@inheritdoc}
*
* @return ProcessRunner
*/
public function setLogger(LoggerInterface $logger)
{
$this->logger = $logger;
return $this;
}
/**
* @return LoggerInterface
*/
public function getLogger()
{
return $this->logger;
}
/**
* {@inheritdoc}
*/
public function run(Process $process, SplObjectStorage $listeners, $bypassErrors)
{
$this->logger->info(sprintf(
'%s running command %s', $this->name, $process->getCommandLine()
));
try {
$process->run($this->buildCallback($listeners));
} catch (RuntimeException $e) {
if (!$bypassErrors) {
$this->doExecutionFailure($process->getCommandLine(), $e);
}
}
if (!$bypassErrors && !$process->isSuccessful()) {
$this->doExecutionFailure($process->getCommandLine());
} elseif (!$process->isSuccessful()) {
$this->logger->error(sprintf(
'%s failed to execute command %s', $this->name, $process->getCommandLine()
));
return;
} else {
$this->logger->info(sprintf('%s executed command successfully', $this->name));
return $process->getOutput();
}
}
private function buildCallback(SplObjectStorage $listeners)
{
return function ($type, $data) use ($listeners) {
foreach ($listeners as $listener) {
$listener->handle($type, $data);
}
};
}
private function doExecutionFailure($command, \Exception $e = null)
{
$this->logger->error(sprintf(
'%s failed to execute command %s', $this->name, $command
));
throw new ExecutionFailureException(sprintf(
'%s failed to execute command %s', $this->name, $command
), $e ? $e->getCode() : null, $e ?: null);
}
}

@ -0,0 +1,29 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
interface ProcessRunnerAwareInterface
{
/**
* Returns the current process runner
*
* @return ProcessRunnerInterface
*/
public function getProcessRunner();
/**
* Sets a process runner
*
* @param ProcessRunnerInterface $runner
*/
public function setProcessRunner(ProcessRunnerInterface $runner);
}

@ -0,0 +1,33 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\BinaryDriver;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use Psr\Log\LoggerAwareInterface;
use SplObjectStorage;
use Symfony\Component\Process\Process;
interface ProcessRunnerInterface extends LoggerAwareInterface
{
/**
* Executes a process, logs events
*
* @param Process $process
* @param SplObjectStorage $listeners Some listeners
* @param Boolean $bypassErrors Set to true to disable throwing ExecutionFailureExceptions
*
* @return string The Process output
*
* @throws ExecutionFailureException in case of process failure.
*/
public function run(Process $process, SplObjectStorage $listeners, $bypassErrors);
}

@ -0,0 +1,297 @@
<?php
namespace Alchemy\Tests\BinaryDriver;
use Alchemy\BinaryDriver\AbstractBinary;
use Alchemy\BinaryDriver\BinaryDriverTestCase;
use Alchemy\BinaryDriver\Configuration;
use Symfony\Component\Process\ExecutableFinder;
class AbstractBinaryTest extends BinaryDriverTestCase
{
protected function getPhpBinary()
{
$finder = new ExecutableFinder();
$php = $finder->find('php');
if (null === $php) {
$this->markTestSkipped('Unable to find a php binary');
}
return $php;
}
public function testSimpleLoadWithBinaryPath()
{
$php = $this->getPhpBinary();
$imp = Implementation::load($php);
$this->assertInstanceOf('Alchemy\Tests\BinaryDriver\Implementation', $imp);
$this->assertEquals($php, $imp->getProcessBuilderFactory()->getBinary());
}
public function testMultipleLoadWithBinaryPath()
{
$php = $this->getPhpBinary();
$imp = Implementation::load(array('/zz/path/to/unexisting/command', $php));
$this->assertInstanceOf('Alchemy\Tests\BinaryDriver\Implementation', $imp);
$this->assertEquals($php, $imp->getProcessBuilderFactory()->getBinary());
}
public function testSimpleLoadWithBinaryName()
{
$php = $this->getPhpBinary();
$imp = Implementation::load('php');
$this->assertInstanceOf('Alchemy\Tests\BinaryDriver\Implementation', $imp);
$this->assertEquals($php, $imp->getProcessBuilderFactory()->getBinary());
}
public function testMultipleLoadWithBinaryName()
{
$php = $this->getPhpBinary();
$imp = Implementation::load(array('bachibouzouk', 'php'));
$this->assertInstanceOf('Alchemy\Tests\BinaryDriver\Implementation', $imp);
$this->assertEquals($php, $imp->getProcessBuilderFactory()->getBinary());
}
/**
* @expectedException Alchemy\BinaryDriver\Exception\ExecutableNotFoundException
*/
public function testLoadWithMultiplePathExpectingAFailure()
{
Implementation::load(array('bachibouzouk', 'moribon'));
}
/**
* @expectedException Alchemy\BinaryDriver\Exception\ExecutableNotFoundException
*/
public function testLoadWithUniquePathExpectingAFailure()
{
Implementation::load('bachibouzouk');
}
public function testLoadWithCustomLogger()
{
$logger = $this->getMock('Psr\Log\LoggerInterface');
$imp = Implementation::load('php', $logger);
$this->assertEquals($logger, $imp->getProcessRunner()->getLogger());
}
public function testLoadWithCustomConfigurationAsArray()
{
$conf = array('timeout' => 200);
$imp = Implementation::load('php', null, $conf);
$this->assertEquals($conf, $imp->getConfiguration()->all());
}
public function testLoadWithCustomConfigurationAsObject()
{
$conf = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
$imp = Implementation::load('php', null, $conf);
$this->assertEquals($conf, $imp->getConfiguration());
}
public function testProcessBuilderFactoryGetterAndSetters()
{
$imp = Implementation::load('php');
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$imp->setProcessBuilderFactory($factory);
$this->assertEquals($factory, $imp->getProcessBuilderFactory());
}
public function testConfigurationGetterAndSetters()
{
$imp = Implementation::load('php');
$conf = $this->getMock('Alchemy\BinaryDriver\ConfigurationInterface');
$imp->setConfiguration($conf);
$this->assertEquals($conf, $imp->getConfiguration());
}
public function testTimeoutIsSetOnConstruction()
{
$imp = Implementation::load('php', null, array('timeout' => 42));
$this->assertEquals(42, $imp->getProcessBuilderFactory()->getTimeout());
}
public function testTimeoutIsSetOnConfigurationSetting()
{
$imp = Implementation::load('php', null);
$imp->setConfiguration(new Configuration(array('timeout' => 42)));
$this->assertEquals(42, $imp->getProcessBuilderFactory()->getTimeout());
}
public function testTimeoutIsSetOnProcessBuilderSetting()
{
$imp = Implementation::load('php', null, array('timeout' => 42));
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$factory->expects($this->once())
->method('setTimeout')
->with(42);
$imp->setProcessBuilderFactory($factory);
}
public function testListenRegistersAListener()
{
$imp = Implementation::load('php');
$listeners = $this->getMockBuilder('Alchemy\BinaryDriver\Listeners\Listeners')
->disableOriginalConstructor()
->getMock();
$listener = $this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');
$listeners->expects($this->once())
->method('register')
->with($this->equalTo($listener), $this->equalTo($imp));
$reflexion = new \ReflectionClass('Alchemy\BinaryDriver\AbstractBinary');
$prop = $reflexion->getProperty('listenersManager');
$prop->setAccessible(true);
$prop->setValue($imp, $listeners);
$imp->listen($listener);
}
/**
* @dataProvider provideCommandParameters
*/
public function testCommandRunsAProcess($parameters, $bypassErrors, $expectedParameters, $output)
{
$imp = Implementation::load('php');
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$processRunner = $this->getMock('Alchemy\BinaryDriver\ProcessRunnerInterface');
$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
->getMock();
$processRunner->expects($this->once())
->method('run')
->with($this->equalTo($process), $this->isInstanceOf('SplObjectStorage'), $this->equalTo($bypassErrors))
->will($this->returnValue($output));
$factory->expects($this->once())
->method('create')
->with($expectedParameters)
->will($this->returnValue($process));
$imp->setProcessBuilderFactory($factory);
$imp->setProcessRunner($processRunner);
$this->assertEquals($output, $imp->command($parameters, $bypassErrors));
}
/**
* @dataProvider provideCommandWithListenersParameters
*/
public function testCommandWithTemporaryListeners($parameters, $bypassErrors, $expectedParameters, $output, $count, $listeners)
{
$imp = Implementation::load('php');
$factory = $this->getMock('Alchemy\BinaryDriver\ProcessBuilderFactoryInterface');
$processRunner = $this->getMock('Alchemy\BinaryDriver\ProcessRunnerInterface');
$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
->getMock();
$firstStorage = $secondStorage = null;
$processRunner->expects($this->exactly(2))
->method('run')
->with($this->equalTo($process), $this->isInstanceOf('SplObjectStorage'), $this->equalTo($bypassErrors))
->will($this->returnCallback(function ($process, $storage, $errors) use ($output, &$firstStorage, &$secondStorage) {
if (null === $firstStorage) {
$firstStorage = $storage;
} else {
$secondStorage = $storage;
}
return $output;
}));
$factory->expects($this->exactly(2))
->method('create')
->with($expectedParameters)
->will($this->returnValue($process));
$imp->setProcessBuilderFactory($factory);
$imp->setProcessRunner($processRunner);
$this->assertEquals($output, $imp->command($parameters, $bypassErrors, $listeners));
$this->assertCount($count, $firstStorage);
$this->assertEquals($output, $imp->command($parameters, $bypassErrors));
$this->assertCount(0, $secondStorage);
}
public function provideCommandWithListenersParameters()
{
$listener = $this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');
$listener->expects($this->any())
->method('forwardedEvents')
->will($this->returnValue(array()));
$listener2 = $this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');
$listener2->expects($this->any())
->method('forwardedEvents')
->will($this->returnValue(array()));
return array(
array('-a', false, array('-a'), 'loubda', 2, array($listener, $listener2)),
array('-a', false, array('-a'), 'loubda', 1, array($listener)),
array('-a', false, array('-a'), 'loubda', 1, $listener),
array('-a', false, array('-a'), 'loubda', 0, array()),
);
}
public function provideCommandParameters()
{
return array(
array('-a', false, array('-a'), 'loubda'),
array('-a', true, array('-a'), 'loubda'),
array('-a -b', false, array('-a -b'), 'loubda'),
array(array('-a'), false, array('-a'), 'loubda'),
array(array('-a'), true, array('-a'), 'loubda'),
array(array('-a', '-b'), false, array('-a', '-b'), 'loubda'),
);
}
public function testUnlistenUnregistersAListener()
{
$imp = Implementation::load('php');
$listeners = $this->getMockBuilder('Alchemy\BinaryDriver\Listeners\Listeners')
->disableOriginalConstructor()
->getMock();
$listener = $this->getMock('Alchemy\BinaryDriver\Listeners\ListenerInterface');
$listeners->expects($this->once())
->method('unregister')
->with($this->equalTo($listener), $this->equalTo($imp));
$reflexion = new \ReflectionClass('Alchemy\BinaryDriver\AbstractBinary');
$prop = $reflexion->getProperty('listenersManager');
$prop->setAccessible(true);
$prop->setValue($imp, $listeners);
$imp->unlisten($listener);
}
}
class Implementation extends AbstractBinary
{
public function getName()
{
return 'Implementation';
}
}

@ -0,0 +1,97 @@
<?php
namespace Alchemy\Tests\BinaryDriver;
use Symfony\Component\Process\ExecutableFinder;
use Alchemy\BinaryDriver\ProcessBuilderFactory;
abstract class AbstractProcessBuilderFactoryTest extends \PHPUnit_Framework_TestCase
{
public static $phpBinary;
private $original;
/**
* @return ProcessBuilderFactory
*/
abstract protected function getProcessBuilderFactory($binary);
public function setUp()
{
ProcessBuilderFactory::$emulateSfLTS = null;
if (null === static::$phpBinary) {
$this->markTestSkipped('Unable to detect php binary, skipping');
}
}
public static function setUpBeforeClass()
{
$finder = new ExecutableFinder();
static::$phpBinary = $finder->find('php');
}
public function testThatBinaryIsSetOnConstruction()
{
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$this->assertEquals(static::$phpBinary, $factory->getBinary());
}
public function testGetSetBinary()
{
$finder = new ExecutableFinder();
$phpUnit = $finder->find('phpunit');
if (null === $phpUnit) {
$this->markTestSkipped('Unable to detect phpunit binary, skipping');
}
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$factory->useBinary($phpUnit);
$this->assertEquals($phpUnit, $factory->getBinary());
}
/**
* @expectedException Alchemy\BinaryDriver\Exception\InvalidArgumentException
*/
public function testUseNonExistantBinary()
{
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$factory->useBinary('itissureitdoesnotexist');
}
public function testCreateShouldReturnAProcess()
{
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$process = $factory->create();
$this->assertInstanceOf('Symfony\Component\Process\Process', $process);
$this->assertEquals("'".static::$phpBinary."'", $process->getCommandLine());
}
public function testCreateWithStringArgument()
{
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$process = $factory->create('-v');
$this->assertInstanceOf('Symfony\Component\Process\Process', $process);
$this->assertEquals("'".static::$phpBinary."' '-v'", $process->getCommandLine());
}
public function testCreateWithArrayArgument()
{
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$process = $factory->create(array('-r', 'echo "Hello !";'));
$this->assertInstanceOf('Symfony\Component\Process\Process', $process);
$this->assertEquals("'".static::$phpBinary."' '-r' 'echo \"Hello !\";'", $process->getCommandLine());
}
public function testCreateWithTimeout()
{
$factory = $this->getProcessBuilderFactory(static::$phpBinary);
$factory->setTimeout(200);
$process = $factory->create(array('-i'));
$this->assertInstanceOf('Symfony\Component\Process\Process', $process);
$this->assertEquals(200, $process->getTimeout());
}
}

@ -0,0 +1,78 @@
<?php
namespace Alchemy\Tests\BinaryDriver;
use Alchemy\BinaryDriver\Configuration;
class ConfigurationTest extends \PHPUnit_Framework_TestCase
{
public function testArrayAccessImplementation()
{
$configuration = new Configuration(array('key' => 'value'));
$this->assertTrue(isset($configuration['key']));
$this->assertEquals('value', $configuration['key']);
$this->assertFalse(isset($configuration['key2']));
unset($configuration['key']);
$this->assertFalse(isset($configuration['key']));
$configuration['key2'] = 'value2';
$this->assertTrue(isset($configuration['key2']));
$this->assertEquals('value2', $configuration['key2']);
}
public function testGetOnNonExistentKeyShouldReturnDefaultValue()
{
$conf = new Configuration();
$this->assertEquals('booba', $conf->get('hooba', 'booba'));
$this->assertEquals(null, $conf->get('hooba'));
}
public function testSetHasGetRemove()
{
$configuration = new Configuration(array('key' => 'value'));
$this->assertTrue($configuration->has('key'));
$this->assertEquals('value', $configuration->get('key'));
$this->assertFalse($configuration->has('key2'));
$configuration->remove('key');
$this->assertFalse($configuration->has('key'));
$configuration->set('key2', 'value2');
$this->assertTrue($configuration->has('key2'));
$this->assertEquals('value2', $configuration->get('key2'));
}
public function testIterator()
{
$data = array(
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
);
$captured = array();
$conf = new Configuration($data);
foreach ($conf as $key => $value) {
$captured[$key] = $value;
}
$this->assertEquals($data, $captured);
}
public function testAll()
{
$data = array(
'key1' => 'value1',
'key2' => 'value2',
'key3' => 'value3',
);
$conf = new Configuration($data);
$this->assertEquals($data, $conf->all());
}
}

@ -0,0 +1,66 @@
<?php
namespace Alchemy\Tests\BinaryDriver;
use Symfony\Component\Process\ProcessBuilder;
use Alchemy\BinaryDriver\ProcessBuilderFactory;
use Symfony\Component\Process\Process;
class LTSProcessBuilderFactoryTest extends AbstractProcessBuilderFactoryTest
{
protected function getProcessBuilderFactory($binary)
{
$factory = new ProcessBuilderFactory($binary);
$factory->setBuilder(new LTSProcessBuilder());
ProcessBuilderFactory::$emulateSfLTS = false;
$factory->useBinary($binary);
return $factory;
}
}
class LTSProcessBuilder extends ProcessBuilder
{
private $arguments;
private $prefix;
private $timeout;
public function __construct(array $arguments = array())
{
$this->arguments = $arguments;
parent::__construct($arguments);
}
public function setArguments(array $arguments)
{
$this->arguments = $arguments;
return $this;
}
public function setPrefix($prefix)
{
$this->prefix = $prefix;
return $this;
}
public function setTimeout($timeout)
{
$this->timeout = $timeout;
return $this;
}
public function getProcess()
{
if (!$this->prefix && !count($this->arguments)) {
throw new LogicException('You must add() command arguments before calling getProcess().');
}
$args = $this->prefix ? array_merge(array($this->prefix), $this->arguments) : $this->arguments;
$script = implode(' ', array_map('escapeshellarg', $args));
return new Process($script, null, null, null, $this->timeout);
}
}

@ -0,0 +1,33 @@
<?php
namespace Alchemy\Tests\BinaryDriver\Listeners;
use Alchemy\BinaryDriver\Listeners\DebugListener;
use Symfony\Component\Process\Process;
class DebugListenerTest extends \PHPUnit_Framework_TestCase
{
public function testHandle()
{
$listener = new DebugListener();
$lines = array();
$listener->on('debug', function ($line) use (&$lines) {
$lines[] = $line;
});
$listener->handle(Process::ERR, "first line\nsecond line");
$listener->handle(Process::OUT, "cool output");
$listener->handle('unknown', "lalala");
$listener->handle(Process::OUT, "another output\n");
$expected = array(
'[ERROR] first line',
'[ERROR] second line',
'[OUT] cool output',
'[OUT] another output',
'[OUT] ',
);
$this->assertEquals($expected, $lines);
}
}

@ -0,0 +1,92 @@
<?php
namespace Alchemy\Tests\BinaryDriver\Listeners;
use Alchemy\BinaryDriver\Listeners\Listeners;
use Evenement\EventEmitter;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
class ListenersTest extends \PHPUnit_Framework_TestCase
{
public function testRegister()
{
$listener = new TestListener();
$listeners = new Listeners();
$listeners->register($listener);
$n = 0;
$listener->on('received', function ($type, $data) use (&$n, &$capturedType, &$capturedData) {
$n++;
$capturedData = $data;
$capturedType = $type;
});
$type = 'type';
$data = 'data';
$listener->handle($type, $data);
$listener->handle($type, $data);
$listeners->unregister($listener);
$listener->handle($type, $data);
$this->assertEquals(3, $n);
$this->assertEquals($type, $capturedType);
$this->assertEquals($data, $capturedData);
}
public function testRegisterAndForwardThenUnregister()
{
$listener = new TestListener();
$target = new EventEmitter();
$n = 0;
$target->on('received', function ($type, $data) use (&$n, &$capturedType, &$capturedData) {
$n++;
$capturedData = $data;
$capturedType = $type;
});
$m = 0;
$listener->on('received', function ($type, $data) use (&$m, &$capturedType2, &$capturedData2) {
$m++;
$capturedData2 = $data;
$capturedType2 = $type;
});
$listeners = new Listeners();
$listeners->register($listener, $target);
$type = 'type';
$data = 'data';
$listener->handle($type, $data);
$listener->handle($type, $data);
$listeners->unregister($listener, $target);
$listener->handle($type, $data);
$this->assertEquals(2, $n);
$this->assertEquals(3, $m);
$this->assertEquals($type, $capturedType);
$this->assertEquals($data, $capturedData);
$this->assertEquals($type, $capturedType2);
$this->assertEquals($data, $capturedData2);
}
}
class TestListener extends EventEmitter implements ListenerInterface
{
public function handle($type, $data)
{
$this->emit('received', array($type, $data));
}
public function forwardedEvents()
{
return array('received');
}
}

@ -0,0 +1,15 @@
<?php
namespace Alchemy\Tests\BinaryDriver;
use Alchemy\BinaryDriver\ProcessBuilderFactory;
class NONLTSProcessBuilderFactoryTest extends AbstractProcessBuilderFactoryTest
{
protected function getProcessBuilderFactory($binary)
{
ProcessBuilderFactory::$emulateSfLTS = true;
return new ProcessBuilderFactory($binary);
}
}

@ -0,0 +1,208 @@
<?php
/*
* This file is part of Alchemy\BinaryDriver.
*
* (c) Alchemy <info@alchemy.fr>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Tests\BinaryDriver;
use Alchemy\BinaryDriver\ProcessRunner;
use Alchemy\BinaryDriver\BinaryDriverTestCase;
use Alchemy\BinaryDriver\Exception\ExecutionFailureException;
use Alchemy\BinaryDriver\Listeners\ListenerInterface;
use Evenement\EventEmitter;
use Symfony\Component\Process\Exception\RuntimeException as ProcessRuntimeException;
class ProcessRunnerTest extends BinaryDriverTestCase
{
public function getProcessRunner($logger)
{
return new ProcessRunner($logger, 'test-runner');
}
public function testRunSuccessFullProcess()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$process = $this->createProcessMock(1, true, '--helloworld--', "Kikoo Romain", null, true);
$logger
->expects($this->never())
->method('error');
$logger
->expects($this->exactly(2))
->method('info');
$this->assertEquals('Kikoo Romain', $runner->run($process, new \SplObjectStorage(), false));
}
public function testRunSuccessFullProcessBypassingErrors()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$process = $this->createProcessMock(1, true, '--helloworld--', "Kikoo Romain", null, true);
$logger
->expects($this->never())
->method('error');
$logger
->expects($this->exactly(2))
->method('info');
$this->assertEquals('Kikoo Romain', $runner->run($process, new \SplObjectStorage(), true));
}
public function testRunFailingProcess()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$process = $this->createProcessMock(1, false, '--helloworld--', null, null, true);
$logger
->expects($this->once())
->method('error');
$logger
->expects($this->once())
->method('info');
try {
$runner->run($process, new \SplObjectStorage(), false);
$this->fail('An exception should have been raised');
} catch (ExecutionFailureException $e) {
}
}
public function testRunFailingProcessWithException()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$exception = new ProcessRuntimeException('Process Failed');
$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
->getMock();
$process->expects($this->once())
->method('run')
->will($this->throwException($exception));
$logger
->expects($this->once())
->method('error');
$logger
->expects($this->once())
->method('info');
try {
$runner->run($process, new \SplObjectStorage(), false);
$this->fail('An exception should have been raised');
} catch (ExecutionFailureException $e) {
$this->assertEquals($exception, $e->getPrevious());
}
}
public function testRunfailingProcessBypassingErrors()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$process = $this->createProcessMock(1, false, '--helloworld--', 'Hello output', null, true);
$logger
->expects($this->once())
->method('error');
$logger
->expects($this->once())
->method('info');
$this->assertNull($runner->run($process, new \SplObjectStorage(), true));
}
public function testRunFailingProcessWithExceptionBypassingErrors()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$exception = new ProcessRuntimeException('Process Failed');
$process = $this->getMockBuilder('Symfony\Component\Process\Process')
->disableOriginalConstructor()
->getMock();
$process->expects($this->once())
->method('run')
->will($this->throwException($exception));
$logger
->expects($this->once())
->method('error');
$logger
->expects($this->once())
->method('info');
$this->assertNull($runner->run($process, new \SplObjectStorage(), true));
}
public function testRunSuccessFullProcessWithHandlers()
{
$logger = $this->createLoggerMock();
$runner = $this->getProcessRunner($logger);
$capturedCallback = null;
$process = $this->createProcessMock(1, true, '--helloworld--', "Kikoo Romain", null, true);
$process->expects($this->once())
->method('run')
->with($this->isInstanceOf('Closure'))
->will($this->returnCallback(function ($callback) use (&$capturedCallback) {
$capturedCallback = $callback;
}));
$logger
->expects($this->never())
->method('error');
$logger
->expects($this->exactly(2))
->method('info');
$listener = new TestListener();
$storage = new \SplObjectStorage();
$storage->attach($listener);
$capturedType = $capturedData = null;
$listener->on('received', function ($type, $data) use (&$capturedType, &$capturedData) {
$capturedData = $data;
$capturedType = $type;
});
$this->assertEquals('Kikoo Romain', $runner->run($process, $storage, false));
$type = 'err';
$data = 'data';
$capturedCallback($type, $data);
$this->assertEquals($data, $capturedData);
$this->assertEquals($type, $capturedType);
}
}
class TestListener extends EventEmitter implements ListenerInterface
{
public function handle($type, $data)
{
return $this->emit('received', array($type, $data));
}
public function forwardedEvents()
{
return array();
}
}

@ -0,0 +1,4 @@
<?php
$loader = require __DIR__.'/../vendor/autoload.php';
$loader->add('Alchemy\Tests', __DIR__);

@ -0,0 +1,7 @@
<?php
// autoload.php generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit75f7ea26a11f6be21d13acba7a2d0249::getLoader();

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save