From: Calin Burloiu Date: Mon, 1 Aug 2011 09:24:48 +0000 (+0300) Subject: language support added; Romanian language added; preparing to create jQuery UI video... X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=c3cb1c599db718a4fd81c7df57850fced9f64c02;p=living-lab-site.git language support added; Romanian language added; preparing to create jQuery UI video player widget --- diff --git a/application/config/autoload.php b/application/config/autoload.php index 58da7c9..68acde8 100644 --- a/application/config/autoload.php +++ b/application/config/autoload.php @@ -96,7 +96,7 @@ $autoload['config'] = array('p2p-tube'); | */ -$autoload['language'] = array(); +$autoload['language'] = array('ui'); /* diff --git a/application/config/config.php b/application/config/config.php index 1402953..a0c644e 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -69,7 +69,7 @@ $config['url_suffix'] = ''; | than english. | */ -$config['language'] = 'english'; +$config['language'] = 'romanian'; /* |-------------------------------------------------------------------------- diff --git a/application/config/p2p-tube.php b/application/config/p2p-tube.php index 89bd1ef..b6a6e46 100644 --- a/application/config/p2p-tube.php +++ b/application/config/p2p-tube.php @@ -81,11 +81,13 @@ $config['default_torrent_ext'] = 'tstream'; |-------------------------------------------------------------------------- | | An associative list with the video categories of the site. IDs are used -| in DB (for example in `videos` table), and value are human-friendly names -| for categories. IDs must be numeric and must preferably start from 1. +| in DB (for example in `videos` table), and values are string identifiers +| for categories. Category names localization can be made by concatenating +| 'ui_categ_' with the value in order to obtain a language key. +| IDs must be numeric and must preferably start from 1. | */ -$config['categories'] = array(1 => 'Movies', 2 => 'TechTalks', 3 => 'Events', 4 => 'Karaoke'); +$config['categories'] = array(1 => 'movies', 2 => 'tech_talks', 3 => 'events', 4 => 'karaoke'); /* |-------------------------------------------------------------------------- diff --git a/application/controllers/catalog.php b/application/controllers/catalog.php index 3447167..8a325e7 100644 --- a/application/controllers/catalog.php +++ b/application/controllers/catalog.php @@ -11,17 +11,31 @@ class Catalog extends CI_Controller { public function __construct() { parent::__construct(); + + //$this->lang->load('catalog'); } public function index() { // Retrieve videos summary. - $data['categories'] = $this->config->item('categories'); $this->load->model('videos_model'); - foreach ($data['categories'] as $id => $name) + foreach ($this->config->item('categories') as $id => $name) { - $data['videos'][$id] = $this->videos_model->get_videos_summary( + // Videos + $vs_data['videos'] = $this->videos_model->get_videos_summary( $id, 0, $this->config->item('videos_per_row')); + + // Category + $vs_data['category_title'] = $name ? + $this->lang->line("ui_categ_$name") : $name; + $vs_data['category_id'] = $id; + + // Pagination (not required) + $vs_data['pagination'] = ''; + + $data['videos_summaries'][] = + $this->load->view('catalog/videos_summary_view', + $vs_data, TRUE); } $params = array( 'title' => $this->config->item('site_name'), @@ -54,12 +68,16 @@ class Catalog extends CI_Controller { { // Retrieve videos summary. $this->load->model('videos_model'); - $data['videos'] = $this->videos_model->get_videos_summary( + $vs_data['videos'] = $this->videos_model->get_videos_summary( $category_id, intval($offset), $this->config->item('videos_per_page')); + + // Video Category $categories = $this->config->item('categories'); - $data['category'] = $categories[$category_id]; - $data['category_id'] = $category_id; + $category_name = $categories[$category_id]; + $vs_data['category_title'] = $category_name ? + $this->lang->line("ui_categ_$category_name") : $category_name; + $vs_data['category_id'] = $category_id; // Pagination $this->load->library('pagination'); @@ -69,7 +87,11 @@ class Catalog extends CI_Controller { $category_id); $pg_config['per_page'] = $this->config->item('videos_per_page'); $this->pagination->initialize($pg_config); - $data['pagination'] = $this->pagination->create_links(); + $vs_data['pagination'] = $this->pagination->create_links(); + + // Video Summary + $data['video_summary'] = $this->load->view('catalog/videos_summary_view', + $vs_data, TRUE); $params = array( 'title' => $this->config->item('site_name'), 'css' => array('catalog.css'), diff --git a/application/controllers/video.php b/application/controllers/video.php index f892349..0003f74 100644 --- a/application/controllers/video.php +++ b/application/controllers/video.php @@ -12,6 +12,8 @@ class Video extends CI_Controller { public function __construct() { parent::__construct(); + + //$this->lang->load('video'); } public function index() @@ -34,7 +36,7 @@ class Video extends CI_Controller { // Retrieve video information. $this->load->model('videos_model'); $data['video'] = $this->videos_model->get_video($id, $name); - $data['plugin'] = ($plugin === NULL ? 'auto' : $plugin); + $data['plugin_type'] = ($plugin === NULL ? 'auto' : $plugin); // Display page. $params = array( 'title' => $data['video']['title'] . ' -- ' @@ -47,6 +49,11 @@ class Video extends CI_Controller { $this->load->view('html_begin', $this->html_head_params); $this->load->view('header'); + // Preloading video plugin. + // TODO plugin auto (type + definition) + $data['plugin_content'] = $this->_plugin('ns-html5', + $data['video']['url'][0], TRUE); + $this->load->view('video/watch_view', $data); $this->load->view('footer'); @@ -64,10 +71,31 @@ class Video extends CI_Controller { */ public function plugin($type) { - $data['url'] = $this->input->post('url', TRUE); + $url = $this->input->post('url', TRUE); + + $this->_plugin($type, $url); + } + + /** + * Video plugin controller + * + * See plugin function for details. If the second parameter is TRUE + * the output is return instead of being displayed (used in preloading). + */ + public function _plugin($type, $url, $return_output=FALSE) + { + if ($type == 'ns-html5') + $data['url'] = 'tribe://' . $url; + else if ($type == 'ns-vlc') + $data['url'] = $url; - $this->load->view('video/'. $type . '_plugin_view', $data); + $output = $this->load->view('video/'. $type . '_plugin_view', $data, + $return_output); + + if ($return_output) + return $output; } + } /* End of file video.php */ diff --git a/application/language/english/catalog_lang.php b/application/language/english/catalog_lang.php new file mode 100644 index 0000000..16cffdc --- /dev/null +++ b/application/language/english/catalog_lang.php @@ -0,0 +1,6 @@ + + + 403 Forbidden + + + +

