Re: [aur-dev] small translation problem
On 09/26/2010 03:31 AM, Loui Chang wrote: Nope there's no automatic cleaning of the translation files, so they may very well contain duplicate and obsolete strings. I'd welcome contributors for such a task. The translation related scripts and functionality could use some attention too. How do you translators translate? I edited the .po file directly, is someone using the translation_tool? I created some scripts that parse the .po files and search the code for usage of the __() function. (I know there was code for this before, but it would take me less time to rewrite it then to understand and adapt the old code, my code also is modular) The scripts then search for obsolete translations and untranslated strings. [1] Based on that I could write a script that rewrites the *.po files (only the required strings). It could also reorganize the strings into sections of strings used by the same template (which would help translating, if one edits the .po file directly) It would be easy to write a script that allows to change some strings in the .po files without loosing the translations. (It could also be told to copy the translations to a second string, which would be what we need to solve the Submit issue) Regards, PyroPeter [1] http://gist.github.com/597985 -- freenode/pyropeter 12:50 - Ich drücke Return.
Re: [aur-dev] Handling deletion through the web interface.
Hi Loui, On Monday 20 September 2010 at 02:23 Loui Chang wrote: Hi Peter. Thanks for sending in these patches. I really don't know when I'll be able to give these a fair look however. No problem - so sorry for sending more :-) I've actually spent today taking another look at how this can be accomplished, and since it seems that we should require users to give reasons for deletion requests, which then get forwarded to aur-general (otherwise the automated emails aren't too useful), I've reimplemented some of it in a slightly different way. Basically I put the bulk of it in pkgedit.php rather than pkgfuncs.inc, imitating the way category changes happen. This means that in my implementation: - Users are now required to give a reason when requesting deletion, from a list. Hopefully this will make people think / check. - When a package has a pending deletion request, this is displayed on the package page. - Users can leave a comment (and should in most cases), which gets forwarded to the list in the deletion proposal and can start any discussion. - The maintainer and everyone on the notify list also gets an email, letting them know that the package is up for deletion (with the reasons) and this will be discussed on aur-general. - TUs and devs can cancel deletion requests (preferably following discussion on the list), ordinary users can't. - On the downside, bulk deletion proposals aren't possible, since reasons have to be given per package on the pkgedit.php page. Bulk cancelations are possible though, in case of abuse. - It should be fairly easy to add and amend valid reasons for proposing deletion, since these are just extra variables in the http post, which get sent to the mailing list. They're not stored in the database (seemed overkill to me). (Five related) patches to follow shortly (and don't bother with the previous ones I sent, these include that stuff). The AUR really needs someone to step up to keep it going now. Well, once I'm a bit more comfortable with the code and processes and stuff, I'd be happy to help. Cheers, Pete. PS. There's a bit of duplication of code here, but if the general idea is accepted, then I'll work on factoring some of it out later.
[aur-dev] [PATCH] Add function pkg_propose_deletion to web/lib/pkgfuncs.inc, which manages whether or not a package is currently proposed for deletion and emails the maintainer and aur-general when a
--- web/lib/pkgfuncs.inc | 95 ++ 1 files changed, 95 insertions(+), 0 deletions(-) diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 5605daa..386662c 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -678,6 +678,101 @@ function pkg_flag ($atype, $ids, $action = True) { } /** + * Propose packages for deletion and cancel proposals + * + * @param string $atype Account type, output of account_from_sid + * @param array $ids Array of package IDs to propose / cancel proposals for + * @param boolean $action True proposes deletion, false cancels proposal. + * Proposes by default. + * + * @return string Translated success or error messages + */ +function pkg_propose_deletion ($atype, $ids, $action = True) { + if (!$atype) { + if ($action) { + return __(You must be logged in before you can propose packages for deletion.); + } else { + return __(You must be logged in before you can cancel deletion proposals.); + } + } + + if (empty($ids)) { + if ($action) { + return __(You did not select any packages to propose.); + } else { + return __(You did not select any packages to cancel proposals for.); + } + } + + foreach ($ids as $pid) { + if (!is_numeric($pid)) { + if ($action) { + return __(You did not select any packages to propose.); + } else { + return __(You did not select any packages to cancel proposals for.); + } + } + } + + $dbh = db_connect(); + + $first = 1; + foreach ($ids as $pid) { + if ($first) { + $first = 0; + $propose = $pid; + } else { + $propose .= , . $pid; + } + } + + $ood = $action ? 1 : 0; + $q = UPDATE Packages SET DeletionProposed = . $ood; + $q.= WHERE ID IN ( . $propose . ); + + if (!$action) { + echo Undeleting; + } + + db_query($q, $dbh); + + if ($action) { + # Notify maintainer and aur-general of proposal by email + $f_name = username_from_sid($_COOKIE['AURSID']); + $f_email = email_from_sid($_COOKIE['AURSID']); + $f_uid = uid_from_sid($_COOKIE['AURSID']); + $q = SELECT Packages.Name, Users.Email, Packages.ID ; + $q.= FROM Packages, Users ; + $q.= WHERE Packages.ID IN ( . $propose .) ; + $q.= AND Users.ID = Packages.MaintainerUID ; + $q.= AND Users.ID != . $f_uid; + $result = db_query($q, $dbh); + if (mysql_num_rows($result)) { + while ($row = mysql_fetch_assoc($result)) { + # construct email - maintainer + $body = Your package . $row['Name'] . has been proposed for deletion by . $f_name . [1]. You may view your package at:\nhttp://aur.archlinux.org/packages.php?ID=; . $row['ID'] . \n\n[1] - http://aur.archlinux.org/account.php?Action=AccountInfoID=; . $f_uid; + $body = wordwrap($body, 70); + $headers = Reply-to: nob...@archlinux.org\nfrom:aur-not...@archlinux.org\nx-mailer: PHP\nX-MimeOLE: Produced By AUR\n; + @mail($row['Email'], AUR Package Deletion Proposal for .$row['Name'], $body, $headers); + + # construct email - aur-general + $body = The AUR package . $row['Name'] . has been proposed for deletion by . $f_name . [1]. You may view the package at:\nhttp://aur.archlinux.org/packages.php?ID=; . $row['ID'] . \n\n[1] - http://aur.archlinux.org/account.php?Action=AccountInfoID=; . $f_uid; + $body = wordwrap($body, 70); + $headers = Reply-to: nob...@archlinux.org\nfrom:aur-not...@archlinux.org\nx-mailer: PHP\nX-MimeOLE: Produced By AUR\n; + @mail('aur-gene...@archlinux.org', AUR Package Deletion Proposal for .$row['Name'], $body, $headers); + + } + } + } + + if ($action) { + return __(The selected packages have been proposed for deletion.); + } else { + return __(The deletion proposals have been cancelled for the selection packages.); + } +} + +/** * Delete packages * * @param string $atype Account type, output of account_from_sid -- 1.7.3
[aur-dev] [PATCH] Move deletion proposal code from pkgfuncs.inc to pkgedit.php and add mechanism for dealing with reasons for deletion.
--- web/html/pkgedit.php | 210 ++ web/lib/pkgfuncs.inc | 42 ++ 2 files changed, 218 insertions(+), 34 deletions(-) diff --git a/web/html/pkgedit.php b/web/html/pkgedit.php index 0339d00..f04e816 100644 --- a/web/html/pkgedit.php +++ b/web/html/pkgedit.php @@ -103,6 +103,216 @@ if ($_REQUEST[change_Category]) { exit(); } +# Propose deletion of package +# +# valid reasons are: +# - sources no longer available [nosource], +# - no longer builds on current systems (and cannot reasonably be patched) [wontbuild], +# - duplicated elsewhere in the repos [dupe], +# - name or source control system changed (e.g. from svn to git) [namechange] +# +if ($_REQUEST[propose_Deletion]) { + + if ($_REQUEST[CONFIRM] ($_REQUEST[NOSOURCE] || $_REQUEST[WONTBUILD] || $_REQUEST[DUPE] || $_REQUEST[NAMECHANGE]) ) { + # The user confirmed and we have at least one reason - go ahead and do it + + $dbh = db_connect(); + + # Get details of the user who proposed the deletion + $f_name = username_from_sid($_COOKIE['AURSID']); + $f_email = email_from_sid($_COOKIE['AURSID']); + $f_uid = uid_from_sid($_COOKIE['AURSID']); + + # Get package name + $q = SELECT Packages.Name ; + $q.= FROM Packages ; + $q.= WHERE Packages.ID = . $_REQUEST['ID']; + + $result = db_query($q, $dbh); + + # If this is false, then something has gone wrong (i.e. the package got deleted while you were doing this) + if (!mysql_num_rows($result)) { + print __(Oops, something went wrong and the package no longer seems to exist!); + exit(); + } + + $row = mysql_fetch_assoc($result); + + # Send a message to aur-general + $body = The AUR package . $row['Name'] . has been proposed for deletion by . $f_name . [1].\n\n; + $body.= You may view the package at:\nhttp://aur.archlinux.org/packages.php?ID=; . $_REQUEST['ID'] . \n\n; + + $body.= The reason(s) given were:\n; + if ($_REQUEST['NOSOURCE']) { + $body.= - The sources are no longer available.\n; + } + if ($_REQUEST['WONTBUILD']) { + $body.= - The package no longer builds on current systems.\n; + } + if ($_REQUEST['DUPE']) { + $body.= - The package is duplicated elsewhere.\n; + } + if ($_REQUEST['NAMECHANGE']) { + $body.= - The package's name has changed, and a new package replaces it.\n; + } + + $body.= \nThe proposer added the following details:\n; + $body.= $_REQUEST['REASONTEXT'].\n\n; + + + $body.= [1] - http://aur.archlinux.org/account.php?Action=AccountInfoID=; . $f_uid; + + + $body = wordwrap($body, 70); + $headers = Reply-to: nob...@archlinux.org\nfrom:aur-not...@archlinux.org\nx-mailer: PHP\nX-MimeOLE: Produced By AUR\n; + + # TODO: add the real aur-gene...@archlinux.org address here when done with testing + @mail('aur-gene...@__remove_me__archlinux.org', AUR Package Deletion Proposal for .$row['Name'], $body, $headers); + + + + # Notify maintainer of package by email + $q = SELECT Packages.Name, Users.Email ; + $q.= FROM Packages, Users ; + $q.= WHERE Packages.ID = . $_REQUEST['ID'] . ; + $q.= AND Users.ID = Packages.MaintainerUID; + + $result = db_query($q, $dbh); + + # If this is false, then the package has no maintainer, so there's no email to send + if (mysql_num_rows($result)) { + $row = mysql_fetch_assoc($result); + + # construct email - maintainer + $body = Your AUR package . $row['Name'] . has been proposed for deletion by . $f_name . [1].\n\n; + $body.= You may view your package at:\nhttp://aur.archlinux.org/packages.php?ID=; . $_REQUEST['ID'] . \n\n; + + $body.= The reason(s) given were:\n; + if ($_REQUEST['NOSOURCE']) { + $body.= - The sources are no longer available.\n; + } + if ($_REQUEST['WONTBUILD']) { + $body.= - The package no longer builds on current systems.\n; + } + if ($_REQUEST['DUPE']) { + $body.= -
[aur-dev] [PATCH] Modify search and package pages to provide interface to deletion functions.
--- web/template/actions_form.php |5 +++-- web/template/pkg_details.php| 15 +++ web/template/pkg_search_results.php |4 +++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/web/template/actions_form.php b/web/template/actions_form.php index 006f9ef..41b7860 100644 --- a/web/template/actions_form.php +++ b/web/template/actions_form.php @@ -45,8 +45,9 @@ if ($row[MaintainerUID] == 0) { } if ($row[DeletionProposed] == 0) { -echo input type='submit' class='button' name='do_ProposeDeletion'; -echo value='.__(Propose for deletion).'\n; + # Disabled, since we require a reason to be given + #echo input type='submit' class='button' name='do_ProposeDeletion'; + #echo value='.__(Propose for deletion).'\n; } else if ($atype == Trusted User || $atype == Developer) { echo input type='submit' class='button' name='do_UnProposeDeletion'; echo value='.__(Cancel deletion proposal).'\n; diff --git a/web/template/pkg_details.php b/web/template/pkg_details.php index 9c76ab3..6c52990 100644 --- a/web/template/pkg_details.php +++ b/web/template/pkg_details.php @@ -28,6 +28,15 @@ if ($atype == Developer or $atype == Trusted User) { $votes = a href=\voters.php?ID=$pkgid\$votes/a; } +# If the package has been proposed for deletion +if ($row[DeletionProposed]) { + $deletion_status = __(This package has been proposed for deletion).br /; + $deletion_status .= __(You can view and participate in the discussion on the aur-general mailing list); +} else { + $deletion_status = a href='pkgedit.php?propose_Deletion=1amp;ID=; + $deletion_status .= $pkgid .'.__(Propose deletion of this package)./a; +} + # In case of wanting to put a custom message $msg = __('unknown'); $license = empty($row['License']) ? $msg : $row['License']; @@ -53,6 +62,12 @@ $submitted_time = ($row[SubmittedTS] == 0) ? (unknown) : gmdate(r, intval( span class='f3'?php echo $votes ?/span /p + p + span class='f3'?php echo $deletion_status ?/spanbr / + /p + + + pspan class='f3'?php echo __('License') . ': ' . $license ?/span/p p diff --git a/web/template/pkg_search_results.php b/web/template/pkg_search_results.php index f2ce5c0..a7810ce 100644 --- a/web/template/pkg_search_results.php +++ b/web/template/pkg_search_results.php @@ -107,7 +107,9 @@ for ($i = 0; $row = mysql_fetch_assoc($result); $i++) { ?php endif; ? option value='do_Notify'?php print __(Notify) ?/option option value='do_UnNotify'?php print __(UnNotify) ?/option - option value='do_ProposeDeletion'?php print __(Propose Deletion) ?/option + !-- not currently allowed without a reason +option value='do_ProposeDeletion'?php print __(Propose Deletion) ?/option + -- ?php if ($atype == Trusted User || $atype == Developer): ? option value='do_UnProposeDeletion'?php print __(Cancel Deletion Proposal) ?/option ?php endif; ? -- 1.7.3
[aur-dev] Fwd: AUR Package Deletion Proposal for beebem
FYI, an example email which would be sent to aur-general and those on the notify list. (links are duff, just example) Pete. On Sunday 26 September 2010 at 20:30 aur-not...@archlinux.org wrote: The AUR package beebem has been proposed for deletion by pete [1]. You may view the package at: http://aur.archlinux.org/packages.php?ID=901 The reason(s) given were: - The package is duplicated elsewhere. - The package's name has changed, and a new package replaces it. The proposer added the following details: it already exists with -svn suffix. cvs is old skoool! [1] - http://aur.archlinux.org/account.php?Action=AccountInfoID=305