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 rivejä
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 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['SCRIPT_URL']}" 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 = cookies["CopyviosDefaultLang"].value if "CopyviosDefaultLang" in cookies else bot.wiki.get_site().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 = cookies["CopyviosDefaultProject"].value if "CopyviosDefaultProject" in cookies else bot.wiki.get_site().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 = cookies["CopyviosBackground"].value if "CopyviosBackground" in 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 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><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="${environ['SCRIPT_URL']}" 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['SCRIPT_URL']}" 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"/>