Script Declaration in Image field

More
11 years 10 months ago #38678 by brandonking
If we set Use Popup to Yes in Image field,
all related js and css files are included if there is image on page..
This sometimes give us some js conflicts.

All my images in Item List View are not set to popup, only for link to its item page.

So, we better to have some restricts,
like Use popup Only for ITEM VIEW/ITEM LIST VIEW/CATEGORY VIEW/MODULE(Multi-Select will be better).
Code:
if ($view=='item'){ $document->addScript(JURI::root().'components/com_flexicontent/librairies/multibox/Scripts/multiBox.js'); }
Code:
if ($view=='item'){ $document->addScriptDeclaration($js); }

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #38679 by ggppdk
Hello,
What you describe is done already (but...), please below:

... we have 2 parameters:
usepopup and popupinview

the 'popupinview' is checkboxes and is used to turn off popup in non-selected views:

$popupinview = $field->parameters->get('popupinview', array(FLEXI_ITEMVIEW,'category','backend'));
Code:
$popupinview = FLEXIUtilities::paramToArray($popupinview); if ($view==FLEXI_ITEMVIEW && !in_array(FLEXI_ITEMVIEW,$popupinview)) $usepopup = 0; if ($view=='category' && !in_array('category',$popupinview)) $usepopup = 0; if ($isItemsManager && !in_array('backend',$popupinview)) $usepopup = 0;
(but i see the check for view == 'module to be missing:)
Code:
if ($view=='module' && !in_array('module',$popupinview)) $usepopup = 0;

Please check these 2 cases:

a. 'popupinview' does have option for 'module' but in the code it is missing (bug i will add) ... so maybe the problem comes from there? e.g. if you add the image field in custom fields of module then JS code for popup will be added

b. the parameter 'linkto_url' forces the adding of JS code for popup

is a or b your case ?

FOR a, i ll add option for 'module'
(the fields are called with view that can have 3 values: item, category = 'all content lists views', module)
... but image field also uses backend (not the view variable, it calculates variable $isItemsManager inside the code)

FOR b, you think to use parameter 'popupinview' to also turn off 'linkto_url' or add 'linkto_inview'?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #38682 by brandonking
In my case is A, as you mentioned, I have universal modules displayed in front page and that's why I see scripts included. I will check for other pages and let you know soon.

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #38684 by ggppdk
Please find code:
Code:
$popupinview = FLEXIUtilities::paramToArray($popupinview); if ($view==FLEXI_ITEMVIEW && !in_array(FLEXI_ITEMVIEW,$popupinview)) $usepopup = 0; if ($view=='category' && !in_array('category',$popupinview)) $usepopup = 0; if ($isItemsManager && !in_array('backend',$popupinview)) $usepopup = 0;

and add after it:
Code:
if ($view=='module' && !in_array('module',$popupinview)) $usepopup = 0;

and also make sure 'module' is not check for parameter "Popup in view"

and test ...

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #38702 by brandonking
Yeap, it works.. all the scripts and css are now gone.
Thank you. :)

About

b. the parameter 'linkto_url' forces the adding of JS code for popup


I have tested and had no problem.

Please Log in or Create an account to join the conversation.

More
11 years 10 months ago #38704 by brandonking
You have updated Galleriffic image plugin into latest version in revision 1697 but, in xml file, the Galleriffic option in popuptype is still commented. :)
<!--option value="5">FLEXI_FIELD_IMAGE_GALLERIFFIC_BUILTIN</option-->

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.359 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save