1<?php 2/* vim:set softtabstop=4 shiftwidth=4 expandtab: */ 3/** 4 * 5 * LICENSE: GNU Affero General Public License, version 3 (AGPL-3.0-or-later) 6 * Copyright 2001 - 2020 Ampache.org 7 * 8 * This program is free software: you can redistribute it and/or modify 9 * it under the terms of the GNU Affero General Public License as published by 10 * the Free Software Foundation, either version 3 of the License, or 11 * (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU Affero General Public License for more details. 17 * 18 * You should have received a copy of the GNU Affero General Public License 19 * along with this program. If not, see <https://www.gnu.org/licenses/>. 20 * 21 */ 22 23use Ampache\Config\AmpConfig; 24use Ampache\Module\Art\Collector\ArtCollector; 25use Ampache\Module\System\Core; 26use Ampache\Module\Util\Ui; 27 28?> 29<?php 30$keywords = $item->get_keywords(); 31$limit = AmpConfig::get('art_search_limit', ArtCollector::ART_SEARCH_LIMIT); 32$art_order = AmpConfig::get('art_order', array()); 33$art_type = ($object_type == 'album') ? T_('Cover Art Search') : T_('Artist Art Search'); 34UI::show_box_top($art_type, 'box box_get_albumart'); ?> 35<form enctype="multipart/form-data" name="coverart" method="post" action="<?php echo AmpConfig::get('web_path'); ?>/arts.php?action=find_art&object_type=<?php echo $object_type; ?>&object_id=<?php echo $object_id; ?>&burl=<?php echo base64_encode($burl); ?>&artist_name=<?php echo urlencode(Core::get_request('artist_name')); ?>&album_name=<?php echo urlencode(Core::get_request('album_name')); ?>&cover=<?php echo urlencode(Core::get_request('cover')); ?>" style="Display:inline;"> 36 <table class="gatherart"> 37 <?php 38 foreach ($keywords as $key => $word) { 39 if ($key == 'year') { 40 $year_str = (string)$word['value']; 41 continue; 42 } 43 if (($key != 'mb_albumid_group' && $key != 'mb_artistid') && ($key != 'keyword' && $word['label'])) { ?> 44 <tr> 45 <td> 46 <?php echo $word['label']; ?> 47 </td> 48 <td> 49 <input type="text" 50 id="option_<?php echo $key . '"'; ?> 51 name="option_<?php echo $key; ?>" 52 value="<?php echo scrub_out(unhtmlentities($word['value'])); ?>" 53 <?php 54 if ($key == 'album') { 55 echo ' required'; 56 } elseif ($key == 'artist') { 57 if ($object_type == 'artist') { 58 echo 'required'; 59 } 60 } 61 ?> 62 /> 63 </td> 64 </tr> 65 <?php 66 } 67 } ?> 68 <tr> 69 <td> 70 <?php echo T_('Direct URL to Image'); ?> 71 </td> 72 <td><input type="url" id="cover" name="cover" value="" /></td> 73 </tr> 74 <tr> 75 <td> 76 <?php echo T_('Local Image'); ?> (< <?php echo Ui::format_bytes(AmpConfig::get('max_upload_size')); ?>) 77 </td> 78 <td> 79 <input type="file" id="file" name="file" value="" /> 80 </td> 81 </tr> 82 <?php 83 if (in_array('spotify', $art_order)) { 84 if ($object_type == 'album') {?> 85 <tr> 86 <th class="center" rowspan="3" style> 87 <?php echo T_('Spotify Album Filters'); ?> 88 </th> 89 <td> 90 <label for="for artistFilter"><?php echo T_('Artist'); ?></label> 91 <input type="checkbox" id="artistFilter" 92 name="artist_filter" value="artist" 93 onchange="validateArtist()"> 94 </td> 95 </tr> 96 <tr> 97 <td> 98 <label id="gatherYear" for="yearFilter"><?php echo T_('Year'); ?> </label> 99 <input type="text" id="yearFilter" name="year_filter" size="5" maxlength="9" pattern="[0-9]{4}(-[0-9]{4})?" value="<?php echo $year_str; ?>"> 100 <label><?php echo T_("(e.g. '2001', '2001-2005')"); ?></label> 101 </td> 102 </tr> 103 <tr> 104 <td> 105 <label id="gatherLimit" for="searchLimit"> <?php echo T_('Limit'); ?></label> 106 <input type="number" id="searchLimit" 107 name="search_limit" required min="1" max="50" value="<?php echo $limit; ?>"> 108 </td> 109 </tr> 110 <?php } ?> 111 <tr> 112 <?php if ($object_type == 'artist') { ?> 113 <td> 114 <?php echo T_('Search Limit'); ?> 115 </td> 116 <td> 117 <input type="number" id="searchLimit" 118 name="search_limit" required min="1" max="50" value="<?php echo $limit; ?>"> 119 </td> 120 121 <?php } 122 } else { ?> 123 <td> 124 </td> 125 <?php } ?> 126 <td> 127 </td> 128 </tr> 129 </table> 130 <div class="formValidation"> 131 <input type="hidden" name="action" value="find_art" /> 132 <input type="hidden" name="object_type" value="<?php echo $object_type; ?>" /> 133 <input type="hidden" name="object_id" value="<?php echo $object_id; ?>" /> 134 <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo AmpConfig::get('max_upload_size'); ?>" /> 135 <?php if (AmpConfig::get('ajax_load')) { 136 $cancelurl = ((string) AmpConfig::get('web_path') == '') ? $burl : (AmpConfig::get('web_path') . '/' . $burl); 137 } else { 138 $cancelurl = (string) $burl; 139 } 140 ?> 141 <input type="button" value="<?php echo T_('Cancel'); ?>" onClick="NavigateTo('<?php echo $cancelurl; ?>');" /> 142 <input type="submit" value="<?php echo T_('Get Art'); ?>" /> 143 </div> 144</form> 145<?php UI::show_box_bottom(); ?> 146<script> 147 function validateArtist() 148 { 149 var artist = document.getElementById('option_artist'); 150 151 var checked = document.getElementById('artistFilter').checked; 152 if (checked == true) { 153 artist.setAttribute("required", "true"); 154 } else { 155 artist.removeAttribute('required'); 156 } 157 } 158</script>