Directory access is forbidden.

+ + + \ No newline at end of file diff --git a/application/language/romanian/ui_lang.php b/application/language/romanian/ui_lang.php new file mode 100644 index 0000000..362ae54 --- /dev/null +++ b/application/language/romanian/ui_lang.php @@ -0,0 +1,23 @@ + list of torrent file names formated as + * * url => list of URLs for the video torrents formated as * {name}_{format}.{default_video_ext}.{default_torrent_ext} * * user_name => TODO: user name from `users` table * * formats => list of formats like 1080p - * * category_name => TODO: human-friendly category name + * * category_title => a human-friendly category name * * tags => associative list of "tag => score" * * date => date and time when the video was created * * thumbs => thumbnail images' URLs @@ -134,16 +134,22 @@ class Videos_model extends CI_Model { $video['tags'] = array_reverse($video['tags'], true); // Torrents - $video['torrents'] = array(); + $video['url'] = array(); foreach ($video['formats'] as $format) { $ext = isset($format['ext']) ? $format['ext'] : $this->config->item('default_video_ext'); - $video['torrents'][] = site_url('data/torrents/'. $video['name'] . '_' + $video['url'][] = site_url('data/torrents/'. $video['name'] . '_' . $format['def'] . '.'. $ext . '.'. $this->config->item('default_torrent_ext')); } + // Category title + $categories = $this->config->item('categories'); + $category_name = $categories[ intval($video['category_id']) ]; + $video['category_title'] = $category_name ? + $this->lang->line("ui_categ_$category_name") : $category_name; + // Thumbnails $video['thumbs'] = $this->get_thumbs($video['name'], $video['thumbs_count']); diff --git a/application/views/catalog/category_view.php b/application/views/catalog/category_view.php index 6831bb6..aee1cb6 100644 --- a/application/views/catalog/category_view.php +++ b/application/views/catalog/category_view.php @@ -1,33 +1,7 @@
-
-

