]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-17316, supported flickr_public plugin working in non-js filepicker"
authordongsheng <dongsheng>
Thu, 18 Jun 2009 07:58:37 +0000 (07:58 +0000)
committerdongsheng <dongsheng>
Thu, 18 Jun 2009 07:58:37 +0000 (07:58 +0000)
repository/filepicker.php
repository/flickr_public/repository.class.php

index ff40fd22c43bbaf022b14eca77cf5182a82e5e7d..9edfb39cd647f17d1150912184ad1c2577c6a244 100755 (executable)
@@ -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');
index 0fad3206e7f9cce9184be287020dafdc03d4421b..d7ed8d334df7bfdeb49b840f62e6c23310f2dd6c 100644 (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" />';
         }
     }