Sunday, November 25, 2012

xataface calculate age

function beforeSave(&$record){
    $age=intval(substr(date('Ymd') - date('Ymd', strtotime($record->strval('Birthday'))), 0, -4));
    $record->setValue('Age',$age);
 }

Love the simplicity

Ckeditor single space

By default, ckeditor does a {p} instead of a /br when you press enter.

Just press shift+enter to make a /br

xataface ckeditor worked when g2 invoked last

[_modules]
modules_ckeditor=modules/ckeditor/ckeditor.php
modules_depselect=modules/depselect/depselect.php
modules_htmlreports=modules/htmlreports/htmlreports.php
modules_g2=modules/g2/g2.php



can't explain it but it works

xataface htmlreports permissions

Just remember to expand Manager permissions for everything to run smoothly


[MANAGER extends MANAGER]
manage reports=1
view private report=1
view schema =1
validate report template =1
preview report =1



Failure to do this will not allow even someone with ALL permission to view the manage reports option in the control panel..

Again may be due to one of the things I entered in the application delegate

Thursday, November 15, 2012

xataface, hide role in registration, prevent editing of role

WORKS!!!!

<?
function isAdmin(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and $user->val('Role') == 'ADMIN')  return true;
    return false;
  
}

function isEdit(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and $user->val('Role') == 'EDIT')  return true;
    return false;
  
}

function isNoAccess(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and $user->val('Role') == 'NO_ACCESS')  return true;
    return false;
  
}
class tables_users {


   
function getpermissions($record) {
if ( isAdmin() or isEdit() ) return null;
$perms['register'] = 1;
$perms['view'] = 1;
return $perms;
}


  function role__permissions(&$record){
    if (!isAdmin() ) /** return array('edit'=>0); */
return Dataface_PermissionsTool::NO_ACCESS(); 
    
   
  
  }

}
?>

Wednesday, November 14, 2012

xataface fix for users being able to edit their roles

 in users.php

<?
function isAdmin(){
    $auth =& Dataface_AuthenticationTool::getInstance();
    $user =& $auth->getLoggedInUser();
    if ( $user and $user->val('Role') == 'ADMIN')  return true;
    return false;
}
class tables_users {




    function role__permissions(&$record){
        if (!isAdmin() ) return array('edit'=>0);
       return null;
    }
}
?>

using special characters like ñ in linux mint

just go to preferences --> keyboard layouts --> options

then choose a compose key

I used the right ctrl key