WebsiteBaker Logo
  • *
  • Templates
  • Help
  • Add-ons
  • Download
  • Home
*
Welcome, Guest. Please login or register.

Login with username, password and session length
 

News


WebsiteBaker 2.13.6 is now available!


Will it continue with WB? It goes on! | Geht es mit WB weiter? Es geht weiter!
https://forum.websitebaker.org/index.php/topic,32340.msg226702.html#msg226702


The forum email address board@websitebaker.org is working again
https://forum.websitebaker.org/index.php/topic,32358.0.html


R.I.P Dietmar (luisehahne) and thank you for all your valuable work for WB
https://forum.websitebaker.org/index.php/topic,32355.0.html


* Support WebsiteBaker

Your donations will help to:

  • Pay for our dedicated server
  • Pay for domain registration
  • and much more!

You can donate by clicking on the button below.


  • Home
  • Help
  • Search
  • Login
  • Register

  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • Modules »
  • CKEditor WBLink does not detect modules
  • Print
Pages: [1] 2   Go Down

Author Topic: CKEditor WBLink does not detect modules  (Read 37368 times)

Offline CodeALot

  • Posts: 579
  • Gender: Male
CKEditor WBLink does not detect modules
« on: February 04, 2020, 12:02:09 PM »
Hi all. There used to be a solution to add different modules (Bakery, Topics, OneForAll) to the pages.php file in /modules/ckeditor/ckeditor/plugins/wblink

This pages.php-file has changed, and now there is a code block (starting at line 225 in pages.php) that should detect all available modules to build WBLinks from:
"/* --- begin: crawl all available page-addons for additional lists -------------------- */"

This however does not work. I have tested this with a fresh install of OneForAll, but the WBLink plugin fails to detect the pages made by that OneForAll-module.

Like I said: there was a workaround in the old version of CKeditor, but that does not work anymore. Anyone any idea?
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #1 on: February 04, 2020, 12:55:08 PM »
Additional info: WBLink DOES detect items of a section of the NEWS module.
It fails however to 'detect' OneForAll-records.
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #2 on: February 04, 2020, 01:23:45 PM »
Never mind. The problem lays deeper than this. It has to do with the new features in WB 2.12.2, like in the announcement:

Added WBLink format [wblink14?addon=news&item=153] to work with addons like news, topics, bakery and so on

It works for News. It does not work for OneForAll.
The link is returned as "#"

For instance, I am on www.mysite.com/pages/home.php
On that page I want to link to page ID 30, which has a OneForAll section. That link should be www.mysite.com/pages/newpage/oneforallitem1.php

Code: [Select]
<a href="[wblink30?addon=oneforall&amp;item=1]">Linktext</a>
But it results in a link to: www.mysite.com/pages/home.php/#
 
Looks like it's too complex to solve. I'll work around it.
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #3 on: February 04, 2020, 04:33:28 PM »
You need to create separate droplet for this. For example [ofa-30]  i have this for  custom addon..
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #4 on: February 04, 2020, 05:21:46 PM »
Quote from: crnogorac081 on February 04, 2020, 04:33:28 PM
You need to create separate droplet for this. For example [ofa-30]  i have this for  custom addon..
That would be a workaround, but not for the client. They want to select a page and then a single record. Just like they can do with Bakery, News and Topics-items. It won't work for OneForAll. :-(
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #5 on: February 04, 2020, 06:36:40 PM »
So either to modify plugin to eork with ofa (easier way) or to create another button in ckeditor for ofa. Either way you must create droplet that create reverse link from [ofa-id] to real link..
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #6 on: February 04, 2020, 08:53:00 PM »
Quote from: crnogorac081 on February 04, 2020, 06:36:40 PM
So either to modify plugin to eork with ofa (easier way) or to create another button in ckeditor for ofa. Either way you must create droplet that create reverse link from [ofa-id] to real link..
True. Can you give me the code for your droplet? I know it's not exactly for my situation, but it may serve as a good starting point :)
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #7 on: February 05, 2020, 09:40:11 AM »
Hello,

here is solution for OFA.

rename .txt to .php and place to OFA folder


Can someone link this to original topic, https://forum.WebsiteBaker.org/index.php/topic,27895.275.html  because its locked.

