- Fixes in the new Weekdays Plugin
authorocto <octo>
Thu, 14 Apr 2005 17:39:03 +0000 (17:39 +0000)
committerocto <octo>
Thu, 14 Apr 2005 17:39:03 +0000 (17:39 +0000)
- Output changes to Plugins::Core and Userdetails
- Changed the light-theme's CSS accordingly..

lib/Onis/Plugins/Core.pm
lib/Onis/Plugins/Userdetails.pm
lib/Onis/Plugins/Weekdays.pm
reports/light-theme/style.css [new file with mode: 0644]

index ec6dc79..da58275 100644 (file)
@@ -591,14 +591,14 @@ sub activetimes
 
        my $header = translate ('When do we actually talk here?');
        print $fh "<h2>$header</h2>\n",
-       qq#<table class="hours_of_day">\n#,
-       qq#  <tr>\n#;
+       qq#<table class="hours">\n#,
+       qq#  <tr class="bars">\n#;
 
 # this for circles through the four colors. Each color represents six hours.
 # (4 * 6 hours = 24 hours)
        for (my $i = 0; $i <= 3; $i++)
        {
-               for (my $j = 0; $j <= 5; $j++)
+               for (my $j = 0; $j < 6; $j++)
                {
                        my $hour = (($i * 6) + $j);
                        if (!defined ($data[$hour]))
@@ -606,19 +606,22 @@ sub activetimes
                                $data[$hour] = 0;
                        }
 
-                       my $percent = 100 * ($data[$hour] / $total);
-                       my $height = int ($data[$hour] * $factor) + 1;
-                       my $img_url = $img_urls[$i];
+                       my $height  = sprintf ("%.2f", 95 * $data[$hour] / $max);
+                       my $img = $img_urls[$i];
                        
-                       print $fh '    <td>', sprintf ("%2.1f", $percent),
-                       qq#%<br /><img src="$img_url" style="height: $height#,
-                       qq#px;" alt="" /></td>\n#;
+                       print $fh qq#    <td class="bar vertical"><img src="$img" class="first last" style="height: $height\%;" alt="" /></td>\n#;
                }
        }
+       print $fh qq#  </tr>\n  <tr class="counter">\n#;
+       for (my $i = 0; $i < 24; $i++)
+       {
+               my $percent = sprintf ("%.1f", 100 * $data[$i] / $total);
+               print $fh qq#    <td class="counter">$percent\%</td>\n#;
+       }
 
        print $fh "  </tr>\n",
-       qq#  <tr class="hour_row">\n#;
-       print $fh map { "    <td>$_</td>\n" } (0 .. 23);
+       qq#  <tr class="numeration">\n#;
+       print $fh map { qq#    <td class="numeration">$_</td>\n# } (0 .. 23);
        print $fh "  </tr>\n",
        "</table>\n\n";
 }
index 1f846a7..66aa39e 100644 (file)
@@ -160,9 +160,9 @@ sub output
                $nick_data->{$nick}{'bignumbers'} = get_bignumbers ($nick);
                $nick_data->{$nick}{'interestingnumbers'} = get_interestingnumbers ($nick);
                
-               for (my $i = 0; $i < 12; $i++)
+               for (my $i = 0; $i < 24; $i++)
                {
-                       $num = $nick_data->{$nick}{'chars'}[2 * $i] + $nick_data->{$nick}{'chars'}[(2 * $i) + 1];
+                       $num = $nick_data->{$nick}{'chars'}[$i];
                        $max_time = $num if ($max_time < $num);
                }
 
