/** * @param $menu menu list need to show as list * @param $parm a list of parameters to add to the URL. * @param $uploadId upload id */ public static function menuToActiveSelect($menu, &$parm, $uploadId = "") { if (empty($menu)) { return ''; } $showFullName = isset($_SESSION) && array_key_exists('fullmenudebug', $_SESSION) && $_SESSION['fullmenudebug'] == 1; $optionsOut = ""; foreach ($menu as $Val) { if (!empty($Val->HTML)) { $entry = $Val->HTML; } else { if (!empty($Val->URI)) { if (!empty($uploadId) && "tag" == $Val->URI) { $tagstatus = TagStatus($uploadId); if (0 == $tagstatus) { // tagging on this upload is disabled break; } } $entry = '<option value="' . Traceback_uri() . '?mod=' . $Val->URI . '&' . $parm . '"'; if (!empty($Val->Title)) { $entry .= ' title="' . htmlentities($Val->Title, ENT_QUOTES) . '"'; } $entry .= '>' . $Val->getName($showFullName) . '</option>'; } else { $entry = "<option>" . $Val->getName($showFullName) . "</option>"; } } $optionsOut .= $entry; } if (plugin_find_id('showjobs') >= 0) { $optionsOut .= '<option value="' . Traceback_uri() . '?mod=showjobs&upload=' . $uploadId . '" title="' . _("Scan History") . '" >' . _("History") . '</option>'; } return '<select class="goto-active-option"><option>-- select action --</option>' . $optionsOut . '</select>'; }
/** * \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; }
/** * \brief Take a menu and render it as * one HTML line with items in a "[name]" list. * This ignores submenus! * * \param $Menu menu list need to show as list * \param $Parm a list of parameters to add to the URL. * \param $Pre string before "[name]" * \param $Post string after "[name]" * \param $ShowAll If $ShowAll==0, then items without hyperlinks are hidden. * \param $upload_id upload id * * \return one HTML line with items in a "[name]" list */ function menu_to_1list($Menu, &$Parm, $Pre = "", $Post = "", $ShowAll = 1, $upload_id = "") { $V = ""; $Std = ""; if (!empty($Menu)) { foreach ($Menu as $Val) { if (!empty($Val->HTML)) { $V .= $Pre; $V .= $Val->HTML; $V .= $Post; } else { if (!empty($Val->URI)) { if (!empty($upload_id) && "tag" == $Val->URI) { $tagstatus = TagStatus($upload_id); if (0 == $tagstatus) { break; } // tagging on this upload is disabled } $V .= $Pre; $V .= "[<a href='" . Traceback_uri() . "?mod=" . $Val->URI . "&" . $Parm . "'"; if (!empty($Val->Title)) { $V .= " title='" . htmlentities($Val->Title, ENT_QUOTES) . "'"; } $V .= ">"; if (@$_SESSION['fullmenudebug'] == 1) { $V .= $Val->FullName . "(" . $Val->Order . ")"; } else { $V .= $Val->Name; } $V .= "</a>]"; $V .= $Post; } else { if ($ShowAll) { $V .= $Pre; $V .= "["; if (@$_SESSION['fullmenudebug'] == 1) { $V .= $Val->FullName . "(" . $Val->Order . ")"; } else { $V .= $Val->Name; } $V .= "]"; $V .= $Post; } } } } } return $V; }
/** * \brief Take a menu and render it as * one HTML line with items in a "[name]" list. * This ignores submenus! * * \param $Menu menu list need to show as list * \param $Parm a list of parameters to add to the URL. * \param $Pre string before "[name]" * \param $Post string after "[name]" * \param $ShowAll If $ShowAll==0, then items without hyperlinks are hidden. * \param $upload_id upload id * * \return one HTML line with items in a "[name]" list */ function menu_to_1list($Menu, &$Parm, $Pre = "", $Post = "", $ShowAll = 1, $upload_id = "") { if (empty($Menu)) { return ''; } $showFullName = isset($_SESSION) && array_key_exists('fullmenudebug', $_SESSION) && $_SESSION['fullmenudebug'] == 1; $V = ""; foreach ($Menu as $Val) { if (!empty($Val->HTML)) { $entry = $Val->HTML; } else { if (!empty($Val->URI)) { if (!empty($upload_id) && "tag" == $Val->URI) { $tagstatus = TagStatus($upload_id); if (0 == $tagstatus) { break; } // tagging on this upload is disabled } $entry = "[<a href='" . Traceback_uri() . "?mod=" . $Val->URI . "&" . $Parm . "'"; if (!empty($Val->Title)) { $entry .= " title='" . htmlentities($Val->Title, ENT_QUOTES) . "'"; } $entry .= ">"; $entry .= $Val->getName($showFullName); $entry .= "</a>]"; } else { if ($ShowAll) { $entry = "[" . $Val->getName($showFullName) . "]"; } else { continue; } } } $V .= $Pre . $entry . $Post; } return $V; }