function HookLegacy_actionsSearchAdd_search_title_links() { global $baseurl, $baseurl_short, $lang, $search, $k, $userrequestmode, $collection_download, $contact_sheet, $manage_collections_contact_sheet_link, $manage_collections_share_link, $allow_share, $manage_collections_remove_link, $username, $collection_purge, $show_edit_all_link, $edit_all_checkperms, $preview_all, $order_by, $sort, $archive, $collectiondata, $result, $search_title, $display, $search_title_links; // extra collection title links if (substr($search, 0, 11) == "!collection") { if ($k == "" && !checkperm("b") && ($userrequestmode != 2 && $userrequestmode != 3)) { $search_title_links = "<div class='CollectionTitleLinks'>"; if ($k == "" && !checkperm("b") && ($userrequestmode != 2 && $userrequestmode != 3)) { $search_title_links .= '<a href="#" onclick="ChangeCollection(' . $collectiondata["ref"] . ', \'\');">> ' . $lang["selectcollection"] . '</a>'; } if (isset($zipcommand) || $collection_download) { $search_title_links .= "<a onClick='return CentralSpaceLoad(this,true);' href='" . $baseurl_short . "pages/terms.php?url=" . urlencode("pages/collection_download.php?collection=" . $collectiondata["ref"]) . "'>> " . $lang["action-download"] . "</a>"; } if ($contact_sheet == true && $manage_collections_contact_sheet_link) { $search_title_links .= "<a onClick='return CentralSpaceLoad(this,true);' href='" . $baseurl_short . "pages/contactsheet_settings.php?ref=" . urlencode($collectiondata["ref"]) . "'>> " . $lang["contactsheet"] . "</a>"; } if ($manage_collections_share_link && $allow_share && (checkperm("v") || checkperm("g"))) { $search_title_links .= " <a href='" . $baseurl_short . "pages/collection_share.php?ref=" . $collectiondata["ref"] . "' onClick='return CentralSpaceLoad(this,true);'>> " . $lang["share"] . "</a>"; } if ($manage_collections_remove_link && $username != $collectiondata["username"]) { $search_title_links .= " <a href='#' onclick=\" if(confirm('" . $lang["removecollectionareyousure"] . "')){document.getElementById('collectionremove').value='" . urlencode($collectiondata["ref"]) . "';document.getElementById('collectionform').submit();} return false;\">> " . $lang["action-remove"] . "</a>"; } if (($username == $collectiondata["username"] || checkperm("h")) && $collectiondata["cant_delete"] == 0) { $search_title_links .= " <a href='#'' onclick=\"if (confirm('" . $lang["collectiondeleteconfirm"] . "')) {document.getElementById('collectiondelete').value='" . urlencode($collectiondata["ref"]) . "';CentralSpacePost(document.getElementById('collectionform'),false);} return false;\">> " . $lang["action-delete"] . "</a>"; } if ($collection_purge) { if ($n == 0) { $search_title_links .= "<input type=hidden name='purge' id='collectionpurge' value=''>"; } if (isset($collections) && checkperm("e0") && $collectiondata["cant_delete"] == 0) { $search_title_links .= " <a href='#' onclick=\"if (confirm('" . $lang["purgecollectionareyousure"] . "')){document.getElementById('collectionpurge').value='" . urlencode($collections[$n]["ref"]) . "';document.getElementById('collectionform').submit();} return false;\">> " . $lang["purgeanddelete"] . "</a>"; } } hook('additionalcollectiontool'); if ($username == $collectiondata["username"] || checkperm("h")) { $search_title_links .= "<a href='" . $baseurl_short . "pages/collection_edit.php?ref=" . urlencode($collectiondata["ref"]) . "' onClick='return CentralSpaceLoad(this,true);' >> " . $lang["action-edit"] . "</a>"; } # If this collection is (fully) editable, then display an edit all link if ($show_edit_all_link && count($result) > 0) { if (!$edit_all_checkperms || allow_multi_edit($collectiondata["ref"])) { $search_title_links .= " <a href='" . $baseurl_short . "pages/edit.php?collection=" . urlencode($collectiondata["ref"]) . "' onClick='return CentralSpaceLoad(this,true);'>> " . $lang["action-editall"] . "</a>"; } } if ($username == $collectiondata["username"] || checkperm("h")) { $search_title_links .= "<a href='" . $baseurl_short . "pages/collection_log.php?ref=" . urlencode($collectiondata["ref"]) . "' onClick='return CentralSpaceLoad(this,true);'>> " . $lang["log"] . "</a>"; } hook("addcustomtool"); $search_title_links .= "</div>"; // END INSERT } if (count($result) != 0 && $k == "" && $preview_all) { $search_title_links .= '<a href="' . $baseurl_short . 'pages/preview_all.php?ref=' . $collectiondata["ref"] . '&order_by=' . urlencode($order_by) . '&sort=' . urlencode($sort) . '&archive=' . urlencode($archive) . '&k=' . urlencode($k) . '">> ' . $lang['preview_all'] . '</a>'; } if ($display != "list") { $search_title_links .= '<br />'; } } }
echo $baseurl_short; ?> pages/collection_edit.php?ref=<?php echo urlencode($collections[$n]["ref"]); ?> " onClick="return CentralSpaceLoad(this,true);" >> <?php echo $lang["action-edit"]; ?> </a><?php } ?> <?php # If this collection is (fully) editable, then display an edit all link if ($show_edit_all_link && $collections[$n]["count"] > 0) { if (allow_multi_edit($collections[$n]["ref"])) { ?> <a href="<?php echo $baseurl_short; ?> pages/edit.php?collection=<?php echo urlencode($collections[$n]["ref"]); ?> " onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["action-editall"]; ?> </a> <?php } } ?>
function compile_collection_actions(array $collection_data, $top_actions) { global $baseurl_short, $lang, $k, $userrequestmode, $zipcommand, $collection_download, $contact_sheet, $manage_collections_contact_sheet_link, $manage_collections_share_link, $allow_share, $manage_collections_remove_link, $userref, $collection_purge, $show_edit_all_link, $result, $edit_all_checkperms, $preview_all, $order_by, $sort, $archive, $contact_sheet_link_on_collection_bar, $show_searchitemsdiskusage, $emptycollection, $remove_resources_link_on_collection_bar, $count_result, $download_usage, $home_dash, $top_nav_upload_type, $pagename, $offset, $col_order_by, $find, $default_sort, $starsearch, $restricted_share; $options = array(); $o = 0; if (empty($collection_data)) { return $options; } if (!collection_is_research_request($collection_data['ref']) || !checkperm('r')) { if (!$top_actions && checkperm('s') && $pagename === 'collections') { // Manage My Collections $data_attribute['url'] = $baseurl_short . 'pages/collection_manage.php'; $options[$o]['value'] = 'manage_collections'; $options[$o]['label'] = $lang['managemycollections']; $options[$o]['data_attr'] = $data_attribute; $o++; // Collection feedback if (isset($collection_data['request_feedback']) && $collection_data['request_feedback']) { $data_attribute['url'] = sprintf('%spages/collection_feedback.php?collection=%s&k=%s', $baseurl_short, urlencode($collection_data['ref']), urlencode($k)); $options[$o]['value'] = 'collection_feedback'; $options[$o]['label'] = $lang['sendfeedback']; $options[$o]['data_attr'] = $data_attribute; $o++; } } } else { $research = sql_value('SELECT ref value FROM research_request WHERE collection="' . $collection_data['ref'] . '";', 0); // Manage research requests $data_attribute['url'] = sprintf('%spages/team/team_research.php', $baseurl_short); $options[$o]['value'] = 'manage_research_requests'; $options[$o]['label'] = $lang['manageresearchrequests']; $options[$o]['data_attr'] = $data_attribute; $o++; // Edit research requests $data_attribute['url'] = sprintf('%spages/team/team_research_edit.php?ref=%s', $baseurl_short, urlencode($research)); $options[$o]['value'] = 'edit_research_requests'; $options[$o]['label'] = $lang['editresearchrequests']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Select collection option - not for collection bar if ($pagename != 'collections' && $k == '' && !checkperm('b') && ($pagename == 'themes' || $pagename === 'collection_manage' || $pagename === 'resource_collection_list' || $top_actions)) { $options[$o]['value'] = 'select_collection'; $options[$o]['label'] = $lang['selectcollection']; $o++; } // Edit Collection if ($userref == $collection_data['user'] || checkperm('h')) { $extra_tag_attributes = sprintf(' data-url="%spages/collection_edit.php?ref=%s" ', $baseurl_short, urlencode($collection_data['ref'])); $options[$o]['value'] = 'edit_collection'; $options[$o]['label'] = $lang['action-edit']; $options[$o]['data_attr'] = array(); $options[$o]['extra_tag_attributes'] = $extra_tag_attributes; $o++; } // Upload to collection if ((checkperm('c') || checkperm('d')) && $collection_data['savedsearch'] == 0 && ($userref == $collection_data['user'] || $collection_data['allow_changes'] == 1 || checkperm('h'))) { $data_attribute['url'] = sprintf('%spages/edit.php?uploader=%s&ref=-%s&collection_add=%s', $baseurl_short, urlencode($top_nav_upload_type), urlencode($userref), urlencode($collection_data['ref'])); $options[$o]['value'] = 'upload_collection'; $options[$o]['label'] = $lang['action-upload-to-collection']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Home_dash is on, AND NOT Anonymous use, AND (Dash tile user (NOT with a managed dash) || Dash Tile Admin) if (!$top_actions && $home_dash && checkPermission_dashcreate()) { $data_attribute['url'] = sprintf(' %spages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection%s&order_by=relevance&sort=DESC ', $baseurl_short, $collection_data['ref']); $options[$o]['value'] = 'save_collection_to_dash'; $options[$o]['label'] = $lang['createnewdashtile']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Request all if ($count_result > 0) { # Ability to request a whole collection (only if user has restricted access to any of these resources) $min_access = collection_min_access($result); if ($min_access != 0) { $data_attribute['url'] = sprintf('%spages/collection_request.php?ref=%s&k=%s', $baseurl_short, urlencode($collection_data['ref']), urlencode($k)); $options[$o]['value'] = 'request_all'; $options[$o]['label'] = $lang['requestall']; $options[$o]['data_attr'] = $data_attribute; $o++; } } // Download option if ($download_usage && ((isset($zipcommand) || $collection_download) && $count_result > 0)) { $data_attribute['url'] = $baseurl_short . "pages/terms.php?k=" . urlencode($k) . "&url=pages/download_usage.php?collection=" . urlencode($collection_data['ref']) . "%26k=" . urlencode($k); $options[$o]['value'] = 'download_collection'; $options[$o]['label'] = $lang['action-download']; $options[$o]['data_attr'] = $data_attribute; $o++; } else { if ((isset($zipcommand) || $collection_download) && $count_result > 0) { $data_attribute['url'] = $baseurl_short . "pages/terms.php?k=" . urlencode($k) . "&url=pages/collection_download.php?collection=" . urlencode($collection_data['ref']) . "%26k=" . urlencode($k); $options[$o]['value'] = 'download_collection'; $options[$o]['label'] = $lang['action-download']; $options[$o]['data_attr'] = $data_attribute; $o++; } else { if (isset($zipcommand) || $collection_download) { $data_attribute['url'] = $baseurl_short . "pages/terms.php?k=" . urlencode($k) . "&url=pages/collection_download.php?collection=" . urlencode($collection_data['ref']) . "%26k=" . urlencode($k); $options[$o]['value'] = 'download_collection'; $options[$o]['label'] = $lang['action-download']; $options[$o]['data_attr'] = $data_attribute; $o++; } } } // Contact Sheet if ($k == "" && $contact_sheet == true && ($manage_collections_contact_sheet_link || $contact_sheet_link_on_collection_bar)) { $data_attribute = array('url' => sprintf('%spages/contactsheet_settings.php?ref=%s', $baseurl_short, urlencode($collection_data['ref']))); $options[$o]['value'] = 'contact_sheet'; $options[$o]['label'] = $lang['contactsheet']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Share if ($k == "" && $manage_collections_share_link && $allow_share && (checkperm('v') || checkperm('g') || collection_min_access($collection_data['ref']) <= 1 && $restricted_share)) { $extra_tag_attributes = sprintf(' data-url="%spages/collection_share.php?ref=%s" ', $baseurl_short, urlencode($collection_data['ref'])); $options[$o]['value'] = 'share_collection'; $options[$o]['label'] = $lang['share']; $options[$o]['data_attr'] = array(); $options[$o]['extra_tag_attributes'] = $extra_tag_attributes; $o++; } // Remove if ($k == "" && $manage_collections_remove_link && $userref != $collection_data['user']) { $options[$o]['value'] = 'remove_collection'; $options[$o]['label'] = $lang['action-remove']; $o++; } // Delete if ($k == "" && ($userref == $collection_data['user'] || checkperm('h')) && $collection_data['cant_delete'] == 0) { $options[$o]['value'] = 'delete_collection'; $options[$o]['label'] = $lang['action-delete']; $o++; } // Collection Purge if ($k == "" && $collection_purge && isset($collections) && checkperm('e0') && $collection_data['cant_delete'] == 0) { $options[$o]['value'] = 'purge_collection'; $options[$o]['label'] = $lang['purgeanddelete']; $o++; } // Collection log if ($k == "" && $userref == $collection_data['user'] || checkperm('h')) { $extra_tag_attributes = sprintf(' data-url="%spages/collection_log.php?ref=%s" ', $baseurl_short, urlencode($collection_data['ref'])); $options[$o]['value'] = 'collection_log'; $options[$o]['label'] = $lang['action-log']; $options[$o]['data_attr'] = array(); $options[$o]['extra_tag_attributes'] = $extra_tag_attributes; $o++; } // View all if ($k == "" && (isset($collection_data["c"]) && $collection_data["c"] > 0) || count($result) > 0) { $data_attribute['url'] = $baseurl_short . 'pages/search.php?search=!collection' . urlencode($collection_data['ref']) . "&k=" . urlencode($k); $options[$o]['value'] = 'view_all_resources_in_collection'; $options[$o]['label'] = $lang['view_all_resources']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Edit all # If this collection is (fully) editable, then display an edit all link if ($k == "" && $show_edit_all_link && count($result) > 0) { if (!$edit_all_checkperms || allow_multi_edit($collection_data['ref'])) { $extra_tag_attributes = sprintf(' data-url="%spages/edit.php?collection=%s" ', $baseurl_short, urlencode($collection_data['ref'])); $options[$o]['value'] = 'edit_all_in_collection'; $options[$o]['label'] = $lang['edit_all_resources']; $options[$o]['data_attr'] = array(); $options[$o]['extra_tag_attributes'] = $extra_tag_attributes; $o++; } } // Delete all // Note: functionality moved from edit collection page if ($k == "" && !$top_actions && (count($result) != 0 || $count_result != 0) && !(isset($allow_resource_deletion) && !$allow_resource_deletion) && collection_writeable($collection_data['ref']) && allow_multi_edit($collection_data['ref']) && !checkperm('D')) { $options[$o]['value'] = 'delete_all_in_collection'; $options[$o]['label'] = $lang['deleteallresourcesfromcollection']; $o++; } // Preview all if (count($result) != 0 && $k == '' && $preview_all) { $extra_tag_attributes = sprintf(' data-url="%spages/preview_all.php?ref=%s" ', $baseurl_short, urlencode($collection_data['ref'])); $options[$o]['value'] = 'preview_all'; $options[$o]['label'] = $lang['preview_all']; $options[$o]['data_attr'] = array(); $options[$o]['extra_tag_attributes'] = $extra_tag_attributes; $o++; } // Remove all if ($k == '' && isset($emptycollection) && $remove_resources_link_on_collection_bar && collection_writeable($collection_data['ref'])) { $data_attribute['url'] = sprintf('%spages/collections.php?emptycollection=%s&removeall=true&submitted=removeall&ajax=true', $baseurl_short, urlencode($collection_data['ref'])); $options[$o]['value'] = 'empty_collection'; $options[$o]['label'] = $lang['emptycollection']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Edit Previews if ($k == '' && $count_result > 0 && ($userref == $collection_data['user'] || $collection_data['allow_changes'] == 1 || checkperm('h')) && allow_multi_edit($collection_data['ref'])) { $main_pages = array('search', 'collection_manage', 'collection_public', 'themes'); $back_to_page = in_array($pagename, $main_pages) ? htmlspecialchars($pagename) : ''; $data_attribute['url'] = sprintf('%spages/collection_edit_previews.php?ref=%s&offset=%s&order_by=%s&col_order_by=<%s&sort=%s&find=%s&backto=%s', $baseurl_short, urlencode($collection_data['ref']), urlencode($offset), urlencode($order_by), urlencode($col_order_by), urlencode($sort), urlencode($find), $back_to_page); $options[$o]['value'] = 'edit_previews'; $options[$o]['label'] = $lang['editcollectionresources']; $options[$o]['data_attr'] = $data_attribute; $o++; } // Show disk usage if ($k == '' && !$top_actions && $show_searchitemsdiskusage) { $extra_tag_attributes = sprintf(' data-url="%spages/search_disk_usage.php?search=!collection%s&k=%s" ', $baseurl_short, urlencode($collection_data['ref']), urlencode($k)); $options[$o]['value'] = 'search_items_disk_usage'; $options[$o]['label'] = $lang['collection_disk_usage']; $options[$o]['data_attr'] = array(); $options[$o]['extra_tag_attributes'] = $extra_tag_attributes; $o++; } // CSV export of collection metadata if (!$top_actions && $k == '') { if (empty($order_by)) { $order_by = $default_sort; } $options[$o]['value'] = 'csv_export_results_metadata'; $options[$o]['label'] = $lang['csvExportResultsMetadata']; $options[$o]['data_attr']['url'] = sprintf('%spages/csv_export_results_metadata.php?search=!collection%s&restype=%s&order_by=%s&archive=0&sort=%s&starsearch=%s', $baseurl_short, urlencode($collection_data['ref']), isset($_COOKIE['restypes']) ? urlencode($_COOKIE['restypes']) : '', urlencode($order_by), urlencode($sort), urlencode($starsearch)); $o++; } // Add extra collection actions and manipulate existing actions through plugins $modified_options = hook('render_actions_add_collection_option', '', array($top_actions, $options)); if (is_array($modified_options) && !empty($modified_options)) { $options = $modified_options; } return $options; }
function HookLegacy_actionsCollection_manageLegacy_list_tools($collection_data) { global $baseurl_short, $lang, $autoshow_thumbs, $download_usage, $collection_download, $contact_sheet, $manage_collections_contact_sheet_link, $manage_collections_share_link, $allow_share, $manage_collections_remove_link, $username, $collection_purge, $home_dash, $anonymous_login, $show_edit_all_link, $edit_all_checkperms; ?> <a href="<?php echo $baseurl_short; ?> pages/search.php?search=<?php echo urlencode('!collection' . $collection_data['ref']); ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['viewall']; ?> </a> <a href="<?php echo $baseurl_short; ?> pages/collections.php?collection=<?php echo urlencode($collection_data['ref']); if ($autoshow_thumbs) { echo '&thumbs=show'; } ?> " onClick="ChangeCollection(<?php echo $collection_data['ref']; ?> , ''); return false;">> <?php echo $lang['action-select']; ?> </a> <?php if ($download_usage && (isset($zipcommand) || $collection_download)) { ?> <a href="<?php echo $baseurl_short; ?> pages/terms.php?url=<?php echo urlencode('pages/download_usage.php?collection=' . $collection_data['ref']); ?> ">> <?php echo $lang['action-download']; ?> </a> <?php } else { if (isset($zipcommand) || $collection_download) { ?> <a href="<?php echo $baseurl_short; ?> pages/terms.php?url=<?php echo urlencode('pages/collection_download.php?collection=' . $collection_data['ref']); ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['action-download']; ?> </a> <?php } } if ($contact_sheet == true && $manage_collections_contact_sheet_link) { ?> <a href="<?php echo $baseurl_short; ?> pages/contactsheet_settings.php?ref=<?php echo urlencode($collection_data['ref']); ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['contactsheet']; ?> </a> <?php } if ($manage_collections_share_link && $allow_share && (checkperm('v') || checkperm('g'))) { ?> <a href="<?php echo $baseurl_short; ?> pages/collection_share.php?ref=<?php echo $collection_data['ref']; ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['share']; ?> </a> <?php } /*Remove Shared Collection*/ if ($manage_collections_remove_link && $username != $collection_data['username']) { ?> <a href="#" onclick="if(confirm('<?php echo $lang["removecollectionareyousure"]; ?> ')) {document.getElementById('collectionremove').value='<?php echo urlencode($collection_data["ref"]); ?> '; document.getElementById('collectionform').submit();} return false;">> <?php echo $lang['action-remove']; ?> </a> <?php } if (($username == $collection_data['username'] || checkperm('h')) && $collection_data['cant_delete'] == 0) { ?> <a href="#" onclick="if(confirm('<?php echo $lang["collectiondeleteconfirm"]; ?> ')) {document.getElementById('collectiondelete').value='<?php echo urlencode($collection_data["ref"]); ?> '; passQueryStrings(['paging', 'col_order_by', 'sort', 'find', 'go', 'offset'], 'collectionform'); CentralSpacePost(document.getElementById('collectionform'),false);} return false;">> <?php echo $lang['action-delete']; ?> </a> <?php } if ($collection_purge) { if ($n == 0) { ?> <input id="collectionpurge" type=hidden name="purge" value=""> <?php } if (checkperm('e0') && $collection_data['cant_delete'] == 0) { ?> <a href="#" onclick="if(confirm('<?php echo $lang["purgecollectionareyousure"]; ?> ')) {document.getElementById('collectionpurge').value='<?php echo urlencode($collection_data["ref"]); ?> ';document.getElementById('collectionform').submit();} return false;">> <?php echo $lang['purgeanddelete']; ?> </a> <?php } } hook('additionalcollectiontool'); if ($username == $collection_data['username'] || checkperm('h')) { ?> <a href="<?php echo $baseurl_short; ?> pages/collection_edit.php?ref=<?php echo urlencode($collection_data['ref']); ?> " onClick="return CentralSpaceLoad(this, true);" >> <?php echo $lang['action-edit']; ?> </a> <?php } # If this collection is (fully) editable, then display an edit all link if ($show_edit_all_link && $collection_data['count'] > 0) { if (!$edit_all_checkperms || allow_multi_edit($collection_data['ref'])) { ?> <a href="<?php echo $baseurl_short; ?> pages/edit.php?collection=<?php echo urlencode($collection_data['ref']); ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['action-editall']; ?> </a> <?php } } #Home_dash is on, And not Anonymous use, And (Dash tile user (Not with a managed dash) || Dash Tile Admin) if ($home_dash && checkPermission_dashcreate()) { ?> <a href="<?php echo $baseurl_short; ?> pages/dash_tile.php?create=true&tltype=srch&promoted_resource=true&freetext=true&all_users=1&link=/pages/search.php?search=!collection<?php echo urlencode($collection_data['ref']); ?> &order_by=relevance&sort=DESC" onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['dashtile']; ?> </a> <?php } if ($username == $collection_data['username'] || checkperm('h')) { ?> <a href="<?php echo $baseurl_short; ?> pages/collection_log.php?ref=<?php echo urlencode($collection_data['ref']); ?> &order_by=relevance&sort=DESC" onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['log']; ?> </a> <?php } hook('addcustomtool'); }
function HookLegacy_actionsResource_collection_listRender_resource_collection_list_list_tools($collection_data) { global $baseurl_short, $lang, $autoshow_thumbs, $collection_download, $contact_sheet, $allow_share, $username, $show_edit_all_link; ?> <a href="<?php echo $baseurl_short; ?> pages/search.php?search=<?php echo urlencode('!collection' . $collection_data['ref']); ?> ">> <?php echo $lang['viewall']; ?> </a> <?php if (!checkperm('b')) { ?> <a href="<?php echo $baseurl_short; ?> pages/collections.php?collection=<?php echo $collection_data['ref']; if ($autoshow_thumbs) { echo "&thumbs=show"; } ?> " onClick="return CollectionDivLoad(this);">> <?php echo $lang['action-select']; ?> </a> <?php } if (isset($zipcommand) || $collection_download) { ?> <a href="<?php echo $baseurl_short; ?> pages/terms.php?url=<?php echo urlencode('pages/collection_download.php?collection=' . $collection_download['ref']); ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['action-download']; ?> </a> <?php } if ($contact_sheet == true) { ?> <a href="<?php echo $baseurl_short; ?> pages/contactsheet_settings.php?ref=<?php echo $collection_data['ref']; ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['contactsheet']; ?> </a> <?php } if ($allow_share && (checkperm('v') || checkperm('g'))) { ?> <a href="<?php echo $baseurl_short; ?> pages/collection_share.php?ref=<?php echo $collection_data['ref']; ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['share']; ?> </a> <?php } if ($username == $collection_data['username'] || checkperm('h')) { ?> <a href="<?php echo $baseurl_short; ?> pages/collection_edit.php?ref=<?php echo $collection_data['ref']; ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['action-edit']; ?> </a> <?php } # If this collection is (fully) editable, then display an edit all link if ($collection_data['count'] > 0 && allow_multi_edit($collection_data['ref']) && $show_edit_all_link) { ?> <a href="<?php echo $baseurl_short; ?> pages/edit.php?collection=<?php echo $collection_data['ref']; ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['action-editall']; ?> </a> <?php } if ($username == $collection_data['username'] || checkperm('h')) { ?> <a href="<?php echo $baseurl_short; ?> pages/collection_log.php?ref=<?php echo $collection_data['ref']; ?> " onClick="return CentralSpaceLoad(this, true);">> <?php echo $lang['log']; ?> </a> <?php } }
} } $collection = getvalescaped("collection", "", true); if ($collection != "") { # If editing multiple items, use the first resource as the template $multiple = true; $edit_autosave = false; # Do not allow auto saving for batch editing. $items = get_collection_resources($collection); if (count($items) == 0) { $error = $lang['error-cannoteditemptycollection']; error_alert($error); exit; } # check editability if (!allow_multi_edit($collection)) { $error = $lang['error-permissiondenied']; error_alert($error); exit; } $ref = $items[0]; } else { $multiple = false; } # Fetch resource data. $resource = get_resource_data($ref); # Allow alternative configuration settings for this resource type. resource_type_config_override($resource["resource_type"]); # If upload template, check if the user has upload permission. if ($ref < 0 && !(checkperm("c") || checkperm("d"))) { $error = $lang['error-permissiondenied'];
$collection = $usercollection; $colresult = $result; } } } if ($pagename == "search" && isset($resources) && is_array($resources)) { $colresult = $resources; $cinfo = get_collection($collections[$n]['ref']); $feedback = $cinfo["request_feedback"]; $collection_results = true; $collection = $collections[$n]['ref']; } $count_result = count($colresult); // check editability $col_editable = false; if (count($colresult) > 0 && checkperm("e" . $colresult[0]["archive"]) && allow_multi_edit($colresult)) { $col_editable = true; } if ($pagename != "collection_manage" && $pagename != "collection_public" && $pagename != "themes") { ?> <form method="get" name="colactions" id="colactions" action="collections_compact_style.php"> <?php } if ($pagename == "search" || $pagename == "collections") { ?> <?php hook("beforecollectiontoolscolumn"); if (!hook("modifycompacttoolslabel")) { echo $lang['tools'] . ":"; }
?> <a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short; ?> pages/collection_edit.php?ref=<?php echo $collections[$n]["ref"]; ?> ">> <?php echo $lang["action-edit"]; ?> </a> <?php } ?> <?php # If this collection is (fully) editable, then display an edit all link if ($collections[$n]["count"] > 0 && allow_multi_edit($collections[$n]["ref"]) && $show_edit_all_link) { ?> <a onClick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short; ?> pages/edit.php?collection=<?php echo $collections[$n]["ref"]; ?> ">> <?php echo $lang["action-editall"]; ?> </a> <?php } ?> <?php
function HookLegacy_actionsAllAftertogglethumbs() { global $baseurl_short, $lang, $usercollection, $contact_sheet, $allow_share, $cinfo, $userref, $preview_all, $feedback, $k, $result, $collection_download, $count_result, $disable_collection_toggle; ?> <ul style="float: right;"> <?php if (!collection_is_research_request($usercollection) || !checkperm('r')) { hook('beforecollectionminlinks'); if (checkperm('s')) { if ($contact_sheet == true) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/contactsheet_settings.php?ref=<?php echo urlencode($usercollection); ?> "> <?php echo $lang['contactsheet']; ?> </a></li> <?php } if ($allow_share) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/collection_share.php?ref=<?php echo urlencode($usercollection); ?> "><?php echo $lang['share']; ?> </a></li> <?php } if ($userref == $cinfo['user'] || checkperm('h')) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/collection_edit.php?ref=<?php echo urlencode($usercollection); ?> "> <?php echo $allow_share ? $lang['action-edit'] : $lang['editcollection']; ?> </a></li> <?php } if ($preview_all) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/preview_all.php?ref=<?php echo urlencode($usercollection); ?> "><?php echo $lang['preview_all']; ?> </a></li> <?php } hook('collectiontool2min'); if ($feedback) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/collection_feedback.php?collection=<?php echo urlencode($usercollection); ?> &k=<?php echo urlencode($k); ?> "> <?php echo $lang['sendfeedback']; ?> </a></li> <?php } } } else { if (!hook('replacecollectionsresearchlinks')) { $research = sql_value("SELECT ref value FROM research_request WHERE collection = '" . $usercollection . "'", 0); ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/team/team_research.php"><?php echo $lang['manageresearchrequests']; ?> </a></li> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/team/team_research_edit.php?ref=<?php echo urlencode($research); ?> "><?php echo $lang['editresearchrequests']; ?> </a></li> <?php } /* end hook replacecollectionsresearchlinks */ } # If this collection is (fully) editable, then display an extra edit all link if (count($result) > 0 && checkperm('e' . $result[0]['archive']) && allow_multi_edit($result)) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/search.php?search=<?php echo urlencode('!collection' . $usercollection); ?> "><?php echo $lang['viewall']; ?> </a></li> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/edit.php?collection=<?php echo $usercollection; ?> "><?php echo $lang['action-editall']; ?> </a></li> <?php } else { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/search.php?search=<?php echo urlencode('!collection' . $usercollection); ?> "><?php echo $lang['viewall']; ?> </a></li> <?php } echo isset($emptycollection) && $remove_resources_link_on_collection_bar && collection_writeable($usercollection) ? '<li><a href="' . $baseurl_short . 'pages/collections.php?emptycollection=' . urlencode($usercollection) . '&removeall=true&submitted=removeall&ajax=true" onclick="if(!confirm(\'' . $lang['emptycollectionareyousure'] . '\')){return false;}return CollectionDivLoad(this);">' . $lang['emptycollection'] . '</a></li>' : ''; if ((isset($zipcommand) || $collection_download) && $count_result > 0) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/terms.php?k=<?php echo $k; ?> &url=<?php echo urlencode("pages/collection_download.php?collection=" . $usercollection . "&k=" . $k); ?> "><?php echo $lang['action-download']; ?> </a></li> <?php } if ($count_result > 0 && $k == '' && checkperm('q')) { # Ability to request a whole collection (only if user has restricted access to any of these resources) $min_access = collection_min_access($result); if ($min_access != 0) { ?> <li><a onclick="return CentralSpaceLoad(this, true);" href="<?php echo $baseurl_short; ?> pages/collection_request.php?ref=<?php echo urlencode($usercollection); ?> "><?php echo $lang['action-request']; ?> </a></li> <?php } } hook('collectiontoolmin'); ?> </ul> <?php }
include "../include/authenticate.php"; #if (!checkperm("s")) {exit ("Permission denied.");} if (checkperm("b")) { exit("Permission denied."); } include_once "../include/collections_functions.php"; include "../include/resource_functions.php"; include "../include/search_functions.php"; $ref = getvalescaped("ref", "", true); $copycollectionremoveall = getvalescaped("copycollectionremoveall", ""); $offset = getval("offset", 0); $find = getvalescaped("find", ""); $col_order_by = getvalescaped("col_order_by", "name"); $sort = getval("sort", "ASC"); # Does this user have edit access to collections? Variable will be found in functions below. $multi_edit = allow_multi_edit($ref); # Check access if (!collection_writeable($ref)) { exit($lang["no_access_to_collection"]); } # Fetch collection data $collection = get_collection($ref); if ($collection === false) { $error = $lang['error-collectionnotfound']; error_alert($error); exit; } $resources = do_search("!collection" . $ref); $colcount = count($resources); # Collection copy functionality $copy = getval("copy", "");
} if ($collection_purge) { if ($n == 0) { $search_title_links .= "<input type=hidden name='purge' id='collectionpurge' value=''>"; } if (isset($collections) && checkperm("e0") && $collectiondata["cant_delete"] == 0) { $search_title_links .= " <a href='#' onclick=\"if (confirm('" . $lang["purgecollectionareyousure"] . "')){document.getElementById('collectionpurge').value='" . urlencode($collections[$n]["ref"]) . "';document.getElementById('collectionform').submit();} return false;\">> " . $lang["purgeanddelete"] . "</a>"; } } hook('additionalcollectiontool'); if ($username == $collectiondata["username"] || checkperm("h")) { $search_title_links .= "<a href='" . $baseurl_short . "pages/collection_edit.php?ref=" . urlencode($collectiondata["ref"]) . "' onClick='return CentralSpaceLoad(this,true);' >> " . $lang["action-edit"] . "</a>"; } # If this collection is (fully) editable, then display an edit all link if ($show_edit_all_link && count($result) > 0) { if (!$edit_all_checkperms || allow_multi_edit($collectiondata["ref"])) { $search_title_links .= " <a href='" . $baseurl_short . "pages/edit.php?collection=" . urlencode($collectiondata["ref"]) . "' onClick='return CentralSpaceLoad(this,true);'>> " . $lang["action-editall"] . "</a>"; } } if ($username == $collectiondata["username"] || checkperm("h")) { $search_title_links .= "<a href='" . $baseurl_short . "pages/collection_log.php?ref=" . urlencode($collectiondata["ref"]) . "' onClick='return CentralSpaceLoad(this,true);'>> " . $lang["log"] . "</a>"; } hook("addcustomtool"); $search_title_links .= "</div>"; // END INSERT */ } if (count($result) != 0 && $k == "" && $preview_all) { $search_title_links .= '<a href="' . $baseurl_short . 'pages/preview_all.php?ref=' . $collectiondata["ref"] . '&order_by=' . $order_by . '&sort=' . $sort . '&archive=' . $archive . '&k=' . $k . '">> ' . $lang['preview_all'] . '</a>'; } $search_title .= '</div>'; if ($display != "list") {
} if (checkperm("e0") && $collections[$n]["cant_delete"] == 0) { ?> <a href="#" onclick="if (confirm('<?php echo $lang["purgecollectionareyousure"]?>')) {document.getElementById('collectionpurge').value='<?php echo urlencode($collections[$n]["ref"]) ?>';document.getElementById('collectionform').submit();} return false;">> <?php echo $lang["purgeanddelete"]?></a><?php } } ?> <?php hook('additionalcollectiontool') ?> <?php if (($username==$collections[$n]["username"]) || (checkperm("h"))) {?> <a href="<?php echo $baseurl_short?>pages/collection_edit.php?ref=<?php echo urlencode($collections[$n]["ref"]) ?>" onClick="return CentralSpaceLoad(this,true);" >> <?php echo $lang["action-edit"]?></a><?php } ?> <?php # If this collection is (fully) editable, then display an edit all link if ($show_edit_all_link && ($collections[$n]["count"] > 0)) { if (allow_multi_edit($collections[$n]["ref"])) { ?> <a href="<?php echo $baseurl_short?>pages/edit.php?collection=<?php echo urlencode($collections[$n]["ref"]) ?>" onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["action-editall"]?></a> <?php } } ?> <?php if (($username==$collections[$n]["username"]) || (checkperm("h"))) {?><a href="<?php echo $baseurl_short?>pages/collection_log.php?ref=<?php echo urlencode($collections[$n]["ref"]) ?>" onClick="return CentralSpaceLoad(this,true);">> <?php echo $lang["log"]?></a><?php } ?> <?php hook("addcustomtool"); ?> </td> </tr><?php } } ?> <input type=hidden name="deleteempty" id="collectiondeleteempty" value="">
<?php if ($preview_all){?><li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/preview_all.php?ref=<?php echo urlencode($usercollection) ?>"><?php echo $lang["preview_all"]?></a></li><?php } ?> <?php hook('collectiontool2min');?> <?php if ($feedback) {?><li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/collection_feedback.php?collection=<?php echo urlencode($usercollection)?>&k=<?php echo urlencode($k) ?>"> <?php echo $lang["sendfeedback"]?></a></li><?php } ?> <?php } ?> <?php } else { if (!hook("replacecollectionsresearchlinks")){ $research=sql_value("select ref value from research_request where collection='$usercollection'",0); ?> <li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/team/team_research.php"><?php echo $lang["manageresearchrequests"]?></a></li> <li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/team/team_research_edit.php?ref=<?php echo urlencode($research) ?>"><?php echo $lang["editresearchrequests"]?></a></li> <?php } /* end hook replacecollectionsresearchlinks */ ?> <?php } ?> <?php # If this collection is (fully) editable, then display an extra edit all link if ((count($result)>0) && checkperm("e" . $result[0]["archive"]) && allow_multi_edit($result)) { ?> <li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/search.php?search=<?php echo urlencode("!collection" . $usercollection)?>"><?php echo $lang["viewall"]?></a></li> <li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/edit.php?collection=<?php echo $usercollection?>"><?php echo $lang["action-editall"]?></a></li> <?php } else { ?> <li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/search.php?search=<?php echo urlencode("!collection" . $usercollection)?>"><?php echo $lang["viewall"]?></a></li> <?php } ?> <?php if ((isset($zipcommand) || $collection_download) && $count_result>0) { ?> <li><a onclick="return CentralSpaceLoad(this,true);" href="<?php echo $baseurl_short?>pages/terms.php?k=<?php echo $k?>&url=<?php echo urlencode("pages/collection_download.php?collection=" . $usercollection . "&k=" . $k)?>"><?php echo $lang["action-download"]?></a></li> <?php } ?> <?php if ($count_result>0 && $k=="" && checkperm("q")) { # Ability to request a whole collection (only if user has restricted access to any of these resources) $min_access=collection_min_access($result); if ($min_access!=0) { ?>
function save_collection($ref) { global $theme_category_levels; if (!collection_writeable($ref)) { return false; } $allow_changes = getval("allow_changes", "") != "" ? 1 : 0; # Next line disabled as it seems incorrect to override the user's setting here. 20071217 DH. #if ($theme!="") {$allow_changes=0;} # lock allow changes to off if this is a theme # Update collection with submitted form data if (!hook('modifysavecollection')) { $sql = "update collection set\n\t\t\t\tname='" . getvalescaped("name", "") . "',\n\t\t\t\t" . hook('savecollectionadditionalfields') . "\n\t\t\t\tkeywords='" . getvalescaped("keywords", "") . "',\n\t\t\t\tpublic='" . getvalescaped("public", "", true) . "',"; for ($n = 1; $n <= $theme_category_levels; $n++) { if ($n == 1) { $themeindex = ""; } else { $themeindex = $n; } $themes[$n] = getvalescaped("theme{$themeindex}", ""); if (getval("newtheme{$themeindex}", "") != "") { $themes[$n] = trim(getvalescaped("newtheme{$themeindex}", "")); } if (isset($themes[$n])) { $sql .= "theme" . $themeindex . "='" . $themes[$n] . "',"; } } $sql .= "allow_changes='" . $allow_changes . "'"; if (checkperm("h")) { $sql .= "\n\t\t\t,home_page_publish='" . (getvalescaped("home_page_publish", "") != "" ? "1" : "0") . "'\n\t\t\t,home_page_text='" . getvalescaped("home_page_text", "") . "'"; if (getval("home_page_image", "") != "") { $sql .= ",home_page_image='" . getvalescaped("home_page_image", "") . "'"; } } $modified_sql = hook('morehomepagepublishsave', "", array($sql)); if (!empty($modified_sql)) { $sql = $modified_sql; } $sql .= " where ref='{$ref}'"; sql_query($sql); } # end replace hook - modifysavecollection index_collection($ref); # If 'users' is specified (i.e. access is private) then rebuild users list $users = getvalescaped("users", false); if ($users !== false) { sql_query("delete from user_collection where collection='{$ref}'"); #log this collection_log($ref, "T", 0, '#all_users'); if ($users != "") { # Build a new list and insert $users = resolve_userlist_groups($users); $ulist = array_unique(trim_array(explode(",", $users))); $urefs = sql_array("select ref value from user where username in ('" . join("','", $ulist) . "')"); if (count($urefs) > 0) { sql_query("insert into user_collection(collection,user) values ({$ref}," . join("),(" . $ref . ",", $urefs) . ")"); } #log this collection_log($ref, "S", 0, join(", ", $ulist)); } } # Relate all resources? if (getval("relateall", "") != "") { $rlist = get_collection_resources($ref); for ($n = 0; $n < count($rlist); $n++) { for ($m = 0; $m < count($rlist); $m++) { if ($rlist[$n] != $rlist[$m]) { sql_query("delete from resource_related where resource='" . $rlist[$n] . "' and related='" . $rlist[$m] . "'"); sql_query("insert into resource_related (resource,related) values ('" . $rlist[$n] . "','" . $rlist[$m] . "')"); } } } } # Remove all resources? if (getval("removeall", "") != "") { remove_all_resources_from_collection($ref); } # Delete all resources? if (getval("deleteall", "") != "" && !checkperm("D")) { if (allow_multi_edit($ref)) { delete_resources_in_collection($ref); } } # Update limit count for saved search if (isset($_POST["result_limit"])) { sql_query("update collection_savedsearch set result_limit='" . getvalescaped("result_limit", "") . "' where collection='{$ref}'"); } refresh_collection_frame(); }
</div> <strong><?php echo count($result); ?> </strong> <?php echo $lang["resourcesincollection"]; ?> </div> <!--Menu--> <div id="CollectionFramelessNav"> <ul> <?php # If this collection is (fully) editable, then display an extra edit all link if (allow_multi_edit($usercollection)) { ?> <li class="clearerleft"><a href="<?php echo $baseurl_short; ?> pages/search.php?search=<?php echo urlencode("!collection" . $usercollection); ?> &k=<?php echo isset($k) ? $k : ""; ?> ">> <?php echo $lang["viewall"]; ?> </a></li> <li><a href="<?php