Author: elias
Date: Sun Oct 12 15:12:07 2008
New Revision: 30084
URL: http://svn.gna.org/viewcvs/wesnoth?rev=30084&view=rev
Log:
addon_manager: Backported revision 30082 to 1.4.
Added:
branches/1.4/utils/addon_manager/asc.gif
- copied unchanged from r30082, trunk/data/tools/addon_manager/asc.gif
branches/1.4/utils/addon_manager/bg.gif
- copied unchanged from r30082, trunk/data/tools/addon_manager/bg.gif
branches/1.4/utils/addon_manager/desc.gif
- copied unchanged from r30082, trunk/data/tools/addon_manager/desc.gif
branches/1.4/utils/addon_manager/jquery.js
- copied unchanged from r30082, trunk/data/tools/addon_manager/jquery.js
branches/1.4/utils/addon_manager/tablesorter.js
- copied unchanged from r30082,
trunk/data/tools/addon_manager/tablesorter.js
Removed:
branches/1.4/utils/addon_manager/sorttable.js
Modified:
branches/1.4/utils/addon_manager/html.py
branches/1.4/utils/addon_manager/style.css
branches/1.4/utils/campaigns_client.py
Modified: branches/1.4/utils/addon_manager/html.py
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/utils/addon_manager/html.py?rev=30084&r1=30083&r2=30084&view=diff
==============================================================================
--- branches/1.4/utils/addon_manager/html.py (original)
+++ branches/1.4/utils/addon_manager/html.py Sun Oct 12 15:12:07 2008
@@ -1,3 +1,4 @@
+# encoding: utf8
import time, os, glob, sys
def output(path, url, data):
@@ -13,7 +14,19 @@
<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 @@
<div class="topnav">
<a href="index.html">Wesnoth Addons</a>
</div>
-<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
campaigns.wesnoth.org.
-Select the add-on you want to install from the list and click "OK". The
download will commence immediately. Once the download has finished you have to
restart Battle for Wesnoth before you can play the add-on.</p>
+<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 utils/addon_manager/style.css " + path)
- os.system("cp -u utils/addon_manager/sorttable.js " + path)
+ for name in ["style.css", "jquery.js", "tablesorter.js",
+ "asc.gif", "bg.gif", "desc.gif"]:
+ os.system("cp -u utils/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 </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 @@
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>
© 2003-2008 The Battle for Wesnoth</p>
<p>Supported by <a href="http://www.jexiste.fr/">Jexiste</a></p>
</div>
Removed: branches/1.4/utils/addon_manager/sorttable.js
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/utils/addon_manager/sorttable.js?rev=30083&view=auto
==============================================================================
--- branches/1.4/utils/addon_manager/sorttable.js (original)
+++ branches/1.4/utils/addon_manager/sorttable.js (removed)
@@ -1,14 +1,0 @@
-var stIsIE=
-/[EMAIL PROTECTED]@*/
-false;sorttable={init:function(){if(arguments.callee.done){return
}arguments.callee.done=true;if(_timer){clearInterval(_timer)}if(!document.createElement||!document.getElementsByTagName){return
}sorttable.DATE_RE=/^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;forEach(document.getElementsByTagName("table"),function(A){if(A.className.search(/\bsortable\b/)!=-1){sorttable.makeSortable(A)}})},makeSortable:function(B){if(B.getElementsByTagName("thead").length==0){the=document.createElement("thead");the.appendChild(B.rows[0]);B.insertBefore(the,B.firstChild)}if(B.tHead==null){B.tHead=B.getElementsByTagName("thead")[0]}if(B.tHead.rows.length!=1){return
}sortbottomrows=[];for(var
A=0;A<B.rows.length;A++){if(B.rows[A].className.search(/\bsortbottom\b/)!=-1){sortbottomrows[sortbottomrows.length]=B.rows[A]}}if(sortbottomrows){if(B.tFoot==null){tfo=document.createElement("tfoot");B.appendChild(tfo)}for(var
A=0;A<sortbottomrows.length;A++){tfo.appendChild(sortbottomrows[A])}delete
sortbottomrows}headrow=B.tHead.rows[0].cells;for(var
A=0;A<headrow.length;A++){if(!headrow[A].className.match(/\bsorttable_nosort\b/)){mtch=headrow[A].className.match(/\bsorttable_([a-z0-9]+)\b/);if(mtch){override=mtch[1]}if(mtch&&typeof
sorttable["sort_"+override]=="function"){headrow[A].sorttable_sortfunction=sorttable["sort_"+override]}else{headrow[A].sorttable_sortfunction=sorttable.guessType(B,A)}headrow[A].sorttable_columnindex=A;headrow[A].sorttable_tbody=B.tBodies[0];dean_addEvent(headrow[A],"click",function(D){if(this.className.search(/\bsorttable_sorted\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted","sorttable_sorted_reverse");this.removeChild(document.getElementById("sorttable_sortfwdind"));sortrevind=document.createElement("span");sortrevind.id="sorttable_sortrevind";sortrevind.innerHTML=stIsIE?' <font
face="webdings">5</font>':" ▴";this.appendChild(sortrevind);return
}if(this.className.search(/\bsorttable_sorted_reverse\b/)!=-1){sorttable.reverse(this.sorttable_tbody);this.className=this.className.replace("sorttable_sorted_reverse","sorttable_sorted");this.removeChild(document.getElementById("sorttable_sortrevind"));sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.innerHTML=stIsIE?' <font
face="webdings">6</font>':" ▾";this.appendChild(sortfwdind);return
}theadrow=this.parentNode;forEach(theadrow.childNodes,function(E){if(E.nodeType==1){E.className=E.className.replace("sorttable_sorted_reverse","");E.className=E.className.replace("sorttable_sorted","")}});sortfwdind=document.getElementById("sorttable_sortfwdind");if(sortfwdind){sortfwdind.parentNode.removeChild(sortfwdind)}sortrevind=document.getElementById("sorttable_sortrevind");if(sortrevind){sortrevind.parentNode.removeChild(sortrevind)}this.className+="
sorttable_sorted";sortfwdind=document.createElement("span");sortfwdind.id="sorttable_sortfwdind";sortfwdind.innerHTML=stIsIE?' <font
face="webdings">6</font>':" ▾";this.appendChild(sortfwdind);row_array=[];col=this.sorttable_columnindex;rows=this.sorttable_tbody.rows;for(var
C=0;C<rows.length;C++){row_array[row_array.length]=[sorttable.getInnerText(rows[C].cells[col]),rows[C]]}row_array.sort(this.sorttable_sortfunction);tb=this.sorttable_tbody;for(var
C=0;C<row_array.length;C++){tb.appendChild(row_array[C][1])}delete
row_array})}}},guessType:function(C,B){sortfn=sorttable.sort_alpha;for(var
A=0;A<C.tBodies[0].rows.length;A++){text=sorttable.getInnerText(C.tBodies[0].rows[A].cells[B]);if(text!=""){if(text.match(/^-?[£$¤]?[\d,.]+%?$/)){return
sorttable.sort_numeric}possdate=text.match(sorttable.DATE_RE);if(possdate){first=parseInt(possdate[1]);second=parseInt(possdate[2]);if(first>12){return
sorttable.sort_ddmm}else{if(second>12){return
sorttable.sort_mmdd}else{sortfn=sorttable.sort_ddmm}}}}}return
sortfn},getInnerText:function(B){hasInputs=(typeof
B.getElementsByTagName=="function")&&B.getElementsByTagName("input").length;if(B.getAttribute("sorttable_customkey")!=null){return
B.getAttribute("sorttable_customkey")}else{if(typeof
B.textContent!="undefined"&&!hasInputs){return
B.textContent.replace(/^\s+|\s+$/g,"")}else{if(typeof
B.innerText!="undefined"&&!hasInputs){return
B.innerText.replace(/^\s+|\s+$/g,"")}else{if(typeof
B.text!="undefined"&&!hasInputs){return
B.text.replace(/^\s+|\s+$/g,"")}else{switch(B.nodeType){case
3:if(B.nodeName.toLowerCase()=="input"){return
B.value.replace(/^\s+|\s+$/g,"")}case 4:return
B.nodeValue.replace(/^\s+|\s+$/g,"");break;case 1:case 11:var C="";for(var
A=0;A<B.childNodes.length;A++){C+=sorttable.getInnerText(B.childNodes[A])}return
C.replace(/^\s+|\s+$/g,"");break;default:return""}}}}}},reverse:function(A){newrows=[];for(var
B=0;B<A.rows.length;B++){newrows[newrows.length]=A.rows[B]}for(var
B=newrows.length-1;B>=0;B--){A.appendChild(newrows[B])}delete
newrows},sort_numeric:function(B,A){aa=parseFloat(B[0].replace(/[^0-9.-]/g,""));if(isNaN(aa)){aa=0}bb=parseFloat(A[0].replace(/[^0-9.-]/g,""));if(isNaN(bb)){bb=0}return
aa-bb},sort_alpha:function(B,A){if(B[0]==A[0]){return 0}if(B[0]<A[0]){return
-1}return
1},sort_ddmm:function(B,A){mtch=B[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt1=y+m+d;mtch=A[0].match(sorttable.DATE_RE);y=mtch[3];m=mtch[2];d=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt2=y+m+d;if(dt1==dt2){return
0}if(dt1<dt2){return -1}return
1},sort_mmdd:function(B,A){mtch=B[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt1=y+m+d;mtch=A[0].match(sorttable.DATE_RE);y=mtch[3];d=mtch[2];m=mtch[1];if(m.length==1){m="0"+m}if(d.length==1){d="0"+d}dt2=y+m+d;if(dt1==dt2){return
0}if(dt1<dt2){return -1}return 1},shaker_sort:function(F,D){var A=0;var
C=F.length-1;var G=true;while(G){G=false;for(var
B=A;B<C;++B){if(D(F[B],F[B+1])>0){var
E=F[B];F[B]=F[B+1];F[B+1]=E;G=true}}C--;if(!G){break}for(var
B=C;B>A;--B){if(D(F[B],F[B-1])<0){var
E=F[B];F[B]=F[B-1];F[B-1]=E;G=true}}A++}}};if(document.addEventListener){document.addEventListener("DOMContentLoaded",sorttable.init,false);
-/[EMAIL PROTECTED] @*/
-/[EMAIL PROTECTED] (@_win32)
- document.write("<script id=__ie_onload defer
src=javascript:void(0)><\/script>");
- var script = document.getElementById("__ie_onload");
- script.onreadystatechange = function() {
- if (this.readyState == "complete") {
- sorttable.init(); // call the onload handler
- }
- };
-/[EMAIL PROTECTED] @*/
-}if(/WebKit/i.test(navigator.userAgent)){var
_timer=setInterval(function(){if(/loaded|complete/.test(document.readyState)){sorttable.init()}},10)}window.onload=sorttable.init;function
dean_addEvent(B,D,C){if(B.addEventListener){B.addEventListener(D,C,false)}else{if(!C.$$guid){C.$$guid=dean_addEvent.guid++}if(!B.events){B.events={}}var
A=B.events[D];if(!A){A=B.events[D]={};if(B["on"+D]){A[0]=B["on"+D]}}A[C.$$guid]=C;B["on"+D]=handleEvent}}dean_addEvent.guid=1;function
removeEvent(A,C,B){if(A.removeEventListener){A.removeEventListener(C,B,false)}else{if(A.events&&A.events[C]){delete
A.events[C][B.$$guid]}}}function handleEvent(D){var
C=true;D=D||fixEvent(((this.ownerDocument||this.document||this).parentWindow||window).event);var
A=this.events[D.type];for(var B in
A){this.$$handleEvent=A[B];if(this.$$handleEvent(D)===false){C=false}}return
C}function
fixEvent(A){A.preventDefault=fixEvent.preventDefault;A.stopPropagation=fixEvent.stopPropagation;return
A}fixEvent.preventDefault=function(){this.returnValue=false};fixEvent.stopPropagation=function(){this.cancelBubble=true};if(!Array.forEach){Array.forEach=function(D,C,B){for(var
A=0;A<D.length;A++){C.call(B,D[A],A,D)}}}Function.prototype.forEach=function(A,D,C){for(var
B in A){if(typeof
this.prototype[B]=="undefined"){D.call(C,A[B],B,A)}}};String.forEach=function(A,C,B){Array.forEach(A.split(""),function(E,D){C.call(B,E,D,A)})};var
forEach=function(A,D,B){if(A){var C=Object;if(A instanceof
Function){C=Function}else{if(A.forEach instanceof
Function){A.forEach(D,B);return }else{if(typeof
A=="string"){C=String}else{if(typeof
A.length=="number"){C=Array}}}}C.forEach(A,D,B)}};
Modified: branches/1.4/utils/addon_manager/style.css
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/utils/addon_manager/style.css?rev=30084&r1=30083&r2=30084&view=diff
==============================================================================
--- branches/1.4/utils/addon_manager/style.css (original)
+++ branches/1.4/utils/addon_manager/style.css Sun Oct 12 15:12:07 2008
@@ -32,18 +32,25 @@
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 @@
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 {
}
Modified: branches/1.4/utils/campaigns_client.py
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/1.4/utils/campaigns_client.py?rev=30084&r1=30083&r2=30084&view=diff
==============================================================================
--- branches/1.4/utils/campaigns_client.py (original)
+++ branches/1.4/utils/campaigns_client.py Sun Oct 12 15:12:07 2008
@@ -120,6 +120,8 @@
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" %
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits