"MDL-17316, supported flickr_public plugin working in non-js filepicker"

This commit is contained in:
dongsheng 2009-06-18 07:58:37 +00:00
parent e78e71fd61
commit 78ff29832d
2 changed files with 73 additions and 3 deletions

View File

@ -80,6 +80,46 @@ case 'deletedraft':
}
exit;
break;
case 'search':
try {
$search_result = $repo->search($search_text);
$search_result['search_result'] = true;
$search_result['repo_id'] = $repo_id;
echo '<table>';
foreach ($search_result['list'] as $item) {
echo '<tr>';
echo '<td><img src="'.$item['thumbnail'].'" />';
echo '</td><td>';
if (!empty($item['url'])) {
echo '<a href="'.$item['url'].'" target="_blank">'.$item['title'].'</a>';
} else {
echo $item['title'];
}
echo '</td>';
echo '<td>';
if (!isset($item['children'])) {
echo '<form method="post">';
echo '<input type="hidden" name="file" value="'.$item['source'].'"/>';
echo '<input type="hidden" name="action" value="confirm"/>';
echo '<input type="hidden" name="title" value="'.$item['title'].'"/>';
echo '<input type="hidden" name="icon" value="'.$item['thumbnail'].'"/>';
echo '<input type="submit" value="'.get_string('select','repository').'" />';
echo '</form>';
} else {
echo '<form method="post">';
echo '<input type="hidden" name="p" value="'.$item['path'].'"/>';
echo '<input type="submit" value="'.get_string('enter', 'repository').'" />';
echo '</form>';
}
echo '</td>';
echo '<td width="100px" align="center">';
echo '</td>';
echo '</td></tr>';
}
echo '</table>';
} catch (repository_exception $e) {
}
break;
case 'list':
case 'sign':
print_header();
@ -141,9 +181,9 @@ case 'sign':
}
} else {
echo '<form method="post">';
$repo->print_login();
echo '<input type="hidden" name="action" value="sign" />';
echo '<input type="hidden" name="repo_id" value="'.$repo_id.'" />';
$repo->print_login();
echo '</form>';
}
print_footer('empty');

View File

@ -109,8 +109,8 @@ class repository_flickr_public extends repository {
* @param boolean $ajax
* @return array
*/
public function print_login($ajax = true) {
if ($ajax) {
public function print_login() {
if ($this->options['ajax']) {
$ret = array();
$fulltext = new stdclass;
$fulltext->label = get_string('fulltext', 'repository_flickr_public').': ';
@ -153,6 +153,36 @@ class repository_flickr_public extends repository {
$ret['login_btn_label'] = get_string('search');
$ret['login_btn_action'] = 'search';
return $ret;
} else {
echo '<table>';
echo '<tr><td><label>'.get_string('fulltext', 'repository_flickr_public').'</label></td>';
echo '<td><input type="text" name="flickr_fulltext" /></td></tr>';
echo '<tr><td><label>'.get_string('tag', 'repository_flickr_public').'</label></td>';
echo '<td><input type="text" name="flickr_tag" /></td></tr>';
echo '<tr><td><label>'.get_string('username', 'repository_flickr_public').'</label></td>';
echo '<td><input type="text" name="flickr_account" /></td></tr>';
echo '<tr><td><label>'.get_string('license', 'repository_flickr_public').'</label></td>';
echo '<td>';
echo '<input type="radio" name="flickr_license" value="all" /> '.get_string('all', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_license" value="1" /> '.get_string('by-nc-sa', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_license" value="2" /> '.get_string('by-nc', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_license" value="3" /> '.get_string('by-nc-nd', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_license" value="4" /> '.get_string('by', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_license" value="5" /> '.get_string('by-sa', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_license" value="6" /> '.get_string('by-nd', 'repository_flickr_public');
echo '</td></tr>';
echo '</table>';
echo '<input type="hidden" name="action" value="search" />';
echo '<input type="submit" value="Search" />';
}
}