예제 #1
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.
/**
 * @package MantisBT
 * @copyright Copyright (C) 2002 - 2013  MantisBT Team - mantisbt-dev@lists.sourceforge.net
 * @link http://www.mantisbt.org
 */
/**
 * MantisBT Core API's
 */
require_once 'core.php';
/**
 * requires tag_api
 */
require_once 'tag_api.php';
form_security_validate('tag_detach');
$f_tag_id = gpc_get_int('tag_id');
$f_bug_id = gpc_get_int('bug_id');
tag_bug_detach($f_tag_id, $f_bug_id);
event_signal('EVENT_TAG_DETACHED', array($f_bug_id, array($f_tag_id)));
form_security_purge('tag_detach');
print_successful_redirect_to_bug($f_bug_id);
예제 #2
0
파일: tag_api.php 프로젝트: Kirill/mantisbt
/**
 * Detach all tags from a given bug.
 * @param integer Bug ID
 * @param boolean Add history entries to bug
 * @param integer User Id (or null for current logged in user)
 */
function tag_bug_detach_all($p_bug_id, $p_add_history = true, $p_user_id = null)
{
    $t_tags = tag_bug_get_attached($p_bug_id);
    foreach ($t_tags as $t_tag_row) {
        tag_bug_detach($t_tag_row['id'], $p_bug_id, $p_add_history, $p_user_id);
    }
}
예제 #3
0
function mci_tag_set_for_issue($p_issue_id, $p_tags, $p_user_id)
{
    $t_tag_ids_to_attach = array();
    $t_tag_ids_to_detach = array();
    $t_submitted_tag_ids = array();
    $t_attached_tags = tag_bug_get_attached($p_issue_id);
    $t_attached_tag_ids = array();
    foreach ($t_attached_tags as $t_attached_tag) {
        $t_attached_tag_ids[] = $t_attached_tag['id'];
    }
    foreach ($p_tags as $t_tag) {
        $t_tag = SoapObjectsFactory::unwrapObject($t_tag);
        $t_submitted_tag_ids[] = $t_tag['id'];
        if (in_array($t_tag['id'], $t_attached_tag_ids)) {
            continue;
        } else {
            $t_tag_ids_to_attach[] = $t_tag['id'];
        }
    }
    foreach ($t_attached_tag_ids as $t_attached_tag_id) {
        if (in_array($t_attached_tag_id, $t_submitted_tag_ids)) {
            continue;
        } else {
            $t_tag_ids_to_detach[] = $t_attached_tag_id;
        }
    }
    foreach ($t_tag_ids_to_detach as $t_tag_id) {
        if (access_has_bug_level(config_get('tag_detach_threshold'), $p_issue_id, $p_user_id)) {
            tag_bug_detach($t_tag_id, $p_issue_id);
        }
    }
    foreach ($t_tag_ids_to_attach as $t_tag_id) {
        if (access_has_bug_level(config_get('tag_attach_threshold'), $p_issue_id, $p_user_id)) {
            tag_bug_attach($t_tag_id, $p_issue_id);
        }
    }
}
예제 #4
0
파일: mc_tag_api.php 프로젝트: gtn/mantisbt
/**
 * Set tag(s) for a given issue id
 * @param integer $p_issue_id Issue id.
 * @param array   $p_tags     Array of tags.
 * @param integer $p_user_id  User id.
 * @return void
 */
function mci_tag_set_for_issue($p_issue_id, array $p_tags, $p_user_id)
{
    $t_tag_ids_to_attach = array();
    $t_tag_ids_to_detach = array();
    $t_submitted_tag_ids = array();
    $t_attached_tags = tag_bug_get_attached($p_issue_id);
    $t_attached_tag_ids = array();
    foreach ($t_attached_tags as $t_attached_tag) {
        $t_attached_tag_ids[] = $t_attached_tag['id'];
    }
    foreach ($p_tags as $t_tag) {
        $t_tag = SoapObjectsFactory::unwrapObject($t_tag);
        $t_submitted_tag_ids[] = $t_tag['id'];
        if (in_array($t_tag['id'], $t_attached_tag_ids)) {
            continue;
        } else {
            $t_tag_ids_to_attach[] = $t_tag['id'];
        }
    }
    foreach ($t_attached_tag_ids as $t_attached_tag_id) {
        if (in_array($t_attached_tag_id, $t_submitted_tag_ids)) {
            continue;
        } else {
            $t_tag_ids_to_detach[] = $t_attached_tag_id;
        }
    }
    foreach ($t_tag_ids_to_detach as $t_tag_id) {
        if (access_has_bug_level(config_get('tag_detach_threshold'), $p_issue_id, $p_user_id)) {
            log_event(LOG_WEBSERVICE, 'detaching tag id \'' . $t_tag_id . '\' from issue \'' . $p_issue_id . '\'');
            tag_bug_detach($t_tag_id, $p_issue_id);
        }
    }
    foreach ($t_tag_ids_to_attach as $t_tag_id) {
        if (access_has_bug_level(config_get('tag_attach_threshold'), $p_issue_id, $p_user_id)) {
            log_event(LOG_WEBSERVICE, 'attaching tag id \'' . $t_tag_id . '\' to issue \'' . $p_issue_id . '\'');
            tag_bug_attach($t_tag_id, $p_issue_id);
        }
    }
}