Changeset 591 for ether_statistics/web


Ignore:
Timestamp:
10/10/12 18:10:41 (12 years ago)
Author:
vmipsl
Message:

clean

Location:
ether_statistics/web
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • ether_statistics/web/project/statistics-script.jsp

    r589 r591  
    44<script type="text/javascript"> 
    55 
    6     var InterfaceStatistics = Class.create( { 
    7         initialize: function() 
    8         { 
    9             /** *********** CONTAINERS *********** **/ 
    10             this.parent = $( "#containerMiddle" ); 
    11             this.containerMenu = $( "#menuCircle" ); 
    12  
    13             /** *********** VARIABLES *********** **/ 
    14             this.language = '<spring:message code="language"/>'; 
    15             this.webmaster = "<%=WebHelper.getProperty(request, "mail.webmaster")%>"; 
    16             this.numberProjects = {"logo_acomida.jpg", "logo_ECCAD.gif", "logo_gosat.jpg", "logo_Megapoli.png", "logo_Ether.jpg", "logo_mimosa.png"}; 
    17  
    18             this.bindButtons(); 
    19             this.createDivs(); 
    20             this.createCircleMenu(); 
    21             $( ".containerToDrag" ).draggable(); 
    22         }, 
    23  
    24  
    25         // CREATES AND BINDS ******************************************************** 
    26         bindButtons: function() 
    27         { 
    28             $( "#home_button" ).bind( "dblclick", this.onClickHome ); 
    29             $( "#language_button" ).bind( "dblclick", jQuery.proxy( this.onClickLanguage, this ) ); 
    30             $( "#mail_button" ).bind( "dblclick", this.onClickMail ); 
    31             $( "#login_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogin, this ) ); 
    32         }, 
    33  
    34         createDivs: function() 
    35         { 
    36             var div1 = this.createDiv( "div1", "150", "200", "200", "100", "Main statistics", "content" ); 
    37             this.parent.append( div1 ); 
    38             var div2 = this.createDiv( "div2", "250", "200", "150", "300", "MEGAPOLI Statistics", "content" ); 
    39             this.parent.append( div2 ); 
    40             var div3 = this.createDiv( "div3", "150", "200", "300", "600", "TAPAS Statistics", "content" ); 
    41             this.parent.append( div3 ); 
    42         }, 
    43  
    44         createDiv: function( id, width, height, top, left, title, content ) 
    45         { 
    46             var divContainer = $( document.createElement( "div" ) ); 
    47             divContainer.addClass( "containerStatistics containerToDrag" ); 
    48             divContainer.attr( {id:id, style:"width:" + width + "px; height:" + height + "px; top:" + top + "px; left:" + left + "px"} ); 
    49             var divTitle = $( document.createElement( "div" ) ); 
    50             divTitle.addClass( "containerStatisticsTitle" ); 
    51             divTitle.html( title ); 
    52             divTitle.attr( {style:"width:" + (width - 7) + "px"} ); 
    53             divContainer.append( divTitle ); 
    54             var divContent = $( document.createElement( "div" ) ); 
    55             divContent.addClass( "containerStatisticsContent" ); 
    56             divContent.html( content ); 
    57             divContainer.append( divContent ); 
    58             return divContainer; 
    59         }, 
    60  
    61         createCircleMenu: function() 
    62         { 
    63             var menuWidth = 300; 
    64             var nbLogosForWidth = (this.numberProjects / 2) + 1; 
    65             var logoWidth = menuWidth / nbLogosForWidth; 
    66  
    67         }, 
    68  
    69         // REQUESTS ******************************************************** 
    70         requestChangeLocale: function() 
    71         { 
    72             $.ajax( { 
    73                 url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", 
    74                 success:function() 
    75                 { 
    76                     location.reload(); 
    77                 } 
    78             } ); 
    79         }, 
    80  
    81         // HANDLES ******************************************************** = retours ajax 
    82         handleCreateXML: function( result ) 
    83         { 
    84             this.loadingRequest.hide(); 
    85             //this.loadingRequest.display(); 
    86  
    87             var res = jQuery.parseJSON( result ).result; 
    88             alert( res ); 
    89         }, 
    90  
    91  
    92         // EVENTS ******************************************************** 
    93         onClickHome: function() 
    94         { 
    95             location.reload(); 
    96         }, 
    97  
    98         onClickLanguage: function() 
    99         { 
    100             this.requestChangeLocale(); 
    101         }, 
    102  
    103         onClickMail: function() 
    104         { 
    105             document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; 
    106         }, 
    107  
    108         onClickLogin: function() 
    109         { 
    110             if( 88 == $( "#login_bg" ).width() ) 
    111                 this.enlargeLogin(); 
    112             else 
    113                 this.reduceLogin(); 
    114         }, 
    115  
    116         onClickButtonLogin: function() 
    117         { 
    118             // TODO reduce cloud 
    119  
    120         }, 
    121  
    122         // OTHERS ******************************************************** 
    123         reduceLogin: function() 
    124         { 
    125             $( "#login_text" ).css( "visibility", "hidden" ); 
    126             $( "#login_bg" ).animate( { 
    127                 opacity: 1, 
    128                 height:'60px', 
    129                 width:'78px' 
    130             }, 5000, function() 
     6var InterfaceStatistics = Class.create( { 
     7    initialize: function() 
     8    { 
     9        /** *********** CONTAINERS *********** **/ 
     10        this.parent = $( "#containerMiddle" ); 
     11        this.containerMenu = $( "#menuCircle" ); 
     12 
     13        /** *********** VARIABLES *********** **/ 
     14        this.language = '<spring:message code="language"/>'; 
     15        this.webmaster = "<%=WebHelper.getProperty(request, "mail.webmaster")%>"; 
     16        this.projectsArray = ["logo_Ether_50.jpg", "logo_Ndacc_50.jpg", "logo_ECCAD_50.gif", "logo_iasi_50.jpg", "logo_gosat_50.jpg", "logo_Iagos_50.jpg", "logo_tropico_50.jpg", "logo_Megapoli_50.png", "logo_mimosa_50.png", "logo_reprobus_50.png", "logo_geisa_50.jpg", "logo_tapas_50.png", "logo_acomida_50.jpg", "logo_omer7A_50.jpg", "logo_girafe_50.JPG", "logo_arletty_50.jpg"]; 
     17        this.projectsPath = "resources/images/"; 
     18 
     19        this.bindButtons(); 
     20        this.createDivs(); 
     21        this.createCircleMenu(); 
     22        $( ".containerToDrag" ).draggable(); 
     23    }, 
     24 
     25 
     26    // CREATES AND BINDS ******************************************************** 
     27    bindButtons: function() 
     28    { 
     29        $( "#home_button" ).bind( "dblclick", this.onClickHome ); 
     30        $( "#language_button" ).bind( "dblclick", jQuery.proxy( this.onClickLanguage, this ) ); 
     31        $( "#mail_button" ).bind( "dblclick", this.onClickMail ); 
     32        $( "#login_button" ).bind( "dblclick", jQuery.proxy( this.onClickLogin, this ) ); 
     33    }, 
     34 
     35    createDivs: function() 
     36    { 
     37        var div1 = this.createDiv( "div1", "150", "200", "200", "100", "Main statistics", "content" ); 
     38        this.parent.append( div1 ); 
     39        var div2 = this.createDiv( "div2", "250", "200", "150", "300", "MEGAPOLI Statistics", "content" ); 
     40        this.parent.append( div2 ); 
     41        var div3 = this.createDiv( "div3", "150", "200", "300", "600", "TAPAS Statistics", "content" ); 
     42        this.parent.append( div3 ); 
     43    }, 
     44 
     45    createDiv: function( id, width, height, top, left, title, content ) 
     46    { 
     47        var divContainer = $( document.createElement( "div" ) ); 
     48        divContainer.addClass( "containerStatistics containerToDrag" ); 
     49        divContainer.attr( {id:id, style:"width:" + width + "px; height:" + height + "px; top:" + top + "px; left:" + left + "px"} ); 
     50        var divTitle = $( document.createElement( "div" ) ); 
     51        divTitle.addClass( "containerStatisticsTitle" ); 
     52        divTitle.html( title ); 
     53        divTitle.attr( {style:"width:" + (width - 7) + "px"} ); 
     54        divContainer.append( divTitle ); 
     55        var divContent = $( document.createElement( "div" ) ); 
     56        divContent.addClass( "containerStatisticsContent" ); 
     57        divContent.html( content ); 
     58        divContainer.append( divContent ); 
     59        return divContainer; 
     60    }, 
     61 
     62    createCircleMenu: function() 
     63    { 
     64        var menuSize = this.containerMenu.width(); 
     65        var nbLogosForSize = (this.projectsArray.length / 2) + 1; 
     66        var divLogoSize = menuSize / nbLogosForSize; 
     67        var logoSize = divLogoSize - 5; 
     68        var stepLeft = 0; 
     69        var stepTop = this.createTopLevels( nbLogosForSize - 1 ); 
     70        for( var i = 0; i < this.projectsArray.length; i++ ) 
     71        { 
     72            var left = stepLeft * divLogoSize; 
     73            var top = menuSize / 2 - stepTop[stepLeft] * divLogoSize; 
     74            var divLogo = $( document.createElement( "div" ) ); 
     75            divLogo.html( '<img id="img_' + this.projectsArray[i] + '"src="' + this.projectsPath + '' + this.projectsArray[i] + '" width="' + logoSize + 'px" height="' + logoSize + 'px"/>' ); 
     76            divLogo.addClass( "divLogo" ); 
     77            divLogo.attr( {id:this.projectsArray[i], style:"position:absolute; top:" + top + "px; left:" + left + "px"} ); 
     78            this.containerMenu.append( divLogo ); 
     79 
     80            if( 0 != i && (this.projectsArray.length - 1) != i ) 
    13181            { 
    132             } ); 
    133  
    134             $( "#login_button" ).animate( { 
    135                 top:'16px', 
    136                 left: '20px' 
    137             }, 5000, function() 
     82                top = menuSize / 2 + stepTop[stepLeft] * divLogoSize; 
     83                i++; 
     84                var divLogo2 = $( document.createElement( "div" ) ); 
     85                divLogo2.html( '<img id="img_' + this.projectsArray[i] + '"src="' + this.projectsPath + '' + this.projectsArray[i] + '" width="' + logoSize + 'px" height="' + logoSize + 'px"/>' ); 
     86                divLogo2.addClass( "divLogo" ); 
     87                divLogo2.attr( {id:this.projectsArray[i], style:"position:absolute; top:" + top + "px; left:" + left + "px"} ); 
     88                this.containerMenu.append( divLogo2 ); 
     89            } 
     90            stepLeft++; 
     91        } 
     92 
     93//        $( ".divLogo" ).hover( function() 
     94//        { 
     95//            $( this )[0].firstChild.width = "50px"; 
     96//            $( "#img_logo_mimosa_50.png" ).animate( { 
     97//                opacity: 1, 
     98//                width:'50px' 
     99//            }, 5000, function() 
     100//            { 
     101//            } ); 
     102 
     103//            $("#img_logo_mimosa_50.png").stop(false, false).animate({width:'50px'}, 600); 
     104//            $( "#img_" + $( this )[0].id ).width( "50px" ); 
     105//        } ); 
     106    }, 
     107 
     108    createTopLevels: function( nb ) 
     109    { 
     110        var topLevels = []; 
     111        var level = 0; 
     112        for( var i = 0; i <= (nb / 2); i++ ) 
     113        { 
     114            topLevels[i] = level; 
     115            topLevels[nb - i] = level; 
     116            level++; 
     117        } 
     118        return topLevels; 
     119    }, 
     120 
     121    // REQUESTS ******************************************************** 
     122    requestChangeLocale: function() 
     123    { 
     124        $.ajax( { 
     125            url: "project?methodName=setLocale&language=<spring:message code="label.language.value.to.switch"/>", 
     126            success:function() 
    138127            { 
    139             } ); 
    140         }, 
    141  
    142         enlargeLogin: function() 
    143         { 
    144             $( "#login_bg" ).animate( { 
    145                 opacity: 0.45, 
    146                 height:'500px', 
    147                 width:'500px' 
    148             }, 5000, function() 
    149             { 
    150                 $( "#login_text" ).css( "visibility", "visible" ); 
    151             } ); 
    152  
    153             $( "#login_button" ).animate( { 
    154                 top:'82px', 
    155                 left: '155px' 
    156             }, 5000, function() 
    157             { 
    158             } ); 
    159         } 
    160  
    161     } ); 
     128                location.reload(); 
     129            } 
     130        } ); 
     131    }, 
     132 
     133    // HANDLES ******************************************************** = retours ajax 
     134    handleCreateXML: function( result ) 
     135    { 
     136        this.loadingRequest.hide(); 
     137        //this.loadingRequest.display(); 
     138 
     139        var res = jQuery.parseJSON( result ).result; 
     140        alert( res ); 
     141    }, 
     142 
     143 
     144    // EVENTS ******************************************************** 
     145    onClickHome: function() 
     146    { 
     147        location.reload(); 
     148    }, 
     149 
     150    onClickLanguage: function() 
     151    { 
     152        this.requestChangeLocale(); 
     153    }, 
     154 
     155    onClickMail: function() 
     156    { 
     157        document.location.href = "mailto:" + this.webmaster + "?subject=[STATISTICS]"; 
     158    }, 
     159 
     160    onClickLogin: function() 
     161    { 
     162        if( 88 == $( "#login_bg" ).width() ) 
     163            this.enlargeLogin(); 
     164        else 
     165            this.reduceLogin(); 
     166    }, 
     167 
     168    onClickButtonLogin: function() 
     169    { 
     170        // TODO reduce cloud 
     171 
     172    }, 
     173 
     174    // OTHERS ******************************************************** 
     175    reduceLogin: function() 
     176    { 
     177        $( "#login_text" ).css( "visibility", "hidden" ); 
     178        $( "#login_bg" ).animate( { 
     179            opacity: 1, 
     180            height:'60px', 
     181            width:'78px' 
     182        }, 5000, function() 
     183        { 
     184        } ); 
     185 
     186        $( "#login_button" ).animate( { 
     187            top:'16px', 
     188            left: '20px' 
     189        }, 5000, function() 
     190        { 
     191        } ); 
     192    }, 
     193 
     194    enlargeLogin: function() 
     195    { 
     196        $( "#login_bg" ).animate( { 
     197            opacity: 0.45, 
     198            height:'500px', 
     199            width:'500px' 
     200        }, 5000, function() 
     201        { 
     202            $( "#login_text" ).css( "visibility", "visible" ); 
     203        } ); 
     204 
     205        $( "#login_button" ).animate( { 
     206            top:'82px', 
     207            left: '155px' 
     208        }, 5000, function() 
     209        { 
     210        } ); 
     211    } 
     212 
     213} ); 
    162214 
    163215</script> 
  • ether_statistics/web/project/statistics.jsp

    r589 r591  
    7373        </div> 
    7474 
    75         <div class="menuCircle" id="menuCircle"></div> 
     75    </div> 
    7676 
    77     </div> 
     77    <div class="menuCircle" id="menuCircle"></div> 
    7878 
    7979    <div id="containerMiddle"></div> 
  • ether_statistics/web/resources/css/statistics.css

    r589 r591  
    5252 
    5353.containerTop { 
    54     width: 840px; 
     54    width: 690px; 
    5555} 
    5656 
     
    6666    float: left; 
    6767    margin-right: 15px; 
     68} 
     69 
     70.menuCircle { 
     71    position: relative; 
     72    float: right; 
     73    width: 300px; 
    6874} 
    6975 
Note: See TracChangeset for help on using the changeset viewer.