A place for users and developers of the Xataface to discuss and receive support.
by shannah » Tue Nov 13, 2007 5:24 am
This is bizarre. You shouldn't have to try different installs... it should just work. (i.e. I have it running and tested on Linux, OS X, Windows XP/Apache, Windows XP/XAMPP, and Solaris).
Any chance you can give me access to the source so that I can do some debugging?
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by inmisia » Tue Nov 13, 2007 6:01 am
Of course! I can send source with export of database to your email
steve_hannah@sfu.ca if you wont.
-
inmisia
-
- Posts: 16
- Joined: Tue Nov 06, 2007 2:01 am
by inmisia » Tue Nov 13, 2007 7:14 am
file:analisi.php
val('IDtipoAnalisi');
$app =& Dataface_Application::getInstance();
$res = mysql_query($sql, $app->db()) or
die ("Errore in tables_analisi on query:".$sql." code". mysql_error());
$riga = mysql_fetch_array($res, MYSQL_NUM);
eval("\$ret=$riga[0];");
mysql_free_result($res);
*/
if ($value > 40 or $value <100>val('IDtipoAnalisi');
$app =& Dataface_Application::getInstance();
$res = mysql_query($sql, $app->db()) or
die ("Errore in tables_analisi on query:".$sql." code". mysql_error());
$riga = mysql_fetch_array($res, MYSQL_NUM);
$value=$record->value("Valore");
eval("\$ret=$riga[0];");
if($ret)
{
return "".$record->value("Valore")."";
}
else
{
return $record->value("Valore")."#";
}
}
}
?>
CREATE TABLE `analisi` (
`IDAnalisi` bigint(20) NOT NULL auto_increment,
`IDAnagrafica` bigint(20) default NULL,
`IDtipoAnalisi` bigint(20) default NULL,
`Valore` decimal(10,0) default NULL,
`Data` date default NULL,
PRIMARY KEY (`IDAnalisi`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
SET SQL_MODE=@OLD_SQL_MODE;
-
inmisia
-
- Posts: 16
- Joined: Tue Nov 06, 2007 2:01 am
by shannah » Tue Nov 13, 2007 1:02 pm
[quote="inmisia"]Of course! I can send source with export of database to your email steve_hannah@sfu.ca if you wont.
Yes. Please do.
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by shannah » Thu Nov 15, 2007 9:51 am
Thanks for sending your code. I have nailed down the issue. You need to change the validate() method in lib/HTML/QuickForm.php
The method starts out like:
- Code: Select all
if (count($this->_rules) == 0 && count($this->_formRules) == 0 && $this->isSubmitted()) { return true; } elseif (!$this->isSubmitted()) { return false; }
....
Change it to: - Code: Select all
if (count($this->_rules) == 0 && count($this->_formRules) == 0 && $this->isSubmitted()) { return (count($this->_errors) == 0); } elseif (!$this->isSubmitted()) { return false; } ....
Best regards
Steve
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by inmisia » Fri Nov 16, 2007 12:27 am
HI! Thanks It wotks!!
Great Job!
-
inmisia
-
- Posts: 16
- Joined: Tue Nov 06, 2007 2:01 am
by fantomasdm » Tue Jul 01, 2008 6:27 am
Hi! I have a fucntion
- Code: Select all
function Codice__validate( &$record, $value, &$params) { if ( substr ($value,0,2) !='BM' ) { $params['message'] = $this->local('biomolecolareCodeError'); Dataface_Error::permissionDenied($this->local('biomolecolareCodeError')); return false; } else { return true; } }
for validate field Codice, but if I add in config.ini language section my error message is no more visible, instread i get classic "permission denied"
without language session I get right message.
Thank for help, sorry for my English..
-
fantomasdm
-
- Posts: 114
- Joined: Thu Mar 13, 2008 2:35 pm
by shannah » Wed Jul 02, 2008 9:40 am
What does your local() method look like?
-
shannah
-
- Posts: 4457
- Joined: Wed Dec 31, 1969 5:00 pm
by fantomasdm » Thu Jul 03, 2008 12:24 am
base class is:
- Code: Select all
class local_class {
var $lg; private $ar; function local_class() { $app =& Dataface_Application::getInstance(); if ( $app->_conf['lang'] =="it" || $app->_conf['lang'] =="en" ) $this->lg = $app->_conf['lang']; else $this->lg = "it"; $this->loadArray(); } private function loadArray() { $this->ar= array(); $this->ar['it']= array(); $this->ar['en']= array(); $this->ar['it']['cryptModeOn']="Il sistema sta girando in modo Criptato"; $this->ar['it']['cryptModeOff']="Il sistema sta girando in modo tutto visibile"; $this->ar['it']['getPwdCrypt']="Inserire la Password di Criptazione:"; $this->ar['it']['pwdCryptErr']="Occore prima inserire la chiave di criptazione"; $this->ar['it']['reportAlreadyClose']="Il referto è giàstato chiuso!!"; $this->ar['it']['reportClose']="Il referto è stato chiuso, non saràpiù possibile modificarlo salvo autorizzazione!!"; $this->ar['it']['autopsiaCodeError']="Il codice delle autopsie deve iniziare per A!"; $this->ar['it']['istochimicaCodeError']="Il codice delle autopsie deve iniziare per IC"; $this->ar['it']['biomolecolareCodeError']="Il codice delle autopsie deve iniziare per BM"; $this->ar['it']['citologiaCodeError']="Il codice delle autopsie deve iniziare per C"; $this->ar['it']['imistochimicaCodeError']="Il codice delle autopsie deve iniziare per IM"; $this->ar['it']['istologiaCodeError']="Il codice delle autopsie deve iniziare per I";
$this->ar['en']['cryptModeOn']="The system is running in crypt mode on"; $this->ar['en']['cryptModeOff']="The system is running in crypt mode off"; $this->ar['en']['getPwdCrypt']="Insert key for encrypt data:"; $this->ar['en']['pwdCryptErr']="Need to insert key for encrypt data"; $this->ar['en']['reportAlreadyClose']="Report has been already closed!!"; $this->ar['en']['reportClose']="The report was closed, you can not change it unless authorized"; $this->ar['en']['autopsiaCodeError']="The code of autopsies must begin for A"; $this->ar['en']['istochimicaCodeError']="The code of autopsies must begin for IC"; $this->ar['en']['biomolecolareCodeError']="The code of autopsies must begin for BM"; $this->ar['en']['citologiaCodeError']="The code of autopsies must begin for C"; $this->ar['en']['imistochimicaCodeError']="The code of autopsies must begin for IM"; $this->ar['en']['istologiaCodeError']="The code of autopsies must begin for I"; } function local($str) { if ($this->ar[$this->lg][$str]=="") return "Localization not found!!"; else return $this->ar[$this->lg][$str]; } }
first derivate: - Code: Select all
include_once("local.php"); class table_class extends local_class {
var $td; var $iv; function table_class(){ $this->td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', MCRYPT_MODE_ECB, ''); $this->iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($this->td), MCRYPT_RAND); parent::__construct(); }
function __destruct() { mcrypt_module_close($this->td); }
function gdecrypt($input) { if( isset($_SESSION["PWDCRYPT"]) and $input!="" ) { $key=$_SESSION["PWDCRYPT"]; mcrypt_generic_init($this->td, $key, $this->iv);
$encrypted_data = mdecrypt_generic ($this->td, $input); mcrypt_generic_deinit($this->td); return rtrim( $encrypted_data, ( ( ord(substr( $encrypted_data, strlen( $encrypted_data )-1, 1 )) >= 0 and ord(substr( $encrypted_data, strlen( $encrypted_data )-1, 1 ) ) <= 16 ) ? chr(ord(substr( $encrypted_data, strlen( $encrypted_data )-1, 1 ))): null) ); } else { return $input; } }
function gcrypt($input) { if( !isset($_SESSION["PWDCRYPT"]) ) { $form_html = "<b>".$this->local('pwdCryptErr')."</b>"; df_display(array('form'=>$form_html), 'chiudi.html'); exit; } if ( $input!="" ) { $key=$_SESSION["PWDCRYPT"]; mcrypt_generic_init($this->td, $key, $this->iv); $val=str_pad($input, (16*(floor(strlen($input) / 16)+(strlen($input) % 16==0?2:1))), chr(16-(strlen($input) % 16))); $encrypted_data = mcrypt_generic($this->td, $val); mcrypt_generic_deinit($this->td); return $encrypted_data; } else return $input; }
}
second derivate: include_once "TableClass.php"; - Code: Select all
class baseBrowser extends table_class { function baseBrowser(){ parent::__construct(); } function getTitle(&$record) { $sql = "select nome,cognome from anagrafica where idanagrafica=".$record->val('idanagrafica')." limit 1"; $res = mysql_query($sql, df_db()); $linea = mysql_fetch_array($res, MYSQL_NUM); /* Liberazione delle risorse del risultato */ mysql_free_result($res);
return $this->gdecrypt($linea[0]).' '.$this->gdecrypt($linea[1]).":".$record->val('codice'); }
function getPermissions(&$record) { $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); $app =& Dataface_Application::getInstance(); $query =& $app->getQuery(); if ( $query['-action'] == 'new'/* and (!$record || !$record->val('registrantid'))*/ ) { return Dataface_PermissionsTool::ALL(); }
if ( !is_null ($record) && $record->val('chiuso') ) return Dataface_PermissionsTool::READ_ONLY(); else return Dataface_PermissionsTool::getRolePermissions($user->val('role')); } }
last derivate that message for validate not works: - Code: Select all
include_once "baseBrowser.php";
class tables_istologia extends baseBrowser { function tables_istologia() { parent::__construct(); }
function Codice__validate( &$record, $value, &$params) { if ( $value{0} !='I' ) { $params['message'] = $this->local('istologiaCodeError'); Dataface_Error::permissionDenied($this->local('istologiaCodeError')); echo "find:".$params['message']; return false; } else { return true; } }
}
last derivate that message for validate works: - Code: Select all
include_once "baseBrowser.php";
class tables_biomolecolare extends baseBrowser { function tables_biomolecolare() { parent::__construct(); }
function Codice__validate( &$record, $value, &$params) { if ( substr ($value,0,2) !='BM' ) { $params['message'] = $this->local('biomolecolareCodeError'); Dataface_Error::permissionDenied($this->local('biomolecolareCodeError')); return false; } else { return true; } }
}
another example that validate message don't work! - Code: Select all
include_once "baseBrowser.php";
class tables_imistochimica extends baseBrowser {
function tables_imistochimica() { parent::__construct(); }
function Codice__validate( &$record, $value, &$params) { if ( substr ($value,0,2) !='IM' ) { $params['message'] = $this->local('imistochimicaCodeError'); Dataface_Error::permissionDenied($this->local('imistochimicaCodeError')); return false; } else { return true; } }
}
-
fantomasdm
-
- Posts: 114
- Joined: Thu Mar 13, 2008 2:35 pm
by fantomasdm » Thu Jul 03, 2008 12:35 am
Find problem!!
When add new relative record return bad error message, classic "permission Denied" but when Edit record return true error message!!
-
fantomasdm
-
- Posts: 114
- Joined: Thu Mar 13, 2008 2:35 pm
by fantomasdm » Sun Jul 06, 2008 11:52 pm
When add new record, with version dataface-0.7.1 and xataface-1.0-beta-3 I get "Permission Denied" error message with xataface-1.0-beta-2 I get nothing. validete function works but, I can't see my error message when add, but it's works good when edit!!
-
fantomasdm
-
- Posts: 114
- Joined: Thu Mar 13, 2008 2:35 pm
by fantomasdm » Mon Jul 07, 2008 11:50 pm
Thanks!! Now It works!!!
-
fantomasdm
-
- Posts: 114
- Joined: Thu Mar 13, 2008 2:35 pm
Return to Xataface Users
Who is online
Users browsing this forum: No registered users and 31 guests
|