Changeset 4707 in subversion
- Timestamp:
- Apr 27, 2011 5:43:10 AM (2 years ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 2 edited
-
js/app.js (modified) (5 diffs)
-
steps/addressbook/func.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/js/app.js
r4697 r4707 325 325 } 326 326 327 if ((this.env.action =='add' || this.env.action=='edit') && this.gui_objects.editform) {327 if ((this.env.action == 'add' || this.env.action == 'edit') && this.gui_objects.editform) { 328 328 this.enable_command('save', true); 329 this.enable_command('upload-photo', this.env.coltypes.photo ? true : false); 330 this.enable_command('delete-photo', this.env.coltypes.photo && this.env.action == 'edit'); 331 332 for (var col in this.env.coltypes) 333 this.init_edit_field(col, null); 334 335 $('.contactfieldgroup .row a.deletebutton').click(function(){ ref.delete_edit_field(this); return false }); 336 337 $('select.addfieldmenu').change(function(e){ 338 ref.insert_edit_field($(this).val(), $(this).attr('rel'), this); 339 this.selectedIndex = 0; 340 }); 341 342 $("input[type='text']:visible").first().focus(); 329 this.init_contact_form(); 343 330 } 344 331 else if (this.gui_objects.qsearchbox) { … … 357 344 this.enable_command('preferences', 'identities', 'save', 'folders', true); 358 345 359 if (this.env.action =='identities') {346 if (this.env.action == 'identities') { 360 347 this.enable_command('add', this.env.identities_level < 2); 361 348 } 362 else if (this.env.action =='edit-identity' || this.env.action=='add-identity') {349 else if (this.env.action == 'edit-identity' || this.env.action == 'add-identity') { 363 350 this.enable_command('add', this.env.identities_level < 2); 364 351 this.enable_command('save', 'delete', 'edit', 'toggle-editor', true); 365 352 } 366 else if (this.env.action =='folders') {353 else if (this.env.action == 'folders') { 367 354 this.enable_command('subscribe', 'unsubscribe', 'create-folder', 'rename-folder', true); 368 355 } … … 3599 3586 if (this.ksearch_pane) 3600 3587 this.ksearch_pane.hide(); 3601 };3588 }; 3602 3589 3603 3590 … … 3839 3826 3840 3827 this.enable_command('export', (this.contact_list.rowcount > 0)); 3828 }; 3829 3830 this.init_contact_form = function() 3831 { 3832 var ref = this, col; 3833 3834 this.set_photo_actions($('#ff_photo').val()); 3835 3836 for (col in this.env.coltypes) 3837 this.init_edit_field(col, null); 3838 3839 $('.contactfieldgroup .row a.deletebutton').click(function() { 3840 ref.delete_edit_field(this); 3841 return false; 3842 }); 3843 3844 $('select.addfieldmenu').change(function(e) { 3845 ref.insert_edit_field($(this).val(), $(this).attr('rel'), this); 3846 this.selectedIndex = 0; 3847 }); 3848 3849 $("input[type='text']:visible").first().focus(); 3841 3850 }; 3842 3851 … … 4137 4146 } 4138 4147 }; 4139 4148 4140 4149 this.replace_contact_photo = function(id) 4141 4150 { 4142 $('#ff_photo').val(id);4143 4144 var buttons = this.buttons['upload-photo'];4145 for (var n=0; n < buttons.length; n++)4146 $('#'+buttons[n].id).html(this.get_label(id == '-del-' ? 'addphoto' : 'replacephoto'));4147 4148 4151 var img_src = id == '-del-' ? this.env.photo_placeholder : 4149 4152 this.env.comm_path + '&_action=photo&_source=' + this.env.source + '&_cid=' + this.env.cid + '&_photo=' + id; 4153 4154 this.set_photo_actions(id); 4150 4155 $(this.gui_objects.contactphoto).children('img').attr('src', img_src); 4151 4152 this.enable_command('delete-photo', id != '-del-'); 4153 }; 4154 4156 }; 4157 4155 4158 this.photo_upload_end = function() 4156 4159 { 4157 4160 this.set_busy(false, null, this.photo_upload_id); 4158 4161 delete this.photo_upload_id; 4162 }; 4163 4164 this.set_photo_actions = function(id) 4165 { 4166 var n, buttons = this.buttons['upload-photo']; 4167 for (n=0; n < buttons.length; n++) 4168 $('#'+buttons[n].id).html(this.get_label(id == '-del-' ? 'addphoto' : 'replacephoto')); 4169 4170 $('#ff_photo').val(id); 4171 this.enable_command('upload-photo', this.env.coltypes.photo ? true : false); 4172 this.enable_command('delete-photo', this.env.coltypes.photo && id != '-del-'); 4159 4173 }; 4160 4174 -
trunk/roundcubemail/program/steps/addressbook/func.inc
r4575 r4707 558 558 { 559 559 global $CONTACTS, $CONTACT_COLTYPES, $RCMAIL, $CONFIG; 560 560 561 if (!$CONTACT_COLTYPES['photo']) 562 return ''; 563 561 564 if ($result = $CONTACTS->get_result()) 562 565 $record = $result->first(); 563 566 564 567 $photo_img = $attrib['placeholder'] ? $CONFIG['skin_path'] . $attrib['placeholder'] : 'program/blank.gif'; 568 $RCMAIL->output->set_env('photo_placeholder', $photo_img); 565 569 unset($attrib['placeholder']); 566 567 if ($CONTACT_COLTYPES['photo']) { 568 $RCMAIL->output->set_env('photo_placeholder', $photo_img); 569 570 if (strpos($record['photo'], 'http:') === 0) 571 $photo_img = $record['photo']; 572 else if ($record['photo']) 573 $photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $_REQUEST['_source'])); 574 $img = html::img(array('src' => $photo_img, 'border' => 1, 'alt' => '')); 575 $content = html::div($attrib, $img); 576 577 if ($RCMAIL->action == 'edit' || $RCMAIL->action == 'add') { 578 $RCMAIL->output->add_gui_object('contactphoto', $attrib['id']); 579 $hidden = new html_hiddenfield(array('name' => '_photo', 'id' => 'ff_photo')); 580 $content .= $hidden->show(); 581 } 582 } 583 584 return $content; 570 571 if (strpos($record['photo'], 'http:') === 0) 572 $photo_img = $record['photo']; 573 else if ($record['photo']) 574 $photo_img = $RCMAIL->url(array('_action' => 'photo', '_cid' => $record['ID'], '_source' => $_REQUEST['_source'])); 575 else 576 $ff_value = '-del-'; // will disable delete-photo action 577 578 $img = html::img(array('src' => $photo_img, 'border' => 1, 'alt' => '')); 579 $content = html::div($attrib, $img); 580 581 if ($RCMAIL->action == 'edit' || $RCMAIL->action == 'add') { 582 $RCMAIL->output->add_gui_object('contactphoto', $attrib['id']); 583 $hidden = new html_hiddenfield(array('name' => '_photo', 'id' => 'ff_photo', 'value' => $ff_value)); 584 $content .= $hidden->show(); 585 } 586 587 return $content; 585 588 } 586 589
Note: See TracChangeset
for help on using the changeset viewer.
