From e47a36393a02057ccd82537d9fbe2ee964ed18e6 Mon Sep 17 00:00:00 2001 From: ozhozh Date: Sat, 12 Sep 2009 11:55:22 +0000 Subject: [PATCH] Big cosmetic commit - fixed width layout - icons for action buttons - link to stats from main admin page - trim too long urls in the admin page git-svn-id: http://yourls.googlecode.com/svn/trunk@136 12232710-3e20-11de-b438-597f59cd7555 --- admin/index.php | 13 ++- css/infos.css | 2 + css/share.css | 21 ---- css/style.css | 78 ++++++++++++++- images/chart_bar.png | Bin 0 -> 541 bytes images/delete.png | Bin 0 -> 715 bytes images/pencil.png | Bin 0 -> 450 bytes includes/functions-infos.php | 4 +- includes/functions.php | 22 ++++- js/infos.js | 11 ++- js/insert.js | 22 ++--- yourls-infos.php | 183 +++++++++++++++++++---------------- 12 files changed, 220 insertions(+), 136 deletions(-) create mode 100644 images/chart_bar.png create mode 100644 images/delete.png create mode 100644 images/pencil.png diff --git a/admin/index.php b/admin/index.php index 6171ce4..61f6878 100644 --- a/admin/index.php +++ b/admin/index.php @@ -15,7 +15,7 @@ $sort_order_sql = 'desc'; $page = ( isset( $_GET['page'] ) ? intval($_GET['page']) : 1 ); $search = ( isset( $_GET['s_search'] ) ? mysql_real_escape_string(trim($_GET['s_search'])) : '' ); -$perpage = ( isset( $_GET['perpage'] ) && intval( $_GET['perpage'] ) ? intval($_GET['perpage']) : 10 ); +$perpage = ( isset( $_GET['perpage'] ) && intval( $_GET['perpage'] ) ? intval($_GET['perpage']) : 20 ); $link_limit = ( isset( $_GET['link_limit'] ) && intval($_GET['link_limit']) ? intval($_GET['link_limit']) : '' ); if ( $link_limit != '' ) { $link_filter = ( isset( $_GET['link_filter'] ) && $_GET['link_filter'] == 'more' ? 'more' : 'less' ) ; @@ -162,13 +162,12 @@ Your are logged in as: . Logout. Check the Tools.

-

- Display to of URLs. - +

Display to of URLs.

+

- Overall, tracking links, clicks, and counting! -

+

Overall, tracking links, clicks, and counting!

