Skip to content

Commit

Permalink
repository/flickr_public MDL-15488 Make the search form a lot simpler…
Browse files Browse the repository at this point in the history
… and friendlier
  • Loading branch information
moodler committed Dec 2, 2009
1 parent 5363905 commit 640bb8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
8 changes: 4 additions & 4 deletions lang/en_utf8/repository_flickr_public.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
$string['by'] = 'Attribution License';
$string['by-sa'] = 'Attribution-ShareAlike License';
$string['by-nd'] = 'Attribution-NoDerivs License';
$string['commercialuse'] = 'Allow commercial uses of your work?';
$string['commercialuse'] = 'I want to be able to use the images commercially';
$string['creativecommonscommercial'] = 'Only creative commons commercial';
$string['emailaddress'] = 'Email address';
$string['fulltext'] = 'Full text';
$string['flickr_public:view'] = 'View flickr_public repository';
$string['information'] = '<div>Get <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key</a> for your Moodle site. </div>';
$string['information'] = '<div>Get a <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key</a> for your Moodle site. </div>';
$string['invalidemail'] = 'Invalid email account for flickr';
$string['license'] = 'License';
$string['modification'] = 'Allow modifications of your work?';
$string['modification'] = 'I want to be able to modify the images';
$string['notitle'] = 'notitle';
$string['nullphotolist'] = 'There are no photos in this account';
$string['tag'] = 'Tag';
Expand All @@ -28,5 +28,5 @@
$string['secret'] = 'Secret';
$string['sharealike'] = 'Yes, as long as others share alike';
$string['username'] = 'Flickr account email';
$string['watermark'] = 'Add watermark (Author ID and original URL) to downloaed photos?';
$string['watermark'] = 'Add watermark to photos (Author and URL)';

37 changes: 10 additions & 27 deletions repository/flickr_public/repository.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,16 @@ public function print_login() {
$commercial = new stdclass;
$commercial->label = get_string('commercialuse', 'repository_flickr_public').': ';
$commercial->id = 'flickr_commercial_id';
$commercial->type = 'radio';
$commercial->type = 'checkbox';
$commercial->name = 'flickr_commercial';
$commercial->value = implode('|', array('yes', 'no'));
$commercial->value_label = implode('|', array(
get_string('yes'),
get_string('no')
));
$commercial->value = 'yes';

$modification = new stdclass;
$modification->label = get_string('modification', 'repository_flickr_public').': ';
$modification->id = 'flickr_modification_id';
$modification->type = 'radio';
$modification->type = 'checkbox';
$modification->name = 'flickr_modification';
$modification->value = implode('|', array('yes', 'sharealike', 'no'));
$modification->value_label = implode('|', array(
get_string('yes'),
get_string('sharealike', 'repository_flickr_public'),
get_string('no')
));
$modification->value = 'yes';

$ret['login'] = array($fulltext, $tag, $email_field, $commercial, $modification);
$ret['login_btn_label'] = get_string('search');
Expand All @@ -166,20 +157,12 @@ public function print_login() {

echo '<tr><td><label>'.get_string('commercialuse', 'repository_flickr_public').'</label></td>';
echo '<td>';
echo '<input type="radio" name="flickr_commercial" value="yes" /> '.get_string('yes');
echo '<br />';
echo '<input type="radio" name="flickr_commercial" value="no" /> '.get_string('no');
echo '<br />';
echo '<input type="checkbox" name="flickr_commercial" value="yes" />';
echo '</td></tr>';

echo '<tr><td><label>'.get_string('modification', 'repository_flickr_public').'</label></td>';
echo '<td>';
echo '<input type="radio" name="flickr_modification" value="yes" /> '.get_string('yes');
echo '<br />';
echo '<input type="radio" name="flickr_modification" value="sharealike" /> '.get_string('sharealike', 'repository_flickr_public');
echo '<br />';
echo '<input type="radio" name="flickr_modification" value="no" /> '.get_string('no');
echo '<br />';
echo '<input type="checkbox" name="flickr_modification" value="yes" />';
echo '</td></tr>';

echo '</table>';
Expand Down Expand Up @@ -254,18 +237,18 @@ public function search($search_text) {
// 7: unknown license
unset($licenses[3], $licenses[6]);
}
if ($modification == 'sharealike') {
//if ($modification == 'sharealike') {
// including
// 1: Attribution NonCommercial ShareAlike
// 5: Attribution ShareAlike
unset($licenses[2], $licenses[3], $licenses[4], $licenses[6], $licenses[7]);
}
//unset($licenses[2], $licenses[3], $licenses[4], $licenses[6], $licenses[7]);
//}

$licenses = implode(',', $licenses);

if (!empty($SESSION->{$this->sess_tag}) // use tag to search
or !empty($SESSION->{$this->sess_text}) // use keyword to search
or !empty($this->nsid)/*use pre-defined accound*/) {
or !empty($this->nsid)/*use pre-defined accound*/) {
$photos = $this->flickr->photos_search(array(
'tags'=>$SESSION->{$this->sess_tag},
'page'=>$page,
Expand Down

0 comments on commit 640bb8c

Please sign in to comment.