Skip to content

Commit

Permalink
Merge pull request #3 from IvanJelicSF/docker
Browse files Browse the repository at this point in the history
Added sample data for Docker install from Superdesk master
  • Loading branch information
petrjasek authored Nov 8, 2022
2 parents 5b2466f + 1ecb993 commit 626b8ea
Show file tree
Hide file tree
Showing 109 changed files with 135 additions and 0 deletions.
Binary file added server/dump/activity.bson.gz
Binary file not shown.
Binary file added server/dump/activity.metadata.json.gz
Binary file not shown.
Binary file added server/dump/agenda.bson.gz
Binary file not shown.
Binary file added server/dump/agenda.metadata.json.gz
Binary file not shown.
Binary file added server/dump/archive.bson.gz
Binary file not shown.
Binary file added server/dump/archive.metadata.json.gz
Binary file not shown.
Binary file added server/dump/archive_autosave.bson.gz
Binary file not shown.
Binary file added server/dump/archive_autosave.metadata.json.gz
Binary file not shown.
Binary file added server/dump/archive_history.bson.gz
Binary file not shown.
Binary file added server/dump/archive_history.metadata.json.gz
Binary file not shown.
Binary file added server/dump/archive_versions.bson.gz
Binary file not shown.
Binary file added server/dump/archive_versions.metadata.json.gz
Binary file not shown.
Binary file added server/dump/archive_versions_versions.bson.gz
Binary file not shown.
Binary file not shown.
Binary file added server/dump/assignments.bson.gz
Binary file not shown.
Binary file added server/dump/assignments.metadata.json.gz
Binary file not shown.
Binary file added server/dump/audit.bson.gz
Binary file not shown.
Binary file added server/dump/audit.metadata.json.gz
Binary file not shown.
Binary file added server/dump/auth.bson.gz
Binary file not shown.
Binary file added server/dump/auth.metadata.json.gz
Binary file not shown.
Binary file added server/dump/concept_items.bson.gz
Binary file not shown.
Binary file added server/dump/concept_items.metadata.json.gz
Binary file not shown.
Binary file added server/dump/config.bson.gz
Binary file not shown.
Binary file added server/dump/config.metadata.json.gz
Binary file not shown.
Binary file added server/dump/contacts.bson.gz
Binary file not shown.
Binary file added server/dump/contacts.metadata.json.gz
Binary file not shown.
Binary file added server/dump/content_filters.bson.gz
Binary file not shown.
Binary file added server/dump/content_filters.metadata.json.gz
Binary file not shown.
Binary file added server/dump/content_templates.bson.gz
Binary file not shown.
Binary file added server/dump/content_templates.metadata.json.gz
Binary file not shown.
Binary file added server/dump/content_types.bson.gz
Binary file not shown.
Binary file added server/dump/content_types.metadata.json.gz
Binary file not shown.
Binary file added server/dump/data_updates.bson.gz
Binary file not shown.
Binary file added server/dump/data_updates.metadata.json.gz
Binary file not shown.
Binary file added server/dump/delivery.bson.gz
Binary file not shown.
Binary file added server/dump/delivery.metadata.json.gz
Binary file not shown.
Binary file added server/dump/desks.bson.gz
Binary file not shown.
Binary file added server/dump/desks.metadata.json.gz
Binary file not shown.
Binary file added server/dump/email_timestamps.bson.gz
Binary file not shown.
Binary file added server/dump/email_timestamps.metadata.json.gz
Binary file not shown.
Binary file added server/dump/event_autosave.bson.gz
Binary file not shown.
Binary file added server/dump/event_autosave.metadata.json.gz
Binary file not shown.
Binary file added server/dump/events.bson.gz
Binary file not shown.
Binary file added server/dump/events.metadata.json.gz
Binary file not shown.
Binary file added server/dump/events_planning_filters.bson.gz
Binary file not shown.
Binary file added server/dump/events_planning_filters.metadata.json.gz
Binary file not shown.
Binary file added server/dump/filter_conditions.bson.gz
Binary file not shown.
Binary file added server/dump/filter_conditions.metadata.json.gz
Binary file not shown.
Binary file added server/dump/fs.chunks.bson.gz
Binary file not shown.
Binary file added server/dump/fs.chunks.metadata.json.gz
Binary file not shown.
Binary file added server/dump/fs.files.bson.gz
Binary file not shown.
Binary file added server/dump/fs.files.metadata.json.gz
Binary file not shown.
Binary file added server/dump/highlights.bson.gz
Binary file not shown.
Binary file added server/dump/highlights.metadata.json.gz
Binary file not shown.
Binary file added server/dump/ingest.bson.gz
Binary file not shown.
Binary file added server/dump/ingest.metadata.json.gz
Binary file not shown.
Binary file added server/dump/ingest_providers.bson.gz
Binary file not shown.
Binary file added server/dump/ingest_providers.metadata.json.gz
Binary file not shown.
Binary file added server/dump/internal_destinations.bson.gz
Binary file not shown.
Binary file added server/dump/internal_destinations.metadata.json.gz
Binary file not shown.
Binary file added server/dump/item_comments.bson.gz
Binary file not shown.
Binary file added server/dump/item_comments.metadata.json.gz
Binary file not shown.
Binary file added server/dump/locations.bson.gz
Binary file not shown.
Binary file added server/dump/locations.metadata.json.gz
Binary file not shown.
Binary file added server/dump/media_references.bson.gz
Binary file not shown.
Binary file added server/dump/media_references.metadata.json.gz
Binary file not shown.
Binary file added server/dump/mongolock.lock.bson.gz
Binary file not shown.
Binary file added server/dump/mongolock.lock.metadata.json.gz
Binary file not shown.
Binary file added server/dump/planning.bson.gz
Binary file not shown.
Binary file added server/dump/planning.metadata.json.gz
Binary file not shown.
Binary file added server/dump/planning_autosave.bson.gz
Binary file not shown.
Binary file added server/dump/planning_autosave.metadata.json.gz
Binary file not shown.
Binary file added server/dump/products.bson.gz
Binary file not shown.
Binary file added server/dump/products.metadata.json.gz
Binary file not shown.
Binary file added server/dump/publish_queue.bson.gz
Binary file not shown.
Binary file added server/dump/publish_queue.metadata.json.gz
Binary file not shown.
Binary file added server/dump/published.bson.gz
Binary file not shown.
Binary file added server/dump/published.metadata.json.gz
Binary file not shown.
Binary file added server/dump/published_planning.bson.gz
Binary file not shown.
Binary file added server/dump/published_planning.metadata.json.gz
Binary file not shown.
Binary file added server/dump/reset_user_password.bson.gz
Binary file not shown.
Binary file added server/dump/reset_user_password.metadata.json.gz
Binary file not shown.
Binary file added server/dump/roles.bson.gz
Binary file not shown.
Binary file added server/dump/roles.metadata.json.gz
Binary file not shown.
Binary file added server/dump/routing_schemes.bson.gz
Binary file not shown.
Binary file added server/dump/routing_schemes.metadata.json.gz
Binary file not shown.
Binary file added server/dump/rule_sets.bson.gz
Binary file not shown.
Binary file added server/dump/rule_sets.metadata.json.gz
Binary file not shown.
Binary file added server/dump/saved_reports.bson.gz
Binary file not shown.
Binary file added server/dump/saved_reports.metadata.json.gz
Binary file not shown.
Binary file added server/dump/saved_searches.bson.gz
Binary file not shown.
Binary file added server/dump/saved_searches.metadata.json.gz
Binary file not shown.
Binary file added server/dump/sequences.bson.gz
Binary file not shown.
Binary file added server/dump/sequences.metadata.json.gz
Binary file not shown.
Binary file added server/dump/stages.bson.gz
Binary file not shown.
Binary file added server/dump/stages.metadata.json.gz
Binary file not shown.
Binary file added server/dump/subscribers.bson.gz
Binary file not shown.
Binary file added server/dump/subscribers.metadata.json.gz
Binary file not shown.
Binary file added server/dump/users.bson.gz
Binary file not shown.
Binary file added server/dump/users.metadata.json.gz
Binary file not shown.
Binary file added server/dump/validators.bson.gz
Binary file not shown.
Binary file added server/dump/validators.metadata.json.gz
Binary file not shown.
Binary file added server/dump/vocabularies.bson.gz
Binary file not shown.
Binary file added server/dump/vocabularies.metadata.json.gz
Binary file not shown.
Binary file added server/dump/workspaces.bson.gz
Binary file not shown.
Binary file added server/dump/workspaces.metadata.json.gz
Binary file not shown.
2 changes: 2 additions & 0 deletions server/macros/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from superdesk.macros import * # noqa
from . import replace_words # noqa
100 changes: 100 additions & 0 deletions server/macros/replace_words.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license