@@ -180,7 +179,7 @@ - + diff --git a/css/infos.css b/css/infos.css index 9404994..2ea3e5b 100644 --- a/css/infos.css +++ b/css/infos.css @@ -47,6 +47,8 @@ li#sites_various { padding-left:22px; padding-top:4px;} +li.sites_list img {width:16px; height: 16px; display:inline-block;} + #referrer_cell { min-width: 300px;} ul.no_bullet { diff --git a/css/share.css b/css/share.css index b71c526..0219331 100644 --- a/css/share.css +++ b/css/share.css @@ -41,24 +41,3 @@ div.share { #share_fb {background:transparent url(../images/facebook.png) left center no-repeat;} #share_ff {background:transparent url(../images/friendfeed.png) left center no-repeat;} -#tools_desc { - width:550px; - zbackground:#ffe; - padding-bottom:10px; -} -#tools_desc span { - background:#ffa; - padding:0 2px; -} - -#tools_desc .bookmarklet { - border:2px solid #2A85B3; - -moz-border-radius:3px; - -webkit-border-radius:3px; - padding:5px 5px 5px 20px; - background:#eef url(../images/favicon.gif) 2px center no-repeat; -} - -#tools_desc .bookmarklet:hover { - text-decoration:none; -} \ No newline at end of file diff --git a/css/style.css b/css/style.css index c7e3410..2cd7434 100644 --- a/css/style.css +++ b/css/style.css @@ -2,6 +2,23 @@ body { font-family: Verdana, Arial; font-size: 12px; color: #595441; + background:#E6EEEE; + text-align:center; + margin-top:0px; + padding-top:0px; +} +#wrap { + width:980px; + margin:0 auto; + border-left:2px solid #E6FFEE; + border-right:2px solid #E6eeff; + background:white; + text-align:justify; + padding:0 20px; + -moz-border-radius-bottomleft:20px; + -moz-border-radius-bottomright:20px; + -webkit-border-bottom-left-radius:20px; + -webkit-border-bottom-right-radius:20px; } div, p, td { font-family: Verdana, Arial; @@ -14,11 +31,11 @@ a, a:link, a:active, a:visited { a:hover { text-decoration: underline; } -h1 {height:50px;} +h1 {height:50px;margin:0;} h1 a {float:right;text-align:right;} h1 a:hover{text-decoration:none;} h1 a:hover span{text-decoration:underline;color:#8dbdd8} -input, textarea { +input, textarea, .button_stats { -moz-border-radius:3px; -webkit-border-radius:3px; } @@ -83,15 +100,31 @@ tr.edit-row td { #new_url #feedback .fail { color:#f55; } -td.actions input{ +td.actions input, td.actions a { visibility:hidden; } -td.actions input.disabled, td.actions input.loading{ +td.actions input.disabled, td.actions input.loading { visibility:visible; } -tr:hover td.actions input{ +tr:hover td.actions input, tr:hover td.actions a { visibility:visible; } +td.actions .button { + height:22px; + width:22px; +} +td.actions .button_edit { + background:transparent url(../images/pencil.png) 2px center no-repeat; +} +td.actions .button_delete { + background:transparent url(../images/delete.png) 2px center no-repeat; +} +td.actions .button_stats { + background:transparent url(../images/chart_bar.png) 2px center no-repeat; +} +td.actions .button_stats:hover { + text-decoration:none; +} .error { color: red; } @@ -135,3 +168,38 @@ tr:hover td.actions input{ #login ul.success li { background:transparent url(../images/accept.png) top left no-repeat; } +#tools_desc { + width:550px; + zbackground:#ffe; + padding-bottom:10px; +} +#tools_desc span { + background:#ffa; + padding:0 2px; +} +#tools_desc .bookmarklet { + border:2px solid #2A85B3; + -moz-border-radius:3px; + -webkit-border-radius:3px; + padding:5px 5px 5px 20px; + background:#eef url(../images/favicon.gif) 2px center no-repeat; +} +#tools_desc .bookmarklet:hover { + text-decoration:none; +} +#footer { + text-align:center; + margin-top:10px; +} +#footer p { + padding:10px; + background:white; + margin:0 auto; + width:980px; + -moz-border-radius:10px; + -webkit-border-radius:10px; +} +#footer p a { + background:#fff url(../images/favicon.gif) 2px center no-repeat; + padding-left:20px; +} \ No newline at end of file diff --git a/images/chart_bar.png b/images/chart_bar.png new file mode 100644 index 0000000000000000000000000000000000000000..9051fbc609b92b15af9be410e368b7adc20283b8 GIT binary patch literal 541 zcmV+&0^V&qIn(Wzh!))n z^W^$!aM&X3bCX~Vo|JLOLCb!-`g!yN7b-yh!|sbVZ|M~fElQAyiB?lO%sjz z7TJ==TTk%_A{ znxkIa+E~RC#EKF{U0G~y<6)R9(uCp7&f7|JN}RHwEO@{EgbF~D3a1<@ip|9yZb^6$ fo@6A$W#9P^w2GuX0-m@}00000NkvXXu0mjfB69Bi literal 0 HcmV?d00001 diff --git a/images/delete.png b/images/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..08f249365afd29594b51210c6e21ba253897505d GIT binary patch literal 715 zcmV;+0yO=JP)C4}Mrzlg<+1Y8PEBfUp0jJpx4B>@E+cy3`^(Gw`Mf+2&yxZm<$to~Vpgvg&QKNR z_f#1(r6svZt%iF?s+n<8X?B&!h3g9Dbb8_=MX}!;HiQSAh`bp^WMl~Z-44teO7W_Y zV4thSL{h;rJY7!l3%5J4H1!tIzB`Dv+YxO(haWeausGZYkI8^hWj6mzo=L0{%;yxzh{5!Htr?51 zvG|W62MzC8BZ76hRpCyO2zOn<%e)K>NHge!-~)Ap33OdWw6hsLYbCxGNt0%wk_2z7 zfyYvXheSG)5HRK1VB~%mq7Dmurw#bi@hEcOr3&G1ZiF*$M=&9nB#VNf&Q^r$4G5kp zTURh&s)E0%5&hyVD}sp<72~zmAY`Y(9aqO6CXF%=zFHGzO-A&I(pE}v70YQxCPJ{Y z4L+?5-crdLn3ZRPEs!A4ehEY3ZRpL~w9>@aMN+{F4dI@v&>(QDHQum!mG~E^$OS8l z!7?%Uwib*ROP67Hw`ika)gX-(8Ia`-u_IEhxG7U<13kSsMW+$lbb2dUMm5p6pa}cjgA+U$^mJ^AjD?&bdi)8~y+Q002ovPDHLkV1g8IMc@Dc literal 0 HcmV?d00001 diff --git a/images/pencil.png b/images/pencil.png new file mode 100644 index 0000000000000000000000000000000000000000..0bfecd50ee9f5bc5828f0c0745aa3e0effcbe250 GIT binary patch literal 450 zcmV;z0X_bSP)Rq1}l<=psl5*5Xz9i;M}s*NP=ugs7Q#8Z;Dyx|}!`#}xw_C3!B-yaPC&0j)XcpuX@rNfq|q}N(wJOjA& z>u+z?dfJEuLePrqzy!)73pvLjxk4d6XNZt?hm_iYES{i}J5y3l?}PPNYDBR7oPc~6 zL^d)Bi4Q2L3pnp!nFxN9c2E+=@XAl&+;2m6a~kZj1r3Mz3C=hmUG<{+vWR@t4q?fJ zhFc(ozZD#Mx`^Q~g1v=K6!QnfuqyD4>U4EjF0eamL}Jx| z%&`kR-H+3GBYr*Qx}frLU4`%n9(`uSomzw)t%%NagXkA*R5Mbv9VLDp1wMo$cOMa~ s3Wm%r7^bwK$2$}-<~D8p`#1iScU4^XCLAA~0ssI207*qoM6N<$g3sK(Qvd(} literal 0 HcmV?d00001 diff --git a/includes/functions-infos.php b/includes/functions-infos.php index 3df6d8e..f597459 100644 --- a/includes/functions-infos.php +++ b/includes/functions-infos.php @@ -16,7 +16,7 @@ function yourls_stats_countries_map( $countries ) { } // Echoes an image tag of Google Charts pie from sorted array of 'data' => 'value' (sort by DESC). Optional $limit = (integer) limit list of X first countries, sorted by most visits -function yourls_stats_pie( $data, $limit = 10, $size = '340x220' ) { +function yourls_stats_pie( $data, $limit = 10, $size = '340x220', $colors = '202040,9090AA' ) { // Trim array: $limit first item + the sum of all others if ( count( $data ) > $limit ) { $i= 0; @@ -43,7 +43,7 @@ function yourls_stats_pie( $data, $limit = 10, $size = '340x220' ) { 'cht' => 'p', 'chs' => $size, 'chd' => 't:'.( join(',' , $data ) ), - 'chco'=> '202040,9090AA', + 'chco'=> $colors, 'chl' => join('|' , array_keys( $data ) ) ); $pie_src = 'http://chart.apis.google.com/chart?' . http_build_query( $pie ); diff --git a/includes/functions.php b/includes/functions.php index 8aa475b..b3abd53 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -140,7 +140,7 @@ function yourls_table_edit_row( $keyword ) { if( $url ) { $return = << + RETURN; } else { $return = ''; @@ -157,9 +157,11 @@ function yourls_table_add_row( $keyword, $url, $ip, $clicks, $timestamp ) { $clicks = number_format($clicks); $www = YOURLS_SITE; $shorturl = YOURLS_SITE.'/'.$keyword; + $display_url = yourls_trim_long_string( $url ); + $statlink = $shorturl.'+'; return << + ROW; } @@ -299,8 +301,8 @@ function yourls_edit_link($url, $keyword, $newkeyword='') { // All clear, update if ( !$new_url_already_there && $keyword_is_ok ) { - $timestamp4screen = date( 'Y M d H:i', time()+( yourls_HOURS_OFFSET * 3600) ); - $timestamp4db = date('Y-m-d H:i:s', time()+( yourls_HOURS_OFFSET * 3600) ); + $timestamp4screen = date( 'Y M d H:i', time()+( YOURLS_HOURS_OFFSET * 3600) ); + $timestamp4db = date('Y-m-d H:i:s', time()+( YOURLS_HOURS_OFFSET * 3600) ); $update_url = $ydb->query("UPDATE `$table` SET `url` = '$url', `timestamp` = '$timestamp4db', `keyword` = '$newkeyword' WHERE `keyword` = '$keyword';"); if( $update_url ) { $return['url'] = array( 'keyword' => $newkeyword, 'shorturl' => YOURLS_SITE.'/'.$newkeyword, 'url' => $strip_url, 'date' => $timestamp4screen); @@ -582,6 +584,7 @@ function yourls_html_head( $context = 'index' ) { +
num_queries > 1 ? $ydb->num_queries.' queries' : $ydb->num_queries.' query'; ?> +
'. $ydb->all_queries .'

