-
-
- // The following code was modifed to allow module-defined breadcrumbs.
- // Everything else in this file is a copy of the default page.html.php file.
- ?>
- if (!empty($breadcrumbs)): ?>
-
- if ($theme->page_subtype != "login"): ?>
- = new View("sidebar.html") ?>
- endif ?>
-
-
-
-
- = $theme->page_bottom() ?>
-
-
\ No newline at end of file
diff --git a/3.0/modules/calendarview/views/user_profile_calendarview.html.php b/3.0/modules/calendarview/views/user_profile_calendarview.html.php
new file mode 100644
index 00000000..4d9d68a9
--- /dev/null
+++ b/3.0/modules/calendarview/views/user_profile_calendarview.html.php
@@ -0,0 +1,86 @@
+
+
+ // Generate a list of items within the specified 3 month time-frame.
+ $items = ORM::factory("item")
+ ->viewable()
+ ->where("owner_id", "=", $user_id)
+ ->where("type", "!=", "album")
+ ->where("captured", ">=", mktime(0, 0, 0, $user_month-2, 1, $user_year))
+ ->where("captured", "<", mktime(0, 0, 0, $user_month+1, 1, ($user_year)))
+ ->order_by("captured")
+ ->find_all();
+
+ // Set up some initial variables.
+ $calendar_year = $user_year;
+ $counter_months = $user_month - 2;
+ if ($counter_months < 1) {
+ $counter_months += 12;
+ $calendar_year--;
+ }
+ $counter_days = 0;
+ $counter = 0;
+
+ // Print the first month.
+ print "
";
+ if ((count($items) > 0) && (date("n", $items[$counter]->captured) == $counter_months)) {
+ $month_url = url::site("calendarview/month/" . $calendar_year . "/" . $user_id . "/" . $counter_months . "/");
+ } else {
+ $month_url = "";
+ }
+ $calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
+
+ // Loop through each photo taken during the 3 month time frame, and see what month and day they were taken on.
+ // Make the corresponding dates on the calendars into clickable links.
+ while ($counter < (count($items))) {
+
+ // Check and see if we've switched to a new month.
+ // If so, render the current calendar and set up a new one.
+ // Continue printing empty months until we reach the next photo or the last month.
+ while (date("n", $items[$counter]->captured) != $counter_months) {
+ echo $calendar->render();
+ print "
";
+ if (date("n", $items[$counter]->captured) == $counter_months) {
+ $month_url = url::site("calendarview/month/" . $calendar_year . "/" . $user_id . "/" . $counter_months . "/");
+ } else {
+ $month_url = "";
+ }
+ $calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
+ }
+
+ // If the day of the current photo is different then the day of the previous photo,
+ // then add a link to the calendar for this date and set the current day to this day.
+ if (date("j", $items[$counter]->captured) > $counter_days) {
+ $counter_days = date("j", $items[$counter]->captured);
+ $calendar->event($counter_days, url::site("calendarview/day/" . $calendar_year . "/" . $user_id . "/" . $counter_months . "/" . $counter_days));
+ }
+
+ // Move onto the next photo.
+ $counter++;
+ }
+
+ // Print out the last calendar to be generated.
+ echo $calendar->render();
+ print "
";
+ $counter_months++;
+
+ // If the calendar that was previously rendered was not the final month,
+ // then print out a few empty months to fill the remaining space.
+ while ($counter_months < $user_month + 1) {
+ print "
=t("Default Zoom Level:"); ?> =t("This value represents how far zoomed in or out the map will start out at. A value of 0 (the coarsest) will zoom the map all of the way out, while higher numbers will zoom the map further in. Depending on the map type, the highest zoom value you can use will be around 19-23."); ?>
+
diff --git a/3.0/modules/google_analytics/controllers/admin_google_analytics.php b/3.0/modules/google_analytics/controllers/admin_google_analytics.php
index 4a28ad8d..328e294a 100644
--- a/3.0/modules/google_analytics/controllers/admin_google_analytics.php
+++ b/3.0/modules/google_analytics/controllers/admin_google_analytics.php
@@ -1,53 +1,62 @@
-_get_view();
- }
-
- public function handler() {
- access::verify_csrf();
-
- $form = $this->_get_form();
- if ($form->validate()) {
- module::set_var(
- "google_analytics", "code", $form->google_analytics_code->analytics_code->value);
- url::redirect("admin/google_analytics");
- }
-
- print $this->_get_view($form);
- }
-
- private function _get_view($form=null) {
- $v = new Admin_View("admin.html");
- $v->content = new View("admin_google_analytics.html");
- $v->content->form = empty($form) ? $this->_get_form() : $form;
- return $v;
- }
-
- private function _get_form() {
- $form = new Forge("admin/google_analytics/handler", "", "post", array("id" => "g-admin-form"));
- $group = $form->group("google_analytics_code");
- $group->input("analytics_code")->label(t('Enter the Web-Property-ID given by Google.'))->rules("required")->value(module::get_var("google_analytics", "code"));
- $group->submit("submit")->value(t("Save"));
-
- return $form;
- }
+_get_view();
+ }
+
+ public function handler()
+ {
+ access::verify_csrf();
+
+ $form = $this->_get_form();
+
+ if ($form->validate())
+ {
+ module::set_var("google_analytics", "code", $form->google_analytics_code->inputs["analytics_code"]->value);
+ module::set_var("google_analytics", "owneradmin_hidden", $form->google_analytics_code->inputs["analytics_owneradmin_hidden"]->value);
+ url::redirect("admin/google_analytics");
+ }
+
+ print $this->_get_view($form);
+ }
+
+ private function _get_view($form=null)
+ {
+ $v = new Admin_View("admin.html");
+ $v->content = new View("admin_google_analytics.html");
+ $v->content->form = empty($form) ? $this->_get_form() : $form;
+ return $v;
+ }
+
+ private function _get_form()
+ {
+ $form = new Forge("admin/google_analytics/handler", "", "post",
+ array("id" => "gAdminForm"));
+ $group = $form->group("google_analytics_code");
+ $group->input("analytics_code")->label(t('Enter the Web-Property-ID given by Google.'))->rules("required")->value(module::get_var("google_analytics", "code"));
+ $group->checkbox("analytics_owneradmin_hidden")->label(t("Omit code for owner and admin"))
+ ->checked(module::get_var("google_analytics", "owneradmin_hidden", false) == 1);
+ $group->submit("submit")->value(t("Save"));
+
+ return $form;
+ }
}
\ No newline at end of file
diff --git a/3.0/modules/google_analytics/helpers/google_analytics_event.php b/3.0/modules/google_analytics/helpers/google_analytics_event.php
index 0672cf73..1cef1b08 100644
--- a/3.0/modules/google_analytics/helpers/google_analytics_event.php
+++ b/3.0/modules/google_analytics/helpers/google_analytics_event.php
@@ -1,28 +1,28 @@
-get("settings_menu")
- ->append(Menu::factory("link")
- ->id("google_analytics_menu")
- ->label(t("Google Analytics"))
- ->url(url::site("admin/google_analytics")));
- }
-}
+get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("google_analytics_menu")
+ ->label(t("Google Analytics"))
+ ->url(url::site("admin/google_analytics")));
+ }
+}
diff --git a/3.1/modules/themeroller/helpers/themeroller_installer.php b/3.0/modules/google_analytics/helpers/google_analytics_installer.php
similarity index 53%
rename from 3.1/modules/themeroller/helpers/themeroller_installer.php
rename to 3.0/modules/google_analytics/helpers/google_analytics_installer.php
index a2d5688d..0e52c059 100644
--- a/3.1/modules/themeroller/helpers/themeroller_installer.php
+++ b/3.0/modules/google_analytics/helpers/google_analytics_installer.php
@@ -1,44 +1,45 @@
- "zip", "zlib" => "zlib"));
- }
- return $messages;
- }
-}
+
-
-
- ';
-
- return $google_code;
- }
-}
+item->owner_id != identity::active_user()->id) && (identity::active_user()->admin == 0) ) {
+ $u_o = 0;
+ }
+
+ if ( $u_o == 0 || ( ($u_o == 1) && (module::get_var("google_analytics", "owneradmin_hidden") == 0) ) ) {
+ $google_code = '
+
+
+ ';
+
+ return $google_code;
+ }
+
+ }
+
+}
+
+
diff --git a/3.0/modules/google_analytics/module.info b/3.0/modules/google_analytics/module.info
index ca5a51e3..b49b147b 100644
--- a/3.0/modules/google_analytics/module.info
+++ b/3.0/modules/google_analytics/module.info
@@ -1,7 +1,7 @@
-name = "Google Analytics"
-description = "Renders the Google Analytics Code at the end of the page. Written by 'mcp'."
-version = 2
-author_name = ""
-author_url = ""
-info_url = "http://codex.gallery2.org/Gallery3:Modules:google_analytics"
-discuss_url = "http://gallery.menalto.com/forum_module_google_analytics"
+name = Google Analytics
+description = Renders the Google Analytics Code in the head of the page.
+version = 4
+author_name = ""
+author_url = ""
+info_url = "http://codex.gallery2.org/Gallery3:Modules:google_analytics"
+discuss_url = "http://gallery.menalto.com/node/88884"
diff --git a/3.0/modules/google_analytics/views/admin_google_analytics.html.php b/3.0/modules/google_analytics/views/admin_google_analytics.html.php
index e516f35a..9abc3c39 100644
--- a/3.0/modules/google_analytics/views/admin_google_analytics.html.php
+++ b/3.0/modules/google_analytics/views/admin_google_analytics.html.php
@@ -1,6 +1,6 @@
-
-
-
- = t("Google Analytics Adminstration") ?>
- = $form ?>
-
+
+
+
+ = t("Google Analytics Adminstration") ?>
+ = $form ?>
+
diff --git a/3.0/modules/gwtorganize/controllers/admin_gwtorganise.php b/3.0/modules/gwtorganize/controllers/admin_gwtorganise.php
index 0c2b0486..4f4ea8ec 100644
--- a/3.0/modules/gwtorganize/controllers/admin_gwtorganise.php
+++ b/3.0/modules/gwtorganize/controllers/admin_gwtorganise.php
@@ -1,7 +1,7 @@
join("hidden_items", "items.id", "hidden_items.item_id", "LEFT OUTER");
+ $this->where("hidden_items.item_id", "IS", NULL);
+ return parent::children($limit, $offset, $where, $order_by);
}
- return $messages;
}
}
diff --git a/3.0/modules/hide/models/hidden_item.php b/3.0/modules/hide/models/hidden_item.php
index bc98f59c..5f00b6a6 100644
--- a/3.0/modules/hide/models/hidden_item.php
+++ b/3.0/modules/hide/models/hidden_item.php
@@ -1,7 +1,7 @@
loaded()) {
+ throw new Kohana_404_Exception();
+ }
+
+ // Grab the first 10 items for the specified display type.
+ // Default to "popular" if display type is invalid.
+ $template = new View("latestupdates_user_profile_carousel.html");
+ $template->items = latestupdates_Controller::items($str_display_type, $user_id, 10);
+
+ // Figure out the text for the "View more" link.
+ if ($str_display_type == "recent") {
+ $template->str_view_more_title = t("View all recent uploads");
+ } elseif ($str_display_type == "albums") {
+ $template->str_view_more_title = t("View all recent albums");
+ } else {
+ $template->str_view_more_title = t("View more popular uploads");
+ }
+
+ // Set up a "View more" url.
+ $template->str_view_more_url = url::site("latestupdates/users/{$str_display_type}/{$user_id}");
+
+ // Display the page.
+ print $template;
+
+ // Make item links in the carousel load as virtual albums for the view type instead of the regular album.
+ item::set_display_context_callback("latestupdates_Controller::get_display_context",
+ $str_display_type, $user_id);
+ return ;
+ }
+
+ public function users($str_display_type, $user_id) {
+ // Generate a dynamic page with items uploaded by a specific user ($user_id).
+
+ // Make sure user_id is valid.
+ $current_user = ORM::factory("user", $user_id);
+ if (!$current_user->loaded()) {
+ throw new Kohana_404_Exception();
+ }
+
+ // Figure out how many items to display on each page.
+ $page_size = module::get_var("gallery", "page_size", 9);
+
+ // Figure out which page # the visitor is on and
+ // don't allow the visitor to go below page 1.
+ $page = Input::instance()->get("page", 1);
+ if ($page < 1) {
+ url::redirect("latestupdates/users/{$str_display_type}/{$user_id}");
+ }
+
+ // If this page was reached from a breadcrumb, figure out what page to load from the show id.
+ $show = Input::instance()->get("show");
+ if ($show) {
+ $child = ORM::factory("item", $show);
+ $index = latestupdates_Controller::_get_position($child, $str_display_type, $user_id);
+ if ($index) {
+ $page = ceil($index / $page_size);
+ if ($page == 1) {
+ url::redirect("latestupdates/users/{$str_display_type}/{$user_id}");
+ } else {
+ url::redirect("latestupdates/users/{$str_display_type}/{$user_id}?page=$page");
+ }
+ }
+ }
+
+ // First item to display.
+ $offset = ($page - 1) * $page_size;
+
+ // Determine the total number of items,
+ // for page numbering purposes.
+ $count = latestupdates_Controller::items_count($str_display_type, $user_id);
+
+ // Figure out what the highest page number is.
+ $max_pages = ceil($count / $page_size);
+
+ // Don't let the visitor go past the last page.
+ if ($max_pages && $page > $max_pages) {
+ url::redirect("latestupdates/users/{$str_display_type}/{$user_id}?page=$max_pages");
+ }
+
+ // Figure out which items to display on this page.
+ $children = latestupdates_Controller::items($str_display_type, $user_id, $page_size, $offset);
+
+ // Figure out the page title.
+ $str_page_title = "";
+ if ($str_display_type == "recent") {
+ $str_page_title = t("Recent Uploads");
+ } elseif ($str_display_type == "albums") {
+ $str_page_title = t("Recent Albums");
+ } else {
+ $str_page_title = t("Most Viewed");
+ }
+
+ // Set up the previous and next page buttons.
+ if ($page > 1) {
+ $previous_page = $page - 1;
+ $view->previous_page_link = url::site("latestupdates/users/{$str_display_type}/{$user_id}?page={$previous_page}");
+ }
+ if ($page < $max_pages) {
+ $next_page = $page + 1;
+ $view->next_page_link = url::site("latestupdates/users/{$str_display_type}/{$user_id}?page={$next_page}");
+ }
+
+ // Set up and display the actual page.
+ $root = item::root();
+ $template = new Theme_View("page.html", "collection", "LatestUpdates");
+ $template->page_title = t("Gallery :: Latest Updates");
+ $template->set_global(
+ array("page" => $page,
+ "max_pages" => $max_pages,
+ "page_size" => $page_size,
+ "children" => $children,
+ "breadcrumbs" => array(
+ Breadcrumb::instance($root->title, $root->url())->set_first(),
+ Breadcrumb::instance(t("User profile: %name", array("name" => $current_user->display_name())),
+ url::site("user_profile/show/{$user_id}")),
+ Breadcrumb::instance($str_page_title,
+ url::site("latestupdates/users/{$str_display_type}/{$user_id}"))->set_last()),
+ "children_count" => $count));
+ $template->content = new View("dynamic.html");
+ $template->content->title = $str_page_title;
+
+ // Display the page.
+ print $template;
+
+ // Set up the callback so links within the photo page will lead to photos within the virtual album
+ // instead of the actual album.
+ item::set_display_context_callback("latestupdates_Controller::get_display_context",
+ $str_display_type, $user_id);
+ }
public function albums($id) {
// Figure out how many items to display on each page.
$page_size = module::get_var("gallery", "page_size", 9);
+ // Load the parent album.
+ $item = ORM::factory("item", $id);
+
// Figure out which page # the visitor is on and
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
@@ -30,18 +165,27 @@ class latestupdates_Controller extends Controller {
url::redirect("latestupdates/albums/{$item->id}");
}
+ // If this page was reached from a breadcrumb, figure out what page to load from the show id.
+ $show = Input::instance()->get("show");
+ if ($show) {
+ $child = ORM::factory("item", $show);
+ $index = latestupdates_Controller::_get_position($child, "descendants", $item->id);
+ if ($index) {
+ $page = ceil($index / $page_size);
+ if ($page == 1) {
+ url::redirect("latestupdates/albums/{$item->id}");
+ } else {
+ url::redirect("latestupdates/albums/{$item->id}?page=$page");
+ }
+ }
+ }
+
// First item to display.
$offset = ($page - 1) * $page_size;
- $item = ORM::factory("item", $id);
-
// Determine the total number of items,
// for page numbering purposes.
- $count = $item
- ->viewable()
- ->where("type", "!=", "album")
- ->order_by("created", "DESC")
- ->descendants_count();
+ $count = latestupdates_Controller::items_count("descendants", $item->id);
// Figure out what the highest page number is.
$max_pages = ceil($count / $page_size);
@@ -52,11 +196,7 @@ class latestupdates_Controller extends Controller {
}
// Figure out which items to display on this page.
- $children = $item
- ->viewable()
- ->where("type", "!=", "album")
- ->order_by("created", "DESC")
- ->descendants($page_size, $offset);
+ $children = latestupdates_Controller::items("descendants", $item->id, $page_size, $offset);
// Set up the previous and next page buttons.
if ($page > 1) {
@@ -68,40 +208,73 @@ class latestupdates_Controller extends Controller {
$view->next_page_link = url::site("latestupdates/albums/{$item->id}?page={$next_page}");
}
+ // Set up breadcrumbs.
+ $breadcrumbs = array();
+ $counter = 0;
+ $breadcrumbs[] = Breadcrumb::instance(t("Recent Uploads"), url::site("latestupdates/albums/{$item->id}"))->set_last();
+ $parent_item = $item;
+ while ($parent_item->id != 1) {
+ $breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
+ $parent_item = ORM::factory("item", $parent_item->parent_id);
+ }
+ $breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
+ $breadcrumbs = array_reverse($breadcrumbs, true);
+
// Set up and display the actual page.
+ $root = item::root();
$template = new Theme_View("page.html", "collection", "LatestUpdates");
$template->page_title = t("Gallery :: Latest Updates");
- $template->set_global("page", $page);
- $template->set_global("page_size", $page_size);
- $template->set_global("max_pages", $max_pages);
- $template->set_global("children", $children);
- $template->set_global("children_count", $count);
+ $template->set_global(
+ array("page" => $page,
+ "max_pages" => $max_pages,
+ "page_size" => $page_size,
+ "children" => $children,
+ "breadcrumbs" => $breadcrumbs,
+ "children_count" => $count));
$template->content = new View("dynamic.html");
- $template->content->title = t("Latest Updates");
+ $template->content->title = t("Recent Uploads");
+
+ // Display the page.
print $template;
+
+ // Set up the callback so links within the photo page will lead to photos within the virtual album
+ // instead of the actual album.
+ item::set_display_context_callback("latestupdates_Controller::get_display_context",
+ "descendants", $item->id);
}
public function updates() {
- // Figure out how many items to display on each page.
- $page_size = module::get_var("gallery", "page_size", 9);
+ // Figure out how many items to display on each page.
+ $page_size = module::get_var("gallery", "page_size", 9);
- // Figure out which page # the visitor is on and
- // don't allow the visitor to go below page 1.
- $page = Input::instance()->get("page", 1);
+ // Figure out which page # the visitor is on and
+ // don't allow the visitor to go below page 1.
+ $page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("latestupdates/updates");
}
+ // If this page was reached from a breadcrumb, figure out what page to load from the show id.
+ $show = Input::instance()->get("show");
+ if ($show) {
+ $child = ORM::factory("item", $show);
+ $index = latestupdates_Controller::_get_position($child, "recent", 0);
+ if ($index) {
+ $page = ceil($index / $page_size);
+ if ($page == 1) {
+ url::redirect("latestupdates/updates");
+ } else {
+ url::redirect("latestupdates/updates?page=$page");
+ }
+ }
+ }
+
// First item to display.
$offset = ($page - 1) * $page_size;
// Determine the total number of items,
// for page numbering purposes.
- $count = ORM::factory("item")
- ->viewable()
- ->where("type", "!=", "album")
- ->find_all()
- ->count();
+ $count = latestupdates_Controller::items_count("recent", 0);
// Figure out what the highest page number is.
$max_pages = ceil($count / $page_size);
@@ -112,11 +285,7 @@ class latestupdates_Controller extends Controller {
}
// Figure out which items to display on this page.
- $items = ORM::factory("item")
- ->viewable()
- ->where("type", "!=", "album")
- ->order_by("created", "DESC")
- ->find_all($page_size, $offset);
+ $items = latestupdates_Controller::items("recent", 0, $page_size, $offset);
// Set up the previous and next page buttons.
if ($page > 1) {
@@ -129,16 +298,298 @@ class latestupdates_Controller extends Controller {
}
// Set up and display the actual page.
+ $root = item::root();
$template = new Theme_View("page.html", "collection", "LatestUpdates");
- $template->page_title = t("Gallery :: Latest Updates");
- $template->set_global("page", $page);
- $template->set_global("page_size", $page_size);
- $template->set_global("max_pages", $max_pages);
- $template->set_global("children", $items);
- $template->set_global("children_count", $count);
- $template->content = new View ("dynamic.html");
- $template->content->title = t("Latest Updates");
+ $template->page_title = t("Gallery :: Latest Updates");
+ $template->set_global(
+ array("page" => $page,
+ "max_pages" => $max_pages,
+ "page_size" => $page_size,
+ "children" => $items,
+ "breadcrumbs" => array(
+ Breadcrumb::instance($root->title, $root->url())->set_first(),
+ Breadcrumb::instance(t("Recent Uploads"),
+ url::site("latestupdates/updates"))->set_last()),
+ "children_count" => $count));
+ $template->content = new View("dynamic.html");
+ $template->content->title = t("Recent Uploads");
+
+ // Display the page.
print $template;
+
+ // Set up the callback so links within the photo page will lead to photos within the virtual album
+ // instead of the actual album.
+ item::set_display_context_callback("latestupdates_Controller::get_display_context",
+ "recent", 0);
}
-}
\ No newline at end of file
+ static function get_display_context($item, $str_display_type, $user_id) {
+ // Set up display elements on the photo page to link to the virtual album.
+ // Valid $str_display_type values are popular, recent, albums and descendants.
+ // $user_id can be set to "0" to search site wide.
+ // For "descendants", $user_id should be the album id #.
+
+ // Figure out page title.
+ $str_page_title = "";
+ if ($str_display_type == "recent") {
+ $str_page_title = t("Recent Uploads");
+ } elseif ($str_display_type == "albums") {
+ $str_page_title = t("Recent Albums");
+ } elseif ($str_display_type == "descendants") {
+ $str_page_title = t("Recent Uploads");
+ } else {
+ $str_page_title = t("Most Viewed");
+ }
+
+ // Figure out item position.
+ $position = latestupdates_Controller::_get_position($item, $str_display_type, $user_id);
+
+ // Figure out which items are the previous and next items with the virtual album.
+ if ($position > 1) {
+ list ($previous_item, $ignore, $next_item) =
+ latestupdates_Controller::items($str_display_type, $user_id, 3, $position - 2);
+ } else {
+ $previous_item = null;
+ list ($next_item) = latestupdates_Controller::items($str_display_type, $user_id, 1, $position);
+ }
+
+ // Figure out total number of items (excluding albums).
+ $count = latestupdates_Controller::items_count($str_display_type, $user_id);
+
+ // Set up breadcrumbs.
+ $root = item::root();
+ $breadcrumbs = array();
+ if ($user_id == 0) {
+ $breadcrumbs[0] = Breadcrumb::instance($root->title, $root->url())->set_first();
+ $breadcrumbs[1] = Breadcrumb::instance($str_page_title,
+ url::site("latestupdates/updates?show={$item->id}"));
+ $breadcrumbs[2] = Breadcrumb::instance($item->title, $item->url())->set_last();
+ } else {
+ if ($str_display_type == "descendants") {
+ $counter = 0;
+ $breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
+ $breadcrumbs[] = Breadcrumb::instance(t("Recent Uploads"), url::site("latestupdates/albums/{$user_id}?show={$item->id}"));
+ $parent_item = ORM::factory("item", $user_id);
+ while ($parent_item->id != 1) {
+ $breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
+ $parent_item = ORM::factory("item", $parent_item->parent_id);
+ }
+ $breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
+ $breadcrumbs = array_reverse($breadcrumbs, true);
+ } else {
+ $current_user = ORM::factory("user", $user_id);
+ $breadcrumbs[0] = Breadcrumb::instance($root->title, $root->url())->set_first();
+ $breadcrumbs[1] = Breadcrumb::instance(t("User profile: %name", array("name" => $current_user->display_name())),
+ url::site("user_profile/show/{$user_id}"));
+ $breadcrumbs[2] = Breadcrumb::instance($str_page_title,
+ url::site("latestupdates/users/{$str_display_type}/{$user_id}?show={$item->id}"));
+ $breadcrumbs[3] = Breadcrumb::instance($item->title, $item->url())->set_last();
+ }
+ }
+
+ // Return the display elements.
+ return array("position" => $position,
+ "previous_item" => $previous_item,
+ "next_item" => $next_item,
+ "sibling_count" => $count,
+ "breadcrumbs" => $breadcrumbs
+ );
+ }
+
+ static function items_count($str_display_type, $user_id) {
+ // Figure out the total number of items.
+ // Valid $str_display_type values are popular, recent, albums and descendants.
+ // $user_id can be set to "0" to search site wide.
+ // For "descendants", $user_id should be the album id #.
+
+ // If $str_display_type is albums, then we only want albums.
+ // If it's not, then we want everything except albums.
+ if ($str_display_type == "albums") {
+ // This is only used for user profiles, so we always want
+ // results from a specific user.
+ $count = ORM::factory("item")
+ ->viewable()
+ ->where("type", "=", "album")
+ ->where("owner_id", "=", $user_id)
+ ->count_all();
+ } else {
+
+ // If $user_id is not 0 we only want results from a specific user,
+ // Or else we want results from any user.
+ if ($user_id == 0) {
+ $count = ORM::factory("item")
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->count_all();
+ } else {
+
+ // If type is descendants, then user_id is actually an item id#.
+ if ($str_display_type == "descendants") {
+ $item = ORM::factory("item", $user_id);
+ $count = $item
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->order_by("created", "DESC")
+ ->descendants_count();
+ } else {
+ $count = ORM::factory("item")
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->where("owner_id", "=", $user_id)
+ ->count_all();
+ }
+ }
+ }
+
+ return $count;
+ }
+
+ static function items($str_display_type, $user_id, $limit=null, $offset=null) {
+ // Query the database for a list of items to display in the virtual album.
+ // Valid $str_display_type values are popular, recent, albums and descendants.
+ // $user_id can be set to "0" to search site wide.
+ // For "descendants", $user_id should be the album id #.
+
+ // Figure out search parameters based on $str_display_type.
+ $str_where = array();
+ $str_orderby_field = "";
+ if ($str_display_type == "recent") {
+ $str_where = array(array("type", "!=", "album"));
+ $str_orderby_field = "created";
+ } elseif ($str_display_type == "albums") {
+ $str_where = array(array("type", "=", "album"));
+ $str_orderby_field = "created";
+ } else {
+ $str_where = array(array("type", "!=", "album"));
+ $str_orderby_field = "view_count";
+ }
+
+ // Search the database for matching items.
+
+ // Searching for descendants of a parent album is significantly
+ // different from the other query types, so we're doing this one
+ // seperately.
+ if ($str_display_type == "descendants") {
+ $item = ORM::factory("item", $user_id);
+ return $item
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->order_by("created", "DESC")
+ ->descendants($limit, $offset);
+ }
+
+ // If $user_id is greater then 0, limit results
+ // to a specific user.
+ if ($user_id == 0) {
+ return ORM::factory("item")
+ ->viewable()
+ ->merge_where($str_where)
+ ->order_by($str_orderby_field, "DESC")
+ ->find_all($limit, $offset);
+ } else {
+ return ORM::factory("item")
+ ->viewable()
+ ->merge_where($str_where)
+ ->where("owner_id", "=", $user_id)
+ ->order_by($str_orderby_field, "DESC")
+ ->find_all($limit, $offset);
+ }
+ }
+
+ private function _get_position($item, $str_display_type, $user_id) {
+ // Figure out the item's position within the virtual album.
+ // Valid $str_display_type values are popular, recent, albums and descendants.
+ // $user_id can be set to "0" to search site wide.
+ // For "descendants", $user_id should be the album id #.
+
+ // Figure out search conditions.
+ $str_where = array();
+ $str_orderby_field = "";
+ if ($str_display_type == "recent") {
+ $str_where = array(array("type", "!=", "album"));
+ $str_orderby_field = "created";
+ } elseif ($str_display_type == "albums") {
+ $str_where = array(array("type", "=", "album"));
+ $str_orderby_field = "created";
+ } else {
+ $str_where = array(array("type", "!=", "album"));
+ $str_orderby_field = "view_count";
+ }
+
+ // Count the number of records that have a higher orderby_field value then
+ // the item we're looking for.
+ $position = 0;
+ if ($user_id == 0) {
+ $position = ORM::factory("item")
+ ->viewable()
+ ->merge_where($str_where)
+ ->where($str_orderby_field, ">", $item->$str_orderby_field)
+ ->order_by($str_orderby_field, "DESC")
+ ->count_all();
+ } else {
+ if ($str_display_type == "descendants") {
+ $album_item = ORM::factory("item", $user_id);
+ $position = $album_item
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->where("created", ">", $item->created)
+ ->order_by("created", "DESC")
+ ->descendants_count();
+ } else {
+ $position = ORM::factory("item")
+ ->viewable()
+ ->where("owner_id", "=", $user_id)
+ ->merge_where($str_where)
+ ->where($str_orderby_field, ">", $item->$str_orderby_field)
+ ->order_by($str_orderby_field, "DESC")
+ ->count_all();
+ }
+ }
+
+ // Set up a db query for all records with the same orderby field value
+ // as the item we're looking for.
+ $items = ORM::factory("item");
+ if ($user_id == 0) {
+ $items->viewable()
+ ->merge_where($str_where)
+ ->where($str_orderby_field, "=", $item->$str_orderby_field)
+ ->order_by($str_orderby_field, "DESC");
+ } else {
+ if ($str_display_type == "descendants") {
+ $item_album = ORM::factory("item", $user_id);
+ $items = $item_album
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->where("created", "=", $item->created)
+ ->order_by("created", "DESC");
+ } else {
+ $items->viewable()
+ ->where("owner_id", "=", $user_id)
+ ->merge_where($str_where)
+ ->where($str_orderby_field, "=", $item->$str_orderby_field)
+ ->order_by($str_orderby_field, "DESC");
+ }
+ }
+
+ // Loop through each remaining match, increasing position by 1 each time
+ // until we find a match.
+ if ($str_display_type == "descendants") {
+ foreach ($items->descendants() as $row) {
+ $position++;
+ if ($row->id == $item->id) {
+ break;
+ }
+ }
+ } else {
+ foreach ($items->find_all() as $row) {
+ $position++;
+ if ($row->id == $item->id) {
+ break;
+ }
+ }
+ }
+
+ // Return the result.
+ return $position;
+ }
+}
diff --git a/3.0/modules/latestupdates/css/latestupdates_jcarousel.css b/3.0/modules/latestupdates/css/latestupdates_jcarousel.css
new file mode 100644
index 00000000..f123143d
--- /dev/null
+++ b/3.0/modules/latestupdates/css/latestupdates_jcarousel.css
@@ -0,0 +1,95 @@
+#jCarouselLite .carousel {
+ padding: 10px 0 0 0;
+ margin: 0 0 20px 10px;
+ position: relative;
+}
+
+#jCarouselLite .digg {
+ position: absolute;
+ left: 610px;
+ top: 110px;
+}
+
+#jCarouselLite .main {
+ margin-left: 0px;
+}
+
+#jCarouselLite .demo em {
+ color: #FF3300;
+ font-weight: bold;
+ font-size: 60%;
+ font-style: normal;
+}
+
+#jCarouselLite .carousel a.prev, #jCarouselLite .carousel a.next {
+ display: block;
+ float: left;
+ width: 30px;
+ height: 90px;
+ text-decoration: none;
+ background: url("../images/imageNavLeft.gif") left 60px no-repeat;
+}
+
+#jCarouselLite .carousel a.next {
+ background: url("../images/imageNavRight.gif") right 60px no-repeat;
+}
+
+#jCarouselLite .carousel a.next:hover {
+ background-image: url("../images/imageNavRightHover.gif");
+}
+
+#jCarouselLite .carousel a.prev:hover {
+ background-image: url("../images/imageNavLeftHover.gif");
+}
+
+#jCarouselLite .carousel a:hover, #jCarouselLite .carousel a:active {
+ border: none;
+ outline: none;
+}
+
+#jCarouselLite .carousel .jCarouselLite {
+ border: 1px solid black;
+ float: left;
+ background-color: #dfdfdf;
+
+ /* Needed for rendering without flicker */
+ position: relative;
+ visibility: hidden;
+ left: -5000px;
+}
+
+#jCarouselLite .carousel ul {
+ margin: 0;
+}
+
+#jCarouselLite .carousel li img,
+#jCarouselLite .carousel li p {
+ background-color: #fff;
+ margin: 10px;
+}
+
+#jCarouselLite .widget img {
+ cursor: pointer;
+}
+
+#jCarouselLite .mid {
+ margin-left: 80px;
+ width: 400px;
+ height: 300px;
+}
+
+#jCarouselLite .vertical {
+ margin-left: 90px;
+}
+
+#jCarouselLite .vertical .jCarouselLite { /* so that in IE 6, the carousel div doesnt expand to fill the space */
+ width: 90px;
+}
+
+#jCarouselLite .imageSlider li img,
+#jCarouselLite .imageSlider li p,
+#jCarouselLite .imageSliderExt li img ,
+#jCarouselLite .imageSliderExt li p {
+ width: 400px;
+ height: 300px;
+}
diff --git a/3.0/modules/latestupdates/helpers/latestupdates_block.php b/3.0/modules/latestupdates/helpers/latestupdates_block.php
index 4af70f06..158ffa96 100644
--- a/3.0/modules/latestupdates/helpers/latestupdates_block.php
+++ b/3.0/modules/latestupdates/helpers/latestupdates_block.php
@@ -1,7 +1,7 @@
title = $new_title;
- $this->url = $new_url;
+class latestupdates_event_Core {
+ static function show_user_profile($data) {
+ // Display links on the user profile pages for recent photos/albums
+ // and most popular photos from the specified user.
+ $v = new View("latestupdates_user_profile_info.html");
+ $v->user_id = $data->user->id;
+ $data->content[] = (object) array("title" => t("Latest Updates"), "view" => $v);
}
}
diff --git a/3.1/modules/downloadalbum/helpers/downloadalbum_theme.php b/3.0/modules/latestupdates/helpers/latestupdates_theme.php
similarity index 79%
rename from 3.1/modules/downloadalbum/helpers/downloadalbum_theme.php
rename to 3.0/modules/latestupdates/helpers/latestupdates_theme.php
index 8cda59fc..1de3116f 100644
--- a/3.1/modules/downloadalbum/helpers/downloadalbum_theme.php
+++ b/3.0/modules/latestupdates/helpers/latestupdates_theme.php
@@ -1,7 +1,7 @@
css("downloadalbum_menu.css");
+ // Load CSS and JS for jCarouselLite.
+ return $theme->script("jcarousellite_1.0.1.js") .
+ $theme->css("latestupdates_jcarousel.css");
}
}
diff --git a/3.0/modules/latestupdates/images/imageNavLeft.gif b/3.0/modules/latestupdates/images/imageNavLeft.gif
new file mode 100644
index 00000000..9c0e5af3
Binary files /dev/null and b/3.0/modules/latestupdates/images/imageNavLeft.gif differ
diff --git a/3.0/modules/latestupdates/images/imageNavLeftHover.gif b/3.0/modules/latestupdates/images/imageNavLeftHover.gif
new file mode 100644
index 00000000..0945b9eb
Binary files /dev/null and b/3.0/modules/latestupdates/images/imageNavLeftHover.gif differ
diff --git a/3.0/modules/latestupdates/images/imageNavRight.gif b/3.0/modules/latestupdates/images/imageNavRight.gif
new file mode 100644
index 00000000..ad4bb007
Binary files /dev/null and b/3.0/modules/latestupdates/images/imageNavRight.gif differ
diff --git a/3.0/modules/latestupdates/images/imageNavRightHover.gif b/3.0/modules/latestupdates/images/imageNavRightHover.gif
new file mode 100644
index 00000000..a5abcc99
Binary files /dev/null and b/3.0/modules/latestupdates/images/imageNavRightHover.gif differ
diff --git a/3.0/modules/latestupdates/js/jcarousellite_1.0.1.js b/3.0/modules/latestupdates/js/jcarousellite_1.0.1.js
new file mode 100644
index 00000000..07b82a6d
--- /dev/null
+++ b/3.0/modules/latestupdates/js/jcarousellite_1.0.1.js
@@ -0,0 +1,341 @@
+/**
+ * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
+ * @requires jQuery v1.2 or above
+ *
+ * http://gmarwaha.com/jquery/jcarousellite/
+ *
+ * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
+ * Dual licensed under the MIT and GPL licenses:
+ * http://www.opensource.org/licenses/mit-license.php
+ * http://www.gnu.org/licenses/gpl.html
+ *
+ * Version: 1.0.1
+ * Note: Requires jquery 1.2 or above from version 1.0.1
+ */
+
+/**
+ * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
+ *
+ * The HTML markup that is used to build the carousel can be as simple as...
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
+ * You don't need any special "class" attribute, or a special "css" file for this plugin.
+ * I am using a class attribute just for the sake of explanation here.
+ *
+ * To navigate the elements of the carousel, you need some kind of navigation buttons.
+ * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
+ * This need not be part of the carousel "div" itself. It can be any element in your page.
+ * Lets assume that the following elements in your document can be used as next, and prev buttons...
+ *
+ *
+ *
+ *
+ * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
+ * navigation buttons as options.
+ *
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev"
+ * });
+ *
+ * That's it, you would have now converted your raw div, into a magnificient carousel.
+ *
+ * There are quite a few other options that you can use to customize it though.
+ * Each will be explained with an example below.
+ *
+ * @param an options object - You can specify all the options shown below as an options object param.
+ *
+ * @option btnPrev, btnNext : string - no defaults
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev"
+ * });
+ * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
+ *
+ * @option btnGo - array - no defaults
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * btnGo: [".0", ".1", ".2"]
+ * });
+ * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
+ * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
+ * in the carousel. The index of the array represents the index of the element. What i mean is, if the
+ * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
+ * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
+ * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
+ * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
+ * The best part is that, the tab will "slide" based on the provided effect. :-)
+ *
+ * @option mouseWheel : boolean - default is false
+ * @example
+ * $(".carousel").jCarouselLite({
+ * mouseWheel: true
+ * });
+ * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
+ * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
+ * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
+ * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
+ * as well. They complement each other. To use both together, just supply the options required for both as shown below.
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * mouseWheel: true
+ * });
+ *
+ * @option auto : number - default is null, meaning autoscroll is disabled by default
+ * @example
+ * $(".carousel").jCarouselLite({
+ * auto: 800,
+ * speed: 500
+ * });
+ * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
+ * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
+ * Specify this value and magically your carousel will start auto scrolling.
+ *
+ * @option speed : number - 200 is default
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * speed: 800
+ * });
+ * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
+ * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
+ *
+ * @option easing : string - no easing effects by default.
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * easing: "bounceout"
+ * });
+ * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
+ * the carousel will slide based on the provided easing effect.
+ *
+ * @option vertical : boolean - default is false
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * vertical: true
+ * });
+ * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
+ * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
+ * display horizontally. The next and prev items will slide the items from left-right in this case.
+ *
+ * @option circular : boolean - default is true
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * circular: false
+ * });
+ * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
+ * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
+ * if you click on the "next" button after you reach the last element, you will stay in the last element itself
+ * and similarly for "previous" button and first element.
+ *
+ * @option visible : number - default is 3
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * visible: 4
+ * });
+ * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
+ * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
+ * last item half visible. This gives you the effect of showing the user that there are more images to the right.
+ *
+ * @option start : number - default is 0
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * start: 2
+ * });
+ * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
+ * has a start of 0, and so on.
+ *
+ * @option scrool : number - default is 1
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * scroll: 2
+ * });
+ * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
+ * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
+ * 2 items when you click the next or previous buttons.
+ *
+ * @option beforeStart, afterEnd : function - callbacks
+ * @example
+ * $(".carousel").jCarouselLite({
+ * btnNext: ".next",
+ * btnPrev: ".prev",
+ * beforeStart: function(a) {
+ * alert("Before animation starts:" + a);
+ * },
+ * afterEnd: function(a) {
+ * alert("After animation ends:" + a);
+ * }
+ * });
+ * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
+ * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
+ * are visible at the time of callback.
+ *
+ *
+ * @cat Plugins/Image Gallery
+ * @author Ganeshji Marwaha/ganeshread@gmail.com
+ */
+
+(function($) { // Compliant with jquery.noConflict()
+$.fn.jCarouselLite = function(o) {
+ o = $.extend({
+ btnPrev: null,
+ btnNext: null,
+ btnGo: null,
+ mouseWheel: false,
+ auto: null,
+
+ speed: 200,
+ easing: null,
+
+ vertical: false,
+ circular: true,
+ visible: 3,
+ start: 0,
+ scroll: 1,
+
+ beforeStart: null,
+ afterEnd: null
+ }, o || {});
+
+ return this.each(function() { // Returns the element collection. Chainable.
+
+ var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
+ var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
+
+ if(o.circular) {
+ ul.prepend(tLi.slice(tl-v-1+1).clone())
+ .append(tLi.slice(0,v).clone());
+ o.start += v;
+ }
+
+ var li = $("li", ul), itemLength = li.size(), curr = o.start;
+ div.css("visibility", "visible");
+
+ li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
+ ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
+ div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
+
+ var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation
+ var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items)
+ var divSize = liSize * v; // size of entire div(total length for just the visible items)
+
+ li.css({width: li.width(), height: li.height()});
+ ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
+
+ div.css(sizeCss, divSize+"px"); // Width of the DIV. length of visible images
+
+ if(o.btnPrev)
+ $(o.btnPrev).click(function() {
+ return go(curr-o.scroll);
+ });
+
+ if(o.btnNext)
+ $(o.btnNext).click(function() {
+ return go(curr+o.scroll);
+ });
+
+ if(o.btnGo)
+ $.each(o.btnGo, function(i, val) {
+ $(val).click(function() {
+ return go(o.circular ? o.visible+i : i);
+ });
+ });
+
+ if(o.mouseWheel && div.mousewheel)
+ div.mousewheel(function(e, d) {
+ return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
+ });
+
+ if(o.auto)
+ setInterval(function() {
+ go(curr+o.scroll);
+ }, o.auto+o.speed);
+
+ function vis() {
+ return li.slice(curr).slice(0,v);
+ };
+
+ function go(to) {
+ if(!running) {
+
+ if(o.beforeStart)
+ o.beforeStart.call(this, vis());
+
+ if(o.circular) { // If circular we are in first or last, then goto the other end
+ if(to<=o.start-v-1) { // If first, then goto last
+ ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
+ // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
+ curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
+ } else if(to>=itemLength-v+1) { // If last, then goto first
+ ul.css(animCss, -( (v) * liSize ) + "px" );
+ // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
+ curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
+ } else curr = to;
+ } else { // If non-circular and to points to first or last, we just return.
+ if(to<0 || to>itemLength-v) return;
+ else curr = to;
+ } // If neither overrides it, the curr will still be "to" and we can proceed.
+
+ running = true;
+
+ ul.animate(
+ animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
+ function() {
+ if(o.afterEnd)
+ o.afterEnd.call(this, vis());
+ running = false;
+ }
+ );
+ // Disable buttons when the carousel reaches the last/first, and enable when not
+ if(!o.circular) {
+ $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
+ $( (curr-o.scroll<0 && o.btnPrev)
+ ||
+ (curr+o.scroll > itemLength-v && o.btnNext)
+ ||
+ []
+ ).addClass("disabled");
+ }
+
+ }
+ return false;
+ };
+ });
+};
+
+function css(el, prop) {
+ return parseInt($.css(el[0], prop)) || 0;
+};
+function width(el) {
+ return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
+};
+function height(el) {
+ return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
+};
+
+})(jQuery);
\ No newline at end of file
diff --git a/3.0/modules/latestupdates/module.info b/3.0/modules/latestupdates/module.info
index a4916cd6..95aba927 100644
--- a/3.0/modules/latestupdates/module.info
+++ b/3.0/modules/latestupdates/module.info
@@ -1,7 +1,7 @@
name = "LatestUpdates"
description = "Display recently uploaded photos and videos."
version = 1
-author_name = ""
-author_url = ""
+author_name = "rWatcher"
+author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:latestupdates"
-discuss_url = "http://gallery.menalto.com/forum_module_latestupdates"
+discuss_url = "http://gallery.menalto.com/node/88936"
diff --git a/3.0/modules/latestupdates/views/latestupdates_user_profile_carousel.html.php b/3.0/modules/latestupdates/views/latestupdates_user_profile_carousel.html.php
new file mode 100644
index 00000000..1a3ada22
--- /dev/null
+++ b/3.0/modules/latestupdates/views/latestupdates_user_profile_carousel.html.php
@@ -0,0 +1,37 @@
+
+ if (count($items) == 0): ?>
+
diff --git a/3.0/modules/ldap/config/identity.php b/3.0/modules/ldap/config/identity.php
index 8c4136b2..343e3af8 100644
--- a/3.0/modules/ldap/config/identity.php
+++ b/3.0/modules/ldap/config/identity.php
@@ -34,10 +34,12 @@ $config["ldap"] = array(
"driver" => "ldap",
"allow_updates" => false,
"params" => array(
+ "guest_user" => "Guest",
"groups" => array("engineering", "everybody", "guest"),
"everybody_group" => "guest",
"registered_users_group" => "everybody",
"admins" => array("alice", "bob"),
+ "admin_mail" => "unknown@unknown.com",
"url" => "ldaps://ldap.mycompany.com/",
"group_domain" => "ou=Posix,ou=Groups,dc=ymcompany,dc=com",
"user_domain" => "ou=People,dc=MyCompany,dc=com",
diff --git a/3.0/modules/ldap/helpers/ldap_installer.php b/3.0/modules/ldap/helpers/ldap_installer.php
index d9bdbfd4..ae33fd7c 100644
--- a/3.0/modules/ldap/helpers/ldap_installer.php
+++ b/3.0/modules/ldap/helpers/ldap_installer.php
@@ -1,7 +1,7 @@
id = 0;
- self::$_guest_user->name = "Guest";
- self::$_guest_user->full_name = "Guest";
- self::$_guest_user->guest = true;
- self::$_guest_user->admin = false;
- self::$_guest_user->locale = null;
- self::$_guest_user->email = null;
- self::$_guest_user->groups = array($this->everybody());
- }
- return self::$_guest_user;
+ return self::lookup_user_by_name(self::$_params["guest_user"]);
}
/**
@@ -86,8 +84,8 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
* @see IdentityProvider_Driver::lookup_user.
*/
public function lookup_user($id) {
- if ($id == 0) {
- return $this->guest();
+ if ($id == LDAP_GUEST_ID) {
+ return self::lookup_user_by_name(self::$_params["guest_user"]);
}
$result = ldap_search(self::$_connection, self::$_params["user_domain"], "uidNumber=$id");
$entries = ldap_get_entries(self::$_connection, $result);
@@ -109,6 +107,19 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
if ($entries["count"] > 0) {
return new Ldap_User($entries[0]);
}
+ if ($name == self::$_params["guest_user"]) {
+ if (empty(self::$_guest_user)) {
+ self::$_guest_user = new Ldap_User();
+ self::$_guest_user->id = LDAP_GUEST_ID;
+ self::$_guest_user->name = "$name";
+ self::$_guest_user->full_name = "$name";
+ self::$_guest_user->guest = true;
+ self::$_guest_user->admin = false;
+ self::$_guest_user->locale = null;
+ self::$_guest_user->email = null;
+ }
+ return self::$_guest_user;
+ }
return null;
}
@@ -137,13 +148,20 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
* @see IdentityProvider_Driver::lookup_group.
*/
public function lookup_group($id) {
+ if ($id = LDAP_EVERYBODY_GROUP_ID) {
+ return self::lookup_group_by_name(self::$_params["everybody_group"]);
+ } else if ($id = LDAP_REGISTERED_USERS_ID) {
+ return self::lookup_group_by_name(self::$_params["registered_users_group"]);
+ }
$result = @ldap_search(self::$_connection, self::$_params["group_domain"], "gidNumber=$id");
$entry_id = ldap_first_entry(self::$_connection, $result);
if ($entry_id !== false) {
$cn_entry = ldap_get_values(self::$_connection, $entry_id, "cn");
$gid_number_entry = ldap_get_values(self::$_connection, $entry_id, "gidNumber");
- return new Ldap_Group($gid_number_entry[0], $cn_entry[0]);
+ if (in_array($cn_entry, self::$_params["groups"])) {
+ return new Ldap_Group($gid_number_entry[0], $cn_entry[0]);
+ }
}
return null;
}
@@ -160,7 +178,21 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
if ($entry_id !== false) {
$cn_entry = ldap_get_values(self::$_connection, $entry_id, "cn");
$gid_number_entry = ldap_get_values(self::$_connection, $entry_id, "gidNumber");
- return new Ldap_Group($gid_number_entry[0], $cn_entry[0]);
+ if (in_array($cn_entry, self::$_params["groups"])) {
+ return new Ldap_Group($gid_number_entry[0], $cn_entry[0]);
+ }
+ }
+ if ($name == self::$_params["everybody_group"]) {
+ if (!self::$_everybody_group) {
+ self::$_everybody_group = new Ldap_Group(LDAP_EVERYBODY_ID, $name);
+ }
+ return self::$_everybody_group;
+ }
+ if ($name == self::$_params["registered_users_group"]) {
+ if (!self::$_registered_users_group) {
+ self::$_registered_users_group = new Ldap_Group(LDAP_REGISTERED_USERS_ID, $name);
+ }
+ return self::$_registered_users_group;
}
return null;
}
@@ -171,7 +203,9 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
public function get_user_list($ids) {
$users = array();
foreach ($ids as $id) {
- $users[] = $this->lookup_user($id);
+ if ($user = $this->lookup_user($id)) {
+ $users[] = $user;
+ }
}
return $users;
}
@@ -182,21 +216,21 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
public function groups() {
$groups = array();
foreach (self::$_params["groups"] as $group_name) {
- $groups[] = $this->lookup_group_by_name($group_name);
+ if ($group = $this->lookup_group_by_name($group_name)) {
+ $groups[] = $group;
+ }
}
return $groups;
}
static function groups_for($user) {
- if ($user->guest) {
- return $user->groups;
- }
-
$result = ldap_search(self::$_connection, self::$_params["group_domain"],
"(memberUid=$user->name)");
$associated_groups = self::$_params["groups"];
$groups = array();
+ $in_everybody_group = false;
+ $in_registered_users_group = false;
for ($entry_id = ldap_first_entry(self::$_connection, $result);
$entry_id != false;
$entry_id = ldap_next_entry(self::$_connection, $entry_id)) {
@@ -205,6 +239,18 @@ class IdentityProvider_Ldap_Driver implements IdentityProvider_Driver {
if (in_array($group_name[0], $associated_groups)) {
$groups[] = new Ldap_Group($group_id[0], $group_name[0]);
}
+ if ($group_name[0] == self::$_params["everybody_group"]) {
+ $in_everybody_group = true;
+ }
+ if ($group_name[0] == self::$_params["registered_users_group"]) {
+ $in_registered_users_group = true;
+ }
+ }
+ if (!$in_everybody_group) {
+ $groups[] = self::lookup_group_by_name(self::$_params["everybody_group"]);
+ }
+ if (!$user->guest && !$in_registered_users_group) {
+ $groups[] = self::lookup_group_by_name(self::$_params["registered_users_group"]);
}
return $groups;
}
@@ -235,7 +281,7 @@ class Ldap_User implements User_Definition {
if (!empty($this->ldap_entry["displayname"][0])) {
return $this->ldap_entry["displayname"][0];
}
- return $this->ldap_entry["cn"][0];
+ return $this->full_name;
}
public function __get($key) {
@@ -257,10 +303,20 @@ class Ldap_User implements User_Definition {
IdentityProvider_Ldap_Driver::$_params["admins"]);
case "email":
- return $this->ldap_entry["mail"][0];
+ if (isset($this->ldap_entry["mail"])) {
+ return $this->ldap_entry["mail"][0];
+ } else if ($this->admin) {
+ IdentityProvider_Ldap_Driver::$_params["admin_mail"];
+ } else {
+ return null;
+ }
case "full_name":
- return $this->ldap_entry["cn"][0];
+ if (isset($this->ldap_entry["cn"])) {
+ return $this->ldap_entry["cn"][0];
+ } else {
+ return $this->name;
+ }
case "dn":
return $this->ldap_entry["dn"];
@@ -281,6 +337,12 @@ class Ldap_User implements User_Definition {
return sprintf("http://www.gravatar.com/avatar/%s.jpg?s=%d&r=pg%s",
md5($this->email), $size, $default ? "&d=" . urlencode($default) : "");
}
+
+ // Called e.g. by user_profile.php:_can_view_profile_pages()
+ // We don't have "empty" users, so just return true
+ public function loaded() {
+ return true;
+ }
}
class Ldap_Group implements Group_Definition {
diff --git a/3.0/modules/metadescription/helpers/metadescription_event.php b/3.0/modules/metadescription/helpers/metadescription_event.php
index 7e773d7e..579d7d43 100644
--- a/3.0/modules/metadescription/helpers/metadescription_event.php
+++ b/3.0/modules/metadescription/helpers/metadescription_event.php
@@ -1,7 +1,7 @@
append(Menu::factory("link")
- ->id("minislideshow")
- ->label(t("View MiniSlide Show"))
- ->url(url::site("minislideshow/showslideshow/" . $theme->item()->id))
- ->css_class("g-dialog-link")
- ->css_id("g-mini-slideshow-link"));
+ if ($theme->item()->children_count(array(array("type", "=", "photo")))) {
+ $menu
+ ->append(Menu::factory("link")
+ ->id("minislideshow")
+ ->label(t("View MiniSlide Show"))
+ ->url(url::site("minislideshow/showslideshow/" . $theme->item()->id))
+ ->css_class("g-dialog-link")
+ ->css_id("g-mini-slideshow-link"));
+ }
}
static function photo_menu($menu, $theme) {
diff --git a/3.0/modules/minislideshow/helpers/minislideshow_installer.php b/3.0/modules/minislideshow/helpers/minislideshow_installer.php
index 3edcf98a..6ff23dcf 100644
--- a/3.0/modules/minislideshow/helpers/minislideshow_installer.php
+++ b/3.0/modules/minislideshow/helpers/minislideshow_installer.php
@@ -1,7 +1,7 @@
"", "updates" => 0);
$refreshCache = true;
}
-
+
//Check the ability to access the Gallery3 GitHub
$GitHub = null;
try {
@@ -93,6 +93,29 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
$update_count = 0;
if($refreshCache == true){
+ // Only poll GalleryModules.com once for the ini file.
+ $fp = fopen('gm.ini', 'w');
+ $fp2 = fopen('gm_core.ini','w');
+ if(function_exists("curl_init")) {
+ $cp = curl_init("http://www.gallerymodules.com/gallerymodules.ini");
+ curl_setopt($cp, CURLOPT_FILE, $fp);
+ $buffer = curl_exec($cp);
+ curl_close($cp);
+ fclose($fp);
+
+ $cp = curl_init("http://www.gallerymodules.com/core.ini");
+ curl_setopt($cp, CURLOPT_FILE, $fp2);
+ $buffer = curl_exec($cp);
+ curl_close($cp);
+ fclose($fp2);
+ } else {
+ fwrite($fp,file_get_contents("http://www.gallerymodules.com/gallerymodules.ini"));
+ fclose($fp);
+
+ fwrite($fp2,file_get_contents("http://www.gallerymodules.com/core.ini"));
+ fclose($fp2);
+ }
+
foreach (module::available() as $this_module_name => $module_info) {
$font_color_local = "black";
@@ -115,8 +138,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
list ($core_version, $core_server) = $this->get_remote_module_version($this_module_name, "CORE");
$font_color_core = $this->get_module_version_color ($module_info->version, $module_info->code_version, $core_version);
if(!is_numeric($core_version)) {
- list ($contrib_version, $contrib_server) = $this->get_remote_module_version($this_module_name, "CONTRIB");
- $font_color_contrib = $this->get_module_version_color ($module_info->version, $module_info->code_version, $contrib_version);
list ($gh_version, $gh_server) = $this->get_remote_module_version($this_module_name, "GH");
$font_color_gh = $this->get_module_version_color ($module_info->version, $module_info->code_version, $gh_version);
}
@@ -132,14 +153,7 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
$core_dlink = "http://github.com/gallery/gallery3/tree/master/modules/".$this_module_name;
}
}
-
- if (is_numeric($contrib_version)) {
- if($contrib_version > $module_info->version) {
- $contrib_dlink = "http://github.com/gallery/gallery3-contrib/tree/master/".
- substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")) ."/modules/".$this_module_name;
- }
- }
-
+
if (is_numeric($gh_version)) {
if($gh_version > $module_info->version) {
$this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
@@ -171,6 +185,11 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
Cache::instance()->set("moduleupdates_cache_updates", serialize($cache_updates), array("ModuleUpdates"), null);
log::success("moduleupdates", t("Completed checking remote GitHub for modules updates."));
}
+
+ if(is_file('gm.ini'))
+ unlink('gm.ini');
+ if(is_file('gm_core.ini'))
+ unlink('gm_core.ini');
$view->content->vars = $cache;
$view->content->update_time = $cache_updates['date'];
@@ -243,7 +262,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
return $font_color;
}
-
/**
* Parses the known GitHub repositories for new versions of modules.
*
@@ -252,7 +270,6 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
* gather the version information. Uses the following locations;
*
* http://github.com/gallery/gallery3
- * http://github.com/gallery/gallery3-contrib
* http://www.gallerymodules.com
*
* @author brentil
@@ -267,87 +284,69 @@ class Admin_Moduleupdates_Controller extends Admin_Controller {
$file = null;
switch ($server_location) {
- case "CONTRIB":
- //Check the Gallery3 Community Contributions GitHub
- if ($file == null) {
- try {
- $thisInstalledVersion = gallery::VERSION;
- //Gallery versions prior to 3.0.2 contained the codename in the version string
- if (substr_count($thisInstalledVersion, ' ') > 0 ){
- $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strpos($thisInstalledVersion," "));
- }
- //Truncate the minor version number
- if (substr_count($thisInstalledVersion, '.') > 1 ){
- $thisInstalledVersion = substr_replace($thisInstalledVersion,"",strripos($thisInstalledVersion,"."));
- }
- $file = fopen ("http://github.com/gallery/gallery3-contrib/raw/master/".
- $thisInstalledVersion ."/modules/".$module_name."/module.info", "r");
-
- if ($file != null) {
- $server = '(GCC)';
- }
- }
- catch (Exception $e) {
- //echo 'Message: ' .$e->getMessage() . ' ';
- }
- }
- break;
case "CORE":
//Check the main Gallery3 GitHub
if ($file == null) {
try {
- $file = fopen ("http://github.com/gallery/gallery3/raw/master/modules/".$module_name."/module.info", "r");
+ if(file_exists('gm_core.ini')) {
+ $file = 1;
+ }
if ($file != null) {
+ $gm_core_array = parse_ini_file('gm_core.ini',true);
$server = '(G)';
}
}
- catch (Exception $e) {
+ catch (Exception $e) {
}
}
break;
case "GH":
- //Check GalleryModules.com
- if ($file == null) {
+ //Parse ini file from GalleryModules.com
try {
- $this_gm_repo = str_replace(".","",substr_replace(gallery::VERSION,"",strpos(gallery::VERSION," ")));
- if($this_gm_repo == "30"){
- $file = fopen ("http://www.gallerymodules.com/m/".$module_name, "r");
- } else {
- $file = fopen ("http://www.gallerymodules.com/".$this_gm_repo."m/".$module_name, "r");
- }
+ if(file_exists('gm.ini')) {
+ $file = 1;
+ }
if ($file != null) {
+ $gm_array = parse_ini_file('gm.ini',true);
$server = '(GH)';
}
}
catch (Exception $e) {
+ echo $e;
}
- }
break;
- }
-
- if ($file != null) {
- while (!feof ($file)) {
- $line = fgets ($file, 1024);
- if ($server_location == "GH"){
- //GH stores only the version info
- if($line == "Not entered" or $line == "See git") {
- $line = "";
- }
- if (substr_count($line, '.') > 0) {
- $line = str_replace('.','',$line);
- }
- $version = $line;
- break;
- } else {
- //Regular expression to find & gather the version number in the remote module.info file
- if (preg_match ("@version = (.*)@i", $line, $out)) {
- $version = $out[1];
- break;
+ }
+
+ if ($file != null) {
+ //Search in the GM listing
+ if ($server_location == "GH"){
+ //Search if this is a Gallery 3.0 module
+ if(array_key_exists($module_name,$gm_array)){
+ if(array_key_exists('g3',$gm_array[$module_name])){
+ $version = $gm_array[$module_name]['g3'];
+ }
+ if($version == ''){
+ if(array_key_exists('g31',$gm_array[$module_name])){
+ $version = $gm_array[$module_name]['g31'];
}
}
- }
- fclose ($file);
+ if($version == ''){
+ if(array_key_exists('codex',$gm_array[$module_name])){
+ $version = $gm_array[$module_name]['codex'];
+ }
+ }
+ } else { //Module not found
+ $version = '';
+ }
+ //Search in the Core listing
+ } else {
+ if(array_key_exists($module_name,$gm_core_array)){
+ $version = $gm_core_array[$module_name]['version'];
+ } else { //Module not found
+ $version = '';
+ }
}
+ }
return array ($version, $server);
}
diff --git a/3.0/modules/moduleupdates/helpers/moduleupdates_event.php b/3.0/modules/moduleupdates/helpers/moduleupdates_event.php
index ebafb880..440cf409 100644
--- a/3.0/modules/moduleupdates/helpers/moduleupdates_event.php
+++ b/3.0/modules/moduleupdates/helpers/moduleupdates_event.php
@@ -1,6 +1,6 @@
delete("ModuleUpdates");
//create the blank ModuleUpdates cache entry with an expiration of 0 days
@@ -34,7 +34,7 @@ class moduleupdates_installer {
}
static function upgrade($version) {
- module::set_version("moduleupdates", 8);
+ module::set_version("moduleupdates", 11);
//Remove the ModuleUpdates cache entry 'JIC'
Cache::instance()->delete("ModuleUpdates");
//Empty the ModuleUpdates cache entry so our new version starts from scratch
diff --git a/3.0/modules/moduleupdates/module.info b/3.0/modules/moduleupdates/module.info
index 7c73c340..cf66ddd7 100755
--- a/3.0/modules/moduleupdates/module.info
+++ b/3.0/modules/moduleupdates/module.info
@@ -1,7 +1,7 @@
name = "ModuleUpdates"
description = "Compares your installed module version against the ones stored in the GitHub."
-version = 8
+version = 11
author_name = "brentil"
author_url = "http://gallery.menalto.com/user/153736"
info_url = "http://codex.gallery2.org/Gallery3:Modules:moduleupdates"
-discuss_url = "http://gallery.menalto.com/node/96574"
+discuss_url = "http://gallery.menalto.com/node/96574"
\ No newline at end of file
diff --git a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php
index 18ff31ed..b5722d21 100644
--- a/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php
+++ b/3.0/modules/moduleupdates/views/admin_moduleupdates.html.php
@@ -24,7 +24,7 @@
-
= t("Versions are compared from GitHub for Gallery Core (GC), Gallery Community Contributions (GCC), and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?>
+
= t("Versions are compared from GitHub for Gallery Core (GC) and GalleryModules.com (GM). Versions downloaded from the forums will not be shown.") ?>