Changeset 4361 in subversion
- Timestamp:
- Dec 22, 2010 1:25:02 PM (2 years ago)
- Location:
- branches/devel-addressbook/program
- Files:
-
- 4 edited
-
include/rcube_addressbook.php (modified) (3 diffs)
-
include/rcube_ldap.php (modified) (6 diffs)
-
js/app.js (modified) (1 diff)
-
steps/addressbook/save.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-addressbook/program/include/rcube_addressbook.php
r4271 r4361 28 28 abstract class rcube_addressbook 29 29 { 30 /** constants for error reporting **/ 31 const ERROR_READ_ONLY = 1; 32 const ERROR_NO_CONNECTION = 2; 33 const ERROR_INCOMPLETE = 3; 34 const ERROR_SAVING = 4; 35 30 36 /** public properties (mandatory) */ 31 37 public $primary_key; … … 36 42 public $page_size = 10; 37 43 public $coltypes = array('name' => array('limit'=>1), 'firstname' => array('limit'=>1), 'surname' => array('limit'=>1), 'email' => array('limit'=>1)); 44 45 protected $error; 38 46 39 47 /** … … 100 108 */ 101 109 abstract function get_record($id, $assoc=false); 110 111 /** 112 * Returns the last error occured (e.g. when updating/inserting failed) 113 * 114 * @return array Hash array with the following fields: type, message 115 */ 116 function get_error() 117 { 118 return $this->error; 119 } 120 121 /** 122 * Setter for errors for internal use 123 * 124 * @param int Error type (one of this class' error constants) 125 * @param string Error message (name of a text label) 126 */ 127 protected function set_error($type, $message) 128 { 129 $this->error = array('type' => $type, 'message' => $message); 130 } 102 131 103 132 /** -
branches/devel-addressbook/program/include/rcube_ldap.php
r4358 r4361 27 27 class rcube_ldap extends rcube_addressbook 28 28 { 29 var$conn;30 var$prop = array();31 var$fieldmap = array();32 33 var$filter = '';34 var$result = null;35 var$ldap_result = null;36 var$sort_col = '';37 var$mail_domain = '';38 var$debug = false;29 protected $conn; 30 protected $prop = array(); 31 protected $fieldmap = array(); 32 33 protected $filter = ''; 34 protected $result = null; 35 protected $ldap_result = null; 36 protected $sort_col = ''; 37 protected $mail_domain = ''; 38 protected $debug = false; 39 39 40 40 /** public properties */ 41 var$primary_key = 'ID';42 var$readonly = true;43 var$list_page = 1;44 var$page_size = 10;45 var$ready = false;46 var$coltypes = array();41 public $primary_key = 'ID'; 42 public $readonly = true; 43 public $list_page = 1; 44 public $page_size = 10; 45 public $ready = false; 46 public $coltypes = array(); 47 47 48 48 … … 524 524 // Verify that the required fields are set. 525 525 foreach ($this->prop['required_fields'] as $fld) { 526 $ complete = true;526 $missing = null; 527 527 if (!isset($newentry[$fld])) { 528 $ complete = true;529 } // end if530 } // end foreach528 $missing[] = $fld; 529 } 530 } 531 531 532 532 // abort process if requiered fields are missing 533 if (!$complete) 533 // TODO: generate message saying which fields are missing 534 if ($missing) { 535 $this->set_error(self::ERROR_INCOMPLETE, 'formincomplete'); 534 536 return false; 537 } 535 538 536 539 // Build the new entries DN. … … 542 545 if ($res === FALSE) { 543 546 $this->_debug("S: ".ldap_error($this->conn)); 547 $this->set_error(self::ERROR_SAVING, 'errorsaving'); 544 548 return false; 545 549 } // end if … … 600 604 if (!ldap_mod_del($this->conn, $dn, $deletedata)) { 601 605 $this->_debug("S: ".ldap_error($this->conn)); 606 $this->set_error(self::ERROR_SAVING, 'errorsaving'); 602 607 return false; 603 608 } … … 633 638 if (!ldap_mod_add($this->conn, $dn, $newdata)) { 634 639 $this->_debug("S: ".ldap_error($this->conn)); 640 $this->set_error(self::ERROR_SAVING, 'errorsaving'); 635 641 return false; 636 642 } … … 672 678 if ($res === FALSE) { 673 679 $this->_debug("S: ".ldap_error($this->conn)); 680 $this->set_error(self::ERROR_SAVING, 'errorsaving'); 674 681 return false; 675 682 } // end if -
branches/devel-addressbook/program/js/app.js
r4358 r4361 4805 4805 else { 4806 4806 obj.appendTo(cont).bind('mousedown', function(){ return ref.hide_message(obj); }); 4807 window.setTimeout(function(){ ref.hide_message(obj, true); }, this.message_time );4807 window.setTimeout(function(){ ref.hide_message(obj, true); }, this.message_time * (type == 'warning' || type == 'error' ? 2 : 1)); 4808 4808 return obj; 4809 4809 } -
branches/devel-addressbook/program/steps/addressbook/save.inc
r4358 r4361 207 207 else { 208 208 // show error message 209 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); 209 $err = $CONTACTS->get_error(); 210 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($err['message'] ? $err['message'] : 'errorsaving'), 'error', null, false); 210 211 rcmail_overwrite_action('show'); 211 212 } … … 259 260 else { 260 261 // show error message 261 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : 'errorsaving', 'error', null, false); 262 $err = $CONTACTS->get_error(); 263 $OUTPUT->show_message($plugin['message'] ? $plugin['message'] : ($err['message'] ? $err['message'] : 'errorsaving'), 'error', null, false); 262 264 rcmail_overwrite_action('add'); 263 265 }
Note: See TracChangeset
for help on using the changeset viewer.
