--- flickr.module.orig 2007-06-02 05:46:58.000000000 +0100
+++ flickr.module 2007-11-30 13:10:39.000000000 +0000
@@ -10,7 +10,7 @@ require_once(drupal_get_path('module', '
function flickr_help($section) {
switch ($section) {
case 'admin/settings/flickr':
- return t("You will need a Flickr API key to use this module. You can apply for one at @link", array('@link' => url('http://www.flickr.com/services/api/keys/apply/')));
+ return t("You will need a Flickr API key to use this module. You can apply for one at @link . To create a flickr entry click here", array('@link' => url('http://www.flickr.com/services/api/keys/apply/'),'@link2' => url('/admin/flickr/create/entry')));
case 'admin/help#flickr':
return t('The flickr module uses XML-RPC to connect to Flickr\'s API and retreive photo information.');
}
@@ -31,7 +31,15 @@ function flickr_menu($may_cache) {
global $user;
$items = array();
- if ($may_cache) {
+ // if ($may_cache) {
+
+ $items[] = array(
+ 'path' => 'admin/flickr/create/entry', 'title' => t('Create a Flickr entry'),
+ 'callback' => 'flickr_admin_create_entry',
+ 'access' => user_access('administer site configuration'),
+ 'type' => MENU_NORMAL_ITEM,
+ 'description' => t('Create a Flickr entry.'));
+
$items[] = array(
'path' => 'admin/settings/flickr', 'title' => t('Flickr'),
'callback' => 'drupal_get_form',
@@ -53,8 +61,8 @@ function flickr_menu($may_cache) {
'access' => TRUE,
'type' => MENU_CALLBACK,
'callback' => 'flickr_auth_callback');
- }
- else {
+ // }
+// else {
if (arg(0) == 'flickr' && is_numeric(arg(1)) && arg(1) > 0) {
$account = user_load(array('uid' => arg(1)));
if ($account !== FALSE && isset($account->flickr['nsid'])) {
@@ -87,7 +95,7 @@ function flickr_menu($may_cache) {
drupal_set_message(t('%user does not have a Flickr account', array('%user'=>$account->name)), 'error');
}
}
- }
+ // }
return $items;
}
@@ -132,6 +140,8 @@ function flickr_admin_settings() {
$form['flickr_default_userid']['#disabled'] = TRUE;
$form['flickr_default_userid']['#description'] .= t(" Disabled until a valid API Key is set.");
}
+
+
return system_settings_form($form);
}
@@ -317,3 +327,63 @@ function theme_flickr_photoset($ps, $own
return l($img, $photo_url, array('title' => $title), NULL, NULL, TRUE, TRUE);
}
+function flickr_admin_create_entry() {
+
+ $output = drupal_get_form('flickr_admin_create_entry_form');
+ return $output;
+
+
+}
+
+function flickr_admin_create_entry_form() {
+
+ $form['#validate'] = array('flickr_admin_create_entry_form_validate' => array());
+
+ $form['flickr_entry_name'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Flickr entry name'),
+ '#required' => TRUE,
+ '#description' => t("Flickr entry name eg . Birthday party. "),
+ );
+
+ $form['flickr_entry_tags'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Flickr tags'),
+ '#required' => FALSE,
+ '#description' => t("Flickr tags eg birthday,party "),
+ );
+
+ $form['flickr_entry_genre'] = array('#type' => 'radios','#title' => t('Flickr photos that are'),'#default_value' => 're','#options' => array('re' =>'recently added','ra' =>'randomly selected'),'#description' => t("Flickr photos that are recently added or randomly selected "),);
+
+ $form['flickr_entry_scope'] = array('#type' => 'radios','#title' => t('Flickr photos that are'),'#default_value' => 'pu','#options' => array('pu' =>'selected from all flickr accounts','pr' =>'selected from an individual flickr account'),'#description' => t("Flickr photos that are selected for all or individula accounts "));
+
+ $form['flickr_entry_submit'] = array(
+ '#type' => 'submit',
+ '#value' => t('Create an flickr entry')
+ );
+
+ return $form ;
+
+}
+
+function flickr_admin_create_entry_form_validate($form_id, $form_values) { }
+
+function flickr_admin_create_entry_form_submit($form_id, $form_values) {
+
+$flickr_entries = variable_get('flickr_entries',"") ;
+
+$flickr_entry = array( 'name' => $form_values['flickr_entry_name'] , 'tags' => $form_values['flickr_entry_tags'] , 'genre' =>$form_values['flickr_entry_genre'] , 'scope' => $form_values['flickr_entry_scope'] ) ;
+
+if ($flickr_entries == "" ) {
+ $flickr_entries = array() ;
+ $flickr_entries[] = array() ;
+ }
+
+array_push($flickr_entries , $flickr_entry) ;
+variable_set('flickr_entries',$flickr_entries ) ;
+
+
+drupal_set_message("Flickr entry ".$form_values['flickr_entry_name'] ." has been posted") ;
+
+ }
+