Changeset 12462
- Timestamp:
- 09/25/07 11:34:33 (1 year ago)
- Files:
-
- trunk/midcom/midcom.helper.datamanager2/widget/chooser.php (modified) (3 diffs)
- trunk/midcom/org.routamc.gallery/handler/index.php (modified) (1 diff)
- trunk/midcom/org.routamc.gallery/viewer.php (modified) (2 diffs)
- trunk/midcom/org.routamc.photostream/config/schemadb_default.inc (modified) (5 diffs)
- trunk/midcom/org.routamc.photostream/handler/upload.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.datamanager2/widget/chooser.php
r12460 r12462 624 624 array('metadata.published' => 'ASC'), 625 625 ), 626 'id_field' => 'guid',627 626 ), 628 627 ); … … 1023 1022 // Add existing and static selections 1024 1023 $existing_elements = $this->_type->selection; 1024 1025 1025 // debug_print_r('existing_elements',$existing_elements); 1026 1026 1027 1027 // debug_print_r('static_options',$this->static_options); 1028 1028 1029 $elements = array_merge($this->static_options, $existing_elements);1029 $elements = array_merge($this->static_options, $existing_elements); 1030 1030 // debug_print_r('all elements to be added',$elements); 1031 1031 … … 1297 1297 } 1298 1298 $real_results =& $results["{$this->_element_id}_selections"]; 1299 1300 foreach ($real_results as $key => $value) 1301 { 1302 // debug_add("checking key {$key} with value ".var_dump($value)); 1303 if ( $value != "0" 1304 || $value != 0) 1305 { 1306 // debug_add("adding key {$key} to selection"); 1307 $this->_type->selection[] = $key; 1299 if (is_array($real_results)) 1300 { 1301 foreach ($real_results as $key => $value) 1302 { 1303 // debug_add("checking key {$key} with value ".var_dump($value)); 1304 if ( $value != "0" 1305 || $value != 0) 1306 { 1307 // debug_add("adding key {$key} to selection"); 1308 $this->_type->selection[] = $key; 1309 } 1308 1310 } 1309 1311 } trunk/midcom/org.routamc.gallery/handler/index.php
r11649 r12462 126 126 foreach ($photolinks as $photolink) 127 127 { 128 128 129 $photo = new org_routamc_photostream_photo_dba($photolink->photo); 129 if (!$photo) 130 if ( !$photo 131 || !$photo->guid) 130 132 { 131 133 debug_add("Could not read photo #{$photolink->photo}, errstr: " . mgd_errstr(), MIDCOM_LOG_WARN); trunk/midcom/org.routamc.gallery/viewer.php
r11646 r12462 84 84 $nap = new midcom_helper_nav(); 85 85 $photostream_node = $nap->get_node($photostream->id); 86 86 87 return $photostream_node; 87 88 } 88 89 89 90 // No photostream specified, autoprobe 90 91 $photostream_node = midcom_helper_find_node_by_component('org.routamc.photostream'); 91 92 92 93 // Cache the data 93 // TODO: sudo here? 94 $this->_topic->parameter('org.routamc.gallery', 'photostream', $photostream_node[MIDCOM_NAV_GUID]); 94 if ($_MIDCOM->auth->request_sudo('org.routamc.gallery')) 95 { 96 $this->_topic->parameter('org.routamc.gallery', 'photostream', $photostream_node[MIDCOM_NAV_GUID]); 97 $_MIDCOM->auth->drop_sudo(); 98 } 95 99 96 100 return $photostream_node; … … 108 112 array 109 113 ( 110 MIDCOM_TOOLBAR_URL => "{$this->_request_data['photostream'][MIDCOM_NAV_FULLURL]}upload.html ",114 MIDCOM_TOOLBAR_URL => "{$this->_request_data['photostream'][MIDCOM_NAV_FULLURL]}upload.html?to_gallery={$this->_topic->id}", 111 115 MIDCOM_TOOLBAR_LABEL => $_MIDCOM->i18n->get_string('upload photos', 'org.routamc.photostream'), 112 116 MIDCOM_TOOLBAR_HELPTEXT => null, trunk/midcom/org.routamc.photostream/config/schemadb_default.inc
r5954 r12462 29 29 'options' => array(), 30 30 ), 31 'widget' => ' universalchooser',31 'widget' => 'chooser', 32 32 'widget_config' => array 33 33 ( 34 'class' => 'midcom_db_person', 35 'component' => 'org.openpsa.contacts', 36 'titlefield' => 'name', 37 'idfield' => 'id', 38 'constraints' => array 39 ( 40 ), 41 'searchfields' => array 42 ( 43 'lastname', 44 'firstname', 45 'username' 46 ), 47 'orders' => array 48 ( 49 array('lastname' => 'ASC'), 50 array('firstname' => 'ASC'), 51 ), 34 'clever_class' => 'person', 35 'id_field' => 'id', 52 36 ), 53 37 ), … … 152 136 'index_method' => 'title', 153 137 ), 154 'description' => Array155 (156 'title' => 'description',157 'storage' => 'description',158 'type' => 'text',159 'widget' => 'textarea',160 ),161 'photographer' => array162 (163 'title' => 'photographer',164 'storage' => 'photographer',165 'type' => 'select',166 'type_config' => array167 (168 'require_corresponding_option' => false,169 'options' => array(),170 ),171 'widget' => 'universalchooser',172 'widget_config' => array173 (174 'class' => 'midcom_db_person',175 'component' => 'org.openpsa.contacts',176 'titlefield' => 'name',177 'idfield' => 'id',178 'constraints' => array179 (180 ),181 'searchfields' => array182 (183 'lastname',184 'firstname',185 'username'186 ),187 'orders' => array188 (189 array('lastname' => 'ASC'),190 array('firstname' => 'ASC'),191 ),192 ),193 'required' => true,194 ),195 'tags' => Array196 (197 'title' => 'tags',198 'type' => 'tags',199 'widget' => 'text',200 ),201 138 /* NOTE: You *will* want to migrate all changes made here to the same 202 139 field in the photo schema as well */ … … 217 154 'widget' => 'photo', 218 155 ), 219 'private' => Array 220 ( 221 'title' => 'private', 222 'description' => 'if checked only you can see this photo', 223 'storage' => null, 224 'type' => 'privilegeset', 225 'type_config' => Array 226 ( 227 'privileges' => Array 228 ( 229 Array('midgard:read', 'EVERYONE', MIDCOM_PRIVILEGE_DENY), 230 ), 231 ), 232 'widget' => 'privilegecheckbox', 233 ), 234 'not_public' => Array 235 ( 236 'title' => 'not public', 237 'description' => 'if checked only logged in users can see this photo', 238 'storage' => null, 239 'type' => 'privilegeset', 240 'type_config' => Array 241 ( 242 'privileges' => Array 243 ( 244 Array('midgard:read', 'ANONYMOUS', MIDCOM_PRIVILEGE_DENY), 245 ), 246 ), 247 'widget' => 'privilegecheckbox', 248 ), 249 'to_gallery' => array 250 ( 251 'title' => 'upload to gallery', 252 'storage' => null, 156 'description' => Array 157 ( 158 'title' => 'description', 159 'storage' => 'description', 160 'type' => 'text', 161 'widget' => 'textarea', 162 ), 163 'tags' => Array 164 ( 165 'title' => 'tags', 166 'type' => 'tags', 167 'widget' => 'text', 168 ), 169 'photographer' => array 170 ( 171 'title' => 'photographer', 172 'storage' => 'photographer', 253 173 'type' => 'select', 254 174 'type_config' => array … … 257 177 'options' => array(), 258 178 ), 259 'widget' => ' universalchooser',179 'widget' => 'chooser', 260 180 'widget_config' => array 261 181 ( 262 'class' => 'midcom_db_topic', 263 'component' => 'org.routamc.photostream', 264 'titlefield' => 'extra', 265 'idfield' => 'id', 182 'clever_class' => 'person', 183 'id_field' => 'id', 184 ), 185 'required' => true, 186 ), 187 'to_gallery' => array 188 ( 189 'title' => 'upload to gallery', 190 'storage' => 'parameter', 191 'type' => 'select', 192 'type_config' => array 193 ( 194 'require_corresponding_option' => false, 195 'options' => array(), 196 ), 197 'widget' => 'chooser', 198 'widget_config' => array 199 ( 200 'clever_class' => 'topic', 201 'id_field' => 'id', 266 202 'constraints' => array 267 203 ( 268 204 array 269 205 ( 270 'field' => ' parameter.domain',206 'field' => 'component', 271 207 'op' => '=', 272 208 'value' => 'org.routamc.gallery', … … 285 221 ), 286 222 ), 287 'searchfields' => array 288 ( 289 'name', 290 'extra', 291 ), 292 'orders' => array 293 ( 294 array('extra' => 'ASC'), 295 array('name' => 'ASC'), 296 ), 297 ), 223 ), 224 ), 225 'private' => Array 226 ( 227 'title' => 'private', 228 'description' => 'if checked only you can see this photo', 229 'storage' => null, 230 'type' => 'privilegeset', 231 'type_config' => Array 232 ( 233 'privileges' => Array 234 ( 235 Array('midgard:read', 'EVERYONE', MIDCOM_PRIVILEGE_DENY), 236 ), 237 ), 238 'widget' => 'privilegecheckbox', 239 ), 240 'not_public' => Array 241 ( 242 'title' => 'not public', 243 'description' => 'if checked only logged in users can see this photo', 244 'storage' => null, 245 'type' => 'privilegeset', 246 'type_config' => Array 247 ( 248 'privileges' => Array 249 ( 250 Array('midgard:read', 'ANONYMOUS', MIDCOM_PRIVILEGE_DENY), 251 ), 252 ), 253 'widget' => 'privilegecheckbox', 298 254 ), 299 255 ) trunk/midcom/org.routamc.photostream/handler/upload.php
r6029 r12462 80 80 $user = $_MIDCOM->auth->user->get_storage(); 81 81 $this->_defaults['photographer'] = $user->id; 82 } 83 84 if (isset($_REQUEST['to_gallery'])) 85 { 86 $this->_defaults['to_gallery'] = $_REQUEST['to_gallery']; 82 87 } 83 88 } … … 355 360 debug_push_class(__CLASS__, __FUNCTION__); 356 361 debug_add('Called'); 357 /* This seems not to work, let's try a more raw approach 358 if (!isset($this->_controller->datamanager->types['to_gallery'])) 359 { 360 debug_add('Could not find to_gallery-field in schema'); 361 debug_pop(); 362 return; 363 } 364 debug_print_r('to_gallery: ', $this->_controller->datamanager->types['to_gallery']); 365 $gallery =& $this->_controller->datamanager->types['to_gallery']->value; 366 */ 367 if (!isset($_POST['to_gallery'])) 362 363 if (!isset($_POST['org_routamc_photostream_to_gallery_chooser_widget_selections'])) 368 364 { 369 365 debug_add('Could not find to_gallery-field in POST'); … … 371 367 return; 372 368 } 373 $gallery =& $_POST['to_gallery']; 369 370 $gallery = (int) $_POST['org_routamc_photostream_to_gallery_chooser_widget_selections']; 374 371 if (empty($gallery)) 375 372 { … … 396 393 debug_add("Photo #{$this->_photo->id} linked to gallery #{$gallery}", MIDCOM_LOG_INFO); 397 394 debug_pop(); 395 398 396 return; 399 397 } … … 426 424 { 427 425 case 'save': 428 // Change schema on the fly f from upload to photo426 // Change schema on the fly from 'upload' to 'photo' 429 427 $this->_photo->parameter('midcom.helper.datamanager2', 'schema_name', 'photo'); 430 428 $this->_photo->read_exif_data(true);
