Add calendar resolution setting
This commit is contained in:
		| @@ -6,6 +6,9 @@ WebApp admin is a command-line interface to modify, inject and export WebApp set | |||||||
|  |  | ||||||
| # Example Usage | # Example Usage | ||||||
|  |  | ||||||
|  | Overview of all options: | ||||||
|  | > python3 webapp_admin -h | ||||||
|  |  | ||||||
| Reset WebApp settings | Reset WebApp settings | ||||||
| > python3 webapp_admin -u john --reset | > python3 webapp_admin -u john --reset | ||||||
|  |  | ||||||
|   | |||||||
| @@ -62,8 +62,8 @@ def opt_args(print_help=None): | |||||||
|     group = OptionGroup(parser, "Categories", "") |     group = OptionGroup(parser, "Categories", "") | ||||||
|     group.add_option("--export-categories", dest="export_categories", action="store_true", help="Export Categories (name and color)") |     group.add_option("--export-categories", dest="export_categories", action="store_true", help="Export Categories (name and color)") | ||||||
|     group.add_option("--import-categories", dest="import_categories", action="store_true", help="Import Categories (name and color)") |     group.add_option("--import-categories", dest="import_categories", action="store_true", help="Import Categories (name and color)") | ||||||
|  |  | ||||||
|     parser.add_option_group(group) |     parser.add_option_group(group) | ||||||
|  |  | ||||||
|     # S/MIME option group |     # S/MIME option group | ||||||
|     group = OptionGroup(parser, "S/MIME", "") |     group = OptionGroup(parser, "S/MIME", "") | ||||||
|     group.add_option("--export-smime", dest="export_smime", action="store_true", help="Export private S/MIME certificate") |     group.add_option("--export-smime", dest="export_smime", action="store_true", help="Export private S/MIME certificate") | ||||||
| @@ -81,8 +81,9 @@ def opt_args(print_help=None): | |||||||
|     group.add_option("--icons", dest="icons", action="store", help="Change icons (e.g. breeze)") |     group.add_option("--icons", dest="icons", action="store", help="Change icons (e.g. breeze)") | ||||||
|     group.add_option("--htmleditor", dest="htmleditor", action="store", help="Change the HTML editor (e.g. full_tinymce)") |     group.add_option("--htmleditor", dest="htmleditor", action="store", help="Change the HTML editor (e.g. full_tinymce)") | ||||||
|     group.add_option("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings") |     group.add_option("--remove-state", dest="remove_state", action="store_true", help="Remove all the state settings") | ||||||
|     group.add_option("--add-safesender", dest="addsender", action="store", help="Add domain to safe sender list") |     group.add_option("--add-safesender", dest="add_sender", action="store", help="Add domain to safe sender list") | ||||||
|     group.add_option("--polling-interval", dest="pollinginterval", action="store", help="Change the polling interval (seconds)") |     group.add_option("--polling-interval", dest="polling_interval", action="store", help="Change the polling interval (seconds)") | ||||||
|  |     group.add_option("--calendar-resolution", dest="calendar_resolution", action="store", help="Change the calendar resolution (minutes)") | ||||||
|     parser.add_option_group(group) |     parser.add_option_group(group) | ||||||
|  |  | ||||||
|     # Advanced option group |     # Advanced option group | ||||||
| @@ -272,6 +273,7 @@ def restore_signature(user, filename, replace=None, default=None): | |||||||
|  |  | ||||||
|     write_settings(user, json.dumps(settings)) |     write_settings(user, json.dumps(settings)) | ||||||
|  |  | ||||||
|  |  | ||||||
| """ | """ | ||||||
| Export categories from users store | Export categories from users store | ||||||
|  |  | ||||||
| @@ -572,23 +574,38 @@ def main(): | |||||||
|             print('Removed state settings for {}'.format(user.name)) |             print('Removed state settings for {}'.format(user.name)) | ||||||
|  |  | ||||||
|         # Add sender to safe sender list |         # Add sender to safe sender list | ||||||
|         if options.addsender: |         if options.add_sender: | ||||||
|             settings = read_settings(user) |             settings = read_settings(user) | ||||||
|            setting = 'settings.zarafa.v1.contexts.mail.safe_senders_list = {}'.format(options.addsender) |             setting = 'settings.zarafa.v1.contexts.mail.safe_senders_list = {}'.format(options.add_sender) | ||||||
|             advanced_inject(user, setting, 'list') |             advanced_inject(user, setting, 'list') | ||||||
|            print('{}'.format(options.addsender), 'Added to safe sender list') |             print('{}'.format(options.add_sender), 'Added to safe sender list for {}'.format(user.name)) | ||||||
|  |  | ||||||
|         # Polling interval |         # Polling interval | ||||||
|         if options.pollinginterval: |         if options.polling_interval: | ||||||
|             try: |             try: | ||||||
|                 value = int(options.pollinginterval) |                 value = int(options.polling_interval) | ||||||
|             except ValueError: |             except ValueError: | ||||||
|                 print('Invalid number used. Please specify the value in seconds') |                 print('Invalid number used. Please specify the value in seconds') | ||||||
|                 sys.exit(1) |                 sys.exit(1) | ||||||
|             settings = read_settings(user) |             settings = read_settings(user) | ||||||
|             setting = 'settings.zarafa.v1.main.reminder.polling_interval = {}'.format(options.pollinginterval) |             setting = 'settings.zarafa.v1.main.reminder.polling_interval = {}'.format(options.polling_interval) | ||||||
|             advanced_inject(user, setting) |             advanced_inject(user, setting) | ||||||
|             print('Polling interval changed to', '{}'.format(options.pollinginterval)) |             print('Polling interval changed to', '{}'.format(options.polling_interval), 'for {}'.format(user.name)) | ||||||
|  |  | ||||||
|  |         # Calendar resolution (zoom level) | ||||||
|  |         if options.calendar_resolution: | ||||||
|  |             try: | ||||||
|  |                 value = int(options.calendar_resolution) | ||||||
|  |             except ValueError: | ||||||
|  |                 print('Invalid number used. Please specify the value in minutes') | ||||||
|  |                 sys.exit(1) | ||||||
|  |             if value < 5 or value > 60: | ||||||
|  |                 print('Unsupported value used. Use a number between 5 and 60') | ||||||
|  |                 sys.exit(1) | ||||||
|  |             settings = read_settings(user) | ||||||
|  |             setting = 'settings.zarafa.v1.contexts.calendar.default_zoom_level = {}'.format(options.calendar_resolution) | ||||||
|  |             advanced_inject(user, setting) | ||||||
|  |             print('Calendar resolution changed to', '{}'.format(options.calendar_resolution), 'for {}'.format(user.name)) | ||||||
|  |  | ||||||
|         # Always at last!!! |         # Always at last!!! | ||||||
|         if options.reset: |         if options.reset: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user