@@ -315,32 +315,30 @@ sub output
                
                if (defined ($ptr->{'chars'}))
                {
-                       print $fh qq#      <table class="hours_of_day">\n        <tr>\n#;
+                       print $fh qq#      <table class="hours">\n        <tr class="bars">\n#;
                        
-                       for (my $i = 0; $i < 12; $i++)
+                       for (my $i = 0; $i < 24; $i++)
                        {
-                               my $hour = 2 * $i;
                                $num = 0;
 
-                               my $img = $V_IMAGES[int ($hour / 6)];
+                               my $img = $V_IMAGES[int ($i / 6)];
                                my $height;
 
-                               $num  = $ptr->{'chars'}[$hour];
-                               $num += $ptr->{'chars'}[$hour + 1];
+                               $num  = $ptr->{'chars'}[$i];
 
-                               $height = int (0.5 + ($time_factor * $num)) || 1;
+                               $height = sprintf ("%.2f", 95 * $num / $max_time);
 
-                               print $fh qq#          <td><img src="$img" alt="$num chars" #,
-                               qq#style="height: ${height}px;" /></td>\n#;
+                               print $fh qq#          <td class="bar vertical"><img src="$img" alt="$num chars" #,
+                               qq#class="first last" style="height: $height\%;" /></td>\n#;
                        }
 
                        print $fh <<EOF;
         </tr>
-       <tr class="hour_row">
-         <td colspan="3">0-5</td>
-         <td colspan="3">6-11</td>
-         <td colspan="3">12-17</td>
-         <td colspan="3">18-23</td>
+       <tr class="numeration">
+         <td colspan="6" class="numeration">0-5</td>
+         <td colspan="6" class="numeration">6-11</td>
+         <td colspan="6" class="numeration">12-17</td>
+         <td colspan="6" class="numeration">18-23</td>
        </tr>
       </table>
 EOF
index 788c83e..dd27ad9 100644 (file)
@@ -127,10 +127,12 @@ sub output
        for (@order)
        {
                my ($num, $abbr, $name) = @$_;
-               my $sum = $data->{$abbr}[0] + $data->{$abbr}[1] + $data->{$abbr}[2] + $data->{$abbr}[3];
 
-               $total += $sum;
-               $max = $sum if ($max < $sum);
+               for (my $i = 0; $i < 4; $i++)
+               {
+                       $max = $data->{$abbr}[$i] if ($max < $data->{$abbr}[$i]);
+                       $total += $data->{$abbr}[$i];
+               }
        }
        
        $bar_factor = $BarHeight / $max;
@@ -139,20 +141,15 @@ sub output
        for (@order)
        {
                my ($num, $abbr, $name) = @$_;
-               print $fh qq#    <td class="bar vertical $abbr">#;
-               for (my $i = 3; $i >= 0; $i--)
+               for (my $i = 0; $i < 4; $i++)
                {
                        my $num = $data->{$abbr}[$i];
                        my $height = sprintf ("%.2f", (95 * $num / $max));
                        my $img = $VImages[$i];
-                       my $class = '';
-
-                       $class = q( class="first") if ($i == 3);
-                       $class = q( class="last") if ($i == 0);
 
-                       print $fh qq(<img src="$img" alt="" style="height: ${height}%;"$class />);
+                       print $fh qq#    <td class="bar vertical $abbr">#,
+                       qq(<img src="$img" alt="" class="first last" style="height: ${height}%;" /></td>\n);
                }
-               print $fh "</td>\n";
        }
        print $fh qq(  </tr>\n  <tr class="counter">\n);
        for (@order)
@@ -160,13 +157,13 @@ sub output
                my ($num, $abbr, $name) = @$_;
                my $sum = $data->{$abbr}[0] + $data->{$abbr}[1] + $data->{$abbr}[2] + $data->{$abbr}[3];
                my $pct = sprintf ("%.1f", (100 * $sum / $total));
-               print $fh qq(    <td class="counter $abbr">$pct%</td>\n);
+               print $fh qq(    <td colspan="4" class="counter $abbr">$pct%</td>\n);
        }
        print $fh qq(  </tr>\n  <tr class="numeration">\n);
        for (@order)
        {
                my ($num, $abbr, $name) = @$_;
-               print $fh qq(    <td class="numeration $abbr">$name</td>\n);
+               print $fh qq(    <td colspan="4" class="numeration $abbr">$name</td>\n);
        }
        print $fh "  </tr>\n</table>\n\n";
 }
