From: friendica Date: Tue, 19 Jun 2012 10:27:51 +0000 (-0700) Subject: randomise page results of desired X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9c4f69cf7fb4637d0dd1b308b105124a78d5a211;p=friendica-addons.git randomise page results of desired --- diff --git a/page.tgz b/page.tgz index 7fcbf750..43eb2b56 100644 Binary files a/page.tgz and b/page.tgz differ diff --git a/page/page.css b/page/page.css index f145ee0f..b8d84fef 100644 --- a/page/page.css +++ b/page/page.css @@ -1,13 +1,13 @@ -#page-settings-label { +#page-settings-label, #page-random-label { float: left; width: 200px; margin-bottom: 25px; } -#page-max-pages { +#page-max-pages, #page-random { float: left; } diff --git a/page/page.php b/page/page.php index 1d2aec63..80d902de 100755 --- a/page/page.php +++ b/page/page.php @@ -26,11 +26,13 @@ function page_uninstall() { } -function page_getpage($uid) { +function page_getpage($uid,$randomise = false) { $pagelist = array(); + $random = (($randomise) ? ' order by rand ' : ' order by name asc '); + $contacts = q("SELECT `id`, `url`, `name`, `micro`FROM `contact` WHERE `network`= 'dfrn' AND `forum` = 1 AND `uid` = %d order by name asc ", @@ -89,7 +91,9 @@ function page_network_mod_init($a,$b) { $show_total = intval(get_pconfig(local_user(),'page','max_pages')); if($show_total === false) $show_total = 6; - $contacts = page_getpage($a->user['uid']); + $randomise = intval(get_pconfig(local_user(),'page','randomise')); + + $contacts = page_getpage($a->user['uid'],$randomise); $total_shown = 0; $more = false; @@ -116,6 +120,8 @@ function page_plugin_settings_post($a,$post) { return; set_pconfig(local_user(),'page','max_pages',intval($_POST['page_max_pages'])); + set_pconfig(local_user(),'page','randomise',intval($_POST['page_random'])); + info( t('Page settings updated.') . EOL); } @@ -134,6 +140,10 @@ function page_plugin_settings(&$a,&$s) { $max_pages = get_pconfig(local_user(),'page','max_pages'); if($max_pages === false) $max_pages = 6; + + $randomise = intval(get_pconfig(local_user(),'page','randomise')); + $randomise_checked = (($randomise) ? ' checked="checked" ' : ''); + /* Add some HTML to the existing form */ @@ -142,7 +152,12 @@ function page_plugin_settings(&$a,&$s) { $s .= '
'; $s .= ''; $s .= ''; - $s .= '
'; + $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; + + $s .= ''; /* provide a submit button */