From: Oliver M. B. <ol...@fa...> - 2005-01-09 11:01:19
|
Hi! On slashdot.jp, i like to have spaces in department names from time to time. Currently, the conversion of spaces into dashes is hardcoded in admin.pl. Below is a patch against R_2_5_0_41 that makes this behaviour optional and depend on the var "use_dept_space2dash". It'd be great if this could be merged. I'm sure there are other users out there that don't neccersary always-want-the-dashes-in-there. Index: admin.pl =================================================================== RCS file: /cvsroot/slashdotjp/slashjp/plugins/Admin/admin.pl,v retrieving revision 1.3 diff -u -r1.3 admin.pl --- admin.pl 31 Dec 2004 12:35:50 -0000 1.3 +++ admin.pl 9 Jan 2005 10:48:09 -0000 @@ -1327,9 +1327,11 @@ $storyref->{commentstatus} = $form->{commentstatus}; $storyref->{uid} ||= $user->{uid}; - $storyref->{dept} =~ s/[-\s]+/-/g; - $storyref->{dept} =~ s/^-//; - $storyref->{dept} =~ s/-$//; + if ($constants->{use_dept_space2dash}){ + $storyref->{dept} =~ s/[-\s]+/-/g; + $storyref->{dept} =~ s/^-//; + $storyref->{dept} =~ s/-$//; + } my($chosen_hr) = extractChosenFromForm($form); $storyref->{topics_chosen} = $chosen_hr; @@ -1501,7 +1503,7 @@ my $authors = $slashdb->getDescriptions('authors', '', 1); my $author_select = createSelect('uid', $authors, $storyref->{uid}, 1); - $storyref->{dept} =~ s/ /-/gi; + $storyref->{dept} =~ s/ /-/gi if $constants->{use_dept_space2dash}; $locktest = lockTest($storyref->{title}); @@ -1941,7 +1943,7 @@ my $tid_ref; my $default_set = 0; - $form->{dept} =~ s/ /-/g; + $form->{dept} =~ s/ /-/g if $constants->{use_dept_space2dash}; $form->{aid} = $slashdb->getStory($form->{sid}, 'aid', 1) unless $form->{aid}; @@ -2267,7 +2269,7 @@ my $tid_ref; my $default_set = 0; - $form->{dept} =~ s/ /-/g; + $form->{dept} =~ s/ /-/g if $constants->{use_dept_space2dash}; my($chosen_hr) = extractChosenFromForm($form); my($tids) = $slashdb->getTopiclistFromChosen($chosen_hr); Index: dump =================================================================== RCS file: /cvsroot/slashdotjp/slashjp/plugins/Admin/dump,v retrieving revision 1.3 diff -u -r1.3 dump --- dump 31 Dec 2004 12:35:50 -0000 1.3 +++ dump 9 Jan 2005 10:48:09 -0000 @@ -31,6 +31,7 @@ INSERT INTO menus (menu, label, sel_label, value, seclev, menuorder) VALUES ('info','Config','Config','[% gSkin.rootdir %]/admin.pl?op=topics',500,13); INSERT INTO vars (name, value, description) VALUES ('admin_maxdays_divider', '14', 'Max number of days on the admin.pl story list to bother showing the day-dividers'); +INSERT INTO vars (name, value, description) VALUES ('use_dept_space2dash','1','convert spaces to dashes in dept. field'); INSERT INTO vars (name, value, description) VALUES ('ispell', 'ispell', 'Location of ispell binary or empty string to turn off'); INSERT INTO vars (name, value, description) VALUES ('similarstorydays', '30', 'Number of days to look back for uncommon words when determining similar stories'); INSERT INTO vars (name, value, description) VALUES ('similarstorymaxwords', '30', 'Maximum number of top-weighted scores to search for in previous stories'); -- Oliver M. Bolzer GPG (PGP) Fingerprint = 621B 52F6 2AC1 36DB 8761 018F 8786 87AD EF50 D1FF |