diff --git a/amanuensis/db/models.py b/amanuensis/db/models.py index 0f7aead..6a60838 100644 --- a/amanuensis/db/models.py +++ b/amanuensis/db/models.py @@ -562,7 +562,7 @@ class ArticleContentRuleType(enum.Enum): # Whether characters can cite themselves ALLOW_SELF_CITE = 0 # Whether characters can write new articles instead of phantoms - ALLOW_NEW_ARTICLE = 1 + FORCE_PHANTOM = 1 # Required number of extant articles cited CITE_EXTANT_MIN = 2 CITE_EXTANT_MAX = 3 diff --git a/amanuensis/server/lexicon/settings/__init__.py b/amanuensis/server/lexicon/settings/__init__.py index 975178f..b3fa30b 100644 --- a/amanuensis/server/lexicon/settings/__init__.py +++ b/amanuensis/server/lexicon/settings/__init__.py @@ -274,6 +274,15 @@ def assign_post(lexicon_name): ) +@bp.get("/constraint/") +@lexicon_param +@editor_required +def constraint(lexicon_name): + return render_template( + "settings.jinja", lexicon_name=lexicon_name, page_name=constraint.__name__ + ) + + @bp.get("/publish/") @lexicon_param @editor_required diff --git a/amanuensis/server/lexicon/settings/settings.jinja b/amanuensis/server/lexicon/settings/settings.jinja index cfc71d2..f832908 100644 --- a/amanuensis/server/lexicon/settings/settings.jinja +++ b/amanuensis/server/lexicon/settings/settings.jinja @@ -27,6 +27,7 @@
  • {{ settings_page_link("setup", "Game Setup") }}
  • {{ settings_page_link("index", "Article Indices") }}
  • {{ settings_page_link("assign", "Index Assignments") }}
  • +
  • {{ settings_page_link("constraint", "Article Constraints") }}
  • {{ settings_page_link("publish", "Turn Publishing") }}
  • {{ settings_page_link("article", "Article Requirements") }}
  • @@ -92,10 +93,10 @@

    Article Indexes

    Index definition help -

    An index is a rule that matches the title of a lexicon article based on its index type and pattern. A char index matches a title if the first letter of the title (excluding "A", "An", and "The") is one of the letters in the pattern. A range index has a pattern denoting a range of letters, such as "A-F", and matches a title if the first letter of the title is in the range. A prefix index matches any title that begins with the pattern. An etc index always matches a title.

    -

    When a title is to be sorted under an index, indices are checked in order, sorted first by descending order of logical priority, and then by alphabetical order of index pattern. The title is sorted under the first index that matches it.

    -

    On the contents page, indices and the articles under them are displayed sorted instead by display order and then alphabetically by pattern.

    -

    The capacity of an index is the number of articles that may exist under that index. If an index is at capacity, no new articles may be written or created via phantom citation in that index.

    +

    An index is a rule that matches the title of a lexicon article based on its index type and pattern. A char index matches a title if the first letter of the title (excluding "A", "An", and "The") is one of the letters in the pattern. A range index has a pattern denoting a range of letters, such as "A-F", and matches a title if the first letter of the title is in the range. A prefix index matches any title that begins with the pattern. An etc index always matches a title.

    +

    When a title is to be sorted under an index, indices are checked in order, sorted first by descending order of logical priority, and then by alphabetical order of index pattern. The title is sorted under the first index that matches it.

    +

    On the contents page, indices and the articles under them are displayed sorted instead by display order and then alphabetically by pattern.

    +

    The capacity of an index is the number of articles that may exist under that index. If an index is at capacity, no new articles may be written or created via phantom citation in that index.

    To add an index, fill in the type and pattern in the blank row and save your changes. To remove an index, set the type to blank. Note: If you change the type or pattern of an index, all index assignments will be reset. Avoid changing index definitions during gameplay.

    @@ -168,12 +169,112 @@ {% endfor %} {% endif %} +{% if page_name == "constraint" %} +

    Article Constraints

    +
    + Article constraint help +

    The article constraints configured here apply to all players. A constraint's configured value may be overridden on a turn-by-turn basis. On subsequent turns, the most recent overridden value will be used.

    +

    Allow self citation: When this constraint is true, characters can cite extant articles they previously wrote and write phantom articles they previously cited. When this constraint is false, characters can do neither. Defaults to false.

    +

    Allow new articles: When this constraint is true, characters can write articles in their assigned index that have not been cited before. When this constraint is false, characters can only write phantom articles. Defaults to true.

    + {# + +class Setting + settingtype + name + description + #} +
    + {# + {{ form.hidden_tag() }} + + + + + + + {% for rule_form in form.rules %} + + + + + + {% for field in index_form %} + {% for error in field.errors %} + + + + {% endfor %} + {% endfor %} + {% endfor %} +
    TurnIndexCharacter
    {{ rule_form.turn() }}{{ rule_form.index() }}{{ rule_form.character() }}
    {{ error }}
    +

    {{ form.submit() }}

    +
    #} + {% for message in get_flashed_messages() %} + {{ message }}
    + {% endfor %} +{% endif %} + {% if page_name == "publish" %} -

    Turn Publishing

    +

    Turn Publishing

    +{#

    Turn Publishing

    +

    + {{ form.publishDeadlines(autocomplete="off") }} + {{ form.publishDeadlines.label }}
    + {{ flag_setting(form.publishAsap) }} + {% for error in form.publishDeadlines.errors %} + {{ error }}
    + {% endfor %} + {{ flag_setting(form.publishBlockOnReady) }} + {{ number_setting(form.publishQuorum) }} + +

    + {{ form.turnAssignment.label }}:
    + {{ form.turnAssignment(class_="fullwidth", rows=10) }} + Transfer editorial control +

    #} {% endif %} {% if page_name == "article" %} -

    Article Requirements

    +

    Article Requirements

    +{#

    Article Requirements

    +

    + {{ flag_setting(form.articleCitationAllowSelf) }} + {{ number_setting(form.articleCitationMinExtant)}} + {{ number_setting(form.articleCitationMaxExtant)}} + {{ number_setting(form.articleCitationMinPhantom)}} + {{ number_setting(form.articleCitationMaxPhantom)}} + {{ number_setting(form.articleCitationMinTotal)}} + {{ number_setting(form.articleCitationMaxTotal)}} + {{ number_setting(form.articleCitationMinChars)}} + {{ number_setting(form.articleCitationMaxChars)}} + {{ number_setting(form.articleWordLimitSoft)}} + {{ number_setting(form.articleWordLimitHard)}} + {{ flag_setting(form.articleAddendumAllowed) }} + {{ number_setting(form.articleAddendumMax) }} +

    #} {% endif %} + + +{#

    + Id: {{ g.lexicon.lid }}
    + Name: {{ g.lexicon.cfg.name }}
    + Created: {{ g.lexicon.cfg.time.created|asdate }}
    + Completed: {{ g.lexicon.cfg.time.completed|asdate }}
    + Players: + {% for uid in g.lexicon.cfg.join.joined %} + {{ uid|user_attr('username') }}{% if not loop.last %},{% endif %} + {% endfor %}
    + Characters: + {% for char in g.lexicon.cfg.character.values() %} + {{ char.name }}{% if char.player %} + ({{ char.player|user_attr('username') }}){% endif %} + {% if not loop.last %},{% endif %} + {% endfor %}
    + + allow addenda + allow posting + make system post +

    #} + {% endblock %} diff --git a/amanuensis/server/lexicon/settings/settings.py b/amanuensis/server/lexicon/settings/settings.py new file mode 100644 index 0000000..ef1d3e5 --- /dev/null +++ b/amanuensis/server/lexicon/settings/settings.py @@ -0,0 +1,59 @@ +from amanuensis.db import ArticleContentRuleType + +class SettingDef: + def __init__( + self: "SettingDef", + setting_type: ArticleContentRuleType, + name: str, + help: str + ): + self.setting_type = setting_type + self.name = name + self.help = help + + +class Settings: + allow_self_cite = SettingDef( + ArticleContentRuleType.ALLOW_SELF_CITE, + "Allow self citation", + "Characters can cite articles they previously wrote and write phantom articles they previously cited." + ) + + require_phantom + + + + + + +

    The article constraints configured here apply to all players. A constraint's configured value may be overridden on a turn-by-turn basis. On subsequent turns, the most recent overridden value will be used.

    + When this constraint is true, characters can cite extant articles they previously wrote and write phantom articles they previously cited. When this constraint is false, characters can do neither. Defaults to false.

    +

    Allow new articles: When this constraint is true, characters can write articles in their assigned index that have not been cited before. When this constraint is false, characters can only write phantom articles. Defaults to true.

    + + # Whether characters can cite themselves + ALLOW_SELF_CITE = 0 + # Whether characters can write new articles instead of phantoms + ALLOW_NEW_ARTICLE = 1 + # Required number of extant articles cited + CITE_EXTANT_MIN = 2 + CITE_EXTANT_MAX = 3 + # Required number of phantom articles cited + CITE_PHANTOM_MIN = 4 + CITE_PHANTOM_MAX = 5 + # Required number of new articles cited + CITE_NEW_MIN = 6 + CITE_NEW_MAX = 7 + # Required number of characters among authors of articles cited + CITE_CHARS_MIN = 8 + CITE_CHARS_MAX = 9 + # Required number of citations of any kind + CITE_TOTAL_MIN = 10 + CITE_TOTAL_MAX = 11 + # Warn player below this wordcount + WORD_MIN_SOFT = 12 + # Require player to exceed this wordcount + WORD_MIN_HARD = 13 + # Warn player above this wordcount + WORD_MAX_SOFT = 14 + # Require player to be under this wordcount + WORD_MAX_HARD = 15 \ No newline at end of file