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.
 
 
 
 
 

108 regels
5.9 KiB

  1. <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings'"/>\
  2. <%namespace module="toolserver.settings" import="main"/>\
  3. <%! from json import dumps, loads %>
  4. <% bot, status, langs, projects = main(environ, headers, cookies) %>
  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 this Toolserver site. 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["EarwigDefaultLang"].value if "EarwigDefaultLang" in cookies else bot.wiki.get_site().lang %>
  21. % for code, name in langs:
  22. % if code == selected_lang:
  23. <option value="${code}" selected="selected">${name}</option>
  24. % else:
  25. <option value="${code}">${name}</option>
  26. % endif
  27. % endfor
  28. </select>
  29. <tt>.</tt>
  30. <select name="project">
  31. <% selected_project = cookies["EarwigDefaultProject"].value if "EarwigDefaultProject" in cookies else bot.wiki.get_site().project %>
  32. % for code, name in projects:
  33. % if code == selected_project:
  34. <option value="${code}" selected="selected">${name}</option>
  35. % else:
  36. <option value="${code}">${name}</option>
  37. % endif
  38. % endfor
  39. </select>
  40. <tt>.org</tt>
  41. </td>
  42. </tr>
  43. <%
  44. background_options = [
  45. ("plain-brown", "Use a plain tiled background (brown version)."),
  46. ("plain-blue", "Use a plain tiled background (blue version)."),
  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 (default).'),
  49. ]
  50. selected = cookies["EarwigBackground"].value if "EarwigBackground" in cookies else None
  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' if option == elected 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. <h2>Cookies</h2>
  70. % if cookies:
  71. <table>
  72. % for cookie in cookies.itervalues():
  73. <tr>
  74. <td><b><tt>${cookie.key | h}</tt></b></td>
  75. % try:
  76. <% lines = dumps(loads(cookie.value), indent=4).splitlines() %>
  77. <td>
  78. % for line in lines:
  79. <tt><div class="indentable">${line | h}</div></tt>
  80. % endfor
  81. </td>
  82. % except ValueError:
  83. <td><tt>${cookie.value | h}</tt></td>
  84. % endtry
  85. <td>
  86. <form action="${environ['PATH_INFO']}" method="post">
  87. <input type="hidden" name="action" value="delete">
  88. <input type="hidden" name="cookie" value="${cookie.key | h}">
  89. <button type="submit">Delete</button>
  90. </form>
  91. </td>
  92. </tr>
  93. % endfor
  94. <tr>
  95. <td>
  96. <form action="${environ['PATH_INFO']}" method="post">
  97. <input type="hidden" name="action" value="delete">
  98. <input type="hidden" name="all" value="1">
  99. <button type="submit">Delete all</button>
  100. </form>
  101. </td>
  102. </tr>
  103. </table>
  104. % else:
  105. <p>No cookies!</p>
  106. % endif
  107. <%include file="/support/footer.mako" args="environ=environ, cookies=cookies"/>