Page 9 of 10

Re: [PLUGIN] Contact for Bludit 2.5

Posted: Fri May 04, 2018 1:20 pm
by Edi
Fix for the issues.

1) Add the following to plugin.php (after line 38):

Code: Select all

		$keys = array_keys($options);
		// Récupération de la valeur clé des pages				
		foreach($options as $pageKey) {
			// Création de l'objet page
			$page = buildPage($pageKey);
			// Récupération du titre de la page
			$optionsList[$pageKey] = $page->title();
			// On tri le tableau
			ksort($optionsList);
		}
2) Modify (line 57):

Code: Select all

'options'		=> $ListOptions,
instead of

Code: Select all

'options'		=> $pageOptions,
3) Modify (line 203):

Code: Select all

		if ( !$Url->notFound() &&
		     ( $Url->whereAmI()=='page' && $Page->slug()===$this->getDbField('page') )
		    )
instead of

Code: Select all

		if ( !$Url->notFound() &&
		     ( $Url->whereAmI()=='page' &&
			(($this->getDbField('page') && $Page->status()=='published') || 
			($this->getDbField('page') && $Page->status()=='static'))
		     ) )

Re: [PLUGIN] Contact for Bludit 2.5

Posted: Fri May 04, 2018 7:02 pm
by Fred
I can list the posts, but no way to load the form:
Replace this part:

Code: Select all

		// Content to display form
		HTML::formSelect(array(
			'name'			=> 'page',
			'label'			=> $Language->get('Select a content'),
			'class'			=> 'uk-width-1-3 uk-form-large',
			'options'		=> $pageOptions,
			'selected'		=> $this->getValue('page'),
			'tip'			=> '',
			'addEmptySpace'	=> false,
			'disabled' 		=> false
		));	
By:

Code: Select all

		// Content to display form
		HTML::formSelect(array(
			'name'			=> 'page',
			'label'			=> $Language->get('Select a content'),
			'class'			=> 'uk-width-1-3 uk-form-large',
			'options'		=> $options,
			'selected'		=> $this->getValue('page'),
			'tip'			=> '',
			'addEmptySpace'	=> false,
			'disabled' 		=> false
		));	
For the rest, I do not understand the problems you meet.

Re: [PLUGIN] Contact for Bludit 2.5

Posted: Fri May 04, 2018 8:39 pm
by Edi
I try to explain it with some more details.

1) Only static pages can be selected from the dropdown menu on the settings page

This is because there is the wrong value set:

Code: Select all

'options'		=> 		$pageOptions,
The list of all options is set as follows:

Code: Select all

		$pageOptions = $dbPages->getStaticDB();
		$postOptions = $dbPages->getPublishedDB();		
		$options = array_merge( $postOptions, $pageOptions );
$pageOptions shows only a list of static pages.

2) Instead of the slug of the selected page its position in the dropdown menu is saved in the database file

There is the snippet missing from for example version 2.2.1 with the value (slug) and title of the options:

Code: Select all

		$keys = array_keys($options);
		// Récupération de la valeur clé des pages				
		foreach($options as $pageKey) {
			// Création de l'objet page
			$page = buildPage($pageKey);
			// Récupération du titre de la page
			$optionsList[$pageKey] = $page->title();
			// On tri le tableau
			ksort($optionsList);
		}
Without it the value is a number and the slug is shown as title.

3) In the if conditon to determine the selected page the slug of the page is missing.

The script uses the following if condition:

Code: Select all

		if ( !$Url->notFound() &&
		     ( $Url->whereAmI()=='page' &&
			(($this->getDbField('page') && $Page->status()=='published') || 
			($this->getDbField('page') && $Page->status()=='static'))
		     ) )
The result is that the form is shown on every page.

Re: [PLUGIN] Contact for Bludit 2.5

Posted: Fri May 04, 2018 9:14 pm
by Fred

Re: [PLUGIN] Contact for Bludit 2.5

Posted: Sat May 05, 2018 12:50 am
by Edi
This works. Merci beaucoup, Fred!

Re: [PLUGIN] Contact for Bludit 2.5

Posted: Sat May 05, 2018 6:04 pm
by Edi
I made a pull request with small fixes and updated German language files.

There were empty spaces after the succes and the error message. Therefore the translations didn't show.

Re: [PLUGIN] Contact for Bludit 2.6

Posted: Sat May 05, 2018 9:24 pm
by Fred
Thank Edi for your report !
First post update with new link.

Re: [PLUGIN] Contact for Bludit 2.6

Posted: Sun May 20, 2018 2:53 pm
by Edi
There is a problem, if there is only static content or only published content.

A fix could be (line 66):

Code: Select all

		// On merge le tableau
		if ( empty($postOptions) == true && empty($pageOptions) == true ) {
                    $options = array();
		}
		elseif ( empty($postOptions) == true ) {
		    $options = $pageOptions;;
		}
		elseif ( empty($pageOptions) == true ) {
		    $options = $postOptions;
		}
		else {
		    $options = array_merge( $postOptions, $pageOptions );
		}

Re: [PLUGIN] Contact for Bludit 2.6

Posted: Mon Jul 09, 2018 8:37 am
by LRAM
Hi
thanks for this plugin , a great plus for our Bludit

any way to add the link to the menu ?
On most website, the contact link is in the navbar

Thanks

Re: [PLUGIN] Contact for Bludit 2.6

Posted: Mon Jul 09, 2018 11:56 am
by Edi
The plugin adds the contact form to a selected page, and this page can be added to the navigation.