From c98b91f5149d53f522a19ec0f69b4d4727d34896 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Wed, 17 Aug 2016 18:19:36 -0400 Subject: Stash changes for merge with dev --- include/text.php | 22 ++++++++++++++++++++++ include/widgets.php | 15 +++++++++++++++ view/pdl/mod_webpages.pdl | 1 + view/tpl/website_export_tools.tpl | 14 ++++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 view/tpl/website_export_tools.tpl diff --git a/include/text.php b/include/text.php index a2a6d918b..c8e0b1888 100644 --- a/include/text.php +++ b/include/text.php @@ -2294,6 +2294,28 @@ function website_import_tools() { )); } +/** + * @brief Creates website export tools menu + * + * @return string + */ +function website_export_tools() { + + $channel = App::get_channel(); + $sys = false; + + if(App::$is_sys && is_site_admin()) { + require_once('include/channel.php'); + $channel = get_sys_channel(); + $sys = true; + } + + return replace_macros(get_markup_template('website_export_tools.tpl'), array( + '$title' => t('Export'), + '$export_label' => t('Export website...'), + )); +} + /* case insensitive in_array() */ function in_arrayi($needle, $haystack) { diff --git a/include/widgets.php b/include/widgets.php index 68db74703..fc2a9830b 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -794,6 +794,21 @@ function widget_website_import_tools($arr) { return website_import_tools(); } +function widget_website_export_tools($arr) { + + // mod menu doesn't load a profile. For any modules which load a profile, check it. + // otherwise local_channel() is sufficient for permissions. + + if(App::$profile['profile_uid']) + if((App::$profile['profile_uid'] != local_channel()) && (! App::$is_sys)) + return ''; + + if(! local_channel()) + return ''; + + return website_export_tools(); +} + function widget_findpeople($arr) { return findpeople_widget(); } diff --git a/view/pdl/mod_webpages.pdl b/view/pdl/mod_webpages.pdl index b62ec6e7c..292d6791c 100644 --- a/view/pdl/mod_webpages.pdl +++ b/view/pdl/mod_webpages.pdl @@ -1,4 +1,5 @@ [region=aside] [widget=design_tools][/widget] [widget=website_import_tools][/widget] +[widget=website_export_tools][/widget] [/region] \ No newline at end of file diff --git a/view/tpl/website_export_tools.tpl b/view/tpl/website_export_tools.tpl new file mode 100644 index 000000000..36f5c8e24 --- /dev/null +++ b/view/tpl/website_export_tools.tpl @@ -0,0 +1,14 @@ +
+

{{$title}}

+ +
-- cgit v1.2.3