From 4484985c2d48d8256ae114d55a8f4e6db0303425 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 21 Sep 2018 21:37:00 +0200 Subject: add file --- Zotlabs/Module/Settings/Editor.php | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 Zotlabs/Module/Settings/Editor.php (limited to 'Zotlabs/Module/Settings/Editor.php') diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php new file mode 100644 index 000000000..a87f31fe7 --- /dev/null +++ b/Zotlabs/Module/Settings/Editor.php @@ -0,0 +1,120 @@ + $rpath, + '$action_url' => 'settings/editor', + '$form_security_token' => get_form_security_token("settings_editor"), + '$title' => t('Editor Settings'), + '$features' => process_features_get(local_channel(), $features), + '$submit' => t('Submit') + )); + + return $o; + } + + function get_features() { + $arr = [ + + [ + 'large_photos', + t('Large Photos'), + t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'), + false, + get_config('feature_lock','large_photos'), + ], + + [ + //TODO: This should be its own app + 'channel_sources', + t('Channel Sources'), + t('Automatically import channel content from other channels or feeds'), + false, + get_config('feature_lock','channel_sources'), + ], + + [ + 'content_encrypt', + t('Even More Encryption'), + t('Allow optional encryption of content end-to-end with a shared secret key'), + false, + get_config('feature_lock','content_encrypt'), + ], + + [ + 'consensus_tools', + t('Enable Voting Tools'), + t('Provide a class of post which others can vote on'), + false, + get_config('feature_lock','consensus_tools'), + ], + + [ + 'disable_comments', + t('Disable Comments'), + t('Provide the option to disable comments for a post'), + false, + get_config('feature_lock','disable_comments'), + ], + + [ + 'delayed_posting', + t('Delayed Posting'), + t('Allow posts to be published at a later date'), + false, + get_config('feature_lock','delayed_posting'), + ], + + [ + 'content_expire', + t('Content Expiration'), + t('Remove posts/comments and/or private messages at a future time'), + false, + get_config('feature_lock','content_expire'), + ], + + [ + 'suppress_duplicates', + t('Suppress Duplicate Posts/Comments'), + t('Prevent posts with identical content to be published with less than two minutes in between submissions.'), + true, + get_config('feature_lock','suppress_duplicates'), + ], + + [ + 'auto_save_draft', + t('Auto-save drafts of posts and comments'), + t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'), + true, + get_config('feature_lock','auto_save_draft'), + ] + + ]; + + return $arr; + + } + +} -- cgit v1.2.3 From 1e5405ccaf3ddff88653cc34a04cfce9b7102891 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 22 Sep 2018 13:32:42 +0200 Subject: appification of sources --- Zotlabs/Module/Settings/Editor.php | 9 --------- 1 file changed, 9 deletions(-) (limited to 'Zotlabs/Module/Settings/Editor.php') diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index a87f31fe7..92775f154 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -46,15 +46,6 @@ class Editor { get_config('feature_lock','large_photos'), ], - [ - //TODO: This should be its own app - 'channel_sources', - t('Channel Sources'), - t('Automatically import channel content from other channels or feeds'), - false, - get_config('feature_lock','channel_sources'), - ], - [ 'content_encrypt', t('Even More Encryption'), -- cgit v1.2.3 From 9e22ec267c0020e27e4b1cdf5da23b442529da6a Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Sep 2018 01:11:06 +0200 Subject: keep the features in the central array but sort them by module name --- Zotlabs/Module/Settings/Editor.php | 81 ++------------------------------------ 1 file changed, 4 insertions(+), 77 deletions(-) (limited to 'Zotlabs/Module/Settings/Editor.php') diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index 92775f154..514417e49 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -8,9 +8,9 @@ class Editor { function post() { check_form_security_token_redirectOnErr('/settings/editor', 'settings_editor'); - $features = self::get_features(); + $features = get_module_features('editor'); - process_features_post(local_channel(), $features, $_POST); + process_module_features_post(local_channel(), $features, $_POST); build_sync_packet(); return; @@ -18,7 +18,7 @@ class Editor { function get() { - $features = self::get_features(); + $features = get_module_features('editor'); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); @@ -28,84 +28,11 @@ class Editor { '$action_url' => 'settings/editor', '$form_security_token' => get_form_security_token("settings_editor"), '$title' => t('Editor Settings'), - '$features' => process_features_get(local_channel(), $features), + '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') )); return $o; } - function get_features() { - $arr = [ - - [ - 'large_photos', - t('Large Photos'), - t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'), - false, - get_config('feature_lock','large_photos'), - ], - - [ - 'content_encrypt', - t('Even More Encryption'), - t('Allow optional encryption of content end-to-end with a shared secret key'), - false, - get_config('feature_lock','content_encrypt'), - ], - - [ - 'consensus_tools', - t('Enable Voting Tools'), - t('Provide a class of post which others can vote on'), - false, - get_config('feature_lock','consensus_tools'), - ], - - [ - 'disable_comments', - t('Disable Comments'), - t('Provide the option to disable comments for a post'), - false, - get_config('feature_lock','disable_comments'), - ], - - [ - 'delayed_posting', - t('Delayed Posting'), - t('Allow posts to be published at a later date'), - false, - get_config('feature_lock','delayed_posting'), - ], - - [ - 'content_expire', - t('Content Expiration'), - t('Remove posts/comments and/or private messages at a future time'), - false, - get_config('feature_lock','content_expire'), - ], - - [ - 'suppress_duplicates', - t('Suppress Duplicate Posts/Comments'), - t('Prevent posts with identical content to be published with less than two minutes in between submissions.'), - true, - get_config('feature_lock','suppress_duplicates'), - ], - - [ - 'auto_save_draft', - t('Auto-save drafts of posts and comments'), - t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'), - true, - get_config('feature_lock','auto_save_draft'), - ] - - ]; - - return $arr; - - } - } -- cgit v1.2.3 From 1f1d5b9181dd7a9800a2d5c596d8da0f906c53e3 Mon Sep 17 00:00:00 2001 From: Mario Date: Sun, 23 Sep 2018 17:52:32 +0200 Subject: provide settings for mod photo and make it slightly simpler to create new module settings --- Zotlabs/Module/Settings/Editor.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Module/Settings/Editor.php') diff --git a/Zotlabs/Module/Settings/Editor.php b/Zotlabs/Module/Settings/Editor.php index 514417e49..93e3ce602 100644 --- a/Zotlabs/Module/Settings/Editor.php +++ b/Zotlabs/Module/Settings/Editor.php @@ -6,9 +6,12 @@ namespace Zotlabs\Module\Settings; class Editor { function post() { - check_form_security_token_redirectOnErr('/settings/editor', 'settings_editor'); + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + check_form_security_token_redirectOnErr('/settings/' . $module, 'settings_' . $module); - $features = get_module_features('editor'); + $features = get_module_features($module); process_module_features_post(local_channel(), $features, $_POST); @@ -17,16 +20,18 @@ class Editor { } function get() { - - $features = get_module_features('editor'); + + $module = substr(strrchr(strtolower(static::class), '\\'), 1); + + $features = get_module_features($module); $rpath = (($_GET['rpath']) ? $_GET['rpath'] : ''); $tpl = get_markup_template("settings_module.tpl"); $o .= replace_macros($tpl, array( '$rpath' => $rpath, - '$action_url' => 'settings/editor', - '$form_security_token' => get_form_security_token("settings_editor"), + '$action_url' => 'settings/' . $module, + '$form_security_token' => get_form_security_token('settings_' . $module), '$title' => t('Editor Settings'), '$features' => process_module_features_get(local_channel(), $features), '$submit' => t('Submit') -- cgit v1.2.3