<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
- * Article Engine Configurations which include libraries and helpers to be
- * loaded for each article.
+ * Article Engine Configurations which include libraries, helpers,
+ * JavaScript sources, CSS files to be loaded for each article.
+ *
+ * For more details check documentation from
+ * 'application/core/Article_Controller'.
*/
// Examples
// Help article
-$config['article_help_js'] = array('jquery.ui.imagemap.js');
\ No newline at end of file
+$config['article_help_js'] = array('jquery.ui.imagemap.js');
+
+// Test article
+$config['article_test_js'] = array('jquery.ui.thumbs.js');
\ No newline at end of file
| administrator.
|
*/
-$config['require_moderation'] = TRUE;
\ No newline at end of file
+$config['require_moderation'] = FALSE;
\ No newline at end of file
'css' => array(
'catalog.css'
),
- //'js' => array(),
+ 'js' => array('jquery.ui.thumbs.js'),
//'metas' => array('description'=>'','keywords'=>'')
);
$this->load->library('html_head_params', $params);
. $this->config->item('site_name'),
'css' => array(
'catalog.css'
- )
- //'metas' => array('description'=>'','keywords'=>'')
+ ),
+ 'js' => array('jquery.ui.thumbs.js')
+ //'metas' => array('description'=>'','keywords'=>'')
);
$this->load->library('html_head_params', $params);
'css' => array(
'catalog.css'
),
- //'js' => array(),
- //'metas' => array('description'=>'','keywords'=>'')
+ 'js' => array('jquery.ui.thumbs.js'),
+ //'metas' => array('description'=>'','keywords'=>'')
);
$this->load->library('html_head_params', $params);
* Library Article_Controller can be extended by a controller to be used for
* content pages that depend on the language.
*
- * The page views are usually located in
+ * The page views are located in
* "application/views/article/$language/$method".
* Parameters:
* <ul>
// Thumbnails
$video['thumbs'] = $this->get_thumbs($video['name'],
$video['thumbs_count']);
+ $video['json_thumbs'] = json_encode($video['thumbs']);
// Ellipsized title
//$video['shorted_title'] = ellipsize($video['title'], 45, 0.75);
public function add_video($name, $title, $description, $tags, $duration,
$formats, $category_id, $user_id, $uploaded_file)
{
+ $this->load->config('content_ingestion');
+
// Tags.
$json_tags = array();
$tok = strtok($tags, ',');
}
$json_tags = json_encode($json_tags);
- // TODO formats
$json_formats = json_encode($formats);
+ // Thumbnail images
+ $thumbs_count = $this->config->item('thumbs_count');
+ $default_thumb = rand(0, $thumbs_count - 1);
+
$query = $this->db->query("INSERT INTO `videos`
(name, title, description, duration, formats, category_id,
- user_id, tags, date)
+ user_id, tags, date, thumbs_count, default_thumb)
VALUES ('$name', '$title', '$description', '$duration',
'$json_formats', $category_id,
- $user_id, '$json_tags', utc_timestamp())");
+ $user_id, '$json_tags', utc_timestamp(),
+ $thumbs_count, $default_thumb)");
if ($query === FALSE)
return FALSE;
// Thumbnails
$video['thumbs'] = $this->get_thumbs($video['name'],
$video['thumbs_count']);
+ $video['json_thumbs'] = json_encode($video['thumbs']);
// Ellipsized title
//$video['shorted_title'] = ellipsize($video['title'], 45, 0.75);
--- /dev/null
+<?php
+$src[] = site_url('data/thumbs/IndependentaRomaniei_t00.jpg');
+$src[] = site_url('data/thumbs/IndependentaRomaniei_t01.jpg');
+$src[] = site_url('data/thumbs/IndependentaRomaniei_t02.jpg');
+$src[] = site_url('data/thumbs/IndependentaRomaniei_t03.jpg');
+
+$json_src = json_encode($src);
+?>
+
+<img id="d" src="<?php echo site_url('data/thumbs/IndependentaRomaniei_t02.jpg') ?>"
+ data-src='<?php echo $json_src ?>'>tra-la-la</img>
+
+<script type="text/javascript">
+ $('#d').thumbs({
+
+ });
+</script>
\ No newline at end of file
<?php echo $pagination ?>
<?php foreach($videos as $video):
- $thumb_src = $video['thumbs'][ $video['default_thumb'] ];
+ $default_thumb = $video['thumbs'][ $video['default_thumb'] ];
?>
<div class="video-icon">
<div class="video-thumb ui-widget-content ui-corner-all">
<a href="<?php echo $video['video_url'] ?>">
- <img src="<?php echo $thumb_src ?>" />
+ <img class="video-thumb-img"
+ src="<?php echo $default_thumb ?>"
+ data-src='<?php echo $video['json_thumbs'] ?>' />
<div class="video-duration"><?php echo $video['duration'] ?></div>
</a>
</div>
<div style="clear: both"></div>
-</div>
\ No newline at end of file
+</div>
+
+<script type="text/javascript">
+ $(function() {
+ $('.video-thumb-img').thumbs();
+ });
+
+</script>
\ No newline at end of file
<p><?php echo $this->lang->line('user_no_videos_uploaded') ?></p>
<?php else: ?>
<?php foreach($videos as $video):
- $thumb_src = $video['thumbs'][ $video['default_thumb'] ];
+ $default_thumb = $video['thumbs'][ $video['default_thumb'] ];
?>
<div class="video-icon">
<div class="video-thumb ui-widget-content ui-corner-all">
<a href="<?php echo $video['video_url'] ?>">
- <img src="<?php echo $thumb_src ?>" />
+ <img class="video-thumb-img"
+ src="<?php echo $default_thumb ?>"
+ data-src='<?php echo $video['json_thumbs'] ?>' />
<div class="video-duration"><?php echo $video['duration'] ?></div>
</a>
</div>
window.location = uri;
});
+
+ $('.video-thumb-img').thumbs();
});
</script>
\ No newline at end of file
},
_setWidgetWidth: function() {
- var widget = this;
+ //var widget = this;
if (widget.$video.width() < 640)
{
},
refreshState: function() {
- var widget = this;
+ //var widget = this;
var err = "";
var normal = "";
--- /dev/null
+/*
+ * jQuery UI Thumbs 1.0.0 beta
+ *
+ * Creates an image thumbnail slideshow for an image tag when mouse is over.
+ *
+ * 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.thumbs", {
+ version: "1.0.0 beta",
+ options: {
+ // in milliseconds
+ period: 750,
+ src: []
+ },
+
+ _create: function() {
+ var widget = this;
+
+ if (typeof(widget.element.data('src')) != 'undefined')
+ widget.options.src =
+ widget.options.src.concat(widget.element.data('src'));
+
+ widget.index = 0;
+ widget.count = widget.options.src.length;
+ widget.defaultSrc = widget.element.attr('src');
+
+ widget._preloadImages();
+
+ widget.element
+ .mouseover(function() {
+ // Initial frame
+ widget.index = 0;
+ widget.element.attr('src', widget.options.src[0]);
+
+ widget.intervalHandler = setInterval(function() {
+ widget.index = (widget.index + 1) % widget.count;
+ widget.element.attr('src',
+ widget.options.src[widget.index]);
+ }, widget.options.period);
+
+ })
+ .mouseout(function() {
+ clearInterval(widget.intervalHandler);
+ widget.element.attr('src', widget.defaultSrc);
+ });
+ },
+
+ _preloadImages: function() {
+ var images = new Array();
+ for (var i = 0; i < this.options.src.length; i++)
+ {
+ images[i] = new Image();
+ images[i].src = this.options.src[i];
+ }
+ }
+
+});
+
+})( jQuery );
+