diff --git a/reports/light-theme/style.css b/reports/light-theme/style.css
new file mode 100644 (file)
index 0000000..aaf08fc
--- /dev/null
@@ -0,0 +1,354 @@
+a
+{
+       color: navy;
+       background-color: transparent;
+       text-decoration: none;
+       font-weight: bold;
+}
+
+a:hover
+{
+       text-decoration: underline;
+}
+
+a:visited
+{
+       font-weight: normal;
+}
+
+body
+{
+       background-color: white;
+       background-image: url(stripes.png);
+       color: black;
+}
+
+div.msie_hack
+{
+       text-align: center;
+}
+
+em
+{
+       font-style: normal;
+       font-weight: bold;
+}
+
+h1, h2
+{
+       text-align: center;
+}
+
+img#smalllogo
+{
+       border: none;
+       float: right;
+       margin: 1px;
+}
+
+p
+{
+       text-align: center;
+}
+
+span.small
+{
+       font-size: smaller;
+}
+
+table
+{
+       margin-left: auto;
+       margin-right: auto;
+}
+
+table.big_ranking img
+{
+       border-left: none;
+       border-right: none;
+       height: 10px;
+}
+
+table.big_ranking td.image img,
+table.userdetails td.image img
+{
+       width: auto;
+       height: auto;
+       width: 50px;
+       height: 50px;
+       display: block;
+       border: 1px solid gray;
+}
+
+table.conversations
+{
+       border-collapse: collapse;
+}
+
+table.conversations td
+{
+       width: 50%;
+}
+
+table.conversations td.bar img
+{
+       display: inline;
+       height: 4px;
+}
+
+table.conversations td.left
+{
+       text-align: right;
+}
+
+table.conversations td
+{
+       border-top: 2px solid white;
+}
+
+table.conversations td.right
+{
+       text-align: left;
+}
+
+table.copy
+{
+       width: 100%;
+       border-top: 1px solid black;
+}
+
+table.copy span.spam
+{
+       display: none;
+}
+
+table.copy td
+{
+       background-color: transparent;
+       color: gray;
+       font-size: small;
+       width: 50%;
+}
+
+table.copy td.right
+{
+       text-align: right;
+}
+
+table.hours tr.bars
+{
+       height: 150px;
+}
+
+table.hours tr.bars td.bar
+{
+       color: black;
+       background-color: transparent;
+
+       width: 4.1666%;
+}
+
+table.hours tr.bars td.bar img
+{
+       width: 15px;
+}
+
+table.legend
+{
+       width: 500px;
+}
+
+table.legend img
+{
+       display: inline;
+       width: 50px;
+       height: 15px;
+       border: 1px solid gray;
+}
+
+table.legend td
+{
+       background-color: transparent;
+       color: black;
+       text-align: center;
+       width: 125px;
+}
+
+table.plugin
+{
+       width: 500px;
+       margin-top: 20px;
+       margin-bottom: 10px;
+}
+
+table.plugin.userdetails
+{
+       width: auto;
+       border-collapse: collapse;
+}
+
+table.userdetails td.convpartners,
+table.userdetails td.counters,
+table.userdetails td.numbers
+{
+       vertical-align: top;
+}
+
+table.userdetails td.convpartners table
+{
+       margin-right: auto;
+       margin-left: 0px;
+}
+
+table.userdetails td.convpartners td.bar img
+{
+       height: 4px;
+}
+
+table.userdetails table.hours tr.bars
+{
+       height: 75px;
+}
+
+table.userdetails table.hours tr.bars td.bar img
+{
+       width: 3px;
+}
+
+table.userdetails td.image
+{
+       vertical-align: top;
+       padding: 1ex;
+}
+
+table.userdetails th.nick
+{
+       border-top: 2px solid white;
+       border-bottom: 2px solid white;
+}
+
+table.weekdays td
+{
+       /* 14.2857 = 100/7 */
+       width: 14.28%;
+}
+
+table.weekdays tr.bars
+{
+       height: 100px;
+}
+
+table.weekdays tr.bars td
+{
+       color: black;
+       background-color: transparent;
+
+       /* 3.5714 = 100/28 */
+       width: 3.57%;
+}
+
+table.weekdays tr.bars td img
+{
+       width: 10px;
+}
+
+td
+{
+       background-color: #f8f8f8;
+       color: black;
+       text-align: left;
+}
+
+td.bar
+{
+       font-size: smaller;
+}
+
+td.bar img
+{
+       border-top: 1px solid gray;
+       border-bottom: 1px solid gray;
+}
+
+td.bar img.first
+{
+       border-left: 1px solid gray;
+}
+
+td.bar img.last
+{
+       border-right: 1px solid gray;
+}
+
+td.bar.vertical
+{
+       vertical-align: bottom;
+       padding: 0px;
+       border: none;
+}
+
+td.bar.vertical img
+{
+       display: block;
+
+       margin-top: 0px;
+       margin-right: auto;
+       margin-bottom: 0px;
+       margin-left: auto;
+
+       border-top: none;
+       border-right: 1px solid gray;
+       border-bottom: none;
+       border-left: 1px solid gray;
+}
+
+td.bar.vertical img.first
+{
+       border-top: 1px solid gray;
+}
+
+td.bar.vertical img.last
+{
+       border-bottom: 1px solid gray;
+}
+
+td.counter
+{
+       font-size: 60%;
+       text-align: center;
+
+       color: gray;
+       background-color: transparent;
+
+       border: 1px solid silver;
+}
+
+td.numeration
+{
+       font-weight: bold;
+       font-size: 80%;
+       text-align: center;
+
+       color: black;
+       background-color: silver;
+}
+
+td.invis
+{
+       background-color: transparent;
+       color: black;
+}
+
+th
+{
+       background-color: silver;
+       color: black;
+       text-align: center;
+       font-weight: bold;
+       font-style: italic;
+}
+
+tr.hour_row td
+{
+       border: 1px solid gray;
+}