A copyright violation detector running on Wikimedia Cloud Services https://tools.wmflabs.org/copyvios/
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 

110 řádky
6.2 KiB

  1. <% bot, status, langs, projects = main(environ, headers, cookies) %>\
  2. <%include file="/support/header.mako" args="environ=environ, cookies=cookies, title='Settings'"/>\
  3. <%namespace module="toolserver.settings" import="main"/>\
  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 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 | 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["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 | 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-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 "list"
  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 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. <h2>Cookies</h2>
  70. % if cookies:
  71. <table>
  72. <% cookie_order = ["EarwigDefaultProject", "EarwigDefaultLang", "EarwigBackground", "EarwigScreenCache", "EarwigCVShowDetails"] %>\
  73. % for key in [key for key in cookie_order if key in cookies]:
  74. <% cookie = cookies[key] %>\
  75. <tr>
  76. <td><b><tt>${key | h}</tt></b></td>
  77. % try:
  78. <% lines = dumps(loads(cookie.value), indent=4).splitlines() %>\
  79. <td>
  80. % for line in lines:
  81. <tt><div class="indentable">${line | h}</div></tt>
  82. % endfor
  83. </td>
  84. % except ValueError:
  85. <td><tt>${cookie.value | h}</tt></td>
  86. % endtry
  87. <td>
  88. <form action="${environ['PATH_INFO']}" 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['PATH_INFO']}" 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"/>