addon_manager:

- Table sorting now displays nice arrows (using the "jquery"
  javascript library for this now).

- Auto-create --tar folder.
This commit is contained in:
Elias Pschernig 2008-10-12 13:05:11 +00:00
parent 6359ebd5d8
commit 7211157845
9 changed files with 72 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 B

View file

@ -1,3 +1,4 @@
# encoding: utf8
import time, os, glob, sys
def output(path, url, data):
@ -13,7 +14,19 @@ def output(path, url, data):
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel=stylesheet href="style.css" type="text/css">
<script src="sorttable.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$("#campaigns").tablesorter(
{
headers: { 0: { sorter: false} }
}
);
}
);
</script>
</head>
<body>""")
@ -26,24 +39,25 @@ def output(path, url, data):
<div class="topnav">
<a href="index.html">Wesnoth Addons</a>
</div>
<div class="main">
<p>To install an add-on please go to the title screen of Battle for Wesnoth. Select "Add-ons" from the menu and click "OK" to connect to add-ons.wesnoth.org.
Select the add-on you want to install from the list and click "OK". The download will commence immediately. Wesnoth will then automatically install and load the add-on so you can use it.</p>
<p>Note: Hover over the icons to see the description of the add-on.</p>
<br/>""")
""")
os.system("cp -u data/tools/addon_manager/style.css " + path)
os.system("cp -u data/tools/addon_manager/sorttable.js " + path)
for name in ["style.css", "jquery.js", "tablesorter.js",
"asc.gif", "bg.gif", "desc.gif"]:
os.system("cp -u data/tools/addon_manager/" + name + " " + path)
campaigns = data.get_or_create_sub("campaigns")
w("<table class=\"sortable\" id=\"campaigns\">")
w("<table class=\"tablesorter\" id=\"campaigns\">")
w("<thead>")
w("<tr>")
w("<th class=\"sorttable_nosort\"></th>")
w("<th>Addon</th>")
w("<th>Size</th>")
w("<th>Traffic</th>")
w("<th>Date</th>")
w("<th>Notes</th>")
for header in ["Icon", "Addon", "Size", "Traffic", "Date", "Notes"]:
w("<th>%s&nbsp;&nbsp;&nbsp;</th>" % header)
w("</tr>")
w("</thead>")
w("<tbody>")
for campaign in campaigns.get_all("campaign"):
v = campaign.get_text_val
w("<tr>")
@ -84,19 +98,21 @@ Select the add-on you want to install from the list and click "OK". The download
else:
w("</td>")
downloads = int(v("downloads", "0"))
w("<td sorttable_customkey=\"%d\"><b>%d</b> down<br/>" % (downloads,
downloads))
w("<td><b>%d</b> down<br/>" % (downloads))
w("%s up</td>" % v("uploads", "unknown"))
timestamp = int(v("timestamp", "0"))
t = time.localtime(timestamp)
w("<td sorttable_customkey=\"%d\">%s</td>" % (timestamp,
w("<td><span class=\"hidden\">%d</span>%s</td>" % (timestamp,
time.strftime("%b %d %Y", t)))
w("<td>%s</td>" % v("translate", ""))
w("</tr>")
w("</tbody>")
w("</table>")
w("""\
</div>
<div id="footer">
<p><a href="http://www.wesnoth.org/wiki/Site_Map">Site map</a></p>
<p><a href="http://www.wesnoth.org/wiki/Wesnoth:Copyrights">Copyright</a> &copy; 2003-2008 The Battle for Wesnoth</p>
<p>Supported by <a href="http://www.jexiste.fr/">Jexiste</a></p>
</div>

1
data/tools/addon_manager/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -32,18 +32,25 @@ div.topnav a {
div.topnav a:hover {
color:#CCCCCC;
}
div.main {
margin: 0em 1em 0em 1em;
}
img {
border: none;
}
div.header img {
vertical-align:middle;
}
.hidden {display: none;}
div#footer {
clear: both;
font-size: x-small;
font-size: 0.7em;
line-height:0.7em;
border-top: 1px solid black;
padding: 1em;
color:#333333;
font-family:sans-serif;
}
table#campaigns th {
@ -66,4 +73,34 @@ td:hover div.desc {
background-color: #ffffff;
border: 1px solid black;
padding: 8px;
}
/* tables */
table.tablesorter {
width: 100%;
text-align: left;
}
table.tablesorter thead tr th, table.tablesorter tfoot tr th {
border: 1px solid #000000;
padding: 4px;
}
table.tablesorter thead tr .header {
background-image: url(bg.gif);
background-repeat: no-repeat;
background-position: center right;
cursor: pointer;
}
table.tablesorter tbody td {
padding: 4px;
vertical-align: top;
}
table.tablesorter tbody tr.odd td {
}
table.tablesorter thead tr .headerSortUp {
background-image: url(asc.gif);
}
table.tablesorter thead tr .headerSortDown {
background-image: url(desc.gif);
}
table.tablesorter thead tr .headerSortDown, table.tablesorter thead tr .headerSortUp {
}

File diff suppressed because one or more lines are too long

View file

@ -130,6 +130,8 @@ if __name__ == "__main__":
print message.get_text_val("message")
if options.tar:
try: os.mkdir(options.tar)
except OSError: pass
tarname = options.tar + "/" + name + ".tar.bz2"
if options.verbose:
sys.stderr.write("Creating tarball %(tarname)s.\n" %