Changeset 4231 in subversion
- Timestamp:
- Nov 17, 2010 8:35:58 AM (3 years ago)
- Location:
- branches/devel-addressbook
- Files:
-
- 5 edited
-
program/include/rcube_contacts.php (modified) (1 diff)
-
program/include/rcube_vcard.php (modified) (6 diffs)
-
program/steps/addressbook/func.inc (modified) (1 diff)
-
program/steps/addressbook/show.inc (modified) (3 diffs)
-
skins/default/addressbook.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-addressbook/program/include/rcube_contacts.php
r4230 r4231 483 483 if ($sql_arr['vcard']) { 484 484 $vcard = new rcube_vcard($sql_arr['vcard']); 485 $record += $vcard->get_assoc() ;485 $record += $vcard->get_assoc() + $sql_arr; 486 486 } 487 487 else -
branches/devel-addressbook/program/include/rcube_vcard.php
r4230 r4231 34 34 ); 35 35 private $fieldmap = array('phone' => 'TEL', 'birthday' => 'BDAY', 'website' => 'URL', 'notes' => 'NOTE', 'email' => 'EMAIL', 'address' => 'ADR'); 36 private $typemap = array('iPhone' => 'mobile', 'CELL' => 'mobile'); 36 37 37 38 public $business = false; … … 106 107 { 107 108 $out = array('name' => $this->displayname); 108 109 $typemap = $this->typemap; 110 111 // copy name fields to output array 109 112 foreach (array('firstname','surname','middlename','nickname','organization') as $col) 110 113 $out[$col] = $this->$col; 111 114 115 // convert from raw vcard data into associative data for Roundcube 112 116 foreach (array_flip($this->fieldmap) as $tag => $col) { 113 117 foreach ((array)$this->raw[$tag] as $i => $raw) { 114 118 if (is_array($raw)) { 115 $k = 0;119 $k = -1; 116 120 $key = $col; 117 $subtype = strtolower($raw['type'][$k++]);121 $subtype = $typemap[$raw['type'][++$k]] ?: strtolower($raw['type'][$k]); 118 122 while ($k < count($raw['type']) && ($subtype == 'internet' || $subtype == 'pref')) 119 $subtype = strtolower($raw['type'][$k++]);123 $subtype = $typemap[$raw['type'][++$k]] ?: strtolower($raw['type'][$k]); 120 124 if ($subtype) 121 125 $key .= ':' . $subtype; 122 126 127 // split ADR values into assoc array 123 128 if ($tag == 'ADR') { 124 129 list(,, $value['street'], $value['locality'], $value['region'], $value['zipcode'], $value['country']) = $raw; … … 134 139 } 135 140 141 // handle special IM fields as used by Apple 142 foreach (array('X-JABBER' => 'jabber', 'X-ICQ' => 'icq', 'X-MSN' => 'msn', 'X-AIM' => 'aim', 'X-YAHOO' => 'yahoo') as $tag => $type) { 143 foreach ((array)$this->raw[$tag] as $i => $raw) { 144 $out['im:'.$type][] = $raw[0]; 145 } 146 } 147 136 148 return $out; 137 149 } … … 152 164 * @param string Field name 153 165 * @param string Field value 154 * @param string Section name155 */ 156 public function set($field, $value, $ section= 'HOME')166 * @param string Type/section name 167 */ 168 public function set($field, $value, $type = 'HOME') 157 169 { 158 170 static $touched = array(); 171 $typemap = array_flip($this->typemap); 159 172 160 173 switch ($field) { … … 184 197 $this->raw['EMAIL'] = array(); 185 198 $index = count($this->raw['EMAIL']); 186 $this->raw['EMAIL'][$index] = array(0 => $value, 'type' => array_filter(array('INTERNET', $ section)));199 $this->raw['EMAIL'][$index] = array(0 => $value, 'type' => array_filter(array('INTERNET', $type))); 187 200 break; 188 201 … … 197 210 $index = count($this->raw[$tag]); 198 211 $this->raw[$tag][$index] = (array)$value; 199 if ($ section)200 $this->raw[$tag][$index]['type'] = array( $section);212 if ($type) 213 $this->raw[$tag][$index]['type'] = array(($typemap[$type] ?: $type)); 201 214 } 202 215 break; -
branches/devel-addressbook/program/steps/addressbook/func.inc
r4230 r4231 311 311 if ($RCMAIL->action == 'show') { 312 312 if (!empty($record[$col])) 313 $fields .= html::span('namefield ', Q($record[$col])) . " ";313 $fields .= html::span('namefield ' . $col, Q($record[$col])) . " "; 314 314 } 315 315 else { -
branches/devel-addressbook/program/steps/addressbook/show.inc
r4230 r4231 74 74 'address' => array(), 75 75 'birthday' => array('size' => $i_size), 76 'website' => array('size' => $i_size ),76 'website' => array('size' => $i_size, 'value' => array()), 77 77 'im' => array('size' => $i_size), 78 78 ), … … 89 89 ), 90 90 ); 91 91 /* FIXME: this destroys subtype assignments 92 92 foreach ((array)$record as $field => $values) { 93 93 if (strpos($field, 'email') === 0) { … … 101 101 } 102 102 } 103 else if (strpos($field, 'website') === 0) { 104 foreach ((array)$values as $url) { 105 $prefix = preg_match('![htfps]+://!', $url) ? '' : 'http://'; 106 $form['info']['content']['website']['value'][] = html::a(array( 107 'href' => $prefix . $url, 108 'target' => '_blank', 109 'class' => 'url', 110 ), Q($url)); 111 } 112 } 103 113 } 104 114 */ 105 115 return rcmail_contact_form($form, $record); 106 116 } -
branches/devel-addressbook/skins/default/addressbook.css
r4230 r4231 239 239 } 240 240 241 #contacthead span.namefield,241 #contacthead .names span.namefield, 242 242 #contacthead input.ff_firstname, 243 243 #contacthead input.ff_surname, … … 245 245 { 246 246 font-size: 140%; 247 } 248 249 #contacthead span.nickname:before, 250 #contacthead span.nickname:after 251 { 252 content: '"'; 247 253 } 248 254
Note: See TracChangeset
for help on using the changeset viewer.
