[SOLVED] AppGiniCommon setImage fails on custom page

This sub-forum is for discussing all topics related to AppGini Helper JavaScript Library, provided by bizzworxx as a third-party AppGini plugin.
Post Reply
User avatar
onoehring
AppGini Super Hero
AppGini Super Hero
Posts: 1156
Joined: 2019-05-21 22:42
Location: Germany
Contact:

[SOLVED] AppGiniCommon setImage fails on custom page

Post by onoehring » 2019-12-13 11:23

Hi Jan,

I am not sure, if it's a AG Helper problem or some other (old?) jquery problem - or some problem with my code. In the latter case I would not know what I did wrong, as there is no concole error pointing to my code.

Please see the attached image 1: The application icon is changed, even on a custom page (like I would expect it to). 
Zwischenablage04c2b.png
Zwischenablage04c2b.png (64.94 KiB) Viewed 7041 times
Now, I created a new custom page where the AG Helper does not change the image automatically - but when I copy the following code to the console - the icon is changed. On this custom page I am using the library from momentjs.com that comes with AG ans which is included by default as it seems, to do some date calculations.

Code: Select all

var url="/someimage.png"
new AppGiniCommon()
.setTitle("<b>MyAppTitle</b>")
.setImage(url); 
Custom page with problem:
Zwischenablage04.png
Zwischenablage04.png (71.64 KiB) Viewed 7041 times

The AGHelper is referenced in the /hooks/header-extras.php like this:

Code: Select all

<script src="hooks/AppGiniHelper.min.js"></script>
<script>
//appgini helper

//Adjust application image and title
var url="/someimage.png"
new AppGiniCommon()
.setTitle("<b>MyAppTitle</b>")
.setImage(url); 
</script>
Any suggestions?
Olaf

G Belgrado
Veteran Member
Posts: 61
Joined: 2017-03-12 09:24

Re: AppGiniCommon setImage fails on custom page

Post by G Belgrado » 2019-12-13 16:22

I have the same console error in common.js.php
both with helper plugin and without

AppGini.currentTableName: Could not retrieve table name from page URL common.js.php:1394:3

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

Re: AppGiniCommon setImage fails on custom page

Post by onoehring » 2019-12-13 16:35

Hi G Belgrado,

I believe the "AppGini.currentTableName: Could not retrieve table name from page URL common.js.php:1394:3" is because it's a custom page where AG's method of determining the table name simply does not work. I think this is a message not connected to the Helper.

Olaf

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

SOLVED: AppGiniCommon setImage fails on custom page

Post by jsetzer » 2019-12-15 12:13

Sorry, for late response, I somehow missed this post.
  • The error message for currentTableName is related to core AppGini, NOT to AG Helper JS Library.
    As G Belgrado has already mentioned: This error comes from common.js.php which is an core AppGini script.
  • Also the warnings coming from scriptaculous.js are NOT related to AG Helper JS Script, as we do not use scriptaculous.js.
  • Also the warnings coming from analyser.js are NOT related to AG Helper JS Script, as we do not use analyser.js.
Some time ago I was facing similar problems in Chrome - not only in AG apps. I have found out that some Chrome Extensions caused warnings and errors in Console. Whenever you are facing such problems, I recommend checking the same page without Chrome Extensions OR in a different browser like Firefox.

I am going to submit a second post in a couple of minutes concerning custom pages as a response to Olaf's post.

Best,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

SOLVED: AppGiniCommon setImage on custom pages

Post by jsetzer » 2019-12-15 12:45

Hi again,

it has been written that there were problems in AppGiniHelper's .setImage()-function in custom pages.

I can NOT confirm this. The setimage() function works as expected!

I have just double checked it by creating a completely new custom page according to AppGini's specification here:
https://bigprof.com/appgini/help/advanc ... cess-pages

chrome_GCTc9hiQEw.png
chrome_GCTc9hiQEw.png (18.96 KiB) Viewed 6996 times

Code: Select all

