Couple issues and one question :)

A place for users and developers of the Xataface to discuss and receive support.

Couple issues and one question :)

Postby fauners » Fri Oct 31, 2008 7:03 am

Hi all,

First off let me just say that I love Xataface so much. It has saved me so much time and effort. And it's also gotten me back into coding after years away from it.

I have a couple little things I have noticed with the version I am using, I searched the forums but couldn't find these being talked about (sorry if they have!!)

First of all I am using xataface 1.0 beta 3.

The first little thing I noticed that I would like to fix just for cosmetic reasons is that the list view of a related table in my main table only has the Field names in lower case. and I dont know why.

I have two tables in the relationship, Employees and Events. when I am in the events area of the site looking at all the employees that are associated with a certain event in a list view then all the field names, such as EmployeeNumber, FirstName etc are all in lower case.
I have changed several of the labels using widgets in the employees/fields.ini file and they appear fine in the employees area of the site but remain lower case in the events section. Any ideas?

Also in relation to this I would like to have just a couple of the fields appear in the list view of employees within the related view from the events section of the site, if that is possible. I only want name and phone number for example and not address or other details. but I want these to be visible on the employees section. I hope that is clear. But is it possible to do easily?

Also I have noticed that in the find tab there is a very big gap between the first field and the second. The first, employee id is at the top of the screen but the second, FirstNname, is all the way down level with the bottom of the search instructions on the right hand side. I dont know how this could be my fault as I am in the very early stages of using xataface and havent tried changing the look of it at all. But it probably is something I did.

Any help would be really appreciated,

Thanks

Adam
fauners
 
Posts: 10
Joined: Fri Oct 31, 2008 6:37 am

Postby shannah » Fri Oct 31, 2008 7:13 am

The first little thing I noticed that I would like to fix just for cosmetic reasons is that the list view of a related table in my main table only has the Field names in lower case. and I dont know why.


This is in the plone.css stylesheet. Do a find for text-transform. The headers of tables are set to be transformed to lower case. Just remove that directive.

Or override it in your own stylesheet.

I only want name and phone number for example and not address or other details. but I want these to be visible on the employees section. I hope that is clear. But is it possible to do easily?


You could add the following to your application delegate class:
Code: Select all
function beforeHandleRequest(){
    $app =& Dataface_Application::getInstance();
    $query =& $app->getQuery();
    if ( $query['-table'] == 'events' and @$query['-relationship'] == 'employees' ){
        $t =& Dataface_Table::loadTable('employees');
        $hideFields = array('address','detail1','detail2', etc...);
        foreach ($hideFields as $f){
            $fdef =& $t->getField($f);
            $fdef['visibility']['list'] = 'hidden';
            unset($fdef);
        }
    }
}


You'll have to modify this a bit to fit your table, relationship and column names.

Also I have noticed that in the find tab there is a very big gap between the first field and the second.

Yes I have noticed this from time to time also. This is a CSS blunder that should be fixed. I haven't been annoyed enough to look into it closely. If you are able to fix it, let me know what you did.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Thanks

Postby fauners » Fri Oct 31, 2008 8:42 am

Wow, thanks for the quick reply Steve,

I'll try these out and let you know how they work out for me. And if I can fix that style sheet thing I'll let you know.

Thanks again,

Adam
fauners
 
Posts: 10
Joined: Fri Oct 31, 2008 6:37 am

Postby fauners » Mon Nov 03, 2008 9:19 am

Hi Steve,

Tried the code you had there, but cant seem to get it working, This is what my application delegate file looks like

Code: Select all
<?
/**
* A delegate class for the entire application to handle custom handling of
* some functions such as permissions and preferences.
*/
class conf_ApplicationDelegate {
    /**
     * Returns permissions array.  This method is called every time an action is
     * performed to make sure that the user has permission to perform the action.
     * @param record A Dataface_Record object (may be null) against which we check
     *               permissions.
     * @see Dataface_PermissionsTool
     * @see Dataface_AuthenticationTool
     */
     function getPermissions(&$record){
         $auth =& Dataface_AuthenticationTool::getInstance();
         $user =& $auth->getLoggedInUser();
         if ( !isset($user) ) return Dataface_PermissionsTool::NO_ACCESS();
             // if the user is null then nobody is logged in... no access.
             // This will force a login prompt.
         $role = $user->val('Role');
         return Dataface_PermissionsTool::getRolePermissions($role);
             // Returns all of the permissions for the user's current role.
      }
}





function beforeHandleRequest(){
    $app =& Dataface_Application::getInstance();
    $query =& $app->getQuery();
    if ( $query['-table'] == 'events' and @$query['-relationship'] == 'Employees' ){
        $t =& Dataface_Table::loadTable('employees');
        $hideFields = array('Section','Photo','DateOfBirth', 'Nationality', 'Languages', 'PhoneNumber', 'Address', 'Email', 'NextOfKin', 'LicencesType', 'LicenceDetails');
        foreach ($hideFields as $f){
            $fdef =& $t->getField($f);
            $fdef['visibility']['list'] = 'hidden';
            unset($fdef);
        }
    }
}




?>


Sorry I'm crap at this, really trying to get into it, also i'm very hungover today. might have something to do with it.

any help would be Brilliant!!!

Adam
fauners
 
Posts: 10
Joined: Fri Oct 31, 2008 6:37 am

Postby shannah » Mon Nov 03, 2008 9:39 am

the beforeHandleRequest() method should be inside the application delegate class. Not just another function in the same file.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 20 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved