diff --git a/repository/flickr/repository.class.php b/repository/flickr/repository.class.php index a3ff5303fb3..615b8ee42f4 100755 --- a/repository/flickr/repository.class.php +++ b/repository/flickr/repository.class.php @@ -113,11 +113,12 @@ class repository_flickr extends repository{ } public function get_listing($path = '1', $search = ''){ global $SESSION; - $nsid = get_user_preferences($this->setting.'_nsid', ''); + $nsid = get_user_preferences($this->setting.'_nsid'); $photos_url = $this->flickr->urls_getUserPhotos($nsid); if(!empty($search)) { $photos = $this->flickr->photos_search(array( + 'user_id'=>$nsid, 'per_page'=>25, 'page'=>$path, 'extras'=>'original_format', @@ -164,7 +165,9 @@ class repository_flickr extends repository{ return false; } public function print_search(){ - return false; + echo ''; + parent::print_search(); + return true; } public function get_file($photo_id, $file = ''){ global $CFG; diff --git a/repository/flickr_public/repository.class.php b/repository/flickr_public/repository.class.php index e684868615d..e532f0aa1a0 100644 --- a/repository/flickr_public/repository.class.php +++ b/repository/flickr_public/repository.class.php @@ -54,7 +54,9 @@ class repository_flickr_public extends repository{ $this->flickr_account = $this->get_option('public_account'); if(!empty($this->flickr_account)) { - $action = 'list'; + if(empty($action)){ + $action = 'list'; + } } else { $account = optional_param('flickr_account', '', PARAM_RAW); if(!empty($account)) { @@ -136,7 +138,9 @@ class repository_flickr_public extends repository{ return false; } public function print_search(){ - return false; + parent::print_search(); + echo ''; + return true; } public function get_file($photo_id, $file = ''){ global $CFG; diff --git a/repository/lib.php b/repository/lib.php index aa8bd404d6b..cec26665688 100644 --- a/repository/lib.php +++ b/repository/lib.php @@ -840,7 +840,12 @@ abstract class repository { * Show the search screen, if required * @return null */ - abstract public function print_search(); + public function print_search() { + echo ''; + echo ''; + echo ''; + return true; + } /** * is it possible to do glboal search? @@ -1929,23 +1934,57 @@ _client.req = function(id, path, reset) { params['repo_id']=id; var trans = YAHOO.util.Connect.asyncRequest('POST', '$CFG->httpswwwroot/repository/ws.php?action='+action, _client.req_cb, _client.postdata(params)); } -_client.search = function(id){ - var data = window.prompt("$strsearching"); - if(data == '') { - alert('$strnoenter'); - return; - }else if(data == null){ - return; +_client.search_form_cb = { + success: function(o) { + var el = document.getElementById('fp-search-dlg'); + if(el){ + el.innerHTML = ''; + } else { + var el = document.createElement('DIV'); + el.id = 'fp-search-dlg'; + } + var div1 = document.createElement('DIV'); + div1.className = 'hd'; + div1.innerHTML = "$strsearching"; + var div2 = document.createElement('DIV'); + div2.className = 'bd'; + var sform = document.createElement('FORM'); + sform.method = 'POST'; + sform.id = "fp-search-form"; + sform.action = '$CFG->wwwroot/repository/ws.php?action=search'; + sform.innerHTML = o.responseText; + div2.appendChild(sform); + el.appendChild(div1); + el.appendChild(div2); + document.body.appendChild(el); + var dlg = new YAHOO.widget.Dialog("fp-search-dlg",{ + postmethod: 'async', + width : "30em", + fixedcenter : true, + zindex: 666667, + visible : false, + constraintoviewport : true, + buttons : [ { text:"Submit",handler: function(){ + _client.viewbar.set('disabled', false); + _client.loading('load'); + YAHOO.util.Connect.setForm('fp-search-form', false, false); + this.cancel(); + var trans = YAHOO.util.Connect.asyncRequest('POST', + '$CFG->httpswwwroot/repository/ws.php?action=search&env='+_client.env, _client.req_cb); + },isDefault:true }, + {text:"Cancel",handler:function(){this.cancel()}}] + }); + dlg.render(); + dlg.show(); } - _client.viewbar.set('disabled', false); - _client.loading('load'); +} +_client.search = function(id){ var params = []; - params['s']=data; params['env']=_client.env; params['sesskey']='$sesskey'; params['ctx_id']=$context->id; params['repo_id']=id; - var trans = YAHOO.util.Connect.asyncRequest('POST', '$CFG->httpswwwroot/repository/ws.php?action=search', _client.req_cb, _client.postdata(params)); + var trans = YAHOO.util.Connect.asyncRequest('POST', '$CFG->httpswwwroot/repository/ws.php?action=searchform', _client.search_form_cb, _client.postdata(params)); } _client.req_cb = { success: function(o) { diff --git a/repository/ws.php b/repository/ws.php index 2dba41965ae..0e5abac1151 100644 --- a/repository/ws.php +++ b/repository/ws.php @@ -112,6 +112,9 @@ EOD; } switch ($action) { +case 'searchform': + $repo->print_search(); + break; case 'login': try { echo json_encode($repo->print_login());