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 4e11248797ded092f91a32bfef36b21d804904b0 (commit)
from ef7ebd713e39f45a6688a56c7a85a023c8833865 (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=4e11248797ded092f91a32bfef36b21d804904b0
commit 4e11248797ded092f91a32bfef36b21d804904b0
Author: Stéphane-Eymeric Bredthauer <[email protected]>
Date: Thu Jun 1 22:31:12 2017 +0200
Tracker: Artifacts dependencies, part 6
diff --git a/src/common/tracker/Artifact.class.php
b/src/common/tracker/Artifact.class.php
index e43c954..9dc98ff 100644
--- a/src/common/tracker/Artifact.class.php
+++ b/src/common/tracker/Artifact.class.php
@@ -2340,6 +2340,34 @@ class Artifact extends FFObject {
return $return;
}
+ function resetParent(){
+ $return = false;
+ $update = false;
+ if (!$this->getParent()) {
+ return true;
+ }
+ $extra_fields = $this->getExtraFieldData();
+ $priority = $this->getPriority();
+ $status_id = $this->getStatusID();
+ $status_id = $this->getArtifactType()->remapStatus($status_id,
$extra_fields);
+ $assigned_to = $this->getAssignedTo();
+ $summary = $this->getSummary();
+ $canned_response = 100;
+ $details = "";
+ $artifact_type_id = $this->getArtifactType()->getID();
+ $description = $this->getDetails();
+ $ef_parent_arr=
$this->getArtifactType()->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_PARENT));
+ $ef_parent = array_shift($ef_parent_arr);
+ $ef_parent_id = $ef_parent['extra_field_id'];
+ $extra_fields[$ef_parent_id] = '';
+ $return = $this->update($priority,$status_id,
+
$assigned_to,$summary,$canned_response,$details,$artifact_type_id,
+ $extra_fields, $description);
+ unset($this->parent);
+ $this->fetchData($this->getID());
+ return $return;
+ }
+
function getPermalink() {
return '/tracker/a_follow.php/'.$this->getID();
}
diff --git a/src/common/tracker/actions/ajax.php
b/src/common/tracker/actions/ajax.php
index 7ab58c5..da37fe1 100644
--- a/src/common/tracker/actions/ajax.php
+++ b/src/common/tracker/actions/ajax.php
@@ -56,8 +56,21 @@ switch ($function) {
$child_id = getIntFromRequest('child_id');
echo add_child($aid, $child_id);
break;
+ case 'remove_parent':
+ $aid = getIntFromRequest('aid');
+ $parent_id = getIntFromRequest('parent_id');
+ echo remove_parent($aid, $parent_id);
+ break;
+ case 'remove_child':
+ $aid = getIntFromRequest('aid');
+ $child_id = getIntFromRequest('child_id');
+ echo remove_parent($child_id, $aid);
+ break;
default:
- echo '';
+ $ret = array();
+ $ret['message'] = _('Unknown function').(':').' '.$function;
+ return json_encode($ret);
+ exit();
break;
}
@@ -251,4 +264,18 @@ function add_child($parent_id, $child_id){
$ret['children'] = $parent->showChildren();
return json_encode($ret);
exit();
-}
\ No newline at end of file
+}
+
+function remove_parent($child_id, $parent_id){
+ $ret = array('message' => '');
+ $artifact = artifact_get_object($child_id);
+ $at = $artifact->getArtifactType();
+ $child = new ArtifactHtml($at, $child_id);
+ if (!$child->resetParent()) {
+ $ret['message']=$child->getErrorMessage();
+ return json_encode($ret);
+ exit();
+ }
+ return json_encode($ret);
+ exit();
+}
diff --git a/src/common/tracker/include/ArtifactHtml.class.php
b/src/common/tracker/include/ArtifactHtml.class.php
index 4a79568..2b11aa1 100644
--- a/src/common/tracker/include/ArtifactHtml.class.php
+++ b/src/common/tracker/include/ArtifactHtml.class.php
@@ -225,6 +225,11 @@ function hide_edit_button(id) {
}
function showChildren() {
+ global $HTML;
+ global $atid;
+ if (!forge_check_perm('tracker', $atid, 'submit')) {
+ $readonly = true;
+ }
$children = $this->getChildren();
$rows= count($children);
$return = '';
@@ -248,8 +253,13 @@ function hide_edit_button(id) {
if ($arr['status_id'] == 2) {
$arg['class'] =
'artifact_closed';
}
+ $return .=
html_ao('span',array('id'=>'child'.$arr['artifact_id']));
$return .= '<br/> ';
$return .= util_make_link($url, $text,
$arg).' '.util_make_link($url, $arr['summary']);
+ if (!$readonly) {
+ $return .=
$HTML->getMinusPic(_('Click to remove child'), _('Click to remove child'),
array('class'=>'removechild', 'data-id'=>$arr['artifact_id']));
+ }
+ $return .= html_ac(html_ap()-1);
}
}
$return .= '</td>
@@ -260,6 +270,11 @@ function hide_edit_button(id) {
}
function showParent() {
+ global $HTML;
+ global $atid;
+ if (!forge_check_perm('tracker', $atid, 'submit')) {
+ $readonly = true;
+ }
$parentId = $this->getParent();
$return = '';
if ($parentId){
@@ -278,8 +293,13 @@ function hide_edit_button(id) {
if ($parent->getStatusID() == 2) {
$arg['class'] = 'artifact_closed';
}
+ $return .=
html_ao('span',array('id'=>'parent'.$parent->getID()));
$return .= '<br/> ';
$return .= util_make_link($url, $text, $arg).'
'.util_make_link($url, $parent->getSummary());
+ if (!$readonly) {
+ $return .= $HTML->getMinusPic(_('Click
to remove parent'), _('Click to remove parent'), array('class'=>'removeparent',
'data-id'=>$parent->getID()));
+ }
+ $return .= html_ac(html_ap()-1);
}
$return .= '</td>
</tr>
@@ -292,6 +312,10 @@ function hide_edit_button(id) {
function showDependencies() {
global $HTML;
+ global $atid;
+ if (!forge_check_perm('tracker', $atid, 'submit')) {
+ $readonly = true;
+ }
$return = '';
$ef_parent =
$this->getArtifactType()->getExtraFields(array(ARTIFACT_EXTRAFIELDTYPE_PARENT));
if (count($ef_parent)) {
@@ -299,22 +323,26 @@ function hide_edit_button(id) {
$return .= html_ao('div',array('class'=>'fullwidth'));
$return .=
html_e('strong',array(),_('Parent')).html_e('br');
$return .= $this->showParent();
- if ($this->hasParent()) {
- $return .=
html_ao('div',array('class'=>'fullwidth addparent hide'));
- } else {
- $return .=
html_ao('div',array('class'=>'fullwidth addparent'));
+ if (!$readonly) {
+ if ($this->hasParent()) {
+ $return .=
html_ao('div',array('class'=>'fullwidth addparent hide'));
+ } else {
+ $return .=
html_ao('div',array('class'=>'fullwidth addparent'));
+ }
+ $return .= html_e('input',
array('type'=>'text', 'id'=>'parent_id', 'value'=>'', 'size'=>20,
'maxlength'=>80, 'pattern'=>'^(?!'.$this->getID().'$)\d*$'));
+ $return .= $HTML->getAddPic(_('Click to add
parent'), _('Click to add parent'), array('class'=>'addparent')).html_e('br');
+ $return .= html_ac(html_ap()-1);
}
- $return .= html_e('input', array('type'=>'text',
'id'=>'parent_id', 'value'=>'', 'size'=>20, 'maxlength'=>80,
'pattern'=>'^(?!'.$this->getID().'$)\d*$'));
- $return .= $HTML->getAddPic(_('Click to add parent'),
_('Click to add parent'), array('name'=>'addparent')).html_e('br');
- $return .= html_ac(html_ap()-1);
$return .= html_ac(html_ap()-1).html_e('br');
$return .= html_ao('div',array('class'=>'fullwidth'));
$return .=
html_e('strong',array(),_('Children')).html_e('br');
$return .= $this->showChildren();
- $return .= html_ao('div',array('class'=>'fullwidth
addchild'));
- $return .= html_e('input', array('type'=>'text',
'id'=>'child_id', 'value'=>'', 'size'=>20, 'maxlength'=>80,
'pattern'=>'^(?!'.$this->getID().'$)\d*$'));
- $return .= $HTML->getAddPic(_('Click to add child'),
_('Click to add child'), array('name'=>'addchild'));
- $return .= html_ac(html_ap()-1);
+ if (!$readonly) {
+ $return .=
html_ao('div',array('class'=>'fullwidth addchild'));
+ $return .= html_e('input',
array('type'=>'text', 'id'=>'child_id', 'value'=>'', 'size'=>20,
'maxlength'=>80, 'pattern'=>'^(?!'.$this->getID().'$)\d*$'));
+ $return .= $HTML->getAddPic(_('Click to add
child'), _('Click to add child'), array('class'=>'addchild'));
+ $return .= html_ac(html_ap()-1);
+ }
$return .= html_ac(html_ap()-1);
}
return $return;
diff --git a/src/common/tracker/include/ArtifactTypeHtml.class.php
b/src/common/tracker/include/ArtifactTypeHtml.class.php
index 9442251..d4ea019 100644
--- a/src/common/tracker/include/ArtifactTypeHtml.class.php
+++ b/src/common/tracker/include/ArtifactTypeHtml.class.php
@@ -1652,10 +1652,7 @@ EOS;
});
});
-
-
-
- $("img[name='addparent']").click(function(){
+ $("img.addparent").click(function(){
$.ajax({
type: 'POST',
url: 'index.php',
@@ -1671,14 +1668,16 @@ EOS;
$("div#show"+answer['parent_efid']).html(answer['parent_link']);
$("input#parent_id").val('');
$("div.addparent").addClass('hide');
+ $("img.removeparent").click(function(){
+
removeParent($(this).data("id"));
+ });
}
return true;
}
});
});
-
- $("img[name='addchild']").click(function(){
+ $("img.addchild").click(function(){
$.ajax({
type: 'POST',
url: 'index.php',
@@ -1691,6 +1690,9 @@ EOS;
} else {
$("table.children").replaceWith(answer['children']);
$("input#child_id").val('');
+ $("img.removechild").click(function(){
+ removeChild($(this).data("id"));
+ });
}
return true;
}
@@ -1698,6 +1700,50 @@ EOS;
});
+ $("img.removeparent").click(function(){
+ removeParent($(this).data("id"));
+ });
+
+ function removeParent(id) {
+ $.ajax({
+ type: 'POST',
+ url: 'index.php',
+ data:
'rtype=ajax&function=remove_parent&group_id='+groupId+'&atid='+atId+'&aid='+$("input#aid").val()+'&parent_id='+id,
+ async: false,
+ dataType: 'json',
+ success: function(answer){
+ if(answer['message']) {
+ showMessage(answer['message'], 'error');
+ } else {
+ $("span#parent"+id).remove();
+ $("div.addparent").removeClass('hide');
+ }
+ return true;
+ }
+ });
+ };
+
+ $("img.removechild").click(function(){
+ removeChild($(this).data("id"));
+ });
+
+ function removeChild(id) {
+ $.ajax({
+ type: 'POST',
+ url: 'index.php',
+ data:
'rtype=ajax&function=remove_child&group_id='+groupId+'&atid='+atId+'&aid='+$("input#aid").val()+'&child_id='+id,
+ async: false,
+ dataType: 'json',
+ success: function(answer){
+ if(answer['message']) {
+ showMessage(answer['message'], 'error');
+ } else {
+ $("span#child"+id).remove();
+ }
+ return true;
+ }
+ });
+ };
$(".autoassign[name^='extra_fields']").change(function(){
if ($(this).prop('tagName') == 'SELECT') {
var elmnts = $(this).children('option:selected');
diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index d9fa28d..4ca8af0 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -1025,6 +1025,10 @@ abstract class Layout extends FFError {
return $this->getPicto('ic/add-16.png', $title, $alt, 16, 16,
$otherAttr);
}
+ function getMinusPic($title = '', $alt = '', $otherAttr = array()) {
+ return $this->getPicto('ic/minus-16.png', $title, $alt, 16, 16,
$otherAttr);
+ }
+
function getFolderPic($title = '', $alt = '', $otherAttr = array()) {
return $this->getPicto('ic/folder.png', $title, $alt, 20, 20,
$otherAttr);
}
diff --git a/src/www/themes/funky-wOw/images/ic/minus-16.png
b/src/www/themes/funky-wOw/images/ic/minus-16.png
new file mode 100644
index 0000000..c58e4b7
Binary files /dev/null and b/src/www/themes/funky-wOw/images/ic/minus-16.png
differ
diff --git a/src/www/themes/funky/images/ic/minus-16.png
b/src/www/themes/funky/images/ic/minus-16.png
new file mode 100644
index 0000000..c58e4b7
Binary files /dev/null and b/src/www/themes/funky/images/ic/minus-16.png differ
-----------------------------------------------------------------------
Summary of changes:
src/common/tracker/Artifact.class.php | 28 ++++++++++
src/common/tracker/actions/ajax.php | 31 ++++++++++-
src/common/tracker/include/ArtifactHtml.class.php | 50 ++++++++++++++----
.../tracker/include/ArtifactTypeHtml.class.php | 58 ++++++++++++++++++---
src/www/include/Layout.class.php | 4 ++
src/www/themes/funky-wOw/images/ic/minus-16.png | Bin 0 -> 426 bytes
src/www/themes/funky/images/ic/minus-16.png | Bin 0 -> 426 bytes
7 files changed, 152 insertions(+), 19 deletions(-)
create mode 100644 src/www/themes/funky-wOw/images/ic/minus-16.png
create mode 100644 src/www/themes/funky/images/ic/minus-16.png
hooks/post-receive
--
FusionForge
_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits