Page 1 of 1
DV or TV: Where am I?
Posted: 2021-02-24 15:38
by onoehring
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
Re: DV or TV: Where am I?
Posted: 2021-02-24 17:38
by onoehring
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
Re: DV or TV: Where am I?
Posted: 2021-02-25 17:26
by pfrumkin
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
Re: DV or TV: Where am I?
Posted: 2021-02-25 21:46
by pbottcher
Hi Olaf,
maybe you can explain what you try to achieve. Where do you need that information. From where are you calling?
Re: DV or TV: Where am I?
Posted: 2021-02-26 07:07
by onoehring
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 (158.81 KiB) Viewed 3847 times
Olaf
Re: DV or TV: Where am I?
Posted: 2021-02-26 07:29
by pbottcher
Hi Olaf,
so why cant you just use the tablename_header function ? Here you know were you are as the $contentType is set.
Re: DV or TV: Where am I?
Posted: 2021-02-26 12:23
by onoehring
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
Re: DV or TV: Where am I?
Posted: 2021-02-26 12:37
by onoehring
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
Re: DV or TV: Where am I?
Posted: 2021-02-26 12:43
by onoehring
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
Re: DV or TV: Where am I?
Posted: 2021-02-26 21:51
by pbottcher
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');
Re: DV or TV: Where am I?
Posted: 2021-02-27 07:05
by onoehring
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
Re: DV or TV: Where am I?
Posted: 2021-02-27 08:15
by onoehring
Hi,
found it:
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