Sunday, October 14, 2007

Sticky columns or rows in OpenOffice Calc

A very handy feature of OpenOffice Calc that I often use, but never seem to remember is freezing columns or rows. Meaning, when you have a large worksheet and you scroll down or you scroll to the right, some specified columns or rows stay fixed. This is very handy for columns/rows containing headings.

Since I always forget how to do this in OpenOffice Calc, I thought I would write it down here.

Suppose you have an OpenOffice Calc document to keep a list of things to do. It has columns for the task you need to do, the status of this task, the date you last changed the status and any additional remarks.


Select the columns or rows you want to keep on every screen even when scrolling and then select one more.

Now, click Window - Freeze.


That is all. When you scroll down, the top rows will stay visible.


Somehow, I always start looking at print ranges and repeating rows or columns, which does exactly the same, but when printing only.

And, funny, remember to select one row/column more then the rows/columns you want to freeze.

Tip:
If you want both columns and rows to freeze, click on the top left cell you don't want to freeze and click freeze. That way, two lines will show up, one on the left of the cell and one just above the cell and all columns and rows to the left/top of these lines will freeze whenever you scroll.

Read more >>

Wednesday, October 3, 2007

DOS Command for searching text in files on windows

When you want to know which files in a specific directory contain a certain text, it is sometimes easier to search with a DOS command, rather then using the Windows Search functionality. The Windows Search functionality can have trouble finding files with certain extensions, such as .php.

To search quickly from the command prompt for files containing a certain text, I often use the DOS command findstr. It is easy to use and fast.

Let's say you want to find all php files in the directory C:\htdocs\joomla that contain the text "mail". With findstr you can do that as follows:

  • Open a DOS prompt.
  • Use cd to go to the directory C:\htdocs\joomla.
  • Type the following command:
findstr /MSC:"mail" *.php

This will give the names of all php files in C:\htdocs\joomla that contain the text "mail". If you also want to see which lines exactly contain the text, leave out the 'M'. The 'S' makes sure that you also search all subdirectories.

Tip:
Type findstr /? to see a list of all possible options you can use with the findstr command.

Read more >>

Friday, August 17, 2007

Setting group permissions in JCalPro

For a client of mine, I tried to change the permissions of JCalPro, the calendar extension for Joomla!. It turned out to be easy, but not after quite a long search. This is how I managed to do it in the end.

This client uses Joomla! with the JACLPlus extension to manage several usergroups. What they wanted was pretty straightforward: a calendar that everyone can see, but only users of one particular usergroup can add events to.

JCalPro was the calendar of choice. Now, this calendar has settings for exactly what we wanted: which usergroup can add, edit, delete or approve events. But... this works for the default Joomla! groups only, not for the JACLPlus groups my client uses.

So, after some wading through the code I discovered that JCalPro calls the function $acl->check_acl() to see what permissions a certain user has. It calls this function with the following parameters (see components\com_jcalpro\include\functions.inc.php):

$acl->acl_check( 'content', $action, 'users', $my->usertype, 'calendar', 'all' )

I debugged and found that in my particular case, the value of $my->usertype was 'Members'.

I never really looked into the acl system before and since I couldn't add the desired record in the jos_jaclplus table via the JACLPlus User Group Manager, I added the following record to the database manually (feeling quite awkward adding something to the database this way, but still, I just tried it on my test system anyway... ):

INSERT INTO `jos_jaclplus` ( `id` , `aco_section` , `aco_value` , `aro_section` , `aro_value` , `axo_section` , `axo_value` , `enable` )
VALUES (NULL , 'content', 'add', 'users', 'members', 'calendar', 'all', '0');

What happened? Nothing! That is, everything stayed the same, as if I hadn't added the record.

My first thought was that it had to do with the uppercase M of the usertype 'Members'. But, changing the record had no effect.

After some more code-wading, I stumbled over a very usefull file:
components\com_jcalpro\config.inc.php

This happened to include calls to add records to the jaclplus or acl tables in a sort of temporary way.

I added some calls to this file for my members group:

setRights ( 'add', 'calendar', 'members' );
setRights ( 'edit', 'calendar', 'members' );
setRights ( 'approve', 'calendar', 'members' );

and... tadaa... there it was: all users of my members group could add, edit and approve calendar events.

Since this was an easy, but very hidden kind of solution, I wrote it down here. For others to be usefull for, or for others to comment on. Feel free to leave your comment if you have a much better or simpler way to do this!

Read more >>