{"thread":{"id":"7313","subject":"[PATCH] gitweb: Allow configuring the default projects order and add order 'none'","startedAt":"2007-03-19T12:27:13Z","lastAt":"2007-03-19T12:27:13Z","messageCount":1,"participants":["Frank Lichtenheld"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"37487","messageId":"11743072333326-git-send-email-frank@lichtenheld.de","threadId":"7313","inReplyTo":null,"subject":"[PATCH] gitweb: Allow configuring the default projects order and add order 'none'","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-03-19T12:27:13Z","receivedAt":"2007-03-19T12:27:13Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Introduce new configuration variable $default_projects_order\nthat can be used to specify the default order of projects on\nthe index page if no 'o' parameter is given.\n\nAllow a new value 'none' for order that will cause the projects\nto be in the order we learned about them. In case of reading the\nlist of projects from a file, this should be the order as they are\nlisted in the file. In case of reading the list of projects from\na directory this will probably give random results depending on the\nfilesystem in use.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n gitweb/gitweb.perl |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\n This is intended to serve as an easy way to archive\n arbitrary default orders (e.g. by project's \"importance\").\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex b297410..8f999ae 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -71,6 +71,10 @@ our $logo_label = \"git homepage\";\n # source of projects list\n our $projects_list = \"++GITWEB_LIST++\";\n \n+# default order of projects list\n+# valid values are none, project, descr, owner, and age\n+our $default_projects_order = \"project\";\n+\n # show repository only if this file exists\n # (only effective if this variable evaluates to true)\n our $export_ok = \"++GITWEB_EXPORT_OK++\";\n@@ -1131,7 +1135,6 @@ sub git_get_projects_list {\n \t\t}\n \t\tclose $fd;\n \t}\n-\t@list = sort {$a->{'path'} cmp $b->{'path'}} @list;\n \treturn @list;\n }\n \n@@ -2618,7 +2621,7 @@ sub git_project_list_body {\n \t\tpush @projects, $pr;\n \t}\n \n-\t$order ||= \"project\";\n+\t$order ||= $default_projects_order;\n \t$from = 0 unless defined $from;\n \t$to = $#projects if (!defined $to || $#projects < $to);\n \n@@ -2977,7 +2980,7 @@ sub git_search_grep_body {\n \n sub git_project_list {\n \tmy $order = $cgi->param('o');\n-\tif (defined $order && $order !~ m/project|descr|owner|age/) {\n+\tif (defined $order && $order !~ m/none|project|descr|owner|age/) {\n \t\tdie_error(undef, \"Unknown order parameter\");\n \t}\n \n@@ -3000,7 +3003,7 @@ sub git_project_list {\n \n sub git_forks {\n \tmy $order = $cgi->param('o');\n-\tif (defined $order && $order !~ m/project|descr|owner|age/) {\n+\tif (defined $order && $order !~ m/none|project|descr|owner|age/) {\n \t\tdie_error(undef, \"Unknown order parameter\");\n \t}\n \n-- \n1.5.0.3\n"}]}