- - - - -
- -
- - -
-
- -
- - - - -
+
diff --git a/application/views/catalog/index_view.php b/application/views/catalog/index_view.php index 0905dc3..fe0505b 100644 --- a/application/views/catalog/index_view.php +++ b/application/views/catalog/index_view.php @@ -1,37 +1,9 @@
- $category_name): ?> -
-

- "> - - -

- - -
- - -
- - -
-
- -
- - -
-
- +
diff --git a/application/views/catalog/videos_summary_view.php b/application/views/catalog/videos_summary_view.php new file mode 100644 index 0000000..9184ad2 --- /dev/null +++ b/application/views/catalog/videos_summary_view.php @@ -0,0 +1,41 @@ +
+

+ "> + + +

+ + + + +
+ +
+ + +
+
+ lang->line('ui_view') : + $this->lang->line('ui_views') ); + ?> +
+
+ lang->line('ui_from') . ' TODO' //TODO ?> +
+
+ + + + +
+ +
\ No newline at end of file diff --git a/application/views/video/watch_view.php b/application/views/video/watch_view.php index dd9f6d6..2de6b43 100644 --- a/application/views/video/watch_view.php +++ b/application/views/video/watch_view.php @@ -1,10 +1,10 @@ - +
- + Invalid ID in URL.

- +

-
- - +
-
views
-
likes
-
dislikes
+
+ lang->line('ui_view') : + $this->lang->line('ui_views') ); + ?> +
+
+ lang->line('ui_like') : + $this->lang->line('ui_likes') ); + ?> +
+
+ lang->line('ui_dislike') : + $this->lang->line('ui_dislikes') ); + ?> +
- -
Tags: - - $score): ?> +
+ lang->line('ui_category')) + . ': '. $video['category_title'] ?> +
+
+ lang->line('ui_tags')). ': ' ?> + $score): ?> - + - -
+ +
+ lang->line('ui_license')) + . ': '. $video['license'] ?> +
-
\ No newline at end of file +
+ + + \ No newline at end of file diff --git a/css/catalog.css b/css/catalog.css index eba58b2..214d8c2 100644 --- a/css/catalog.css +++ b/css/catalog.css @@ -1,15 +1,21 @@ -.video-list +.videos-summary { position: relative; } +.category-title +{ + border-bottom: 1px solid rgb(108,162,222); + /*border-bottom: 1px solid rgb(171,209,255);*/ +} + .video-icon { position: relative; display: block; float: left; width: 146px; - height: 190px; + height: 170px; margin-right: 8px; } @@ -45,9 +51,15 @@ .video-icon .video-title { + margin-top: 2px; font-size: 12px; + line-height: 100%; } .video-icon .video-views +{ + font-size: 12px; +} +.video-icon .video-username { font-size: 12px; } \ No newline at end of file diff --git a/js/video.js b/js/video.js index 2e0f574..980a317 100644 --- a/js/video.js +++ b/js/video.js @@ -1,5 +1,5 @@ /** - * Video page client scripting (AJAX, events etc.) + * Video page client scripting */ // Usually replaced in PHP diff --git a/system/language/romanian/calendar_lang.php b/system/language/romanian/calendar_lang.php new file mode 100644 index 0000000..7b2e065 --- /dev/null +++ b/system/language/romanian/calendar_lang.php @@ -0,0 +1,50 @@ + + + + +403 Forbidden + + + + + +

Accesul in director este interzis.

+ + + + \ No newline at end of file diff --git a/system/language/romanian/number_lang.php b/system/language/romanian/number_lang.php new file mode 100644 index 0000000..366ff28 --- /dev/null +++ b/system/language/romanian/number_lang.php @@ -0,0 +1,10 @@ +