'; @@ -813,7 +817,7 @@ function yourls_redirect( $location, $code = 301 ) { function yourls_redirect_javascript( $location ) { echo << - //window.location="$location"; + window.location="$location"; (if you are not redirected after 10 seconds, please click here) REDIR; @@ -1155,4 +1159,12 @@ function yourls_html_link( $href, $title = '' ) { // Return word or words if more than one function yourls_plural( $word, $count=1 ) { return $word . ($count > 1 ? 's' : ''); +} + +// Return trimmed string +function yourls_trim_long_string( $string, $length = 70, $append = '[...]' ) { + if ( strlen( $string ) > $length ) { + $string = substr( $string, 0, $length - strlen( $append ) ) . $append; + } + return $string; } \ No newline at end of file diff --git a/js/infos.js b/js/infos.js index 7d6506c..d229bd6 100644 --- a/js/infos.js +++ b/js/infos.js @@ -3,6 +3,7 @@ $(document).ready(function(){ $('#tabs ul#headers').css('display', 'block'); $('.tab h2').css('display','none'); + // Toggle tabs $('#tabs ul#headers li a').click(function(){ var target = $(this).attr('href').replace('#', ''); $('#tabs div.tab').css('display', 'none'); @@ -11,9 +12,15 @@ $(document).ready(function(){ $(this).addClass('selected').css('outline', 'none').blur(); return false; }); + + // Activate tab + if (location.hash) { + $('#tabs ul#headers li a[href="'+location.hash+'"]').click(); + } else { + $('#tabs ul#headers li a:first').click(); + } - $('#tabs ul#headers li a:first').click(); - + // Toggle detail lists $('a.details').click(function(){ var target = $(this).attr('id').replace('more_', 'details_'); $('#'+target).toggle(); diff --git a/js/insert.js b/js/insert.js index 3f6d815..75a57c8 100644 --- a/js/insert.js +++ b/js/insert.js @@ -41,8 +41,7 @@ function add() { // Display the edition interface function edit(id) { - add_loading("#edit-button-" + id); - add_loading("#delete-button-" + id); + add_loading('#actions-'+id+' .button'); var keyword = $('#keyword_'+id).val(); $.getJSON( "index_ajax.php", @@ -50,8 +49,7 @@ function edit(id) { function(data){ $("#id-" + id).after( data.html ); $("#edit-url-"+ id).focus(); - end_loading("#edit-button-" + id); - end_loading("#delete-button-" + id); + end_loading('#actions-'+id+' .button'); } ); } @@ -75,11 +73,15 @@ function remove(id) { ); } +// Redirect to stat page +function stats(link) { + window.location=link; +} + // Cancel edition of a link function hide_edit(id) { $("#edit-" + id).fadeOut(200, function(){ - end_disable("#edit-button-" + id); - end_disable("#delete-button-" + id); + end_disable('#actions-'+id+' .button'); }); } @@ -96,17 +98,15 @@ function edit_save(id) { function(data){ if(data.status == 'success') { $("#url-" + id).html('' + data.url.url + ''); - $("#keyword-" + id).html('' + data.url.shorturl + ''); + $("#keyword-" + id).html('' + data.url.keyword + ''); $("#timestamp-" + id).html(data.url.date); $("#edit-" + id).fadeOut(200, function(){ $('#tblUrl tbody').trigger("update"); }); } feedback(data.message, data.status); - end_disable("#edit-close-" + id); - end_loading("#edit-close-" + id); - end_disable("#edit-button-" + id); - end_disable("#delete-button-" + id); + end_disable('#actions-'+id+' .button'); + end_loading('#actions-'+id+' .button'); } ); } diff --git a/yourls-infos.php b/yourls-infos.php index f2a82bd..5082e9c 100644 --- a/yourls-infos.php +++ b/yourls-infos.php @@ -25,7 +25,7 @@ $dates = array(); // Loop through all results and build list of referrers, countries and hits per day -foreach( $hits as $hit ) { +foreach( (array)$hits as $hit ) { extract( (array)$hit ); if ( isset( $country_code ) && $country_code ) { @@ -106,13 +106,12 @@

