From a50706317435d09cacb95cad0a6ccaf8ae5b5f6c Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 26 Mar 2016 18:43:38 +0100 Subject: move link to /locs to settings menu if we have more than one location and some template work on locs --- include/widgets.php | 20 +++++++++---- mod/locs.php | 11 +++---- mod/manage.php | 4 +-- view/css/mod_locs.css | 33 +++++++++++++++++++-- view/pdl/mod_locs.pdl | 4 +++ view/pdl/mod_uexport.pdl | 4 +++ view/tpl/channel.tpl | 4 --- view/tpl/locmanage.tpl | 77 +++++++++++++++++++++++++----------------------- 8 files changed, 100 insertions(+), 57 deletions(-) create mode 100644 view/pdl/mod_locs.pdl create mode 100644 view/pdl/mod_uexport.pdl diff --git a/include/widgets.php b/include/widgets.php index deb514915..010fcf0ae 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -501,6 +501,12 @@ function widget_settings_menu($arr) { if($abk) $abook_self_id = $abk[0]['abook_id']; + $hublocs = q("select count(*) as total from hubloc where hubloc_hash = '%s'", + dbesc($channel['channel_hash']) + ); + + $hublocs = (($hublocs[0]['total'] > 1) ? true : false); + $tabs = array( array( 'label' => t('Account settings'), @@ -534,14 +540,16 @@ function widget_settings_menu($arr) { 'label' => t('Display settings'), 'url' => $a->get_baseurl(true).'/settings/display', 'selected' => ((argv(1) === 'display') ? 'active' : ''), - ); - - $tabs[] = array( - 'label' => t('Connected apps'), - 'url' => $a->get_baseurl(true) . '/settings/oauth', - 'selected' => ((argv(1) === 'oauth') ? 'active' : ''), ); + if($hublocs) { + $tabs[] = array( + 'label' => t('Manage locations'), + 'url' => $a->get_baseurl(true) . '/locs', + 'selected' => ((argv(1) === 'locs') ? 'active' : ''), + ); + } + // IF can go away when UNO export and import is fully functional if(! UNO) { $tabs[] = array( diff --git a/mod/locs.php b/mod/locs.php index 9f66e3263..8452f62d1 100644 --- a/mod/locs.php +++ b/mod/locs.php @@ -110,11 +110,12 @@ function locs_content(&$a) { $o = replace_macros(get_markup_template('locmanage.tpl'), array( '$header' => t('Manage Channel Locations'), - '$loc' => t('Location (address)'), - '$mkprm' => t('Primary Location'), - '$drop' => t('Drop location'), + '$loc' => t('Location'), + '$addr' => t('Address'), + '$mkprm' => t('Primary'), + '$drop' => t('Drop'), '$submit' => t('Submit'), - '$sync' => t('Sync now'), + '$sync' => t('Sync Now'), '$sync_text' => t('Please wait several minutes between consecutive operations.'), '$drop_text' => t('When possible, drop a location by logging into that website/hub and removing your channel.'), '$last_resort' => t('Use this form to drop the location if the hub is no longer operating.'), @@ -122,4 +123,4 @@ function locs_content(&$a) { )); return $o; -} \ No newline at end of file +} diff --git a/mod/manage.php b/mod/manage.php index cb845befe..d769f0393 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -167,9 +167,7 @@ function manage_content(&$a) { '$intros_format' => t('%d new introductions'), '$channel_usage_message' => $channel_usage_message, '$delegated_desc' => t('Delegated Channel'), - '$delegates' => $delegates, - '$locs' => t('Manage locations') - + '$delegates' => $delegates )); return $o; diff --git a/view/css/mod_locs.css b/view/css/mod_locs.css index 95aee6aef..876da8970 100644 --- a/view/css/mod_locs.css +++ b/view/css/mod_locs.css @@ -1,3 +1,32 @@ -td { -padding: 10px; +#locs-index { + width: 100%; +} + +#locs-index th:nth-child(1), +#locs-index td:nth-child(1){ + padding: 7px 3px 7px 10px; +} + +#locs-index th:nth-child(3), +#locs-index td:nth-child(3){ + padding: 7px 3px; +} + +#locs-index th:nth-child(4), +#locs-index td:nth-child(4){ + padding: 7px 10px 7px 7px; +} + +.primehub, +.drophub { + font-size: 1.2em; +} + +.primehub:hover { + cursor: pointer; +} + +.drophub:hover { + cursor: pointer; + color: red; } diff --git a/view/pdl/mod_locs.pdl b/view/pdl/mod_locs.pdl new file mode 100644 index 000000000..0b0a99638 --- /dev/null +++ b/view/pdl/mod_locs.pdl @@ -0,0 +1,4 @@ +[region=aside] +[widget=settings_menu][/widget] +[/region] + diff --git a/view/pdl/mod_uexport.pdl b/view/pdl/mod_uexport.pdl new file mode 100644 index 000000000..0b0a99638 --- /dev/null +++ b/view/pdl/mod_uexport.pdl @@ -0,0 +1,4 @@ +[region=aside] +[widget=settings_menu][/widget] +[/region] + diff --git a/view/tpl/channel.tpl b/view/tpl/channel.tpl index 17713aef4..d306f0aa0 100755 --- a/view/tpl/channel.tpl +++ b/view/tpl/channel.tpl @@ -44,10 +44,6 @@ {{if $channel.intros != 0}}{{/if}}{{$channel.intros|string_format:$intros_format}}{{if $channel.intros != 0}}{{/if}} - {{/if}} diff --git a/view/tpl/locmanage.tpl b/view/tpl/locmanage.tpl index c94cf60a7..95847d559 100644 --- a/view/tpl/locmanage.tpl +++ b/view/tpl/locmanage.tpl @@ -1,38 +1,41 @@ -
-

{{$header}}

- - - -
{{$sync_text}}
-
-
{{$drop_text}}
-
{{$last_resort}}
-
- - - - - - -{{foreach $hubs as $hub}} -{{if ! $hub.deleted }} - - - - -{{/if}} -{{/foreach}} -
{{$loc}}{{$mkprm}}{{$drop}}
-{{$hub.hubloc_url}} ({{$hub.hubloc_addr}}) -{{if $hub.primary}}{{else}}{{/if}} -
+
+
+ + +

{{$header}}

+
+
+
+ {{$sync_text}} +
+ + + + + + + + + {{foreach $hubs as $hub}} + {{if ! $hub.deleted }} + + + + + + + {{/if}} + {{/foreach}} +
{{$loc}}{{$addr}}{{$mkprm}}{{$drop}}
{{$hub.hubloc_url}}{{$hub.hubloc_addr}}{{if $hub.primary}}{{else}}{{/if}}
+
-
- -- cgit v1.2.3