A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

settings.mako 4.9 KiB

há 11 anos
há 4 anos
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <%!
  2. from json import dumps, loads
  3. from flask import g, request
  4. from copyvios.misc import cache
  5. %>\
  6. <%include file="/support/header.mako" args="title='Settings &ndash; Earwig\'s Copyvio Detector'"/>
  7. % if status:
  8. <div id="info-box" class="green-box">
  9. <p>${status}</p>
  10. </div>
  11. % endif
  12. <p>This page contains some configurable options for the copyvio detector. Settings are saved as cookies. You can view and delete all cookies generated by this site at the bottom of this page.</p>
  13. <form action="${request.script_root}/settings" method="post">
  14. <table>
  15. <tr>
  16. <td>Default site:</td>
  17. <td>
  18. <span class="mono">https://</span>
  19. <select name="lang">
  20. <% selected_lang = g.cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in g.cookies else default_lang %>\
  21. % for code, name in cache.langs:
  22. % if code == selected_lang:
  23. <option value="${code | h}" selected="selected">${name}</option>
  24. % else:
  25. <option value="${code | h}">${name}</option>
  26. % endif
  27. % endfor
  28. </select>
  29. <span class="mono">.</span>
  30. <select name="project">
  31. <% selected_project = g.cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in g.cookies else default_project %>\
  32. % for code, name in cache.projects:
  33. % if code == selected_project:
  34. <option value="${code | h}" selected="selected">${name}</option>
  35. % else:
  36. <option value="${code | h}">${name}</option>
  37. % endif
  38. % endfor
  39. </select>
  40. <span class="mono">.org</span>
  41. </td>
  42. </tr>
  43. <%
  44. background_options = [
  45. ("list", 'Randomly select from <a href="https://commons.wikimedia.org/wiki/User:The_Earwig/POTD">a subset</a> of previous <a href="https://commons.wikimedia.org/">Wikimedia Commons</a> <a href="https://commons.wikimedia.org/wiki/Commons:Picture_of_the_day">Pictures of the Day</a> that work well as widescreen backgrounds, refreshed daily (default).'),
  46. ("potd", 'Use the current Commons Picture of the Day, unfiltered. Certain POTDs may be unsuitable as backgrounds due to their aspect ratio or subject matter.'),
  47. ("plain", "Use a plain background."),
  48. ]
  49. selected = g.cookies["CopyviosBackground"].value if "CopyviosBackground" in g.cookies else "list"
  50. %>\
  51. % for i, (value, desc) in enumerate(background_options):
  52. <tr>
  53. % if i == 0:
  54. <td>Background:</td>
  55. % else:
  56. <td>&nbsp;</td>
  57. % endif
  58. <td>
  59. <input type="radio" name="background" value="${value}" ${'checked="checked"' if value == selected else ''} /> ${desc}
  60. </td>
  61. </tr>
  62. % endfor
  63. <tr>
  64. <td colspan="2">
  65. <input type="hidden" name="action" value="set"/>
  66. <button type="submit">Save</button>
  67. </td>
  68. </tr>
  69. </table>
  70. </form>
  71. <h2>Cookies</h2>
  72. % if g.cookies:
  73. <table>
  74. <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosScreenCache"] %>\
  75. % for key in [key for key in cookie_order if key in g.cookies]:
  76. <% cookie = g.cookies[key] %>\
  77. <tr>
  78. <td><b><span class="mono">${key | h}</span></b></td>
  79. % try:
  80. <% lines = dumps(loads(cookie.value), indent=4).splitlines() %>\
  81. <td>
  82. % for line in lines:
  83. <span class="mono"><div class="indentable">${line | h}</div></span>
  84. % endfor
  85. </td>
  86. % except ValueError:
  87. <td><span class="mono">${cookie.value | h}</span></td>
  88. % endtry
  89. <td>
  90. <form action="${request.script_root}/settings" method="post">
  91. <input type="hidden" name="action" value="delete">
  92. <input type="hidden" name="cookie" value="${key | h}">
  93. <button type="submit">Delete</button>
  94. </form>
  95. </td>
  96. </tr>
  97. % endfor
  98. <tr>
  99. <td>
  100. <form action="${request.script_root}/settings" method="post">
  101. <input type="hidden" name="action" value="delete">
  102. <input type="hidden" name="all" value="1">
  103. <button type="submit">Delete all</button>
  104. </form>
  105. </td>
  106. </tr>
  107. </table>
  108. % else:
  109. <p>No cookies!</p>
  110. % endif
  111. <%include file="/support/footer.mako"/>