Skip to content

Commit

Permalink
"MDL-17316, supported flickr_public plugin working in non-js filepicker"
Browse files Browse the repository at this point in the history
  • Loading branch information
dongsheng committed Jun 18, 2009
1 parent e78e71f commit 78ff298
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 3 deletions.
42 changes: 41 additions & 1 deletion repository/filepicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,46 @@
}
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();
Expand Down Expand Up @@ -141,9 +181,9 @@
}
} 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');
Expand Down
34 changes: 32 additions & 2 deletions repository/flickr_public/repository.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ public function check_login() {
* @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').': ';
Expand Down Expand Up @@ -153,6 +153,36 @@ public function print_login($ajax = true) {
$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" />';
}
}

Expand Down

0 comments on commit 78ff298

Please sign in to comment.