This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "FusionForge".
The branch, master has been updated via 524fce6ab694367e3717ca6c63ae6e6a95fd018f (commit) via 2fc1fa0746552191bd74d5feb297a96ebd0bf9c8 (commit) from d9311374a9b48f20bf378d9002493d754067d1ff (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=524fce6ab694367e3717ca6c63ae6e6a95fd018f commit 524fce6ab694367e3717ca6c63ae6e6a95fd018f Merge: d931137 2fc1fa0 Author: Franck Villaume <franck.villa...@trivialdev.com> Date: Tue May 18 19:07:05 2021 +0200 Merge remote-tracking branch 'rhabacker/master-ticket-933' https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2fc1fa0746552191bd74d5feb297a96ebd0bf9c8 commit 2fc1fa0746552191bd74d5feb297a96ebd0bf9c8 Author: Ralf Habacker <ralf.habac...@freenet.de> Date: Mon May 10 14:28:42 2021 +0200 [#933] Notes can now be added to packages diff --git a/src/common/frs/FRSPackage.class.php b/src/common/frs/FRSPackage.class.php index a4ac0c6..a02a732 100644 --- a/src/common/frs/FRSPackage.class.php +++ b/src/common/frs/FRSPackage.class.php @@ -147,7 +147,7 @@ class FRSPackage extends FFError { * @param int $status Status ID. Default is 1 => Active * @return bool success. */ - function create($name, $status = 1) { + function create($name, $notes = '', $status = 1) { if (strlen($name) < 3) { $this->setError(_('FRSPackage Name Must Be At Least 3 Characters')); return false; @@ -169,9 +169,10 @@ class FRSPackage extends FFError { } db_begin(); - $result = db_query_params('INSERT INTO frs_package(group_id, name, status_id) VALUES ($1, $2, $3)', + $result = db_query_params('INSERT INTO frs_package(group_id, name, notes, status_id) VALUES ($1, $2, $3, $4)', array($this->Group->getID(), htmlspecialchars($name), + htmlspecialchars($notes), $status)); if (!$result) { $this->setError(_('Error Adding Package')._(': ').db_error()); @@ -253,6 +254,15 @@ class FRSPackage extends FFError { } /** + * getNotes - get the notes for this package. + * + * @return string The notes for this package. + */ + function getNotes() { + return $this->data_array['notes']; + } + + /** * getFileName - get the filename of this package. * * @return string The name of this package. @@ -397,10 +407,11 @@ class FRSPackage extends FFError { * update - update an FRSPackage in the database. * * @param string $name The name of this package. + * @param string $notes The notes for this package. * @param int $status The status_id of this package from frs_status table. * @return bool success. */ - function update($name, $status) { + function update($name, $notes, $status) { if (strlen($name) < 3) { $this->setError(_('FRSPackage Name Must Be At Least 3 Characters')); return false; @@ -420,8 +431,9 @@ class FRSPackage extends FFError { } } db_begin(); - $res = db_query_params('UPDATE frs_package SET name=$1, status_id=$2 WHERE group_id=$3 AND package_id=$4', + $res = db_query_params('UPDATE frs_package SET name=$1, notes=$2, status_id=$3 WHERE group_id=$4 AND package_id=$5', array (htmlspecialchars($name), + htmlspecialchars($notes), $status, $this->Group->getID(), $this->getID())); diff --git a/src/common/frs/actions/addpackage.php b/src/common/frs/actions/addpackage.php index 264736b..62b8253 100644 --- a/src/common/frs/actions/addpackage.php +++ b/src/common/frs/actions/addpackage.php @@ -37,6 +37,7 @@ if (!forge_check_perm('frs_admin', $group_id, 'admin')) { } $package_name = htmlspecialchars(trim(getStringFromRequest('package_name'))); +$notes = htmlspecialchars(trim(getStringFromRequest('notes'))); if ($package_name) { //create a new package @@ -46,7 +47,7 @@ if ($package_name) { } elseif ($frsp->isError()) { exit_error($frsp->getErrorMessage(), 'frs'); } - if (!$frsp->create($package_name)) { + if (!$frsp->create($package_name, $notes)) { $error_msg = $frsp->getErrorMessage(); } else { $feedback .= _('Added Package'); diff --git a/src/common/frs/actions/updatepackage.php b/src/common/frs/actions/updatepackage.php index 134775b..bba99d1 100644 --- a/src/common/frs/actions/updatepackage.php +++ b/src/common/frs/actions/updatepackage.php @@ -42,6 +42,7 @@ if (!forge_check_perm('frs', $package_id, 'admin')) { } $package_name = htmlspecialchars(trim(getStringFromRequest('package_name'))); +$notes = htmlspecialchars(trim(getStringFromRequest('notes'))); $status_id = getIntFromRequest('status_id'); $result['html'] = $HTML->error_msg(_('Missing package_id or package_name')); @@ -57,7 +58,7 @@ if ($package_id && $package_name) { echo json_encode($result); exit; } - if (!$frsp->update($package_name, $status_id)) { + if (!$frsp->update($package_name, $notes, $status_id)) { $result['html'] = $HTML->error_msg($frsp->getErrorMessage()); echo json_encode($result); exit; diff --git a/src/common/frs/views/admin.php b/src/common/frs/views/admin.php index deabd42..3b739be 100644 --- a/src/common/frs/views/admin.php +++ b/src/common/frs/views/admin.php @@ -89,6 +89,8 @@ if (count($FRSPackages) == 0) { } $title_arr[] = _('Package name'); $thTitleArray[] = NULL; + $title_arr[] = _('Package notes'); + $thTitleArray[] = NULL; $title_arr[] = _('Status'); $thTitleArray[] = NULL; $title_arr[] = _('Publicly Viewable'); @@ -113,12 +115,14 @@ if (count($FRSPackages) == 0) { } $cells[][] = html_e('input', $package_nameInputAttr); if (forge_check_perm('frs', $FRSPackage->getID(), 'admin')) { + $cells[][] = html_e('input', array('type' => 'text', 'name' => 'notes', 'value' => html_entity_decode($FRSPackage->getNotes()), 'size' => 40, 'maxlength' => 60)); $cells[][] = frs_show_status_popup('status_id', $FRSPackage->getStatus()); $cells[][] = $FRSPackage->getPublicLabel(); $deleteUrlAction = util_make_uri('/frs/?action=deletepackage&package_id='.$FRSPackage->getID().'&group_id='.$group_id); $cells[][] = html_e('input', array('type' => 'button', 'name' => 'submit', 'value' => _('Update'), 'onclick' => 'javascript:controllerFRS.updatePackage({rowid: \'#pkgid'.$FRSPackage->getID().'\', action: \''.util_make_uri('/frs/?group_id='.$group_id.'&action=updatepackage&package_id='.$FRSPackage->getID()).'\'})')). util_make_link('#', $HTML->getDeletePic(_('Delete this package'), _('Delete package')), array('onclick' => 'javascript:controllerFRS.toggleConfirmBox({idconfirmbox: \'confirmbox1\', do: \''._('Delete the package').' '.html_entity_decode($FRSPackage->getName()).'\', cancel: \''._('Cancel').'\', height: 150, width: 300, action: \''.$deleteUrlAction.'\'})' ), true); } else { + $cells[][] = $FRSPackage->getNotes(); $cells[][] = $FRSPackage->getStatusName(); $cells[][] = $FRSPackage->getPublicLabel(); $cells[][] = ''; diff --git a/src/common/frs/views/listpackages.php b/src/common/frs/views/listpackages.php index 4b628fe..215872d 100644 --- a/src/common/frs/views/listpackages.php +++ b/src/common/frs/views/listpackages.php @@ -128,6 +128,7 @@ EOS; .' '._('This link always points to the newest release as a ZIP file.')))); } $content .= html_e('h2', array('id' => 'title_'.$package_name_protected), html_entity_decode($package_name).$package_monitor.$package_ziplink); + $content .= html_e('p', array(), $FRSPackage->getNotes()); if ( !$FRSPackageReleases || $num_releases < 1 ) { $content .= $HTML->warning_msg(_('No releases')); diff --git a/src/db/20210510-add-frs-package-notes.sql b/src/db/20210510-add-frs-package-notes.sql new file mode 100644 index 0000000..23cf3cb --- /dev/null +++ b/src/db/20210510-add-frs-package-notes.sql @@ -0,0 +1 @@ +ALTER TABLE frs_package ADD COLUMN notes text; diff --git a/src/www/frs/scripts/FRSController.js b/src/www/frs/scripts/FRSController.js index 521656b..0070df2 100644 --- a/src/www/frs/scripts/FRSController.js +++ b/src/www/frs/scripts/FRSController.js @@ -105,8 +105,8 @@ FRSController.prototype = updatePackage: function(params) { this.params = params; var td = jQuery(this.params.rowid).children(); - var select = jQuery(td[2].children).children(); - jQuery.getJSON(this.params.action, {package_name: td[1].children.package_name.value, status_id: select[0].value }, function(data){ + var select = jQuery(td[3].children).children(); + jQuery.getJSON(this.params.action, {package_name: td[1].children.package_name.value, notes: td[2].children.notes.value, status_id: select[0].value }, function(data){ jQuery('#maindiv > .feedback').remove(); jQuery('#maindiv > .error').remove(); jQuery('#maindiv > .warning_msg').remove(); ----------------------------------------------------------------------- Summary of changes: src/common/frs/FRSPackage.class.php | 20 ++++++++++++++++---- src/common/frs/actions/addpackage.php | 3 ++- src/common/frs/actions/updatepackage.php | 3 ++- src/common/frs/views/admin.php | 4 ++++ src/common/frs/views/listpackages.php | 1 + src/db/20210510-add-frs-package-notes.sql | 1 + src/www/frs/scripts/FRSController.js | 4 ++-- 7 files changed, 28 insertions(+), 8 deletions(-) create mode 100644 src/db/20210510-add-frs-package-notes.sql hooks/post-receive -- FusionForge _______________________________________________ Fusionforge-commits mailing list Fusionforge-commits@lists.fusionforge.org http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits