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.
 
 
 
 
 

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