Also it would be good to include in original OFA module page from WB addon repository
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #8 on: February 05, 2020, 09:55:12 AM »
Very nice, thank you!
Still work in progress though, I'm afraid.
 
In CKEditor I now get the dropdown-list with all the OneForAll items, so that is great.
In the source code, I can see how the item is 'called', for instance:

Code: [Select]
<a href="[wblink23?addon=oneforall&amp;item=27]">OFA item</a>
However, when it's saved, and I check the live page (frontend) and the link is turned into

Code: [Select]
<a href="#">OFA item</a>
I must add: I use ShortURL. Maybe that's causing problems?
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8914
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: CKEditor WBLink does not detect modules
« Reply #9 on: February 05, 2020, 09:58:50 AM »
Hi, the dialog is now like it should. But the generated link works not for me.
Looks like
Code: [Select]
<a href="[wblink58?addon=oneforall&amp;item=9]">In frontend i see as link the same page with a # at the end.
mydomain.de/de/current-page#  (yes, with shorturl)

Is there something to do except rename/upload the one file?
Logged
https://onkel-franky.de

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #10 on: February 05, 2020, 10:05:21 AM »
I will take a look, hovewer i never used OFA module before
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #11 on: February 05, 2020, 10:21:02 AM »
Quote from: crnogorac081 on February 05, 2020, 10:05:21 AM
I will take a look, hovewer i never used OFA module before
Oh man, you should. Can't do without anymore :-) Thanks for your efforts!
 
EDIT: I installed a fresh WB 2.12.2 without ShortURL and the problem stays as described above here by dbs and me:
In CKEditor source, the link looks ok. In the frontend, the link is replaced by a single "#".
« Last Edit: February 05, 2020, 10:34:24 AM by CodeALot »
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8914
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: CKEditor WBLink does not detect modules
« Reply #12 on: February 05, 2020, 10:41:48 AM »
This # comes from WbLinkAbstract.php line 119
Code: [Select]
// set link on failure ('#' means, still stay on current page)
        $sRetval = '#';
Seems the following sql query has no result.
Logged
https://onkel-franky.de

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #13 on: February 05, 2020, 11:07:15 AM »
Quote from: dbs on February 05, 2020, 10:41:48 AM
This # comes from WbLinkAbstract.php line 119
Code: [Select]
// set link on failure ('#' means, still stay on current page)
        $sRetval = '#';
Seems the following sql query has no result.

The same WbLinkAbstract.php is called when you want to link to an item in a News-module, and then it works OK. It fails for OFA, and I can't find why... :(
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #14 on: February 05, 2020, 11:35:52 AM »
Ok, I now see what's happening. Looking at the output of WbLinkAbstract.php, I get the following:

SQL call for a news post:
Code: [Select]
SELECT `link` FROM `wb_mod_news_posts` WHERE `post_id`=1Resulting URL:
Code: [Select]
/posts/breaking-news-1-1
This works fine.

SQL for an OFA item:
Code: [Select]
SELECT `link` FROM `wb_mod_oneforall_items` WHERE `item_id`=1Resulting URL:
Code: [Select]
/first-item
And that URL is NOT valid since it does not have the full link-path (in this case, it should have been oneforall-page/first-item )
 
This causes WbLinkAbstract to fail when checking the URL and returning the # instead of the actual link.
Logged

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #15 on: February 05, 2020, 12:12:26 PM »
The source of the problem is the fact that OneForAll does not populate the "link"-field with the actual full link with the /pages/ directory as a base. It only saves the page-url, not the path.

So, the only way to fix this is to alter WbLinkAbstract.php in such a way that:

  • The link is checked
  • If the link check fails, look for the page_title based on the page_id
  • Check if the link exists if you add page_title.'/'. before the link (which will be the case in OneForAll-sections)

...and I can't get that to work properly :-(
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #16 on: February 05, 2020, 12:15:05 PM »
hello,

In OFA module file , WBReorg.php  line 50

    const ACCESSFILES_SUBDIR   = '';

change to

    const ACCESSFILES_SUBDIR   = '/ofa';  or whatever ofa item folder is in /Pages

