This commit is contained in:
redmatrix 2015-07-07 16:50:25 -07:00
commit 6b41074396
15 changed files with 80 additions and 87 deletions

View file

@ -72,33 +72,20 @@ function check_upstream_directory() {
set_config('system', 'directory_server', '');
}
function get_globaldir_setting($observer) {
if($observer)
$globaldir = get_xconfig($observer,'directory','globaldir');
else
$globaldir = ((array_key_exists('globaldir',$_SESSION)) ? intval($_SESSION['globaldir']) : false);
if($globaldir === false)
$globaldir = get_config('directory','globaldir');
return $globaldir;
}
function get_safemode_setting($observer) {
function get_directory_setting($observer, $setting) {
if ($observer)
$safe_mode = get_xconfig($observer,'directory','safe_mode');
$ret = get_xconfig($observer, 'directory', $setting);
else
$safe_mode = ((array_key_exists('safemode',$_SESSION)) ? intval($_SESSION['safemode']) : false);
$ret = ((array_key_exists($setting,$_SESSION)) ? intval($_SESSION[$setting]) : false);
if($safe_mode === false)
$safe_mode = get_config('directory','safe_mode');
if($ret === false)
$ret = get_config('directory', $setting);
if($safe_mode === false)
$safe_mode = 1;
if($setting == 'safe_mode' && $ret === false)
$ret = 1;
return $safe_mode;
return $ret;
}
/**
@ -110,49 +97,37 @@ function dir_sort_links() {
$observer = get_observer_hash();
$safe_mode = get_safemode_setting($observer);
$globaldir = get_globaldir_setting($observer);
$safe_mode = get_directory_setting($observer, 'safemode');
$globaldir = get_directory_setting($observer, 'globaldir');
$pubforums = get_directory_setting($observer, 'pubforums');
// Build urls without order and pubforums so it's easy to tack on the changed value
// Probably there's an easier way to do this
$directory_sort_order = get_config('system','directory_sort_order');
if(! $directory_sort_order)
$directory_sort_order = 'date';
$current_order = (($_REQUEST['order']) ? $_REQUEST['order'] : $directory_sort_order);
$suggest = (($_REQUEST['suggest']) ? '&suggest=' . $_REQUEST['suggest'] : '');
$url = 'directory?f=';
$tmp = array_merge($_GET,$_POST);
unset($tmp['order']);
unset($tmp['q']);
unset($tmp['f']);
$sorturl = $url . http_build_query($tmp);
$tmp = array_merge($_GET,$_POST);
unset($tmp['suggest']);
unset($tmp['pubforums']);
unset($tmp['global']);
unset($tmp['safe']);
unset($tmp['q']);
unset($tmp['f']);
$forumsurl = $url . http_build_query($tmp);
$forumsurl = $url . http_build_query($tmp) . $suggest;
$o = replace_macros(get_markup_template('dir_sort_links.tpl'), array(
'$header' => t('Directory Options'),
'$normal' => t('Alphabetic'),
'$reverse' => t('Reverse Alphabetic'),
'$date' => t('Newest to Oldest'),
'$reversedate' => t('Oldest to Newest'),
'$sort' => t('Sort'),
'$selected_sort' => $current_order,
'$sorturl' => $sorturl,
'$forumsurl' => $forumsurl,
'$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'','',' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
'$pubforums' => array('pubforums', t('Public Forums Only'),(x($_REQUEST,'pubforums') ? $_REQUEST['pubforums'] : ''),'','',' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''),
'$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'','',' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''),
'$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
'$pubforums' => array('pubforums', t('Public Forums Only'),$pubforums,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&pubforums="+(this.checked ? 1 : 0)\''),
'$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''),
));
return $o;

View file

@ -278,7 +278,7 @@ function dir_tagblock($link,$r) {
$o = '';
$observer = get_observer_hash();
if(! get_globaldir_setting($observer))
if(! get_directory_setting($observer, 'globaldir'))
return $o;

View file

@ -132,7 +132,7 @@ function widget_suggestions($arr) {
'profile' => $rr['xchan_url'],
'name' => $rr['xchan_name'],
'photo' => $rr['xchan_photo_m'],
'ignlnk' => z_root() . '/suggest?ignore=' . $rr['xchan_hash'],
'ignlnk' => z_root() . '/directory?ignore=' . $rr['xchan_hash'],
'conntxt' => t('Connect'),
'connlnk' => $connlnk,
'ignore' => t('Ignore/Hide')

View file

@ -19,6 +19,7 @@ function directory_init(&$a) {
$observer = get_observer_hash();
$global_changed = false;
$safe_changed = false;
$pubforums_changed = false;
if(array_key_exists('global',$_REQUEST)) {
$globaldir = intval($_REQUEST['global']);
@ -37,9 +38,19 @@ function directory_init(&$a) {
if($safe_changed) {
$_SESSION['safemode'] = $safemode;
if($observer)
set_xconfig($observer,'directory','safe_mode',$safemode);
set_xconfig($observer,'directory','safemode',$safemode);
}
if(array_key_exists('pubforums',$_REQUEST)) {
$pubforums = intval($_REQUEST['pubforums']);
$pubforums_changed = true;
}
if($pubforums_changed) {
$_SESSION['pubforums'] = $pubforums;
if($observer)
set_xconfig($observer,'directory','pubforums',$pubforums);
}
}
function directory_content(&$a) {
@ -51,18 +62,14 @@ function directory_content(&$a) {
$observer = get_observer_hash();
$globaldir = get_globaldir_setting($observer);
$globaldir = get_directory_setting($observer, 'globaldir');
// override your personal global search pref if we're doing a navbar search of the directory
if(intval($_REQUEST['navsearch']))
$globaldir = 1;
$safe_mode = get_safemode_setting($observer);
$safe_mode = get_directory_setting($observer, 'safemode');
$pubforums = null;
if(array_key_exists('pubforums',$_REQUEST))
$pubforums = intval($_REQUEST['pubforums']);
if(! $pubforums)
$pubforums = null;
$pubforums = get_directory_setting($observer, 'pubforums');
$o = '';
nav_set_selected('directory');
@ -375,7 +382,13 @@ function directory_content(&$a) {
'$entries' => $entries,
'$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle,
'$submit' => t('Find'),
'$next' => alt_pager($a,$j['records'], t('next page'), t('previous page'))
'$next' => alt_pager($a,$j['records'], t('next page'), t('previous page')),
'$sort' => t('Sort options'),
'$normal' => t('Alphabetic'),
'$reverse' => t('Reverse Alphabetic'),
'$date' => t('Newest to Oldest'),
'$reversedate' => t('Oldest to Newest'),
'$suggest' => $suggest ? '&suggest=1' : ''
));

View file

@ -196,10 +196,6 @@ a.wall-item-name-link {
filter:alpha(opacity=100);
}
.wall-item-wrapper-end {
clear: both;
}
.shared_header {
margin-bottom: 20px;
}

View file

@ -741,8 +741,8 @@ a.rateme, div.rateme {
}
.wall-item-conv {
margin-top: 5px;
margin-bottom: 25px;
padding-top: 5px;
padding-bottom: 10px;
}
@ -1932,12 +1932,14 @@ nav .dropdown-menu {
background-color: $comment_item_colour;
border-bottom-left-radius: $radiuspx;
border-bottom-right-radius: $radiuspx;
word-wrap: break-word;
}
.section-content-wrapper-np {
background-color: $comment_item_colour;
border-bottom-left-radius: $radiuspx;
border-bottom-right-radius: $radiuspx;
word-wrap: break-word;
}
[id^="cloud-index-"]:hover td,

View file

@ -21,7 +21,6 @@
}
.wall-item-conv {
margin-bottom: 10px;
margin-top: 10px;
margin-left: 10px;
padding-top: 10px;
padding-left: 10px;
}

View file

@ -46,7 +46,7 @@ if (! $radius)
if (! $shadow)
$shadow = "0";
if (! $converse_width)
$converse_width = "676";
$converse_width = "656";
if(! $top_photo)
$top_photo = '48px';
if(! $comment_indent)

View file

@ -165,8 +165,7 @@
</div>
<div class="clear"></div>
</div>
<div class="wall-item-wrapper-end"></div>
<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>
<div class="clear{{if $indent}} {{$indent}}{{/if}}"></div>
</div>
{{if $item.toplevel}}
{{foreach $item.children as $child}}

View file

@ -179,8 +179,7 @@
</div>
<div class="clear"></div>
</div>
<div class="wall-item-wrapper-end"></div>
<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>
<div class="clear{{if $indent}} {{$indent}}{{/if}}"></div>
</div>
</div>
{{if $item.comment_lastcollapsed}}

View file

@ -5,11 +5,4 @@
{{include file="field_checkbox.tpl" field=$globaldir}}
{{include file="field_checkbox.tpl" field=$pubforums}}
{{$sort}}: <select onchange='window.location.href="{{$sorturl}}&order="+this.value'>
<option value='normal' {{if $selected_sort == 'normal'}}selected='selected'{{/if}}>{{$normal}}</option>
<option value='reverse' {{if $selected_sort == 'reverse'}}selected='selected'{{/if}}>{{$reverse}}</option>
<option value='date' {{if $selected_sort == 'date'}}selected='selected'{{/if}}>{{$date}}</option>
<option value='reversedate' {{if $selected_sort == 'reversedate'}}selected='selected'{{/if}}>{{$reversedate}}</option>
</select><br />
</div>

View file

@ -1,6 +1,18 @@
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<div class="btn-group pull-right">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="{{$sort}}">
<i class="icon-sort"></i>
</button>
<ul class="dropdown-menu">
<li><a href="directory?f=&order=date{{$suggest}}">{{$date}}</a></li>
<li><a href="directory?f=&order=normal{{$suggest}}">{{$normal}}</a></li>
<li><a href="directory?f=&order=reversedate{{$suggest}}">{{$reversedate}}</a></li>
<li><a href="directory?f=&order=reverse{{$suggest}}">{{$reverse}}</a></li>
</ul>
</div>
<h2>{{$dirlbl}}{{if $search}}:&nbsp;{{$safetxt}}{{/if}}</h2>
<div class="clear"></div>
</div>
{{foreach $entries as $entry}}
{{include file="direntry.tpl"}}

View file

@ -1,9 +1,14 @@
<div class="page">
<div class="generic-content-wrapper" id="page-content-wrapper" >
{{if $title}}<h2 class="page-title">{{$title}}</h2>{{/if}}
<div class="generic-content-wrapper" id="page-content-wrapper" >
{{if $title}}
<div class="section-title-wrapper">
<h2 class="page-title">{{$title}}</h2>
</div>
{{/if}}
<div class="section-content-wrapper">
<div class="page-author"><a class="page-author-link" href="{{$auth_url}}">{{$author}}</a></div>
<div class="page-date">{{$date}}</div>
<div class="page-body">{{$body}}</div>
</div>
</div>
</div>
</div>

View file

@ -21,7 +21,7 @@
{{$comment}}
<div class="wall-item-outside-wrapper-end{{$indent}}" ></div>
<div class="clear{{if $indent}} {{$indent}}{{/if}}"></div>
</div>
</div>

View file

@ -57,7 +57,7 @@
<a href='{{$item.conv.href}}' id='context-{{$item.id}}' title='{{$item.conv.title}}'>{{$item.conv.title}}</a>
</div>
{{/if}}
<div class="wall-item-outside-wrapper-end {{$item.indent}}" ></div>
<div class="clear{{if $indent}} {{$indent}}{{/if}}"></div>
</div>
</div>