We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26931
    • 2,314 Posts
    hi there smiley

    does sorting work for you guys?

    ... i can drag and drop the pictures, but after saving the order nothing changes on the frontend.

    do i need a certain parameter in the call? (my call is uncached, also tried different caching options)

    thanks, j
      • 18373 ☆ A M B ☆
      • 3,141 Posts
      That’s something I noticed the other day aswell, but as I didn’t think it was important for my client’s site I just left it like that. Thanks for bringing it up again.


      Just manually checked the database, the portfolio_galleries table. It showed the four images, but all the files had a sortorder of 0.

      Found (I think) the section this is all about:

      // Find the last order position
      	$rs = $modx->db->select('sortorder', $modx->getFullTableName('portfolio_galleries'), '', 'sortorder DESC', '1');
      	if ($modx->db->getRecordCount($rs) > 0)
      		$pos = $modx->db->getValue($rs);
      	else
      		$pos = 0;
      
      	// Create record in the database
      	$fields = array(
      		'content_id' => $content_id,
      		'filename' => $modx->db->escape($_FILES['Filedata']['name']),
      		'sortorder' => $pos
      	);
      	$modx->db->insert($fields, $modx->getFullTableName('portfolio_galleries'));

      assets/modules/evogallery/upload.php

      And also
      			elseif (isset($_POST['cmdsort']))  // Update image sort order
      			{
      				foreach ($_POST['sort'] as $key => $filename)
      				{
      					$modx->db->update("sortorder='" . $key . "'", $modx->getFullTableName($this->galleriesTable), "filename='" . urldecode($filename) . "' AND content_id='" . $content_id . "'");
      				}
      			}

      assets/modules/evogallery/classes/management.class.inc.php (line 279)

      I’m not too familiar with the MODx api, so I’m not sure if I’m much of a help. lipsrsealed
        Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

        Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
        • 26931
        • 2,314 Posts
        hey markieham,

        thank you for looking into it.

        could also be that it’s a JS problem. checking the picture elements in the module with firebug shows me:
        <input type="hidden" value="praxis02.jpg" name="sort[]"/>
        maybe someone more experienced with it jumps in smiley
          • 8790
          • 526 Posts

          • yes, sorting does not works
          • suggestion 1 : adding more controls to the thumb creation (keep or not proportion, crop...)
          • Accessibility need: Does someone knows how to add keyboard TAB navigation focus management in addition the hover detection (pause: 1) used in the jQcycle script ?
            how to detect the TAB is passing over a ’slide’ to pause it, exactly like the mouse do, this is for vocal reader like Jaws to have enough time to read , for instance)

          Thank you
            Schtroumpf Grognon - Grouchy Smurf
            ---------------------------------
            Faites pas attention.. - Don&#39;t pay attention
            http://www.dzi-neo.net
            • 8790
            • 526 Posts
            Quote from: markieham at Jun 15, 2010, 12:56 PM

            777 is used for the scripts to make the different gallery folders and to manage the pictures through the module.

            I think (but correct me if I’m wrong) you could just set it back to 755/644 or something similar if you’re not planning on using the management module to change the photos.

            What influence 777 has on the security of the module? No idea, but do remember that while installing MODx you’re also making folders such as /assets/cache, /assets/images, /assets/files, /assets/media etc to writeable too. So I doubt having an extra folder (in this case, /assets/galleries) as writeable poses a security risk.
            Hi,

            afaik, all the folders you list actually are 755 and not 777.

            (May be some face issue on some server, such as hosting service with Plesk wich is ’quit buggy’ and where files are owned by APACHE instead of your ftp user, impacting badly the way files can be manipulated.)

            I don’t know if there is ez way to inject something into a 777 folder, but I guess it should be easier than 755...
              Schtroumpf Grognon - Grouchy Smurf
              ---------------------------------
              Faites pas attention.. - Don&#39;t pay attention
              http://www.dzi-neo.net
              • 18373 ☆ A M B ☆
              • 3,141 Posts
              They are 777 in my set-up....

              @Sharkbait: it shows the same for each image for me also.. When you rearrange the images, the script posts a lot of sort[] names back to the module. Those names each have a value of the image in that position, so the post order is how the sort should be done...

              However, that’s not what this script does:
              			elseif (isset($_POST['cmdsort']))  // Update image sort order
              			{
              				foreach ($_POST['sort'] as $key => $filename)
              				{
              					$modx->db->update("sortorder='" . $key . "'", $modx->getFullTableName($this->galleriesTable), "filename='" . urldecode($filename) . "' AND content_id='" . $content_id . "'");
              				}
              			}

              It checks for the cmdsort post (which is also sent with the batch of sort[] values), and then starts looping through the post values.
              Then it sets the sortorder column in the database to $key, which is 0? Or perhaps even ’’?

              I’ll see if I can come up with a fix on my test server....



              Managed to get a simple fix for the sortorder not updating:
              			elseif (isset($_POST['cmdsort']))  // Update image sort order
              			{
              				$sortnum = 0; //## 16/6/2010 Mark Hamstra
              				foreach ($_POST['sort'] as $key => $filename)
              				{
              					$sortnum++; //## 16/6/2010 Mark Hamstra !vvvvv!
              					$modx->db->update("sortorder='" . $sortnum . "'", $modx->getFullTableName($this->galleriesTable), "filename='" . urldecode($filename) . "' AND content_id='" . $content_id . "'");
              				}
              			}

              Line 279+ from the management.class.inc.php file, found in /assets/modules/evogallery/classes. My changes have been marked (!vvvvv! refers to the $sortnum in the query which I changed from $key).

              The above fix makes sure that when you hit "Save Order" it will actually save it. To also fix the sortorder when uploading new images, you’ll need another one too:

              	// Find the last order position
              	$rs = $modx->db->select('sortorder', $modx->getFullTableName('portfolio_galleries'), '', 'sortorder DESC', '1');
              	if ($modx->db->getRecordCount($rs) > 0)
              		$pos = $modx->db->getValue($rs) + 1; // ## 16/6/2010 Mark Hamstra (+1)
              	else
              		$pos = 1; // ## 16/6/2010 Mark Hamstra (1)

              Line 58+ of the upload.php file, found in /assets/modules/evogallery

              By adding "1" to the highest found value, you increase it, otherwise it would be the same.
              Also for the $pos = 1;, you need it to be higher then 0, or the if call above it will never fire off, increasing the sortorder for the next image.

              When testing this, I found that it was still not using the sortorder column, but that it was sorting on the ID of the image. To "fix" this, specify "sortorder" in the sortBy parameter or change the default setting in the snippet (in the manager).

              These fixes applied to a clients site fixed it there also.
                Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

                Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.
                • 8790
                • 526 Posts
                Hi again,

                I’m looking for a way to improve the rendered code for each item, where, for the moment, it looks like a call to a PL is done for Title of the images, here’s what I’m using:
                <li>
                <div class="slide_block">
                <a class="full_slide" href="[+images_dir+][+filename+]" rel="fancyslide"></a><img src="[+images_dir+]thumbs/[+filename+]" alt="[+title+]" title="Vue de : [+title+]"/>
                </div>
                </li>
                

                Wich is fine when all field are actually filled in, in the module management.

                However, considering it could be a pain to enter all titles and descriptions when there’s many images, I’d like to add "somewhere" a test to use some isset[+title+] , then get it, else use a basic substitution string, such as "no title yet", or the file name instead.
                Same for the alt.
                This way the rendered code will be valid and it does not create accessibility leak.
                (And also, as I use Fancybox to pop the full size image it will run correctly, without an error on "title is not defined")
                I tried to nlude some PHX test into my template, but it was not interpreted.

                Anyone ?
                  Schtroumpf Grognon - Grouchy Smurf
                  ---------------------------------
                  Faites pas attention.. - Don&#39;t pay attention
                  http://www.dzi-neo.net
                  • 26931
                  • 2,314 Posts
                  I tried to nlude some PHX test into my template, but it was not interpreted.
                  Evogallery got PHX functionality included ... e.g. works fine
                  [+title:isnot=``:then=`[+title+]`:else=`blabla`+]
                    • 32678
                    • 290 Posts
                    Hi -- I just installed evoGallery 1.0 Beta and have encountered image upload issues similar to those described in other replies within this thread. I am running evolution 1.0.4 and MAMP with PHP 5.3 in a test environment. GD is enabled (see PHPInfo output for this below) and everything looks OK there (other than ’JPGlib unknown’ -- not sure what that means...). I took a look at error reports and see nothing pertaining to this.

                    The problem behavior -- images simply don’t upload. Any thoughts, guidance, etc., is greatly appreciated!

                    Here’s the PHPInfo output, for the record:

                    gd
                    GD Support enabled
                    GD Version bundled (2.0.34 compatible)
                    FreeType Support enabled
                    FreeType Linkage with freetype
                    FreeType Version 2.3.9
                    T1Lib Support enabled
                    GIF Read Support enabled
                    GIF Create Support enabled
                    JPEG Support enabled
                    libJPEG Version unknown
                    PNG Support enabled
                    libPNG Version 1.2.42
                    WBMP Support enabled
                    XBM Support enabled
                      • 26931
                      • 2,314 Posts
                      When testing this, I found that it was still not using the sortorder column, but that it was sorting on the ID of the image. To "fix" this, specify "sortorder" in the sortBy parameter or change the default setting in the snippet (in the manager).

                      These fixes applied to a clients site fixed it there also.
                      hey markieham, thanks! ... i’ll try your fix, j