- Timestamp:
- 05/02/13 15:19:28 (10 years ago)
- Location:
- trunk/zpush
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zpush/backend/expresso/expresso.php
r7671 r8131 24 24 private function getProvider( $folderId ) 25 25 { 26 27 26 28 foreach($this->providers as $provider) 27 29 { … … 109 111 public function ChangeFolder($folderid, $oldid, $displayname, $type) 110 112 { 111 // TODO: Implement ChangeFolder() method.113 return $this->getProvider($oldid ? $oldid: $folderid)->ChangeFolder($folderid, $oldid, $displayname, $type); 112 114 } 113 115 … … 124 126 public function DeleteFolder($id, $parentid) 125 127 { 126 // TODO: Implement DeleteFolder() method.128 return $this->getProvider($id)->DeleteFolder($id, $parentid); 127 129 } 128 130 -
trunk/zpush/backend/expresso/providers/calendarProvider.php
r8030 r8131 154 154 public function ChangeFolder($folderid, $oldid, $displayname, $type) 155 155 { 156 if($oldid) 157 { 158 $idNumber = (int)str_replace('calendar' , '' , $oldid); 159 $calendarSignature = Controller::read( array( 'concept' => 'calendarSignature' , 'id' => $idNumber )); 160 161 Controller::update( array('concept' => 'calendar' , 'id' => $calendarSignature['calendar']), array( 'name' => $displayname) ); 162 163 return $this->StatFolder($oldid); 164 } 165 else 166 { 167 $cal = array('name' => $displayname, 168 'timezone' => 'America/Sao_Paulo', 169 'type' => '0' 170 ); 171 172 $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 173 174 if(!$calCreated){ 175 return false; 176 } 177 178 $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 179 'calendar' => $calCreated['id'], 180 'isOwner' => '1', 181 'dtstamp' => time() . '000', 182 'fontColor' => 'FFFFFF', 183 'backgroundColor' => '3366CC', 184 'borderColor' => '3366CC', 185 ); 186 187 $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 188 189 if(!$sigCreated){ 190 return false; 191 } 192 else 193 { 194 $return = array(); 195 $return["id"] = 'calendar'.$calCreated; 196 $return["parent"] = 0; 197 $return["mod"] = $displayname; 198 return $return; 199 } 200 } 201 156 202 return false; 157 203 … … 168 214 * @throws StatusException could throw specific SYNC_FSSTATUS_* exceptions 169 215 */ 170 public function DeleteFolder($id, $parentid) 171 { 172 return false; 216 public function DeleteFolder($id, $parent) 217 { 218 $interation = array(); 219 $idNumber = (int)str_replace('calendar' , '' , $id); 220 $calendarSignature = Controller::read( array( 'concept' => 'calendarSignature' , 'id' => $idNumber )); 221 222 $interation['calendar://' . $calendarSignature['calendar']] = false; 223 ob_start(); 224 $args = $interation; 225 include EXPRESSO_PATH.'/prototype/Sync.php'; 226 ob_end_clean(); 227 228 return true; 173 229 } 174 230 -
trunk/zpush/backend/expresso/providers/imapProvider.php
r8026 r8131 903 903 904 904 // build name for new mailboxBackendMaildir 905 $displayname = Utils::Utf7_iconv_encode(Utils::Utf8_to_utf7($displayname)); 906 $newname = $this->server . $folderid . $this->serverdelimiter . $displayname; 907 905 $displayname = Utils::Utf7_iconv_encode(Utils::Utf8_to_utf7($displayname));; 906 $new = $this->server . $this->getImapIdFromFolderId($folderid) . $this->serverdelimiter. $displayname; 908 907 $csts = false; 909 // if $id is set => rename mailbox, otherwise create 910 if ($oldid) { 911 // rename doesn't work properly with IMAP 912 // the activesync client doesn't support a 'changing ID' 913 // TODO this would be solved by implementing hex ids (Mantis #459) 914 //$csts = imap_renamemailbox($this->mbox, $this->server . imap_utf7_encode(str_replace(".", $this->serverdelimiter, $oldid)), $newname); 915 } 916 else { 917 $csts = @imap_createmailbox($this->mbox, $newname); 918 } 908 909 $csts = ($oldid) ? imap_renamemailbox($this->mbox, $this->server .$this->getImapIdFromFolderId($oldid) , $new) : imap_createmailbox($this->mbox, $new); 910 919 911 if ($csts) { 920 return $this->StatFolder($folderid . $this->serverdelimiter . $displayname); 912 $newId = $this->convertImapId($new); 913 return $this->StatFolder($newId); 921 914 } 922 915 else … … 935 928 * 936 929 */ 937 public function DeleteFolder($id, $parentid){ 938 // TODO implement 939 return false; 930 public function DeleteFolder($id, $parentid) 931 { 932 $ret = imap_deletemailbox($this->mbox , $this->server .$this->getImapIdFromFolderId($id) ); 933 imap_expunge( $this->mbox ); 934 return $ret; 940 935 } 941 936 -
trunk/zpush/lib/utils/utils.php
r7589 r8131 446 446 static public function IsSystemFolder($foldertype) { 447 447 return ($foldertype == SYNC_FOLDER_TYPE_INBOX || $foldertype == SYNC_FOLDER_TYPE_DRAFTS || $foldertype == SYNC_FOLDER_TYPE_WASTEBASKET || $foldertype == SYNC_FOLDER_TYPE_SENTMAIL || 448 $foldertype == SYNC_FOLDER_TYPE_OUTBOX || $foldertype == SYNC_FOLDER_TYPE_TASK || $foldertype == SYNC_FOLDER_TYPE_APPOINTMENT|| $foldertype == SYNC_FOLDER_TYPE_CONTACT ||448 $foldertype == SYNC_FOLDER_TYPE_OUTBOX || $foldertype == SYNC_FOLDER_TYPE_TASK /*|| $foldertype == SYNC_FOLDER_TYPE_APPOINTMENT */|| $foldertype == SYNC_FOLDER_TYPE_CONTACT || 449 449 $foldertype == SYNC_FOLDER_TYPE_NOTE || $foldertype == SYNC_FOLDER_TYPE_JOURNAL) ? true:false; 450 450 }
Note: See TracChangeset
for help on using the changeset viewer.