Index: trunk/extensions/MetavidWiki/includes/MV_Index.php |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | //set up select vars: |
106 | 106 | $conds=$vars=array(); |
107 | 107 | $from_tables =''; |
108 | | - $do_cat_lookup=false; |
| 108 | + $do_cat_lookup=$do_smw_lookup=false; |
109 | 109 | // |
110 | 110 | //set mvd_type if empty: |
111 | 111 | if($mvd_type==null)$mvd_type='all'; |
— | — | @@ -113,6 +113,7 @@ |
114 | 114 | $vars= array('mv_page_id as id', 'mvd_type', 'wiki_title', 'stream_id', 'start_time', 'end_time'); |
115 | 115 | //add in base from: |
116 | 116 | $from_tables.= $dbr->tableName('mv_mvd_index'); |
| 117 | + $conds = array('stream_id'=>$stream_id); |
117 | 118 | //print_r($smw_properties); |
118 | 119 | if($smw_properties!=''){ |
119 | 120 | if(!is_array($smw_properties)) |
— | — | @@ -121,9 +122,36 @@ |
122 | 123 | if($prop_name=='category'){ |
123 | 124 | $do_cat_lookup=true; |
124 | 125 | }else{ |
125 | | - //if(SMW_VERSION >=1.2){ |
126 | | - // $getSMWTags=true; |
127 | | - //}else{ |
| 126 | + if(SMW_VERSION >=1.2){ |
| 127 | + |
| 128 | + //the following is too slow to use but gennerally works: |
| 129 | + //has to be rewritten with sub-queries or something more elaborate |
| 130 | + //for now just do lookup after the fact |
| 131 | + $do_smw_lookup=true; |
| 132 | + /*$esc_p = mysql_real_escape_string($prop_name); |
| 133 | + $vars[] = $esc_p.'.`smw_title` AS `'. |
| 134 | + $esc_p.'` '; |
| 135 | + $from_tables.=' ,'. |
| 136 | + ' ' . $dbr->tableName('smw_rels2') . ' as `'.$esc_p.'_rels2`'. |
| 137 | + ' JOIN `smw_ids` AS `'.$esc_p.'_pname` '. |
| 138 | + ' ON ( '. |
| 139 | + ' `'.$esc_p.'_rels2`.`p_id` = `'.$esc_p.'_pname`.`smw_id` |
| 140 | + AND `'.$esc_p.'_pname`.`smw_title` LIKE CONVERT( _utf8 '. |
| 141 | + $dbr->addQuotes($esc_p). |
| 142 | + ' USING latin1 ) COLLATE latin1_general_ci '. |
| 143 | + ' ) ' . |
| 144 | + ' LEFT JOIN `smw_ids` AS `'.$esc_p.'stext` ' . |
| 145 | + ' ON ( '. |
| 146 | + ' `'.$esc_p.'_rels2`.`s_id` = `'.$esc_p.'stext`.`smw_id` '. |
| 147 | + ' ) ' . |
| 148 | + 'LEFT JOIN `smw_ids` AS `'.mysql_real_escape_string($prop_name).'` '. |
| 149 | + ' ON ( '. |
| 150 | + ' `'.$esc_p.'_rels2`.`o_id` = `'.mysql_real_escape_string($prop_name).'`.`smw_id`'. |
| 151 | + ' ) '; |
| 152 | + $conds[]=' `'.$esc_p.'stext`.`smw_title` = `mv_mvd_index`.`wiki_title` '; |
| 153 | + break; |
| 154 | + */ |
| 155 | + }else{ |
128 | 156 | $vars[] = mysql_real_escape_string($prop_name).'.object_title as '.mysql_real_escape_string($prop_name); |
129 | 157 | $from_tables.=' ' . |
130 | 158 | ' LEFT JOIN '. $dbr->tableName('smw_relations') . |
— | — | @@ -132,11 +160,10 @@ |
133 | 161 | ' = ' . mysql_real_escape_string($prop_name) . '.subject_id'. |
134 | 162 | ' AND '. mysql_real_escape_string($prop_name).'.relation_title'. |
135 | 163 | ' = ' . $dbr->addQuotes($prop_name) . ')'; |
136 | | - //} |
| 164 | + } |
137 | 165 | } |
138 | 166 | } |
139 | | - } |
140 | | - $conds = array('stream_id'=>$stream_id); |
| 167 | + } |
141 | 168 | if($mvd_type!='all'){ |
142 | 169 | $mvd_type=(is_object($mvd_type))?get_object_vars($mvd_type):$mvd_type; |
143 | 170 | if(is_array($mvd_type)){ |
— | — | @@ -174,6 +201,7 @@ |
175 | 202 | __METHOD__, |
176 | 203 | $options); |
177 | 204 | //print $dbr->lastQuery(); |
| 205 | + //die; |
178 | 206 | |
179 | 207 | $ret_ary=array(); |
180 | 208 | $from_tables=$vars=$options=array(); |
— | — | @@ -189,18 +217,25 @@ |
190 | 218 | } |
191 | 219 | } |
192 | 220 | |
193 | | - //not very fast: |
194 | | - /*if($getSMWTags){ |
195 | | - foreach($ret_ary as $row){ |
196 | | - $smwStore =& smwfGetStore(); |
| 221 | + //slow epecialy for lots of query results but join Query is crazy complicated for SMW >= 1.2 |
| 222 | + //(and I have not been able to construct it without hitting exessive number of rows in the EXPLIN) |
| 223 | + if($do_smw_lookup){ |
| 224 | + $smwStore =& smwfGetStore(); |
| 225 | + foreach($ret_ary as & $row){ |
197 | 226 | $rowTitle = Title::newFromText($row->wiki_title, MV_NS_MVD); |
198 | | - //print "Title: ".$title->getDBKey() . "\n"; |
199 | | - $smwProps = $smwStore->getSemanticData($rowTitle); |
200 | | - foreach($smwProps as $smwProp){ |
201 | | - print "val: " . $smwProp->getValue(); |
202 | | - } |
| 227 | + foreach($smw_properties as $propKey){ |
| 228 | + $propTitle = Title::newFromText($propKey, SMW_NS_PROPERTY); |
| 229 | + $smwProps = $smwStore->getPropertyValues($rowTitle,$propTitle ); |
| 230 | + //just a temp hack .. we need to think about this abstraction a bit... |
| 231 | + if(count($smwProps)!=0){ |
| 232 | + $v = current($smwProps); |
| 233 | + $row->$propKey=$v->getXSDValue(); |
| 234 | + } |
| 235 | + } |
203 | 236 | } |
204 | | - }*/ |
| 237 | + } |
| 238 | + //print_r($ret_ary); |
| 239 | + //die; |
205 | 240 | |
206 | 241 | if($do_cat_lookup){ |
207 | 242 | $from_tables = $dbr->tableName('categorylinks'); |
Index: trunk/extensions/MetavidWiki/includes/MV_Title.php |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | var $start_time=null; |
25 | 25 | var $end_time=null; |
26 | 26 | var $id = null; |
27 | | - |
| 27 | + var $view_count=null; |
28 | 28 | |
29 | 29 | var $hasMVDType = false; |
30 | 30 | var $dispVideoPlayerTime=false; |
— | — | @@ -319,8 +319,7 @@ |
320 | 320 | list($vWidth, $vHeight) = explode('x',$size); |
321 | 321 | }else{ |
322 | 322 | list($vWidth, $vHeight, $na) = MV_StreamImage::getSizeType($size); |
323 | | - } |
324 | | - |
| 323 | + } |
325 | 324 | |
326 | 325 | $stream_web_url = $this->getWebStreamURL($mvDefaultVideoQualityKey); |
327 | 326 | //print "lookign for q: $mvDefaultFlashQualityKey "; |
— | — | @@ -339,7 +338,9 @@ |
340 | 339 | $o.='thumbnail="'.$this->getStreamImageURL($size, null, $force_server).'" '. |
341 | 340 | 'roe="'.$roe_url.'" '. |
342 | 341 | 'show_meta_link="false" '; |
| 342 | + |
343 | 343 | $o.= ($autoplay)?' autoplay="true" ':''; |
| 344 | + |
344 | 345 | $o.='style="width:'.htmlspecialchars($vWidth).'px;height:'.htmlspecialchars($vHeight).'px" '. |
345 | 346 | 'controls="true" embed_link="true" >'; |
346 | 347 | |
— | — | @@ -360,6 +361,21 @@ |
361 | 362 | return wfMsg('mv_error_stream_missing'); |
362 | 363 | } |
363 | 364 | } |
| 365 | + function getViewCount(){ |
| 366 | + if($this->view_count==null){ |
| 367 | + $dbr = & wfGetDB(DB_READ); |
| 368 | + $vars = array('COUNT(1) as hit_count'); |
| 369 | + $conds = array( 'stream_id ='.$dbr->addQuotes($this->getStreamId()), |
| 370 | + 'start_time >= '. $this->getStartTimeSeconds(), |
| 371 | + 'end_time <= '. $this->getEndTimeSeconds() ); |
| 372 | + $this->view_count =$dbr->selectField('mv_clipview_digest', |
| 373 | + $vars, |
| 374 | + $conds, |
| 375 | + __METHOD__ |
| 376 | + ); |
| 377 | + } |
| 378 | + return $this->view_count; |
| 379 | + } |
364 | 380 | function getTitleDesc(){ |
365 | 381 | if($this->type_marker){ |
366 | 382 | $title_str = wfMsg('mv_data_page_title', |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Navigator.php |
— | — | @@ -47,16 +47,17 @@ |
48 | 48 | $smw_properties=array('speech_by','bill','category'), |
49 | 49 | $options=array('LIMIT'=>1, 'ORDER BY'=>$orderby) |
50 | 50 | ); |
51 | | - //print "SHOULD GET $pntype for $stream_time_req"; |
52 | | - //print_r($mvd_rows); |
53 | | - //die; |
| 51 | + //print "SHOULD GET $pntype for $stream_time_req"; |
| 52 | + reset($mvd_rows); |
54 | 53 | if(count($mvd_rows)!=0){ |
55 | 54 | $row = current($mvd_rows); |
56 | 55 | $prev_end = $row->end_time; |
57 | 56 | $stime_req = seconds2ntp($row->start_time) . '/' . seconds2ntp($row->end_time); |
58 | 57 | $streamTitle = Title::newFromText($stream_name .'/'. $stime_req, MV_NS_STREAM); |
59 | | - if(trim($row->speech_by)!=''){ |
60 | | - $o.=wfMsg('mv_'.$pntype.'_speech', $sk->makeKnownLinkObj($streamTitle, $row->speech_by)); |
| 58 | + $tool_tip =''; |
| 59 | + if(trim($row->speech_by)!=''){ |
| 60 | + $o.=wfMsg('mv_'.$pntype.'_speech', $sk->makeKnownLinkObj($streamTitle, $row->speech_by)); |
| 61 | + $tool_tip.= 'Speech By: '. $row->speech_by; |
61 | 62 | }else if(trim($row->bill)!=''){ |
62 | 63 | $o.=wfMsg('mv_'.$pntype.'_bill', $sk->makeKnownLinkObj($streamTitle, $row->bill)); |
63 | 64 | }else if(count($row->category)!=0){ |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_Overlay.php |
— | — | @@ -299,12 +299,14 @@ |
300 | 300 | $template_key = strtolower($mvdTile->getMvdTypeKey()); |
301 | 301 | //$wgOut->addHTML('looking at: ' . strtolower($template_key)); |
302 | 302 | $sk = &$wgUser->getSkin(); |
303 | | - $pre_text_html = $post_text_html=''; |
| 303 | + $pre_text_html = $post_text_html=''; |
| 304 | + $smw_text_html=''; |
304 | 305 | switch($template_key){ |
305 | 306 | case 'ht_en': |
306 | 307 | case 'anno_en': |
307 | 308 | $smw_attr = $this->get_and_strip_semantic_tags($text); |
308 | 309 | foreach($smw_attr as $smw_key=>$smw_attr_val){ |
| 310 | + //do special display for given values: |
309 | 311 | switch($smw_key){ |
310 | 312 | case 'speech_by': |
311 | 313 | case 'spoken_by': |
— | — | @@ -320,21 +322,20 @@ |
321 | 323 | if($mvd_page!='') |
322 | 324 | $pre_text_html.='<img border="0" src="'.htmlspecialchars($mvgScriptPath).'/skins/images/button_play.png">'.'</a>'; |
323 | 325 | $pre_text_html.='</p>'; |
324 | | - break; |
325 | | - default: |
326 | | - //@@todo we should just use semantic mediaWikis info box with some custom style . |
327 | | - $smwKeyTitle=Title::newFromText($smw_key); |
328 | | - $valueTitle = Title::newFromText($smw_attr_val); |
329 | | - $post_text_html.=$smwKeyTitle->getText(). ' '. $sk->makeLinkObj($valueTitle); |
330 | | - break; |
| 326 | + break; |
331 | 327 | } |
| 328 | + //@@todo we should just use semantic mediaWikis info box with some custom style . |
| 329 | + $smwKeyTitle=Title::newFromText($smw_key); |
| 330 | + $valueTitle = Title::newFromText($smw_attr_val); |
| 331 | + if($template_key=='anno_en') |
| 332 | + $smw_text_html.=$smwKeyTitle->getText(). ': '. $sk->makeLinkObj($valueTitle).'<br>'; |
332 | 333 | } |
333 | 334 | $pre_text_html.='<p class="text">'; |
334 | 335 | if($mvd_page!=''){ |
335 | 336 | $pre_text_html.='<span class="mvd_menu_header">'.$this->get_mvd_menu($mvd_page).'</span>'; |
336 | 337 | } |
337 | | - $pre_text_html.='<span class="description">'; |
338 | | - |
| 338 | + $pre_text_html.='<span class="description"><br>'; |
| 339 | + $pre_text_html.=$smw_text_html; |
339 | 340 | //for ht_en add spoken by add name to start of text: |
340 | 341 | if( $template_key=='ht_en'){ |
341 | 342 | //if we have the person title add them to start of the text output: |
— | — | @@ -342,8 +343,7 @@ |
343 | 344 | //have to prepend it cuz of <p> insertion for first paragraph |
344 | 345 | $text='[['.$pTitle->getText().']]: '.trim($text); |
345 | 346 | } |
346 | | - } |
347 | | - |
| 347 | + } |
348 | 348 | $post_text_html.='</span></p>'; |
349 | 349 | break; |
350 | 350 | default: |
Index: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php |
— | — | @@ -10,15 +10,66 @@ |
11 | 11 | */ |
12 | 12 | if ( !defined( 'MEDIAWIKI' ) ) die( 1 ); |
13 | 13 | class MV_VideoPlayer extends MV_Component{ |
14 | | - var $name = 'MV_VideoPlayer'; |
| 14 | + var $name = 'MV_VideoPlayer'; |
| 15 | + var $embed_id = 'embed_vid'; |
15 | 16 | function getHTML(){ |
16 | 17 | global $wgOut; |
17 | 18 | if($this->getReqStreamName()!=null){ |
18 | 19 | $wgOut->addHTML($this->embed_html()); |
| 20 | + //add link helpers |
| 21 | + $wgOut->addHTML($this->link_helpers_html()); |
19 | 22 | }else{ |
20 | 23 | $wgOut->addHTML('no stream selected'); |
21 | 24 | } |
22 | 25 | } |
| 26 | + function link_helpers_html(){ |
| 27 | + global $wgUser; |
| 28 | + $o=''; |
| 29 | + $sk = & $wgUser->getSkin(); |
| 30 | + $mvTitle= & $this->mv_interface->article->mvTitle; |
| 31 | + $file_list = $mvTitle->mvStream->getFileList(); |
| 32 | + $o.='<div id="videoMeta"> |
| 33 | + <p class="options">'; |
| 34 | + //get file list: |
| 35 | + global $mvDefaultVideoQualityKey, $mvDefaultFlashQualityKey; |
| 36 | + if(count($file_list)!=0){ |
| 37 | + $coma=''; |
| 38 | + $o.='<span class="download">Download Segment:'; |
| 39 | + $ogg_stream_url = $mvTitle->getWebStreamURL($mvDefaultVideoQualityKey); |
| 40 | + if($ogg_stream_url!=''){ |
| 41 | + $o.=$coma.' <a href="'.htmlspecialchars($ogg_stream_url).'"> |
| 42 | + Web Ogg |
| 43 | + </a>'; |
| 44 | + $coma=', '; |
| 45 | + } |
| 46 | + $ogg_hq_url = $mvTitle->getWebStreamURL('mv_ogg_high_quality'); |
| 47 | + if($ogg_hq_url!=''){ |
| 48 | + $o.=$coma.' <a href="'.htmlspecialchars($ogg_hq_url).'"> |
| 49 | + High Quality Ogg |
| 50 | + </a>'; |
| 51 | + $coma=', '; |
| 52 | + } |
| 53 | + $flash_stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey); |
| 54 | + if($flash_stream_url!=''){ |
| 55 | + $o.=$coma.' <a href="'.htmlspecialchars($ogg_stream_url).'"> |
| 56 | + Flash Video |
| 57 | + </a>'; |
| 58 | + $coma=', '; |
| 59 | + } |
| 60 | + $o.='</span>'; |
| 61 | + $o.='<span class="download"><a href="javascript:">More Download Options</a></span>'; |
| 62 | + } |
| 63 | + $o.='<span class="embed"><a href="javascript:hideShowEmbedCode();">Embed Video</a></span>'. |
| 64 | + '</p>'; |
| 65 | + //about file: |
| 66 | + $o.='<p class="about_file"> |
| 67 | + <span class="views">Views:'.htmlspecialchars($mvTitle->getViewCount()).'</span> |
| 68 | + <span class="duration">Duration: '.htmlspecialchars($mvTitle->getSegmentDurationNTP()).'</span> |
| 69 | + <span class="comments">na</span> |
| 70 | + </p> |
| 71 | + </div>'; |
| 72 | + return $o; |
| 73 | + } |
23 | 74 | function embed_html(){ |
24 | 75 | global $mvDefaultVideoPlaybackRes; |
25 | 76 | $out=''; |
— | — | @@ -28,7 +79,7 @@ |
29 | 80 | $mvTitle->dispVideoPlayerTime=true; |
30 | 81 | $vid_size = (isset($this->mv_interface->smwProperties['playback_resolution']))? |
31 | 82 | $this->mv_interface->smwProperties['playback_resolution']:''; |
32 | | - return $mvTitle->getEmbedVideoHtml('embed_vid', $vid_size); |
| 83 | + return $mvTitle->getEmbedVideoHtml($this->embed_id, $vid_size); |
33 | 84 | } |
34 | 85 | function render_menu(){ |
35 | 86 | return 'embed video'; |
Index: trunk/extensions/MetavidWiki/languages/MV_Messages.php |
— | — | @@ -255,8 +255,8 @@ |
256 | 256 | 'mv_bad_tool_request' => 'bad tool line should be form: tool_name|tool_display_name', |
257 | 257 | 'mv_update_layers' => 'update layers view', |
258 | 258 | |
259 | | - 'mv_prev_speech' => 'Previous speech: $1', |
260 | | - 'mv_next_speech' => 'Next speech: $1', |
| 259 | + 'mv_prev_speech' => 'Previous Speech: $1', |
| 260 | + 'mv_next_speech' => 'Next Speech: $1', |
261 | 261 | 'mv_prev_bill' => 'Previous bill: $1', |
262 | 262 | 'mv_next_bill' => 'Next bill: $1', |
263 | 263 | 'mv_prev_cat' => 'Previous category: $1', |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -30,6 +30,14 @@ |
31 | 31 | var _global = this; |
32 | 32 | var mv_init_done=false; |
33 | 33 | |
| 34 | +/* |
| 35 | + * its best if you just require all your external data sources to serve up json data. |
| 36 | + * mv_proxy is not such a good idea from security standpoint but if you know what your doing |
| 37 | + * ie mv_data_proxy should not be hosted on domain as with any other web services running... |
| 38 | + * you can enable it here ) |
| 39 | +*/ |
| 40 | +var MV_ENABLE_DATA_PROXY=false; |
| 41 | + |
34 | 42 | //get mv_embed location if it has not been set |
35 | 43 | if(!mv_embed_path){ |
36 | 44 | getMvEmbedPath(); |
— | — | @@ -2463,7 +2471,7 @@ |
2464 | 2472 | }); |
2465 | 2473 | }else{ |
2466 | 2474 | //check if MV_embed path matches document.URL then we can use the local proxy: |
2467 | | - if(parseUri(document.URL).host == parseUri(mv_embed_path).host ){ |
| 2475 | + if(parseUri(document.URL).host == parseUri(mv_embed_path).host && MV_ENABLE_DATA_PROXY){ |
2468 | 2476 | js_log('use mv_embed_proxy : ' + parseUri(document.URL).host + ' == '+ parseUri(mv_embed_path).host); |
2469 | 2477 | //alert("do ajax req:" +req_url); |
2470 | 2478 | $j.ajax({ |
— | — | @@ -2479,14 +2487,14 @@ |
2480 | 2488 | }else{ |
2481 | 2489 | //get data via DOM injection of proxy request with callback |
2482 | 2490 | global_req_cb.push(callback); |
2483 | | - if(!mv_json_response){ |
| 2491 | + if(!mv_json_response && MV_ENABLE_DATA_PROXY){ |
2484 | 2492 | //@@todo should remove this functionality from mv_data_proxy |
2485 | 2493 | //and require sites serve up data as javascript with a callback |
2486 | 2494 | req_url =req_url.replace(/&/g,'__amp__'); |
2487 | 2495 | loadExternalJs(mv_embed_path+'mv_data_proxy.php?url='+req_url+ |
2488 | 2496 | '&cb=mv_jsdata_cb&cb_inx='+(global_req_cb.length-1) ); |
2489 | 2497 | }else{ |
2490 | | - //response type is mv_json_response don't hit mv_data_proxy |
| 2498 | + //response type is mv_json_response or proxy dissabled |
2491 | 2499 | loadExternalJs(req_url+'&cb=mv_jsdata_cb&cb_inx='+(global_req_cb.length-1)); |
2492 | 2500 | } |
2493 | 2501 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_data_proxy.php |
— | — | @@ -8,7 +8,8 @@ |
9 | 9 | */ |
10 | 10 | |
11 | 11 | //NOTE THIS IS DISABLED BY DEFAULT simply comment out the line below to enable; |
12 | | -die('note mv_data_proxy is disabled by default'); |
| 12 | +die('note mv_data_proxy is disabled by default, see var mv_data_proxy in mv_embed.js for more info'); |
| 13 | + |
13 | 14 | if(isset($_POST['url'])){ |
14 | 15 | $req_url = $_POST['url']; |
15 | 16 | }else{ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/sample_page.php |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | ?> |
116 | 116 | <table border="1" cellpadding="6" width="600"> |
117 | 117 | <? foreach($sample_embed as $key=>$aval){ |
118 | | - if($key>3)continue; |
| 118 | + if($key!=3)continue; |
119 | 119 | ?> |
120 | 120 | <tr> |
121 | 121 | <td><?=$aval['tag']?></td> |