WBCE CMS Forum

WBCE CMS – Way Better Content Editing.

Du bist nicht angemeldet.

#1 27.05.2016 11:36:50

rjgamer
Mitglied

[Erledigt] Arrow Icon Bug

Hi guys,

I've found an bug with the arrow icons on the adminpage pages.htt when you are drag'n drop a page to an other position. Tested with a plain V1.1.6 installation without any modification or changes.

Screenshot in the Attachement.

rjgamer

Beitrag geändert von rjgamer (27.05.2016 11:37:55)

Offline

#2 27.05.2016 11:45:05

florian
Administrator

Re: [Erledigt] Arrow Icon Bug


Wir Benötigen: Cents, Euros... jetzt spenden!

Offline

#3 01.06.2016 18:11:32

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

Hi community bakers.

The remedy is fairly simple:
just add in line 230 a new, empty <td> tag pair, like that:

<!-- this is line 230: -->
</td>
<!-- change to this: -->
</td><td>&nbsp;</td>

This will do.

The problem is that this PageTree still runs with the old YUI (yahoo js framework from the stone age).

I have long ago reworked the PageTree to a newer version, running with TWIG and using jQuery. It's a charm.

~Chris


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#4 01.06.2016 18:23:02

rjgamer
Mitglied

Re: [Erledigt] Arrow Icon Bug

Thx, will check it this evening!

Offline

#5 01.06.2016 19:06:49

florian
Administrator

Re: [Erledigt] Arrow Icon Bug

thumb_up
stefanek, welcome on board... is there a possibility that your pagetree script basing on twig and jquery could be used in an upcoming WBCE version?


Wir Benötigen: Cents, Euros... jetzt spenden!

Offline

#6 01.06.2016 19:45:24

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

florian schrieb:

... is there a possibility that your pagetree script basing on twig and jquery could be used in an upcoming WBCE version?

Yes, but we would need to talk about a good Twig integration.

I have already talked to Norbert some time ago, and we have found a way how this could be done. But it was only in theory up until now.

