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.
 
 
 
 
 

109 lines
6.1 KiB

  1. <%namespace module="copyvios.settings" import="main"/>\
  2. <% bot, status, langs, projects = main(environ, headers, cookies) %>\
  3. <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings - Earwig\'s Copyvio Detector'"/>\
  4. <%! from json import dumps, loads %>\
  5. % if status:
  6. <div class="green-box">
  7. <p>${status}</p>
  8. </div>
  9. % endif
  10. <h1>Settings</h1>
  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="${environ['PATH_INFO']}" method="post">
  13. <input type="hidden" name="action" value="set">
  14. <table>
  15. <tr>
  16. <td>Default site:</td>
  17. <td>
  18. <tt>http://</tt>
  19. <select name="lang">
  20. <% selected_lang = cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in cookies else bot.wiki.get_site().lang %>\
  21. % for code, name in 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. <tt>.</tt>
  30. <select name="project">
  31. <% selected_project = cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in cookies else bot.wiki.get_site().project %>\
  32. % for code, name in 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. <tt>.org</tt>
  41. </td>
  42. </tr>
  43. <%
  44. background_options = [
  45. ("plain", "Use a plain tiled background (default)."),
  46. ("potd", 'Use the current <a href="//commons.wikimedia.org/">Wikimedia Commons</a> <a href="//commons.wikimedia.org/wiki/Commons:Picture_of_the_day">Picture of the Day</a>, unfiltered. Certain POTDs may be unsuitable as backgrounds due to their aspect ratio or subject matter (generally portraits do not work well).'),
  47. ("list", 'Randomly select from <a href="http://commons.wikimedia.org/wiki/User:The_Earwig/POTD">a subset of previous Commons Pictures of the Day</a> that work well as widescreen backgrounds, refreshed daily.'),
  48. ]
  49. selected = cookies["CopyviosBackground"].value if "CopyviosBackground" in cookies else "plain"
  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' if value == selected else ''} /> ${desc}
  60. </td>
  61. </tr>
  62. % endfor
  63. <tr>
  64. <td><button type="submit">Save</button></td>
  65. </tr>
  66. </table>
  67. </form>
  68. <h2>Cookies</h2>
  69. % if cookies:
  70. <table>
  71. <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosShowDetails", "CopyviosScreenCache"] %>\
  72. % for key in [key for key in cookie_order if key in cookies]:
  73. <% cookie = cookies[key] %>\
  74. <tr>
  75. <td><b><tt>${key | h}</tt></b></td>
  76. % try:
  77. <% lines = dumps(loads(cookie.value), indent=4).splitlines() %>\
  78. <td>
  79. % for line in lines:
  80. <tt><div class="indentable">${line | h}</div></tt>
  81. % endfor
  82. </td>
  83. % except ValueError:
  84. <td><tt>${cookie.value | h}</tt></td>
  85. % endtry
  86. <td>
  87. <form action="${environ['PATH_INFO']}" method="post">
  88. <input type="hidden" name="action" value="delete">
  89. <input type="hidden" name="cookie" value="${key | h}">
  90. <button type="submit">Delete</button>
  91. </form>
  92. </td>
  93. </tr>
  94. % endfor
  95. <tr>
  96. <td>
  97. <form action="${environ['PATH_INFO']}" method="post">
  98. <input type="hidden" name="action" value="delete">
  99. <input type="hidden" name="all" value="1">
  100. <button type="submit">Delete all</button>
  101. </form>
  102. </td>
  103. </tr>
  104. </table>
  105. % else:
  106. <p>No cookies!</p>
  107. % endif
  108. <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>