From: Calin Burloiu Date: Tue, 30 Aug 2011 13:38:29 +0000 (+0300) Subject: bug fixes; views is incrementing; started to create help page -- imagemap widget... X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=954fc0210d9151cb86ca4dad6a955f59ba135915;p=living-lab-site.git bug fixes; views is incrementing; started to create help page -- imagemap widget created --- diff --git a/application/config/article.php b/application/config/article.php index 8e6bc9f..1677048 100644 --- a/application/config/article.php +++ b/application/config/article.php @@ -6,5 +6,9 @@ */ // Examples -$config['article_$method_helpers'] = array(); -$config['article_$method_libraries'] = array(); \ No newline at end of file +// $config['article_$method_helpers'] = array(); +// $config['article_$method_libraries'] = array(); + + +// Help article +$config['article_help_js'] = array('jquery.ui.imagemap.js'); \ No newline at end of file diff --git a/application/config/pagination.php b/application/config/pagination.php index 8df4933..cd18203 100644 --- a/application/config/pagination.php +++ b/application/config/pagination.php @@ -1,7 +1,14 @@ '; -$config['full_tag_close'] = ''; \ No newline at end of file +$config['full_tag_close'] = ''; + +$config['first_link'] = $CI->lang->line('ui_page_first'); +$config['prev_link'] = $CI->lang->line('ui_page_previous'); +$config['next_link'] = $CI->lang->line('ui_page_next'); +$config['last_link'] = $CI->lang->line('ui_page_last'); \ No newline at end of file diff --git a/application/controllers/article.php b/application/controllers/article.php index 5073a5b..f1909b9 100644 --- a/application/controllers/article.php +++ b/application/controllers/article.php @@ -26,8 +26,8 @@ class Article extends Article_Controller { $html_params = array('title' => $this->title.' - ' . $this->config->item('site_name'), - //'css' => array(), - //'js' => array(), + 'css' => $this->css, + 'js' => $this->js, 'metas' => array('description'=>$this->metaDescription) ); diff --git a/application/controllers/video.php b/application/controllers/video.php index 019fa2c..45e66d3 100644 --- a/application/controllers/video.php +++ b/application/controllers/video.php @@ -38,6 +38,7 @@ class Video extends CI_Controller { // ** // Retrieve video information. $this->load->model('videos_model'); + $this->videos_model->inc_video_var($id, 'views'); $data['video'] = $this->videos_model->get_video($id, $name); $data['plugin_type'] = ($plugin === NULL ? 'auto' : $plugin); diff --git a/application/core/Article_Controller.php b/application/core/Article_Controller.php index e6a50aa..480b847 100644 --- a/application/core/Article_Controller.php +++ b/application/core/Article_Controller.php @@ -16,6 +16,11 @@ * an entry named "article_${method}_helpers" or "article_${method}_libraries" * respectively with an array of helpers or libraries to be loaded for the * article. + *
  • CSSs, JSs: in config file 'article.php': + * an entry named "article_${method}_css" or "article_${method}_js" + * respectively with an array of .css or .js to be loaded into members $css + * and $js. It's up to the programmer to define how this members are going + * to be used.
  • * * * @category Base Controller Library @@ -27,6 +32,8 @@ class Article_Controller extends CI_Controller { protected $metaDescription = NULL; protected $helpers = array(); protected $libraries = array(); + protected $css = array(); + protected $js = array(); function __construct() { @@ -65,6 +72,16 @@ class Article_Controller extends CI_Controller { $this->libraries = $this->config->item("article_${method}_library"); if ($this->libraries !== FALSE) $this->load->library($libraries); + + // CSSs + $css =& $this->config->item("article_${method}_css"); + if ($css !== FALSE) + $this->css = $css; + + // JavaScripts + $js =& $this->config->item("article_${method}_js"); + if ($js !== FALSE) + $this->js = $js; } /** diff --git a/application/language/english/ui_lang.php b/application/language/english/ui_lang.php index 0bd140d..70dffc0 100644 --- a/application/language/english/ui_lang.php +++ b/application/language/english/ui_lang.php @@ -24,6 +24,12 @@ $lang['ui_categ_tech_talks'] = 'TechTalks'; $lang['ui_categ_events'] = 'Events'; $lang['ui_categ_karaoke'] = 'Karaoke'; +// Pagination +$lang['ui_page_first'] = 'First'; +$lang['ui_page_previous'] = 'Previous'; +$lang['ui_page_next'] = 'Next'; +$lang['ui_page_last'] = 'Last'; + // Video asset metrics $lang['ui_view'] = 'view'; $lang['ui_views'] = 'views'; diff --git a/application/models/videos_model.php b/application/models/videos_model.php index ec7bb39..1ba9e8f 100644 --- a/application/models/videos_model.php +++ b/application/models/videos_model.php @@ -176,6 +176,21 @@ class Videos_model extends CI_Model { return $video; } + /** + * Increment a video parameter from DB: `views`, `likes` or `dislikes`. + * + * @param int $id DB video id + * @param string $param DB parameter column name. + * @return void + */ + public function inc_video_var($id, $var) + { + // TODO error report if query returns FALSE + $this->db->query('UPDATE `videos` ' + . 'SET `'. $var. '`=`'. $var. '`+1 ' + . 'WHERE id='. $id); + } + public function get_thumbs($name, $count) { $thumbs = array(); diff --git a/application/views/article/english/contact.php b/application/views/article/english/contact.php index 34b39a7..02e5d6f 100644 --- a/application/views/article/english/contact.php +++ b/application/views/article/english/contact.php @@ -6,7 +6,7 @@
    -
    email Redmine Issue Tracker:
    +
    redmine Redmine Issue Tracker:
    http://p2p-next.cs.pub.ro/redmine/site/issues
    diff --git a/application/views/article/english/help.php b/application/views/article/english/help.php index 30b2de3..99a6494 100644 --- a/application/views/article/english/help.php +++ b/application/views/article/english/help.php @@ -1 +1,91 @@ -TODO Help \ No newline at end of file +
    +
    + NextShare Video Widget Screenshot +
    + +
    +

    Watching Area

    +
    + Here you can watch the video. +
    + +

    Play / Pause button

    +
    + Toggle playing and pausing the video. +
    + +

    Current Time

    +
    + ... +
    + +

    Total Time

    +
    + ... +
    + +

    Time Progress Slider

    +
    + ... +
    + +

    Volume Slider

    +
    + ... +
    + +

    Mute button

    +
    + ... +
    + +

    Switch Video Definition (Resolution)

    +
    + ... +
    + +

    Switch Video Plugin

    +
    + ... +
    + +

    Full Screen button

    +
    + ... +
    +
    + +
    + + \ No newline at end of file diff --git a/application/views/video/watch_view.php b/application/views/video/watch_view.php index 36ae1e0..9f7d091 100644 --- a/application/views/video/watch_view.php +++ b/application/views/video/watch_view.php @@ -124,10 +124,15 @@ .nsvideo({ type: "", src: , - //width: videoWidth, - //height: videoHeight - minWidth: 640, - maxWidth: 1024, + + + width: 427, + height: 240, + showState: false, + + + //minWidth: 640, + //maxWidth: 1024, initialDuration: "", resize: function() { diff --git a/css/default.css b/css/default.css index e1abafa..fac6909 100644 --- a/css/default.css +++ b/css/default.css @@ -210,4 +210,5 @@ h1 .pagination { clear: both; + word-spacing: 0.5em; } diff --git a/img/nsvideo-widget.jpg b/img/nsvideo-widget.jpg new file mode 100644 index 0000000..7504176 Binary files /dev/null and b/img/nsvideo-widget.jpg differ diff --git a/js/jquery.ui.imagemap.js b/js/jquery.ui.imagemap.js new file mode 100644 index 0000000..a34a2c2 --- /dev/null +++ b/js/jquery.ui.imagemap.js @@ -0,0 +1,81 @@ +/* + * jQuery UI ImageMap 1.0.0 beta + * + * Copyright 2011, Călin-Andrei Burloiu + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + */ +(function( $, undefined ) { + +$.widget( "ui.imagemap", { + version: "1.0.0 beta", + options: { + + }, + + _create: function() { + var widget = this; + + $('div.ui-imagemap-image', widget.element) + .css('position', 'relative') + .css('width', $('div.ui-imagemap-image > img', widget.element).css('width')) + .css('height', $('div.ui-imagemap-image > img', widget.element).css('height')) + ; + + widget.$marker = $('
    ') + .appendTo('div.ui-imagemap-image', widget.element); + widget.$marker + .css('position', 'absolute') + .css('outline', '2px solid red') + .css('background', 'transparent'); + + $('.ui-imagemap-title', widget.element) + .click(function() { + var $title = $(this); + + if (typeof $title.data('top') == 'undefined') + return false; + if (typeof $title.data('left') == 'undefined') + return false; + + var top = $title.data('top') + var left = $title.data('left'); + var width, height; + + if (typeof $title.data('width') == 'undefined') + width = '1px'; + else + width = $title.data('width'); + if (typeof $title.data('height') == 'undefined') + height = '1px'; + else + height = $title.data('height'); + + widget.$marker + .css('top', top) + .css('left', left) + .css('width', width) + .css('height', height); + + }); + }, + + _destroy: function() { + this.element.html(''); + }, + + _setOption: function( key, value ) { + // TODO + if ( key === "TODO" ) { + + } + + this._super( "_setOption", key, value ); + } +}); + +})( jQuery ); \ No newline at end of file diff --git a/js/jquery.ui.nsvideo.js b/js/jquery.ui.nsvideo.js index ccf9a13..ec30d87 100644 --- a/js/jquery.ui.nsvideo.js +++ b/js/jquery.ui.nsvideo.js @@ -200,13 +200,19 @@ $.widget( "ui.nsvideo", { widget.$videoContainer.html(''); // Install buttons or not supported message if required - var $installContainer = $('
    ') - .appendTo(widget.$videoContainer); - $installContainer - .nsinstall({ - type: widget.options.type, - hideIfAlreadyInstalled: true - }); + if (typeof $.fn.nsinstall == 'function') + { + widget.$installContainer = $('
    ') + .appendTo(widget.$videoContainer); + widget.$installContainer + .nsinstall({ + type: widget.options.type, + hideIfAlreadyInstalled: true + }); + if (widget.$installContainer.nsinstall('option', 'error') + == 'already installed') + widget.$installContainer.hide(); + } var width = widget.options.width; var height = widget.options.height; @@ -243,6 +249,10 @@ $.widget( "ui.nsvideo", { widget.html5.refreshVolume(); widget.html5.refreshState(); widget._setWidgetWidth(); + + if (widget.$video[0].error != 3 + && widget.$video[0].error != 4) + widget.$installContainer.hide(); }, seeked: function() { widget.html5.play(); @@ -375,7 +385,7 @@ $.widget( "ui.nsvideo", { if (widget.$video.width() < 640) { widget.element.css('width', - 640 + 8 + 'px'); + 427 + 8 + 'px');//TODO 640 + 8 widget.$video.css('left', Math.round(widget.$videoContainer.width()/2 - widget.$video.width()/2) @@ -826,6 +836,11 @@ $.widget( "ui.nsvideo", { }, play: function() { + if(typeof widget.$video[0].playlist.isPlaying == 'undefined') + return widget; + + widget.$installContainer.hide(); + if (! widget.$video[0].playlist.isPlaying) widget.$video[0].playlist.play();