Re: Code review: icms_ipf_Metagen

PHPStorm identifies loads of parts of the code that contain repetitive statements, so your findings are more or less expected. We can't fix them all at once, and the metagen is a good place to start.

This is an area that can be more fleshed out as well, I would expect the metagen function to be able to generate other metadata like the ones for facebook, twitter (sorry, 'X'), linkedin, and the likes.

When metagen was developed, those newer systems weren't there yet (or not as ubiquitous), now they're the norm and search engines have reduced or dropped the importance of the fields we're generating at the moment.

Topic | Forum

Re: Code review: icms_ipf_Metagen

Here are some code snippets to look at -

libraries/icms/ipf/Metagen.php - setTitle()

These both have this:  @todo Remove this and use the proper data filter and HTML Purifier

include/functions.php - icms_html2text()

include/functions.php - icms_purifyText()

My review is that at this point, when the title tag is being rendered, the title has already been filtered and purified before being saved in the database, and then retrieved and sent to these functions. It's important to note that the title is not sent through these functions for rendering on the page.

Topic | Forum

Code review: icms_ipf_Metagen

I'm working through a few things on a couple of sites and looking a little more into ways to improve readability for all readers - people and search engines.

Page titles are always a key thing and it is something we need to pay more attention to. The ICMS IPF Metagen class handles creating meta tags, including the title. However, much of it was done before we implemented HTML Purifier and our standard filtering practices for content being saved into the database and before it is rendered.

What I find happening is punctuation - which is allowed - is being stripped out, making it a little awkward to read. It all starts in icms_ipf_Metagen->setTitle(). The first thing it does is call icms_html2text(), a function to strip HTML tags and replace HTML entities with text equivalents. Then, icms_purifyText() gets called to strip out punctuation. The post title displays as desired in the content, but the meta title is altered.

Would removing those 2 function calls be risky? After all, a module following the IPF methods and any module saving content is having the content filtered before being added to the database. I think these 2 functions served a different purpose, and the code comments even indicate they should be replaced by other methods already in the core.

There are other parts of this to explore in more detail. Just starting with this one, since it isn't one that can be overridden by other properties saved with the post, like the keywords, description, and short URL text can be.

Re: Admin theme development

I am working on the mockups in plain HTML, that works easier than directly in Smarty. it's coming along quite well for a first iteration.

Attach file:

png  icms-coreui-acp-theme-preview.png (873.38 KB)
1102__2469066035b30044ce.png 2850X1526 px

Re: Admin theme development

I was wrong on the theming for the pages : the Adsense page for example does not take into account theme templates. It does work with a different template defined in a template set, so I'm taking that route for the moment.

Re: Admin theme development

Alas, no. The reflex theme doesn't really define new blocks that are used in the ACP part of the admin theme. It defines a new CSS that gives the existing layout a fresh coat of paint, but nothing more than that. I'll try to dig up an ancient version of the new theme MrTheme started working on several years back, he did a total overhaul if I'm not mistaken. Let's see if I can get it working on 2.0 RC1.

Re: Admin theme development

If the reflex theme is still working, there are template overrides for blocks in it -


Re: Admin theme development

I create a new theme without theme.html, but with theme_admin.html as main template. That part works well, I can have the overall structure of my page defined by that template. The ACP page content such as adsense can also be themed. I'm still working on re-theming the table component, but that's just figuring out how to understand those admittedly very complex theme files.

The only thing I haven't been able to get to theme are the blocks. But the start page of the ACP is only made out of blocks, so it's quite a big deal if I want to have a modern-looking and inviting first impression

Re: Admin theme development

How are you attempting to override the admin theme? I know a theme can add another option to the admin theme selector. I’m not sure how to override an existing admin theme. 

Admin theme development

I have been looking into upgrading our admin theme, as the current one is way out of date (no mobile support for instance). I made some good headway working out the theme_admin.html template, but once you want to go and change some more detailed parts such as the way the content of the ACP blocks is rendered, I'm hitting a wall.

It looks like the template overrides don't work in the context of the ACP. I'm going through some debugging sessions at the moment to try to figure out why that is exactly, but that is a major roadblock in getting a new, fresh admin theme out there.

To be continued

Re: is there a current gallery module?

Looking at the code, there appears to be 4 fields for storing the image information, one it is received. There may be some nuances in how the control is rendered - try using 'multiple=multiple' as the extra argument and see what you get. Once that is working, have a look at modules/system/admin/images/main.php - function imanager_addfile(). It steps through the FILE variable and handles multiple files, though I don't see how this is set to work in the core.

Re: is there a current gallery module?

I added several image fields in the event class, and I want to use the promoimage4 field to handle the multiple images as a gallery. Have a look on github :

Re: is there a current gallery module?

Well, we know the form field will accept the input

Thinking about storing the images - how did you link the images to the event?

Re: is there a current gallery module?

I hacked my page the same way

Rendering of the page was the same, I could only choose more than one item. But when I uploaded the items only the first one was shown by the component, so that needed more work. That was going to be the next step, after I could get a clean way of adding the extra 'multiple' parameter to the control.

Re: is there a current gallery module?

With that change, how the field render on the page? What attributes did it have?

When I used the developer mode in my browser, I edited the HTML and added the attribute to the field. When I clicked on the Browse button to select a file, it allowed me to select more than one. Without that change, it did not. 

Re: is there a current gallery module?

That seems like a good way to proceed. I had a look at the library file, and came up with this to try to add the multiple keyword to the control, but nothing changed :

$this->setControl('promoimage4', array('name' => 'image', 'extra' => 'multiple'));

Re: is there a current gallery module?

As for multiple file uploads, looking at modules/system/admin/images/main.php, function imanager_addfile() looks like it is set to handle multiple files. The change to make to the submission form is rather simple. The input field needs to have the 'multiple' attribute set.

Re: is there a current gallery module?

Visitors uploading photos is not really required at the moment, so it would be content editors that would be taking care of that.

The resize feature is nice technically, but we're talking about a visitor population of 400-500 in total, so I don't think we should lose ourselves in cache strategies here

Re: is there a current gallery module?

Some more questions:

Will general visitors be uploading photos?
Do you want people to interact with the photos? Add comments, like/share?
Any privacy concerns? Only registered members can view, or members of a specific group?
What other content is there with the event? Any way to add attachments, like here in the forums?

xcGallery covers most of these, but in the module, not as connected to another module. The multiple file upload is a form with multiple fields for uploading, not a drag and drop or multiple select option.

What I like about what I see in Catalogue is the resize feature - change the settings of the module to display images in a different size and the custom smarty plugin handles resizing and creating cached versions of the images. I;m not sure how images can be grouped into albums or sets.

Re: Standup Reports

The editor integration is a bit messy, with in my view lots of times whee configuration is rebuilt and overwritten later in the loop. It's not as easy as I had hoped, so please bear with me as I try to make sense of it all ...

I first tried to update the CKEditor version to v5, which is the current, supported, one. That version is not backward compatible with previous versions, which means that the entire integration would need to be rewritten. The javascript functions in the CKEDITOR object that replace a textarea on the page no longer exist, so I am now greeted with a nice, empty editor space That's something for later, after I get the v4 integration correct again.