import re

from superdesk import get_resource_service
from superdesk.macros import macro_replacement_fields


def find_and_replace(item, **kwargs):
"""
Find and replace words
:param dict item:
:param kwargs:
:return tuple(dict, dict): tuple of modified item and diff of items modified.
"""
diff = {}

def repl(new, old):
"""
Returns a version of the "new" string that matches the case of the "old" string
:param new:
:param old:
:return: a string which is a version of "new" that matches the case of old.
"""
if old.islower():
return new.lower()
elif old.isupper():
return new.upper()
else:
# the old string starts with upper case so we use the title function
if old[:1].isupper():
return new.title()
# it is more complex so try to match it
else:
result = ''
all_upper = True
for i, c in enumerate(old):
if i >= len(new):
break
if c.isupper():
result += new[i].upper()
else:
result += new[i].lower()
all_upper = False
# append any remaining characters from new
if all_upper:
result += new[i + 1:].upper()
else:
result += new[i + 1:].lower()
return result

def do_find_replace(input_string, words_list):
found_list = {}
for word in words_list:
pattern = r'{}'.format(re.escape(word.get('existing', '')))

while re.search(pattern, input_string, flags=re.IGNORECASE):
# get the original string from the input
original = re.search(pattern, input_string, flags=re.IGNORECASE).group(0)
replacement = repl(word.get('replacement', ''), original)
if found_list.get(original):
break
diff[original] = replacement
found_list[original] = replacement
input_string = input_string.replace(original, replacement)

