Return function as in CMSimple 3.4

Discussions and requests related to new CMSimple features, plugins, templates etc. and how to develop.
Please don't ask for support at this forums!
Post Reply
oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Return function as in CMSimple 3.4

Post by oldnema » Tue Nov 04, 2014 2:30 pm

Hi developers. CMSimple 3.4 had one excellent service that the new versions disappeared. The features announced which pages are used images from the folder "Pictures".
It would be great if the service is returned, including search plugins such as Realblog_XH and Calelendar_XH.
It's a stupid idea? If so, I apologize.
Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Return function as in CMSimple 3.4

Post by cmb » Tue Nov 04, 2014 9:26 pm

oldnema wrote: CMSimple 3.4 had one excellent service that the new versions disappeared. The features announced which pages are used images from the folder "Pictures".
This feature is still available. When you hover over an image in the file browser, you see the thumbnail on the right hand side. If this image is used in content.htm, it is reported there (incl. the page names):
[ external image ]
oldnema wrote:including search plugins such as Realblog_XH and Calelendar_XH.
That would require some support of the plugins. I'll try to think of a possible solution.
Christoph M. Becker – Plugins for CMSimple_XH

oldnema
Posts: 265
Joined: Wed Jan 21, 2009 5:15 pm
Location: Czech Republic
Contact:

Re: Return function as in CMSimple 3.4

Post by oldnema » Wed Nov 05, 2014 12:29 am

cmb wrote: This feature is still available. When you hover over an image in the file browser, you see the thumbnail on the right hand side. If this image is used in content.htm, it is reported there (incl. the page names):
[ external image ]
Oh, I admit that this feature I never noticed.
Excellent, however, this option, which would allow bulk deletion of unused files, see Editing screen cmsimple 3.4
[ external image ]
A further amendment: to plugins that would be a good search would have added Boilerplate.
My claims are probably exaggerated, but it would be a huge help for the admin and facilitation.
Josef
Nobody knows how much time he has left ...
http://oldnema.compsys.cz/en/?Demo_templates

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Return function as in CMSimple 3.4

Post by cmb » Wed Nov 05, 2014 12:57 am

oldnema wrote:Oh, I admit that this feature I never noticed.
I have to admit that it is somewhat hidden, and that it's not perfect that the thumbnail can be seen only when hovering over the filename. However, there is the possibility to use KCFinder, which is much more advanced than the default file browser (KCFinder lacks the "used-in" feature, though).
oldnema wrote:Excellent, however, this option, which would allow bulk deletion of unused files, see Editing screen cmsimple 3.4
Is bulk deletion really possible with CMSimple 3.4? I just tried, but I only see radio buttons, and no checkboxes, so I can delete only a single file. :?

Anyhow, Ajaxfilemanager_XH has a bulk delete feature (and many more) -- unfortunately it is still not ready for CMSimple_XH 1.6. I'm somewhat torn between improving the built-in filebrowser or Ajaxfilemanager_XH (both would need it), because I don't have the time for both.
oldnema wrote:A further amendment: to plugins that would be a good search would have added Boilerplate.
Agreed.
oldnema wrote:My claims are probably exaggerated, but it would be a huge help for the admin and facilitation.
I don't think your requests are too demanding, because the name of the CMS is CMSimple, and that's how it should be.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Return function as in CMSimple 3.4

Post by cmb » Sun Feb 08, 2015 12:57 am

cmb wrote:
oldnema wrote:Excellent, however, this option, which would allow bulk deletion of unused files, see Editing screen cmsimple 3.4
Is bulk deletion really possible with CMSimple 3.4? I just tried, but I only see radio buttons, and no checkboxes, so I can delete only a single file. :?
Ah, now I understand. Only unused images can be bulk deleted -- quite nifty! :)
cmb wrote:
oldnema wrote:A further amendment: to plugins that would be a good search would have added Boilerplate.
Agreed.
Well, it seems I had misunderstand your request, as you were probably referring to images used in "boilerpates" to be marked as such in the filebrowser. That could be done by evaluating all scripts on the pages before checking the images for usage, but that might considerably slow down the check. There had already been a report that the filebrowser is very slow, what's probably related to checking the usage of images. Therefore I'm not sure if we should risk to further decrease its performance. What do others think?

FWIW: here's an untested patch:

Code: Select all

Index: plugins/filebrowser/classes/Filebrowser_Controller.php
===================================================================
--- plugins/filebrowser/classes/Filebrowser_Controller.php	(revision 1480)
+++ plugins/filebrowser/classes/Filebrowser_Controller.php	(working copy)
@@ -223,14 +223,18 @@
      * @global array The content of the pages.
      * @global array The headings of the pages.
      * @global int   The number of pages.
+     * @global int   The index of the requested page.
      */
     function usedImages()
     {
-        global $c, $h, $cl;
+        global $c, $h, $cl, $s;
 
         $images = array();
+        $oldS = $s;
         for ($i = 0; $i < $cl; $i++) {
-            preg_match_all('/<img.*?src=(["\'])(.*?)\\1.*?>/is', $c[$i], $m);
+            $s = $i;
+            $content = evaluate_scripting($c[$i]);
+            preg_match_all('/<img.*?src=(["\'])(.*?)\\1.*?>/is', $content, $m);
             foreach ($m[2] as $fn) {
                 if ($fn{0} == '.' && $fn{1} == '/') {
                     $fn = substr($fn, 2);
@@ -244,6 +248,7 @@
                 }
             }
         }
+        $s = $oldS;
         return $images;
     }
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply