コード例 #1
0
ファイル: ajax-tags.php プロジェクト: DanielDobre/fossology
 /**
  * \brief Display the loaded menu and plugins.
  */
 function Output()
 {
     $V = "";
     $item = GetParm("uploadtree_pk", PARM_INTEGER);
     /* get uploadtree_tablename from $Item */
     $uploadtreeRec = GetSingleRec("uploadtree", "where uploadtree_pk='{$item}'");
     $uploadRec = GetSingleRec("upload", "where upload_pk='{$uploadtreeRec['upload_fk']}'");
     if (empty($uploadRec['uploadtree_tablename'])) {
         $uploadtree_tablename = "uploadtree";
     } else {
         $uploadtree_tablename = $uploadRec['uploadtree_tablename'];
     }
     $List = GetAllTags($item, true, $uploadtree_tablename);
     foreach ($List as $L) {
         $V .= $L['tag_name'] . ",";
     }
     return new Response($V, Response::HTTP_OK, array('content-type' => 'text/plain'));
 }
コード例 #2
0
 /**
  * \brief Display the loaded menu and plugins.
  */
 function Output()
 {
     if ($this->State != PLUGIN_STATE_READY) {
         return;
     }
     $V = "";
     global $Plugins;
     switch ($this->OutputType) {
         case "XML":
             break;
         case "HTML":
             $Item = GetParm("uploadtree_pk", PARM_INTEGER);
             /* get uploadtree_tablename from $Item */
             $uploadtreeRec = GetSingleRec("uploadtree", "where uploadtree_pk='{$Item}'");
             $uploadRec = GetSingleRec("upload", "where upload_pk='{$uploadtreeRec['upload_fk']}'");
             if (empty($uploadRec['uploadtree_tablename'])) {
                 $uploadtree_tablename = "uploadtree";
             } else {
                 $uploadtree_tablename = $uploadRec['uploadtree_tablename'];
             }
             $List = GetAllTags($Item, true, $uploadtree_tablename);
             foreach ($List as $L) {
                 $V .= $L['tag_name'] . ",";
             }
             break;
         case "Text":
             break;
         default:
             break;
     }
     if (!$this->OutputToStdout) {
         return $V;
     }
     print "{$V}";
     return;
 }
コード例 #3
0
		} else {
			document.getElementById(element).innerHTML="";
		}
	}
}

function confirmDelete(m,c,date,t) {
	if (confirm(t)) {
	      document.location = "edit_channel.php?c=" + c + "&delete=" + m + "&date=" + date
	}
} 

$(function() {
	var availableTags = [
		<?php 
$tags = GetAllTags($dbh);
for ($i = 0; $i < sizeof($tags); $i++) {
    echo "\"" . $tags[$i] . "\"";
    if ($i == sizeof($tags) - 1) {
    } else {
        echo ",";
    }
}
?>
	];
	function split( val ) {
		return val.split( /,\s*/ );
	}
	function extractLast( term ) {
		return split( term ).pop();
	}
コード例 #4
0
/**
 * \brief get list of links: [View][Info][Download]
 *
 * \param $upload_fk - upload id
 * \param $uploadtree_pk - uploadtree id
 * \param $napk - nomos agent pk
 * \param $pfile_pk
 * \param $Recurse true if links should propapagate recursion.  Currently,
 *        this means that the displayed tags will be displayed for directory contents.
 * \param $UniqueTagArray - cumulative array of unique tags
 * \param $uploadtree_tablename
 * \param $wantTags - if true add [Tag] ...
 *
 *        For example:
 * \verbatim  Array
 *        (
 *          [0] => Array
 *            (
 *                [tag_pk] => 5
 *                [tag_name] => GPL false positive
 *            )
 *        )
 * \endverbatim
 * \param $uploadtree_tablename for $upload_fk
 *
 * \returns String containing the links [View][Info][Download][Tag {tags}]
 */
function FileListLinks($upload_fk, $uploadtree_pk, $napk, $pfile_pk, $Recurse = True, &$UniqueTagArray = array(), $uploadtree_tablename = "uploadtree", $wantTags = true)
{
    $LinkStr = "";
    if ($pfile_pk) {
        $text = _("View");
        $text1 = _("Info");
        $text2 = _("Download");
        $LinkStr .= "[<a href='" . Traceback_uri() . "?mod=view-license&upload={$upload_fk}&item={$uploadtree_pk}&napk={$napk}' >{$text}</a>]";
        $LinkStr .= "[<a href='" . Traceback_uri() . "?mod=view_info&upload={$upload_fk}&item={$uploadtree_pk}&show=detail' >{$text1}</a>]";
        $LinkStr .= "[<a href='" . Traceback_uri() . "?mod=download&upload={$upload_fk}&item={$uploadtree_pk}' >{$text2}</a>]";
    }
    /********  Tag  ********/
    if ($wantTags && TagStatus($upload_fk)) {
        $TagArray = GetAllTags($uploadtree_pk, $Recurse, $uploadtree_tablename);
        $TagStr = "";
        foreach ($TagArray as $TagPair) {
            /* Build string of tags for this item */
            if (!empty($TagStr)) {
                $TagStr .= ",";
            }
            $TagStr .= " " . $TagPair['tag_name'];
            /* Update $UniqueTagArray */
            $found = false;
            foreach ($UniqueTagArray as $UTA_key => $UTA_row) {
                if ($TagPair['tag_pk'] == $UTA_row['tag_pk']) {
                    $found = true;
                    break;
                }
            }
            if (!$found) {
                $UniqueTagArray[] = $TagPair;
            }
        }
        $text3 = _("Tag");
        $LinkStr .= "[<a href='" . Traceback_uri() . "?mod=tag&upload={$upload_fk}&item={$uploadtree_pk}' >{$text3}</a>";
        $LinkStr .= "<span style='color:#2897B7'>";
        $LinkStr .= $TagStr;
        $LinkStr .= "</span>";
        $LinkStr .= "]";
    }
    return $LinkStr;
}
コード例 #5
0
ファイル: common-tags.php プロジェクト: DanielDobre/fossology
/**
 * \brief Given a list of uploadtree recs, remove recs that do not have $tag_pk.
 *
 * \param $UploadtreeRows This array may be modified by this function.
 * \param $tag_pk
 * \param $uploadtree_tablename
 *
 *\return none
 */
function TagFilter(&$UploadtreeRows, $tag_pk, $uploadtree_tablename)
{
    foreach ($UploadtreeRows as $key => $UploadtreeRow) {
        $found = false;
        $tags = GetAllTags($UploadtreeRow["uploadtree_pk"], true, $uploadtree_tablename);
        foreach ($tags as $tagArray) {
            if ($tagArray['tag_pk'] == $tag_pk) {
                $found = true;
                break;
            }
            if ($found) {
                break;
            }
        }
        if ($found == false) {
            unset($UploadtreeRows[$key]);
        }
    }
}
コード例 #6
0
ファイル: HTMLGeneration.php プロジェクト: anujpareek/OldCode
/**
 * Generates a list of all of the active tags in the DB and encases them in a div.
 * 
 * @return string
 *                a div of all the active tags in the DB
 */
function GenerateFilters($currentTag)
{
    return '<div id = "filters">' . implode(GetAllTags($currentTag), '') . '</div>';
}