Page 1 of 1

re-enable quick search?

Posted: 2020-01-28 19:11
by D Oliveira
hello all, i have changed my tablename_view.php from:

Code: Select all

$x->ScriptFileName = "recipes_view.php";
to this:

Code: Select all

$mi = getMemberInfo();
if( $mi['groupID'] == '2' ){
	$x->ScriptFileName = "recipes_view.php";
}else{
	$x->ScriptFileName = "receitas_pdf.php";
}

the goal was to take the admin to detail view and user straight to the generated fpdf, all worked great with one exception... 'quick search' works fine for admin but doesnt work for user, does anyone know a way to re-enable quick search for the user? thank you

Re: re-enable quick search?

Posted: 2020-01-29 18:24
by a.gneady
Hmm ... my guess is that the quick search form, for non-admin users, is now being submitted to 'receitas_pdf.php', which seems not to handle quick search the same way the _view file handles it.

Re: re-enable quick search?

Posted: 2020-01-29 19:49
by D Oliveira
a.gneady wrote:
2020-01-29 18:24
Hmm ... my guess is that the quick search form, for non-admin users, is now being submitted to 'receitas_pdf.php', which seems not to handle quick search the same way the _view file handles it.
exactly, I could switch back and put a window.location.replace in the table_dv function in the tablename.php file for the user to be redirected to the pdf but that delay is an awful user experience, any ideas how it could be worked around? already tried settimeout function in js and the delay seems to always be there

Re: re-enable quick search?

Posted: 2020-01-29 20:13
by D Oliveira
solution: reset tablename_view.php, go to templates/tablename_templateTV.html

change this:

Code: Select all

<dt class="recipes-kcal-caption field-caption-tv">Calorias</dt>
<dd id="recipes-kcal-<%%VALUE(id)%%>" class="recipes-kcal h6 text-bold"><%%SELECT%%><%%VALUE(kcal)%%><%%ENDSELECT%%></dd>
to this:

Code: Select all

<dt class="recipes-kcal-caption field-caption-tv">Calorias1</dt>
<dd onclick="window.open('receitas_pdf.php?SelectedID=<%%VALUE(id)%%>');" class="recipes-kcal h6 text-bold"><%%VALUE(kcal)%%></dd>

make the file read-only, inside the pdf page create a button if groupID == '2' to allow admin to open the detail view page and edit stuff. hope it helps someone :)