Generally all of my recent modules work with Twig (in BE and FE), but I paused development due to a lack of time (but it's all there).

I'm in communication with Norbert and if he likes to integrate the PageTree with Twig and jQuery, we will find a way.

Kind regards,
Christian


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#7 01.06.2016 20:19:13

florian
Administrator

Re: [Erledigt] Arrow Icon Bug

That's great, I'm looking foward to the further development.


Wir Benötigen: Cents, Euros... jetzt spenden!

Offline

#8 01.06.2016 20:42:12

rjgamer
Mitglied

Re: [Erledigt] Arrow Icon Bug

Cool. Happy that the stone is rolling smile

Offline

#9 01.06.2016 21:22:05

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

OK, I checked the Twig/jQuery pageTree again.

  1. The pageTree is table-less (it's a List with divs, can be made responsive with some CSS tweaks)

  2. I am still using regular, image based ICONS, but it could be reworked to use fonts instead (would make it even more "turbo" fast).

  3. I removed the UP/DOWN arrows altogether; though they could (should?) be in there when the browser has JS disabled.

  4. I have still a big issue with the collapse/expand status and saving the status to a cookie (need some free time to come to that)

Generally I would suggest: for the next release keep the pageTree as it is now.
For a later release I will rework the remaining issue (4) and re-integrate the UP/DOWN icons (3).
Making it responsive (1) and applying icon-fonts instead of pixel-based icons is a good idea aswell.
Maybe we should think about creating a custom font for WBCEs needs. (Or rework one, if there is one that is interesting and the license allows for customization.)

[Personally what I don't like about the current icons is that they're all monochromic (same color). Some color, like in the different visibility-mode in pages, makes it really more comprehensive for the user.]

Anyways, all the above is doable, but it takes some time to create (which I don't have plenty of at the moment), therefore I would suggest to keep it as is for the next release (it's still working, actually...).

Suggestions?

~Chris


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#10 02.06.2016 07:33:16

florian
Administrator

Re: [Erledigt] Arrow Icon Bug

It should be avoided that one of you has double work, so maybe it would be good if you give/show your treeview code to rjgamer/norhei already. Thus they can have a look at it and decide when to implement it or help you with the issue.


Wir Benötigen: Cents, Euros... jetzt spenden!

Offline

#11 02.06.2016 07:35:11

norhei
Developer

Re: [Erledigt] Arrow Icon Bug

Another question , do you have any idea to get the headlines in line whith the table content when scaling the page ?
As far as i remember this pagetree was once made for a static width page.

Offline

#12 02.06.2016 10:56:33

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

florian schrieb:

It should be avoided that one of you has double work, so maybe it would be good if you give/show your treeview code to rjgamer/norhei already. Thus they can have a look at it and decide when to implement it or help you with the issue.

Florian,

sharing my code AS IS would make no sense, as my solution is working on top of my own Fork wich has Twig implemented core-deep already, in a special, unobtrusive way.

Therefore we will need to implement Twig in such a way, that my solution will work.
Also I wrote with Christian (cwSoft) and there is more interest in a better implementation of Twig. If we give it some combined effort by experienced people, we could come up with a good integration that makes all currently involved happy.

As I have seen yesterday, rjGamer already works with font-icons in the pageTree. This is a very good step.

Having the pageTree working with Twig, once it's done, will give him and all others who like to produce AdminThemes, the freedom to change everything in the Template without messing with the PHP. This is really an advancement to what we had since the inception of WB.

But first -- if you really want to use the Twig based PageTree -- we will need a more sophisticated integration of Twig. I'm sure we will find a good solution for that, if we don't hurry.

Kind regards,
Chris


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#13 02.06.2016 11:01:09

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

norhei schrieb:

Another question , do you have any idea to get the headlines in line whith the table content when scaling the page ?
As far as i remember this pagetree was once made for a static width page.

This will be probably just some CSS magic, I guess.
This Table based PageTree is a mess in itself.
That's why I have abandoned it altogether, completely avoiding it in the pageTree.

Regards,
Christian


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#14 02.06.2016 14:31:46

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

Let me know if you have any questions, Florian, Norbert or RJ.

My time is somewhat limited right now, but I am willing to answer all your questions or any concerns you may have.

That's also one reason why I think it's best to keep it as it is for the upcoming version and work on a good Twig implementation first.
Then, in a second step, to implement the pageTree itself.
Doing it in a different sequence would result in too much unneeded complication.

My PageTree function itself, and also the Twig part of it -- as far as I remember -- I did send to Norbert some time ago.
I have reworked it since, though no major changes have been done (only some additions).

Regards,
Chris

Beitrag geändert von stefanek (02.06.2016 14:32:21)


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#15 02.06.2016 17:55:43

rjgamer
Mitglied

Re: [Erledigt] Arrow Icon Bug

I dont like Ttwig and prefering pure PHP as templating solution. But if you gave me a great Twig solution with access to all translations keys, I am willed to learn it!

Offline

#16 02.06.2016 20:58:26

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

rjgamer schrieb:

I dont like Ttwig and prefering pure PHP as templating solution.

There are some benefits in using Twig, as there are, of course, benefits to use plain PHP.
The problem with using PHP for templates is that you end up using (often too much) PHP in the templates themselves. While this is somewhat cool on a solo project, it ends up in a mess when working in teams.
Also, I wouldn't like to give customers or editors access to PHP in templates, as this may result in unsatisfactory situations.

But I agree with you that PHP is a good templating solution. No question about it.
Twig is easier to comprehend for people who have no, or little, PHP background.
There are more benefits if Twig is implemented correctly into the system.

rjgamer schrieb:

But if you gave me a great Twig solution with access to all translations keys, I am willed to learn it!

There is not all too much to learn, really. And in most cases we use only the basics of Twig in our templates.
Getting access to translations-keys is very simple. If your translation is an array containing key-value pairs it's as easy as handing over the array to Twig.

Let's say you have an array $MOD_NEWS.
You hand over this array into Twig, say for example:

'LANG' => $MOD_NEWS

Now you can very easily access your language strings in the Template

<a href="#">{{ LANG.SETTINGS }}</a>

(the above is just for illustration, but generally it's as simple as that.)

Some popular WBCE Modules are using Twig already: anyNews, AddonFileEditor (both from cwSoft) and some of my own modules, like the AddonMonitor.

While the modules work good, they use workarounds to implement Twig, which results in too much code in each module.
But there is generally no rocket science involved. It can be done easily, unobtrusive and "slim", and since some of the modules are packaged with WBCE, Twig is needed anyway in the system.

Regards,
Chris

Beitrag geändert von stefanek (02.06.2016 21:00:42)


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#17 02.06.2016 23:48:39

norhei
Developer

Re: [Erledigt] Arrow Icon Bug

As whith next version of WBCE the BE Elements will be exchangeable , so simply write a twig version , i will possibly conbvert this to a php template  and maybe Bianka ports it to DWOO . All is no problem .

Concerning TWIG , the module does not interfere whith anything , and if you like Global or any other values imported go and write a Twig extension that loads all the Needed Vars /Constants on initialisation.  TWIG documentation states its very easy ...
Pease dont try such stuff like initializing an instance in Initialize.php and adding the Globals , this will alwys load even when TWIG isn't used , and thats a big waste of resources . Just a plain little extension .

Offline

#18 02.06.2016 23:52:09

norhei
Developer

Re: [Erledigt] Arrow Icon Bug

While the modules work good, they use workarounds to implement Twig, which results in too much code in each module.
But there is generally no rocket science involved. It can be done easily, unobtrusive and "slim", and since some of the modules are packaged with WBCE, Twig is needed anyway in the system.

To clarify this even more , Twig isn't packed in the modules anymore its available core wide , but its an installable and removeable Module .
HAve a look into the TWIG and the PHPlib module to see how its done.

Offline

#19 03.06.2016 00:27:59

cwsoft
Mitglied

Re: [Erledigt] Arrow Icon Bug

@Norhei: Can work on a WBCE_Twig module which adds WBCE globals, language strings of core and modules and maybe some callbacks to the WBCE insert class to load CSS or JS files from templates together with stefanek in a month or so.

A nice Twig integration - also a bit too much for WBCE right now - is available for the CMS Contao at Github. Other CMS or frameworks like Symfony2 have done similar integration of Twig into their ecosystem.

Guess this is what stefanek was talking about. Just a basic Twig module which already exposes globals, objects and some core features of WBCE by default. This would stop others from implementing such basics over and over again in their own modules.

Cheers

Beitrag geändert von cwsoft (03.06.2016 00:29:49)


Account inactive since 2018/11/17.

Offline

#20 03.06.2016 01:07:29

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

cwsoft schrieb:

Guess this is what stefanek was talking about. Just a basic Twig module which already exposes globals, objects and some core features of WBCE by default. This would stop others from implementing such basics over and over again in their own modules.

Yes.


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#21 03.06.2016 01:24:50

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

norhei schrieb:

As whith next version of WBCE the BE Elements will be exchangeable , so simply write a twig version , i will possibly conbvert this to a php template  and maybe Bianka ports it to DWOO . All is no problem .

Oh, I didn't suspect you want to have PHP backend themes in the future.

If so, here is the basic function for the pageTree (I sent this to you some time ago, but this is the latest version):

[== PHP ==]
if(!function_exists('pagesArray')){
	function pagesArray($iParent = 0) {
		global $database, $admin;
		// prepare SQL Query, build the query string first
		$iParent = intval($iParent);
		$sWhereClause = (PAGE_TRASH != 'inline') ? " WHERE `visibility` <> 'deleted'" : '';	
		$sUseTrash = '';		
		$sQuery = 'SELECT  s.`module`, MAX(s.`publ_start` + s.`publ_end`) published, p.`link`, '
		     .        '(SELECT MAX(`position`) FROM `'. TABLE_PREFIX .'pages` WHERE `parent` = p.`parent`) siblings, '
		     .        'p.`position`, p.`page_id`, p.`parent`, p.`level`, p.`language`, p.`admin_groups`, '
		     .        'p.`admin_users`, p.`viewing_groups`, p.`viewing_users`, p.`visibility`, '
		     .        'p.`menu_title`, p.`page_title`, p.`page_trail`, p.`description`, p.`keywords`, ' 
			 .        'GROUP_CONCAT(CAST(CONCAT(\'\', s.`section_id`, \',\', s.`module`, \'; \') AS CHAR) ORDER BY s.`position` SEPARATOR \'\n\') `sections` '
			 . 'FROM `'. TABLE_PREFIX .'pages` p '
		     .    'INNER JOIN `'. TABLE_PREFIX .'sections` s '
		     .    'ON p.`page_id`=s.`page_id` '
		     . $sWhereClause.' '
		     . 'GROUP BY p.`page_id` '
		     . 'ORDER BY p.`position` ASC';
			 
		$oPages = $database->query($sQuery);
		
		$aPages = array();
		$refs = array();	
		// create $aPages[] Array
		while($page = $oPages->fetchRow(MYSQL_ASSOC)) {
			$thisref = &$refs[ $page['page_id'] ];
			//$thisref[] = $page;
			$thisref['siblings']       = $page['siblings'];
			$thisref['position']       = $page['position'];
			$thisref['parent']         = $page['parent'];
			$thisref['root_parent']    = isset($page['root_parent']) ? $page['root_parent'] : 0;
			$thisref['menu_title']     = $page['menu_title'];
			$thisref['page_title']     = $page['page_title'];
			$thisref['level']          = $page['level'];
			$thisref['visibility']     = $page['visibility'];
			$thisref['admin_groups']   = $page['admin_groups'];
			$thisref['admin_users']    = $page['admin_users'];
			$thisref['position']       = $page['position'];
			$thisref['page_id']        = $page['page_id'];
			$thisref['module']         = $page['module'];
			$thisref['sections']       = $page['sections'];
			$thisref['pageIDKEY']      = $admin->getIDKEY($page['page_id']);
			$thisref['frontend_link']  = PAGES_DIRECTORY . $page['link'] . PAGE_EXTENSION;
			$thisref['modify_page_url']= '../pages/modify.php?page_id='.$page['page_id'];	

			// Admin Groups (get user permissions)
			$admin_groups = explode(',', str_replace('_', '', $page['admin_groups']));
			$admin_users = explode(',', str_replace('_', '', $page['admin_users']));
			$in_group = false;
			foreach($admin->get_groups_id() as $cur_gid) {
				if (in_array($cur_gid, $admin_groups)) 	$in_group = true;
			}			
			// check modify permissions
			$thisref['can_modify'] = false;
			if(($in_group) || is_numeric(array_search($admin->get_user_id(), $admin_users))){				
				if($page['visibility'] == 'deleted'){
					$thisref['can_modify'] = (PAGE_TRASH == 'inline') ? true : false;	
				} elseif ($page['visibility'] != 'deleted') {	
					$thisref['can_modify'] = true; 
				} 
			} else { 
				if ($page['visibility'] == 'private') {	
					continue; 
				} else { 
					$thisref['can_modify'] = false; 
				}
			}
			$thisref['canManageSections'] = (MANAGE_SECTIONS == 'enabled' && $admin->get_permission('pages_modify') == true && $thisref['can_modify'] == true) ? true : false;
			$thisref['canMoveUP']         = (isset($thisref['pageIsMovable']) && $thisref['position'] != 1) ? true : false;
			$thisref['canMoveDOWN']       = (isset($thisref['pageIsMovable']) && $thisref['position'] != $thisref['siblings']) ? true : false;	
			$thisref['pageIsMovable']     = ($admin->get_permission('pages_settings') == true && $thisref['can_modify'] == true) ? true : false;
			$thisref['pageIsMovable']     = ($thisref['pageIsMovable'] && $thisref['siblings'] != 1) ? true : false;	
			$thisref['canDeleteAndModify'] = ($admin->get_permission('pages_delete') == true && $thisref['can_modify'] == true) ? true : false;
			$thisref['canAddChild']        = ($admin->get_permission('pages_add')) == (true && $thisref['can_modify'] == true) && ($thisref['visibility'] != 'deleted') ? true : false;
			$thisref['canModifyPage']      = ($admin->get_permission('pages_modify') == true && $thisref['can_modify'] == true) ? true : false;
			$thisref['canModifySettings']  = ($admin->get_permission('pages_settings') == true && $thisref['can_modify'] == true) ? true : false;	
			$thisref['modifySettingsURL']  = '../pages/settings.php?page_id='.$page['page_id'];
			$thisref['restoreURL']         = '../pages/restore.php?page_id='.$page['page_id'];
			
			# sectionICON
			$thisref['sectionICON'] = "noclock_16.png";
			if($page['published'] != 0){
				$thisref['sectionICON'] = ($admin->page_is_active($thisref)) ? "clock_16.png" : "clock_red_16.png";
			}		
			if($page['module'] == 'menu_link') {
				$thisref['sectionICON'] =  "menu_link_16.png";
				$thisref['menu_link'] =  true;
			}	
			if ($thisref['canManageSections'] == true){ 
				$thisref['sectionsURL'] = '../pages/sections.php?page_id='.$thisref['page_id'];
			}		
			
			if ($page['parent'] == $iParent) {	
				$aPages[ $page['page_id'] ] = &$thisref;				
			} else {
				$refs[ $page['parent'] ]['children'][ $page['page_id'] ] = &$thisref;
			}
			unset($page);
		}
		return $aPages;
	}
}

The function will return the entire pages Table as nested array starting at the given parent (default = 0).
This function is different from WebsiteBakers PageTree class where sql queries are done over and over for each child tree.
You have one query for the whole three, followed by some PHP logic to reconstruct the one dimensional array into a nested array.

~Chris


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#22 03.06.2016 16:21:17

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

cwsoft schrieb:

@Norhei: Can work on a WBCE_Twig module which adds WBCE globals, language strings of core and modules and maybe some callbacks to the WBCE insert class to load CSS or JS files from templates together with stefanek in a month or so.

if I see it right, it can be easily implemented in
[root_path]\modules\twig\initialize.php

In my own implementation I am loading the constants needed depending on location (is it frontend? backend? is it a sectionType- or an AdminTool-module?).
Some constants are loaded for all locations (WB_URL, MEDIA_DIRECTORY, LANGUAGE etc.).
If it is a sectionType module, the page_id and section_id are handed over to twig automatically (saves writing and handing over in module logic).
Some functions are added (addJS, addCSS -- here we'll need to wait for NorHei's implementation of the new I/Insert Class).

But there could be ideas I didn't think about. My implementation was rather neat and small.

So it's good to cooperate and also compare notes with the future development of the CMS itself, so that future improvements within the Twig Snippet , that will be needed as the CMS changes, can be made in such a way that the modules already using the implementation don't break, miss constants etc.

Regards,
Chris


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#23 03.06.2016 22:19:30

norhei
Developer

Re: [Erledigt] Arrow Icon Bug

Guess this is what stefanek was talking about. Just a basic Twig module which already exposes globals, objects and some core features of WBCE by default. This would stop others from implementing such basics over and over again in their own modules.

I would be happy if someone finds the time to do it .


Oh, I didn't suspect you want to have PHP backend themes in the future.

Personally i prefer PHP templates as they add no learning curve to the core, but i want to allow and support any TE in the BE anf FE.

I feel the learning curve on Twig isn't that low as you want to make us believe . And Personally i Feel the documentation sucks as Sensiolab wants you to get you into a support contract. No support forum, go to Stackoverflow they state .. Its just not that easy.  Basically you always have to dig through Stack Overflow and the Api Docs to get more komplex things done .  Thats noting you can expect fron any newcomer.

On the other Hand i don't want to stay in the way and Twig comes whith the Core , so if Twig modules are good enough to make it into the Core ... its OK.

Only one a few things are expected tif you make new Admintools whith twig templates. Please put em in a "templates" folder and check the recent BE theme if it contains  its own template in /templates/recentBETemplate/modules/yourmodule/templates/
You can even add a function for this to the twig module. (The core provides one , but i am not sure if it can be used whith twig ... basically it should as it just returns the template filepath for include depending on if it found a template in the theme or not.)


Damm i need a Bed, taking a closer look at the Code later .

Offline

#24 03.06.2016 22:55:14

stefanek
Core-Team

Re: [Erledigt] Arrow Icon Bug

norhei schrieb:

I feel the learning curve on Twig isn't that low as you want to make us believe . And Personally i Feel the documentation sucks as Sensiolab wants you to get you into a support contract. No support forum, go to Stackoverflow they state .. Its just not that easy.  Basically you always have to dig through Stack Overflow and the Api Docs to get more komplex things done .  Thats noting you can expect fron any newcomer.

No, actually I don't want you to believe anything.
What seems to be hard for you from a developer standpoint is the overall implementation of Twig into the system.
Here it may be a learning curve, agree.
What I am talking about is that using the Twig syntax is lot easier for people WHO HAVE NO OR LITTLE understanding of PHP.
That is actually the general audience of WB/CE, in my estimation.

Once the designer has a ready template as example, he can use it and adapt it to his hearts content, easily. Much easier than with PHP.
I know it from experience, as when I started off with WebsiteBaker I had no PHP knowledge at all. That's why I liked WB. I didn't need to learn any to use it. The reason I later started learning it was because the Layout-Fields (such as in the News-Module) have been very limiting to having logic in the layouts.

Look as example AnyNews. It's a popular snippet and it uses Twig for templating.
Therefore I am using Twig also in other modules for layouting.
You can use conditional statements in it.
It can be saved in DB tables or in files.

And some designers even have phobias against PHP (did you know that?),


NorHei schrieb:

Only one a few things are expected tif you make new Admintools whith twig templates. Please put em in a "templates" folder and check the recent BE theme if it contains  its own template in /templates/recentBETemplate/modules/yourmodule/templates/
You can even add a function for this to the twig module. (The core provides one , but i am not sure if it can be used whith twig ... basically it should as it just returns the template filepath for include depending on if it found a template in the theme or not.)

This part I didn't understand.
We'll come to it later.

~Chris


“Success is the progressive realization of a worthy ideal.” ― Earl Nightingale

Offline

#25 11.05.2017 00:34:15

colinax
Developer

Re: [Erledigt] Arrow Icon Bug

rjgamer schrieb:

Hi guys,

I've found an bug with the arrow icons on the adminpage pages.htt when you are drag'n drop a page to an other position. Tested with a plain V1.1.6 installation without any modification or changes.

Screenshot in the Attachement.

rjgamer

This Bug is fixed.

Offline

Fußzeile des Forums

up