Tarea #981 -> El "we recommend" debe sacar dedicatorias aleatorias

Tarea #982 -> El Top 10 debe sacar los video que más gustan (se saca por nº de comentarios)

git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@92 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
This commit is contained in:
David Arranz 2012-08-09 15:08:54 +00:00
parent 562d9fa9d0
commit 5c24d39ad3
2 changed files with 66 additions and 15 deletions

View File

@ -31,6 +31,8 @@ class SidebarPosts extends WP_Widget {
$gd_sort = $instance['gd_sort']; $gd_sort = $instance['gd_sort'];
$gd_order = $instance['gd_order']; $gd_order = $instance['gd_order'];
$after_text = htmlspecialchars_decode($instance['after_text']); $after_text = htmlspecialchars_decode($instance['after_text']);
$css_class = $instance['css_class'];
$max_length = $instance['max_length'];
require(ghostpool_inc . 'options.php'); require(ghostpool_inc . 'options.php');
@ -38,7 +40,7 @@ class SidebarPosts extends WP_Widget {
echo $before_widget; echo $before_widget;
?> ?>
<div class="posts-widget"> <div class="posts-widget <?php echo $css_class; ?>">
<?php <?php
if ($title) if ($title)
@ -46,8 +48,8 @@ class SidebarPosts extends WP_Widget {
$args = array( $args = array(
'posts_per_page' => $number, 'posts_per_page' => $number,
'gdsr_sort' => $gd_sort, 'orderby' => $gd_sort,
'gdsr_order' => $gd_order, 'order' => $gd_order,
'cat' => $cats 'cat' => $cats
); );
@ -99,7 +101,8 @@ class SidebarPosts extends WP_Widget {
<?php <?php
if ($post_artist_song == "Yes") { if ($post_artist_song == "Yes") {
$gp_settings['artist_song_span_short'] = cutstr($gp_settings['artist_song_span'], 18, ''); $gp_settings['artist_song_span_short'] = cutstr($gp_settings['artist_song_span'], $max_length, '');
if ($gp_settings['artist_song_span_short'] != $gp_settings['artist_song_span']) { if ($gp_settings['artist_song_span_short'] != $gp_settings['artist_song_span']) {
$gp_settings['artist_song_span_short'] .= '...'; $gp_settings['artist_song_span_short'] .= '...';
} }
@ -151,6 +154,7 @@ class SidebarPosts extends WP_Widget {
function update($new_instance, $old_instance) { function update($new_instance, $old_instance) {
$instance = $old_instance; $instance = $old_instance;
$instance['css_class'] = strip_tags($new_instance['css_class']);
$instance['title'] = strip_tags($new_instance['title']); $instance['title'] = strip_tags($new_instance['title']);
$instance['cats'] = strip_tags($new_instance['cats']); $instance['cats'] = strip_tags($new_instance['cats']);
$instance['number'] = strip_tags($new_instance['number']); $instance['number'] = strip_tags($new_instance['number']);
@ -166,6 +170,8 @@ class SidebarPosts extends WP_Widget {
$instance['gd_sort'] = $_POST['gd_sort']; $instance['gd_sort'] = $_POST['gd_sort'];
$instance['gd_order'] = $_POST['gd_order']; $instance['gd_order'] = $_POST['gd_order'];
$instance['after_text'] = htmlspecialchars($new_instance['after_text']); $instance['after_text'] = htmlspecialchars($new_instance['after_text']);
$instance['max_length'] = strip_tags($new_instance['max_length']);
return $instance; return $instance;
} }
@ -184,13 +190,19 @@ class SidebarPosts extends WP_Widget {
'post_cats' => __('Yes', 'gp_lang'), 'post_cats' => __('Yes', 'gp_lang'),
'score_type' => __('Site Score', 'gp_lang'), 'score_type' => __('Site Score', 'gp_lang'),
'post_meta' => __('Yes', 'gp_lang'), 'post_meta' => __('Yes', 'gp_lang'),
'gd_sort' => 'review', 'gd_sort' => 'date',
'gd_order' => 'desc', 'gd_order' => 'desc',
'after_text' => '' 'after_text' => '',
'css_class' => '',
'max_length' => 999,
); );
$instance = wp_parse_args((array) $instance, $defaults); $instance = wp_parse_args((array) $instance, $defaults);
?> ?>
<p>
<label for="<?php echo $this->get_field_id('css_class'); ?>"><?php _e('CSS Class', 'gp_lang'); ?>:</label>
<br/><input type="text" id="<?php echo $this->get_field_id('css_class'); ?>" name="<?php echo $this->get_field_name('css_class'); ?>" value="<?php echo $instance['css_class']; ?>" />
</p>
<p> <p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'gp_lang'); ?>:</label> <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title', 'gp_lang'); ?>:</label>
<br/><input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" /> <br/><input type="text" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" />
@ -246,6 +258,9 @@ class SidebarPosts extends WP_Widget {
echo ' selected="selected"'; echo ' selected="selected"';
} ?>><?php _e('No', 'gp_lang'); ?></option> } ?>><?php _e('No', 'gp_lang'); ?></option>
</select> </select>
<label for="<?php echo $this->get_field_id('max_length'); ?>"><?php _e('Max length', 'gp_lang'); ?>:</label>
<br/><input type="text" id="<?php echo $this->get_field_id('max_length'); ?>" name="<?php echo $this->get_field_name('max_length'); ?>" value="<?php echo $instance['max_length']; ?>" size="3" />
</p> </p>
<p> <p>
<label for="post_from_to"><?php _e('Display Post From and To', 'gp_lang'); ?>:</label> <label for="post_from_to"><?php _e('Display Post From and To', 'gp_lang'); ?>:</label>
@ -290,9 +305,9 @@ class SidebarPosts extends WP_Widget {
<p> <p>
<label for="gd_sort"><?php _e('Sort By', 'gp_lang'); ?>:</label> <label for="gd_sort"><?php _e('Sort By', 'gp_lang'); ?>:</label>
<select id="gd_sort" name="gd_sort"> <select id="gd_sort" name="gd_sort">
<option value="date"<?php if ($instance['gd_sort'] == __('date', 'gp_lang')) { <option value="date"<?php if ($instance['gd_sort'] == __('date', 'gp_lang')) { echo ' selected="selected"'; } ?>><?php _e('Date', 'gp_lang'); ?></option>
echo ' selected="selected"'; <option value="rand"<?php if ($instance['gd_sort'] == __('rand', 'gp_lang')) { echo ' selected="selected"'; } ?>><?php _e('Random', 'gp_lang'); ?></option>
} ?>><?php _e('Date', 'gp_lang'); ?></option> <option value="comment_count"<?php if ($instance['gd_sort'] == __('comment_count', 'gp_lang')) { echo ' selected="selected"'; } ?>><?php _e('Comment count', 'gp_lang'); ?></option>
</select> </select>
</p> </p>
<p> <p>

View File

@ -656,27 +656,29 @@ ul.navmenu li a.logout:hover {
font-size: 14px; font-size: 14px;
line-height: 14px; line-height: 14px;
font-weight: bold; font-weight: bold;
padding: 5px 0;
width: 95%;
} }
/* Sidebarposts widget */ /* Sidebarposts widget */
#sidebar .widget.sidebarposts { .widget.sidebarposts {
} }
#sidebar .widget.sidebarposts h3, .widget.sidebarposts h3,
#sidebar .widget.sidebarposts .post-loop .post-text { .widget.sidebarposts .post-loop .post-text {
color: #34a089 !important; color: #34a089 !important;
text-align: left; text-align: left;
font-size: 12px; font-size: 12px;
} }
#sidebar .widget.sidebarposts h3 { .widget.sidebarposts h3 {
background: transparent; background: transparent;
border: 0px; border: 0px;
padding: 0; padding: 0;
margin: 0; margin: 0;
} }
#sidebar .widget.sidebarposts .post-loop { .widget.sidebarposts .post-loop {
width: 100% !important; width: 100% !important;
min-height: 88px; min-height: 88px;
margin: 0; margin: 0;
@ -684,7 +686,7 @@ ul.navmenu li a.logout:hover {
border: none; border: none;
} }
#sidebar .widget.sidebarposts .post-loop .post-text { .widget.sidebarposts .post-loop .post-text {
float: right; float: right;
width: 58%; width: 58%;
overflow: visible; overflow: visible;
@ -730,6 +732,40 @@ ul.navmenu li a.logout:hover {
} }
.widget.sidebarposts .we_recommend {
margin-top: 2px;
}
.widget.sidebarposts .we_recommend .post-loop .post-thumbnail {
width: 100%;
text-align: center;
}
.widget.sidebarposts .we_recommend .post-loop .post-text {
width: 100%;
float: left;
margin-left: 10px;
}
.widget.sidebarposts .top_10 {
margin-top: -27px;
}
.widget.sidebarposts .top_10 h3 {
background: none repeat scroll 0 0 #D7EDEB;
border: 1px solid #4DA6A2;
color: #34A089;
display: block;
font-size: 14px;
font-weight: bold;
line-height: 14px;
text-shadow: none;
padding: 5px 0px;
margin-bottom: 5px;
color: #34A089 !important;
text-align: center;
}
.widget.top_members img, .widget.top_members img,
.widget.sidebarposts img { .widget.sidebarposts img {