[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gallery-devel
Subject:    Re: [Gallery-devel] Modules Name Sorting patch
From:       Bharat Mediratta <bharat () menalto ! com>
Date:       2012-05-11 23:54:37
Message-ID: CAESa+_kvAr2vgMJMqQ1R7iD9Og+P4_Jon9Shxii=Y9_ZpQ3Trg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


strcasecmp would be better than strcmp on multiple strlower's.  Actually I
think we want strnatcasecmp here.  I'll tune this up and submit it - thanks.

On Tue, May 8, 2012 at 7:55 AM, James Nash <gallery@nashnetworks.com> wrote:

> Can I propose this patch for the sorting of modules by their name vs. their
> filename.  Makes looking through the list a lot more appealing.
>
> Thanks,
>
> James (jnash)
>
> --- /data/archives/g3-git/gallery3/modules/gallery/helpers/module.php
> 2012-02-28 13:28:18.000000000 -0500
> +++ /data/apache/htdocs/gallery/modules/gallery/helpers/module.php
> 2012-05-08 10:45:39.000000000 -0400
> @@ -109,7 +109,12 @@
>        $modules->gallery->locked = true;
>        $identity_module = module::get_var("gallery", "identity_provider",
> "user");
>        $modules->$identity_module->locked = true;
> -      $modules->ksort();
> +
> +      function cmp($a, $b) {
> +       return strcmp(strtolower($a->name), strtolower($b->name));
> +      }
> +
> +      $modules->uasort('cmp');
>        self::$available = $modules;
>      }
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> __[ g a l l e r y - d e v e l ]_________________________
>
> [ list info/archive --> http://gallery.sf.net/lists.php ]
> [ gallery info/FAQ/download --> http://gallery.sf.net ]
>
>

[Attachment #5 (text/html)]

<div><br></div>strcasecmp would be better than strcmp on multiple strlower&#39;s.  \
Actually I think we want strnatcasecmp here.  I&#39;ll tune this up and submit it - \
thanks.<br><br><div class="gmail_quote">On Tue, May 8, 2012 at 7:55 AM, James Nash \
<span dir="ltr">&lt;<a href="mailto:gallery@nashnetworks.com" \
target="_blank">gallery@nashnetworks.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Can I propose this patch for the sorting of modules by their \
name vs. their<br> filename.  Makes looking through the list a lot more \
appealing.<br> <br>
Thanks,<br>
<br>
James (jnash)<br>
<br>
--- /data/archives/g3-git/gallery3/modules/gallery/helpers/module.php<br>
2012-02-28 13:28:18.000000000 -0500<br>
+++ /data/apache/htdocs/gallery/modules/gallery/helpers/module.php<br>
2012-05-08 10:45:39.000000000 -0400<br>
@@ -109,7 +109,12 @@<br>
        $modules-&gt;gallery-&gt;locked = true;<br>
        $identity_module = module::get_var(&quot;gallery&quot;, \
&quot;identity_provider&quot;,<br> &quot;user&quot;);<br>
        $modules-&gt;$identity_module-&gt;locked = true;<br>
-      $modules-&gt;ksort();<br>
+<br>
+      function cmp($a, $b) {<br>
+       return strcmp(strtolower($a-&gt;name), strtolower($b-&gt;name));<br>
+      }<br>
+<br>
+      $modules-&gt;uasort(&#39;cmp&#39;);<br>
        self::$available = $modules;<br>
      }<br>
<br>
<br>
------------------------------------------------------------------------------<br>
Live Security Virtual Conference<br>
Exclusive live event will cover all the ways today&#39;s security and<br>
threat landscape has changed and how IT managers can respond. Discussions<br>
will include endpoint security, mobile security and the latest in malware<br>
threats. <a href="http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/" \
target="_blank">http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/</a><br> __[ \
g a l l e r y - d e v e l ]_________________________<br> <br>
[ list info/archive --&gt; <a href="http://gallery.sf.net/lists.php" \
target="_blank">http://gallery.sf.net/lists.php</a> ]<br> [ gallery info/FAQ/download \
--&gt; <a href="http://gallery.sf.net" target="_blank">http://gallery.sf.net</a> \
]<br> <br>
</blockquote></div><br>



------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic