From e49eaacbc9cdb73059195805842b02a1395b05d7 Mon Sep 17 00:00:00 2001 From: jerome <jerome> Date: Wed, 17 Sep 2008 06:09:10 +0000 Subject: [PATCH] MDL-15402: add some help texts to filckr/boxnet plugins --- lang/en_utf8/repository_boxnet.php | 13 ++++---- lang/en_utf8/repository_flickr.php | 3 +- lang/en_utf8/repository_flickr_public.php | 1 + repository/boxnet/repository.class.php | 1 + repository/flickr/repository.class.php | 32 +++++++++++++------ repository/flickr_public/repository.class.php | 8 ++--- 6 files changed, 35 insertions(+), 23 deletions(-) diff --git a/lang/en_utf8/repository_boxnet.php b/lang/en_utf8/repository_boxnet.php index a8d1eece89..b947fde097 100644 --- a/lang/en_utf8/repository_boxnet.php +++ b/lang/en_utf8/repository_boxnet.php @@ -1,14 +1,13 @@ <?php $string['apikey'] = 'API Key'; -$string['repositoryname'] = 'Box.net'; -$string['repositorydesc'] = 'Repository on Box.net'; $string['configplugin'] = 'Box.net configuration'; -$string['username'] = 'Username for Box.net'; -$string['password'] = 'Password'; -$string['saved'] = 'Box.net data saved'; +$string['information'] = '<div style=\"font-size:0.8em\">Get <a href=\"http://enabled.box.net/\">Box.net API Key</a> for your Moodle site. </div>'; $string['invalidpassword'] = 'Invalid password'; $stirng['invalidtoken'] = 'Invalid authentication token'; $string['nullfilelist'] = 'There are no files in this repository'; -$string['username'] = 'Box.net account'; -$string['password'] = 'Box.net password'; +$string['password'] = 'Password'; +$string['repositorydesc'] = 'Repository on Box.net'; +$string['repositoryname'] = 'Box.net'; +$string['saved'] = 'Box.net data saved'; $string['shareurl'] = 'Share URL'; +$string['username'] = 'Username for Box.net'; diff --git a/lang/en_utf8/repository_flickr.php b/lang/en_utf8/repository_flickr.php index 5420e6921b..3245373ab4 100644 --- a/lang/en_utf8/repository_flickr.php +++ b/lang/en_utf8/repository_flickr.php @@ -1,7 +1,8 @@ <?php $string['apikey'] = 'API Key'; $string['callbackurl'] = 'Callback URL'; -$string['callbackwarning'] = 'You will need to copy the callback URL into Flickr. This callback URL will be generated once you save this information. Please click on Save button, then on Settings in order to check the generated callback URL'; +$string['callbackurltext'] = '<div style=\"font-size:0.8em\">1. Get <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key and Secret</a> for your Moodle site.<br/>2. Your callback URL is <strong>$a</strong><br/>3. Edit your <a href=\"http://www.flickr.com/services/api/keys/\">Flickr</a> key details and set the callback URL. </div>'; +$string['callbackwarning'] = '<div style=\"font-size:0.8em\">1. Get <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key and Secret</a> for your Moodle site.<br/>2. Your callback URL <strong>will be</strong> generated <strong>once</strong> you save these above information. Please click on Save button, then on <strong>Settings</strong> in order to check the generated callback URL.<br/>3. Edit your <a href=\"http://www.flickr.com/services/api/keys/\">Flickr</a> key details and set the callback URL.</div> '; $string['configplugin'] = 'Flickr configuration'; $string['emailaddress'] = 'Email address'; $string['invalidemail'] = 'Invalid email address for flickr'; diff --git a/lang/en_utf8/repository_flickr_public.php b/lang/en_utf8/repository_flickr_public.php index be97c779d7..ee393afb62 100644 --- a/lang/en_utf8/repository_flickr_public.php +++ b/lang/en_utf8/repository_flickr_public.php @@ -3,6 +3,7 @@ $string['apikey'] = 'API Key'; $string['callbackurl'] = 'Callback URL'; $string['configplugin'] = 'Flickr Public configuration'; $string['emailaddress'] = 'Email address'; +$string['information'] = '<div style=\"font-size:0.8em\">Get <a href=\"http://www.flickr.com/services/api/keys/\">Flickr API Key</a> for your Moodle site. </div>'; $string['invalidemail'] = 'Invalid email address for flickr'; $string['notitle'] = 'notitle'; $string['nullphotolist'] = 'There are no photos in this account'; diff --git a/repository/boxnet/repository.class.php b/repository/boxnet/repository.class.php index 9c029fde00..0fe9468580 100755 --- a/repository/boxnet/repository.class.php +++ b/repository/boxnet/repository.class.php @@ -186,6 +186,7 @@ class repository_boxnet extends repository { $strrequired = get_string('required'); $mform->addElement('text', 'api_key', get_string('apikey', 'repository_boxnet'), array('value'=>$api_key,'size' => '40')); $mform->addRule('api_key', $strrequired, 'required', null, 'client'); + $mform->addElement('static', null, '', get_string('information','repository_boxnet')); } public function instance_config_form(&$mform) { diff --git a/repository/flickr/repository.class.php b/repository/flickr/repository.class.php index cdb51acf4c..7c934fe501 100755 --- a/repository/flickr/repository.class.php +++ b/repository/flickr/repository.class.php @@ -200,14 +200,7 @@ class repository_flickr extends repository { $api_key = get_config('flickr', 'api_key'); $secret = get_config('flickr', 'secret'); - //retrieve the flickr instances - $instances = repository_get_instances(array(),null,false,"flickr"); - if (empty($instances)) { - $callbackurl = get_string("callbackwarning","repository_flickr"); - } - else { - $callbackurl = $CFG->wwwroot.'/repository/ws.php?callback=yes&repo_id='.$instances[0]->id; - } + if (empty($api_key)) { $api_key = ''; @@ -215,11 +208,32 @@ class repository_flickr extends repository { if (empty($secret)) { $secret = ''; } +/* + $noticetext = get_string('notice', 'repository_flickr'); + //$noticetext = 'a['; + //var_dump($noticetext); + if (strpos($noticetext, '[')==0) { + $mform->addElement('static', 'notice', '<strong>'.get_string('notice', 'repository').'</strong>', '<i>'.$noticetext.'</i>'); + } + * */ + + $strrequired = get_string('required'); $mform->addElement('text', 'api_key', get_string('apikey', 'repository_flickr'), array('value'=>$api_key,'size' => '40')); $mform->addElement('text', 'secret', get_string('secret', 'repository_flickr'), array('value'=>$secret,'size' => '40')); - $mform->addElement('static', 'callbackurl', get_string('callbackurl', 'repository_flickr'), $callbackurl); + + //retrieve the flickr instances + $instances = repository_get_instances(array(),null,false,"flickr"); + if (empty($instances)) { + $callbackurl = get_string("callbackwarning","repository_flickr"); + $mform->addElement('static', null, '', $callbackurl); + } + else { + $callbackurl = $CFG->wwwroot.'/repository/ws.php?callback=yes&repo_id='.$instances[0]->id; + $mform->addElement('static', 'callbackurl', '', get_string('callbackurltext', 'repository_flickr', $callbackurl)); + } + $mform->addRule('api_key', $strrequired, 'required', null, 'client'); $mform->addRule('secret', $strrequired, 'required', null, 'client'); diff --git a/repository/flickr_public/repository.class.php b/repository/flickr_public/repository.class.php index beab04675e..512f128993 100644 --- a/repository/flickr_public/repository.class.php +++ b/repository/flickr_public/repository.class.php @@ -197,6 +197,7 @@ class repository_flickr_public extends repository { $strrequired = get_string('required'); $mform->addElement('text', 'api_key', get_string('apikey', 'repository_flickr_public'), array('value'=>$api_key,'size' => '40')); $mform->addRule('api_key', $strrequired, 'required', null, 'client'); + $mform->addElement('static', null, '', get_string('information','repository_flickr_public')); } public static function get_admin_option_names() { @@ -205,13 +206,8 @@ class repository_flickr_public extends repository { public static function plugin_init() { - //here we create a default instances for this type + //here we create a default instance for this type repository_static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name' => 'default instance','email_address' => null),1); - //create(0, get_system_context(), array('name' => 'default instance'),1); - /* - $success = repository_static_function($plugin, 'create', $plugin, 0, get_context_instance_by_id($contextid), $fromform); - $defaultinstance = new repository (); - * */ } } -- 2.39.5