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.
 
 
 
 
 

111 lines
6.4 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. <div id="settings-form">
  13. <form action="${environ['PATH_INFO']}" method="post">
  14. <input type="hidden" name="action" value="set"/>
  15. <table>
  16. <tr>
  17. <td>Default site:</td>
  18. <td>
  19. <tt>http://</tt>
  20. <select name="lang">
  21. <% selected_lang = cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in cookies else bot.wiki.get_site().lang %>\
  22. % for code, name in langs:
  23. % if code == selected_lang:
  24. <option value="${code | h}" selected="selected">${name}</option>
  25. % else:
  26. <option value="${code | h}">${name}</option>
  27. % endif
  28. % endfor
  29. </select>
  30. <tt>.</tt>
  31. <select name="project">
  32. <% selected_project = cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in cookies else bot.wiki.get_site().project %>\
  33. % for code, name in projects:
  34. % if code == selected_project:
  35. <option value="${code | h}" selected="selected">${name}</option>
  36. % else:
  37. <option value="${code | h}">${name}</option>
  38. % endif
  39. % endfor
  40. </select>
  41. <tt>.org</tt>
  42. </td>
  43. </tr>
  44. <%
  45. background_options = [
  46. ("plain", "Use a plain tiled background (default)."),
  47. ("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).'),
  48. ("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.'),
  49. ]
  50. selected = cookies["CopyviosBackground"].value if "CopyviosBackground" in cookies else "plain"
  51. %>\
  52. % for i, (value, desc) in enumerate(background_options):
  53. <tr>
  54. % if i == 0:
  55. <td>Background:</td>
  56. % else:
  57. <td>&nbsp;</td>
  58. % endif
  59. <td>
  60. <input type="radio" name="background" value="${value}" ${'checked="checked"' if value == selected else ''} /> ${desc}
  61. </td>
  62. </tr>
  63. % endfor
  64. <tr>
  65. <td><button type="submit">Save</button></td>
  66. </tr>
  67. </table>
  68. </form>
  69. </div>
  70. <h2>Cookies</h2>
  71. % if cookies:
  72. <table>
  73. <% cookie_order = ["CopyviosDefaultProject", "CopyviosDefaultLang", "CopyviosBackground", "CopyviosShowDetails", "CopyviosScreenCache"] %>\
  74. % for key in [key for key in cookie_order if key in cookies]:
  75. <% cookie = cookies[key] %>\
  76. <tr>
  77. <td><b><tt>${key | h}</tt></b></td>
  78. % try:
  79. <% lines = dumps(loads(cookie.value), indent=4).splitlines() %>\
  80. <td>
  81. % for line in lines:
  82. <tt><div class="indentable">${line | h}</div></tt>
  83. % endfor
  84. </td>
  85. % except ValueError:
  86. <td><tt>${cookie.value | h}</tt></td>
  87. % endtry
  88. <td>
  89. <form action="${environ['PATH_INFO']}" 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="${environ['PATH_INFO']}" 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" args="environ=environ, cookies=cookies"/>