mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-15402: minor changes for flickr admin settings
This commit is contained in:
parent
e9c1829aaa
commit
7892948d1f
@ -1,6 +1,7 @@
|
||||
<?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['configplugin'] = 'Flickr configuration';
|
||||
$string['emailaddress'] = 'Email address';
|
||||
$string['invalidemail'] = 'Invalid email address for flickr';
|
||||
|
@ -209,7 +209,7 @@ class repository_flickr extends repository{
|
||||
}
|
||||
|
||||
public static function has_instance_config() {
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public function instance_config_form(&$mform) {
|
||||
@ -224,17 +224,24 @@ class repository_flickr extends repository{
|
||||
public function admin_config_form(&$mform) {
|
||||
global $CFG;
|
||||
$api_key = get_config('flickr', 'api_key');
|
||||
$secret = get_config('flickr', 'secret');
|
||||
$callbackurl = get_config('flickr', 'callbackurl');
|
||||
$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 = '';
|
||||
}
|
||||
if (empty($secret)) {
|
||||
$secret = '';
|
||||
}
|
||||
if (empty($callbackurl)) {
|
||||
$callbackurl = $CFG->wwwroot.'/repository/ws.php?callback=yes&repo_id=';
|
||||
}
|
||||
|
||||
$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'));
|
||||
|
@ -872,6 +872,20 @@ abstract class repository {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* function which is run when a type is created
|
||||
* This should be a function from a type, but as I plugin wrtie, only write
|
||||
* a class extended from repository class, the init() for type has been placed
|
||||
* into the repository.
|
||||
*/
|
||||
public static function type_init(){
|
||||
|
||||
}
|
||||
|
||||
public static function add_unremovable_instances(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the plugin type has at least one general option field
|
||||
* By default: false
|
||||
@ -1005,8 +1019,8 @@ function repository_get_instances($contexts=array(), $userid = null, $onlyvisibl
|
||||
$params[] = $context->id;
|
||||
}
|
||||
|
||||
if ($firstcontext) {
|
||||
$sql .=')';
|
||||
if (!empty($firstcontext)) {
|
||||
$sql .=')';
|
||||
}
|
||||
|
||||
if ($onlyvisible == true) {
|
||||
@ -1274,7 +1288,7 @@ function repository_get_client($context) {
|
||||
.fp-grid .label{height:48px}
|
||||
.fp-grid span{background: #EEF9EB;color:gray}
|
||||
</style>
|
||||
EOD;
|
||||
EOD;
|
||||
|
||||
$js = <<<EOD
|
||||
<script type="text/javascript" src="$CFG->httpswwwroot/lib/yui/yahoo-dom-event/yahoo-dom-event.js"></script>
|
||||
@ -1288,7 +1302,7 @@ function repository_get_client($context) {
|
||||
<script type="text/javascript" src="$CFG->httpswwwroot/lib/yui/json/json-min.js"></script>
|
||||
<script type="text/javascript" src="$CFG->httpswwwroot/lib/yui/button/button-min.js"></script>
|
||||
<script type="text/javascript" src="$CFG->httpswwwroot/lib/yui/selector/selector-beta-min.js"></script>
|
||||
EOD;
|
||||
EOD;
|
||||
$CFG->repo_yui_loaded = true;
|
||||
} else {
|
||||
$js = '';
|
||||
@ -2314,8 +2328,7 @@ function repository_display_instances_list($context, $typename = null) {
|
||||
$addable = 1;
|
||||
$instancehtml .= "<form action='".$baseurl."&new=".$typename."' method='post'>
|
||||
<p style='text-align:center'><input type='submit' value='".get_string('createinstance', 'repository')."'/></p>
|
||||
</form>";
|
||||
}
|
||||
</form>";
|
||||
}
|
||||
|
||||
if ($addable) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user