Based on advice re simplify, one must hide unused fields in CSS.
I've noticed however that the headings all have the same class assigned.
It needs to be assigned a (additional) unique css class per field heading - could be same as for field.

PS: When do you expect to add the ability to configure which fields are visible?

Thanks for the great work!

Comments

_randy’s picture

Good point -- right now the only way to do so would be to add the css to each column explicitly in the template files.

Configurable fields is something I would like to put into a future release. I would like to roll in some updates to Timesaver and make it a 1.0 release and then have configurable fields as a 1.1 release.

SiteMaster.ServeLime.com’s picture

StatusFileSize
new2.12 KB

How about simply adding them into the templates for now.

I've attached my attempt to do so.

PS: Please add a 1-liner explanation of the purpose of each field to the readme.txt + on the project page.

SiteMaster.ServeLime.com’s picture

Priority: Normal » Major

For the Weekly & Grand totals, I'm stumped on figuring out where to assign classes to the fields.

Please post how-to on where to apply classes for Totals & Grand, to style/hide specific columns.
Assuming the Dev snapshot is stable, can you please update the Dev snapshot with the classes.

Thanks

_randy’s picture

Not sure I can get to this before DrupalCon Chicago. It's on my to-do list.

SiteMaster.ServeLime.com’s picture

For the totals, i was thinking something...
Add a heading as a class name (replacing space -> underscore).
That should do the trick for the iterative totals.

Can you throw that into the build at least?

Thanx

SiteMaster.ServeLime.com’s picture

I've managed to update the footer function in timesaver.module in timesaver-6.x-1.0-rc3.
The classes added are simple field-counters: (should be the field-names though)
- Sub-Totals: ts-subN (N:1-14)
- Grand-Totals: ts-grandN (N:1-14)

Function modified as highlighted in bold:

function template_preprocess_timesaver_timesheet_entry_footer(&$variables) {
  global $base_url;

  $variables['weekly_totals']=t('Weekly Totals:');
  $variables['grand_totals']=t('Grand Totals');
  $variables['site_url']=$base_url;
  if ($variables['disabled']==TRUE) {
    $variables['disabled_style']='none';
  }
  else {
    $variables['disabled_style']='';
  }

  if ($variables['isLocked']==TRUE && ((user_access('Timesaver finance')) || (user_access('Timesaver supervisor')))) {
    $variables['disabled_style']='';
  }
  else {
    if ($variables['isLocked']) {
      $variables['disabled_style']='none';
    }
  }
  // output weekly totals
  $variables['hide_weekly_totals']='display:none';
  $weeklynumbers = '<td colspan=16></td>';
  if ($variables['weeklytotals']) {
    $variables['hide_weekly_totals']='';
    $weeklynumbers = '';

Added $fieldno here

	$fieldno = 0;
    foreach ($variables['weeklytotals'] as $field => $sum) {
      if ($field != 'placeholder') {
	    $fieldno = $fieldno +1;
        $weeklynumbers .= '<td class="ts-sub' . sprintf("%d", $fieldno) . '" style="font-weight:bold">' . sprintf("%01.2f", $sum) . '</td>';
      }
      else {
        $weeklynumbers .= '<td style="font-weight:bold"></td>';
      }
    }
  }
  $variables['weekly_numbers']=$weeklynumbers;
  // output grand totals
  $variables['hide_grand_totals']='display:none';
  $grandnumbers = '<td colspan=16></td>';
  if ($variables['grandtotals']) {
    $variables['hide_grand_totals']='';
    $grandnumbers = '';

Added $fieldno here

	$fieldno = 0;
    foreach ($variables['grandtotals'] as $field => $sum) {
      if ($field != 'placeholder') {
	    $fieldno = $fieldno +1;
        $grandnumbers .= '<td class="ts-grand' . sprintf("%d", $fieldno) . '" style="font-weight:bold">' . sprintf("%01.2f", $sum) . '</td>';
      }
      else {
        $grandnumbers .= '<td style="font-weight:bold"></td>';
      }
    }
  }
  $variables['grand_numbers']=$grandnumbers;
}
MM10’s picture

I need a bit more than footer changes. I guess I'll hold out for configurable fields, haven't figured out the best way to assign classes for the rest of the table.
Hope you enjoyed DrupalCon!

_randy’s picture

@SiteMaster.ServeLime.com -- good start on that. I'll review the code and see if there's anything else i can think of to tweak in it.

@MM10 -- the tpl.php files store the output templates for the timesheet. adding your css classes to those files should help you hide/unhide columns.

SiteMaster.ServeLime.com’s picture

I posted my attempt at adding classes to the tpl files as a zip file in my earlier comment of February 28, 2011 at 9:00pm.

MM10’s picture

Of course- thanks SiteMaster.Serv!