someone test
« Last Edit: February 05, 2020, 12:25:27 PM by crnogorac081 »
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #17 on: February 05, 2020, 12:37:04 PM »
Quote from: crnogorac081 on February 05, 2020, 12:15:05 PM
hello,

In OFA module file , WBReorg.php  line 50

    const ACCESSFILES_SUBDIR   = '';

change to

    const ACCESSFILES_SUBDIR   = '/ofa';  or whatever ofa item folder is in /Pages

someone test

Tested. Does not do anything, it seems.
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #18 on: February 05, 2020, 12:45:40 PM »
if you have for example OFA item id = 1, what is his real path from /pages direcotry ??   root/pages/ofa/item-link-1.php ?
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #19 on: February 05, 2020, 12:54:31 PM »
Quote from: crnogorac081 on February 05, 2020, 12:45:40 PM
if you have for example OFA item id = 1, what is his real path from /pages direcotry ??   root/pages/ofa/item-link-1.php ?

Correct.

pages/ofa-module-name/titlelink-of-ofa-item.php

What WbLinkAbstract now tries to do, is create

pages/titlelink-of-ofa-item.php
 
For my own situation, I altered WbLinkAbstract so that it checks for the module name, and if it's the OFA-module name, it adds an extra path to the link

Code: [Select]

if ($this->oDb->TablePrefix.$this::TABLE_NAME == 'wb_mod_oneforall_items') { $extrapath="oneforall/"; }
$sLink     = $extrapath.$sLink;
Not pretty, but it works for me. There should be a more elegant way to solve this, though :-)
Logged

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #20 on: February 05, 2020, 01:08:48 PM »
there are 2 lines in modules/oneforall/WBReorg.php  around line 50

Code: [Select]
/** sub directory for accessfiles
 * @description  This is needed to correct db::x_mod_table::link entries of former versions<br />
 *               let it empty without a hardcoded subdirectory name like our news addon with a
 *               hardcodet subdirectory. The root directory always will be the pages_directory.
 *               with trailing slash if not empty
 */
    const ACCESSFILES_SUBDIR   = '';

/** root directory for accessfiles */
    protected $sAccessFilesRoot = '';


But no matter if I change to

    const ACCESSFILES_SUBDIR   = '/ofa';

or
    protected $sAccessFilesRoot = '/ofa';
or both of them as /ofa

it want work... Wierd..
Logged
Web developer

johnbroeckaert

  • Guest
Re: CKEditor WBLink does not detect modules
« Reply #21 on: February 06, 2020, 07:21:35 PM »
I got this solution from Jacobi22
Works fine for me...

Try it for yourself and let me/us Know.....
CHEERS
Logged

Offline dbs

  • Betatester
  • **
  • Posts: 8914
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: CKEditor WBLink does not detect modules
« Reply #22 on: February 06, 2020, 11:39:11 PM »
Works also for me. Thanks.  (Y)
In my case
Code: [Select]
const ACCESSFILES_SUBDIR   = 'de/listen/oneforall';
edit: it works not if you have the same module on another (sub)page.
« Last Edit: February 07, 2020, 09:20:45 AM by dbs »
Logged
https://onkel-franky.de

Offline crnogorac081

  • Posts: 2161
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #23 on: February 07, 2020, 06:15:35 PM »
Someone tell me what is difference between

const ACCESSFILES_SUBDIR   = '';
And
    protected $sAccessFilesRoot = '';

Where are they used.. it seems to me this is same..

But stil, const can not be changed, and
$sAccessFilesRoot  could be changed dinamicly ,something like $sAccessFilesRoot = $language.'/ofa/';  right ?
Logged
Web developer

Offline CodeALot

  • Posts: 579
  • Gender: Male
Re: CKEditor WBLink does not detect modules
« Reply #24 on: February 07, 2020, 11:06:17 PM »
I tried the posted WbLink.php and that works, as long as you don't use the same OFA module on different pages.
Logged

  • Print
Pages: [1] 2   Go Up
  • WebsiteBaker Community Forum »
  • WebsiteBaker Support (2.12.x) »
  • Modules »
  • CKEditor WBLink does not detect modules
 

  • SMF 2.0.19 | SMF © 2017, Simple Machines
  • XHTML
  • RSS
  • WAP2