Your are logged in as: . Logout

-

Informations

+

Informations

Short URL:

Long URL:

Number of hits since : hit 1 ? 's' : ''); ?>

-
Short URLShort URL  Original URL Date IPOriginal URL: Short URL: $www/ 
Original URL: Short URL: $www/ 
Error, URL not found
$shorturl$url$date$ip$clicks 
$keyword$display_url$date$ip$clicks  
- - - - -
-

Top 5 countries

- -

Click for more details

- - -
-

Overall traffic

- -
+ + + + + + + +
+

Top 5 countries

+ +

Click for more details

+ + +
+

Overall traffic

+ +
+ + No countrie data. Maybe the geolocation module is not installed, or no traffic yet.

"; + } ?>

Traffic Sources

- - - - -
-

Referrer shares

- -

Referrers

-
    + + + + + + + - - + +
    +

    Referrer shares

    $count ) { - $i++; - echo "
  • $site: $count (details)
  • \n"; - echo " + +
    +

    Direct vs Referrer Traffic

    + $direct, 'Referrers'=> $ref_traffic), 5, '440x220', '902020,FF6060' ); ?> - - - -
    -

    Direct vs Referrer Traffic

    - $direct, 'Referrers'=> $ref_traffic), 5, '440x220' ); - ?> -

    Direct traffic:

    -

    Referrer traffic:

    +

    Direct traffic:

    +

    Referrer traffic:

    + +
    -
+ No referrer data. Get some clicks first!

"; + } ?>
-- 2.45.0