Skip to content

Commit

Permalink
1.2 (2011-09-12):
Browse files Browse the repository at this point in the history
	- added: widget slider view
  • Loading branch information
rickterheide committed Sep 13, 2011
1 parent 325085f commit f09beb4
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 15 deletions.
6 changes: 5 additions & 1 deletion manifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin_manifest>
<field key="author" value="ColdTrick IT Solutions" />
<field key="version" value="1.1.1" />
<field key="version" value="1.2" />
<field key="description" value="Adds a image to a blog" />
<field key="website" value="http://www.coldtrick.com/" />
<field key="licence" value="GNU Public License version 2" />
Expand All @@ -12,6 +12,10 @@
=====================
Version history
=====================
1.2 (2011-09-12):
- added: widget slider view
1.1.1 (2011-08-18):
- fixed: broken preview mode
- fixed: preview/draft not cleaning up correctly in edit mode
Expand Down
28 changes: 28 additions & 0 deletions views/default/blog_tools/css.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,31 @@
.blog_tools_info_wrapper .blog_post_icon {
margin: 0 5px 0 0;
}

#widget_blog_items_container > div {
display: none;
}
#widget_blog_items_navigator {
border-top: 1px dotted #CCCCCC;
padding-top: 5px;
text-align: center;
}
#widget_blog_items_navigator > span {
border: 1px solid #CCCCCC;
cursor: pointer;
padding: 2px 4px;
margin: 0 2px;
}

#widget_blog_items_navigator > span.active,
#widget_blog_items_navigator > span:hover {
background: #CCCCCC;
}

#widget_blog_items_navigator > span.active {
cursor: auto;
}
#widget_blog_items_container .groupicon{
float: left;
margin-right: 20px;
}
34 changes: 24 additions & 10 deletions views/default/object/blog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,40 @@
* @package ElggBlog
* @uses $entity Optionally, the blog post to view
*/
if (isset($vars["entity"])) {
$context = get_context();
if (isset($vars["entity"]))
{
$entity = $vars["entity"];
$full_view = $vars["full"];

// get icon settings
if($full_view){
if($full_view)
{
$icon_align = get_plugin_setting("full_align", "blog_tools");
$icon_size = get_plugin_setting("full_size", "blog_tools");

if(empty($icon_align)){
if(empty($icon_align))
{
$icon_align = "right";
}

if(empty($icon_size)){
if(empty($icon_size))
{
$icon_size = "large";
}
} else {
}
else
{
$icon_align = get_plugin_setting("listing_align", "blog_tools");
$icon_size = get_plugin_setting("listing_size", "blog_tools");

if(empty($icon_align)){
if(empty($icon_align))
{
$icon_align = "left";
}

if(empty($icon_size)){
if(empty($icon_size))
{
$icon_size = "small";
}
}
Expand All @@ -56,7 +65,7 @@
$comments_on = true;
}

if ((get_context() == "search") && ($entity instanceof ElggObject)) {
if (($context == "search") && ($entity instanceof ElggObject)) {

//display the correct layout depending on gallery or list view
if (get_input('search_viewtype') == "gallery") {
Expand All @@ -76,6 +85,9 @@
$owner = $vars['user'];
$canedit = false;
}


echo "<div id='widget_blog_item_" . $entity->getGUID() . "'>";
?>
<div class="contentWrapper singleview">

Expand Down Expand Up @@ -146,6 +158,7 @@
echo $entity->description;
echo "<div class='clearfloat'></div>";
} else {

$body = "";
if(get_plugin_setting("listing_strapline", "blog_tools") == "time"){
$body .= date("F j, Y", $entity->time_created) . " - ";
Expand All @@ -159,6 +172,7 @@
}

echo $body;

echo "<div class='clearfloat'></div>";
}

Expand Down Expand Up @@ -193,9 +207,9 @@
?>
</div>
</div>
</div>

<?php

<?php
}

}
3 changes: 2 additions & 1 deletion views/default/widgets/index_blog/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

$view_mode_options_values = array(
"list" => elgg_echo("blog_tools:widgets:index_blog:view_mode:list"),
"preview" => elgg_echo("blog_tools:widgets:index_blog:view_mode:preview")
"preview" => elgg_echo("blog_tools:widgets:index_blog:view_mode:preview"),
"slider" => elgg_echo("blog_tools:widgets:index_blog:view_mode:slider")
);

$noyes_options = array(
Expand Down
65 changes: 62 additions & 3 deletions views/default/widgets/index_blog/view.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
set_context("search");
}

if($widget->view_mode == 'slider')
{
set_context("slider");
}

$options = array(
"type" => "object",
"subtype" => "blog",
Expand All @@ -23,12 +28,66 @@
"view_type_toggle" => false
);

if($widget->show_featured == "yes"){
if($widget->show_featured == "yes")
{
$options["metadata_name_value_pairs"] = array("featured" => true);
}

if($blogs = elgg_list_entities_from_metadata($options)){
echo $blogs;

if($blogs = elgg_list_entities_from_metadata($options))
{
if(get_context() == 'slider')
{
$blog_entities = elgg_get_entities_from_metadata($options);

echo '<div class="contentWrapper">
<div id="widget_blog_items_container">';
echo $blogs;
echo "</div>";

echo "<div id='widget_blog_items_navigator'>";

foreach($blog_entities as $key => $blog)
{
echo "<span rel='widget_blog_item_" . $blog->getGUID() . "'>" . ($key + 1). "</span>";
}

?>
</div>
<script type="text/javascript">
function rotateBlogItems(){
if($("#widget_blog_items_navigator .active").next().length === 0){
$("#widget_blog_items_navigator>span:first").click();
} else {
$("#widget_blog_items_navigator .active").next().click();
}
}

$(document).ready(function(){
$("#widget_blog_items_navigator>span:first").addClass("active");
var active = $("#widget_blog_items_navigator>span:first").attr("rel");
$("#" + active).show();

$("#widget_blog_items_navigator span").click(function(){
$("#widget_blog_items_navigator span.active").removeClass("active");
$(this).addClass("active");

$("#widget_blog_items_container>div").hide();
var active = $(this).attr("rel");
$("#" + active).show();
});

setInterval (rotateBlogItems, 10000);

});
</script>
</div>
<?php
}
else
{
echo $blogs;
}
} else {
echo elgg_view("page_elements/contentwrapper", array("body" => elgg_echo("blog_tools:widgets:index_blog:no_result")));
}
Expand Down

0 comments on commit f09beb4

Please sign in to comment.