return input_string

vocab = get_resource_service('vocabularies').find_one(req=None, _id='replace_words')

if vocab:
replace_words_list = vocab.get('items') or []

if not replace_words_list:
return item

for field in macro_replacement_fields:
if not item.get(field, None):
continue

item[field] = do_find_replace(item[field], replace_words_list)

return item


name = 'Replace_Words'
label = 'Replace words in the article'
order = 1
shortcut = 'a'
callback = find_and_replace
access_type = 'frontend'
action_type = 'direct'
33 changes: 33 additions & 0 deletions server/templates/planning_group_by_date.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% for year, year_group in items|groupby('planning_date.year') %}
{% for month, month_group in year_group|groupby('planning_date.month') %}
{% for day, day_group in month_group|groupby('planning_date.day') %}
{% set weekday = day_group[0].planning_date.strftime('%A') %}
{% if weekday == 'Monday' %}<h2>Monday {{day}}/{{month}}</h2>{% endif %}
{% if weekday == 'Tuesday' %}<h2>Tuesday {{day}}/{{month}}</h2>{% endif %}
{% if weekday == 'Wednesday' %}<h2>Wednesday {{day}}/{{month}}</h2>{% endif %}
{% if weekday == 'Thursday' %}<h2>Thursday {{day}}/{{month}}</h2>{% endif %}
{% if weekday == 'Friday' %}<h2>Friday {{day}}/{{month}}</h2>{% endif %}
{% if weekday == 'Saturday' %}<h2>Saturday {{day}}/{{month}}</h2>{% endif %}
{% if weekday == 'Sunday' %}<h2>Sunday {{day}}/{{month}}</h2>{% endif %}
{% for item in day_group %}
<h2>{{ item.name or item.headline or item.slugline }}</h2>
<p>{{ item.description_text or '' }}
{% if item.get('event', {}).get('location') %}
&nbsp;Location: {{ item.event.location[0].name }}.
{% endif %}
{% if item.get('planning_date', '') != ''
and item.get('planning_date', '') | format_datetime(date_format='%H:%M') != '00:00' %}
&nbsp;Time: {{ item.planning_date | format_datetime(date_format='%H:%M') }}.
{% endif %}
</p>
{% if item.get('ednote', '') != '' %}
<p>Editorial note: {{ item.ednote }}</p>
{% endif %}
{% if item.coverages %}
<p>Coverage(s): {{ item.coverages | join(', ') }}</p>
{% endif %}
<p></p>
{% endfor %}
{% endfor %}
{% endfor %}
{% endfor %}

0 comments on commit 626b8ea

Please sign in to comment.