DV or TV: Where am I?

If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
Post Reply
User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

DV or TV: Where am I?

Post by onoehring » 2021-02-24 15:38

Hi,

is there a variable for which I can check (or similar) which tells me reliably if I am looking at the details of a record (TV+DV or DV) or if I am only seeing tableview (TV)? I thought I had this figured out, but .. well, I don't :-(

So far I tried this

Code: Select all

$checkSelectedID = isset($_POST['SelectedID']) ? makeSafe($_POST['SelectedID']) : 0;	// check POST first!
$checkSelectedID = isset($_GET['SelectedID']) ? makeSafe($_GET['SelectedID']) : $checkSelectedID;
But POST is filled, even when I am on DV and click on the heading which holds no ?SelectedID=... and returns to TV.
I also tried to remove POST (and GET) in after the two lines above to make sure, when I click on the title like I get nothing (no SelectedID in POST):

Code: Select all

unset($_GET['SelectedID']);
unset($_POST['SelectedID']);
without luck.

Olaf

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-24 17:38

Hi,

I am dumping GET and POST data to see if this gives me a hint. Unfortunately in POST a value sometimes exists "current_view" .. but this is the view BEFORE the page has loaded (obviously). Thus, this does not tell me, I am on TV or DV - and - imho it's actually not "current_view", but previous_view.
Is this a bug?

Olaf

pfrumkin
Veteran Member
Posts: 157
Joined: 2020-02-18 17:58
Location: Albuquerque, New Mexico USA

Re: DV or TV: Where am I?

Post by pfrumkin » 2021-02-25 17:26

Hi Olaf,

I think you may be on the right track looking at the SelectedID. In inc_common.php I found quick_search_html(), that suggests to check if document.myform.SelectedID.value has a value. But this may run into the same problem. In \admin\getThumbnailSpecs() there is a $view parameter that is passed in, looks like exactly what you are looking for, but I can't find where it is called (how it is set). Maybe you will be a better investigator than I am.

~Paul

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: DV or TV: Where am I?

Post by pbottcher » 2021-02-25 21:46

Hi Olaf,

maybe you can explain what you try to achieve. Where do you need that information. From where are you calling?
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-26 07:07

Hi,

thank you for your anserws.
@pbötcher: I have the code above placed in the /hooks/tablename.php -> init function.

Purpose: I want to change the table title and add a field from the record that is shown when the user sees DV only. I created a screencast (image below) to show what happens: Search for something, click on a result, title is adjusted. Click on the title again (to return to TV)... title still as in DV. When I use the menu to return to TV it works.
tableh4.gif
tableh4.gif (158.81 KiB) Viewed 2493 times
Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: DV or TV: Where am I?

Post by pbottcher » 2021-02-26 07:29

Hi Olaf,

so why cant you just use the tablename_header function ? Here you know were you are as the $contentType is set.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-26 12:23

Hi pbötcher,

the answer to this question is - because I did not know about this [edit] - probably totally overlooked $contenttype[/edit]. I will check it out.
Thank you very much.

Olaf

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-26 12:37

Hi pbötcher,

how embarrassing for me to ask such a silly question. And thank you again for taking the time to answer it.
Olaf

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-26 12:43

Hi,

well, still a problem: Even when I use the .._header function to save the $contentType into a session variable, this variable is only set AFTER the _init function has been processed. Thus, the

Code: Select all

$options->TableTitle = $_SESSION['mycontenttype'];
in the _init function does not work.
Olaf

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1638
Joined: 2018-04-01 10:12

Re: DV or TV: Where am I?

Post by pbottcher » 2021-02-26 21:51

Hi Olaf,

ok, so that would make it a little more complex, but why not use the _header function and set the text accordingly?

Change the header via

Code: Select all

$j('.page-header a').html($j('.page-header a').html()+' YOURTEXTHERE');
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-27 07:05

Hi pbötcher,

I did that already, but doing so, the extension that is added with the $j, is not shown in the browser tab. As exactly this is a great help (orientation) for the users if they have more than one browser tab open, and this extra help is why I would like to set it in a way, that shows up as browser tab title as well

(I am really not into $j, but maybe there is a oneliner which can do this?).

Olaf

User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1160
Joined: 2019-05-21 22:42
Location: Germany
Contact:

Re: DV or TV: Where am I?

Post by onoehring » 2021-02-27 08:15

Hi,

found it:

Code: Select all

document.title = 'test';
or

Code: Select all

$(document).prop('title', 'test');
Thank you for pointing the direction.

But: Is there a way to get in the /hooks/tabnlename _Init function reliably the view (TV/DV/TV+DV...)? For other tests this might be important. For example I have some calculations to do for the record in DV right before it is rendered.

Olaf

Post Reply