<?php
define('PREPEND_PATH', '../');
$hooks_dir = dirname(__FILE__);
include("$hooks_dir/../defaultLang.php");
include("$hooks_dir/../language.php");
include("$hooks_dir/../lib.php");
include_once("$hooks_dir/../header.php");
?>
<div class="container">
    <h1>Test</h1>
</div>

<script>
    new AppGiniCommon()
        .setTitle("Test")
        // .setIcon("cog") // worxx fine
        .setImage("/app/calxx/images/accept.png"); // worxx fine
</script>
<?php
include_once("$hooks_dir/../footer.php");
?>
As long as you pass a valid url refering an existing and reachable image this will work perfectly fine.

I'm sorry, guys, for the irritation.

Best,
Jan

@Olaf: As written on October 5th, you have to specify a valid (!) image url which is reachable by the server from the location of your custom-page in hooks-subdirectory. If you, for example, specify /ECoMo.png or /someimage.png, the server will try to find it in root-directory. Also always double check letter-casing, especially in non-Windows systems. If the problem re-occurs in your environment, please re-check the url.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

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

Re: AppGiniCommon setImage fails on custom page

Post by onoehring » 2019-12-16 07:59

Hi Jan,

thanks for your reply. I am trying to fix it ... will report back.
Short: It works, if I run the code that I can see in the debugger again in the console.

Olaf
Attachments
Zwischenablage05.png
Zwischenablage05.png (41.07 KiB) Viewed 6981 times
Zwischenablage05b.png
Zwischenablage05b.png (25.5 KiB) Viewed 6981 times

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: AppGiniCommon setImage fails on custom page

Post by jsetzer » 2019-12-17 07:58

Hi Olaf,
did you try with a valid url?
From your screenshots I can still see /ECoMo.png.
Best,
Jan
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

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

Re: AppGiniCommon setImage fails on custom page

Post by onoehring » 2019-12-17 08:01

Hi Jan,

yes, I placed the main logo in the root dir, so /ECoMo.png is indeed the correct name and path.
I can of course add some domain to it as well...
But/And this code works on other pages.

Olaf
Last edited by onoehring on 2019-12-17 08:02, edited 1 time in total.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: AppGiniCommon setImage fails on custom page

Post by jsetzer » 2019-12-17 08:02

Hi Olaf,
yes, please.
Jan

PS: Documentation for .setImage() function here:
https://appgini.bizzworxx.de/products/j ... t-picture/

Code: Select all

var url="https://www.bizzworxx.de/agh32.png";

new AppGiniCommon()
.setTitle("<b>CLINIC</b>Management")
.setImage(url);
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: AppGiniCommon setImage fails on custom page

Post by jsetzer » 2019-12-17 08:08

onoehring wrote:
2019-12-17 08:01
But/And this code works on other pages.
Yes, and that's the reason why we need a valid (absolute) URL and not a path.

Referencing resources in most cases depends on the starting-location.
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

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

Re: AppGiniCommon setImage fails on custom page

Post by onoehring » 2019-12-17 08:11

Hi Jan,
I will try - but it fails.
Zwischenablage06b.png
Zwischenablage06b.png (31.51 KiB) Viewed 6949 times
Running the code in the console works.
Zwischenablage06.png
Zwischenablage06.png (47.1 KiB) Viewed 6949 times
My edit above: The /ECoMo.png works on other pages.

My suspicion is, that it has something to do with the JS errors from other parts of that specific page. These seem to occur from using another datepicker (so far I was unable to get the standard AG supplied to work. As this is a custom page, I also failed to use the Helper's date picker (I need something like you described das date-range-picker of your helper here viewtopic.php?f=13&t=3331&sid=294c89ea0 ... f0b#p11660 )

Olaf

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

Re: AppGiniCommon setImage fails on custom page

Post by onoehring » 2019-12-17 08:47

Hi Jan,

for now I am using a workaround. I simply added

Code: Select all

<script>
	//set image again once document is ready
	$(function() {
		var url = "/ECoMo.png"
		new AppGiniCommon()
			.setTitle("<b>ECoMo</b>")
			.setImage(url);
	});
</script>
to the bottom of my page (again, as it is done in the header-extras already). This places the correct icon.

Thanks
Olaf

Post Reply