Nova Resource:Metavidwiki/openmeetings v metavidwiki
Apply with:
patch -p2 < text_of_this_wikipage.diff
I'm not really sure what going on with the '/skins/' directory – I might have force-copied-and-pasted in a different theme a few years ago while learning how to use MetaVidWiki. gchriss (talk) 21:11, 11 July 2012 (UTC)
- Also, this patch really is sensitive to versioning (i.e., Mediawiki rev51560) and will not patch cleanly on a non-matching version. gchriss (talk) 22:26, 29 March 2013 (UTC)
diff --git a/rev51560/w/maintenance/generateSitemap.php b/gchriss/w/maintenance/generateSitemap.php index 737c4eb..190942c 100755 --- a/rev51560/w/maintenance/generateSitemap.php +++ b/gchriss/w/maintenance/generateSitemap.php @@ -81,6 +81,8 @@ class GenerateSitemap { NS_PROJECT => '0.5', NS_PROJECT_TALK => '0.1', NS_FILE => '0.5', + NS_STREAM => '0.5', + NS_STREAM_TALK => '0.1', NS_FILE_TALK => '0.1', NS_MEDIAWIKI => '0.0', NS_MEDIAWIKI_TALK => '0.1', @@ -394,7 +396,7 @@ class GenerateSitemap { function indexEntry( $filename ) { return "\t<sitemap>\n" . - "\t\t<loc>$filename</loc>\n" . + "\t\t<loc>" . 'http://host.org/' . "$filename</loc>\n" . "\t\t<lastmod>{$this->timestamp}</lastmod>\n" . "\t</sitemap>\n"; } diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_GlobalFunctions.php b/gchriss/w/extensions/MetavidWiki/includes/MV_GlobalFunctions.php index 7b2912d..5fa0d8e 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_GlobalFunctions.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_GlobalFunctions.php @@ -611,12 +611,14 @@ function seconds2npt( $seconds, $short = false ) { } } function seconds2Description( $seconds, $short=false, $singular=false){ - $dur = time_duration_2array( $seconds , array('days'=> '86400', 'hours'=> 3600,'minutes' => 60,'seconds' => 1)); + $dur = time_duration_2array( $seconds , array('days'=> 86400 , 'hours'=> 3600,'minutes' => 60,'seconds' => 1)); $o=''; - if( $dur['days']!=0){ - $msg = ($singular)?'mv_days_singular':'mv_days'; - $o.= wfMsg($msg, intval( $dur['days']) ); - } +// if( $dur['days']!=0){ +// $msg = ($singular)?'mv_days_singular':'mv_days'; +// $o.= wfMsg($msg, intval( $dur['days']) ); +// } if( $dur['hours'] != 0 ){ $msg = ($singular)?'mv_hours_singular':'mv_hours'; $o.= wfMsg($msg, intval( $dur['hours']) ); @@ -777,8 +779,10 @@ function mvGetMVTitle() { } function mv_get_person_img( $person_name ) { - $imgTitle = Title::makeTitle( NS_IMAGE, $person_name . '.jpg' ); + $imgTitle = Title::makeTitle( NS_IMAGE, $person_name . '.png' ); if ( $imgTitle->exists() ) { $img = wfFindFile( $imgTitle ); if ( !$img ) { $img = wfLocalFile( $imgTitle ); diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_ImageGallery.php b/gchriss/w/extensions/MetavidWiki/includes/MV_ImageGallery.php index ed3f27f..89619da 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_ImageGallery.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_ImageGallery.php @@ -66,7 +66,7 @@ if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); # ref http://css-discuss.incutio.com/?page=CenteringBlockElement . '<div style="margin-left: auto; margin-right: auto; width: ' . htmlspecialchars( $this->mWidths ) . 'px;">' . $sk->makeKnownLinkObj( $nt, '<img title="'. htmlspecialchars($mvTitle->getStreamNameText()) .'"' - . ' width="160" height="120" src="'.$mvTitle->getStreamImageURL('160x120') . '">') + . ' width="160" height="90" src="'.$mvTitle->getStreamImageURL('160x90') . '">') . '</div>' . '</div>' . // @@todo clean up link diff --git a/rev51560/w/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php b/gchriss/w/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php index f0928f0..9a39720 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php +++ b/gchriss/w/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php @@ -359,11 +364,11 @@ class MV_SpecialMediaSearch { // force host for script (should be a better way to do this) if ( !isset( $_SERVER['HTTP_HOST'] ) ) - $_SERVER['HTTP_HOST'] = 'metavid.org'; + $_SERVER['HTTP_HOST'] = 'host.org'; // make miro link: $o .= '<li class="subscribe"><a href="http://subscribe.getMiro.com/?url1=' . - 'http%3A%2F%2F' . $_SERVER['HTTP_HOST'] . urlencode( $sTitle->getFullUrl( $this->get_httpd_filters_query() ) ) . '" ' . + urlencode( $sTitle->getFullUrl( $this->get_httpd_filters_query() ) ) . '" ' . 'title="Subscribe with Miro"><img src="' . $wgStylePath . '/mvpcf/images/button_subscribe.png" alt="Miro Video Player" border="0" /></a></li>'; // make rss link: @@ -481,11 +486,14 @@ class MV_SpecialMediaSearch { // $mvTitle->getStreamName() .'/'.$mvTitle->getStartTime() .'/'. $mvTitle->getEndTime() ); $mvd_text = $mvd->text; + $gchriss_search_hack = ($mvTitle->getStreamId() < 543 || $mvTitle->getStreamId() == 518 ) ? '176x120' : '170x96' ; $o .= '<li class="result"> <span class="vid_img" id="mvimg_' . htmlspecialchars( $mvd->id ) . '"> ' . $sk->makeKnownLinkObj( $mvStreamTitle, '<img alt="image for ' . htmlspecialchars( $mvTitle->getStreamNameText() ) . - ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL( 'small' , $req_time = null, $foce_server = '', $direct_link=false ) . + ' ' . $mvTitle->getTimeDesc() . '" src="' . $mvTitle->getStreamImageURL( $gsc_search_hack , $req_time = null, $foce_server = '', $direct_link=false ) . '"/>' ) . ' </span> <div class="result_description"> @@ -861,7 +871,7 @@ class MV_SpecialMediaSearch { if ( $f['t'] != 'match' ) // no desc for text search $o .= ( $query_key ) ? $a : $a . wfMsg( 'mv_' . $f['t'] ) . ' '; if ( $f['t'] == 'date_range' ) { // handle special case of date range: - $o .= ' '+ wfMsg( 'mv_time_separator', $bo . htmlspecialchars( $f['vs'] ) . $bc, $bo . htmlspecialchars( $f['ve'] ) . $bc ); + $o .= ' '. wfMsg( 'mv_time_separator', $bo . htmlspecialchars( $f['vs'] ) . $bc, $bo . htmlspecialchars( $f['ve'] ) . $bc ); } else { $o .=' '. $bo . str_replace( '_', ' ', htmlspecialchars( $f['v'] ) ) . $bc .' '; } @@ -974,7 +984,7 @@ class MV_SpecialMediaSearch { $result = $dbr->select( 'page', 'page_title', array ( 'page_namespace' => NS_CATEGORY, '`page_title` LIKE \'%' . mysql_escape_string( $val - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array ( + ) . '%\' COLLATE utf8_bin' ), __METHOD__, array ( 'LIMIT' => $result_limit ) ); $match_count = $dbr->numRows( $result ); @@ -996,7 +1006,7 @@ class MV_SpecialMediaSearch { $result = $dbr->select( 'categorylinks', 'cl_sortkey', array ( 'cl_to' => $category, '`cl_sortkey` LIKE \'%' . mysql_escape_string( $val - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array ( + ) . '%\' COLLATE utf8_bin' ), __METHOD__, array ( 'LIMIT' => $result_limit ) ); // print 'ran: ' . $dbr->lastQuery(); @@ -1023,7 +1033,7 @@ class MV_SpecialMediaSearch { $result = $dbr->select( 'categorylinks', 'cl_sortkey', array ( 'cl_to' => 'Person', '`cl_sortkey` LIKE \'%' . mysql_escape_string( $val - ) . '%\' COLLATE latin1_general_ci' ), __METHOD__, array ( + ) . '%\' COLLATE utf8_bin' ), __METHOD__, array ( 'LIMIT' => $result_limit ) ); $out = ''; diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php index e4d9277..f3d0167 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php @@ -52,7 +52,7 @@ $smwgShowFactbox = SMW_FACTBOX_HIDDEN; */ // get nav-interface links - $wgOut->addHTML( '<div id="mv_fd_mvd_cont" >' ); + $wgOut->addHTML( '<div id="mv_fd_mvd_cont" style="position:relative;" >' ); $wgOut->addHTML( "<div id=\"mv_add_new_mvd\" style=\"display:none;\"></div>" ); $this->get_transcript_pages(); $wgOut->addHTML( "</div>" ); @@ -377,7 +377,9 @@ $smwgShowFactbox = SMW_FACTBOX_HIDDEN; $smwKeyTitle = Title::newFromText( $smw_key ); $valueTitle = Title::newFromText( $smw_attr_val ); if ( $template_key == 'anno_en' ) - $smw_text_html .= ucwords( $smwKeyTitle->getText() ) . ': ' . $sk->makeLinkObj( $valueTitle ) . '<br>'; + // $smw_text_html .= ucwords( $smwKeyTitle->getText() ) . ': ' . $sk->makeLinkObj( $valueTitle ) . '<br>'; + + $smw_text_html .= 'Title: ' . $sk->makeLinkObj( $valueTitle ) . '<br>'; } if ( !$added_play_link && $mvd_page != '' ) { @@ -427,7 +429,9 @@ $smwgShowFactbox = SMW_FACTBOX_HIDDEN; function get_add_disp( $baseTitle, $mvdType, $time_range ) { global $wgUser, $wgOut, $mvDefaultClipLength, $mvMVDTypeAllAvailable, $wgRequest; + if( isset($time_range)) { list( $this->start_context, $this->end_context ) = split( '/', $time_range ); + } // first make sure its a valid mvd_type if ( !in_array( $mvdType, $mvMVDTypeAllAvailable ) )return; # Or we could throw an exception: @@ -601,7 +605,7 @@ $smwgShowFactbox = SMW_FACTBOX_HIDDEN; $o .= "<tr><td><label>" . htmlspecialchars( $swmTitle->getText() ) . ':</label></td><td>' . $smwImageHTML . '<input class="mv_anno_ac_' . htmlspecialchars( $mvd_id ) . '" ' . - 'size="40" name="smw_' . htmlspecialchars( $prop ) . '" type="text" value="' . htmlspecialchars( $val ) . '"> ' . + 'size="20" name="smw_' . htmlspecialchars( $prop ) . '" type="text" value="' . htmlspecialchars( $val ) . '"> ' . '<div class="autocomplete" id="smw_' . htmlspecialchars( $prop ) . '_choices_' . htmlspecialchars( $mvd_id ) . '" style="display: none;"/> </td></tr>'; } else { @@ -663,33 +667,7 @@ $smwgShowFactbox = SMW_FACTBOX_HIDDEN; */ $mvd_id = htmlspecialchars( $mvd_id ); $mvgScriptPath = htmlspecialchars( $mvgScriptPath ); - $out .= ' - <span id="mv_adjust_msg_' . $mvd_id . '"></span> - <table style="background:transparent;position:relative" width="94%" border="0"><tr><td width="40"> -<span id="track_time_start_' . $mvd_id . '" style="font-size:small">0:00:00</span> -</td><td>' . -'<div id="container_track_' . $mvd_id . '" style="width:100%; height: 5px; background-color: rgb(170, 170, 170); border:1px solid black; position: relative">'; - // add some overlays to make the track look like it ends/starts at 0+-7px - $out .= '<div style="position:absolute;left:0px;width:7px;height: 5px;background-color: white;border-right:1px solid black;"></div>' . - '<div style="position:absolute;right:0px;width:7px;height: 5px;background-color: white;border-left:1px solid black;"></div>'; - // the reszie div structure: - $out .= '<div id="resize_' . $mvd_id . '" style="height: 20px; position: absolute;"> - <div id="handle1_' . $mvd_id . '" style="background:no-repeat url(\'' . $mvgScriptPath . '/skins/images/slider_handle_green.gif\')"; class="ui-resizable-w ui-resizable-handle"></div> - <div id="handle2_' . $mvd_id . '" style="background:no-repeat url(\'' . $mvgScriptPath . '/skins/images/slider_handle_red.gif\')"; class="ui-resizable-e ui-resizable-handle"></div> - <div id="dragSpan_' . $mvd_id . '" class="ui-dragSpan"></div> - </div> -</div>' . -// '<input type="hidden" id="wpPreview_stop_msg_' .$mvd_id.'" value="'.wfMsg('mv_adjust_preview_stop').'">'. -// style="background: red url(\''.$mvgScriptPath.'/skins/mv_embed/images/slider_handle.gif\')" - /*<div id="track_'.$mvd_id.'" style="width:100%;background-color: rgb(170, 170, 170); height: 5px; position: relative;"> - <div class="" id="handle1_'.$mvd_id.'" style="cursor: move;position:absolute;background-color:#5f5;height:20px;z-index:3"> </div> - <div class="" id="handle2_'.$mvd_id.'" style="cursor: move;position:absolute;background-color:#f55;height:20px;z-index:3"> </div> - <div class="" id="selected_'.$mvd_id.'" style="position:absolute;background-color:#55f;height:10px;z-index:1;overflow:hidden"></div> - </div>*/ -'</td><td width="50"> -<span id="track_time_end_' . $mvd_id . '" style="font-size:small">0:00:00</span> - </td></tr></table> - <br />'; + $out .= '<br><div class="inOutSlider"></div><br />'; $out .= '<span style="float:left;"><label class="mv_css_form" for="mv_start_hr_' . $mvd_id . '"><i>' . wfMsg( 'mv_start_desc' ) . ':</i></label> ' . '<input class="mv_adj_hr" size="8" maxlength="8" value="' . htmlspecialchars( $start_time ) . '" id="mv_start_hr_' . $mvd_id . '" name="mv_start_hr_' . $mvd_id . '">' . diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php index 2d9f968..d130c97 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php @@ -42,20 +42,20 @@ if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); </a>'; $coma=', '; } - $ogg_hq_url = $mvTitle->getWebStreamURL('mv_ogg_high_quality'); + $ogg_hq_url = $mvTitle->getWebStreamURL('mv_ogg_424x240'); if($ogg_hq_url!=''){ $o.=$coma.' <a href="'.htmlspecialchars($ogg_hq_url).'"> - High Quality Ogg - </a>'; - $coma=', '; - } - $flash_stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey); - if($flash_stream_url!=''){ - $o.=$coma.' <a href="'.htmlspecialchars($flash_stream_url).'"> - Flash Video + Widescreen Ogg </a>'; $coma=', '; } + // $flash_stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey); + // if($flash_stream_url!=''){ + // $o.=$coma.' <a href="'.htmlspecialchars($flash_stream_url).'"> + // Flash Video + // </a>'; + // $coma=', '; + // } $o.='</span>';*/ $o .= '<span class="download"><a href="javascript:$j(\'#' . htmlspecialchars( $this->embed_id ) . '\').get(0).showVideoDownload()">Download Options</a></span>'; } diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php index eaeb71b..4bf798e 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_EditPageAjax.php @@ -161,7 +161,7 @@ $lTitle = Title::makeTitle( NS_SPECIAL, 'Userlogin' ); $loginLink = $lTitle->getFullURL('returnto=' . MWNamespace::getCanonicalName( MV_NS_STREAM ) . ':' . $stream_name ); - $wgOut->addHTML( wfMsg( 'mv_user_cant_edit', $loginLink, $cancel ) ); + $wgOut->addWikiText( wfMsg( 'mv_user_cant_edit', $loginLink, $cancel ) ); $wgOut->readOnlyPage( $this->mArticle->getContent(), true, $permErrors ); $wgUser->setOption( 'rows', $non_ajax_rows ); wfProfileOut( $fname ); @@ -626,13 +626,13 @@ # Otherwise, show a summary field at the bottom $summarytext = htmlspecialchars( $wgContLang->recodeForEdit( $this->summary ) ); # FIXME if ( $this->section == 'new' ) { - $commentsubject = "<br /><span id='wpSummaryLabel'><label for='wpSummary'>{$subject}:</label></span>\n<div class='editOptions'>\n<input tabindex='1' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='40' /><br />"; + $commentsubject = "<br /><span id='wpSummaryLabel'><label for='wpSummary'>{$subject}:</label></span>\n<div class='editOptions'>\n<input tabindex='1' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='36' /><br />"; $editsummary = ''; $subjectpreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg( 'subject-preview' ) . ':' . $sk->commentBlock( $this->summary, $this->mTitle ) . "</div>\n" : ''; $summarypreview = ''; } else { $commentsubject = ''; - $editsummary = "<br /><span id='wpSummaryLabel'><label for='wpSummary'>{$summary}:</label></span>\n<div class='editOptions'>\n<input tabindex='2' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='40' /><br />"; + $editsummary = "<br /><span id='wpSummaryLabel'><label for='wpSummary'>{$summary}:</label></span>\n<div class='editOptions'>\n<input tabindex='2' type='text' value=\"$summarytext\" name='wpSummary' id='wpSummary' maxlength='200' size='36' /><br />"; $summarypreview = $summarytext && $this->preview ? "<div class=\"mw-summary-preview\">" . wfMsg( 'summary-preview' ) . ':' . $sk->commentBlock( $this->summary, $this->mTitle ) . "</div>\n" : ''; $subjectpreview = ''; } diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php index f9adacb..5566866 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_MetavidInterface.php @@ -124,15 +124,15 @@ if ( SMW_VERSION ) { // global $smwgIP; $smwStore =& smwfGetStore(); - foreach ( $this->smwProperties as $propKey => $val ) { - $propTitle = Title::newFromText( $propKey, SMW_NS_PROPERTY ); - $smwProps = $smwStore->getPropertyValues( $this->article->mTitle, $propTitle ); + //foreach ( $this->smwProperties as $propKey => $val ) { + // $propTitle = Title::newFromText( $propKey, SMW_NS_PROPERTY ); + // $smwProps = $smwStore->getPropertyValues( $this->article->mTitle, $propTitle ); // just a temp hack .. we need to think about this abstraction a bit... - if ( count( $smwProps ) != 0 ) { - $v = current( $smwProps ); - $this->smwProperties[$propKey] = $v->getXSDValue(); - } - } + // if ( count( $smwProps ) != 0 ) { + // $v = current( $smwProps ); + // $this->smwProperties[$propKey] = $v->getXSDValue(); + // } + // } } } /* @@ -152,11 +152,16 @@ // @@todo dynamic re-size page_spacer: $wgOut->addHTML( '<div id="mv_interface_container">' ); foreach ( $this->components as $cpKey => &$component ) { + if ( $cpKey == 'MV_Tools' ) + $wgOut->addHTML( "<div style=\"clear:left\"></div>"); + if ( $cpKey == 'MV_Navigator' ) $wgOut->addHTML( "<div id=\"videoSideBar\">" ); + $component->render_full(); if ( $cpKey == 'MV_Overlay' ) $wgOut->addHTML( "</div>" ); + } $wgOut->addHTML( '</div>' ); // for now output spacers diff --git a/rev51560/w/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php b/gchriss/w/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php index e5009e9..83b038e 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php +++ b/gchriss/w/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php @@ -84,7 +84,8 @@ class MV_SequencePage extends Article { 'interface_url' => str_replace('index.php', 'api.php', $wgServer . $wgScript), //api link (might be a better way to grab that) 'linkback' => $this->mTitle->getFullURL(), 'mTitle' => $this->mTitle->getPrefixedDBKey(), - 'mTalk' => $talkTitle->getPrefixedDBKey() + 'mTalk' => $talkTitle->getPrefixedDBKey(), + 'mTouchedTime' => wfTimestamp(TS_ISO_8601, $this->mTitle->getTouched()) ); foreach($metaData as $name=>$val){ $titleNode = $this->smilDoc->createElement('meta'); @@ -92,11 +93,22 @@ class MV_SequencePage extends Article { $titleNode->setAttribute("content", htmlentities($val) ); $headNode->appendChild($titleNode); } + //add special meta wikiDesc: + $titleNode = $this->smilDoc->createElement('meta'); + $titleNode->setAttribute("name", htmlentities('wikiDesc') ); + $f = $titleNode->ownerDocument->createDocumentFragment(); + $f->appendXML( "<![CDATA[\n". + trim( $this->getPageContent() ). + "\n]]>"); + $titleNode->appendChild($f); + $headNode->appendChild( $titleNode ); + //add resolved transitions to the head: $tranNodeList = $this->hlrdDoc->getElementsByTagName('transition'); foreach ($tranNodeList as $tranNode){ - //for now do a direct copy (future we should do additional validation even though it should be validated on the way in) + //for now do a direct copy + //(future we should do additional validation even though it should be validated on the way in) $node = $this->smilDoc->importNode($tranNode, true); $headNode->appendChild($node); } @@ -251,9 +263,11 @@ class MV_SequencePage extends Article { foreach($paramVars as $name=>$val){ $phtml.='<param name="' . htmlentities($name) . '">' . htmlentities($val) . '</param>'; } + if($phtml!=''){ $f = $node->ownerDocument->createDocumentFragment(); $f->appendXML( $phtml ); $node->appendChild($f); + } break; case NS_IMAGE: case NS_FILE: @@ -714,7 +728,6 @@ class MV_SequencePage extends Article { return $marker; } function getPageContent() { - global $wgRequest; $base_text = parent::getContent(); // strip the sequence $seqClose = strpos( $base_text, '</' . SEQUENCE_TAG . '>' ); diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_Settings.php b/gchriss/w/extensions/MetavidWiki/includes/MV_Settings.php index d8f7461..b5b3ab1 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_Settings.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_Settings.php @@ -1,4 +1,4 @@ -<? +<?php if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); # ## @@ -25,12 +25,6 @@ $mvGetParentMeta = true; //script loader settings: -$mvgJSDebug=false; -$wgEnableScriptLoader = false; //if the script loader is on - -$wgEnableScriptLoaderJsFile = true; //if you can use the script loader with js files (rather than only js classes) -$wgEnableScriptMinify = true; - // if the search portlet should autoComplete @@ -40,7 +34,7 @@ $mvEnableAutoComplete = true; // if you want mvd links to be rewritten client side as inline movie clips and link to the stream page -$mvEnableJSMVDrewrite = true; +$mvEnableJSMVDrewrite = false; # ######################### # semanticWiki integration options @@ -62,11 +56,11 @@ $mvMetaDataHelpers = array( 'anno_en' => array( 'speech_by' => 'person', 'bill' $mvMetaCategoryHelper = true; -$mvSpokenByInSearchResult = true; +$mvSpokenByInSearchResult = false; // if you want to include category lookup in search results: $mvCategoryInSearchResult = true; // if you want to include bill lookup in search results: -$mvBillInSearchResult = true; +$mvBillInSearchResult = false; # ######################## @@ -81,7 +75,7 @@ $mvBillInSearchResult = true; // if we should load images from an external server: $mvExternalImages = false; // path to metavidWiki install that is serving images: -$mvExternalImgServerPath = 'http://mvprime.cse.ucsc.edu/wiki/index.php'; +$mvExternalImgServerPath = 'http://host.org/w/index.php'; $mvWebImgLoc = $mvgScriptPath . '/stream_images'; // full local path for images (if hosted locally) @@ -96,56 +90,57 @@ $mvServeImageRedirect = false; // (set pretty high for the metavid context where we load the images via scripts // (early on we did less frequent image grabs) // normally you would want a lower value like 5 seconds or so -$mvImageGranularityRate = '600'; -// the ffmpeg command to generate thumbnail (to disable generating images set to '') -$mvShellOggFrameGrab = ''; +$mvImageGranularityRate = '5'; +// command to generate thumbnail (to disable generating images set to '') +// $mvShellOggFrameGrab = ''; # define the video media locations based on path/server names -$mvVideoArchivePaths['cap1'] = 'http://metavidstorage01.ucsc.edu/media/'; -$mvVideoArchivePaths['mvbox2'] = 'http://mvbox2.cse.ucsc.edu/media/'; +$mvVideoArchivePaths['cap1'] = 'http://host.org/archives/'; +$mvVideoArchivePaths['mvbox2'] = 'http://host.org/archives/'; // stream msgKeys that support ?t=start_time/end_time temporal url media serving: -$mvDefaultVideoQualityKey = 'mv_ogg_low_quality'; -$mvDefaultFlashQualityKey = 'mv_flash_low_quality'; -$mvDefaultVideoHighQualityKey = 'mv_ogg_high_quality'; -$mvDefaultMP4QualityKey = 'mv_archive_org_mp4'; +$mvDefaultVideoQualityKey = 'mv_ogg_424x240'; +#$mvDefaultFlashQualityKey = 'mv_flash_low_quality'; +$mvDefaultVideoHighQualityKey = 'mv_ogg_424x240'; +#$mvDefaultMP4QualityKey = 'mv_archive_org_mp4'; + +$mvVidQualityMsgKeyType['mv_ogg_low_quality'] = $mvVidQualityMsgKeyType['mv_ogg_424x240']='video/ogg'; -$mvVidQualityMsgKeyType['mv_ogg_low_quality'] = $mvVidQualityMsgKeyType['mv_ogg_high_quality']='video/ogg'; -$mvVidQualityMsgKeyType['mv_flash_low_quality']='video/x-flv'; +#$mvVidQualityMsgKeyType['mv_flash_low_quality']='video/x-flv'; # local path to video archive (if hosted locally) -$mvLocalVideoLoc = '/metavid/video_archive'; +$mvLocalVideoLoc = '/archives/'; # default clip length -$mvDefaultClipLength = 30; +$mvDefaultClipLength = 240; $mvDefaultClipRange = 10; /*how many seconds to display of the video in the default Metavid:stream_name page */ $mvDefaultStreamViewLength = 60 * 20; // 20 min // default aspect ratio (should be derived from media resolution once we integrate with oggHandler) -$mvDefaultAspectRatio = .75; +$mvDefaultAspectRatio = 0.566037736; // limit for media search results: -$mvMediaSearchResultsLimit = 100; +$mvMediaSearchResultsLimit = 30; # define how offten (in seconds) clients do http pull requests # to get new info when watching live broadcasts $mvLiveUpdateInterval = 5; // should be the same resolution as webstream encode. -$mvDefaultVideoPlaybackRes = '400x300'; -$mvDefaultSearchVideoPlaybackRes = '320x240'; +$mvDefaultVideoPlaybackRes = '424x240'; +$mvDefaultSearchVideoPlaybackRes = '424x240'; $mvDefaultVideoIconSize = '80x60'; //if to display the ROE resource link -$mvDispROEicon=false; +$mvDispROEicon=true; //The text Embed a metavid Stream inline in the wiki $mvEmbedKey = 'Embed'; //wars people of archive inacuracys (given its a wiki and the source is close caption feed) -$mvEnableStreamNotice = false; +$mvEnableStreamNotice = true; /* * All Available meta data layers @@ -154,7 +149,7 @@ $mvEnableStreamNotice = false; * Different languages should be in different tracks and documentation should be clear * to insure data goes into its associative layer. */ -$mvMVDTypeAllAvailable = array( 'ht_en', 'anno_en', 'thomas_en' ); +$mvMVDTypeAllAvailable = array( 'ht_en', 'anno_en'); /* * the default display set of layers (must be a subset of $mvMVDTypeAllAvaliable) @@ -164,7 +159,7 @@ $mvMVDTypeAllAvailable = array( 'ht_en', 'anno_en', 'thomas_en' ); $mvMVDTypeDefaultDisp = array( 'ht_en', 'anno_en' ); //if we should show the layer controls: -$mvgShowLayerControls = false; +$mvgShowLayerControls = true; # ################## # Special Pages with Interface functions @@ -174,7 +169,7 @@ define( 'MV_MISSING_PERSON_IMG', 'Missing person.jpg' ); // whether to count found results (can take lots of time on big result sets) -$mvDo_SQL_CALC_FOUND_ROWS = true; +$mvDo_SQL_CALC_FOUND_ROWS = false; # ######## # Stream Types & User Rights @@ -201,15 +196,16 @@ $wgAvailableRights[] = 'mv_delete_mvd'; $wgAvailableRights[] = 'mv_edit_stream'; $mvMsgContentTypeLookup = array( - 'ao_file_256Kb_MPEG4' => 'video/mp4', - 'ao_file_64Kb_MPEG4' => 'video/mp4', - 'ao_file_flash_flv' => 'video/x-flv', - 'ao_file_MPEG1' => 'video/mpeg', - 'ao_file_MPEG2' => 'video/mpeg-2', - - 'mv_archive_org_mp4' => 'video/h264', - 'mv_flash_low_quality' => 'video/x-flv', - 'mv_ogg_high_quality' => 'video/ogg', +# 'ao_file_256Kb_MPEG4' => 'video/mp4', +# 'ao_file_64Kb_MPEG4' => 'video/mp4', +# 'ao_file_flash_flv' => 'video/x-flv', +# 'ao_file_MPEG1' => 'video/mpeg', +# 'ao_file_MPEG2' => 'video/mpeg-2', + +# 'mv_archive_org_mp4' => 'video/h264', +# 'mv_flash_low_quality' => 'video/x-flv', + 'mv_ogg_424x240' => 'video/ogg', + 'mv_ogg_352x240' => 'video/ogg', 'mv_ogg_low_quality' => 'video/ogg' ); diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_Index.php b/gchriss/w/extensions/MetavidWiki/includes/MV_Index.php index 43dcd08..be3f042 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_Index.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_Index.php @@ -170,9 +170,13 @@ if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); // init property: $row->$propKey = ''; $propTitle = Title::newFromText( $propKey, SMW_NS_PROPERTY ); - $smwProps = $smwStore->getPropertyValues( $rowTitle, $propTitle ); +// $smwProps = $smwStore->getPropertyValues( $rowTitle, $propTitle ); + $smwProps = ''; + // just a temp hack .. we need to think about this abstraction a bit... - if ( count( $smwProps ) != 0 ) { +// if ( count( $smwProps ) != 0 ) { + if ( 0 ) { + $v = current( $smwProps ); $row->$propKey = $v->getXSDValue(); } @@ -214,10 +218,10 @@ if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); ); $cond[] = ' `start_time` <= ' . $mvTitle->getStartTimeSeconds() ; - $cond[] = ' `start_time` <= ' . $mvTitle->getEndTimeSeconds() ; +// $cond[] = ' `start_time` <= ' . $mvTitle->getEndTimeSeconds() ; $cond[] = ' `end_time` >= ' . $mvTitle->getStartTimeSeconds() ; - $cond[] = ' `end_time` >= ' . $mvTitle->getEndTimeSeconds() ; +// $cond[] = ' `end_time` >= ' . $mvTitle->getEndTimeSeconds() ; $res = $dbr->select( $from_tables, $vars, @@ -438,7 +442,7 @@ if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); // restrict to streams with valid $mvDefaultVideoQualityKey files: global $mvDefaultVideoQualityKey, $mvDefaultFlashQualityKey; - $from_tables .= 'JOIN ' . $dbr->tableName( 'mv_stream_files' ) . +// $from_tables .= 'JOIN ' . $dbr->tableName( 'mv_stream_files' ) . ' ON ' . '( ' . $dbr->tableName( 'mv_mvd_index' ) . '.stream_id = ' . $dbr->tableName( 'mv_stream_files' ) . '.stream_id ' . @@ -628,6 +634,15 @@ if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); } } + foreach($ret_ary as $k => $v){ + $ret_ary[$k]->text = str_replace(array('u800','u82e'),'', $v->text); + } + + foreach($ret_ary as $k => $v){ + $ret_ary[$k]->text = str_replace(' ',' ', $v->text); + } + + return $ret_ary; } function numResultsFound() { diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_StreamImage.php b/gchriss/w/extensions/MetavidWiki/includes/MV_StreamImage.php index aca7079..4766fd3 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_StreamImage.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_StreamImage.php @@ -176,44 +176,74 @@ class MV_StreamImage { } /*generate the requested image if possible /necessary */ function getLocalImagePath( $stream_id, $req_time, $req_size = null ) { $img_dir = MV_StreamImage::getLocalImageDir( $stream_id ); - list( $im_width, $im_height, $ext ) = MV_StreamImage::getSizeType( $req_size ); - $base_img = $img_dir . '/' . $req_time . '.jpg'; +// list( $im_width, $im_height, $ext ) = MV_StreamImage::getSizeType( $req_size ); + list( $im_width, $im_height, $ext ) = explode('x', $req_size) ; + $base_img = $img_dir . '/' . $req_time ; // print "base img: $base_img \n"; if ( $req_size == null ) { - if ( is_file( $base_img ) ) { - return $base_img; + + if ( is_file( $base_img . '.jpg') ) { + return $base_img . '.jpg'; } else { + // Based on settings we may do an ffmpeg call here: - // @@FFMPEG call goes here: + + $stream =& mvGetMVStream(array('id'=>$stream_id)); + $stream->db_load_stream(); + $streamFile = new MV_StreamFile($stream); + + + exec('/home/metavidwiki/www/w/thumbnailer -y -ss ' . $req_time . ' -i /home/metavidwiki/www/archives/' . strtolower($streamFile->_parent_stream->getStreamName()) . '.ogv' . ' -vcodec mjpeg -vframes 1 -an -f mjpeg ' . ' ' . $base_img . '.jpg'); + + $base_img = $base_img . '.jpg'; + return $base_img; + // make the call to generate the image for that time: - return MV_StreamImage::genLocalStreamImage( $stream_id, $req_time, $req_size ); + //return MV_StreamImage::genLocalStreamImage( $stream_id, $req_time, $req_size ); } } else { - $img_file = $img_dir . '/' . $req_time . '_' . $im_width . 'x' . $im_height . '.' . $ext; + $img_file = $img_dir . '/' . $req_time . '_' . $im_width . 'x' . $im_height . '.jpg'; // print "img with size: $img_file \n"; if ( is_file( $img_file ) ) { // print "FOUND FILE: $img_file"; return $img_file; } else { - if ( !is_file( $base_img ) ) { + if ( !is_file( $base_img . '.jpg' ) ) { // print "missing base img $base_img \n"; - $img_file = MV_StreamImage::genLocalStreamImage( $stream_id, $req_time, $req_size ); - if ( is_file( $base_img ) ) { + + $stream =& mvGetMVStream(array('id'=>$stream_id)); + $stream->db_load_stream(); + $streamFile = new MV_StreamFile($stream); + + exec('/home/metavidwiki/www/w/thumbnailer -y -ss ' . $req_time . ' -i /home/metavidwiki/www/archives/' . strtolower($streamFile->_parent_stream->getStreamName()) . '.ogv' . ' -vcodec mjpeg -vframes 1 -an -f mjpeg -s ' . $im_width . 'x' . $im_height . ' ' . $base_img . '_' . $im_width . 'x' . $im_height . '.jpg'); + + if ( is_file( $base_img . '_' . $im_width . 'x' . $im_height . '.jpg' ) ) { // got file successful: // continue: } else { return false; } } + + $base_img = $base_img . '_' . $im_width . 'x' . $im_height . '.jpg'; + // would be great to use mediaWIki's bitmap transform but not super easy to integrate... // @@todo eventually we should integrate with oggHanlder... // $thumb = Bitmap::doTransform($image) - if ( !MV_StreamImage::doTransformImage( $base_img, $img_file, $im_width, $im_height, $ext ) ) { + // if ( !MV_StreamImage::doTransformImage( $base_img, $img_file, $im_width, $im_height, $ext ) ) { // print 'failed image transform\n'; - return false; - } + // return false; + // } return $img_file; } } @@ -274,9 +304,14 @@ class MV_StreamImage { case 'medium': case '320x240': $width = 320; $height = 240; break; - case '400x300': - $width = 400; $height = 300; + + case '352x240': + $width = 352; $height = 240; + break; + case '424x240': + $width = 424; $height = 240; break; + case 'large': case '512x384': case '480x360': $width = 480; $height = 360; break; @@ -285,13 +320,13 @@ class MV_StreamImage { $width = 720; $height = 540; break; default: - // defaults to 320x240 if size does not match above: - $width = 320; $height = 240; + // defaults to 424x240 if size does not match above: + $width = 424; $height = 240; break; } } else { // default size is 320x240 - $width = 320; $height = 240; + $width = 424; $height = 240; } } else { $width = 320; $height = 240; @@ -304,7 +339,7 @@ class MV_StreamImage { if ( !$stream_id ) return false; if ( !$req_time ) $req_time = 0; - if ( !$req_size ) $req_size = '320x240'; + if ( !$req_size ) $req_size = '424x240'; list( $im_width, $im_height, $ext ) = MV_StreamImage::getSizeType( $req_size ); if ( $req_size == null ) { @@ -350,7 +385,7 @@ class MV_StreamImage { } } } - if ( is_file( $img_file ) && ( $req_size == '320x240' || $req_size == '' ) ) { + if ( is_file( $img_file ) && ( $req_size == '424x240' || $req_size == '' ) ) { $insAry = array (); $insAry[stream_id] = $stream_id; $insAry[time] = $req_time; diff --git a/rev51560/w/extensions/MetavidWiki/includes/MV_Title.php b/gchriss/w/extensions/MetavidWiki/includes/MV_Title.php index 86ab239..6cb87f8 100755 --- a/rev51560/w/extensions/MetavidWiki/includes/MV_Title.php +++ b/gchriss/w/extensions/MetavidWiki/includes/MV_Title.php @@ -361,25 +361,69 @@ $showmeta = (isset($options['showmeta']))?$options['showmeta']:false; $tag = 'video'; + +// $gsc_haystack = array(564, 565, 566, 568); + // var_dump("$this->mvTitle->mvStream->getFileList()"); + +$this->file_list = $this->mvStream->getFileList(); + +//foreach ( $this->file_list as $file ){ +//echo htmlentities($file->getNameKey()) ; +//} + +// if($this->getStreamId() < 547 || in_array( $this->getStreamID(), $gsc_haystack ) ){ +// $size="352x240"; +// } + +// $gsc_haystack = array(564, 565, 566, 568); +// elseif($this->getStreamID() == 564 || $this->getStreamID() == 565 || $this->getStreamID() == 566){ +// elseif (in_array( $this->getStreamID(), $gsc_haystack )){ +// $size="352x240"; + +// else { +// $size="424x240"; +// } + + +foreach ( $this->file_list as $file ){ +if( htmlentities( $file->getNameKey()) == 'mv_ogg_352x240' ){ + $size="352x240"; + $gsc_getWebStreamURL = 'mv_ogg_352x240'; + } +elseif( htmlentities( $file->getNameKey()) == 'mv_ogg_424x240' ){ + $size="424x240"; + $gsc_getWebStreamURL = 'mv_ogg_424x240'; + } +} + if ( $size == '' ) { global $mvDefaultVideoPlaybackRes; $size = $mvDefaultVideoPlaybackRes; + + + list( $vWidth, $vHeight ) = explode( 'x', $size ); } else { list( $vWidth, $vHeight, $na ) = MV_StreamImage::getSizeType( $size ); } - $stream_web_url = $this->getWebStreamURL( $mvDefaultVideoQualityKey ); - $flash_stream_url = $this->getWebStreamURL( $mvDefaultFlashQualityKey ); - $mp4_stream_url = $this->getWebStreamURL( $mvDefaultMP4QualityKey ); + // if($this->getStreamId() < 543 || $this->getStreamId() == 564 || $this->getStreamId() == 565 || $this->getStreamID() == 566){ +// if ($this->getStreamId() < 547 || in_array($this->getStreamID(), $gsc_haystack)){ + $stream_web_url = $this->getWebStreamURL( $gsc_getWebStreamURL ); +// } else { +// $stream_web_url = $this->getWebStreamURL( $mvDefaultVideoQualityKey ); +// } + +// $flash_stream_url = $this->getWebStreamURL( $mvDefaultFlashQualityKey ); +// $mp4_stream_url = $this->getWebStreamURL( $mvDefaultMP4QualityKey ); // print "looking for q: $mvDefaultFlashQualityKey "; // print "FOUND: $flash_stream_url"; $roe_url = $this->getROEURL(); //if no urls available return missing: if ( !$stream_web_url && !$flash_stream_url && !$mp4_stream_url ) { - return wfMsg( 'mv_error_stream_missing' ); + return wfMsgWikiHtml( 'mv_error_stream_missing' ); } if ( $stream_web_url || $flash_stream_url || $mp4_stream_url) { @@ -395,25 +439,59 @@ 'roe="' . $roe_url . '" '; $o .= ($showmeta)?'show_meta_link="true" ':'show_meta_link="false" ' ; - $o .= ( $autoplay ) ? ' autoplay="true" ':''; + $o .= ( $autoplay ) ? ' autoplay ':''; + +if($size=='424x240'){ + $fb_thumb0 = $this->getStreamImageURL( '130x74', null, $force_server ); + $fb_thumb1 = preg_replace('/[0-9][0-9][&]size/', '00&size', $fb_thumb0); + $fb_thumb2 = preg_replace('/[0-9][0-9][&]size/', '10&size', $fb_thumb0); + $fb_thumb3 = preg_replace('/[0-9][0-9][&]size/', '20&size', $fb_thumb0); + $fb_thumb4 = preg_replace('/[0-9][0-9][&]size/', '30&size', $fb_thumb0); + $fb_thumb5 = preg_replace('/[0-9][0-9][&]size/', '40&size', $fb_thumb0); + $fb_thumb6 = preg_replace('/[0-9][0-9][&]size/', '50&size', $fb_thumb0); + + } +elseif($size=='130x87'){ + $fb_thumb0 = $this->getStreamImageURL( '130x87', null, $force_server ); + $fb_thumb1 = preg_replace('/[0-9][0-9][&]size/', '00&size', $fb_thumb0); + $fb_thumb2 = preg_replace('/[0-9][0-9][&]size/', '10&size', $fb_thumb0); + $fb_thumb3 = preg_replace('/[0-9][0-9][&]size/', '20&size', $fb_thumb0); + $fb_thumb4 = preg_replace('/[0-9][0-9][&]size/', '30&size', $fb_thumb0); + $fb_thumb5 = preg_replace('/[0-9][0-9][&]size/', '40&size', $fb_thumb0); + $fb_thumb6 = preg_replace('/[0-9][0-9][&]size/', '50&size', $fb_thumb0); + +} + + + $o .= 'style="width:' . htmlspecialchars( $vWidth ) . 'px;height:' . htmlspecialchars( $vHeight ) . 'px;" ' . + 'controls embed_link="true" /> +<img src="' . $fb_thumb0 . '" ' . 'style="display:none" alt="Hidden thumbnail for FB Status Updates, at original timepoint."' .'/> +<img src="' . $fb_thumb1 . '" ' . 'style="display:none" alt="...at :00"' .'/> +<img src="' . $fb_thumb2 . '" ' . 'style="display:none" alt="...at :10"' .'/> +<img src="' . $fb_thumb3 . '" ' . 'style="display:none" alt="...at :20"' .'/> +<img src="' . $fb_thumb4 . '" ' . 'style="display:none" alt="...at :30"' .'/> +<img src="' . $fb_thumb5 . '" ' . 'style="display:none" alt="...at :40"' .'/> +<img src="' . $fb_thumb6 . '" ' . 'style="display:none" alt="...at :50"' .'/>'; + +//var_dump($this->getStartTime()); +//echo preg_replace('/[0-9][0-9]$/', '00', $this->getStartTime()); +//var_dump($this->getStreamImageURL( $size, null, $force_server )); - $o .= 'style="width:' . htmlspecialchars( $vWidth ) . 'px;height:' . htmlspecialchars( $vHeight ) . 'px" ' . - 'controls="true" embed_link="true" >'; if ( $stream_web_url ) $o .= '<source timeFormat="anx" type="' . htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultVideoQualityKey ) ) . '" src="' . $stream_web_url . '"></source>'; - if ( $flash_stream_url ) - $o .= '<source timeFormat="anx" type="' . - htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultFlashQualityKey ) ) . - '" src="' . $flash_stream_url . '"></source>'; - - if ( $mp4_stream_url ) - $o.='<source timeFormat="mp4" type="' . - htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultMP4QualityKey ) ) . - '" src="' . $mp4_stream_url . '"></source>'; + // if ( $flash_stream_url ) + // $o .= '<source timeFormat="anx" type="' . + // htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultFlashQualityKey ) ) . + // '" src="' . $flash_stream_url . '"></source>'; +// +// if ( $mp4_stream_url ) +// $o.='<source timeFormat="mp4" type="' . +// htmlspecialchars( MV_StreamFile::getTypeForQK( $mvDefaultMP4QualityKey ) ) . +// '" src="' . $mp4_stream_url . '"></source>'; $o .= '</' . htmlspecialchars( $tag ) . '>'; return $o; @@ -433,6 +511,7 @@ ); } return $this->view_count; + } function getTitleDesc() { if ( $this->type_marker ) { @@ -443,6 +522,7 @@ } else { $title_str = $this->getStreamNameText() . ' ' . $this->getTimeDesc(); } +// var_dump($title_str); return $title_str; } /* diff --git a/rev51560/w/skins/common/diff.css b/gchriss/w/skins/common/diff.css index 6afa373..80ba109 100755 --- a/rev51560/w/skins/common/diff.css +++ b/gchriss/w/skins/common/diff.css @@ -2,7 +2,7 @@ ** Diff rendering */ table.diff, td.diff-otitle, td.diff-ntitle { - background-color: white; + background-color: black; } td.diff-otitle, td.diff-ntitle { @@ -18,16 +18,16 @@ td.diff-lineno { font-weight: bold; } td.diff-addedline { - background: #cfc; - font-size: smaller; + background: black; +// font-size: smaller; } td.diff-deletedline { - background: #ffa; - font-size: smaller; + background: black; +// font-size: smaller; } td.diff-context { - background: #eee; - font-size: smaller; + background: black; +// font-size: smaller; } .diffchange { color: red; diff --git a/rev51560/w/extensions/MetavidWiki/skins/mv_allpages.js b/gchriss/w/extensions/MetavidWiki/skins/mv_allpages.js index ecb0b90..249f816 100755 --- a/rev51560/w/extensions/MetavidWiki/skins/mv_allpages.js +++ b/gchriss/w/extensions/MetavidWiki/skins/mv_allpages.js @@ -3,27 +3,27 @@ _global = this; mwAddOnloadHook(mv_setup_allpage); var mv_setup_allpage_flag=false; if( typeof wgServer!='undefined' && typeof wgScript != 'undefined'){ - var base_roe_url = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name='; + var base_roe_url = wgServer + wgScript + '?title=Special:MvExportStream&feed_format=roe&stream_name='; }else{ - var base_roe_url = ''; + var base_roe_url = ''; } //force wgScript path for blog support if(typeof wgScript=='undefined') - var wgScript = "/w/index.php"; - + var wgScript = "/w/index.php"; + if(typeof wgScriptPath=='undefined') - var wgScriptPath = '/w'; - + var wgScriptPath = '/w'; + var gMvd={}; function mv_setup_allpage(){ - js_log("mv embed done loading now setup 'all page'"); + //js_log("mv embed done loading now setup 'all page'"); //make sure we have jQuery and any base required libs: + mvJsLoader.jQueryCheck(function(){ - js_log('allpage_ did jquery check'); - mvJsLoader.doLoad( { - '$j.fn.autocomplete':'jquery/plugins/jquery.autocomplete.js', - '$j.fn.hoverIntent':'jquery/plugins/jquery.hoverIntent.js' - }, function(){ + // js_log('allpage_ did jquery check'); + mvJsLoader.doLoad( [ + '$j.fn.autocomplete' + ], function(){ //js_log('allpage_ auto and hover check'+mv_setup_allpage_flag); if( ! mv_setup_allpage_flag ){ mv_setup_search_ac(); @@ -36,256 +36,255 @@ function mv_setup_allpage(){ }); } function mv_do_sequence_edit_swap(mode){ - if(mode=='text'){ - $j('#seq_edit_container,#swich_seq_text').hide(); - $j('#mv_text_edit_container,#switch_seq_wysiwyg').show(); - }else if(mode=='seq' || mode=='seq_update'){ - $j('#mv_text_edit_container,#switch_seq_wysiwyg').hide(); - $j('#seq_edit_container,#swich_seq_text').show(); - if( mode == 'seq_update' ){ - js_log('do server side text parse'); - //$j('#seq_edit_container').html( gMsg('loading') ); - } - //check if the seq is already ready: - if( typeof _global['mvSeq'] == 'undefined' ){ - mv_do_sequence({ - "sequence_container_id": 'seq_edit_container', - "mv_pl_src":mvSeqExportUrl - }); - } - } + if(mode=='text'){ + $j('#seq_edit_container,#swich_seq_text').hide(); + $j('#mv_text_edit_container,#switch_seq_wysiwyg').show(); + }else if(mode=='seq' || mode=='seq_update'){ + $j('#mv_text_edit_container,#switch_seq_wysiwyg').hide(); + $j('#seq_edit_container,#swich_seq_text').show(); + if( mode == 'seq_update' ){ + js_log('do server side text parse'); + //$j('#seq_edit_container').html( gMsg('loading') ); + } + //check if the seq is already ready: + if( typeof _global['mvSeq'] == 'undefined' ){ + $j('#seq_edit_container').sequencer({ + 'mv_pl_src':mvSeqExportUrl + }); + } + } } function mv_page_specific_rewrites(){ - var mvAskTitle = 'Special:MvExportAsk'; - var rssImg = '<img border="0" src="'+wgScriptPath+'/extensions/MetavidWiki/skins/images/feed-icon-28x28.png"/>'; - var msg_video_rss = 'video rss'; - if($j('#NOTITLEHACK').length!=0)$j('.firstHeading').hide(); - //add in rss-media feed link if on Special:Ask page - if(typeof wgPageName!='undefined'){ - if(wgPageName=='Special:Ask'){ - js_log("url : " + document.location); - var sURL = parseUri(document.location); - var podLink=wgArticlePath.replace('$1', mvAskTitle); - if(sURL.queryKey['title']){ - //pass along all url params (update the title) - podLink+='?'; - for(i in sURL.queryKey){ - if(i !='title')podLink+=i+'='+sURL.queryKey[i]+'&'; - } - }else{ - // /title/askparam format - var pInx =sURL.relative.indexOf(wgPageName); - if(pInx!==false){ - podLink+= sURL.relative.substring(pInx+wgPageName.length); - } - } - //@@todo add to javascript msg system - $j('#bodyContent').before('<span style="float: right;"><a title="'+ - msg_video_rss+'" href="'+podLink+'">'+ rssImg + '</a></span>'); - } - } - //move the search filter if #msms_form_search_row - if($j('#msms_form_search_row').get(0)!=null){ - $j('#msms_form_search_row').appendTo("#searchHeader"); - } - //if we have an inline query add a search link - $j('.smwtable').each(function(){ - if($j('#'+this.id+' .smwfooter a').length!=0){ - var pLink = $j('#'+this.id+' .smwfooter a').attr('href').replace('Special:Ask',mvAskTitle ); - var colspan = $j('.smwfooter .sortbottom').attr('colspan'); - var pHTML = '<a title="'+msg_video_rss+'" href="'+pLink+'">'+rssImg+'</a>'; - js_log("plink: "+pLink + ' colspan:'+ colspan + ' ph:'+pHTML); - $j('#'+this.id+' tbody').prepend('<tr><td colspan="'+colspan+'">'+pHTML+'</td></tr>'); - } - }); + var mvAskTitle = 'Special:MvExportAsk'; + var rssImg = '<img border="0" src="'+wgScriptPath+'/extensions/MetavidWiki/skins/images/feed-icon-28x28.png"/>'; + var msg_video_rss = 'video rss'; + if($j('#NOTITLEHACK').length!=0)$j('.firstHeading').hide(); + //add in rss-media feed link if on Special:Ask page + if(typeof wgPageName!='undefined'){ + if(wgPageName=='Special:Ask'){ + js_log("url : " + document.location); + var sURL = parseUri(document.location); + var podLink=wgArticlePath.replace('$1', mvAskTitle); + if(sURL.queryKey['title']){ + //pass along all url params (update the title) + podLink+='?'; + for(i in sURL.queryKey){ + if(i !='title')podLink+=i+'='+sURL.queryKey[i]+'&'; + } + }else{ + // /title/askparam format + var pInx =sURL.relative.indexOf(wgPageName); + if(pInx!==false){ + podLink+= sURL.relative.substring(pInx+wgPageName.length); + } + } + //@@todo add to javascript msg system + $j('#bodyContent').before('<span style="float: right;"><a title="'+ + msg_video_rss+'" href="'+podLink+'">'+ rssImg + '</a></span>'); + } + } + //move the search filter if #msms_form_search_row + if($j('#msms_form_search_row').get(0)!=null){ + $j('#msms_form_search_row').appendTo("#searchHeader"); + } + //if we have an inline query add a search link + $j('.smwtable').each(function(){ + if($j('#'+this.id+' .smwfooter a').length!=0){ + var pLink = $j('#'+this.id+' .smwfooter a').attr('href').replace('Special:Ask',mvAskTitle ); + var colspan = $j('.smwfooter .sortbottom').attr('colspan'); + var pHTML = '<a title="'+msg_video_rss+'" href="'+pLink+'">'+rssImg+'</a>'; + js_log("plink: "+pLink + ' colspan:'+ colspan + ' ph:'+pHTML); + $j('#'+this.id+' tbody').prepend('<tr><td colspan="'+colspan+'">'+pHTML+'</td></tr>'); + } + }); } function mv_do_mvd_link_rewrite(){ - js_log('mv_do_mvd_link_rewrite'); - var patt_mvd = new RegExp("MVD:([^:]*):([^\/]*)\/([0-9]+:[0-9]+:[^\/]+)\/([0-9]+:[0-9]+:[^\&]+)(&?.*)"); - var i =0; - $j('a').each(function(){ - if(this.href.indexOf('Special:')==-1 && this.href.indexOf('action=')==-1){ - titleTest = this.title.match(patt_mvd); - if(titleTest){ - res = this.href.match(patt_mvd); - if(res){ - if(res[5]!='')return ; - //skip if res[4] not at end: - //js_log(res); - i++; - if(!gMvd[i])gMvd[i]={}; - gMvd[i]['url']=res[0]; - gMvd[i]['sn']=res[2]; //stream name - gMvd[i]['st']=res[3]; //start time - gMvd[i]['et']=res[4]; //end time + js_log('mv_do_mvd_link_rewrite'); + var patt_mvd = new RegExp("MVD:([^:]*):([^\/]*)\/([0-9]+:[0-9]+:[^\/]+)\/([0-9]+:[0-9]+:[^\&]+)(&?.*)"); + var i =0; + $j('a').each(function(){ + if(this.href.indexOf('Special:')==-1 && this.href.indexOf('action=')==-1){ + titleTest = this.title.match(patt_mvd); + if(titleTest){ + res = this.href.match(patt_mvd); + if(res){ + if(res[5]!='')return ; + //skip if res[4] not at end: + //js_log(res); + i++; + if(!gMvd[i])gMvd[i]={}; + gMvd[i]['url']=res[0]; + gMvd[i]['sn']=res[2]; //stream name + gMvd[i]['st']=res[3]; //start time + gMvd[i]['et']=res[4]; //end time - //js_log(this.href); - //js_log(res); - //replace with: - //check if we are instance of smwb-title (if so reduce font size) - var fsize = ( $j(this).parents().is(".smwb-title") )? '50%':'100%'; - //TEMP: - $j(this).replaceWith('<div id="mvd_link_'+i+'" ' + - 'style="display:inline-block;font-size:'+fsize+';vertical-align: middle;margin:.5em;border:solid thin black;width:300px;height:60px;">' + - get_mvdrw_img(i) + - '</div>'); - $j('#mv_mvd_ex_'+i).click(function(){ - inx = this.id.substr(10); - mv_ext(inx); - }); - $j('#mv_pglink_'+i).click(function(){ - inx = this.id.substr(10); - js_log('inx: '+ inx); - window.location = wgArticlePath.replace('$1',gMvd[inx]['url']); - }) - } - } - } - }); - js_log('got to I: '+i); - $j('#mvd_link_'+i).after('<div style="clear:both"></div>') + //js_log(this.href); + //js_log(res); + //replace with: + //check if we are instance of smwb-title (if so reduce font size) + var fsize = ( $j(this).parents().is(".smwb-title") )? '50%':'100%'; + //TEMP: + $j(this).replaceWith('<div id="mvd_link_'+i+'" ' + + 'style="display:inline-block;font-size:'+fsize+';vertical-align: middle;margin:.5em;border:solid thin black;width:300px;height:60px;">' + + get_mvdrw_img(i) + + '</div>'); + $j('#mv_mvd_ex_'+i).click(function(){ + inx = this.id.substr(10); + mv_ext(inx); + }); + $j('#mv_pglink_'+i).click(function(){ + inx = this.id.substr(10); + js_log('inx: '+ inx); + window.location = wgArticlePath.replace('$1',gMvd[inx]['url']); + }) + } + } + } + }); + js_log('got to I: '+i); + $j('#mvd_link_'+i).after('<div style="clear:both"></div>') } function get_mvdrw_img(i, size){ - var size = (!size)?{'w':80,'h':60}:size; - var stream_link = wgScript+'?title=Stream:'+gMvd[i]['sn']+'/'+gMvd[i]['st']+'/'+gMvd[i]['et']; - var stream_desc = gMvd[i]['sn'].substr(0,1).toUpperCase() + gMvd[i]['sn'].substr(1).replace('_', ' ')+' '+ gMvd[i]['st'] + ' to '+ gMvd[i]['et']; - //@@todo localize javascript msg - var wiki_link = '<span title="Edited Wiki Page" id="mv_pglink_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/run_mediawiki.png\');"/>'; - var expand_link = '<span title="Play Inline" id="mv_mvd_ex_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\');"/>'; - var img_url = wgScript+'?action=ajax&rs=mv_frame_server&stream_name='+gMvd[i]['sn']+'&t='+gMvd[i]['st']+'&size=icon'; - return '<img id="mvd_link_im_'+i+'" onclick="mv_ext('+i+')" ' + - 'style="cursor:pointer;float:left;height:'+size['h']+'px;width:'+size['w']+'px;" src="'+img_url+'">'+expand_link+wiki_link+' '+ - '<a title="'+stream_desc+'" href="'+stream_link+'">'+stream_desc+'</a><br>'; + var size = (!size)?{'w':80,'h':60}:size; + var stream_link = wgScript+'?title=Stream:'+gMvd[i]['sn']+'/'+gMvd[i]['st']+'/'+gMvd[i]['et']; + var stream_desc = gMvd[i]['sn'].substr(0,1).toUpperCase() + gMvd[i]['sn'].substr(1).replace('_', ' ')+' '+ gMvd[i]['st'] + ' to '+ gMvd[i]['et']; + //@@todo localize javascript msg + var wiki_link = '<span title="Edited Wiki Page" id="mv_pglink_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/run_mediawiki.png\');"/>'; + var expand_link = '<span title="Play Inline" id="mv_mvd_ex_'+i+'" style="cursor:pointer;width:16px;height:16px;float:left;background:url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\');"/>'; + var img_url = wgScript+'?action=ajax&rs=mv_frame_server&stream_name='+gMvd[i]['sn']+'&t='+gMvd[i]['st']+'&size=icon'; + return '<img id="mvd_link_im_'+i+'" onclick="mv_ext('+i+')" ' + + 'style="cursor:pointer;float:left;height:'+size['h']+'px;width:'+size['w']+'px;" src="'+img_url+'">'+expand_link+wiki_link+' '+ + '<a title="'+stream_desc+'" href="'+stream_link+'">'+stream_desc+'</a><br>'; } function mv_ext(inx){ - js_log('f:inx:'+inx); - //grow the window to 300+240 540 - js_log('i: is '+ inx); - $j('#mvd_link_'+inx).animate({width:'400px','height':'370px'},1000); - $j('#mvd_link_im_'+inx).animate({width:'400px','height':'300px'},1000,function(){ - //do mv_embed swap - $j('#mvd_link_im_'+inx).replaceWith('<div style="height:300px;width:400px;">' + - '<video roe="'+base_roe_url + gMvd[inx]['sn']+'&t='+gMvd[inx]['st']+'/'+gMvd[inx]['et']+'" ' + - 'autoplay="true" id="mvd_vid_'+inx +'"></video>' + - '</div>'); - init_mv_embed(true); - }); - $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/opened.png\')'); - $j('#mv_mvd_ex_'+inx).unbind(); - $j('#mv_mvd_ex_'+inx).click(function(){ - inx = this.id.substr(10); - mv_cxt(inx); - }); + js_log('f:inx:'+inx); + //grow the window to 300+240 540 + js_log('i: is '+ inx); + $j('#mvd_link_'+inx).animate({width:'400px','height':'370px'},1000); + $j('#mvd_link_im_'+inx).animate({width:'400px','height':'300px'},1000,function(){ + //do mv_embed swap + $j('#mvd_link_im_'+inx).replaceWith('<div style="height:300px;width:400px;">' + + '<video roe="'+base_roe_url + gMvd[inx]['sn']+'&t='+gMvd[inx]['st']+'/'+gMvd[inx]['et']+'" ' + + 'autoplay="true" id="mvd_vid_'+inx +'"></video>' + + '</div>'); + init_mv_embed(true); + }); + $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/opened.png\')'); + $j('#mv_mvd_ex_'+inx).unbind(); + $j('#mv_mvd_ex_'+inx).click(function(){ + inx = this.id.substr(10); + mv_cxt(inx); + }); } function mv_cxt(inx){ - //stop the video: - $j('#mvd_vid_'+inx).get(0).stop(); - //replace the html: - $j('#mvd_link_'+inx).html(get_mvdrw_img(inx, {'w':320,'h':240})); - $j('#mvd_link_'+inx).animate({width:'300px','height':'60px'},1000); - $j('#mvd_link_im_'+inx).animate({width:'80px','height':'60px'},1000); - $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\')'); - $j('#mv_mvd_ex_'+inx).unbind(); - $j('#mv_mvd_ex_'+inx).click(function(){ - inx = this.id.substr(10); - mv_ext(inx); - }); + //stop the video: + $j('#mvd_vid_'+inx).get(0).stop(); + //replace the html: + $j('#mvd_link_'+inx).html(get_mvdrw_img(inx, {'w':320,'h':240})); + $j('#mvd_link_'+inx).animate({width:'300px','height':'60px'},1000); + $j('#mvd_link_im_'+inx).animate({width:'80px','height':'60px'},1000); + $j('#mv_mvd_ex_'+inx).css('background', 'url(\''+wgScriptPath+'/extensions/MetavidWiki/skins/images/closed.png\')'); + $j('#mv_mvd_ex_'+inx).unbind(); + $j('#mv_mvd_ex_'+inx).click(function(){ + inx = this.id.substr(10); + mv_ext(inx); + }); } /* toggles advanced search */ function mv_toggle_advs(){ - js_log('called mv_toggle_advs:' + $j('#advs').val()); - if($j('#advs').val()=='0'){ - $j('#advs').val('1'); - //sync values from basic -> avanced - $j("input[@name$='f[0][v]']").val( $j('#searchInput').val() ); - var _fadecalled = false; - $j('.advs_basic').fadeOut('fast',function(){ - if(!_fadecalled){ - if($j('#tmp_loading_txt').length==0){ - $j('.advanced_search_tag').before('<span id="tmp_loading_txt">'+gM('loading_txt')+'</span>'); - } - if(typeof(mv_setup_search)=='undefined'){ - $j.getScript(mv_embed_path +'../mv_search.js', function(){ - mv_do_disp_adv_search(); - }); - }else{ - mv_do_disp_adv_search(); - } - } - _fadecalled=true; - }); - }else{ - $j('#advs').val('0'); - //sync values from advanced -> basic - $j('#searchInput').val( $j("input[@name$='f[0][v]']").val() ); - //do style display swap - $j('.advs_adv').fadeOut('fast',function(){ - $j('.advs_basic').fadeIn('fast'); - $j('#frontPageTop').animate({'height':'233px'},'fast'); - }); - } + js_log('called mv_toggle_advs:' + $j('#advs').val()); + if($j('#advs').val()=='0'){ + $j('#advs').val('1'); + //sync values from basic -> avanced + $j("input[@name$='f[0][v]']").val( $j('#searchInput').val() ); + var _fadecalled = false; + $j('.advs_basic').fadeOut('fast',function(){ + if(!_fadecalled){ + if($j('#tmp_loading_txt').length==0){ + $j('.advanced_search_tag').before('<span id="tmp_loading_txt">'+gM('loading_txt')+'</span>'); + } + if(typeof(mv_setup_search)=='undefined'){ + $j.getScript(mv_embed_path +'../mv_search.js', function(){ + mv_do_disp_adv_search(); + }); + }else{ + mv_do_disp_adv_search(); + } + } + _fadecalled=true; + }); + }else{ + $j('#advs').val('0'); + //sync values from advanced -> basic + $j('#searchInput').val( $j("input[@name$='f[0][v]']").val() ); + //do style display swap + $j('.advs_adv').fadeOut('fast',function(){ + $j('.advs_basic').fadeIn('fast'); + $j('#frontPageTop').animate({'height':'233px'},'fast'); + }); + } } function mv_do_disp_adv_search(){ - $j('#tmp_loading_txt').remove(); - js_log('should fade in: .advs_adv'); - $j('.advs_adv').fadeIn('fast', function(){ - $j(this).css('display', 'inline'); - }); - //give some extra room for advanced search: - $j('#frontPageTop').animate({'height':'350px'},'fast'); + $j('#tmp_loading_txt').remove(); + js_log('should fade in: .advs_adv'); + $j('.advs_adv').fadeIn('fast', function(){ + $j(this).css('display', 'inline'); + }); + //give some extra room for advanced search: + $j('#frontPageTop').animate({'height':'350px'},'fast'); } function mv_setup_search_ac(){ - var uri = wgScript; - //add the person choices div to searchInput - //turn off browser baseed autocomplete: - $j('#searchInput').attr('autocomplete',"off"); - - // add the sugestions div (abolute positioned so it can be ontop of everything) - $j('body').prepend('<div id="suggestions" style="position:absolute;display:none;z-index:50;">'+ - '<div id="suggestionsTop"></div>'+ - '<div id="suggestionsInner" class="suggestionsBox">'+ - '</div>'+ - '<div id="suggestionsBot"></div>'+ - '</div>'); - //position the sugestions below the search field: - if( $j('#searchInput').get(0)!=null){ - sf_pos = $j('#searchInput').offset(); - sf_pos['top']=sf_pos['top']+40; - sf_pos['left']=sf_pos['left']-220; - //js_log("moved sugest to: " + sf_pos['top'] + ' '+ sf_pos['left']); - $j('#suggestions').css(sf_pos); - } - //add hook: - $j('#searchInput').autocomplete( - uri, - { - autoFill:false, - onItemSelect:function(v){ - //alert('selected:' + v.innerHTML + ' page:'+$j('#searchInput').val()); - //jump to page: - if($j('#searchInput').val()=='do_search'){ - qs = v.innerHTML.toLowerCase().indexOf('<b>')+3; - qe = v.innerHTML.toLowerCase().indexOf('</b>'); - //update the search input (incase redirect fails) - $j('#searchInput').val(v.innerHTML.substring(qs,qe)); - window.location = uri+'/'+'Special:MediaSearch?mv_search='+v.innerHTML.substring(qs,qe); - }else{ - window.location = uri+'/'+$j('#searchInput').val(); - } - }, - formatItem:function(row){ - if(row[0]=='do_search'){ - return '<span class="ac_txt">'+row[1].replace('$1',$j('#searchInput').val())+'</span>'; - }else if(row[2]=='no_image'){ - return '<span class="ac_txt">'+row[1]+'</span>'; - }else{ - return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; - } - }, - matchSubset:0, - extraParams:{action:'ajax',rs:'mv_auto_complete_all'}, - paramName:'rsargs[]', - resultElem:'#suggestionsInner', - resultContainer:'#suggestions' - }); -} \ No newline at end of file + var uri = wgScript; + //add the person choices div to searchInput + //turn off browser baseed autocomplete: + $j('#searchInput').attr('autocomplete',"off"); + + // add the sugestions div (abolute positioned so it can be ontop of everything) + $j('body').prepend('<div id="suggestions" style="position:absolute;display:none;z-index:50;">'+ + '<div id="suggestionsTop"></div>'+ + '<div id="suggestionsInner" class="suggestionsBox">'+ + '</div>'+ + '<div id="suggestionsBot"></div>'+ + '</div>'); + //position the sugestions below the search field: + if( $j('#searchInput').get(0)!=null){ + sf_pos = $j('#searchInput').offset(); + sf_pos['top']=sf_pos['top']+40; + sf_pos['left']=sf_pos['left']-220; + //js_log("moved sugest to: " + sf_pos['top'] + ' '+ sf_pos['left']); + $j('#suggestions').css(sf_pos); + } + //add hook: + $j('#searchInput').autocomplete( + uri, + { + autoFill:false, + onItemSelect:function(v){ + //alert('selected:' + v.innerHTML + ' page:'+$j('#searchInput').val()); + //jump to page: + if($j('#searchInput').val()=='do_search'){ + qs = v.innerHTML.toLowerCase().indexOf('<b>')+3; + qe = v.innerHTML.toLowerCase().indexOf('</b>'); + //update the search input (incase redirect fails) + $j('#searchInput').val(v.innerHTML.substring(qs,qe)); + window.location = uri+'/'+'Special:MediaSearch?mv_search='+v.innerHTML.substring(qs,qe); + }else{ + window.location = uri+'/'+$j('#searchInput').val(); + } + }, + formatItem:function(row){ + if(row[0]=='do_search'){ + return '<span class="ac_txt">'+row[1].replace('$1',$j('#searchInput').val())+'</span>'; + }else if(row[2]=='no_image'){ + return '<span class="ac_txt">'+row[1]+'</span>'; + }else{ + return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; + } + }, + matchSubset:0, + extraParams:{action:'ajax',rs:'mv_auto_complete_all'}, + paramName:'rsargs[]', + resultElem:'#suggestionsInner', + resultContainer:'#suggestions' + }); +} diff --git a/rev51560/w/extensions/MetavidWiki/skins/mv_stream.js b/gchriss/w/extensions/MetavidWiki/skins/mv_stream.js index 72bc76c..8280835 100755 --- a/rev51560/w/extensions/MetavidWiki/skins/mv_stream.js +++ b/gchriss/w/extensions/MetavidWiki/skins/mv_stream.js @@ -14,8 +14,8 @@ * http://metavid.org/wiki/index.php/Mv_embed * * assumes a few utility functions are available from mv_embed: - * loadExternalJs() - * addLoadEvent() + * loadExternalJs() + * addLoadEvent() */ var org_vid_time_req =null; //store the original time req: var org_vid_title = null; //stores the original title @@ -59,14 +59,13 @@ function mv_load_interface_libs(){ //load some additional plugins/components: //:hoverIntent //http://cherne.net/brian/resources/jquery.hoverIntent.html - mvJsLoader.doLoad({ - '$j.fn.autocomplete': 'jquery/plugins/jquery.autocomplete.js', - '$j.fn.hoverIntent' : 'jquery/plugins/jquery.hoverIntent.js', - '$j.ui' : 'jquery/jquery.ui-1.7.1/ui/ui.core.js', - '$j.ui.resizable' : 'jquery/jquery.ui-1.7.1/ui/ui.resizable.js', - 'mvClipEdit' : 'libClipEdit/mvClipEdit.js', - '$j.ui.draggable' : 'jquery/jquery.ui-1.7.1/ui/ui.draggable.js' - },function(){ + mvJsLoader.doLoad([ + '$j.fn.autocomplete', + '$j.ui', + '$j.ui.resizable', + 'mvClipEdit', + '$j.ui.draggable' + ],function(){ //make sure mv_embed has done video re-write: mv_stream_interface.init(); }); @@ -79,119 +78,117 @@ function mv_load_interface_libs(){ * to take up the full page space. */ var mv_stream_interface = { - cur_mvd_id:'base', - interfaceLoaded:false, - monitorTimerId:0, - init:function(){ - //don't call multiple times: - if(this.interfaceLoaded) - return; - //set interfaceLoaded flag: - this.interfaceLoaded=true; - - js_log('f:mv_stream_interface.init call'); - //add_custom_effects(); - //set up the init values for mouse over restore: - org_vid_title = $j('#mv_stream_time').html(); - if( $j('#embed_vid').length==0 || !$j('#embed_vid').get(0).ready_to_play ){ - //no embed video present stop init - js_log('no clip ready to play'); - return false; - } - org_vid_time_req = $j('#embed_vid').get(0).getTimeReq(); - $j('#embed_vid').get(0).org_thum_src = $j('#embed_vid').get(0).thumbnail; + cur_mvd_id:'base', + interfaceLoaded:false, + monitorTimerId:0, + init:function(){ + //don't call multiple times: + if(this.interfaceLoaded) + return; + //set interfaceLoaded flag: + this.interfaceLoaded=true; + + js_log('f:mv_stream_interface.init call'); + //add_custom_effects(); + //set up the init values for mouse over restore: + org_vid_title = $j('#mv_stream_time').html(); + if( $j('#embed_vid').length==0 || !$j('#embed_vid').get(0).ready_to_play ){ + //no embed video present stop init + js_log('no clip ready to play'); + return false; + } + org_vid_time_req = $j('#embed_vid').get(0).getTimeReq(); + $j('#embed_vid').get(0).org_thum_src = $j('#embed_vid').get(0).thumbnail; - //@@TODO override stop function in player: + //@@TODO override stop function in player: - //current range or search parameter - stream_current_context =$j('#mv_stream_time').html(); - js_log('set org_vid_time_req: ' + org_vid_time_req ); - ebvid = $j('#embed_vid').get(0); - //setup text scroll monitor: - mv_doTextScrollMonitor(); - - //add all the hover hooks: - this.addHoverHooks(); + //current range or search parameter + stream_current_context =$j('#mv_stream_time').html(); + js_log('set org_vid_time_req: ' + org_vid_time_req ); + ebvid = $j('#embed_vid').get(0); + //setup text scroll monitor: + mv_doTextScrollMonitor(); + + //add all the hover hooks: + this.addHoverHooks(); - //add odd even classes (for non-annoative layers - this.oddEvenPaint(); + //add odd even classes (for non-annoative layers + this.oddEvenPaint(); - //add edit/navigate hook - var st_input_mode=false; - $j('#mv_stream_time,#mv_edit_time').click(function(){ - if(!st_input_mode){ - var st = $j('#mv_stream_time .mv_start_time').html(); - var et = $j('#mv_stream_time .mv_end_time').html(); - $j('#mv_stream_time').hide(); - $j('#mv_stream_time').after('<form style="display:inline" action="javascript:alert(\'wtf\');" id="td_st_mv_stream_time">' + - '<input class="videoHeader" id="mv_td_start_time" size="7" value="'+st+'">'+ - '<input class="videoHeader" id="mv_td_end_time" size="7" value="'+et+'"> '+ - '<a href="#" id="mv_td_st_go">go</a> :: '+ - '<a href="#" id="mv_td_st_cancel">cancel</a></form>'); - } - if(!st_input_mode)st_input_mode=true; - //bind actions for go/cancel - function getNavUrl(){ - return wgArticlePath.replace('$1',wgPageName+'/'+$j('#mv_td_start_time').val()+'/'+$j('#mv_td_end_time').val()); - } - $j('#mv_td_st_go').click(function(){ - window.location=getNavUrl(); - return false; - }); - $j('#td_st_mv_stream_time input').keypress(function (e) { - if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { - window.location=getNavUrl(); - } - }); - $j('#mv_td_st_cancel').click(function(){ - $j('#mv_stream_time').show(); - $j('#td_st_mv_stream_time').remove(); - st_input_mode=false; - return false; - }); - }); + //add edit/navigate hook + var st_input_mode=false; + $j('#mv_stream_time,#mv_edit_time').click(function(){ + if(!st_input_mode){ + var st = $j('#mv_stream_time .mv_start_time').html(); + var et = $j('#mv_stream_time .mv_end_time').html(); + $j('#mv_stream_time').hide(); + $j('#mv_stream_time').after('<form style="display:inline" action="javascript:alert(\'wtf\');" id="td_st_mv_stream_time">' + + '<input class="videoHeader" id="mv_td_start_time" size="7" value="'+st+'">'+ + '<input class="videoHeader" id="mv_td_end_time" size="7" value="'+et+'"> '+ + '<a href="#" id="mv_td_st_go">go</a> :: '+ + '<a href="#" id="mv_td_st_cancel">cancel</a></form>'); + } + if(!st_input_mode)st_input_mode=true; + //bind actions for go/cancel + function getNavUrl(){ + return wgArticlePath.replace('$1',wgPageName+'/'+$j('#mv_td_start_time').val()+'/'+$j('#mv_td_end_time').val()); + } + $j('#mv_td_st_go').click(function(){ + window.location=getNavUrl(); + return false; + }); + $j('#td_st_mv_stream_time input').keypress(function (e) { + if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) { + window.location=getNavUrl(); + } + }); + $j('#mv_td_st_cancel').click(function(){ + $j('#mv_stream_time').show(); + $j('#td_st_mv_stream_time').remove(); + st_input_mode=false; + return false; + }); + }); - //do any tool specific hooks: - this.tool_key = parseUri(document.URL).queryKey.tool_disp; - if(this.tool_key){ - mv_proc_tool_result(this.tool_key, {'status':'ok','innerHTML':$j('#mv_tool_cont').html()} ); - } + //do any tool specific hooks: + this.tool_key = parseUri(document.URL).queryKey.tool_disp; + if(this.tool_key){ + mv_proc_tool_result(this.tool_key, {'status':'ok','innerHTML':$j('#mv_tool_cont').html()} ); + } - //unlock the interface updates once everything is setup: - mv_lock_vid_updates=false; - - //check for #autoplay ancor - var hash = window.location.hash.toString(); - js_log(" hash is: " + hash); - if( hash == '#autoplay'){ - //window.location.hash = ''; - setTimeout('mv_do_play()', 500); - } - - js_log('done with mv_init_inerface'); - //$j('#embed_vid').get(0).stop(); - }, - oddEvenPaint:function(){ - //remove existing class: - $j('.mv_fd_mvd:not(.anno_en)').removeClass("odd").removeClass("even"); - $j('.mv_fd_mvd:odd').filter(':not(.anno_en)').addClass("odd"); - $j('.mv_fd_mvd:even').filter(':not(.anno_en)').addClass("even"); - //remove odd/even class for annoative layer: - $j('.anno_en:odd').addClass("anno_en_odd") - $j('.anno_en:even').addClass("anno_en_even"); - //add annotative odd even collor: - }, - addHoverHooks:function(selector){ + //unlock the interface updates once everything is setup: + mv_lock_vid_updates=false; + + //check for #autoplay ancor + var hash = window.location.hash.toString(); + js_log(" hash is: " + hash); + if( hash == '#autoplay'){ + //window.location.hash = ''; + setTimeout('mv_do_play()', 500); + } + + js_log('done with mv_init_inerface'); + //$j('#embed_vid').get(0).stop(); + }, + oddEvenPaint:function(){ + //remove existing class: + $j('.mv_fd_mvd:not(.anno_en)').removeClass("odd").removeClass("even"); + $j('.mv_fd_mvd:odd').filter(':not(.anno_en)').addClass("odd"); + $j('.mv_fd_mvd:even').filter(':not(.anno_en)').addClass("even"); + //remove odd/even class for annoative layer: + $j('.anno_en:odd').addClass("anno_en_odd") + $j('.anno_en:even').addClass("anno_en_even"); + //add annotative odd even collor: + }, + addHoverHooks:function(selector){ this_stream=this; if(!selector){ //null selector do init: selector='.mv_timeline_mvd_jumper,.mv_fd_mvd'; } js_log('selector: '+selector); - $j(selector).hoverIntent({ - interval:200, //polling interval - timeout:200, //delay before onMouseOut - over:function(){ + $j(selector).hover( + function(){ //get the mvd_id (the last part of the this.id) mvd_id = this.id.split('_').pop(); //if timeline scroll to position: @@ -204,7 +201,7 @@ var mv_stream_interface = { } this_stream.mvdOver( mvd_id ); }, - out:function(){ + function(){ //get the mvd_id (the last part of the this.id) mvd_id = this.id.split('_').pop(); this_stream.mvdOut(mvd_id); @@ -214,324 +211,330 @@ var mv_stream_interface = { return ; }); } - }); + ); }, mvdOver:function(mvd_id){ - js_log('f:mvdOver' + mvd_id ); - var vid_elm = $j('#embed_vid').get(0); - //never do mvdOver while video is playing: - if( vid_elm.isPlaying() ){ - return false; - } - //stop the video if not already stopped - vid_elm.stop(); - mv_lock_vid_updates=false; - //set the onClipDone_disp to false: - this.cur_mvd_id=this.delay_cur_mvd_id=mvd_id; - do_video_mvd_update(mvd_id); - highlight_tl_ts(mvd_id); - highlight_fd(mvd_id); - }, - mvdOut:function(mvd_id){ - var vid_elm = $j('#embed_vid').get(0); - //only process out if in "stoped" state - if( vid_elm.isStoped() ){ - js_log('do out ' + mvd_id ); - this.cur_mvd_id='base'; - de_highlight_tl_ts(mvd_id); - de_highlight_fd(mvd_id); - js_log('calling interface restore: '); - vid_elm.hideHighlight(); - setTimeout('mv_stream_interface.doRestore()',500); - }else{ - setTimeout('mv_stream_interface.mvdOut(\''+mvd_id+'\')',100); - } - }, - //delay video updates until we are not playing the clip and clipEnd is not displayed - delayDoVidMvdUpdate:function(){ - if(mv_lock_vid_updates){ - setTimeout("mv_stream_interface.delayDoVidMvdUpdate()", 250); - }else{ - //only restore if the onClipDone_disp is false - if( !$j('#embed_vid').get(0).onClipDone_disp){ - if(this.cur_mvd_id!=this.delay_cur_mvd_id){ - this.cur_mvd_id = this.delay_cur_mvd_id; - do_video_mvd_update(this.cur_mvd_id); - } - } - } - }, - /* based on a a mvd_id update the video thumbnail to the correct location - */ - doRestore:function(){ - //js_log('f:doRestore'); - var vid_elm = $j('#embed_vid').get(0); - if(vid_elm){ - if( vid_elm.isPlaying()){ - //js_log('vid elm is playing delay restore:') - if(!vid_elm.userSlide){ //dont' restore if userSlide is true - if( ! this.monitorTimerId ){ - // this.monitorTimerId = setInterval('mv_stream_interface.doRestore()', 250); - } - } - }else{ - //stop restore monitor: - clearInterval(this.monitorTimerId); - this.monitorTimerId = 0; - //only restore if onClipDone_disp is false - if(!vid_elm.onClipDone_disp){ - //only restore if the cur_mvd = 'base' and interface updates are not locked - if(this.cur_mvd_id=='base'){ - vid_elm.updateThumbnail( $j('#embed_vid').get(0).org_thum_src ); - vid_elm.updateVideoTimeReq(org_vid_time_req); - //vid_elm.updateVideoSrc(org_vid_src); - $j('#mv_videoPlayerTime').html(org_vid_title); - } - } - } - } - } + js_log('f:mvdOver' + mvd_id ); + var vid_elm = $j('#embed_vid').get(0); + //never do mvdOver while video is playing: + if( vid_elm.isPlaying() ){ + return false; + } + //stop the video if not already stopped + vid_elm.stop(); + mv_lock_vid_updates=false; + //set the onClipDone_disp to false: + this.cur_mvd_id=this.delay_cur_mvd_id=mvd_id; + do_video_mvd_update(mvd_id); + highlight_tl_ts(mvd_id); + highlight_fd(mvd_id); + }, + mvdOut:function(mvd_id){ + var vid_elm = $j('#embed_vid').get(0); + //only process out if in "stoped" state + if( vid_elm.isStoped() ){ + js_log('do out ' + mvd_id ); + this.cur_mvd_id='base'; + de_highlight_tl_ts(mvd_id); + de_highlight_fd(mvd_id); + js_log('calling interface restore: '); + vid_elm.hideHighlight(); + setTimeout('mv_stream_interface.doRestore()',500); + }else{ + setTimeout('mv_stream_interface.mvdOut(\''+mvd_id+'\')',100); + } + }, + //delay video updates until we are not playing the clip and clipEnd is not displayed + delayDoVidMvdUpdate:function(){ + if(mv_lock_vid_updates){ + setTimeout("mv_stream_interface.delayDoVidMvdUpdate()", 250); + }else{ + //only restore if the onClipDone_disp is false + if( !$j('#embed_vid').get(0).onClipDone_disp){ + if(this.cur_mvd_id!=this.delay_cur_mvd_id){ + this.cur_mvd_id = this.delay_cur_mvd_id; + do_video_mvd_update(this.cur_mvd_id); + } + } + } + }, + /* based on a a mvd_id update the video thumbnail to the correct location + */ + doRestore:function(){ + //js_log('f:doRestore'); + var vid_elm = $j('#embed_vid').get(0); + if(vid_elm){ + if( vid_elm.isPlaying()){ + //js_log('vid elm is playing delay restore:') + if(!vid_elm.userSlide){ //dont' restore if userSlide is true + if( ! this.monitorTimerId ){ + // this.monitorTimerId = setInterval('mv_stream_interface.doRestore()', 250); + } + } + }else{ + //stop restore monitor: + clearInterval(this.monitorTimerId); + this.monitorTimerId = 0; + //only restore if onClipDone_disp is false + if(!vid_elm.onClipDone_disp){ + //only restore if the cur_mvd = 'base' and interface updates are not locked + if(this.cur_mvd_id=='base'){ + vid_elm.updateThumbnail( $j('#embed_vid').get(0).org_thum_src ); + vid_elm.updateVideoTimeReq(org_vid_time_req); + //vid_elm.updateVideoSrc(org_vid_src); + $j('#mv_videoPlayerTime').html(org_vid_title); + } + } + } + } + } } function mv_doTextScrollMonitor(){ - if(!mvTextScrollMonitorTimer) - mvTextScrollMonitorTimer=setInterval('mv_doTextScrollMonitor()',1000); - - if( ! mv_open_edit_mvd ){ - var evid = $j('#embed_vid').get(0); - if( evid.isPlaying() ){ - if(evid.currentTime!=0) - mv_scroll2Time(evid.currentTime); - } - if( evid.userSlide ){ - var mvd_id = mv_scroll2Time( npt2seconds( evid.jump_time ) ); - if( mvd_id ){ - //also update the image: - var img_url = $j('#mv_fd_mvd_'+mvd_id).attr('image_url'); - //js_log('set imag via mv_doTextScrollMonitor:'+img_url); - $j('#embed_vid').get(0).updateThumbnail( img_url ); - }else{ - //update the image based on the time: - $j('#embed_vid').get(0).updateThumbTime( evid.jump_time ); - } - } - - - } - //if userScroll scroll/update + if(!mvTextScrollMonitorTimer) + mvTextScrollMonitorTimer=setInterval('mv_doTextScrollMonitor()',1000); + + if( ! mv_open_edit_mvd ){ + var evid = $j('#embed_vid').get(0); + if( evid.isPlaying() ){ + if(evid.currentTime!=0) + mv_scroll2Time(evid.currentTime); + } + if( evid.userSlide ){ + var mvd_id = mv_scroll2Time( npt2seconds( evid.jump_time ) ); + if( mvd_id ){ + //also update the image: + var img_url = $j('#mv_fd_mvd_'+mvd_id).attr('image_url'); + //js_log('set imag via mv_doTextScrollMonitor:'+img_url); + $j('#embed_vid').get(0).updateThumbnail( img_url ); + }else{ + //update the image based on the time: + $j('#embed_vid').get(0).updateThumbTime( evid.jump_time ); + } + } + + + } + //if userScroll scroll/update } var previus_scroll2Time_time=null; var previus_scrollMvd_id=null; function mv_scroll2Time(sec_time){ - if(previus_scroll2Time_time!=sec_time){ - var scroll_mvd_id = null; - //init pMvd_id - if( $j('.mv_fd_mvd:first').length != 0 ){ - var pMvd_id=$j('.mv_fd_mvd:first').attr("id").split('_').pop(); - $j('.mv_fd_mvd').each(function(){ - var curTitle = get_titleObject($j(this).attr('name')); - if( curTitle.start_time >= sec_time ){ - //js_log('found mvd pos: ' + curTitle.start_time + ' for sec time: ' + sec_time); - if(previus_scrollMvd_id != pMvd_id){ - scroll_to_pos( pMvd_id ) ; - previus_scrollMvd_id = pMvd_id; - } - return false;//break out of for loop: - } - pMvd_id = $j(this).attr("id").split('_').pop(); - }); - } - } - return pMvd_id; + if(previus_scroll2Time_time!=sec_time){ + var scroll_mvd_id = null; + //init pMvd_id + if( $j('.mv_fd_mvd:first').length != 0 ){ + var pMvd_id=$j('.mv_fd_mvd:first').attr("id").split('_').pop(); + $j('.mv_fd_mvd').each(function(){ + var curTitle = get_titleObject($j(this).attr('name')); + if( sec_time <= curTitle.start_time){ + js_log('found mvd pos: ' + curTitle.start_time + ' for sec time: ' + sec_time); + if(previus_scrollMvd_id != pMvd_id){ + //do highlight / dehighlight: + highlight_fd( pMvd_id ); + de_highlight_fd( previus_scrollMvd_id ); + + scroll_to_pos( pMvd_id ) ; + previus_scrollMvd_id = pMvd_id; + } + return false;//break out of for loop: + }else{ + js_log('Not found mvd pos: '+ $j(this).attr("id") +' ' + curTitle.start_time + ' compared to: ' + sec_time); + } + pMvd_id = $j(this).attr("id").split('_').pop(); + }); + } + } + return pMvd_id; } /*function mv_doShowVideoDownload(){ - js_log('f:mv_doShowVideoDownload'); - //restores orginal state before showing download links: - mv_stream_interface.doRestore(); - return $j('#embed_vid').get(0).org_showVideoDownload(); + js_log('f:mv_doShowVideoDownload'); + //restores orginal state before showing download links: + mv_stream_interface.doRestore(); + return $j('#embed_vid').get(0).org_showVideoDownload(); }*/ /* the mvdObject * * eventually a lot of mvd_based functionality should be ported over to this structure. * */ function getMvdObject(mvd_id){ - if(mvdAry[mvd_id])return mvdAry[mvd_id]; - if($j('#mv_fd_mvd_'+mvd_id).get(0)){ - var mvdObj = new Object({ - id:mvd_id, - name:$j('#mv_fd_mvd_'+mvd_id).attr('name'), - parseTitle:function(){ - parts = this.name.split('/'); - this.start_ntp = parts[1]; - this.end_ntp = parts[2]; - this.start_time = npt2seconds(this.start_ntp); - this.end_time = npt2seconds(this.end_ntp); - } - }); - } - mvdObj.parseTitle(); - mvdAry[mvd_id] = mvdObj; - return mvdAry[mvd_id]; + if(mvdAry[mvd_id])return mvdAry[mvd_id]; + if($j('#mv_fd_mvd_'+mvd_id).get(0)){ + var mvdObj = new Object({ + id:mvd_id, + name:$j('#mv_fd_mvd_'+mvd_id).attr('name'), + parseTitle:function(){ + parts = this.name.split('/'); + this.start_ntp = parts[1]; + this.end_ntp = parts[2]; + this.start_time = npt2seconds(this.start_ntp); + this.end_time = npt2seconds(this.end_ntp); + } + }); + } + mvdObj.parseTitle(); + mvdAry[mvd_id] = mvdObj; + return mvdAry[mvd_id]; } function mv_disp_add_mvd(mvd_type){ - if(mv_open_edit_mvd){ - js_error(gMsg['mv_open_edit']); - return ; - } - if($j('#embed_vid').length == 0){ - js_error('Error: no video present'); - return ; - } - mv_open_edit_mvd=mvd_type; - $j('#embed_vid').get(0).preview_mode=true; //turn on clip preivew mode: - - sajax_request_type='GET'; - sajax_do_call( "mv_add_disp",[wgTitle, mvd_type, org_vid_time_req], f ); - //insert before the first mvd: - $j('#mv_add_new_mvd').css( { display : 'inline' } ); - $j('#mv_add_new_mvd').html( gM('loading_txt') ); - var mvd_id='new'; - //scroll to the new (loading) (top of mvd_cont) - $j('#selectionsBox').animate( { scrollTop: 0}, 'slow'); - function f( request ) { - result= request.responseText; - if (request.status != 200){ - $j('#mv_fd_mvd_new').html( "<div class='error'> " + - request.status + " " + request.statusText + ": " + result + "</div>"); - }else{ - $j('#mv_add_new_mvd').html(result); - //add the javascrip based hooks: - if(mvd_type=='ht_en'){ - add_autocomplete('new'); - add_adjust_hooks('new'); - } - if(mvd_type=='anno_en'){ - add_adjust_hooks('new'); - } - //add edit buttons - if(typeof mwSetupToolbar =='function'){ - mwSetupToolbar(); - } - mwEditButtons = []; //empty edit buttons - - if(mvd_type=='anno_en'){ - //add mv_helpers autocompletes - add_mv_helpers_ac(mvd_id); - if($j('#adv_basic_'+mvd_id).val()=='basic'){ - $j('.mv_advanced_edit').hide(); - }else{ - $j('.mv_basic_edit').hide(); - } - } - } - } + if(mv_open_edit_mvd){ + js_error(gMsg['mv_open_edit']); + return ; + } + if($j('#embed_vid').length == 0){ + js_error('Error: no video present'); + return ; + } + mv_open_edit_mvd=mvd_type; + $j('#embed_vid').get(0).preview_mode=true; //turn on clip preivew mode: + + sajax_request_type='GET'; + sajax_do_call( "mv_add_disp",[wgTitle, mvd_type, org_vid_time_req], f ); + //insert before the first mvd: + $j('#mv_add_new_mvd').css( { display : 'inline' } ); + $j('#mv_add_new_mvd').html( gM('loading_txt') ); + var mvd_id='new'; + //scroll to the new (loading) (top of mvd_cont) + $j('#selectionsBox').animate( { scrollTop: 0}, 'slow'); + function f( request ) { + result= request.responseText; + if (request.status != 200){ + $j('#mv_fd_mvd_new').html( "<div class='error'> " + + request.status + " " + request.statusText + ": " + result + "</div>"); + }else{ + $j('#mv_add_new_mvd').html(result); + //add the javascrip based hooks: + if(mvd_type=='ht_en'){ + add_autocomplete('new'); + add_adjust_hooks('new'); + } + if(mvd_type=='anno_en'){ + add_adjust_hooks('new'); + } + //add edit buttons + if(typeof mwSetupToolbar =='function'){ + mwSetupToolbar(); + } + mwEditButtons = []; //empty edit buttons + + if(mvd_type=='anno_en'){ + //add mv_helpers autocompletes + add_mv_helpers_ac(mvd_id); + if($j('#adv_basic_'+mvd_id).val()=='basic'){ + $j('.mv_advanced_edit').hide(); + }else{ + $j('.mv_basic_edit').hide(); + } + } + } + } } function mv_edit_disp(titleKey, mvd_id){ - if(mv_open_edit_mvd && mv_open_edit_mvd!=mvd_id){ - alert(gMsg['mv_open_edit']); - return ; - } - var title_parts = titleKey.split(':'); - var mvd_type = title_parts[0].toLowerCase(); + if(mv_open_edit_mvd && mv_open_edit_mvd!=mvd_id){ + alert(gMsg['mv_open_edit']); + return ; + } + var title_parts = titleKey.split(':'); + var mvd_type = title_parts[0].toLowerCase(); - mv_open_edit_mvd=mvd_id; - //set sajax to do a GET request - sajax_request_type='GET'; + mv_open_edit_mvd=mvd_id; + //set sajax to do a GET request + sajax_request_type='GET'; - sajax_do_call( "mv_edit_disp", [titleKey, mvd_id], f ); - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); - //handle the response: - function f( request ) { - result= request.responseText; - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - $j('#mv_fcontent_'+mvd_id).html( result ); - //add javascript hooks - add_autocomplete(mvd_id); - add_adjust_hooks(mvd_id); + sajax_do_call( "mv_edit_disp", [titleKey, mvd_id], f ); + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); + //handle the response: + function f( request ) { + result= request.responseText; + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + $j('#mv_fcontent_'+mvd_id).html( result ); + //add javascript hooks + add_autocomplete(mvd_id); + add_adjust_hooks(mvd_id); - //if mvd_type==anno_en - //add buttons - //mwSetupToolbar(); - mwEditButtons = []; //empty edit buttons + //if mvd_type==anno_en + //add buttons + //mwSetupToolbar(); + mwEditButtons = []; //empty edit buttons - if(mvd_type=='anno_en'){ - //add mv_helpers autocompletes - add_mv_helpers_ac(mvd_id); - if($j('#adv_basic_'+mvd_id).val()=='basic'){ - $j('.mv_advanced_edit').hide(); - }else{ - $j('.mv_basic_edit').hide(); - } - } - } + if(mvd_type=='anno_en'){ + //add mv_helpers autocompletes + add_mv_helpers_ac(mvd_id); + if($j('#adv_basic_'+mvd_id).val()=='basic'){ + $j('.mv_advanced_edit').hide(); + }else{ + $j('.mv_basic_edit').hide(); + } + } + } }/* interface ajax actions */ function mv_disp_mvd(titleKey, mvd_id){ - if(mvd_id=='new'){ - //@@todo confirm (user will lose text in window - $j('#mv_add_new_mvd').fadeOut("slow", function(){$j(this).empty();}); - //@@todo confirm cancel: + if(mvd_id=='new'){ + //@@todo confirm (user will lose text in window + $j('#mv_add_new_mvd').fadeOut("slow", function(){$j(this).empty();}); + //@@todo confirm cancel: //if (confirm("unsaved changes will be lost")) { - // $j('#mv_add_mvd_cont').remove(); + // $j('#mv_add_mvd_cont').remove(); //} - }else{ - //set sajax to do a GET request - sajax_request_type='GET'; - sajax_do_call( "mv_disp_mvd", [titleKey, mvd_id], f ); - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); - } - //free the editor slot: - js_log('mv_disp_mvd: nset mv_open_edit_mvd'); - mv_open_edit_mvd=null; - $j('#embed_vid').get(0).preview_mode=false;//turn off clip preivew mode: - - function f( request ) { - result= request.responseText; - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - //fill in div - $j('#mv_fcontent_'+mvd_id).html( result ); - //add_autocomplete(mvd_id); + }else{ + //set sajax to do a GET request + sajax_request_type='GET'; + sajax_do_call( "mv_disp_mvd", [titleKey, mvd_id], f ); + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); + } + //free the editor slot: + js_log('mv_disp_mvd: nset mv_open_edit_mvd'); + mv_open_edit_mvd=null; + $j('#embed_vid').get(0).preview_mode=false;//turn off clip preivew mode: + + function f( request ) { + result= request.responseText; + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + //fill in div + $j('#mv_fcontent_'+mvd_id).html( result ); + //add_autocomplete(mvd_id); //add_adjust_hooks(mvd_id); - } + } } function mv_history_disp(titleKey, mvd_id){ - sajax_request_type='GET'; - sajax_do_call( "mv_history_disp", [titleKey, mvd_id], f ); - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); - function f( request ) { - result= request.responseText; - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - $j('#mv_fcontent_'+mvd_id).html( result ); - //do javascript actions: + sajax_request_type='GET'; + sajax_do_call( "mv_history_disp", [titleKey, mvd_id], f ); + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); + function f( request ) { + result= request.responseText; + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + $j('#mv_fcontent_'+mvd_id).html( result ); + //do javascript actions: } } /*function mv_adjust_disp(titleKey, mvd_id){ - sajax_request_type='GET'; - sajax_do_call( "mv_adjust_disp", [titleKey, mvd_id], f ); - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); - //hanndle the response: - function f( request ) { - result= request.responseText; - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - $j('#mv_fcontent_'+mvd_id).html( result ); - //do javascript actions: - add_adjust_hooks(mvd_id); + sajax_request_type='GET'; + sajax_do_call( "mv_adjust_disp", [titleKey, mvd_id], f ); + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); + //hanndle the response: + function f( request ) { + result= request.responseText; + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + $j('#mv_fcontent_'+mvd_id).html( result ); + //do javascript actions: + add_adjust_hooks(mvd_id); } }*/ /* non-ajax preview of clip adjustment*/ -function mv_adjust_preview( mvd_id ){ - js_log('start val:#mv_start_hr_'+mvd_id+' ' + $j('#mv_start_hr_'+mvd_id).val() + ' end:'+ $j('#mv_end_hr_'+mvd_id).val() ); - $j('#embed_vid').get(0).hideHighlight(); - $j('#embed_vid').get(0).stop(); - $j('#embed_vid').get(0).preview_mode=true; - mv_lock_vid_updates=false; - do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); - mv_lock_vid_updates=true; - //start playing - $j('#embed_vid').get(0).play(); - //mv_lock_vid_updates=false; +function mv_adjust_preview( mvd_id ){ + js_log('start val:#mv_start_hr_'+mvd_id+' ' + $j('#mv_start_hr_'+mvd_id).val() + ' end:'+ $j('#mv_end_hr_'+mvd_id).val() ); + $j('#embed_vid').get(0).hideHighlight(); + $j('#embed_vid').get(0).stop(); + $j('#embed_vid').get(0).preview_mode=true; + mv_lock_vid_updates=false; + do_video_time_update($j('#mv_start_hr_'+mvd_id).val(), $j('#mv_end_hr_'+mvd_id).val() ); + mv_lock_vid_updates=true; + //start playing + $j('#embed_vid').get(0).play(); + //mv_lock_vid_updates=false; } /* * adds autocomplete to semantic forms @@ -539,561 +542,562 @@ function mv_adjust_preview( mvd_id ){ * @@todo generalize for all autocompletes */ function add_mv_helpers_ac(mvd_id){ - js_log('add_mv_helpers_ac:'+mvd_id); - $j('.mv_anno_ac_'+mvd_id).each(function(i, input_item){ - var prop_name =$j(input_item).attr('name'); - js_log('add ac for: '+ prop_name); - uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); - $j(input_item).autocomplete( - uri, - { - autoFill:true, - onItemSelect:function(v){ - js_log('selected:' + v.innerHTML + 'fill with' + $j(input_item).val() ); - //@@todo better way to determin type - //js_log("img src: " + $j(v).children('img').attr('src')); - //'mv_edit_im_'+mvd_id - if($j(v).children('img').length!=0){ - $j('#smw_Speech_by_img').attr('src', $j(v).children('img').attr('src')); - } - //add category and empty input (@@todo make cat_ns multi-lengual friendly - var cat_ns="Category:" - if($j(input_item).val().indexOf(cat_ns)==0){ - mv_add_category(mvd_id, $j(input_item).val().substr(cat_ns.length)); - $j(input_item).val(''); - } - }, - formatItem:function(row){ - if(row[2]=='no_image'){ - return row[1]; - }else{ - return '<img width="44" src="'+ row[2] + '">'+row[1]; - } - }, - matchSubset:0, - extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:prop_name}, - paramName:'rsargs[]', - resultElem:'#'+prop_name+'_choices_'+mvd_id - }); - }); + js_log('add_mv_helpers_ac:'+mvd_id); + $j('.mv_anno_ac_'+mvd_id).each(function(i, input_item){ + var prop_name =$j(input_item).attr('name'); + js_log('add ac for: '+ prop_name); + uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + $j(input_item).autocomplete( + uri, + { + autoFill:true, + onItemSelect:function(v){ + js_log('selected:' + v.innerHTML + 'fill with' + $j(input_item).val() ); + //@@todo better way to determin type + //js_log("img src: " + $j(v).children('img').attr('src')); + //'mv_edit_im_'+mvd_id + if($j(v).children('img').length!=0){ + $j('#smw_Speech_by_img').attr('src', $j(v).children('img').attr('src')); + } + //add category and empty input (@@todo make cat_ns multi-lengual friendly + var cat_ns="Category:" + if($j(input_item).val().indexOf(cat_ns)==0){ + mv_add_category(mvd_id, $j(input_item).val().substr(cat_ns.length)); + $j(input_item).val(''); + } + }, + formatItem:function(row){ + if(row[2]=='no_image'){ + return row[1]; + }else{ + return '<img width="44" src="'+ row[2] + '">'+row[1]; + } + }, + matchSubset:0, + extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:prop_name}, + paramName:'rsargs[]', + resultElem:'#'+prop_name+'_choices_'+mvd_id + }); + }); } function mv_add_category(mvd_id, cat_name){ - js_log("add cat: "+ cat_name); - if(cat_name=='')return false; - var currentDate = new Date() - var unique_inx = currentDate.getUTCMilliseconds(); - $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat_'+unique_inx+'" class="mv_ext_cat">'+ - cat_name.replace(/_/g," ") + - '<a href="#" onclick="$j(\'#ext_cat_'+unique_inx+'\').fadeOut(\'fast\').remove();return false;">'+ - '<img border="0" src="'+mvgScriptPath+'/skins/images/delete.png">'+ - '</a></span><br>'); + js_log("add cat: "+ cat_name); + if(cat_name=='')return false; + var currentDate = new Date() + var unique_inx = currentDate.getUTCMilliseconds(); + $j('#mv_ext_cat_container_'+mvd_id).append('<span id="ext_cat_'+unique_inx+'"><input value="'+cat_name+'" type="hidden" style="display:none;" name="ext_cat_'+unique_inx+'" class="mv_ext_cat">'+ + cat_name.replace(/_/g," ") + + '<a href="#" onclick="$j(\'#ext_cat_'+unique_inx+'\').fadeOut(\'fast\').remove();return false;">'+ + '<img border="0" src="'+mvgScriptPath+'/skins/images/delete.png">'+ + '</a></span><br>'); } /* * @@TODO add_autocomplete should be merged with generalized mv_helpers_ac */ function add_autocomplete(mvd_id){ - js_log("f:auto_comp_choices_:"+mvd_id); - //make sure the target elements exist: - //if(!document.getElementById("auto_comp_"+mvd_id))return ; - //if(!document.getElementById("auto_comp_choices_"+mvd_id))return ; - uri = wgServer + - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); - $j('#auto_comp_'+mvd_id).autocomplete( - uri, - { - autoFill:true, - onItemSelect:function(v){ - js_log('selected:' + v.innerHTML ); - //update the image: - //js_log("img src: " + $j(v).children('img').attr('src')); - //'mv_edit_im_'+mvd_id - $j('#mv_edit_im_'+mvd_id).attr('src', $j(v).children('img').attr('src')); - }, - formatItem:function(row){ - return '<img width="44" src="'+ row[2] + '">'+row[1]; - }, - matchSubset:0, - extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, - paramName:'rsargs[]', - resultElem:'#auto_comp_choices_'+mvd_id - }); + js_log("f:auto_comp_choices_:"+mvd_id); + //make sure the target elements exist: + //if(!document.getElementById("auto_comp_"+mvd_id))return ; + //if(!document.getElementById("auto_comp_choices_"+mvd_id))return ; + uri = wgServer + + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + $j('#auto_comp_'+mvd_id).autocomplete( + uri, + { + autoFill:true, + onItemSelect:function(v){ + js_log('selected:' + v.innerHTML ); + //update the image: + //js_log("img src: " + $j(v).children('img').attr('src')); + //'mv_edit_im_'+mvd_id + $j('#mv_edit_im_'+mvd_id).attr('src', $j(v).children('img').attr('src')); + }, + formatItem:function(row){ + return '<img width="44" src="'+ row[2] + '">'+row[1]; + }, + matchSubset:0, + extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, + paramName:'rsargs[]', + resultElem:'#auto_comp_choices_'+mvd_id + }); } //submit the adjust //use start time of elements in the to position pieces. function mv_add_new_fd_mvd(titleKey, node_html){ - //js_log('add: ' + mv_result['titleKey'] + node_html); - //get start time and end time from titleKey: - var insertTitle = get_titleObject(titleKey); + //js_log('add: ' + mv_result['titleKey'] + node_html); + //get start time and end time from titleKey: + var insertTitle = get_titleObject(titleKey); - //for each element selectionsBox - var inserted = false; - $j('.mv_fd_mvd').each(function(i){ - if(!inserted){ - var curTitle = get_titleObject($j(this).attr('name')); - if(insertTitle.start_time < curTitle.start_time){ - $j(this).before(node_html).show("slow"); - js_log('inserted before: '+curTitle.title +' id:'+insertTitle.start_time); - inserted=true; - return ; - } - } - }); - //add at the end (if not before some other mvd page) - if(!inserted){ - js_log('insert to end: ' + insertTitle.start_time + "\n" + node_html); - $j('#selectionsBox').append(node_html); - } - //repaint row colors: - mv_stream_interface.oddEvenPaint(); + //for each element selectionsBox + var inserted = false; + $j('.mv_fd_mvd').each(function(i){ + if(!inserted){ + var curTitle = get_titleObject($j(this).attr('name')); + if(insertTitle.start_time < curTitle.start_time){ + $j(this).before(node_html).show("slow"); + js_log('inserted before: '+curTitle.title +' id:'+insertTitle.start_time); + inserted=true; + return ; + } + } + }); + //add at the end (if not before some other mvd page) + if(!inserted){ + js_log('insert to end: ' + insertTitle.start_time + "\n" + node_html); + $j('#selectionsBox').append(node_html); + } + //repaint row colors: + mv_stream_interface.oddEvenPaint(); } function get_titleObject(titleKey){ - var titleObj = new Object({ - title:titleKey, - parseTitle:function(){ - parts = this.title.split('/'); - this.start_ntp = parts[1]; - this.end_ntp = parts[2]; - this.start_time = npt2seconds(this.start_ntp); - this.end_time = npt2seconds(this.end_ntp); - } - }); - titleObj.parseTitle(); - return titleObj; + var titleObj = new Object({ + title:titleKey, + parseTitle:function(){ + parts = this.title.split('/'); + this.start_ntp = parts[1]; + this.end_ntp = parts[2]; + this.start_time = npt2seconds(this.start_ntp); + this.end_time = npt2seconds(this.end_ntp); + } + }); + titleObj.parseTitle(); + return titleObj; } function mv_disp_remove_mvd(titleKey, mvd_id){ - sajax_request_type='GET'; - sajax_do_call( "mv_disp_remove_mvd", [titleKey, mvd_id], f ); - $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); - function f( request ) { - result= request.responseText; - if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - $j('#mv_fcontent_'+mvd_id).html( result ); - //dirty hack to avoid re-write of article->delete(); - update_delete_submit(titleKey, mvd_id); + sajax_request_type='GET'; + sajax_do_call( "mv_disp_remove_mvd", [titleKey, mvd_id], f ); + $j('#mv_fcontent_'+mvd_id).html( gM('loading_txt') ); + function f( request ) { + result= request.responseText; + if (request.status != 200) result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + $j('#mv_fcontent_'+mvd_id).html( result ); + //dirty hack to avoid re-write of article->delete(); + update_delete_submit(titleKey, mvd_id); } } function update_delete_submit(titleKey, mvd_id){ - $j('#deleteconfirm').attr('id', 'deleteconfirm_'+mvd_id); - $j('#deleteconfirm_'+mvd_id).attr('onSubmit', 'mv_remove_mvd(\'' + - titleKey + '\', \''+ mvd_id+'\', this); return false;'); + $j('#deleteconfirm').attr('id', 'deleteconfirm_'+mvd_id); + $j('#deleteconfirm_'+mvd_id).attr('onSubmit', 'mv_remove_mvd(\'' + + titleKey + '\', \''+ mvd_id+'\', this); return false;'); } function mv_remove_mvd(titleKey, mvd_id, form){ - var post_vars = new Object(); - var args = new Object(); - $j('input', form).each(function(){ - post_vars[this.name] = this.value; - }); - post_vars['title']=titleKey; - post_vars['mvd_id'] = mvd_id; + var post_vars = new Object(); + var args = new Object(); + $j('input', form).each(function(){ + post_vars[this.name] = this.value; + }); + post_vars['title']=titleKey; + post_vars['mvd_id'] = mvd_id; - var setHtmlId ='#mv_fcontent_'+mvd_id; - //@@todo switch over to jquery ajax - /*uri = wgServer + - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + - "?action=ajax&rs=mv_remove_mvd"; - $j.ajax({ - url:uri, - data:post_vars, - error:function(error){}, - success:function(result){} - } - ); - }*/ - sajax_request_type='POST'; - mv_sajax_do_call('mv_remove_mvd',args, f, post_vars); - js_log('did request'); - function f( request ) { - result = request.responseText; - js_log("got response:"); - if (request.status != 200){ - result= "<div class='error'> " + request.status + " " + request.statusText + ": " + request.responseText + "</div>"; - $j(setHtmlId).html( result) ; - return ; + var setHtmlId ='#mv_fcontent_'+mvd_id; + //@@todo switch over to jquery ajax + /*uri = wgServer + + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + + "?action=ajax&rs=mv_remove_mvd"; + $j.ajax({ + url:uri, + data:post_vars, + error:function(error){}, + success:function(result){} + } + ); + }*/ + sajax_request_type='POST'; + mv_sajax_do_call('mv_remove_mvd',args, f, post_vars); + js_log('did request'); + function f( request ) { + result = request.responseText; + js_log("got response:"); + if (request.status != 200){ + result= "<div class='error'> " + request.status + " " + request.statusText + ": " + request.responseText + "</div>"; + $j(setHtmlId).html( result) ; + return ; }else{ - js_log("going to eval: " + request.responseText); - eval(request.responseText); - js_log('status: ' + mv_result['status']); - if(mv_result['status']=='ok'){ - js_log(" status ok should remove: "+mvd_id); - //delete success remove mvd: - $j('#mv_fd_mvd_'+mvd_id).remove(); - $j('#mv_tl_mvd_'+mvd_id).remove(); - //repaint colors: - mv_stream_interface.oddEvenPaint(); - }else if(mv_result['status']=='error'){ - $j(setHtmlId).html( mv_result['error_txt'] ); - update_delete_submit(titleKey, mvd_id); - } + js_log("going to eval: " + request.responseText); + eval(request.responseText); + js_log('status: ' + mv_result['status']); + if(mv_result['status']=='ok'){ + js_log(" status ok should remove: "+mvd_id); + //delete success remove mvd: + $j('#mv_fd_mvd_'+mvd_id).remove(); + $j('#mv_tl_mvd_'+mvd_id).remove(); + //repaint colors: + mv_stream_interface.oddEvenPaint(); + }else if(mv_result['status']=='error'){ + $j(setHtmlId).html( mv_result['error_txt'] ); + update_delete_submit(titleKey, mvd_id); + } } - } + } } //do a form submit to a given function function mv_do_ajax_form_submit(mvd_id, edit_action){ - //set sajax to do a post request - sajax_request_type='POST'; - //init the var: - var args = new Object(); - var post_vars = new Object(); - var buttonList = {'wpSave':true, 'wpPreview':true, 'wpLivePreview':true, 'wpDiff':true}; - var move_on_done=false; + //set sajax to do a post request + sajax_request_type='POST'; + //init the var: + var args = new Object(); + var post_vars = new Object(); + var buttonList = {'wpSave':true, 'wpPreview':true, 'wpLivePreview':true, 'wpDiff':true}; + var move_on_done=false; - var form = document.getElementById('mvd_form_'+mvd_id); - for(i=0;i<form.elements.length;i++){ - if(buttonList[ form.elements[i].name ]){ - //don't include button unless its the edit action - // (to simulate button press for edit actions (save, preview, show changes) - if(form.elements[i].name.toLowerCase().indexOf( edit_action.toLowerCase() )!=-1){ - post_vars[ form.elements[i].name ]=form.elements[i].value; - } - }else{ - post_vars[ form.elements[i].name ]=form.elements[i].value; - } - //js_log(form.elements[i].name + ' = ' + form.elements[i].value); - } - //do edit action specific calls: - switch(edit_action){ - case 'save': - var setHtmlId ='#mv_fcontent_'+mvd_id; - break; - case 'preview': - mv_lock_vid_updates=true; - var setHtmlId = '#wikiPreview_'+mvd_id - mv_adjust_preview(mvd_id); - break; - } - //check if we are adjusting (if so move then save text) - if(mvd_id=='new'){ - post_vars['do_adjust']=false; - post_vars['wgTitle']=mvTitle; - }else{ - js_log('get title from: ' + $j('#mv_fd_mvd_'+mvd_id).attr('name')); - var curTitle = get_titleObject( $j('#mv_fd_mvd_'+mvd_id).attr('name') ); - if(edit_action=='save'){ - if( curTitle.start_ntp != $j('#mv_start_hr_'+mvd_id).val() || - curTitle.end_ntp != $j('#mv_end_hr_'+mvd_id).val()){ - post_vars['do_adjust']=true; - js_log('do adjustment move '+ curTitle.start_ntp + '!=' + $j('#mv_start_hr_'+mvd_id).val() - + ' & ' + curTitle.end_ntp + '!=' + $j('#mv_end_hr_'+mvd_id).val() ); - post_vars['wgTitle']=mvTitle; - post_vars['titleKey'] = $j('#mv_fd_mvd_'+mvd_id).attr('name'); - //js_log('titlekey:'+post_vars['titleKey'] ); - //get new title: - post_vars['newTitle'] = post_vars['titleKey'].substr(0, post_vars['titleKey'].indexOf('/')) + '/' + - $j('#mv_start_hr_'+mvd_id).val() + "/" + $j('#mv_end_hr_'+mvd_id).val(); - } - } - } + var form = document.getElementById('mvd_form_'+mvd_id); + for(i=0;i<form.elements.length;i++){ + if(buttonList[ form.elements[i].name ]){ + //don't include button unless its the edit action + // (to simulate button press for edit actions (save, preview, show changes) + if(form.elements[i].name.toLowerCase().indexOf( edit_action.toLowerCase() )!=-1){ + post_vars[ form.elements[i].name ]=form.elements[i].value; + } + }else{ + post_vars[ form.elements[i].name ]=form.elements[i].value; + } + //js_log(form.elements[i].name + ' = ' + form.elements[i].value); + } + //do edit action specific calls: + switch(edit_action){ + case 'save': + var setHtmlId ='#mv_fcontent_'+mvd_id; + break; + case 'preview': + mv_lock_vid_updates=true; + var setHtmlId = '#wikiPreview_'+mvd_id + mv_adjust_preview(mvd_id); + break; + } + //check if we are adjusting (if so move then save text) + if(mvd_id=='new'){ + post_vars['do_adjust']=false; + post_vars['wgTitle']=mvTitle; + }else{ + js_log('get title from: ' + $j('#mv_fd_mvd_'+mvd_id).attr('name')); + var curTitle = get_titleObject( $j('#mv_fd_mvd_'+mvd_id).attr('name') ); + if(edit_action=='save'){ + if( curTitle.start_ntp != $j('#mv_start_hr_'+mvd_id).val() || + curTitle.end_ntp != $j('#mv_end_hr_'+mvd_id).val()){ + post_vars['do_adjust']=true; + js_log('do adjustment move '+ curTitle.start_ntp + '!=' + $j('#mv_start_hr_'+mvd_id).val() + + ' & ' + curTitle.end_ntp + '!=' + $j('#mv_end_hr_'+mvd_id).val() ); + post_vars['wgTitle']=mvTitle; + post_vars['titleKey'] = $j('#mv_fd_mvd_'+mvd_id).attr('name'); + //js_log('titlekey:'+post_vars['titleKey'] ); + //get new title: + post_vars['newTitle'] = post_vars['titleKey'].substr(0, post_vars['titleKey'].indexOf('/')) + '/' + + $j('#mv_start_hr_'+mvd_id).val() + "/" + $j('#mv_end_hr_'+mvd_id).val(); + } + } + } - $j(setHtmlId).html( gM('loading_txt') ); - //@@todo switch over to jquery ajax - mv_sajax_do_call('mv_edit_submit',args, f, post_vars); - //js_log('mv_sajax_do_call ' + fajax +' ' + args); - function f( request ) { + $j(setHtmlId).html( gM('loading_txt') ); + //@@todo switch over to jquery ajax + mv_sajax_do_call('mv_edit_submit',args, f, post_vars); + //js_log('mv_sajax_do_call ' + fajax +' ' + args); + function f( request ) { result = request.responseText; if (request.status != 200){ - result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - mv_lock_vid_updates=false; - $j(setHtmlId).html( result) ; - return ; + result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + mv_lock_vid_updates=false; + $j(setHtmlId).html( result) ; + return ; } js_log('req status:'+ request.status); - if(mvd_id=='new' && edit_action=='save'){ - js_log("new and save"); - eval(result); - js_log('newsave status: '+mv_result['status'] ); - if(mv_result['status']=='ok'){ - //empty the add div: - $j('#mv_add_new_mvd').empty(); + if(mvd_id=='new' && edit_action=='save'){ + js_log("new and save"); + eval(result); + js_log('newsave status: '+mv_result['status'] ); + if(mv_result['status']=='ok'){ + //empty the add div: + $j('#mv_add_new_mvd').empty(); - //add mv_time_line element - $j('#mv_time_line').append(mv_result['tl_mvd']); - mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); + //add mv_time_line element + $j('#mv_time_line').append(mv_result['tl_mvd']); + mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); - mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mv_result['mvd_id']+',#mv_tl_mvd_'+mv_result['mvd_id']); - //scroll to the new mvd: - scroll_to_pos(mv_result['mvd_id']); - } - } + mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mv_result['mvd_id']+',#mv_tl_mvd_'+mv_result['mvd_id']); + //scroll to the new mvd: + scroll_to_pos(mv_result['mvd_id']); + } + } if(post_vars['do_adjust']){ - js_log('do_adjust'); - //remove and add encapsulated mvd_fd - eval(result); - if(mv_result['status']=='ok'){ - //@@could be a (fade but first rename) - js_log('remove: #mv_fd_mvd_'+mvd_id + ' len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); - $j('#mv_fd_mvd_'+mvd_id).remove(); - $j('#mv_tl_mvd_'+mvd_id).remove(); - - js_log('removed! len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); + js_log('do_adjust'); + //remove and add encapsulated mvd_fd + eval(result); + if(mv_result['status']=='ok'){ + //@@could be a (fade but first rename) + js_log('remove: #mv_fd_mvd_'+mvd_id + ' len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); + $j('#mv_fd_mvd_'+mvd_id).remove(); + $j('#mv_tl_mvd_'+mvd_id).remove(); + + js_log('removed! len br:'+ $j('#mv_fd_mvd_'+mvd_id).length); - //add new mv_time_line element (already has position so place at end) - $j('#mv_time_line').append(mv_result['tl_mvd']).show("slow"); + //add new mv_time_line element (already has position so place at end) + $j('#mv_time_line').append(mv_result['tl_mvd']).show("slow"); - //add new selectionsBox mvd element (based on start time) - //(use the titleKey returned from ajax request (in case it got clean or whatever) - mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); + //add new selectionsBox mvd element (based on start time) + //(use the titleKey returned from ajax request (in case it got clean or whatever) + mv_add_new_fd_mvd(mv_result['titleKey'], mv_result['fd_mvd']); - mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mvd_id); - //add tails - //mv_add_mvd_tails(mv_result['titleKey']); - //scroll to the new location (it should have keept its id (cuz its just a move) - scroll_to_pos(mvd_id); - }else if(mv_result['status']=='error'){ - $j(setHtmlId).html( mv_result['error_txt']); - } + mv_stream_interface.addHoverHooks('#mv_fd_mvd_'+mvd_id); + //add tails + //mv_add_mvd_tails(mv_result['titleKey']); + //scroll to the new location (it should have keept its id (cuz its just a move) + scroll_to_pos(mvd_id); + }else if(mv_result['status']=='error'){ + $j(setHtmlId).html( mv_result['error_txt']); + } }else{ - //just update the current mvd - $j(setHtmlId).html( result) ; - scroll_to_pos(mvd_id); + //just update the current mvd + $j(setHtmlId).html( result) ; + scroll_to_pos(mvd_id); } if(edit_action!='preview'){ - //unlock the interface updates - mv_lock_vid_updates=false; - //free the editor slot: - mv_open_edit_mvd=null; - $j('#embed_vid').get(0).preview_mode=false;//turn off clip preview mode: + //unlock the interface updates + mv_lock_vid_updates=false; + //free the editor slot: + mv_open_edit_mvd=null; + $j('#embed_vid').get(0).preview_mode=false;//turn off clip preview mode: } - } - //return false to prevent the form being submitted - return false; + } + //return false to prevent the form being submitted + return false; } function mv_pause(){ - // unlock updates, but issue a pause - if an update occurs, it should + // unlock updates, but issue a pause - if an update occurs, it should // stop. - var ebvid = $j('#embed_vid').get(0); - if( ebvid.isPlaying()) + var ebvid = $j('#embed_vid').get(0); + if( ebvid.isPlaying()) { js_log('f:mv_pause: should pause'); // calling original play_or_pause - ebvid.pause(); + ebvid.pause(); // lock updates if we're not paused, and vice versa - mv_lock_vid_updates =! ebvid.isPaused(); - }else{ - js_log('f:mv_pause called WHILE Paused: (should play)'); - mv_do_play(); - } + mv_lock_vid_updates =! ebvid.isPaused(); + }else{ + js_log('f:mv_pause called WHILE Paused: (should play)'); + mv_do_play(); + } } function mv_do_play( mvd_id ){ - js_log('mv_do_play:' + mvd_id); - $j('#embed_vid').get(0).preview_mode=false - //stop the current - $j('#embed_vid').get(0).stop(); - //stop any deferred updates: - - //force a given mvd if set - if(mvd_id){ - mv_lock_vid_updates=false; - //highlight the current / update url: - mv_stream_interface.mvdOver(mvd_id); - } - $j('#embed_vid').get(0). - //disable interface actions (mouse in out etc) - mv_lock_vid_updates=true; - //update the src if nesesary and no mvd provided: - if(!mvd_id){ - if(mv_stream_interface.cur_mvd_id!=mv_stream_interface.delay_cur_mvd_id){ - mv_stream_interface.cur_mvd_id =mv_stream_interface.delay_cur_mvd_id; - do_video_mvd_update( mv_stream_interface.cur_mvd_id ); - } - } - //check if we are out of range: - if(mvd_id){ - var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); - if( npt2seconds( time_ary[1] ) < npt2seconds( $j('#embed_vid').get(0).start_ntp ) ){ - window.location = wgArticlePath.replace( '$1', wgPageName +'/'+ time_ary[1] + '/' + time_ary[2]) + '#autoplay'; - return ; - } - } - //update the embed video actual play time - //time_chunk = $j('#embed_vid').get(0).src.split('t='); - //$j('#mv_videoPlayerTime').html( time_chunk[1] ); - //stop the video if playing and play: - $j('#embed_vid').get(0).didSeekJump=true; - //@@todo extend mv_embed to support src switching - $j('#embed_vid').get(0).play(); + js_log('mv_do_play:' + mvd_id); + $j('#embed_vid').get(0).preview_mode=false + //stop the current + $j('#embed_vid').get(0).stop(); + //stop any deferred updates: + + //force a given mvd if set + if(mvd_id){ + mv_lock_vid_updates=false; + //highlight the current / update url: + mv_stream_interface.mvdOver(mvd_id); + } + $j('#embed_vid').get(0). + //disable interface actions (mouse in out etc) + mv_lock_vid_updates=true; + //update the src if nesesary and no mvd provided: + if(!mvd_id){ + if(mv_stream_interface.cur_mvd_id!=mv_stream_interface.delay_cur_mvd_id){ + mv_stream_interface.cur_mvd_id =mv_stream_interface.delay_cur_mvd_id; + do_video_mvd_update( mv_stream_interface.cur_mvd_id ); + } + } + //check if we are out of range: + if(mvd_id){ + var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); + if( npt2seconds( time_ary[1] ) < npt2seconds( $j('#embed_vid').get(0).start_ntp ) ){ + window.location = wgArticlePath.replace( '$1', wgPageName +'/'+ time_ary[1] + '/' + time_ary[2]) + '#autoplay'; + return ; + } + } + //update the embed video actual play time + //time_chunk = $j('#embed_vid').get(0).src.split('t='); + //$j('#mv_videoPlayerTime').html( time_chunk[1] ); + //stop the video if playing and play: + $j('#embed_vid').get(0).didSeekJump=true; + //@@todo extend mv_embed to support src switching + $j('#embed_vid').get(0).play(); } //adjusts the interface to show the play controls: function mv_disp_play_controls(disp){ - js_log('mv_controls: ' + disp); - if(!org_height_vid_contain) - org_height_vid_contain = $j('#MV_VideoPlayer').height(); + js_log('mv_controls: ' + disp); + if(!org_height_vid_contain) + org_height_vid_contain = $j('#MV_VideoPlayer').height(); - if(!org_top_tool_contain) - org_top_tool_contain= parseInt($j('#MV_Tools').css('top').replace('px','')); + if(!org_top_tool_contain) + org_top_tool_contain= parseInt($j('#MV_Tools').css('top').replace('px','')); - if(disp){ - //based on the embed type give space for controls: - //@@todo pull pix_offset from players code - /*switch(embedTypes.getPlayerLib()){ - case 'java': - case 'generic': - var pix_offset= 30; - break; - case 'native': - case 'vlc': - case 'oggplay': - var pix_offset=55; - break; - }*/ - //give room for all players: - var pix_offset=55; - js_log("set con space: " + org_height_vid_contain+parseInt(pix_offset)); - $j('#MV_VideoPlayer').css({'height':(org_height_vid_contain+parseInt(pix_offset))+'px'}); - $j('#MV_StreamMeta,#MV_Tools').css({'top':(org_top_tool_contain+parseInt(pix_offset))+'px'}); - }else{ - js_log('return org height'); - $j('#MV_VideoPlayer').css({'height':org_height_vid_contain+'px'}); - $j('#MV_StreamMeta,#MV_Tools').css({'top':org_top_tool_contain+'px'}); - } + if(disp){ + //based on the embed type give space for controls: + //@@todo pull pix_offset from players code + /*switch(embedTypes.getPlayerLib()){ + case 'java': + case 'generic': + var pix_offset= 30; + break; + case 'native': + case 'vlc': + case 'oggplay': + var pix_offset=55; + break; + }*/ + //give room for all players: + var pix_offset=55; + js_log("set con space: " + org_height_vid_contain+parseInt(pix_offset)); + $j('#MV_VideoPlayer').css({'height':(org_height_vid_contain+parseInt(pix_offset))+'px'}); + $j('#MV_StreamMeta,#MV_Tools').css({'top':(org_top_tool_contain+parseInt(pix_offset))+'px'}); + }else{ + js_log('return org height'); + $j('#MV_VideoPlayer').css({'height':org_height_vid_contain+'px'}); + $j('#MV_StreamMeta,#MV_Tools').css({'top':org_top_tool_contain+'px'}); + } } //hackish globals .. needs a rewrite var mv_currently_scroll_to_pos=false; function scroll_to_pos(mvd_id){ - js_log('scroll_to_pos:'+mvd_id); - var speed = (mv_currently_scroll_to_pos)?'fast':'slow'; - if( $j('#mv_fd_mvd_'+mvd_id).get(0)){ - //@@todo debug IE issues with scrolling - $j('#selectionsBox').animate({ - scrollTop: ($j('#mv_fd_mvd_'+mvd_id).get(0).offsetTop-40) - }, - speed, - function(){ - mv_currently_scroll_to_pos=false; - }); - } + js_log('scroll_to_pos:'+mvd_id); + + var speed = (mv_currently_scroll_to_pos)?'fast':'slow'; + if( $j('#mv_fd_mvd_'+mvd_id).get(0)){ + //@@todo debug IE issues with scrolling + $j('#selectionsBox').animate({ + scrollTop: ($j('#mv_fd_mvd_'+mvd_id).get(0).offsetTop -100 ) + }, + speed, + function(){ + mv_currently_scroll_to_pos = false; + }); + } } -function highlight_fd(mvd_id){ - $j('#mv_fd_mvd_'+mvd_id).css('border','1px solid #F00'); +function highlight_fd(mvd_id){ + $j('#mv_fd_mvd_'+mvd_id).css('border','1px solid #F00'); } function de_highlight_fd(mvd_id){ - $j('#mv_fd_mvd_'+mvd_id).css('border', '1px solid #FFF'); + $j('#mv_fd_mvd_'+mvd_id).css('border', '1px solid #FFF'); } function highlight_tl_ts(mvd_id){ - //make sure we don't set the original as red: - if($j('#mv_tl_mvd_'+mvd_id).get(0)){ - if($j('#mv_tl_mvd_'+mvd_id).css('background').indexOf("red")==-1) - mv_tl_mvd_org_color[mvd_id] = $j('#mv_tl_mvd_'+mvd_id).css('background'); - //js_log(mvd_id + ' org color: ' + mv_tl_mvd_org_color[mvd_id]); - $j('#mv_tl_mvd_'+mvd_id).css({background:'red',opacity:.4}).css("z-index",10); - } + //make sure we don't set the original as red: + if($j('#mv_tl_mvd_'+mvd_id).get(0)){ + if($j('#mv_tl_mvd_'+mvd_id).css('background').indexOf("red")==-1) + mv_tl_mvd_org_color[mvd_id] = $j('#mv_tl_mvd_'+mvd_id).css('background'); + //js_log(mvd_id + ' org color: ' + mv_tl_mvd_org_color[mvd_id]); + $j('#mv_tl_mvd_'+mvd_id).css({background:'red',opacity:.4}).css("z-index",10); + } } function de_highlight_tl_ts(mvd_id){ - if(mv_tl_mvd_org_color[mvd_id]){ - if($j('#mv_tl_mvd_'+mvd_id).get(0)){ - //alert(mvd_id + ' restore ' + mv_tl_mvd_org_color[mvd_id] + ' ' + rgb2hex(mv_tl_mvd_org_color[mvd_id])); - $j('#mv_tl_mvd_'+mvd_id).css({background:mv_tl_mvd_org_color[mvd_id],opacity:1}).css("z-index",0); - } - } + if(mv_tl_mvd_org_color[mvd_id]){ + if($j('#mv_tl_mvd_'+mvd_id).get(0)){ + //alert(mvd_id + ' restore ' + mv_tl_mvd_org_color[mvd_id] + ' ' + rgb2hex(mv_tl_mvd_org_color[mvd_id])); + $j('#mv_tl_mvd_'+mvd_id).css({background:mv_tl_mvd_org_color[mvd_id],opacity:1}).css("z-index",0); + } + } } function do_video_mvd_update(mvd_id){ - if(mvd_id){ - var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); - //get the current thumbnail - var vid_elm = document.getElementById('embed_vid'); - if(!vid_elm)return ''; - //make the play button vissable again (if its hidden) : - $j('#big_play_link_embed_vid').show(); - //do_video_time_update(time_ary[1], time_ary[2],mvd_id); - var embedObj = $j('#embed_vid').get(0); - - //add coloring to stream where we would play: - $j('#embed_vid').get(0).highlightPlaySection({ - 'start': time_ary[1], - 'end': time_ary[2] - }); - } + if(mvd_id){ + var time_ary = $j('#mv_fd_mvd_'+mvd_id).attr('name').split('/'); + //get the current thumbnail + var vid_elm = document.getElementById('embed_vid'); + if(!vid_elm)return ''; + //make the play button vissable again (if its hidden) : + $j('#big_play_link_embed_vid').show(); + //do_video_time_update(time_ary[1], time_ary[2],mvd_id); + var embedObj = $j('#embed_vid').get(0); + + //add coloring to stream where we would play: + $j('#embed_vid').get(0).highlightPlaySection({ + 'start': time_ary[1], + 'end': time_ary[2] + }); + } } function mv_tool_disp(tool_id){ - //set content to loading - $j('#mv_tool_cont').html( gM('loading_txt') ); - //populate post vars with any necessary tool specific items: - var post_vars=new Object(); - if(tool_id=='navigate'||tool_id=='export'){ - //assumes stream name ends with time range - //time_range = org_vid_src.substr( org_vid_src.indexOf('?t=')+3 ); - post_vars['time_range']=org_vid_time_req; - } - //set tracks from mv var: - if(tool_id=='mang_layers'){ - post_vars['tracks']=mvTracks; - } - sajax_request_type='POST'; - //@@todo switch over to jquery ajax - mv_sajax_do_call('mv_tool_disp', [tool_id, wgNamespaceNumber, wgTitle], f, post_vars); - function f( request ) { + //set content to loading + $j('#mv_tool_cont').html( gM('loading_txt') ); + //populate post vars with any necessary tool specific items: + var post_vars=new Object(); + if(tool_id=='navigate'||tool_id=='export'){ + //assumes stream name ends with time range + //time_range = org_vid_src.substr( org_vid_src.indexOf('?t=')+3 ); + post_vars['time_range']=org_vid_time_req; + } + //set tracks from mv var: + if(tool_id=='mang_layers'){ + post_vars['tracks']=mvTracks; + } + sajax_request_type='POST'; + //@@todo switch over to jquery ajax + mv_sajax_do_call('mv_tool_disp', [tool_id, wgNamespaceNumber, wgTitle], f, post_vars); + function f( request ) { result = request.responseText; - if (request.status != 200){ - result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; - $j('#mv_tool_cont').html( result); - }else{ - //result should set up object mv_result - eval(result); - mv_proc_tool_result(tool_id, mv_result); - } - //unlock the interface updates - mv_lock_vid_updates=false; - } + if (request.status != 200){ + result= "<div class='error'> " + request.status + " " + request.statusText + ": " + result + "</div>"; + $j('#mv_tool_cont').html( result); + }else{ + //result should set up object mv_result + eval(result); + mv_proc_tool_result(tool_id, mv_result); + } + //unlock the interface updates + mv_lock_vid_updates=false; + } } function mv_proc_tool_result(tool_id, mv_result){ - if(mv_result['status']=='ok'){ - //run any request javascript call backs - //do per tool post-req js actions: - switch(tool_id){ - /*case 'navigate': - //set the content payload - $j('#mv_tool_cont').html( mv_result['innerHTML']); - eval(mv_result['js_eval']); - $j('#mv_go_nav').click(function() { - window.location.href = wgScript+ - '/'+wgPageName+'/'+$j('#mv_start_hr_nav').val()+ - '/'+$j('#mv_end_hr_nav').val(); - }); - add_adjust_hooks('nav', end_time); - break;*/ - case 'search': - //load search.js ... @@todo cleanup path - mvJsLoader.doLoad({ - 'mv_setup_search':'../mv_search.js' - },function(){ - $j('#mv_tool_cont').html( mv_result['innerHTML']); - mv_setup_search(); - }); - break; - case 'mang_layers': - $j('#mv_tool_cont').html( mv_result['innerHTML']); - //add in hooks for turnning on off layers (via click on link) - $j('a.mv_mang_layers').click(function(){ - $j('#option_'+this.id.substring(2)).get(0).checked = !$j('#option_'+this.id.substring(2)).get(0).checked; - return false; - }); - //add in function for page rewrite on submit - $j('#submit_mang_layers').click(function(){ - var track_req = coma = ''; - //build track_req: - $j('a.mv_mang_layers').each(function(){ - if($j('#option_'+this.id.substring(2)).get(0).checked){ - track_req+=coma+this.id.substring(2); - coma=','; - } - }) - window.location.href = wgScript+'/'+wgCanonicalNamespace+':'+mvTitle+'?tracks='+track_req+'&tool_disp=mang_layers'; - return false; - }); - break; - default: - //set the content payload - $j('#mv_tool_cont').html( mv_result['innerHTML']); - break; - } - }else if(mv_result['status']=='error'){ - $j('#mv_tool_cont').html( mv_result['error_txt']); - } + if(mv_result['status']=='ok'){ + //run any request javascript call backs + //do per tool post-req js actions: + switch(tool_id){ + /*case 'navigate': + //set the content payload + $j('#mv_tool_cont').html( mv_result['innerHTML']); + eval(mv_result['js_eval']); + $j('#mv_go_nav').click(function() { + window.location.href = wgScript+ + '/'+wgPageName+'/'+$j('#mv_start_hr_nav').val()+ + '/'+$j('#mv_end_hr_nav').val(); + }); + add_adjust_hooks('nav', end_time); + break;*/ + case 'search': + //load search.js ... @@todo cleanup path + mvJsLoader.doLoad({ + 'mv_setup_search':'../mv_search.js' + },function(){ + $j('#mv_tool_cont').html( mv_result['innerHTML']); + mv_setup_search(); + }); + break; + case 'mang_layers': + $j('#mv_tool_cont').html( mv_result['innerHTML']); + //add in hooks for turnning on off layers (via click on link) + $j('a.mv_mang_layers').click(function(){ + $j('#option_'+this.id.substring(2)).get(0).checked = !$j('#option_'+this.id.substring(2)).get(0).checked; + return false; + }); + //add in function for page rewrite on submit + $j('#submit_mang_layers').click(function(){ + var track_req = coma = ''; + //build track_req: + $j('a.mv_mang_layers').each(function(){ + if($j('#option_'+this.id.substring(2)).get(0).checked){ + track_req+=coma+this.id.substring(2); + coma=','; + } + }) + window.location.href = wgScript+'/'+wgCanonicalNamespace+':'+mvTitle+'?tracks='+track_req+'&tool_disp=mang_layers'; + return false; + }); + break; + default: + //set the content payload + $j('#mv_tool_cont').html( mv_result['innerHTML']); + break; + } + }else if(mv_result['status']=='error'){ + $j('#mv_tool_cont').html( mv_result['error_txt']); + } } /* js functions that are slight modification of * existing mediawiki code (if adopted upstream these can be removed) @@ -1101,184 +1105,184 @@ function mv_proc_tool_result(tool_id, mv_result){ */ //added in payload submit single dimension key.value pair object: function mv_sajax_do_call(func_name, args, target, post_vars) { - var i, x, n; - var uri; - var post_data; - uri = wgServer + - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + - "?action=ajax"; - if (sajax_request_type == "GET") { - if (uri.indexOf("?") == -1) - uri = uri + "?rs=" + encodeURIComponent(func_name); - else - uri = uri + "&rs=" + encodeURIComponent(func_name); - for (i = 0; i < args.length; i++) - uri = uri + "&rsargs[]=" + encodeURIComponent(args[i]); - //uri = uri + "&rsrnd=" + new Date().getTime(); - post_data = null; - } else { - post_data = "rs=" + encodeURIComponent(func_name); - for (i = 0; i < args.length; i++) - post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); - //for (i = 0; i < args.length; i++) - // post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); - } - x = sajax_init_object(); - if (!x) { - alert("AJAX not supported"); - return false; - } + var i, x, n; + var uri; + var post_data; + uri = wgServer + + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript) + + "?action=ajax"; + if (sajax_request_type == "GET") { + if (uri.indexOf("?") == -1) + uri = uri + "?rs=" + encodeURIComponent(func_name); + else + uri = uri + "&rs=" + encodeURIComponent(func_name); + for (i = 0; i < args.length; i++) + uri = uri + "&rsargs[]=" + encodeURIComponent(args[i]); + //uri = uri + "&rsrnd=" + new Date().getTime(); + post_data = null; + } else { + post_data = "rs=" + encodeURIComponent(func_name); + for (i = 0; i < args.length; i++) + post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); + //for (i = 0; i < args.length; i++) + // post_data = post_data + "&rsargs[]=" + encodeURIComponent(args[i]); + } + x = sajax_init_object(); + if (!x) { + alert("AJAX not supported"); + return false; + } - try { - x.open(sajax_request_type, uri, true); - } catch (e) { - if (window.location.hostname == "localhost") { - alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing."); - } - throw e; - } - if (sajax_request_type == "POST") { - x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); - x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - } - x.setRequestHeader("Pragma", "cache=yes"); - x.setRequestHeader("Cache-Control", "no-transform"); - x.onreadystatechange = function() { - if (x.readyState != 4) - return; + try { + x.open(sajax_request_type, uri, true); + } catch (e) { + if (window.location.hostname == "localhost") { + alert("Your browser blocks XMLHttpRequest to 'localhost', try using a real hostname for development/testing."); + } + throw e; + } + if (sajax_request_type == "POST") { + x.setRequestHeader("Method", "POST " + uri + " HTTP/1.1"); + x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + } + x.setRequestHeader("Pragma", "cache=yes"); + x.setRequestHeader("Cache-Control", "no-transform"); + x.onreadystatechange = function() { + if (x.readyState != 4) + return; - sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText); + sajax_debug("received (" + x.status + " " + x.statusText + ") " + x.responseText); - //if (x.status != 200) - // alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText); - //else + //if (x.status != 200) + // alert("Error: " + x.status + " " + x.statusText + ": " + x.responseText); + //else - if ( typeof( target ) == 'function' ) { - target( x ); - } - else if ( typeof( target ) == 'object' ) { - if ( target.tagName == 'INPUT' ) { - if (x.status == 200) target.value= x.responseText; - //else alert("Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")"); - } - else { - if (x.status == 200) target.innerHTML = x.responseText; - else target.innerHTML= "<div class='error'>Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")</div>"; - } - } - else { - alert("bad target for sajax_do_call: not a function or object: " + target); - } + if ( typeof( target ) == 'function' ) { + target( x ); + } + else if ( typeof( target ) == 'object' ) { + if ( target.tagName == 'INPUT' ) { + if (x.status == 200) target.value= x.responseText; + //else alert("Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")"); + } + else { + if (x.status == 200) target.innerHTML = x.responseText; + else target.innerHTML= "<div class='error'>Error: " + x.status + " " + x.statusText + " (" + x.responseText + ")</div>"; + } + } + else { + alert("bad target for sajax_do_call: not a function or object: " + target); + } - return; - } - //add payload to post data (as long as i does not equal rs or rsargs - if(post_vars){ - for(var i in post_vars){ - if(i!='rs' && i!='rsargs') - post_data+= '&'+ i +'='+ encodeURIComponent(post_vars[i]); - } - } - //js_log(func_name + " uri = " + uri + " / post = " + post_data); - x.send(post_data); - sajax_debug(func_name + " waiting.."); - delete x; + return; + } + //add payload to post data (as long as i does not equal rs or rsargs + if(post_vars){ + for(var i in post_vars){ + if(i!='rs' && i!='rsargs') + post_data+= '&'+ i +'='+ encodeURIComponent(post_vars[i]); + } + } + //js_log(func_name + " uri = " + uri + " / post = " + post_data); + x.send(post_data); + sajax_debug(func_name + " waiting.."); + delete x; - return true; + return true; } /* * togle advanced and simply display of mvd annotation edits */ function mv_mvd_advs_toggle(mvd_id){ - js_log('form val:#adv_basic_'+mvd_id+' '+$j('#adv_basic_'+mvd_id).val()); - if($j('#adv_basic_'+mvd_id).val()=='basic'){ - js_log('form is currently basic; SET to ADV'); - //set to advanced - $j('#adv_basic_'+mvd_id).val('advanced'); - //hide all basic - $j('.mv_basic_edit').fadeOut('fast'); - //show all advanced - $j('.mv_advanced_edit').fadeIn('fast'); - }else{ - js_log('form is currently advanced; SET to basic'); - //set to basic - $j('#adv_basic_'+mvd_id).val('basic'); - //hide all advanced - $j('.mv_advanced_edit').fadeOut('fast'); - //show all basic - $j('.mv_basic_edit').fadeIn('fast'); - } + js_log('form val:#adv_basic_'+mvd_id+' '+$j('#adv_basic_'+mvd_id).val()); + if($j('#adv_basic_'+mvd_id).val()=='basic'){ + js_log('form is currently basic; SET to ADV'); + //set to advanced + $j('#adv_basic_'+mvd_id).val('advanced'); + //hide all basic + $j('.mv_basic_edit').fadeOut('fast'); + //show all advanced + $j('.mv_advanced_edit').fadeIn('fast'); + }else{ + js_log('form is currently advanced; SET to basic'); + //set to basic + $j('#adv_basic_'+mvd_id).val('basic'); + //hide all advanced + $j('.mv_advanced_edit').fadeOut('fast'); + //show all basic + $j('.mv_basic_edit').fadeIn('fast'); + } } /* custom effects */ /*function add_custom_effects(){ - Effect.ScrollVertical = Class.create(); - Object.extend(Object.extend(Effect.ScrollVertical.prototype, Effect.Base.prototype), - { - initialize: function(element) - { - if(typeof element == "string") - { - this.element = $(element); - if(!this.element) - { - throw(Effect._elementDoesNotExistError); - } - } + Effect.ScrollVertical = Class.create(); + Object.extend(Object.extend(Effect.ScrollVertical.prototype, Effect.Base.prototype), + { + initialize: function(element) + { + if(typeof element == "string") + { + this.element = $(element); + if(!this.element) + { + throw(Effect._elementDoesNotExistError); + } + } - var options = Object.extend({ - from: this.element.scrollTop || 0, - to: this.element.offsetHeight - }, arguments[1] || {}); - //set to pos via target if set - if(options.target){ - target_elm = $(options.target); - Position.prepare(target_elm); - to_ary=Position.positionedOffset(target_elm); - //@@todo subtract 1/2 of height of container (as to center) - //for now just hardcode 227 - options.to = to_ary[1]-227; - } - /*target_elm = $(options.target); - if(!target_elm)js_log('wft'+ options.target); - //Position.absolutize(target_elm); - if(options.target)js_log(Position.positionedOffset(target_elm) ); - */ /* - this.start(options); - }, + var options = Object.extend({ + from: this.element.scrollTop || 0, + to: this.element.offsetHeight + }, arguments[1] || {}); + //set to pos via target if set + if(options.target){ + target_elm = $(options.target); + Position.prepare(target_elm); + to_ary=Position.positionedOffset(target_elm); + //@@todo subtract 1/2 of height of container (as to center) + //for now just hardcode 227 + options.to = to_ary[1]-227; + } + /*target_elm = $(options.target); + if(!target_elm)js_log('wft'+ options.target); + //Position.absolutize(target_elm); + if(options.target)js_log(Position.positionedOffset(target_elm) ); + */ /* + this.start(options); + }, - update: function(position) - { - this.element.scrollTop = position; - } - }); + update: function(position) + { + this.element.scrollTop = position; + } + }); - Effect.ScrollHorizontal = Class.create(); - Object.extend(Object.extend(Effect.ScrollHorizontal.prototype, Effect.Base.prototype), - { - initialize: function(element) - { - if(typeof element == "string") - { - this.element = $(element); - if(!this.element) - { - throw(Effect._elementDoesNotExistError); - } - } + Effect.ScrollHorizontal = Class.create(); + Object.extend(Object.extend(Effect.ScrollHorizontal.prototype, Effect.Base.prototype), + { + initialize: function(element) + { + if(typeof element == "string") + { + this.element = $(element); + if(!this.element) + { + throw(Effect._elementDoesNotExistError); + } + } - var options = Object.extend({ - from: this.element.scrollLeft || 0, - to: this.element.offsetWidth - }, arguments[1] || {}); + var options = Object.extend({ + from: this.element.scrollLeft || 0, + to: this.element.offsetWidth + }, arguments[1] || {}); - this.start(options); - }, + this.start(options); + }, - update: function(position) - { - this.element.scrollLeft = position; - } - }); + update: function(position) + { + this.element.scrollLeft = position; + } + }); } */ diff --git a/rev51560/w/extensions/MetavidWiki/skins/mv_search.js b/gchriss/w/extensions/MetavidWiki/skins/mv_search.js index 9f46f15..282a024 100755 --- a/rev51560/w/extensions/MetavidWiki/skins/mv_search.js +++ b/gchriss/w/extensions/MetavidWiki/skins/mv_search.js @@ -3,324 +3,321 @@ var mvSearchSetupFlag =false; var maxFilters = 8; var mv_search_action=''; function mv_pre_setup_search(req_mode){ - //make sure we have jQuery and any base required libs: - mvJsLoader.jQueryCheck(function(){ - mv_setup_search(req_mode); - }); + //make sure we have jQuery and any base required libs: + mvJsLoader.jQueryCheck(function(){ + mv_setup_search(req_mode); + }); } function mv_setup_search(req_mode){ - if(!mvSearchSetupFlag) - mv_do_setup_search(req_mode); - mvSearchSetupFlag=true; + if(!mvSearchSetupFlag) + mv_do_setup_search(req_mode); + mvSearchSetupFlag=true; } -function mv_do_setup_search(req_mode){ - js_log('f:mv_setup_search: '); - add_highlight_function(); - //look for existing auto completes: - for(i=0;i<maxFilters;i++){ - if( $j('#mv_person_input_'+i).get(0)){ - mv_add_person_ac(i); - } - } - //if in ajax req mode (re-write "run_search" button) - if(req_mode=='ajax'){ - //store action - mv_search_action = $j('#mv_media_search').attr('action'); - //change form action - $j('#mv_media_search').attr('action','javascript:mv_do_ajax_search()'); - } +function mv_do_setup_search(req_mode){ + js_log('f:mv_setup_search: '); + add_highlight_function(); + //look for existing auto completes: + for(i=0;i<maxFilters;i++){ + if( $j('#mv_person_input_'+i).get(0)){ + mv_add_person_ac(i); + } + } + //if in ajax req mode (re-write "run_search" button) + if(req_mode=='ajax'){ + //store action + mv_search_action = $j('#mv_media_search').attr('action'); + //change form action + $j('#mv_media_search').attr('action','javascript:mv_do_ajax_search()'); + } - //look for search results (enable button actions) - $j('.mv_stream_play_button').click(function(){ - window.location.href = wgScript+ '/'+ - $j(this).attr('name'); - }) - //set up bindings for existing date range: - if(typeof mvDateInitObj!='undefined'){ - $j('.mv_search_select').each(function(){ - //get mv_sel_# number - id_parts = $j(this).attr('id').split('_'); - var type = id_parts[1]; - var inx = id_parts[2]; - //js_log('looking at: '+ $j("#"+this.id+" option:selected").val()) - if($j("#"+this.id+" option:selected").val()=='date_range'){ - add_date_binddings(inx, mvDateInitObj); - } - }); - }else{ - js_log('mvDateInitObj is undefined'); - } - //remove all old search_text bindings: - $j('.mv_search_select').unbind(); - //set up actions: - $j('.mv_search_select').each(function(){ - js_log("SHOULD ADD change for: " + this.id); - }); - $j('.mv_search_select').change(function(){ - js_log('mv_search_select:' + $j("#"+this.id+" option:selected").val()); - //get mv_sel_# number - id_parts = $j(this).attr('id').split('_'); - var type = id_parts[1]; - var inx = id_parts[2]; - js_log("id: "+$j(this).attr('id')+" got t:" + type+ ' Index:' + inx + ' val:' + $j("#"+this.id + " option:selected").val() ); - switch($j("#"+this.id+" option:selected").val()){ - case 'category': - $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text"' + - 'size="9" type="text" name="f['+inx+'][v]" value="" >'); - //@@todo add autocomplete for category names - break; - case 'stream_name': - $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text" ' + - 'size="9" type="text" name="f['+inx+'][v]" value="" >'); - ////@@todo add autocomplete for stream name - break; - case 'match': - //match text is special cuz it gets highlighted in resutls with class: mv_hl_text - $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text mv_hl_text" ' + - 'size="9" type="text" name="f['+inx+'][v]" value="" >'); - break; - case 'date_range': + //look for search results (enable button actions) + $j('.mv_stream_play_button').click(function(){ + window.location.href = wgScript+ '/'+ + $j(this).attr('name'); + }) + //set up bindings for existing date range: + if(typeof mvDateInitObj!='undefined'){ + $j('.mv_search_select').each(function(){ + //get mv_sel_# number + id_parts = $j(this).attr('id').split('_'); + var type = id_parts[1]; + var inx = id_parts[2]; + //js_log('looking at: '+ $j("#"+this.id+" option:selected").val()) + if($j("#"+this.id+" option:selected").val()=='date_range'){ + add_date_binddings(inx, mvDateInitObj); + } + }); + }else{ + js_log('mvDateInitObj is undefined'); + } + //remove all old search_text bindings: + $j('.mv_search_select').unbind(); + //set up actions: + $j('.mv_search_select').each(function(){ + js_log("SHOULD ADD change for: " + this.id); + }); + $j('.mv_search_select').change(function(){ + js_log('mv_search_select:' + $j("#"+this.id+" option:selected").val()); + //get mv_sel_# number + id_parts = $j(this).attr('id').split('_'); + var type = id_parts[1]; + var inx = id_parts[2]; + js_log("id: "+$j(this).attr('id')+" got t:" + type+ ' Index:' + inx + ' val:' + $j("#"+this.id + " option:selected").val() ); + switch($j("#"+this.id+" option:selected").val()){ + case 'category': + $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text"' + + 'size="9" type="text" name="f['+inx+'][v]" value="" >'); + //@@todo add autocomplete for category names + break; + case 'stream_name': + $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text" ' + + 'size="9" type="text" name="f['+inx+'][v]" value="" >'); + ////@@todo add autocomplete for stream name + break; + case 'match': + //match text is special cuz it gets highlighted in resutls with class: mv_hl_text + $j('#mvs_'+inx+'_tc').html('<input class="mv_search_text mv_hl_text" ' + + 'size="9" type="text" name="f['+inx+'][v]" value="" >'); + break; + case 'date_range': $j('#mvs_'+inx+'_tc').html( gM('loading_txt') ); - var load_js_set = { 'Date.fromString':'jquery/plugins/date.js', - '$j.fn.datePicker':'jquery/plugins/jquery.datePicker.js'}; - if(embedTypes.msie6){ - js_log('using IE v6 need iframe as well'); - load_js_set['$j.fn.bgIframe'] = 'jquery/plugins/jquery.bgiframe.js'; - } + //@@todo refactor to new date range method + var load_js_set = ['$j.fn.datePicker']; uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + mvJsLoader.doLoad(load_js_set,function(){ - searchDateObj = $j.get(uri, - {action:'ajax',rs:'mv_date_obj'}, - function(data){ - eval(data); - if(mv_result){ - //we ave to load the jQuery date plugin & the date_range data set (and mesg) - $j('#mvs_'+inx+'_tc').html('<input class="date-pick_'+inx+' mv_search_text" '+ - 'size="9" type="text" id="vs_'+inx+'" name="f['+inx+'][vs]" value="" > to ' + - '<input class="date-pick_'+inx+' mv_search_text" '+ - 'size="9" type="text" id="ve_'+inx+'" name="f['+inx+'][ve]" value="" >'); - add_date_binddings(inx, mv_result); - } - }); - }); - break; - case 'bill': - $j('#mvs_'+inx+'_tc').html('<input onclick="this.value=\'\';" size="35" id="mv_bill_input_' + inx + - '" class="mv_search_text" ' + - 'size="9" type="text" name="f['+inx+'][v]" value="" >' + - '<div class="autocomplete" id="mv_bill_choices_'+inx+'" style="display: none;"/>'); - //add a bill autocomplete: - mv_add_bill_ac(inx); - break; - case 'spoken_by': - $j('#mvs_'+inx+'_tc').html( $j('#mv_person') - .clone().css('display','inline').attr('id', 'mv_person_'+inx).children().each(function(){ - //append the inx to each: - $j(this).attr('id', $j(this).attr('id')+'_'+inx); - js_log('' + this.id); - })); - //update the input name: - $j('#mv_person_input_'+inx).attr({'name':'f['+inx+'][v]', 'onclick':'this.value=\'\';'}); - //for more logical default behavior: - //default to OR if any other "spoken by" are present in list else AND - var default_sel_inx=0; - $j('.mv_search_select').each(function(){ - if(this.id!='mvsel_t_'+inx){ - if(this.value=='spoken_by'){ - default_sel_inx=1; //set to OR - } - } - }) - $j('#mvsel_a_'+inx).get(0).selectedIndex=default_sel_inx; - mv_add_person_ac(inx); - break; - case 'smw_property': - break; - default: - js_log('no select action for:'+ $j("#"+this.id+" option:selected").val()); - break; - }; - }); + searchDateObj = $j.get(uri, + {action:'ajax',rs:'mv_date_obj'}, + function(data){ + eval(data); + if(mv_result){ + //we ave to load the jQuery date plugin & the date_range data set (and mesg) + $j('#mvs_'+inx+'_tc').html('<input class="date-pick_'+inx+' mv_search_text" '+ + 'size="9" type="text" id="vs_'+inx+'" name="f['+inx+'][vs]" value="" > to ' + + '<input class="date-pick_'+inx+' mv_search_text" '+ + 'size="9" type="text" id="ve_'+inx+'" name="f['+inx+'][ve]" value="" >'); + add_date_binddings(inx, mv_result); + } + }); + }); + break; + case 'bill': + $j('#mvs_'+inx+'_tc').html('<input onclick="this.value=\'\';" size="35" id="mv_bill_input_' + inx + + '" class="mv_search_text" ' + + 'size="9" type="text" name="f['+inx+'][v]" value="" >' + + '<div class="autocomplete" id="mv_bill_choices_'+inx+'" style="display: none;"/>'); + //add a bill autocomplete: + mv_add_bill_ac(inx); + break; + case 'spoken_by': + $j('#mvs_'+inx+'_tc').html( $j('#mv_person') + .clone().css('display','inline').attr('id', 'mv_person_'+inx).children().each(function(){ + //append the inx to each: + $j(this).attr('id', $j(this).attr('id')+'_'+inx); + js_log('' + this.id); + })); + //update the input name: + $j('#mv_person_input_'+inx).attr({'name':'f['+inx+'][v]', 'onclick':'this.value=\'\';'}); + //for more logical default behavior: + //default to OR if any other "spoken by" are present in list else AND + var default_sel_inx=0; + $j('.mv_search_select').each(function(){ + if(this.id!='mvsel_t_'+inx){ + if(this.value=='spoken_by'){ + default_sel_inx=1; //set to OR + } + } + }) + $j('#mvsel_a_'+inx).get(0).selectedIndex=default_sel_inx; + mv_add_person_ac(inx); + break; + case 'smw_property': + break; + default: + js_log('no select action for:'+ $j("#"+this.id+" option:selected").val()); + break; + }; + }); } function mv_do_ajax_search(){ - js_log('mv_do_ajax_search '); - //build req url: - var req_query=(mv_search_action.indexOf('?')!==-1)?'&':'?'; - req_query+= 'seq_inline=true'; - $j('#mv_media_search :input').each(function(){ - if($j(this).attr('name')){ - req_query+='&'+$j(this).attr('name')+'='+$j(this).val(); - } - }); - mv_do_ajax_search_request( mv_search_action+ req_query); + js_log('mv_do_ajax_search '); + //build req url: + var req_query=(mv_search_action.indexOf('?')!==-1)?'&':'?'; + req_query+= 'seq_inline=true'; + $j('#mv_media_search :input').each(function(){ + if($j(this).attr('name')){ + req_query+='&'+$j(this).attr('name')+'='+$j(this).val(); + } + }); + mv_do_ajax_search_request( mv_search_action+ req_query); } function mv_do_ajax_search_request(url){ - //(don't) annimate the transition: - //$j('#mv_search_results_container').fadeOut(function(){ - //}); - $j('#mv_search_results_container').html(gM('loading_txt')); - $j.get(url, function(data){ - //populate results - $j('#mv_search_results_container').html(data); - //run callback: - if(typeof mv_ajax_search_callback == 'function'){ - mv_ajax_search_callback(); - }else{ - js_log('ajax_search_callback type was: '+ typeof mv_ajax_search_callback); - } - }); + //(don't) annimate the transition: + //$j('#mv_search_results_container').fadeOut(function(){ + //}); + $j('#mv_search_results_container').html(gM('loading_txt')); + $j.get(url, function(data){ + //populate results + $j('#mv_search_results_container').html(data); + //run callback: + if(typeof mv_ajax_search_callback == 'function'){ + mv_ajax_search_callback(); + }else{ + js_log('ajax_search_callback type was: '+ typeof mv_ajax_search_callback); + } + }); } function add_date_binddings(inx, mvDateInitObj){ - //@@todo load the date format from the server - Date.format = 'mm/dd/yyyy'; - //populate with default start and end times (if empty): - $j('.date-pick_'+inx).each(function(){ - if($j(this).attr('name')=='f[1][vs]'){ - if($j(this).val()=='')$j(this).val(mvDateInitObj['sd']); - }else{ - if($j(this).val()=='')$j(this).val(mvDateInitObj['ed']); - } - //update start end times: - d = new Date($j(this).val()); - if($j(this).id=='vs_'+inx){ - $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); - }else if($j(this).id=='ve_'+inx){ - $j('#vs_'+inx).dpSetStartDate(d.addDays(-1).asString()); - } - }).trigger('change');//apply the current val as selected date - //set up date range: - $j('.date-pick_'+inx).datePicker({ - clickInput:true, - startDate:mvDateInitObj['sd'], - endDate:mvDateInitObj['ed'], - renderCallback:function($td, thisDate, month, year){ - //@@todo fix upstream...month seems to be off by 1 ? or it starts at 0? - month= thisDate.getMonth()+1; - //js_log('renderCallback: '+ thisDate.getDate() +' '+ month +' '+ year ); - //js_log(mvDateInitObj['sdays']); - //check if thisDate is in db (mvDateInitObj) - if(typeof mvDateInitObj['sdays'][year] != 'undefined'){ - if(typeof mvDateInitObj['sdays'][year][month] != 'undefined'){ - if(typeof mvDateInitObj['sdays'][year][month][thisDate.getDate()]!='undefined'){ - js_log("FOUND date match" + thisDate.getDate()); - $td.addClass('has_streams'); - $td.attr('title',mvDateInitObj['sdays'][year][month][thisDate.getDate()] + ' Streams'); - } - } - } - } - }); - //eliminate the "chose date text (don't ask why we need 4 's) - $j('.dp-choose-date').html(' '); + //@@todo load the date format from the server + Date.format = 'mm/dd/yyyy'; + //populate with default start and end times (if empty): + $j('.date-pick_'+inx).each(function(){ + if($j(this).attr('name')=='f[1][vs]'){ + if($j(this).val()=='')$j(this).val(mvDateInitObj['sd']); + }else{ + if($j(this).val()=='')$j(this).val(mvDateInitObj['ed']); + } + //update start end times: + d = new Date($j(this).val()); + if($j(this).id=='vs_'+inx){ + $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); + }else if($j(this).id=='ve_'+inx){ + $j('#vs_'+inx).dpSetStartDate(d.addDays(-1).asString()); + } + }).trigger('change');//apply the current val as selected date + //set up date range: + $j('.date-pick_'+inx).datePicker({ + clickInput:true, + startDate:mvDateInitObj['sd'], + endDate:mvDateInitObj['ed'], + renderCallback:function($td, thisDate, month, year){ + //@@todo fix upstream...month seems to be off by 1 ? or it starts at 0? + month= thisDate.getMonth()+1; + //js_log('renderCallback: '+ thisDate.getDate() +' '+ month +' '+ year ); + //js_log(mvDateInitObj['sdays']); + //check if thisDate is in db (mvDateInitObj) + if(typeof mvDateInitObj['sdays'][year] != 'undefined'){ + if(typeof mvDateInitObj['sdays'][year][month] != 'undefined'){ + if(typeof mvDateInitObj['sdays'][year][month][thisDate.getDate()]!='undefined'){ + js_log("FOUND date match" + thisDate.getDate()); + $td.addClass('has_streams'); + $td.attr('title',mvDateInitObj['sdays'][year][month][thisDate.getDate()] + ' Streams'); + } + } + } + } + }); + //eliminate the "chose date text (don't ask why we need 4 's) + $j('.dp-choose-date').html(' '); - //add cell render function cb (to show which days have videos) + //add cell render function cb (to show which days have videos) - //bind start date end date ranges (so you can select invalid date range): - $j('#vs_'+inx).bind( - 'dpClosed', - function(e, selectedDates) - { - var d = selectedDates[0]; - if (d) { - d = new Date(d); - $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); - } - } - ); - $j('#ve_'+inx).bind( - 'dpClosed', - function(e, selectedDates) - { - var d = selectedDates[0]; - if (d) { - d = new Date(d); - $j('#vs_'+inx).dpSetEndDate(d.addDays(-1).asString()); - } - } - ); + //bind start date end date ranges (so you can select invalid date range): + $j('#vs_'+inx).bind( + 'dpClosed', + function(e, selectedDates) + { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $j('#ve_'+inx).dpSetStartDate(d.addDays(1).asString()); + } + } + ); + $j('#ve_'+inx).bind( + 'dpClosed', + function(e, selectedDates) + { + var d = selectedDates[0]; + if (d) { + d = new Date(d); + $j('#vs_'+inx).dpSetEndDate(d.addDays(-1).asString()); + } + } + ); } function mv_pl(mvd_id){ - uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); - $j.get(uri, - {action:'ajax',rs:'mv_pl_wt', "rsargs[0]":mvd_id, 'size':'small'}, - function(data){ - //run highlighter on data: - //js_log('set to: '+ data); - $j('#mvimg_'+mvd_id).html(data); - //rewrite video tag: - rewrite_by_id('vid_'+mvd_id); - }); + uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + $j.get(uri, + {action:'ajax',rs:'mv_pl_wt', "rsargs[0]":mvd_id, 'size':'small'}, + function(data){ + //run highlighter on data: + //js_log('set to: '+ data); + $j('#mvimg_'+mvd_id).html(data); + //rewrite video tag: + rewrite_by_id('vid_'+mvd_id); + }); } function mv_ex(mvd_id){ - uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); - js_log('expand ' + mvd_id); - //swap the image: - img_parts = $j('#mv_img_ex_'+mvd_id).attr('src').split('/'); - if(img_parts.pop()=='closed.png'){ - //$j('#mvr_desc_'+mvd_id).fadeOut('fast'); + uri = wgServer +((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + js_log('expand ' + mvd_id); + //swap the image: + img_parts = $j('#mv_img_ex_'+mvd_id).attr('src').split('/'); + if(img_parts.pop()=='closed.png'){ + //$j('#mvr_desc_'+mvd_id).fadeOut('fast'); - $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/opened.png'); - $j('#mv_watch_clip_'+mvd_id).fadeOut('fast', function(){ - $j('#mv_close_clip_'+mvd_id).fadeIn('fast'); - }); + $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/opened.png'); + $j('#mv_watch_clip_'+mvd_id).fadeOut('fast', function(){ + $j('#mv_close_clip_'+mvd_id).fadeIn('fast'); + }); - $j('#mvr_'+mvd_id).css('display', 'block').html( gM('loading_txt') ); - //grab search terms: - var terms=''; - $j('.mv_hl_text').each(function(){ - terms+='|'+$j(this).val().replace(/|/, ''); - }); - $j.get(uri, - {action:'ajax',rs:'mv_expand_wt', "rsargs[0]":mvd_id, "st":terms}, - function(data){ - //run highlighter on data: - //js_log('set to: '+ data); - $j('#mvr_'+mvd_id).html(data); - hl_search_terms('#mvr_'+mvd_id); - //rewrite video tag: - rewrite_by_id('vid_'+mvd_id); - }); - }else{ - $j('#mv_close_clip_'+mvd_id).fadeOut('fast', function(){ - $j('#mv_watch_clip_'+mvd_id).fadeIn('fast'); - }); - //$j('#mvr_desc_'+mvd_id).fadeIn('fast'); - //$j('#vrdesc_'+mvd_id).fadeIn('fast'); - $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/closed.png'); - $j('#mvr_'+mvd_id).css('display', 'none'); - } + $j('#mvr_'+mvd_id).css('display', 'block').html( gM('loading_txt') ); + //grab search terms: + var terms=''; + $j('.mv_hl_text').each(function(){ + terms+='|'+$j(this).val().replace(/|/, ''); + }); + $j.get(uri, + {action:'ajax',rs:'mv_expand_wt', "rsargs[0]":mvd_id, "st":terms}, + function(data){ + //run highlighter on data: + //js_log('set to: '+ data); + $j('#mvr_'+mvd_id).html(data); + hl_search_terms('#mvr_'+mvd_id); + //rewrite video tag: + rewrite_by_id('vid_'+mvd_id); + }); + }else{ + $j('#mv_close_clip_'+mvd_id).fadeOut('fast', function(){ + $j('#mv_watch_clip_'+mvd_id).fadeIn('fast'); + }); + //$j('#mvr_desc_'+mvd_id).fadeIn('fast'); + //$j('#vrdesc_'+mvd_id).fadeIn('fast'); + $j('#mv_img_ex_'+mvd_id).attr('src', img_parts.join('/') + '/closed.png'); + $j('#mvr_'+mvd_id).css('display', 'none'); + } } function hl_search_terms(result_selector){ - //get all the terms - var terms = new Array(); + //get all the terms + var terms = new Array(); - $j('.mv_hl_text').each(function(){ - js_log('on val: '+ $j(this).val()); - //do_node_replace($j(result_selector).get(0), $j(this).val()); - result = $j(this).val().replace(/\'|"/g, ''); + $j('.mv_hl_text').each(function(){ + js_log('on val: '+ $j(this).val()); + //do_node_replace($j(result_selector).get(0), $j(this).val()); + result = $j(this).val().replace(/\'|"/g, ''); result = result.split(/[\s,\+\.]+/); for(i=0;i<result.length;i++){ - terms.push( result[i].toUpperCase() ); + terms.push( result[i].toUpperCase() ); } - }); - $j(result_selector).each(function(){ - for(i in terms){ - term = terms[i]; - //js_log("do hl call: "+ term); - $j.highlight(this, term); - } - }); + }); + $j(result_selector).each(function(){ + for(i in terms){ + term = terms[i]; + //js_log("do hl call: "+ term); + $j.highlight(this, term); + } + }); - //if(terms.length!=0){ - //var regex = new RegExp().compile('('+terms.join('|')+')', "ig"); - //console.log(terms + ' reex: ' + regex); - //$j(result_selector).each(function(){ - // $j(this).html($j(this).html().replace(regex, '<span class="hl_term">$1</span>')); - //}); - //} + //if(terms.length!=0){ + //var regex = new RegExp().compile('('+terms.join('|')+')', "ig"); + //console.log(terms + ' reex: ' + regex); + //$j(result_selector).each(function(){ + // $j(this).html($j(this).html().replace(regex, '<span class="hl_term">$1</span>')); + //}); + //} } /*function do_node_replace(node, te) { js_log('n_id:'+ node.id +' '+ node.tagName +' inner:'+ node.innerHTML); @@ -352,96 +349,96 @@ function mv_add_ac(id){ //@@todo should group autocompletes.. // and abstract auto_complete functions from mv_stream.js to mv_common.js function mv_add_bill_ac(inx){ - uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); - js_log('looking for: '+ '#mv_bill_choices_'+inx); - $j('#mv_bill_choices_'+inx).prependTo("body"); - $j('#mv_bill_input_'+inx).autocomplete( - uri, - { - autoFill:true, - onItemSelect:function(v){ - js_log('selected:' + v.innerHTML ); - //update the image: - $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); - }, - matchSubset:0, - extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:'smw_bill'}, - paramName:'rsargs[]', - resultElem:'#mv_bill_choices_'+inx - }); - $j('#mv_bill_choices_'+inx).css({ - 'left':$j('#mv_bill_input_'+inx).get(0).offsetLeft, - 'top':$j('#mv_bill_input_'+inx).get(0).offsetTop + $j('#mv_bill_input_'+inx).height()+6 }); + uri = wgServer + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + js_log('looking for: '+ '#mv_bill_choices_'+inx); + $j('#mv_bill_choices_'+inx).prependTo("body"); + $j('#mv_bill_input_'+inx).autocomplete( + uri, + { + autoFill:true, + onItemSelect:function(v){ + js_log('selected:' + v.innerHTML ); + //update the image: + $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); + }, + matchSubset:0, + extraParams:{action:'ajax',rs:'mv_helpers_auto_complete',prop_name:'smw_bill'}, + paramName:'rsargs[]', + resultElem:'#mv_bill_choices_'+inx + }); + $j('#mv_bill_choices_'+inx).css({ + 'left':$j('#mv_bill_input_'+inx).get(0).offsetLeft, + 'top':$j('#mv_bill_input_'+inx).get(0).offsetTop + $j('#mv_bill_input_'+inx).height()+6 }); } function mv_add_person_ac(inx){ - //now add the auto complete to mv_person_input_{inx} - uri = wgServer + - ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); + //now add the auto complete to mv_person_input_{inx} + uri = wgServer + + ((wgServer == null) ? (wgScriptPath + "/index.php") : wgScript); - //pop mv_person_choices_ out to body (to put it on top) - $j('#mv_person_choices_'+inx).prependTo("body"); + //pop mv_person_choices_ out to body (to put it on top) + $j('#mv_person_choices_'+inx).prependTo("body"); - $j('#mv_person_input_'+inx).autocomplete( - uri, - { - autoFill:true, - onItemSelect:function(v){ - js_log('selected:' + v.innerHTML ); - //update the image: - $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); - //update the text: - $j('#mv_person_input_'+inx).val( $j('#mv_person_input_'+inx).val().replace('_', ' ') ); - }, - formatItem:function(row){ - //return '<img width="44" src="'+ row[2] + '">'+row[1]; - return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; + $j('#mv_person_input_'+inx).autocomplete( + uri, + { + autoFill:true, + onItemSelect:function(v){ + js_log('selected:' + v.innerHTML ); + //update the image: + $j('#mv_person_img_'+inx).attr('src', $j(v).children('img').attr('src')); + //update the text: + $j('#mv_person_input_'+inx).val( $j('#mv_person_input_'+inx).val().replace('_', ' ') ); + }, + formatItem:function(row){ + //return '<img width="44" src="'+ row[2] + '">'+row[1]; + return '<img width="44" src="'+ row[2] + '"><span class="ac_img_txt">'+row[1]+'</span>'; - }, - matchSubset:0, - extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, - paramName:'rsargs[]', - resultElem:'#mv_person_choices_'+inx - }); - $j('#mv_person_choices_'+inx).css({ - 'left':$j('#mv_person_input_'+inx).get(0).offsetLeft, - 'top':$j('#mv_person_input_'+inx).get(0).offsetTop + $j('#mv_person_input_'+inx).height()+6 }); + }, + matchSubset:0, + extraParams:{action:'ajax',rs:'mv_auto_complete_person'}, + paramName:'rsargs[]', + resultElem:'#mv_person_choices_'+inx + }); + $j('#mv_person_choices_'+inx).css({ + 'left':$j('#mv_person_input_'+inx).get(0).offsetLeft, + 'top':$j('#mv_person_input_'+inx).get(0).offsetTop + $j('#mv_person_input_'+inx).height()+6 }); } function mv_add_filter(){ - //give us another 50px if on frontPage: - if($j('#frontPageTop').height()) - $j('#frontPageTop').css('height', ($j('#frontPageTop').height()+55)+'px'); - - - //close the first filter select rename inx to inx+1 - var new_t_id = 'mvsel_t_'+ ($j(".mv_search_select").length-1); - var new_a_id = 'mvsel_a_'+ ($j(".mv_search_select").length-1); - var inx = ($j(".mv_search_select").length-1); - //this could be cleaned up a bit: - $j("#mv_active_filters").append('<br><span id="mvs_'+inx+'" > </span>'); - $j('#mvs_'+inx).append( - $j("#mvsel_a_0").clone().attr({id:new_a_id,name:'f['+inx+'][a]'}), - $j("#mvsel_t_0").clone().attr({id:new_t_id,name:'f['+inx+'][t]'}) - ); - //reset the selector for both selectors: : - $j('#'+new_t_id+',#'+new_a_id).get(0).selectedIndex=null; - $j('#'+new_a_id).css('display', 'inline'); - $j('#mvs_'+inx).append('<span id="mvs_'+inx+'_tc"></span>'); - $j('#mvs_'+inx).append( $j("#mv_ref_remove") - .clone().css('display', 'inline') - .attr({id:'', href:'javascript:mv_remove_filter('+inx+')'})); - mvSearchSetupFlag=false; - mv_setup_search(); - //console.log("new id: " + new_id); - //$j('mv_sel_') + //give us another 50px if on frontPage: + if($j('#frontPageTop').height()) + $j('#frontPageTop').css('height', ($j('#frontPageTop').height()+55)+'px'); + + + //close the first filter select rename inx to inx+1 + var new_t_id = 'mvsel_t_'+ ($j(".mv_search_select").length-1); + var new_a_id = 'mvsel_a_'+ ($j(".mv_search_select").length-1); + var inx = ($j(".mv_search_select").length-1); + //this could be cleaned up a bit: + $j("#mv_active_filters").append('<br><span id="mvs_'+inx+'" > </span>'); + $j('#mvs_'+inx).append( + $j("#mvsel_a_0").clone().attr({id:new_a_id,name:'f['+inx+'][a]'}), + $j("#mvsel_t_0").clone().attr({id:new_t_id,name:'f['+inx+'][t]'}) + ); + //reset the selector for both selectors: : + $j('#'+new_t_id+',#'+new_a_id).get(0).selectedIndex=null; + $j('#'+new_a_id).css('display', 'inline'); + $j('#mvs_'+inx).append('<span id="mvs_'+inx+'_tc"></span>'); + $j('#mvs_'+inx).append( $j("#mv_ref_remove") + .clone().css('display', 'inline') + .attr({id:'', href:'javascript:mv_remove_filter('+inx+')'})); + mvSearchSetupFlag=false; + mv_setup_search(); + //console.log("new id: " + new_id); + //$j('mv_sel_') } //remove filter of given inx function mv_remove_filter(inx){ - //remove 50 px if on front page: - if($j('#frontPageTop').height()) - $j('#frontPageTop').css('height', ($j('#frontPageTop').height()-50)+'px'); - $j('#mvs_'+inx).remove(); - //also remove the person input (since we moved it out of mvs) - $j('#mv_person_choices_'+inx).remove(); + //remove 50 px if on front page: + if($j('#frontPageTop').height()) + $j('#frontPageTop').css('height', ($j('#frontPageTop').height()-50)+'px'); + $j('#mvs_'+inx).remove(); + //also remove the person input (since we moved it out of mvs) + $j('#mv_person_choices_'+inx).remove(); } /* @@ -456,52 +453,52 @@ Johann Burkard function add_highlight_function(){ $j(function() { jQuery.highlight = document.body.createTextRange ? - /* - Version for IE using TextRanges. - */ - function(node, te) { - var r = document.body.createTextRange(); - r.moveToElementText(node); - for (var i = 0; r.findText(te); i++) { - r.pasteHTML('<span class="searchmatch">' + r.text + '<\/span>'); - r.collapse(false); - } - } - : - /* - (Complicated) version for Mozilla and Opera using span tags. - */ - function(node, te) { - js_log('hl:'+ te + ' nt:'+node.nodeType + ' tn:' + node.tagName); - var pos, skip, spannode, middlebit, endbit, middleclone; - skip = 0; - if (node.nodeType == 3) { - pos = node.data.toUpperCase().indexOf(te); - if (pos >= 0) { - spannode = document.createElement('span'); - spannode.className = 'searchmatch'; - middlebit = node.splitText(pos); - endbit = middlebit.splitText(te.length); - middleclone = middlebit.cloneNode(true); - spannode.appendChild(middleclone); - middlebit.parentNode.replaceChild(spannode, middlebit); - skip = 1; - } - } - else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { - for (var i = 0; i < node.childNodes.length; ++i) { - i += $j.highlight(node.childNodes[i], te); - } - } - return skip; - } - - ; - }); - - jQuery.fn.removeHighlight = function() { - return this.find("span.highlight").each(function() { - this.parentNode.replaceChild(this.firstChild, this).normalize(); - }); - }; + /* + Version for IE using TextRanges. + */ + function(node, te) { + var r = document.body.createTextRange(); + r.moveToElementText(node); + for (var i = 0; r.findText(te); i++) { + r.pasteHTML('<span class="searchmatch">' + r.text + '<\/span>'); + r.collapse(false); + } + } + : + /* + (Complicated) version for Mozilla and Opera using span tags. + */ + function(node, te) { + js_log('hl:'+ te + ' nt:'+node.nodeType + ' tn:' + node.tagName); + var pos, skip, spannode, middlebit, endbit, middleclone; + skip = 0; + if (node.nodeType == 3) { + pos = node.data.toUpperCase().indexOf(te); + if (pos >= 0) { + spannode = document.createElement('span'); + spannode.className = 'searchmatch'; + middlebit = node.splitText(pos); + endbit = middlebit.splitText(te.length); + middleclone = middlebit.cloneNode(true); + spannode.appendChild(middleclone); + middlebit.parentNode.replaceChild(spannode, middlebit); + skip = 1; + } + } + else if (node.nodeType == 1 && node.childNodes && !/(script|style)/i.test(node.tagName)) { + for (var i = 0; i < node.childNodes.length; ++i) { + i += $j.highlight(node.childNodes[i], te); + } + } + return skip; + } + + ; + }); + + jQuery.fn.removeHighlight = function() { + return this.find("span.highlight").each(function() { + this.parentNode.replaceChild(this.firstChild, this).normalize(); + }); + }; } diff --git a/rev51560/w/extensions/MetavidWiki/skins/mv_custom.css b/gchriss/w/extensions/MetavidWiki/skins/mv_custom.css index fa1a5e0..8f97fb4 100755 --- a/rev51560/w/extensions/MetavidWiki/skins/mv_custom.css +++ b/gchriss/w/extensions/MetavidWiki/skins/mv_custom.css @@ -190,7 +190,7 @@ div.autocomplete ul li { position:absolute;background:#DDDDDD;left:0px;height:94%;overflow:hidden; } #selectionsBox{ - width: 490px; + width: 480px; height: 517px; overflow: auto; border: 1px solid #c8c8c8; @@ -204,7 +204,7 @@ div.autocomplete ul li { #videoContent #videoMeta { background:#EEEEEE none repeat scroll 0 0; color:#353535; - font-size:11px; + font-size: 11px; height:100%; margin:35px 0 10px; overflow:hidden; @@ -563,4 +563,149 @@ ul#metaResults li.prevnext {margin-left:3px; margin-right:10px;} filter:alpha(opacity=60); -moz-opacity: 0.6; opacity: 0.6; -} \ No newline at end of file +} +<!-- CSS Calendar Start --> +//<style type="text/css"> + /* the calendar table style */ + option.lst{} + input.btn{} + ul.bullets {padding-left: 0px;} + + .calendarWeekday {vertical-align:top; background-color:;} + .calendarWeekend {vertical-align:top; background-color:black} + .calendarToday {vertical-align:top; background-color: black} + .daymissing { height:100px;border:1px solid black} + .alerts {text-align: left;} + .calendarYearSelect {text-align:right;white-space:nowrap;} + .calendarMonthSelect {white-space:nowrap;} + .eventsMode {} + .dayMode{} + .weekMode{border:1px solid #808080;height:100px;} + .calendarAddEvent {text-align: right; white-space:nowrap; font-size:10px; vertical-align:top;} + .monthMode{height:100px; border:1px solid #808080;} + .calendarEventList { width:100%; background-color: transparent;} + + + .calendarTransparent { + background-color: transparent; + width:100%; + } + + /* defines the text for single day events... other events inherent these base values */ + .baseEvent{ + padding:0px; + border-spacing: 0px; + text-align: left; + font-size: 12px; + } + + /* defines the text for multi-day events... inherents baseEvent */ + .repeatEvent{ + } + + /* defines the text for recurrence type events... inherents baseEvent */ + .recurrenceEvent{ + font-weight:bold; + } + + .calendar { + padding:0px; + border-spacing:0px; + border:0px solid #808080; + border-collapse:collapse; + width:100%; + background-color:; + } + + /* style for the table cell displaying the month title */ + .calendarTitle { + font-size:18px; + text-align:center; + font-weight:bold; + } + + /* style for the week day headings */ + .calendarHeading { + width:14%; + text-align:center; + font-weight:bold; + background-color:black; + border:1px solid #808080; + } + + .calendarDayNumber { + white-space:nowrap; + border:1px solid #CCCCCC; + background-color:black; + width:20%; + text-align: center; + font-size: 12px; + } + + /* eventlist 'mode' day overrrides */ + .eventsDay { + background-color: transparent; + border:0px; + font-weight:bold; + font-style:italic; + font-size: 16px; + text-align: left; + } + + .singleDay { + background-color: transparent; + border:0px; + font-weight:bold; + font-style:italic; + font-size: 14px; + text-align: left; + } + +/****** Year View Options BEGIN *******/ + .yearCalendar { + vertical-align:top; + border:0px solid #808080; + xborder-collapse:collapse; + width:100%; + text-align: center; + } + + .yearCalendarMonth { + vertical-align:top; + border:1px solid #808080; + border-collapse:collapse; + width:100%; + text-align: center; + } + + .yearTitle { + text-align:center; + font-weight:bold; + border:1px solid #808080; + font-size: 14px; + } + + .yearHeading { + text-align:center; + font-weight:bold; + background-color:#E0E0E0; + border:1px solid #808080; + font-size: 12px; + } + + .yearWeekday { + text-align:center; + border:1px solid #808080; + font-size: 12px; + } + + .yearWeekend { + text-align:center; + background-color:#EEEEEE; + border:1px solid #808080; + font-size: 12px; + } +/****** Year View Options END *******/ + +//</style> +<!-- CSS End --> diff --git a/rev51560/w/extensions/MetavidWiki/languages/MV_Messages.php b/gchriss/w/extensions/MetavidWiki/languages/MV_Messages.php index 835d1cd..c1f541f 100755 --- a/rev51560/w/extensions/MetavidWiki/languages/MV_Messages.php +++ b/gchriss/w/extensions/MetavidWiki/languages/MV_Messages.php @@ -21,11 +21,9 @@ $messages['en'] = array( 'loading_plugin' => 'Loading plugin <blink>...</blink>', 'select_playback' => 'Set playback preference', 'link_back' => 'Link back', - 'error_load_lib' => 'mv_embed: Unable to load required JavaScript libraries. -Insert script via DOM has failed. -Try reloading?', + 'error_load_lib' => 'Unable to load required JavaScript libraries. Try refreshing the page or using a faster internet connection.', - 'error_swap_vid' => 'Error: mv_embed was unable to swap the video tag for the mv_embed interface', + 'error_swap_vid' => 'Unable to swap the video tag. Try refreshing the page or using a faster internet connection.', 'download_segment' => 'Download selection:', 'download_full' => 'Download full video file:', @@ -49,12 +47,12 @@ Visit the <a href=\"http://metavid.org/wiki/Client_Playback\">Playback methods</ 'add_to_end_of_sequence' => 'Add to end of sequence', - 'missing_video_stream' => 'The video file for this stream is missing', + 'missing_video_stream' => 'The video file for this stream is missing. (It may not have been added yet.)', 'select_transcript_set' => 'Select text layers', 'auto_scroll' => 'auto scroll', 'close' => 'close', - 'improve_transcript' => 'Improve transcript', + 'improve_transcript' => 'Edit/create this transcript', 'next_clip_msg' => 'Play next clip', 'prev_clip_msg' => 'Play previous clip', @@ -102,7 +100,7 @@ Maybe disable the video converter?', 'no_import_by_url' => 'This user or wiki <b>can not</b> import assets via URLs. -If permissions are correct; you may have to enable $wgAllowCopyUploads, <a href="http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads">more info</a>"', +If permissions are correct; you may have to enable $wgAllowCopyUploads, <a href="http://www.mediawiki.org/wiki/Manual:$wgAllowCopyUploads">more info</a>', #metavidSearch.js 'mv_stream_title' => '$1 $2 to $3', # $stream name $start time to $end time @@ -143,8 +141,7 @@ If permissions are correct; you may have to enable $wgAllowCopyUploads, <a href= 'edit_clip' => 'Edit clip', 'edit_save' => 'Save changes', 'edit_cancel' => 'Cancel edit', - 'edit_cancel_confirm' => 'Are you sure you want to cancel your edit? -All changes will be lost.', + 'edit_cancel_confirm' => 'Cancel your edit?', 'zoom_in' => 'Zoom in', 'zoom_out' => 'Zoom out', @@ -172,11 +169,13 @@ Select a single clip to edit it', 'mv_missing_stream' => 'Missing stream: $1', 'specialpages-group-mv_group' => 'MetaVidWiki special pages', - 'mv_warning_wiki' => '<i>Note: MetaVid video transcripts [[Help:FAQ#How_accurate_is_the_information.3F|may contain inaccuracies]], help us build [[Help:Participation#Improving_Archive_Accuracy|a more perfect archive]]</i>', + 'mv_warning_wiki' => '[[MetaVidWiki:About|About]] | [[MetaVidWiki:FAQ|FAQ]] | [[Visual finding aid]] | [[MetaVidWiki:Transcribing|How to use this page]]', # stream/files key descriptions: 'mv_ogg_low_quality' => 'Web streamable - Ogg Theora 300 kbit/s', 'mv_ogg_high_quality' => 'High quality - Ogg Theora 900 kbit/s', + 'mv_ogg_424x240' => 'Ogg Theora, 360x240, 4:3, ~800 kbit/s', + 'mv_ogg_424x240' => 'Ogg Theora, 424x240, 16:9, ~800 kbit/s', 'mv_flash_low_quality' => 'Web streamable - Flash video', 'mv_archive_org_mp4' => 'Archive.org MP4 encapsulated H.264 stream', @@ -189,8 +188,7 @@ Select a single clip to edit it', 'ao_file_flash_flv' => 'Archive.org - Flash video', # only translate this message to other languages if you have to change it 'ao_file_Ogg_Video' => 'Archive.org - Ogg video', # only translate this message to other languages if you have to change it - 'mv_error_stream_missing' => '<span class="error">Error: There is no video file associated with this stream.</span><br /> -Please report this to the [[{{MediaWiki:Grouppage-sysop}}|site administrator]].', + 'mv_error_stream_missing' => '<span class="error">There is no video file associated with this stream. (It may not have been added yet.)</span><br />', 'mv_stream_added' => 'You have added the stream $1', @@ -225,8 +223,8 @@ Please report this to the [[{{MediaWiki:Grouppage-sysop}}|site administrator]].' 'mv_updated_stream_files' => 'Updated stream files record', 'mv_removed_file_stream' => 'Removed stream file: $1', 'mv_missing_stream_text' => 'The stream you requested <b>$1</b> is not available.<br /> -You may want to check the <a href="$2">Stream list</a><br /> -Or you may want to <a href="$3">Add the stream</a>.', +You may want to check the <a href="$2">Stream list</a>,<br /> +or you may want to <a href="$3">Add the stream</a>.', 'mv_user_cant_edit' => 'You may have to [$1 login] to edit, $2', // $1 is login link and $2 is cancel link 'mv_add_stream_file' => 'Add stream file', @@ -269,7 +267,7 @@ Or you may want to <a href="$3">Add the stream</a>.', 'mv_update_layers' => 'Update layers', 'mv_watch_clip' => 'Watch clip', 'mv_close_clip' => 'Close clip', - 'mv_improve_transcript' => 'Improve transcript', + 'mv_improve_transcript' => 'Edit/create this transcript', 'mv_people_matches' => 'People matches', 'mv_category_matches' => 'Category matches', 'mv_bill_matches' => 'Bill matches', @@ -354,7 +352,7 @@ Jump to stream view: $2', 'mv_search_sel_t' => 'Select search type', 'mv_do_media_search' => 'Do MetaVid media search for $1', 'mv_results_for' => 'Results for $1', - 'mv_video_search' => 'Video search', + 'mv_video_search' => 'Display clips', 'mv_page_search' => 'Do wiki page search for $1', 'mv_add_filter' => 'Add filter', 'mv_search_match' => 'Search text', @@ -448,8 +446,8 @@ Jump to stream view: $2', 'mv_stream_resource_export' => 'Stream resources export', 'mv_export_cmml' => 'Export CMML', 'mv_navigate_stream' => 'Navigate full stream', - 'mv_stream_overview' => 'Stream Overview', - 'mv_edit_time' => 'Edit Time', + 'mv_stream_overview' => 'Meeting Overview', + 'mv_edit_time' => 'Jump to a different time in this meeting', 'mv_embed_options' => 'Embed options', 'mv_overlay' => 'Overlay controls', 'mv_stream_tool_heading' => 'Stream Tools', @@ -468,7 +466,7 @@ Jump to stream view: $2', 'mv_search_stream_title' => 'Search the current stream', 'mv_new_ht_en' => 'New transcript', 'mv_new_anno_en' => 'New tag or annotation', - 'mv_mang_layers' => 'Manage layers', + 'mv_mang_layers' => 'Enable/disable layers', 'mv_mang_layers_title' => 'Manage the layer display set for the current stream',