Avatar

@Micha: question about the link-target-feature (Development)

by Auge ⌂ @, Thursday, September 16, 2021, 08:43 (40 days ago)

Hello (especially Micha)

After a long period without any progress I had a mood of motivation to work on one of the half implemented features for MLF 2.5. It's the server part for the user setting for the browser window target of entry links (pull request #550).

There is one task left, generating the matching JS-variable in js_defaults.inc.php for the use in the code of pull request #546. At the moment I have absolutely no clue where I can find the code that builds the array in $_SESSION[[SESSION_ID]_usersettings] to inject the user setting for use in the code in js_defaults.inc.php.

Can you (@Micha) give me a hint, in which script I can find the code that defines $_SESSION[[SESSION_ID]_usersettings]?

Tschö, Auge

PS: I introduced a new category into this forum named "Development".

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

@Micha: question about the link-target-feature

by Micha ⌂, Thursday, September 16, 2021, 15:31 (40 days ago) @ Auge

Hello Auge,

After a long period without any progress I had a mood of motivation to work on one of the half implemented features for MLF 2.5. It's the server part for the user setting for the browser window target of entry links (pull request #550).

Perfect. ;-)

Can you (@Micha) give me a hint, in which script I can find the code that defines $_SESSION[[SESSION_ID]_usersettings]?

The array is defined during the login procedure, isn't it?

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

@Micha: question about the link-target-feature

by Auge ⌂ @, Thursday, September 16, 2021, 21:00 (40 days ago) @ Micha

Hello

Can you (@Micha) give me a hint, in which script I can find the code that defines $_SESSION[[SESSION_ID]_usersettings]?


The array is defined during the login procedure, isn't it?

Of course it is. Thank you for pointing me to the correct place.

I implemented the reading of the new setting from the user data and the creation of the JS-array user_settings in js_defaults.inc.php (see the two commits 28e57c1729 and 340f13cff6). During the comparision with your code in the pull request #546 and the discussion in the causative thread, especially in the branch, starting with this posting, I realised, that we planned a user settings with three possible values [1] and not with two, how I implemented it in its current state and that we planned to provide a general setting for a target name to make it possible to break out of a frame or iframe the forum is running in, when opening a link of an entry (which must override a possibly set user setting). The latter is a task for a new pull request.

The creation of the JS-array user_settings already incorporates the three states as you implemented them in pull request #546 ("NON", "EXTERNAL", "ALL"). Following the discussion in the thread, linked above, I have to implement the strings, HTML-code and storing code for the third status of the user setting and – in a new pull request – the general forum setting for a named target value to break out of a frame or iframe.

Tschö, Auge

[1]: in your implementation from #546: "NON": open all links of an entry in the same tab/window (default), "EXTERNAL": open external links of an entry in a new tab/window, "ALL": open all links of an entry in a new tab/window

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

@Micha: question about the link-target-feature

by Micha ⌂, Friday, September 17, 2021, 05:06 (39 days ago) @ Auge

Hello,

I have to implement...

Yes, it is a lot of work concerning such feature...

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

@Micha: the user setting code is done

by Auge ⌂ @, Monday, September 20, 2021, 19:59 (36 days ago) @ Micha

Hello

Yes, it is a lot of work concerning such feature...

The code for the user setting is merged. Please compare the JS code, generated by my PHP code with your code in #546 a last time.

Tschö, Auge

PS and edit: it was a nightmare to rebase the branch, I used for development, to the current master branch. I had to unify my code with competing code from other commits in a few cases, especially chinese.lang only in three cases.

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

the user setting code is done

by Micha ⌂, Tuesday, September 21, 2021, 08:07 (35 days ago) @ Auge

Hello,

Please compare the JS code, generated by my PHP code with your code in #546 a last time.

I noticed that the arrays have different names, i.e., settings vs. user_settings. I used this new name to avoid conflicts to the existent one but we can still use the settings array in the final version. What do you think? I didn't notice it during the review because it is basically valid and in accordance with my JS code. However, I recommend to change the name.

PS and edit: it was a nightmare to rebase the branch

Yes, it seems to so easy as it could be - in my opinion. We should close branches as soon as possible to avoid conflicts. ;-)

Thank you for doing this job!

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

Avatar

the user setting code is done

by Auge ⌂ @, Tuesday, September 21, 2021, 09:30 (35 days ago) @ Micha

Hello,

Please compare the JS code, generated by my PHP code with your code in #546 a last time.


I noticed that the arrays have different names, i.e., settings vs. user_settings. I used this new name to avoid conflicts to the existent one but we can still use the settings array in the final version. What do you think? I didn't notice it during the review because it is basically valid and in accordance with my JS code. However, I recommend to change the name.

From js_defaults.inc.php:

 
var user_settings = new Array();
<?php if (isset ($usersettings['browser_window_target']) and $usersettings['browser_window_target'] == 1): ?>
user_settings["open_links_in_new_window"] = "NONE";
<?php elseif (isset ($usersettings['browser_window_target']) and $usersettings['browser_window_target'] == 2): ?>
user_settings["open_links_in_new_window"] = "EXTERNAL";
<?php elseif (isset ($usersettings['browser_window_target']) and $usersettings['browser_window_target'] == 3): ?>
user_settings["open_links_in_new_window"] = "ALL";
<?php else: ?>
user_settings["open_links_in_new_window"] = "DEFAULT";
<?php endif; ?>
 

I used the name user_settings for the JS-array!? Or do we talk at cross purposes?

PS and edit: it was a nightmare to rebase the branch


Yes, it seems to so easy as it could be - in my opinion. We should close branches as soon as possible to avoid conflicts. ;-)

The branches one by one are valid. It was the combination of a changed and a new file (chinese_traditional.lang) in another pull request, which was meanwhile already part of the master branch and my own changes in the same file(s) in multiple commits in my development branch that had to get unified (in three passes).

--
Trenne niemals Müll, denn er hat nur eine Silbe!

Avatar

the user setting code is done

by Micha ⌂, Tuesday, September 21, 2021, 19:52 (35 days ago) @ Auge

Hello,

I used the name user_settings for the JS-array!?

It is okay. Ignore my suggestion. I merged by branch, too.

/Micha

--
applied-geodesy.org - OpenSource Least-Squares Adjustment Software for Geodetic Sciences

RSS Feed of thread

powered by my little forum