Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 76E3210796 for ; Sat, 10 Aug 2013 22:26:56 +0000 (UTC) Received: (qmail 57313 invoked by uid 500); 10 Aug 2013 22:26:55 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 57261 invoked by uid 500); 10 Aug 2013 22:26:55 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 57193 invoked by uid 99); 10 Aug 2013 22:26:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Aug 2013 22:26:55 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Aug 2013 22:26:31 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id AB2C02388B46 for ; Sat, 10 Aug 2013 22:25:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r874057 [7/31] - in /websites/production/commons/content/sandbox/commons-openpgp: ./ apidocs/ apidocs/org/apache/commons/openpgp/ apidocs/org/apache/commons/openpgp/ant/ apidocs/org/apache/commons/openpgp/ant/class-use/ apidocs/org/apache/c... Date: Sat, 10 Aug 2013 22:25:21 -0000 To: commits@commons.apache.org From: dennisl@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130810222528.AB2C02388B46@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: websites/production/commons/content/sandbox/commons-openpgp/apidocs/src-html/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/apidocs/src-html/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html (added) +++ websites/production/commons/content/sandbox/commons-openpgp/apidocs/src-html/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html Sat Aug 10 22:25:17 2013 @@ -0,0 +1,275 @@ + + +
+001    /*
+002     * Licensed to the Apache Software Foundation (ASF) under one or more
+003     * contributor license agreements.  See the NOTICE file distributed with
+004     * this work for additional information regarding copyright ownership.
+005     * The ASF licenses this file to You under the Apache License, Version 2.0
+006     * (the "License"); you may not use this file except in compliance with
+007     * the License.  You may obtain a copy of the License at
+008     *
+009     *      http://www.apache.org/licenses/LICENSE-2.0
+010     *
+011     * Unless required by applicable law or agreed to in writing, software
+012     * distributed under the License is distributed on an "AS IS" BASIS,
+013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+014     * See the License for the specific language governing permissions and
+015     * limitations under the License.
+016     */
+017    package org.apache.commons.openpgp.ant;
+018    
+019    import java.io.File;
+020    import java.io.FileInputStream;
+021    import java.io.FileNotFoundException;
+022    import java.io.IOException;
+023    import org.apache.commons.openpgp.BouncyCastleKeyRing;
+024    import org.apache.commons.openpgp.BouncyCastleOpenPgpSignatureVerifier;
+025    import org.apache.commons.openpgp.KeyRing;
+026    import org.apache.commons.openpgp.OpenPgpException;
+027    import org.apache.commons.openpgp.OpenPgpSignatureVerifier;
+028    import org.apache.commons.openpgp.SignatureStatus;
+029    import org.apache.tools.ant.BuildException;
+030    import org.apache.tools.ant.Task;
+031    import org.apache.tools.ant.types.Mapper;
+032    import org.apache.tools.ant.util.FileNameMapper;
+033    import org.apache.tools.ant.util.FileUtils;
+034    import org.apache.tools.ant.util.GlobPatternMapper;
+035    import org.bouncycastle.openpgp.PGPException;
+036    
+037    /**
+038     * Verify a signature using the Bouncy Castle OpenPGP provider.
+039     *
+040     * @author <a href="mailto:dennisl@apache.org">Dennis Lundberg</a>
+041     */
+042    public class OpenPgpVerifierTask extends Task {
+043        private File secring;
+044        private File pubring;
+045        private String password;
+046        private File artefact;
+047        private boolean asciiarmor = true;
+048        private Mapper mapperElement;
+049        private String verifyproperty;
+050    
+051        /**
+052         * Set the secret keyring.
+053         * @param secring secret keyring file
+054         */
+055        public void setSecring(File secring) {
+056            this.secring = secring;
+057        }
+058    
+059        /**
+060         * Set the public keyring.
+061         * @param pubring public keyring file
+062         */
+063        public void setPubring(File pubring) {
+064            this.pubring = pubring;
+065        }
+066    
+067        /**
+068         * Use ASCII armored signature files?
+069         * @param asciiarmor ascii armored signatures?
+070         */
+071        public void setAsciiarmor(boolean asciiarmor) {
+072            this.asciiarmor = asciiarmor;
+073        }
+074    
+075        /**
+076         * Set the value of the password.
+077         * @param password value of the password
+078         */
+079        public void setPassword(String password) {
+080            this.password = password;
+081        }
+082    
+083        /**
+084         * Set the artefact to be handled.
+085         * @param artefact artefact to be handled
+086         */
+087        public void setArtefact(File artefact) {
+088            this.artefact = artefact;
+089        }
+090    
+091        /**
+092         * Set the name of the property that contains the result of the verification.
+093         * @param verifyproperty name of the property
+094         */
+095        public void setVerifyproperty(String verifyproperty) {
+096            this.verifyproperty = verifyproperty;
+097        }
+098    
+099        /**
+100         * Define the mapper to map source to destination files.
+101         * @return a mapper to be configured.
+102         * @exception org.apache.tools.ant.BuildException if more than one mapper is defined.
+103         */
+104        public Mapper createMapper() throws BuildException {
+105            if (mapperElement != null) {
+106                throw new BuildException("Cannot define more than one mapper",
+107                        getLocation());
+108            }
+109            mapperElement = new Mapper(getProject());
+110            return mapperElement;
+111        }
+112    
+113        public void execute() {
+114            if (secring == null) {
+115                throw new BuildException("secring attribute compulsory");
+116            }
+117            if (pubring == null) {
+118                throw new BuildException("pubring attribute compulsory");
+119            }
+120            if (password == null) {
+121                throw new BuildException("password attribute compulsory");
+122            }
+123            if (artefact == null) {
+124                throw new BuildException("The 'artefact' attribute is compulsory.");
+125            }
+126            if (verifyproperty == null) {
+127                throw new BuildException("The 'verifyproperty' attribute is compulsory.");
+128            }
+129            if (!secring.exists() || !secring.canRead()) {
+130                throw new  BuildException("secret keyring file '" + secring.getAbsolutePath() + "' does not exist or is not readable");
+131            }
+132            if (!pubring.exists() || !pubring.canRead()) {
+133                throw new  BuildException("public keyring file '" + pubring.getAbsolutePath() + "' does not exist or is not readable");
+134            }
+135            FileInputStream secStream;
+136            FileInputStream pubStream;
+137            KeyRing keyRing = null;
+138            try {
+139                secStream = new FileInputStream(secring);
+140                pubStream = new FileInputStream(pubring);
+141                keyRing = new BouncyCastleKeyRing(secStream,
+142                        pubStream, password.toCharArray() );
+143            } catch (IOException ioe) {
+144                throw new BuildException(ioe);
+145            } catch (PGPException pgpe) {
+146                throw new BuildException(pgpe);
+147            }
+148            if (artefact != null) {
+149                doHandle(keyRing, artefact);
+150            }
+151            FileUtils.close(secStream);
+152            FileUtils.close(pubStream);
+153        }
+154    
+155        private void doHandle(KeyRing keyRing, File oneartefact) {
+156            doHandle(keyRing, oneartefact, oneartefact.getParentFile(), oneartefact.getName());
+157        }
+158    
+159        private void doHandle(KeyRing keyRing, File oneartefact, File basedir, String relpath) {
+160            FileInputStream artifactFis = null;
+161            FileInputStream signatureFis = null;
+162            File signature;
+163            boolean isValid = false;
+164    
+165            try {
+166                artifactFis = new FileInputStream(oneartefact);
+167                FileNameMapper mapper = getMapper();
+168                String [] mappedFiles = mapper.mapFileName(relpath);
+169                if (mappedFiles == null || mappedFiles.length != 1) {
+170                    throw new BuildException("mapper returned more or less than one output");
+171                }
+172                signature = new File(basedir, mappedFiles[0]);
+173                signatureFis = new FileInputStream(signature);
+174                OpenPgpSignatureVerifier verifier = new BouncyCastleOpenPgpSignatureVerifier();
+175                SignatureStatus status = verifier.verifyDetachedSignature(artifactFis, signatureFis, keyRing);
+176                isValid = status.isValid();
+177            } catch (FileNotFoundException fnfe) {
+178                throw new BuildException(fnfe);
+179            } catch (IOException ioe) {
+180                throw new BuildException(ioe);
+181            } catch (OpenPgpException opgpe) {
+182                throw new BuildException(opgpe);
+183            }
+184            finally {
+185                getProject().setProperty(verifyproperty, Boolean.toString(isValid));
+186            }
+187            FileUtils.close(signatureFis);
+188            FileUtils.close(artifactFis);
+189        }
+190    
+191        /**
+192         * Return the mapper to use based on nested elements or use a default mapping.
+193         */
+194        private FileNameMapper getMapper() {
+195            FileNameMapper mapper = null;
+196            if (mapperElement != null) {
+197                mapper = mapperElement.getImplementation();
+198            } else {
+199                mapper = new GlobPatternMapper();
+200                mapper.setFrom("*");
+201                if (asciiarmor) {
+202                    mapper.setTo("*.asc");
+203                } else {
+204                    mapper.setTo("*.sig");
+205                }
+206            }
+207            return mapper;
+208        }
+209    }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file Propchange: websites/production/commons/content/sandbox/commons-openpgp/apidocs/src-html/org/apache/commons/openpgp/ant/OpenPgpVerifierTask.html ------------------------------------------------------------------------------ svn:eol-style = native Modified: websites/production/commons/content/sandbox/commons-openpgp/apidocs/stylesheet.css ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/apidocs/stylesheet.css (original) +++ websites/production/commons/content/sandbox/commons-openpgp/apidocs/stylesheet.css Sat Aug 10 22:25:17 2013 @@ -26,4 +26,3 @@ h1 { font-size: 145% } .NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} .NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;} - Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/help.css ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/help.css (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/help.css Sat Aug 10 22:25:17 2013 @@ -19,4 +19,4 @@ dd { margin: 0; padding: 1em; width: 60%; -} +} \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/main.css ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/main.css (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/main.css Sat Aug 10 22:25:17 2013 @@ -43,7 +43,7 @@ div.percentgraph background-color: #f02020; border: #808080 1px solid; height: 1.3em; - magin: 0px; + margin: 0px; padding: 0px; width: 100px; } @@ -52,7 +52,7 @@ div.percentgraph div.greenbar { background-color: #00f000; height: 1.3em; - magin: 0px; + margin: 0px; padding: 0px; } @@ -60,7 +60,7 @@ div.percentgraph div.na { background-color: #eaeaea; height: 1.3em; - magin: 0px; + margin: 0px; padding: 0px; } @@ -128,4 +128,4 @@ table.report td.heading:hover { table.report td.value { text-align: right; -} +} \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/source-viewer.css ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/source-viewer.css (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/source-viewer.css Sat Aug 10 22:25:17 2013 @@ -61,7 +61,6 @@ span.keyword { span.srcUncovered { background: #ff9090; - font-weight: bold; } span.string { @@ -71,4 +70,4 @@ span.string { span.text_italic { font-size: 12px; font-style: italic; -} +} \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/tooltip.css ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/tooltip.css (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/css/tooltip.css Sat Aug 10 22:25:17 2013 @@ -46,4 +46,4 @@ a.hastooltip:hover span { text-decoration: none; top: 2em; width: 20em; -} +} \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-packages.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-packages.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-packages.html Sat Aug 10 22:25:17 2013 @@ -20,4 +20,4 @@ - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles-org.apache.commons.openpgp.ant.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles-org.apache.commons.openpgp.ant.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles-org.apache.commons.openpgp.ant.html Sat Aug 10 22:25:17 2013 @@ -17,7 +17,10 @@ org.apache.commons.openpgp.ant OpenPgpSignerTask (0%) + +OpenPgpVerifierTask (0%) + - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles-org.apache.commons.openpgp.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles-org.apache.commons.openpgp.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles-org.apache.commons.openpgp.html Sat Aug 10 22:25:17 2013 @@ -15,45 +15,45 @@ org.apache.commons.openpgp - + - + - + - + - + - + - + - + - + - + - + - +
BouncyCastleKeyRing (77%)BouncyCastleKeyRing (82%)
BouncyCastleOpenPgpSignatureVerifier (89%)BouncyCastleOpenPgpSignatureVerifier (88%)
BouncyCastleOpenPgpSigner (90%)
BouncyCastleOpenPgpStreamingSignatureVerifier (51%)BouncyCastleOpenPgpStreamingSignatureVerifier (65%)
BouncyCastleOpenPgpStreamingSigner (51%)BouncyCastleOpenPgpStreamingSigner (71%)
KeyRing (0%)KeyRing (N/A)
OpenPgpException (0%)OpenPgpException (50%)
OpenPgpSignatureVerifier (0%)OpenPgpSignatureVerifier (N/A)
OpenPgpSigner (0%)OpenPgpSigner (N/A)
OpenPgpStreamingSignatureVerifier (0%)OpenPgpStreamingSignatureVerifier (N/A)
OpenPgpStreamingSigner (0%)OpenPgpStreamingSigner (N/A)
SignatureStatus (89%)SignatureStatus (88%)
UnknownKeyException (0%)UnknownKeyException (50%)
- + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-sourcefiles.html Sat Aug 10 22:25:17 2013 @@ -15,48 +15,51 @@ All Packages - + - + - + - + - + - + - + - + - + - + - + - + + + +
BouncyCastleKeyRing (77%)BouncyCastleKeyRing (82%)
BouncyCastleOpenPgpSignatureVerifier (89%)BouncyCastleOpenPgpSignatureVerifier (88%)
BouncyCastleOpenPgpSigner (90%)
BouncyCastleOpenPgpStreamingSignatureVerifier (51%)BouncyCastleOpenPgpStreamingSignatureVerifier (65%)
BouncyCastleOpenPgpStreamingSigner (51%)BouncyCastleOpenPgpStreamingSigner (71%)
KeyRing (0%)KeyRing (N/A)
OpenPgpException (0%)OpenPgpException (50%)
OpenPgpSignatureVerifier (0%)OpenPgpSignatureVerifier (N/A)
OpenPgpSigner (0%)OpenPgpSigner (N/A)
OpenPgpSignerTask (0%)
OpenPgpStreamingSignatureVerifier (0%)OpenPgpStreamingSignatureVerifier (N/A)
OpenPgpStreamingSigner (0%)OpenPgpStreamingSigner (N/A)
SignatureStatus (89%)OpenPgpVerifierTask (0%)
UnknownKeyException (0%)SignatureStatus (88%)
UnknownKeyException (50%)
- + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary-org.apache.commons.openpgp.ant.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary-org.apache.commons.openpgp.ant.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary-org.apache.commons.openpgp.ant.html Sat Aug 10 22:25:17 2013 @@ -16,7 +16,7 @@ - +
Package # Classes Line Coverage Branch Coverage Complexity
org.apache.commons.openpgp.ant1
0%
0/91
0%
0/36
3.462
org.apache.commons.openpgp.ant2
0%
0/168
0%
0/66
3,917
- + - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary-org.apache.commons.openpgp.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary-org.apache.commons.openpgp.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary-org.apache.commons.openpgp.html Sat Aug 10 22:25:17 2013 @@ -16,8 +16,8 @@ - - + +
Package # Classes Line Coverage Branch Coverage Complexity
org.apache.commons.openpgp18
58%
89/153
62%
20/32
1.889
org.apache.commons.openpgp.ant1
0%
0/91
0%
0/36
3.462
org.apache.commons.openpgp13
74%
114/153
87%
35/40
1,857
org.apache.commons.openpgp.ant2
0%
0/168
0%
0/66
3,917
- + - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/frame-summary.html Sat Aug 10 22:25:17 2013 @@ -16,9 +16,9 @@ - - - + + +
Package # Classes Line Coverage Branch Coverage Complexity
All Packages14
36%
89/244
29%
20/68
2.241
org.apache.commons.openpgp18
58%
89/153
62%
20/32
1.889
org.apache.commons.openpgp.ant1
0%
0/91
0%
0/36
3.462
All Packages15
35%
114/321
33%
35/106
2,534
org.apache.commons.openpgp13
74%
114/153
87%
35/40
1,857
org.apache.commons.openpgp.ant2
0%
0/168
0%
0/66
3,917
- + - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/help.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/help.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/help.html Sat Aug 10 22:25:17 2013 @@ -28,4 +28,4 @@ - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/index.html ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/index.html (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/index.html Sat Aug 10 22:25:17 2013 @@ -22,4 +22,4 @@ - + \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/customsorttypes.js ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/customsorttypes.js (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/customsorttypes.js Sat Aug 10 22:25:17 2013 @@ -1,65 +1,65 @@ -/* - * Cobertura - http://cobertura.sourceforge.net/ - * - * Copyright (C) 2005 Mark Doliner - * Copyright (C) 2005 Olivier Parent - * - * Cobertura is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, - * or (at your option) any later version. - * - * Cobertura is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Cobertura; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - - -function percentageSortType( s ) -{ - var ret; - var i = s.indexOf( "%" ); - - if (i != -1) { - s = s.substr( 0, i ); - } - ret = parseFloat(s); - if (isNaN(ret)) { - ret = -1; - } - - return ret; -} - -SortableTable.prototype.addSortType( "Percentage", percentageSortType ); - - - -// This is needed for correctly sorting numbers in different -// locales. The stock number converter only expects to sort -// numbers which use a period as a separator instead of a -// comma (like French). -function formattedNumberSortType( s ) -{ - var ret; - var i = s.indexOf(';'); - - if (i != -1) { - s = s.substring(0, i); - } - ret = parseFloat(s); - if (isNaN(ret)) { - return -1; - } - - return ret; -} - -SortableTable.prototype.addSortType( "FormattedNumber", formattedNumberSortType ); +/* + * Cobertura - http://cobertura.sourceforge.net/ + * + * Copyright (C) 2005 Mark Doliner + * Copyright (C) 2005 Olivier Parent + * + * Cobertura is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * Cobertura is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Cobertura; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + + + +function percentageSortType( s ) +{ + var ret; + var i = s.indexOf( "%" ); + + if (i != -1) { + s = s.substr( 0, i ); + } + ret = parseFloat(s); + if (isNaN(ret)) { + ret = -1; + } + + return ret; +} + +SortableTable.prototype.addSortType( "Percentage", percentageSortType ); + + + +// This is needed for correctly sorting numbers in different +// locales. The stock number converter only expects to sort +// numbers which use a period as a separator instead of a +// comma (like French). +function formattedNumberSortType( s ) +{ + var ret; + var i = s.indexOf(';'); + + if (i != -1) { + s = s.substring(0, i); + } + ret = parseFloat(s); + if (isNaN(ret)) { + return -1; + } + + return ret; +} + +SortableTable.prototype.addSortType( "FormattedNumber", formattedNumberSortType ); \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/popup.js ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/popup.js (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/popup.js Sat Aug 10 22:25:17 2013 @@ -5,4 +5,4 @@ function popupwindow(url) if (window.focus) { newwindow.focus() } -} +} \ No newline at end of file Modified: websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/sortabletable.js ============================================================================== --- websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/sortabletable.js (original) +++ websites/production/commons/content/sandbox/commons-openpgp/cobertura/js/sortabletable.js Sat Aug 10 22:25:17 2013 @@ -452,4 +452,4 @@ SortableTable.prototype.addSortType("Num SortableTable.prototype.addSortType("CaseInsensitiveString", SortableTable.toUpperCase); SortableTable.prototype.addSortType("Date", SortableTable.toDate); SortableTable.prototype.addSortType("String"); -// None is a special case +// None is a special case \ No newline at end of file