A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

settings.mako 4.9 KiB

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