From a338a97d5bb947f462483de8a9d87dd52fa3b2eb Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sun, 10 Jul 2016 06:58:20 -0400 Subject: First draft of website import tools --- include/text.php | 24 ++++++++++++++++++++++++ include/widgets.php | 14 ++++++++++++++ view/pdl/mod_webpages.pdl | 1 + view/tpl/website_import_tools.tpl | 7 +++++++ 4 files changed, 46 insertions(+) create mode 100644 view/tpl/website_import_tools.tpl diff --git a/include/text.php b/include/text.php index 986e3b56c..57339e16d 100644 --- a/include/text.php +++ b/include/text.php @@ -2246,6 +2246,30 @@ function design_tools() { )); } +/** + * @brief Creates website import tools menu + * + * @return string + */ +function website_import_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; + } + + $who = $channel['channel_address']; + + return replace_macros(get_markup_template('design_tools.tpl'), array( + '$title' => t('Import'), + '$who' => $who, + )); +} + /* case insensitive in_array() */ function in_arrayi($needle, $haystack) { diff --git a/include/widgets.php b/include/widgets.php index a4a6fb55a..6bb53bdf9 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -770,6 +770,20 @@ function widget_design_tools($arr) { return design_tools(); } +function widget_website_import_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_import_tools(); +} function widget_findpeople($arr) { return findpeople_widget(); diff --git a/view/pdl/mod_webpages.pdl b/view/pdl/mod_webpages.pdl index cef69f194..b62ec6e7c 100644 --- a/view/pdl/mod_webpages.pdl +++ b/view/pdl/mod_webpages.pdl @@ -1,3 +1,4 @@ [region=aside] [widget=design_tools][/widget] +[widget=website_import_tools][/widget] [/region] \ No newline at end of file diff --git a/view/tpl/website_import_tools.tpl b/view/tpl/website_import_tools.tpl new file mode 100644 index 000000000..2e319b61d --- /dev/null +++ b/view/tpl/website_import_tools.tpl @@ -0,0 +1,7 @@ +
+

{{$title}}

+

Import website from cloud files

+ +
-- cgit v1.2.3