Changeset 7228 for branches/2.4/prototype
- Timestamp:
- 09/17/12 14:30:47 (12 years ago)
- Location:
- branches/2.4
- Files:
-
- 2 deleted
- 61 edited
- 45 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2.4
- Property svn:mergeinfo changed
-
branches/2.4/prototype/Sync.php
r7054 r7228 4 4 $accept = $_SERVER["HTTP_ACCEPT"]; 5 5 6 if(!function_exists('getRealREQUEST')) 7 { 8 function getRealREQUEST() { 9 $vars = array(); 10 11 $input = $_SERVER['REDIRECT_QUERY_STRING']; 12 if(!empty($input)){ 13 $pairs = explode("&", $input); 14 foreach ($pairs as $pair) { 15 $nv = explode("=", $pair); 16 17 $name = urldecode($nv[0]); 18 $nameSanitize = preg_replace('/([^\[]*)\[.*$/','$1',$name); 19 20 $nameMatched = str_replace('.','_',$nameSanitize); 21 $nameMatched = str_replace(' ','_',$nameMatched); 22 23 $vars[$nameSanitize] = $_REQUEST[$nameMatched]; 24 } 25 } 26 27 $input = file_get_contents("php://input"); 28 if(!empty($input)){ 29 $pairs = explode("&", $input); 30 foreach ($pairs as $pair) { 31 $nv = explode("=", $pair); 32 33 $name = urldecode($nv[0]); 34 $nameSanitize = preg_replace('/([^\[]*)\[.*$/','$1',$name); 35 36 $nameMatched = str_replace('.','_',$nameSanitize); 37 $nameMatched = str_replace(' ','_',$nameMatched); 38 39 $vars[$nameSanitize] = $_REQUEST[$nameMatched]; 40 } 41 } 42 43 return $vars; 44 } 45 } 6 if(!function_exists('getRealREQUEST')) 7 { 8 function getRealREQUEST() { 9 $vars = array(); 10 11 if(isset($_SERVER['REDIRECT_QUERY_STRING'])) 12 $input = $_SERVER['REDIRECT_QUERY_STRING']; 13 14 if(!empty($input)){ 15 $pairs = explode("&", $input); 16 foreach ($pairs as $pair) { 17 $nv = explode("=", $pair); 18 19 $name = urldecode($nv[0]); 20 $nameSanitize = preg_replace('/([^\[]*)\[.*$/','$1',$name); 21 22 $nameMatched = str_replace('.','_',$nameSanitize); 23 $nameMatched = str_replace(' ','_',$nameMatched); 24 25 $vars[$nameSanitize] = $_REQUEST[$nameMatched]; 26 } 27 } 28 29 $input = file_get_contents("php://input"); 30 if(!empty($input)){ 31 $pairs = explode("&", $input); 32 foreach ($pairs as $pair) { 33 $nv = explode("=", $pair); 34 35 $name = urldecode($nv[0]); 36 $nameSanitize = preg_replace('/([^\[]*)\[.*$/','$1',$name); 37 38 $nameMatched = str_replace('.','_',$nameSanitize); 39 $nameMatched = str_replace(' ','_',$nameMatched); 40 41 $vars[$nameSanitize] = $_REQUEST[$nameMatched]; 42 } 43 } 44 45 return $vars; 46 } 47 } 48 46 49 if( !isset( $args ) ) 47 50 $args = getRealREQUEST(); -
branches/2.4/prototype/api/config.php
r6828 r7228 6 6 { 7 7 static $register; 8 8 9 9 static function module($config , $module = false) 10 10 { … … 64 64 } 65 65 66 if( !isset($_SESSION) )67 66 if( !isset($_SESSION) ) 67 session_start(); 68 68 69 69 } 70 70 71 71 72 -
branches/2.4/prototype/api/controller.php
r6828 r7228 797 797 Controller::$cache = Controller::loadCache(); 798 798 799 require_once(__DIR__.'/esecurity.php'); 800 $s = new ESecurity(); 801 $s->valid(); 799 require_once(__DIR__.'/esecurity.php'); 800 $s = new ESecurity(); 801 $s->valid(); 802 802 803 803 -
branches/2.4/prototype/api/esecurity.php
r6852 r7228 1 1 <?php 2 2 3 require_once(__DIR__.'/config.php'); 3 require_once(__DIR__.'/config.php'); 4 4 5 use prototype\api\Config as Config; 5 use prototype\api\Config as Config; 6 6 7 7 class ESecurity … … 14 14 { 15 15 $sql = 'SELECT config_value FROM phpgw_config WHERE config_app = \'phpgwapi\' AND config_name = \'webserver_url\''; 16 $config = Config::service('PostgreSQL' , 'config'); 16 $config = Config::service('PostgreSQL' , 'config'); 17 17 18 $rs = ''; 19 $rs .= ( isset($config['host']) && $config['host'] ) ? ' host='.$config['host'] : '' ; 20 $rs .= ( isset($config['user']) && $config['user'] ) ? ' user='.$config['user'] : '' ; 21 $rs .= ( isset($config['password']) && $config['password'] ) ? ' password='.$config['password'] : '' ; 22 $rs .= ( isset($config['dbname']) && $config['dbname'] ) ? ' dbname='.$config['dbname'] : '' ; 23 $rs .= ( isset($config['port']) && $config['port'] ) ? ' port='.$config['port'] : '' ; 18 $rs = ''; 19 $rs .= ( isset($config['host']) && $config['host'] ) ? ' host='.$config['host'] : '' ; 20 $rs .= ( isset($config['user']) && $config['user'] ) ? ' user='.$config['user'] : '' ; 21 $rs .= ( isset($config['password']) && $config['password'] ) ? ' password='.$config['password'] : '' ; 22 $rs .= ( isset($config['dbname']) && $config['dbname'] ) ? ' dbname='.$config['dbname'] : '' ; 23 $rs .= ( isset($config['port']) && $config['port'] ) ? ' port='.$config['port'] : '' ; 24 24 25 $con = pg_connect( $rs ); 26 $rs = pg_query( $con, $sql ); 25 $con = pg_connect( $rs ); 26 $rs = pg_query( $con, $sql ); 27 27 $row = pg_fetch_assoc( $rs ); 28 28 29 29 session_destroy(); 30 header( 'Location: '.$row['config_value'].'/login.php' ); 30 header( 'Location: '.$row['config_value'].'/login.php' ); 31 31 die(); 32 32 } -
branches/2.4/prototype/config/Tonic.srv
r6754 r7228 8 8 UserResource = /user/UserResource.php 9 9 10 [/ contacts]11 ContactsResource = /catalog/ContactsResource.php10 [/personalContact] 11 PersonalContactResource = /catalog/PersonalContactResource.php 12 12 13 13 [/contact/:id] -
branches/2.4/prototype/config/calendar.ini
r5592 r7228 19 19 id = "id" 20 20 name = "name" 21 type = "type" 21 22 location = "location" 22 23 timezone = "tzid" -
branches/2.4/prototype/config/calendarSignature.ini
r5514 r7228 13 13 createDefaultSignature = modules/calendar/interceptors/DBMapping.php 14 14 deepnessFindCalendarSignature = modules/calendar/interceptors/DBMapping.php 15 createDefaultGroup = modules/calendar/interceptors/DBMapping.php 15 16 16 17 [after.read] … … 22 23 calendar = calendar_id 23 24 isOwner = is_owner 25 type = type 24 26 msgAdd = msg_add 25 27 msgCancel = msg_cancel -
branches/2.4/prototype/config/calendarToPermission.ini
r5907 r7228 12 12 13 13 [before.create] 14 addOwner = modules/calendar/interceptors/DBMapping.php 14 15 createCollectionACL = modules/calendar/interceptors/DAViCalAdapter.php 15 16 … … 24 25 type = object_type 25 26 acl = permission 27 owner = owner -
branches/2.4/prototype/config/followupflagged.ini
r6016 r7228 32 32 doneDeadline = done_deadline 33 33 isDone = is_done 34 isSent = sent 34 35 borderColor = border_color 35 36 backgroundColor = background_color -
branches/2.4/prototype/config/participant.ini
r6111 r7228 19 19 deepnessReadParticipant = modules/calendar/interceptors/DBMapping.php 20 20 21 [after.create] 22 createParticipantHistoric = modules/calendar/interceptors/DBMapping.php 23 24 [before.delete] 25 prepareParticipantHistoric = modules/calendar/interceptors/DBMapping.php 26 27 [after.delete] 28 removeParticipantHistoric = modules/calendar/interceptors/DBMapping.php 29 21 30 [after.commit] 22 31 commitParticipant = modules/calendar/interceptors/Notifications.php 32 23 33 24 34 [PostgreSQL.mapping] -
branches/2.4/prototype/config/schedulable.ini
r6190 r7228 5 5 participants = participant.schedulable 6 6 attachments = schedulableToAttachment.schedulable 7 taskToActivity = taskToActivity.activity 7 8 8 9 [model.hasOne] … … 17 18 [before.find] 18 19 findSchedulable = modules/calendar/interceptors/DBMapping.php 20 findTask = modules/calendar/interceptors/DBMapping.php 19 21 20 22 [after.find] … … 26 28 updateEvent = modules/calendar/interceptors/Notifications.php 27 29 28 29 30 [after.update] 30 31 putEvent = modules/calendar/interceptors/DBMapping.php 32 createHistoric = modules/calendar/interceptors/DBMapping.php 31 33 32 34 [after.read] … … 56 58 sequence = sequence 57 59 timezone = tzid 60 priority = priority 61 percentage = percentage 62 status = status 63 due = due -
branches/2.4/prototype/config/schedulableToAttachment.ini
r6369 r7228 5 5 schedulable = schedulable.attachments 6 6 7 [after.create] 8 createAttachmentHistoric = modules/calendar/interceptors/DBMapping.php 9 7 10 [before.delete] 8 11 decodeSchedulablettachment = modules/calendar/interceptors/DBMapping.php 9 12 10 13 [after.delete] 14 removeAttachmentHistoric = modules/calendar/interceptors/DBMapping.php 11 15 deleteAttachmentDependences = modules/calendar/interceptors/DBMapping.php 12 16 -
branches/2.4/prototype/modules/calendar/constants.php
r7093 r7228 1 1 <?php 2 2 3 /** 4 * 5 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 22 * 6731, PTI, EdifÃcio do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil 23 * or at e-mail address prognus@prognus.com.br. 24 * 25 * Neste arquivo são definidas as contantes a serem utilizadas pelo módulo ExpressoCalendar.26 * 27 * @license http://www.gnu.org/copyleft/gpl.html GPL 28 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 29 * @version 1.0 30 * @sponsor Caixa EconÃŽmica Federal 31 * @since Arquivo disponibilizado na versão Expresso 2.4.0 32 */ 33 3 /** 4 * 5 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 22 * 6731, PTI, Edifício do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil 23 * or at e-mail address prognus@prognus.com.br. 24 * 25 * Neste arquivo são definidas as contantes a serem utilizadas pelo módulo ExpressoCalendar. 26 * 27 * @license http://www.gnu.org/copyleft/gpl.html GPL 28 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 29 * @version 1.0 30 * @sponsor Caixa Econômica Federal 31 * @since Arquivo disponibilizado na versão Expresso 2.4.0 32 */ 33 34 34 define('EVENT_ID', 1); 35 define('TODO_ID', 2); 36 37 define('SIGNATURE_TYPE_NORMAL', 0); 38 define('SIGNATURE_TYPE_DEFAULT', 1); 39 40 define('CALENDAR_TYPE_EVENT', 0); 41 define('CALENDAR_TYPE_TASK_GROUP', 1); 35 42 36 43 define('STATUS_CONFIRMED', 1); … … 64 71 define('ICAL_ACTION_IMPORT_FROM_PERMISSION', 10); 65 72 define('ICAL_ACTION_NONE_FROM_PERMISSION', 11); 73 define('ICAL_NOT_FOUND', 12); 66 74 67 75 define('ATTENDEE_ACL_ORGANIZATION', 'o'); … … 80 88 define('CALENDAR_ACL_SHARED', 's'); 81 89 define('CALENDAR_ACL_REQUIRED', 'p'); 90 91 define('PRIORITY_HIGH', 1); 92 define('PRIORITY_NORMAL', 2); 93 define('PRIORITY_LOW', 3); 94 95 define('STATUS_TODO_NEED_ACTION', 1); 96 define('STATUS_TODO_IN_PROGRESS', 2); 97 define('STATUS_TODO_COMPLETED', 3); 98 define('STATUS_TODO_CANCELLED', 4); 82 99 ?> -
branches/2.4/prototype/modules/calendar/css/layout.css
r6964 r7228 193 193 display: inline-block; 194 194 border: none; 195 width: 21 5px;195 width: 213px; 196 196 } 197 197 … … 217 217 /* -- event details styles -- */ 218 218 219 .new-event-win.active {219 .new-event-win.active, .new-task-win.active { 220 220 width:700px;height:510px;text-align:left; 221 221 } 222 222 223 .new-event-win > .content.ui-tabs.ui-widget-content {223 .new-event-win > .content.ui-tabs.ui-widget-content, .new-task-win > .content.ui-tabs.ui-widget-content { 224 224 border: none; 225 225 } 226 226 227 .new-event-win ul.attendee-permissions-list, li.attendee-permissions-list{text-align: left;} 227 .new-event-win ul.attendee-permissions-list, li.attendee-permissions-list, .new-task-win ul.attendee-permissions-list{text-align: left;} 228 .new-activity-win.active { 229 width:700px;height:510px;text-align:left; 230 } 231 232 .new-activity-win > .content.ui-tabs.ui-widget-content { 233 border: none; 234 } 235 .new-activity-win ul.attendee-permissions-list, li.attendee-permissions-list{text-align: left;} 228 236 229 237 li.attendee-permissions-list input{width: 20px !important; margin: 3px 0 0 0 !important;} … … 234 242 p.request-update label{width: 150px !important;} 235 243 236 .new-event-win .menu-addevent {244 .new-event-win .menu-addevent, .new-task-win .menu-addevent { 237 245 text-align: right; 238 246 } 239 247 240 fieldset.block-add-attendee .add-attendee-search { max-width: 250px; margin: 5px;} 241 fieldset.block-add-attendee .add-attendee-search input { max-width: 220px; width: 220px; padding: 0 0 0 7px;} 242 fieldset.block-add-attendee .search-result-list { width: 255px; max-height: 215px; overflow: auto;} 243 fieldset.block-add-attendee .search-result-list .ui-widget-content { border: none;} 244 fieldset.block-add-attendee .search-result-list .empty { margin-left: 5px; } 248 .new-event-win fieldset.block-add-attendee .add-attendee-search { max-width: 250px; margin: 5px;} 249 .new-task-win fieldset.block-add-attendee .add-attendee-search { max-width: 323px; margin: 5px;} 250 251 .new-event-win fieldset.block-add-attendee .add-attendee-search input { max-width: 220px; width: 220px; padding: 0 0 0 7px;} 252 .new-task-win fieldset.block-add-attendee .add-attendee-search input { max-width: 290px; width: 290px; padding: 0 0 0 7px;} 253 254 .new-activity-win .menu-addevent { text-align: right; } 255 fieldset.block-add-attendee .add-attendee-search, fieldset.block-add-activity .add-activity-search { max-width: 250px; margin: 5px;} 256 fieldset.block-add-attendee .add-attendee-search input, fieldset.block-add-activity .add-activity-search input { max-width: 220px; width: 220px; padding: 0 0 0 7px;} 257 fieldset.block-add-attendee .search-result-list, fieldset.block-add-activity .search-result-list { width: 255px; max-height: 215px; overflow: auto;} 258 fieldset.block-add-attendee .search-result-list .ui-widget-content, fieldset.block-add-activity .search-result-list .ui-widget-content { border: none;} 259 fieldset.block-add-attendee .search-result-list .empty, fieldset.block-add-activity .search-result-list .empty { margin-left: 5px; } 245 260 fieldset.block-add-user .add-user-search {max-width: 235px;} 246 261 fieldset.block-add-user .search-result-list {max-width: 245px;} 247 fieldset.block-add-user .search-result-list .ui-widget-content {/*max-width: 245px;*/} 248 249 .block-attendee-list, .block-add-attendee { float:left;} 262 263 fieldset.block-add-user .search-result-list .ui-widget-content, fieldset.block-add-user .search-result-list .ui-widget-content {max-width: 245px;} 264 265 #calendar_addactivity_details8 .block-attendee-list, #calendar_addactivity_details8 .block-activity-list { width:430px; margin-right: 5px; } 266 267 div.assing-calendar dl.block-add-user.search{width: 255px;} 268 div.assing-calendar dt.add-user.search{width: 120px;} 269 270 271 .block-activity-list, .block-activity-group-select{width: 405px} 272 .block-add-activity.search{width: 298px} 273 274 .block-attendee-list, .block-activity-list, .block-add-activity, .block-activity-group-select { float:left;} 250 275 .block-attendee-list { width:400px; margin-right: 5px; } 251 .block-add-attendee { width:260px; margin-right: 5px; } 252 .block-attendee-list dd, .block-add-attendee dd { border: 1px solid #BFBFBF; } 253 .block-attendee-list dt, .block-add-attendee dt { background-color:#FFF; margin: 5px 0 -6px 5px; font-weight: bold; display: table; position: relative;} 276 .new-event-win .block-add-attendee { width:260px; margin-right: 5px; } 277 .new-task-win .block-add-attendee { width:335px; margin-right: 5px; } 278 .block-attendee-list dd, .block-add-attendee dd, .block-activity-list dd, .block-add-activity dd, .block-activity-group-select dd { border: 1px solid #BFBFBF; } 279 .block-attendee-list dt, .block-add-attendee dt,.block-activity-list dt, .block-add-activity dt, .block-activity-group-select dt { background-color:#FFF; margin: 5px 0 -6px 5px; font-weight: bold; display: table; position: relative; display: table;} 254 280 .block-attendee-list dd.attendee-list { height: 196px; } 255 .block-attendee-list dd.attendee-list ul { max-height: 186px; overflow: auto; margin-top: 10px;} 256 .block-attendee-list dd.attendee-list-add {border-top:none !important; border:1px solid #BFBFBF;} 257 .block-attendee-list dd.attendee-list-add fieldset.add-attendee-input { border:none !important; margin: 0; padding: 0 } 258 .block-attendee-list dd.attendee-list-brief { border:none !important; margin: 5px 0; color:#777; } 259 260 dl.block-add-attendee { 281 .block-attendee-list dd.attendee-list ul, .block-activity-list dd.task-activity-list ul { max-height: 186px; overflow: auto; margin-top: 10px;} 282 .block-attendee-list dd.attendee-list-add, .block-activity-list dd.activity-list-add {border-top:none !important; border:1px solid #BFBFBF;} 283 .block-attendee-list dd.attendee-list-add fieldset.add-attendee-input, .block-activity-list dd.activity-list-add fieldset.add-activity-input { border:none !important; margin: 0; padding: 0 } 284 .block-attendee-list dd.attendee-list-brief, .block-activity-list dd.activity-list-brief { border:none !important; margin: 5px 0; color:#777; } 285 #calendar_addactivity_details8 .block-attendee-list, #calendar_addactivity_details8 .block-activity-list { width:430px; margin-right: 5px; } 286 287 /* Pesquisa de tarefas */ 288 .block-activity-group-select dd.task-activity-list { height: 181px; } 289 .block-activity-group-select dd.group-select { height: 40px; } 290 291 fieldset.block-add-activity ul.search-result-list li{ width: 9999px; } 292 fieldset.block-add-activity ul.search-result-list{width: 290px;} 293 294 fieldset.block-add-activity fieldset.add-activity-search{max-width: 320px; width: 282px} 295 fieldset.block-add-activity fieldset.add-activity-search input{max-width: 260px; width: 245px;} 296 297 .block-activity-group-select dd.group-select select{margin: 12px 8px;} 298 .block-activity-group-select dd.task-activity-list{padding: 10px 5px} 299 300 /** Pesquisa de tarefas **/ 301 302 select.group-addactivity-details-txt-timezone{width: 175px;} 303 304 305 dl.block-add-attendee, dl.block-add-activity { 261 306 float: right; 262 307 display: block; 263 308 } 264 309 265 dl.block-add-attendee dd.add-attendee { 310 dl.block-add-activity dd.add-activity{ 311 width: 295px; 312 min-height: 254px; 313 display: block; 314 } 315 316 .new-event-win dl.block-add-attendee dd.add-attendee{ 266 317 width: 260px; 267 318 min-height: 260px; 268 319 display: block; 269 320 } 321 322 .new-task-win dl.block-add-attendee dd.add-attendee { 323 width: 343px; 324 min-height: 260px; 325 display: block; 326 } 327 328 .new-activity-win dl.block-activity-group-select li.task{overflow: hidden; position: relative;} 329 .new-activity-win dl.block-activity-group-select ul{overflow: hidden;} 330 331 #calendar_addactivity_details8 dl.block-add-attendee dd.add-attendee ,#calendar_addactivity_details8 dl.block-add-activity dd.add-activity { 332 width: 260px; 333 min-height: 292px; 334 display: block; 335 } 336 270 337 271 338 ul.attendees-count {clear:left; float:left;} … … 280 347 .attendees-list .me .add-attendee-options-read { max-height: 16px; height:16px; max-width: 16px; width:16px; display: inline; padding: 0; margin: 0 0 5px 0;} 281 348 282 .attendees-list .me .add-attendee-options-button { position: absolute; top: 171px;}349 .attendees-list .me .add-attendee-options-button {top: 4px;} 283 350 .attendees-list .hover-attendee { background-color: #DFEFFC;} 351 .task-activity-list .hover-activity { background: #DFEFFC;} 284 352 /* 285 353 .attendees-list .attendee-options-button-edit { position: absolute; top:0; right:25px;} … … 288 356 */ 289 357 290 .attendee-options { position: absolute; top: 0; left: 287px; background-color: white; z-index: 100; width: 90px; background-color: #FFF; padding: 0 20px 0 3px; text-align: right;}291 .attendees-list .not-attendee { height:16px; }358 .attendee-options, .activity-options{ position: absolute; top: 0; left: 287px; background-color: white; z-index: 100; width: 90px; background-color: #FFF; padding: 0 20px 0 3px; text-align: right;} 359 .attendees-list .not-attendee, .activitys-list .not-activity { height:16px; } 292 360 293 361 .list-delegates{margin: 0 0 0 25px;} … … 296 364 297 365 .attendees-list .me .add-attendee-search input { max-width: 125px; } 298 .attendees-list li.organizer, .attendees-list li.me-delegated 366 .attendees-list li.organizer, .attendees-list li.me-delegated, .activitys-list li.organizer {margin-bottom: 3px;} 299 367 .attendees-list .organizer .button.swap { 300 368 float: right; … … 338 406 } 339 407 dd.attendee-list ul.attendee-list li label[title=''] { display:none } 408 dd.task-activity-list ul.task-activity-list li { 409 overflow: hidden; 410 position: relative; 411 } 412 413 414 dd.task-activity-list ul.task-activity-list li label.name, 415 dd.task-activity-list ul.task-activity-list li label.mail { 416 width: 99999px; 417 min-width: 99999px; 418 } 419 420 ul.task-activity-list li label.name{display: table-cell;} 421 422 dd.task-activity-list ul.task-activity-list li label[title=''] { display:none } 340 423 /* 341 424 dd.attendee-list ul.attendee-list li .button.close { … … 404 487 /* -- calendar list styles -- */ 405 488 406 .my-calendars .button.new 489 .my-calendars .button.new, .my-groups-task .button.new{ 407 490 float:right; 408 491 width: 15px; … … 410 493 } 411 494 412 .my-calendars .status-list {495 .my-calendars .status-list, .my-groups-task .status-list { 413 496 display: inline-block; 414 497 margin: 0px 0pc -4px -5px; … … 416 499 } 417 500 418 .my-calendars .list-calendars-item, .signed-calendars .list-calendars-item {501 .my-calendars .list-calendars-item, .signed-calendars .list-calendars-item, .my-groups-task .list-calendars-item{ 419 502 position: relative; 420 503 overflow: hidden; 421 504 } 422 .my-calendars .list-calendars-item div, .signed-calendars .list-calendars-item div {505 .my-calendars .list-calendars-item div, .signed-calendars .list-calendars-item div, .my-groups-task .list-calendars-item div{ 423 506 overflow:hidden; 424 507 width:6000px; … … 426 509 } 427 510 428 .my-calendars .cal-list-options-btn, .signed-calendars .cal-list-options-btn {511 .my-calendars .cal-list-options-btn, .signed-calendars .cal-list-options-btn, .my-groups-task .cal-list-options-btn { 429 512 position: absolute; 430 513 top: 2px; … … 459 542 460 543 .shared-calendar .user-list li.user-list{ 461 height: 17px;544 height: 20px; 462 545 overflow: hidden; 463 position: relative; 546 position: relative; 464 547 } 465 548 … … 474 557 } 475 558 559 //Remover bordas indesejáveis no Ie 560 input[type="checkbox"]{border: none 0px;} 561 476 562 .user-acls-shared-calendar{ 477 563 width: 130px; 478 564 float: right; 479 565 position: absolute; 480 left: 200px; 481 566 left: 200px; 567 top:2px; 482 568 background: white; 483 569 } … … 606 692 } 607 693 694 div.assing-calendar .add-user fieldset.block-add-user{ 695 width: 234px; 696 margin: 0; 697 padding: 0; 698 } 699 608 700 dd.user-list{ 609 701 height: 193px; … … 616 708 /*dd.calendar-list ul.user-list li.user-list div { 617 709 position:relative; 710 }*/ 711 712 /*dd.calendar-list ul.user-list li.user-list div { 713 position:relative; 618 714 }*/ 619 715 … … 714 810 715 811 .button.add.button-add-attachment{margin: -9px 0 0 8px;} 716 .button.btn-danger.delete{margin: 0 0 0 0;} 812 /*.button.btn-success.fileinput-button{width: 85px;}*/ 813 .button.btn-danger.delete{margin: 0 0 0 0; min-width: 143px;} 717 814 718 815 .button.upload{top: 4px;} … … 729 826 .lbl-archive-nome{width:40px !important;} 730 827 .row.fileupload-buttonbar{margin-top: -14px; padding: 0.2em 0.7em;} 828 .row.fileupload-buttonbar-task{margin-top: 0; padding: 0.2em 0.7em;} 731 829 732 830 .archive-nome{width: 73px;} … … 745 843 /* -- alarm dysplay -- */ 746 844 747 .new-event-alarm {845 .new-event-alarm, .new-task-alarm{ 748 846 margin: 5px; 749 847 font: bold; 750 848 } 751 849 752 .title-event-alarm {850 .title-event-alarm, .title-task-alarm{ 753 851 margin: 5px; 754 852 } 755 853 756 .description-event-alarm {854 .description-event-alarm, .description-task-alarm{ 757 855 margin: 5px; 758 856 } 759 857 760 .inicialize-event-alarm {858 .inicialize-event-alarm, .inicialize-task-alarm{ 761 859 margin: 5px; 762 860 } … … 861 959 .ui-dialog .ui-button-text-only .ui-button-text { padding: 0.4em 1em; } 862 960 863 .new-event-win fieldset { border: none; margin: 0; padding: 0; } 864 .new-event-win fieldset.tab-level2 { padding: 0px 5px; } 865 .new-event-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset { padding: 5px 0; } 961 .new-event-win fieldset, .new-task-win fieldset { border: none; margin: 0; padding: 0; } 962 .new-event-win fieldset.tab-level2, .new-task-win fieldset.tab-level2 { padding: 0px 5px; } 963 .new-event-win fieldset fieldset, .new-task-win fieldset.tab-level2 fieldset, 964 .new-task-win fieldset fieldset, .new-task-win fieldset.tab-level2 fieldset{ padding: 5px 0; } 965 966 .new-activity-win fieldset { border: none; margin: 0; padding: 0; } 967 .new-activity-win fieldset.tab-level2 { padding: 0px 5px; } 968 .new-activity-win fieldset fieldset, .new-activity-win fieldset.tab-level2 fieldset { padding: 5px 0; } 866 969 867 970 .hidden { … … 904 1007 } 905 1008 1009 .new-event-win form.form-addevent { padding: 9px; } 1010 1011 .new-activity-win div.div-addtask { padding: 0; width: 774px; border: 0;} 1012 .new-activity-win div.div-addactivity { padding: 0; width: 734px; border: 0;} 1013 .new-activity-win form.form-addevent { padding: 9px; } 906 1014 .ui-dialog .ui-dialog-content { padding: 0; } 907 .new-event-win div.div-addevent { padding: 0; width: 700px; border: 0;} 908 .new-event-win form.form-addevent { padding: 9px; } 1015 .new-event-win div.div-addevent{ padding: 0; width: 700px; border: 0;} 1016 .new-task-win div.div-addtask { padding: 0; width: 774px; border: 0;} 1017 .new-event-win form.form-addevent, .new-task-win form.form-addtask { padding: 9px; } 1018 .new-activity-win div.div-addevent { padding: 0; width: 700px; border: 0;} 1019 .new-activity-win form.form-addevent { padding: 9px; } 909 1020 910 1021 .expresso-calendar-container input[type="text"] { height: 18px; } … … 929 1040 930 1041 .expresso-calendar-container input.h1, 931 .new-event-win input.h1 {1042 .new-event-win input.h1, .new-task-win input.h1, .new-activity-win input.h1 { 932 1043 font-size: 150%; 933 1044 font-weight: bold; … … 936 1047 } 937 1048 938 .new-event-win textarea {1049 .new-event-win textarea, .new-task-win textarea, .new-activity-win textarea { 939 1050 width:600px; 940 1051 height: 210px; … … 945 1056 span.input-group { display: block; } 946 1057 /*p.input-group label { vertical-align: top; }*/ 947 .new-event-win p.input-group label { display: inline-block; width: 65px;} 948 .new-event-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;} 1058 .new-event-win p.input-group label, .new-task-win p.input-group label { display: inline-block; width: 65px;} 1059 .new-event-win p.input-group label.input-group, .new-task-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;} 1060 .new-activity-win p.input-group label { display: inline-block; width: 65px;} 1061 .new-activity-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;} 949 1062 950 1063 input.number {text-align: right} … … 966 1079 .new-event-win fieldset.event-repeat-container label, 967 1080 .new-event-win p.input-group.event-repeat-weekly label, 968 .new-event-win p.input-group.event-repeat-monthly label { 1081 .new-event-win p.input-group.event-repeat-monthly label, 1082 .new-task-win fieldset.task-repeat-container label, 1083 .new-task-win p.input-group.task-repeat-weekly label, 1084 .new-task-win p.input-group.task-repeat-monthly label 1085 { 969 1086 width: auto; 970 1087 } … … 973 1090 .new-event-win fieldset.search-field, 974 1091 .new-event-win fieldset.block-add-attendee-permissions, 975 .new-event-win fieldset.block-attendee-list { 1092 .new-event-win fieldset.block-attendee-list, 1093 .new-task-win fieldset.input-field-rounded, 1094 .new-task-win fieldset.search-field, 1095 .new-task-win fieldset.block-add-attendee-permissions, 1096 .new-task-win fieldset.block-attendee-list 1097 { 976 1098 border:1px solid #CFCFCF; 977 1099 } 978 1100 979 .new-event-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;} 980 .new-event-win fieldset.block-attendee-list ul { height:160px; overflow: auto;} 1101 .new-event-win fieldset.block-attendee-list, .new-task-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;} 1102 .new-event-win fieldset.block-attendee-list ul, .new-task-win fieldset.block-attendee-list ul { height:160px; overflow: auto;} 1103 /**/ 1104 .new-activity-win fieldset.event-repeat-container label, 1105 .new-activity-win p.input-group.event-repeat-weekly label, 1106 .new-activity-win p.input-group.event-repeat-monthly label { 1107 width: auto; 1108 } 1109 1110 .new-activity-win fieldset.input-field-rounded, 1111 .new-activity-win fieldset.search-field, 1112 .new-activity-win fieldset.block-add-attendee-permissions, 1113 .new-activity-win fieldset.block-attendee-list { 1114 border:1px solid #CFCFCF; 1115 } 1116 1117 .new-activity-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;} 1118 .new-activity-win fieldset.block-attendee-list ul { height:160px; overflow: auto;} 981 1119 982 1120 … … 1148 1286 } 1149 1287 1150 .events-list-win table img {1151 width: 12px;1152 height: 12px;1153 padding: 0 2px;1154 }1155 1288 1156 1289 .events-list-win table span { font-size:12px; } -
branches/2.4/prototype/modules/calendar/css/style.css
r6933 r7228 45 45 .ui-dialog .ui-button-text-only .ui-button-text { padding: 0.4em 1em; } 46 46 47 .new-event-win fieldset { border: none; margin: 0; padding: 0; } 48 .new-event-win fieldset.tab-level2 { padding: 0px 5px; min-height: 310px; max-height: 310px; overflow: auto;} 49 .new-event-win .overflow_add_calender { overflow: auto; max-height: 320px; } 50 .new-event-win fieldset#calendar_addevent_details7 { overflow: hidden} 51 .new-event-win fieldset#calendar_addevent_details5 .button-files-upload{margin: 15px 0 0 0} 52 .new-event-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset { padding: 5px 0; } 47 .new-event-win fieldset, .new-task-win fieldset { border: none; margin: 0; padding: 0; } 48 .new-event-win fieldset.tab-level2, .new-task-win fieldset.tab-level2 { padding: 0px 5px; min-height: 110px; max-height: 310px; overflow: hidden;} 49 .new-event-win .overflow_add_calender, .new-task-win .overflow_add_calender { overflow: auto; max-height: 320px; } 50 .new-event-win fieldset#calendar_addevent_details7, .new-task-win fieldset#calendar_addevent_details7 { overflow: hidden} 51 .new-event-win fieldset#calendar_addevent_details5 .button-files-upload, .new-task-win fieldset#calendar_addevent_details5 .button-files-upload{margin: 15px 0 0 0} 52 .new-event-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset, .new-task-win fieldset fieldset, .new-event-win fieldset.tab-level2 fieldset { padding: 5px 0; } 53 54 .new-activity-win fieldset { border: none; margin: 0; padding: 0; } 55 .new-activity-win fieldset.tab-level2 { padding: 0px 5px; min-height: 250px; max-height: 310px; overflow: auto;} 56 57 .new-activity-win .overflow_add_calender { overflow: auto; max-height: 320px; } 58 .new-activity-win fieldset#calendar_addevent_details7 { overflow: hidden} 59 .new-activity-win fieldset#calendar_addevent_details5 .button-files-upload{margin: 15px 0 0 0} 60 .new-activity-win fieldset fieldset, .new-activity-win fieldset.tab-level2 fieldset { padding: 5px 0; } 53 61 54 62 .hidden { … … 92 100 93 101 .ui-dialog .ui-dialog-content { padding: 0; } 94 .new-event-win div.div-addevent { padding: 0; width: 700px; border: 0;} 95 .new-event-win form.form-addevent { padding: 9px; } 102 .new-event-win div.div-addevent{ padding: 0; width: 700px; border: 0;} 103 .new-task-win div.div-addtask { padding: 0; width: 774px; border: 0;} 104 105 .new-event-win form.form-addevent, 106 .new-task-win form.form-addtask, 107 .new-activity-win form.form-addactivity { padding: 9px; } 108 109 .new-activity-win input.time{width: 45px;} 110 .new-activity-win input.date{width: 80px;} 111 112 .new-activity-win div.div-addactivity { padding: 0; width: 734px; border: 0;} 113 .new-activity-win form.form-addactivity { padding: 9px; } 96 114 97 115 .expresso-calendar-container input[type="text"] { height: 18px; } … … 116 134 117 135 .expresso-calendar-container input.h1, 118 .new-event-win input.h1 { 136 .new-event-win input.h1, 137 .new-task-win input.h1{ 119 138 font-size: 150%; 120 139 font-weight: bold; … … 122 141 height: 150%; 123 142 } 124 125 .new-event-win textarea { 143 .new-activity-win input.h1 { 144 font-size: 150%; 145 font-weight: bold; 146 width: 100%; 147 height: 150%; 148 } 149 150 .expresso-calendar-container input.h1, 151 .new-task-win input.h1 { 152 font-size: 150%; 153 font-weight: bold; 154 width: 64%; 155 height: 150%; 156 } 157 158 .new-event-win textarea, .new-task-win textarea { 126 159 width:600px; 127 160 height: 210px; … … 130 163 } 131 164 165 .new-activity-win textarea { 166 width:600px; 167 height: 210px; 168 border: 1px solid #CFCFCF; 169 padding: 0px; 170 } 132 171 span.input-group { display: block; } 133 172 /*p.input-group label { vertical-align: top; }*/ 134 .new-event-win p.input-group label { display: inline-block; width: 65px;} 135 .new-event-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;} 173 .new-event-win p.input-group label, .new-task-win p.input-group label { display: inline-block; width: 65px;} 174 .new-event-win p.input-group label.input-group, .new-task-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;} 175 .new-activity-win p.input-group label { display: inline-block; width: 65px;} 176 .new-activity-win p.input-group label.input-group { display: inline-block; width: 110px; font-weight: bold;} 136 177 137 178 input.number {text-align: right} … … 153 194 .new-event-win fieldset.event-repeat-container label, 154 195 .new-event-win p.input-group.event-repeat-weekly label, 155 .new-event-win p.input-group.event-repeat-monthly label { 196 .new-event-win p.input-group.event-repeat-monthly label, 197 .new-task-win fieldset.task-repeat-container label, 198 .new-task-win p.input-group.task-repeat-weekly label, 199 .new-task-win p.input-group.task-repeat-monthly label 200 { 156 201 width: auto; 202 } 203 204 .new-activity-win fieldset.event-repeat-container label, 205 .new-activity-win p.input-group.event-repeat-weekly label, 206 .new-activity-win p.input-group.event-repeat-monthly label { 207 width: auto; 157 208 } 158 209 … … 160 211 .new-event-win fieldset.search-field, 161 212 .new-event-win fieldset.block-add-attendee-permissions, 162 .new-event-win fieldset.block-attendee-list { 213 .new-event-win fieldset.block-attendee-list, 214 .new-task-win fieldset.input-field-rounded, 215 .new-task-win fieldset.search-field, 216 .new-task-win fieldset.block-add-attendee-permissions, 217 .new-task-win fieldset.block-attendee-list{ 163 218 border:1px solid #CFCFCF; 164 219 } 165 220 221 .new-event-win fieldset.block-attendee-list, .new-task-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;} 222 .new-event-win fieldset.block-attendee-list ul, .new-task-win fieldset.block-attendee-list ul { height:160px; overflow: auto;} 223 224 .new-activity-win fieldset.input-field-rounded, 225 .new-activity-win fieldset.search-field, 226 .new-activity-win fieldset.block-add-attendee-permissions, 227 .new-activity-win fieldset.block-attendee-list { 228 border:1px solid #CFCFCF; 229 } 230 /*Duvida*/ 166 231 .new-event-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;} 167 232 .new-event-win fieldset.block-attendee-list ul { height:160px; overflow: auto;} 233 234 .new-activity-win fieldset.block-attendee-list { width: 300px; max-height:180px; padding: 5px; float: left;} 235 .new-activity-win fieldset.block-attendee-list ul { height:160px; overflow: auto;} 168 236 169 237 … … 223 291 .block-vertical-toolbox .button.add { 224 292 width:190px; 225 } 293 margin-bottom: 5px; 294 } 295 296 div.qtip div.add-simple-task input{width: 188px} 297 div.qtip div.add-simple-task textarea{width: 184px} 298 226 299 227 300 .fc-header .fc-state-active, .fc-header .ui-state-active { … … 335 408 } 336 409 337 .events-list-win table img {338 width: 12px;339 height: 12px;340 padding: 0 2px;341 }342 343 410 .events-list-win table span { font-size:12px; } 344 411 .events-list-win table .same-start-date * { border: 0; } … … 348 415 .events-list-win table th.start-date-multiple-events { border-bottom: 1px solid #ccc; } 349 416 417 .events-list-win .fc-header-right.list-right{width: 26%} 418 350 419 .events-list-win table .title { 351 420 font-size: 150%; … … 361 430 .expresso-calendar-container .search-field input { border:none;} 362 431 363 .ui-tabs .ui-tabs-panel { padding: 0; margin-top: 1 0px;}432 .ui-tabs .ui-tabs-panel { padding: 0; margin-top: 11px;} 364 433 365 434 .ui-tabs .ui-tabs-nav li .ui-icon-close { … … 459 528 460 529 input.inputNumber {width:80px; text-align: left;} 530 531 .div-addtask #calendar_addtask_details1 .h1{ 532 width: 100%; 533 } 534 535 .div-addtask #calendar_addtask_details2 textarea { 536 width: 670px; 537 } 538 539 .div-addtask{ 540 width: 760px; 541 } 542 543 .calendar-addevent-details-txt-timezone, .calendar-addtask-details-txt-timezone{width: 217px;} 544 545 .div-addtask #calendar_addtask_details1 .time-prevision { width: 40px; } 546 547 .div-addtask #calendar_addtask_details1 .date-prevision{ width: 80px; } 548 549 .div-addtask #calendar_addtask_details1 .start-time{ width: 40px; } 550 .div-addtask #calendar_addtask_details1 .start-date{ width: 80px; } 551 .div-addtask #calendar_addtask_details1 .end-time{ width: 40px; } 552 .div-addtask #calendar_addtask_details1 .end-date{ width: 80px; } 553 .div-addtask #calendar_addtask_details1 .prevision-termino { margin: 0 0 0 30px; } 554 .div-addtask #calendar_addtask_details1 .subitem { margin: 5px; display: block;} 555 .div-addtask #calendar_addtask_details1 .subitem .span_done{ margin: 0 30px;} 556 .div-addtask #calendar_addtask_details1 .subitem .span_done img{position: relative; top:4px; width:16px; height:16px;} 557 .div-addtask #calendar_addtask_details1 .calendar_addevent_details_lnk_timezone { margin: 0 0 0 20px;} 558 .div-addtask #calendar_addtask_details1 .subitem .done { width: 45px;} 559 560 @-moz-document url-prefix() {.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{ top: -14px !important;}} 561 562 @media screen and (-webkit-min-device-pixel-ratio:0){.div-addtask #calendar_addtask_details1 .ui-spinner-buttons{ top: -2px !important;}} 563 564 .div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-up{height: 7px !important;} 565 .div-addtask #calendar_addtask_details1 .ui-spinner-buttons .ui-spinner-down{height: 8px !important;} 566 567 .div-addtask #calendar_addtask_details1 .subitem .span_done.noAction{background-image: url("../img/gray.png"); background-repeat: no-repeat; } 568 .div-addtask #calendar_addtask_details1 .subitem .span_done.inProcess{background-image: url("../img/yellow.png"); background-repeat: no-repeat;} 569 .div-addtask #calendar_addtask_details1 .subitem .span_done.finished{background-image: url("../img/green.png"); background-repeat: no-repeat;} 570 .div-addtask #calendar_addtask_details1 .subitem .span_done.canceled{background-image: url("../img/red.png"); background-repeat: no-repeat;} 571 .div-addtask #calendar_addtask_details1 .subitem .span_done label{position: relative; left: 28px;} 572 573 .div-addtask fieldset#calendar_addtask_details5.tab-level2{margin: 0} 574 575 .div-addtask #calendar_addtask_details8 .parent {width: 746px; min-height: 208px; float: left;} 576 /*.div-addtask #calendar_addtask_details8 .parent .child-top {width: 745px; height: 20px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}*/ 577 .div-addtask #calendar_addtask_details8 .parent .child-top {width: 745px; height: 25px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; border-top: 1px solid #CCC;} 578 .div-addtask #calendar_addtask_details8 .parent .child-bottom {width: 745px; height: 208px; overflow: auto; float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;} 579 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each { height: 20px; } 580 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;} 581 582 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour {overflow: hidden; width: 140px; float: left; height: 20px} 583 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; } 584 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user{overflow: hidden; width: 150px; float: left; height: 20px; border-left: 1px solid #CCC; } 585 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .user span{ margin: 8px; float: left; } 586 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute{overflow: hidden; width: 130px; float: left; height: 20px; border-left: 1px solid #CCC; } 587 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .attribute span{ margin: 8px; float: left; } 588 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue{overflow: hidden; width: 150px; float: left; height: 20px; border-left: 1px solid #CCC; } 589 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .beforeValue span{ margin: 8px; float: left; } 590 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue{overflow: hidden; width: 150px; float: left; height: 20px; border-left: 1px solid #CCC; } 591 .div-addtask #calendar_addtask_details8 .parent .child-bottom .child-bottom-each .afterValue span{ margin: 8px; float: left; } 592 593 .div-addtask #calendar_addtask_details8 .parent .child-top .date-hour { width: 140px; float: left; background: #E8F4FD; height: 20px; text-align: center; } 594 .div-addtask #calendar_addtask_details8 .parent .child-top .date-hour span{ display: block; padding: 6px; font-weight: bold; color: #2E6E9E; } 595 .div-addtask #calendar_addtask_details8 .parent .child-top .user { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 596 .div-addtask #calendar_addtask_details8 .parent .child-top .user span{display: block; padding: 6px;} 597 .div-addtask #calendar_addtask_details8 .parent .child-top .attribute { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 598 .div-addtask #calendar_addtask_details8 .parent .child-top .attribute span{display: block; padding: 6px;} 599 .div-addtask #calendar_addtask_details8 .parent .child-top .beforeValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 600 .div-addtask #calendar_addtask_details8 .parent .child-top .beforeValue span{display: block; padding: 6px; } 601 .div-addtask #calendar_addtask_details8 .parent .child-top .afterValue { width: 150px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 602 .div-addtask #calendar_addtask_details8 .parent .child-top .afterValue span{display: block; padding: 6px; } 603 604 /*Atividades*/ 605 606 .div-addactivity{ width: 734px;} 607 .div-addactivity #group_addactivity_details1 .h1{ width: 100%;} 608 .div-addactivity #group_addactivity_details2 textarea { width: 635px; } 609 .div-addactivity #group_addactivity_details1 .time-due { width: 40px; } 610 .div-addactivity #group_addactivity_details1 .date-due{ width: 80px; } 611 612 .div-addactivity #group_addactivity_details1 .start-time{ width: 40px; } 613 .div-addactivity #group_addactivity_details1 .start-date{ width: 80px; } 614 .div-addactivity #group_addactivity_details1 .end-time{ width: 40px; } 615 .div-addactivity #group_addactivity_details1 .end-date{ width: 80px; } 616 .div-addactivity #group_addactivity_details1 .prevision-termino { margin: 0 0 0 30px; } 617 .div-addactivity #group_addactivity_details1 .subitem { margin: 5px; display: block;} 618 .div-addactivity #group_addactivity_details1 .subitem .span_done{ margin: 0 30px;} 619 .div-addactivity #group_addactivity_details1 .calendar_addevent_details_lnk_timezone { margin: 0 0 0 20px;} 620 .div-addactivity #group_addactivity_details1 .subitem .done { width: 45px;} 621 622 .div-addactivity #group_addactivity_details1 .subitem .span_done.noAction{background-image: url("../img/gray.png"); background-repeat: no-repeat; } 623 .div-addactivity #group_addactivity_details1 .subitem .span_done.inProcess{background-image: url("../img/yellow.png"); background-repeat: no-repeat;} 624 .div-addactivity #group_addactivity_details1 .subitem .span_done.finished{background-image: url("../img/green.png"); background-repeat: no-repeat;} 625 .div-addactivity #group_addactivity_details1 .subitem .span_done.canceled{background-image: url("../img/red.png"); background-repeat: no-repeat;} 626 .div-addactivity #group_addactivity_details1 .subitem .span_done label{position: relative; left: 28px;} 627 628 .div-addactivity #group_addactivity_details5.tab-level2{margin-top: 2px;} 629 .div-addactivity #group_addactivity_details5 .button-files-upload { margin: 0 0 0 5px; } 630 631 /**********************************************************************************************************/ 632 .div-addactivity #group_addactivity_details6 .parent {width: 695px; min-height: 208px; float: left;} 633 /*.div-addactivity #group_addactivity_details6 .parent .child-top {width: 745px; height: 20px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;}*/ 634 .div-addactivity #group_addactivity_details6 .parent .child-top {width: 695px; height: 25px; background: #E8F4FD; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC; border-top: 1px solid #CCC;} 635 .div-addactivity #group_addactivity_details6 .parent .child-bottom {width: 695px; height: 208px; overflow: auto; float: left; border-left: 1px solid #CCC; border-right: 1px solid #CCC; border-bottom: 1px solid #CCC;} 636 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each { height: 20px; } 637 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each:hover { background: #FFF2F2; cursor: pointer;} 638 639 .div-addactivity #group_addactivity_details6 .parent .child-bottom .task { height: 25px; text-align: center; background: #FEFEAD; border-bottom: 1px solid #CCC;} 640 .div-addactivity #group_addactivity_details6 .parent .child-bottom .task.left {border-top: 1px solid #CCC;} 641 .div-addactivity #group_addactivity_details6 .parent .child-bottom .task span{padding: 5px; display: block;} 642 643 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .date-hour {overflow: hidden; width: 140px; float: left; height: 20px} 644 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .date-hour span { margin: 8px; float: left; } 645 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .user{overflow: hidden; width: 145px; float: left; height: 20px; border-left: 1px solid #CCC; } 646 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .user span{ margin: 8px; float: left; } 647 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .attribute{overflow: hidden; width: 130px; float: left; height: 20px; border-left: 1px solid #CCC; } 648 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .attribute span{ margin: 8px; float: left; } 649 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .beforeValue{overflow: hidden; width: 130px; float: left; height: 20px; border-left: 1px solid #CCC; } 650 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .beforeValue span{ margin: 8px; float: left; } 651 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .afterValue{overflow: hidden; width: 129px; float: left; height: 20px; border-left: 1px solid #CCC; } 652 .div-addactivity #group_addactivity_details6 .parent .child-bottom .child-bottom-each .afterValue span{ margin: 8px; float: left; } 653 654 .div-addactivity #group_addactivity_details6 .parent .child-top .date-hour { width: 140px; float: left; background: #E8F4FD; height: 20px; text-align: center; } 655 .div-addactivity #group_addactivity_details6 .parent .child-top .date-hour span{ display: block; padding: 6px; font-weight: bold; color: #2E6E9E; } 656 .div-addactivity #group_addactivity_details6 .parent .child-top .user { width: 145px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 657 .div-addactivity #group_addactivity_details6 .parent .child-top .user span{display: block; padding: 6px; } 658 .div-addactivity #group_addactivity_details6 .parent .child-top .attribute { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 659 .div-addactivity #group_addactivity_details6 .parent .child-top .attribute span{display: block; padding: 6px; } 660 .div-addactivity #group_addactivity_details6 .parent .child-top .beforeValue { width: 130px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 661 .div-addactivity #group_addactivity_details6 .parent .child-top .beforeValue span{display: block; padding: 6px; } 662 .div-addactivity #group_addactivity_details6 .parent .child-top .afterValue { width: 129px; float: left; background: #E8F4FD; height: 20px; font-weight: bold; color: #2E6E9E; text-align: center;} 663 .div-addactivity #group_addactivity_details6 .parent .child-top .afterValue span{display: block; padding: 6px; } -
branches/2.4/prototype/modules/calendar/export.php
r7093 r7228 1 1 <?php 2 3 /** 4 * 5 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 22 * 6731, PTI, EdifÃcio do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil 23 * or at e-mail address prognus@prognus.com.br. 24 * 25 * Neste arquivo são ser implementadas regras de negócio para a exportação de eventos e tarefas do ExpressoCalendar.26 * 27 * @license http://www.gnu.org/copyleft/gpl.html GPL 28 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 29 * @version 1.0 30 * @sponsor Caixa EconÃŽmica Federal 31 * @since Arquivo disponibilizado na versão Expresso 2.4.0 32 */ 2 3 /** 4 * 5 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation; either version 3 of the License, or 10 * any later version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 * 21 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 22 * 6731, PTI, Edifício do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil 23 * or at e-mail address prognus@prognus.com.br. 24 * 25 * Neste arquivo são ser implementadas regras de negócio para a exportação de eventos e tarefas do ExpressoCalendar. 26 * 27 * @license http://www.gnu.org/copyleft/gpl.html GPL 28 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 29 * @version 1.0 30 * @sponsor Caixa Econômica Federal 31 * @since Arquivo disponibilizado na versão Expresso 2.4.0 32 */ 33 33 34 34 require_once '../../api/controller.php'; … … 78 78 { 79 79 $event = Controller::read(array('concept' => 'schedulable' , 'id' => $params['event'])); 80 81 82 83 84 85 86 87 88 80 $attachmentRelation = Controller::find( array( 'concept' => 'schedulableToAttachment' ) , false ,array( 'filter' => array('=', 'schedulable' , $event['id']) )); 81 if(is_array($attachmentRelation)){ 82 $attachments = array(); 83 foreach($attachmentRelation as $key => $value) 84 if(isset($value['attachment']) || !!$value['attachment']) 85 $attachments[$key] = $value['attachment']; 86 //Pega os anexos sem source 87 $event['attachments'] = Controller::find( array( 'concept' => 'attachment' ) , false ,array( 'filter' => array('IN', 'id' , $attachments) )); 88 } 89 89 90 90 $repeat = Controller::find( array( 'concept' => 'repeat' ) , false ,array( 'filter' => array('=', 'schedulable' , $event['id']) )); -
branches/2.4/prototype/modules/calendar/interceptors/DBMapping.php
r7093 r7228 1 1 <?php 2 /** 3 * 4 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 14 * details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * 20 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 21 * 6731, PTI, Edifício do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil 22 * or at e-mail address prognus@prognus.com.br. 23 * 24 * Neste arquivo são ser implementadas regras de negócio para consistir e normalizar os dados correspondentes às operações do usuário para o ExpressoCalendar. 25 * 26 * @license http://www.gnu.org/copyleft/gpl.html GPL 27 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 28 * @version 1.0 29 * @sponsor Caixa Econômica Federal 30 * @since Arquivo disponibilizado na versão Expresso 2.4.0 31 */ 32 2 /** 3 * 4 * Copyright (C) 2011 Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 3 of the License, or 9 * any later version. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 14 * details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software Foundation, 18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 * 20 * You can contact Prognus Software Livre headquarters at Av. Tancredo Neves, 21 * 6731, PTI, Edifício do Saber, 3º floor, room 306, Foz do Iguaçu - PR - Brasil 22 * or at e-mail address prognus@prognus.com.br. 23 * 24 * Neste arquivo são ser implementadas regras de negócio para consistir e normalizar os dados correspondentes às operações do usuário para o ExpressoCalendar. 25 * 26 * @license http://www.gnu.org/copyleft/gpl.html GPL 27 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 28 * @version 1.0 29 * @sponsor Caixa Econômica Federal 30 * @since Arquivo disponibilizado na versão Expresso 2.4.0 31 */ 32 33 33 34 34 35 //Definindo Constantes … … 39 40 use prototype\api\Config as Config; 40 41 41 /** 42 * Classe com implementações das regras de negócio para consistir e normalizar os dados correspondentes às operações do usuário para o ExpressoCalendar. 43 * 44 * @license http://www.gnu.org/copyleft/gpl.html GPL 45 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 46 * @sponsor Caixa Econômica Federal 47 * @version 1.0 48 * @since Classe disponibilizada na versão Expresso 2.4.0 49 */ 42 /** 43 * Classe com implementações das regras de negócio para consistir e normalizar os dados correspondentes às operações do usuário para o ExpressoCalendar. 44 * 45 * @license http://www.gnu.org/copyleft/gpl.html GPL 46 * @author Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br) 47 * @sponsor Caixa Econômica Federal 48 * @version 1.0 49 * @since Classe disponibilizada na versão Expresso 2.4.0 50 */ 50 51 51 52 class DBMapping extends Helpers { 52 53 53 static function encodeCreateSchedulable(&$uri, &$params, &$criteria, $original) { 54 $params['type_id'] = EVENT_ID; 55 56 if (!is_numeric($params['startTime'])) 57 $params['startTime'] = self::parseTimeDate($params['startTime'], $params['timezone']); 58 59 if (!is_numeric($params['endTime'])) { 60 $params['endTime'] = self::parseTimeDate($params['endTime'], $params['timezone']); 61 62 if ($params['allDay']) 63 $params['endTime'] = $params['endTime'] + 86400000; 64 } 65 66 $params['rangeEnd'] = $params['endTime']; 67 $params['rangeStart'] = $params['startTime']; 68 69 /////////////////////////////////////////////////////////////////// 70 71 $params['dtstamp'] = (isset($params['dtstamp'])) ? $params['dtstamp'] : time() . '000'; 72 $params['lastUpdate'] = (isset($params['lastUpdate'])) ? $params['lastUpdate'] : time() . '000'; 73 $params['type'] = EVENT_ID; 74 $params['uid'] = isset($params['uid']) ? $params['uid'] : self::_makeUid(); 75 } 54 static function encodeCreateSchedulable(&$uri, &$params, &$criteria, $original) 55 { 56 57 if (isset($params['startTime']) && !is_numeric($params['startTime'])) 58 $params['startTime'] = self::parseTimeDate($params['startTime'], $params['timezone']); 59 60 $params['rangeStart'] = $params['startTime']; 61 62 if (isset($params['endTime']) && !is_numeric($params['endTime'])) { 63 $params['endTime'] = self::parseTimeDate($params['endTime'], $params['timezone']); 64 65 if ($params['allDay']) 66 $params['endTime'] = $params['endTime'] + 86400000; 67 } 68 69 $params['rangeEnd'] = $params['endTime']; 70 71 72 if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due'])) 73 $params['due'] = self::parseTimeDate($params['due'], $params['timezone']); 74 75 /////////////////////////////////////////////////////////////////// 76 77 $params['dtstamp'] = (isset($params['dtstamp'])) ? $params['dtstamp'] : time() . '000'; 78 $params['lastUpdate'] = (isset($params['lastUpdate'])) ? $params['lastUpdate'] : time() . '000'; 79 $params['uid'] = isset($params['uid']) ? $params['uid'] : self::_makeUid(); 80 } 76 81 77 82 static function parseTimeDate($time, $timezone) { … … 107 112 if (isset($params['type'])) 108 113 $params['type'] = self::codeAlarmType($params['type']); 114 else{ 115 $alarm = Controller::read( array('concept' => 'alarm' , 'id' => $params['id'] )); 116 117 $params['unit'] = $alarm['unit']; 118 } 119 $params['offset'] = $params['time'] * 1000; 120 121 122 switch( strtolower($params['unit']) ) 123 { 124 case 'd': $params['offset'] *= 24; 125 case 'h': $params['offset'] *= 60; 126 case 'm': $params['offset'] *= 60; 127 } 128 109 129 } 110 130 … … 160 180 .'calendar_object.dtstart as "startTime", calendar_object.summary as "summary", ' 161 181 .'calendar_object.description as "description", calendar_object.dtend as "endTime" , ' 182 .'calendar_object.priority as "priority", calendar_object.due as "due", ' 183 .'calendar_object.percentage as "percentage", calendar_object.status as "status", ' 162 184 .'calendar_object.location as "location", calendar_object.allday as "allDay", ' 163 185 .'calendar_object.transp as "transparent", calendar_object.class_id as "class", ' … … 168 190 .'calendar FROM calendar_to_calendar_object , calendar_object ' 169 191 .'WHERE ( calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $criteria['filter'][2][2]) . '\')) ' 170 .'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id '; 192 .'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id ' 193 .'AND calendar_object.id NOT IN(select calendar_object_task_id from calendar_task_to_activity_object where owner = \'' . Config::me('uidNumber') . '\') '; 171 194 172 195 if(isset($criteria['searchEvent']) && $criteria['searchEvent']){ … … 198 221 $params = array_merge($params, $occ); 199 222 } 223 $params = self::deepnessFindEvent($uri, $params, $criteria, $original); 224 return false; 225 } 226 } 227 228 public function findTask(&$uri, &$params, &$criteria, $original) { 229 230 if (isset($criteria['filterTasks']) && $criteria['filterTasks']) { 231 232 $sql = ' SELECT calendar_object.id as id ,calendar_object.cal_uid as "uid", calendar_object.type_id as "type", ' 233 .'calendar_object.dtstart as "startTime", calendar_object.summary as "summary", ' 234 .'calendar_object.description as "description", calendar_object.dtend as "endTime" , ' 235 .'calendar_object.priority as "priority", calendar_object.due as "due", ' 236 .'calendar_object.percentage as "percentage", calendar_object.status as "status", ' 237 .'calendar_object.location as "location", calendar_object.allday as "allDay", ' 238 .'calendar_object.transp as "transparent", calendar_object.class_id as "class", ' 239 .'calendar_object.repeat as "repeat", calendar_object.range_start as "rangeStart", ' 240 .'calendar_object.range_end as "rangeEnd", calendar_object.last_update as "lastUpdate", ' 241 .'calendar_object.dtstamp as "dtstamp", calendar_object.sequence as "sequence", ' 242 .'calendar_object.tzid as "timezone" ,calendar_to_calendar_object.calendar_id as ' 243 .'calendar FROM calendar_to_calendar_object , calendar_object ' 244 .'WHERE ( calendar_to_calendar_object.calendar_id IN (\'' . implode('\',\'', $criteria['filter'][3][2]) . '\')) ' 245 .'AND calendar_to_calendar_object.calendar_object_id = calendar_object.id ' 246 .'AND calendar_to_calendar_object.calendar_object_id NOT IN (select calendar_object_activity_id from calendar_task_to_activity_object where owner = \'' . Config::me("uidNumber") . '\' ) ' 247 .'AND calendar_to_calendar_object.calendar_object_id NOT IN (select calendar_object_task_id from calendar_task_to_activity_object where owner = \'' . Config::me("uidNumber") . '\' ) '; 248 249 if(isset($criteria['filter'][4])) 250 $sql .= 'AND (((upper("summary") like upper(\'%'.$criteria['filter'][4][1][2].'%\') OR upper("description") like upper(\'%'.$criteria['filter'][4][1][2].'%\'))))'; 251 252 $sql .= 'AND (range_start >= \'' . $criteria['filter'][2][2] . '\' AND type_id <= \'' . $criteria['filter'][1][2] . '\')'; 253 254 $params = Controller::service('PostgreSQL')->execResultSql($sql); 200 255 $params = self::deepnessFindEvent($uri, $params, $criteria, $original); 201 256 return false; … … 442 497 } 443 498 444 //Encode Update 445 499 //Encode Update 446 500 public function encodeUpdateSchedulable(&$uri, &$params, &$criteria, $original) { 447 448 $event = Controller::read(array('concept' => 'schedulable', 'id' => $params['id'])); 449 450 if (isset($params['startTime'])) { 451 452 if (!is_numeric($params['startTime'])) 453 $params['startTime'] = self::parseTimeDate($params['startTime'], $event['timezone']); 454 455 $params['rangeStart'] = $params['startTime']; 456 }if (isset($params['endTime'])) { 457 458 if (!is_numeric($params['endTime'])) { 459 $params['endTime'] = self::parseTimeDate($params['endTime'], $event['timezone']); 460 461 if ((isset($params['allDay']) && $params['allDay']) || ( !isset($params['allDay']) && $event['allDay'])) 462 $params['endTime'] = $params['endTime'] + 86400000; 463 } 464 $params['rangeEnd'] = $params['endTime']; 465 } 501 $event = Controller::read(array('concept' => 'schedulable', 'id' => $uri['id'])); 502 if (isset($params['startTime'])) { 503 504 if (!is_numeric($params['startTime'])) 505 $params['startTime'] = self::parseTimeDate($params['startTime'], $event['timezone']); 506 507 $params['rangeStart'] = $params['startTime']; 508 } 509 510 if (isset($params['endTime'])) { 511 512 if (!is_numeric($params['endTime'])) { 513 $params['endTime'] = self::parseTimeDate($params['endTime'], $event['timezone']); 514 515 if ((isset($params['allDay']) && $params['allDay']) || ( !isset($params['allDay']) && $event['allDay'])) 516 $params['endTime'] = $params['endTime'] + 86400000; 517 } 518 $params['rangeEnd'] = $params['endTime']; 519 } 520 521 522 if (isset($params['due']) && $params['due'] != '' && !is_numeric($params['due'])) 523 $params['due'] = self::parseTimeDate($params['due'], $event['timezone']); 524 525 if($event['type'] == '2'){ 526 $criteria['historic'] = $params; 527 $criteria['beforeValue'] = $event; 528 529 if(isset($params['startTime']) && $params['startTime'] == $event['startTime']) 530 unset($criteria['historic']['startTime']); 531 if(isset($params['due']) && $params['due'] == $event['due']) 532 unset($criteria['historic']['due']); 533 534 //necessário para atulizar a atividade de composta pela tarefa aqui sendo atualizada 535 if(isset($criteria['historic']['startTime']) || isset($criteria['historic']['endTime'])){ 536 $taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'task', $uri['id']), array('=', 'owner', Config::me('uidNumber'))), 'deepness' => 2)); 537 if(!empty($taskToActivity)){ 538 $activity = Controller::read(array('concept' => 'schedulable', 'id' => $taskToActivity[0]['activity']), array('startTime', 'endTime', 'rangeStart', 'rangeEnd', 'allDay')); 539 $isAllDay = 1; 540 541 if(!empty($activity)){ 542 $start = $params['startTime']; 543 $end = $params['endTime']; 544 foreach($taskToActivity as $t){ 545 if($t['task']['id'] != $params['id']){ 546 $start = $t['task']['startTime'] < $start ? $t['task']['startTime'] : $start; 547 $end = $t['task']['endTime'] > $end ? $t['task']['endTime'] : $end; 548 $isAllDay = (($isAllDay == 1) && ($t['task']['allDay'] == '1')) ? 1 : 0; 549 } 550 } 551 552 if($event['allDay'] == '0' || (isset($params['allDay']) && $params['allDay'] == '0')) 553 $isAllDay = 0; 554 555 $toUpdate = array(); 556 557 if($start != $activity['startTime']) 558 $toUpdate['startTime'] = $start; 559 560 if($end != $activity['endTime']){ 561 $toUpdate['endTime'] = $end; 562 $toUpdate['due'] = $end; 563 } 564 565 if($isAllDay != $activity['allDay']) 566 $toUpdate['allDay'] = $isAllDay; 567 568 if(!empty($toUpdate)) 569 Controller::update(array('concept' => 'schedulable', 'id' => $taskToActivity[0]['activity']), $toUpdate); 570 } 571 } 572 } 573 574 unset($criteria['historic']['endTime']); 575 unset($criteria['historic']['rangeEnd']); 576 unset($criteria['historic']['rangeStart']); 577 unset($criteria['historic']['class']); 578 unset($criteria['historic']['type']); 579 unset($criteria['historic']['allDay']); 580 unset($criteria['historic']['id']); 581 } 466 582 } 467 583 … … 494 610 } 495 611 612 613 static function prepareParticipantHistoric(&$uri, &$params, &$criteria, $original){ 614 $participant = Controller::read(array('concept' => 'participant', 'id' => $uri['id'])); 615 $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $participant['schedulable'])); 616 617 618 if($schedulable['type'] == '2') 619 $criteria['historic']['participant'] = $participant; 620 } 621 622 static function removeParticipantHistoric(&$uri, &$params, &$criteria, $original){ 623 if(isset($criteria['historic'])){ 624 625 $participant = $criteria['historic']['participant']; 626 627 Controller::create(array('concept' => 'calendarHistoric'), 628 array('schedulable' => $participant['schedulable'], 629 'user' => Config::me('uidNumber'), 630 'time' => time() . '000', 631 'attribute' => 'participant', 632 'beforeValue' => $participant['user'], 633 'afterValue' => '' 634 ) 635 ); 636 637 } 638 639 } 640 641 static function createParticipantHistoric(&$uri, &$params, &$criteria, $original){ 642 643 if(isset($original['properties']) && $original['properties']['isOrganizer'] != '1'){ 644 if(!isset($criteria['event'])){ 645 $event = Controller::read(array('concept' => 'schedulable', 'id' => $original['properties']['schedulable'])); 646 $criteria['event'] = $event; 647 }else 648 $event = $criteria['event']; 649 650 if($event['type'] == '2'){ 651 Controller::create(array('concept' => 'calendarHistoric'), 652 array('schedulable' => $original['properties']['schedulable'], 653 'user' => Config::me('uidNumber'), 654 'time' => time() . '000', 655 'attribute' => 'participant', 656 'beforeValue' => '', 657 'afterValue' => $original['properties']['user'] 658 ) 659 ); 660 } 661 } 662 } 663 664 static function createHistoric(&$uri, &$result, &$criteria, $original) { 665 666 if(isset($criteria['historic']) && count($criteria['historic'])){ 667 $time = time() . '000'; 668 669 foreach($criteria['historic'] as $k => $v){ 670 Controller::create(array('concept' => 'calendarHistoric'), 671 array('schedulable' => $uri['id'], 672 'user' => Config::me('uidNumber'), 673 'time' => $time, 674 'attribute' => $k, 675 'beforeValue' => $criteria['beforeValue'][$k], 676 'afterValue' => $v 677 ) 678 ); 679 } 680 } 681 } 682 496 683 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 497 684 … … 507 694 } 508 695 509 public function createCreateSchedulableToAttachment(&$uri, &$params, &$criteria, $original) { 510 if (array_key_exists('attachments', $original['properties'])) 511 foreach ($original['properties']['attachments'] as $key => $value) { 512 if (isset($params['id'])) 513 Controller::create(array('concept' => 'schedulableToAttachment'), array('attachment' => $value['attachment'], 'schedulable' => $params['id'])); 514 } 696 //TODO: Remover apos suporte a ManytoMany na api 697 public function createTasksToActivity(&$uri, &$result, &$criteria, $original) { 698 699 if(isset($original['properties']['taskToActivity']) && $original['properties']['taskToActivity']){ 700 701 foreach($original['properties']['taskToActivity'] as $relational) 702 703 Controller::create(array('concept' => 'taskToActivity'), array('task' => $relational['task'], 'owner' => $relational['owner'], 'activity' => $result['id'])); 704 705 } 706 } 707 708 public function removeAttachmentHistoric(&$uri, &$params, &$criteria, $original) { 709 710 if(isset($criteria['historic'])){ 711 $attachment = $criteria['historic']['attachment']; 712 713 $attachment['attachment'] = Controller::read(array('concept' => 'attachment', 'id' => $attachment['attachment']), array('name')); 714 Controller::create(array('concept' => 'calendarHistoric'), 715 array('schedulable' => $attachment['schedulable'], 716 'user' => Config::me('uidNumber'), 717 'time' => time() . '000', 718 'attribute' => 'attachment', 719 'beforeValue' => $attachment['attachment']['name'], 720 'afterValue' => '' 721 ) 722 ); 723 724 } 725 726 } 727 728 public function createAttachmentHistoric(&$uri, &$params, &$criteria, $original) { 729 $event = Controller::read(array('concept' => 'schedulable', 'id' => $original['properties']['schedulable'])); 730 731 if($event['type'] == '2'){ 732 $attachment = Controller::read(array('concept' => 'attachment', 'id' => $original['properties']['attachment']), array('name')); 733 734 Controller::create(array('concept' => 'calendarHistoric'), 735 array('schedulable' => $original['properties']['schedulable'], 736 'user' => Config::me('uidNumber'), 737 'time' => time() . '000', 738 'attribute' => 'attachment', 739 'beforeValue' => '', 740 'afterValue' => $attachment['name'] 741 ) 742 ); 743 744 } 515 745 } 516 746 517 747 public function deepnessFindCalendarShared(&$uri, &$result, &$criteria, $original) { 518 if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != '0' && count($result) > 0) { 519 520 $calendarIds = array(); 521 foreach ($result as $key => $value) 522 array_push($calendarIds, $value['calendar']); 523 524 $calendar = Controller::find(array('concept' => 'calendar'), false, array('filter' => array('AND', array('IN', 'id', $calendarIds), $original['criteria']['filter']))); 525 526 if ($calendar && count($calendar) > 0){ 527 $newResult = array(); 528 foreach ($calendar as $key => $value) { 529 foreach ($result as $k => $r) { 530 531 if ($r['calendar'] == $value['id']) { 532 $r['calendar'] = $value; 533 array_push($newResult, $r); 534 } 535 } 536 } 537 538 foreach ($newResult as $key => &$value) { 539 if ($value['user'] != 0) { 540 $user = $value['user']; 541 $value['user'] = Controller::read(array('concept' => 'user', 'id' => $user)); 542 543 if (!$value['user']) 544 $value['user'] = Controller::read(array('concept' => 'group', 'id' => $user)); 545 } 546 } 547 548 $result = $newResult; 549 }else 550 $result = ''; 551 } 748 if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != '0' && count($result) > 0) { 749 750 $calendarIds = array(); 751 foreach ($result as $value) 752 $calendarIds[] = $value['calendar']; 753 754 $calendar = Controller::find(array('concept' => 'calendar'), false, array('filter' => array('AND', array('IN', 'id', $calendarIds)))); 755 756 if ($calendar && count($calendar) > 0){ 757 $newResult = array(); 758 foreach ($calendar as $value) { 759 foreach ($result as $r) { 760 761 if ($r['calendar'] == $value['id']) { 762 $r['calendar'] = $value; 763 $newResult[] = $r; 764 } 765 } 766 } 767 768 foreach ($newResult as &$value) { 769 if ($value['user'] != 0) { 770 $value['user'] = Controller::read(array('concept' => 'user', 'id' => $value['user'])); 771 772 if (!$value['user']) 773 $value['user'] = Controller::read(array('concept' => 'group', 'id' => $value['user'])); 774 } 775 $value['owner'] = Controller::read(array('concept' => 'user', 'id' => $value['owner'])); 776 } 777 $result = $newResult; 778 }else 779 $result = ''; 780 } 781 } 782 783 //TODO: Remover apos suporte a deepness na api 784 public function deepnessFindTask(&$uri, &$result, &$criteria, $original) { 785 if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) 786 foreach($result as &$value) 787 $value['task'] = Controller::read(array('concept' => 'schedulable', 'id' => $value['task'])); 788 789 790 return $result; 791 } 792 793 //TODO: Remover apos suporte a deepness na api 794 public function deepnessFindHistoric(&$uri, &$result, &$criteria, $original) { 795 if (isset($original['criteria']['deepness']) && $original['criteria']['deepness'] != 0) { 796 foreach($result as &$v){ 797 $v['user'] = Controller::read(array('concept' => 'user', 'id' => $v['user'])); 798 799 if($v['attribute'] == 'participant'){ 800 if($v['beforeValue'] != '') 801 $v['beforeValue'] = Controller::read(array('concept' => 'user', 'id' => $v['beforeValue'])); 802 803 if($v['afterValue'] != '') 804 $v['afterValue'] = Controller::read(array('concept' => 'user', 'id' => $v['afterValue'])); 805 } 806 } 807 } 552 808 } 553 809 … … 559 815 foreach ($result as $i => $v) { 560 816 561 if ( isset($v['calendar']) && (!isset($currentTimezone) || $currentTimezone != $original['criteria']['timezones'][$v['calendar']])) {817 if ( isset($v['calendar']) && (!isset($currentTimezone) || $currentTimezone != $original['criteria']['timezones'][$v['calendar']])) { 562 818 $currentTimezone = isset($original['criteria']['timezones'][$v['calendar']]) ? $original['criteria']['timezones'][$v['calendar']] : $v['timezone']; 563 819 $Time->setTimezone(new DateTimeZone($currentTimezone)); … … 570 826 $DayLigth['calendar']['endTime'] = $Time->format('I') ? 1 : 0; 571 827 572 if ( $currentTimezone != $v['timezone']) {828 if (!isset($currentTimezone) || ($currentTimezone != $v['timezone'])) { 573 829 $currentTimezone = $v['timezone']; 574 830 $Time->setTimezone(new DateTimeZone($v['timezone'])); … … 584 840 585 841 $result[$i]['DayLigth'] = $DayLigth; 842 843 if(((int)$v['type']) == 2){ 844 845 $taskToActivity = Controller::find(array('concept' => 'taskToActivity'), false, array('filter' => array('AND', array('=', 'activity', $v['id']), array('=','owner', Config::me('uidNumber'))) , 'deepness' => 2)); 846 847 if($taskToActivity) 848 $result[$i]['taskToActivity'] = $taskToActivity; 849 850 $result[$i]['historic'] = Controller::find(array('concept' => 'calendarHistoric'), false, array('filter' => array('=', 'schedulable', $v['id']) , 'deepness' => 2)); 851 852 } 586 853 587 854 if (isset($v['id'])) { … … 649 916 } 650 917 918 } 919 920 if(isset($result['id']) && $result['type'] == '2'){ 921 $result['historic'] = Controller::find( array( 'concept' => 'calendarHistoric' ), false, array( 'filter' => array( '=', 'schedulable', $result['id'] ) ) ); 651 922 } 652 923 } … … 684 955 //Caso não seja o dono da agenda retorna o objeto permission com as acls 685 956 if ($result[$i]['isOwner'] == 0) { 686 $permission = Controller::find(array('concept' => 'calendarToPermission'), false, array('filter' => array('AND', array('=', 'calendar', $v['calendar']), array('=', 'user', Config::me('uidNumber')) )));957 $permission = Controller::find(array('concept' => 'calendarToPermission'), false, array('filter' => array('AND', array('=', 'calendar', $v['calendar']), array('=', 'user', Config::me('uidNumber')), 'deepness' => 2))); 687 958 688 959 if (!is_array($permission) || !$permission) { 689 960 690 $permission = Controller::find(array('concept' => 'calendarToPermission'), false, array('filter' => array('AND', array('=', 'calendar', $v['calendar']), array('=', 'type', '1')) ));961 $permission = Controller::find(array('concept' => 'calendarToPermission'), false, array('filter' => array('AND', array('=', 'calendar', $v['calendar']), array('=', 'type', '1')), 'deepness' => 2 )); 691 962 } 692 963 $result[$i]['permission'] = $permission[0]; … … 711 982 $result = $new; 712 983 } 984 } 985 986 public function addOwner(&$uri, &$params, &$criteria, $original) { 987 $owner = Controller::read( array( 'concept' => 'calendarSignature' ) , array('user') ,array( 'filter' => array('AND', array('=', 'isOwner' , '1'), array('=', 'calendar', $params['calendar'])))); 988 $params['owner'] = $owner[0]['user']; 713 989 } 714 990 … … 832 1108 833 1109 static private function countMyCalendarsEvent($id, $owner) { 834 $sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', ' user', $owner), array('=', 'isOwner', '1'))));1110 $sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', 'isOwner', '1'), array('=', 'user', $owner)))); 835 1111 $calendars = array(); 836 1112 foreach ($sig as $val) … … 848 1124 if(isset($criteria['filter']) && $criteria['filter'] && isset($criteria['filter'][1][2])){ 849 1125 $idSchedulable = $criteria['filter'][1][2]; 850 1126 $idCalendar = $criteria['filter'][2][2]; 851 1127 $owner = $criteria['filter'][3][2]; 852 1128 … … 885 1161 886 1162 $uri['id'] = $idSchedulable; 1163 1164 if(isset($criteria['filter']) && isset($criteria['filter'][4]) && isset($criteria['filter'][4][2])){ 1165 Controller::deleteALL(array('concept' => 'taskToActivity'), null, array('filter' => array('=', 'activity', $idSchedulable))); 1166 } 887 1167 } 888 1168 … … 935 1215 $schedulableAttachment = Controller::read(array('concept' => 'schedulableToAttachment'), false, array('filter' => array( '=', 'attachment' , $original['URI']['id'] ))); 936 1216 $uri['id'] = $schedulableAttachment[0]['id']; 1217 1218 $params = $schedulableAttachment[0]; 1219 1220 $event = Controller::read(array('concept' => 'schedulable', 'id' => $params['schedulable'])); 1221 if($event['type'] == '2') 1222 $criteria['historic']['attachment'] = $schedulableAttachment[0]; 1223 937 1224 } 938 1225 } 939 1226 940 1227 public function deleteAttachmentDependences(&$uri, &$params, &$criteria, $original) { 941 Controller::delete(array('concept' => 'attachment', 'id' => $original['URI']['id']));1228 Controller::delete(array('concept' => 'attachment', 'id' => (isset($params['attachment']) ? $params['attachment'] : $original['URI']['id']))); 942 1229 } 943 1230 … … 949 1236 } 950 1237 1238 1239 public function createDefaultGroup(&$uri, &$result, &$criteria, $original) { 1240 if( $original['criteria']['filter'][1][0] == '=' && 1241 $original['criteria']['filter'][1][1] == 'user' && 1242 $original['criteria']['filter'][1][2] == $_SESSION['phpgw_session']['account_id']){ 1243 1244 $existDefaultGroup = false; 1245 1246 foreach($result as $v){ 1247 if($v['type'] == 1 && $v['calendar']['type'] == 1) 1248 $existDefaultGroup = true; 1249 } 1250 1251 if(!$existDefaultGroup){ 1252 1253 $cal = array('name' => 'Sem grupo', 1254 'description' => 'Sem grupo', 1255 'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 1256 'dtstamp' => time() . '000', 1257 'type' => '1' 1258 ); 1259 1260 $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 1261 1262 $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 1263 'calendar' => $calCreated['id'], 1264 'isOwner' => '1', 1265 'dtstamp' => time() . '000', 1266 'fontColor' => 'FFFFFF', 1267 'backgroundColor' => '3366CC', 1268 'borderColor' => '3366CC', 1269 'type' => '1' 1270 ); 1271 1272 $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 1273 $sigCreated = Controller::read(array('concept' => 'calendarSignature', 'id' => $sigCreated['id']), false, array('deepness' => 2 )); 1274 1275 array_push($result, $sigCreated); 1276 } 1277 1278 } 1279 1280 } 1281 951 1282 public function createDefaultSignature(&$uri, &$result, &$criteria, $original) { 1283 1284 if(count($result) == 0 && isset($criteria['filter'][3]) && isset($criteria['filter'][3]['isRecursion'])){ 1285 throw new Exception('It was not possible to find to calendar!'); 1286 return false; 1287 } 952 1288 953 1289 //Caso uma busca não retorne nenhum resultado e foi buscado pelas assinaturas do usuario logado apenas … … 957 1293 if (count($result) > 0) { 958 1294 foreach ($result as $value) { 959 if (isset($value['isOwner']) && $value['isOwner'] != 0)960 $isValidSignature = true;1295 if (isset($value['isOwner']) && $value['isOwner'] != 0 && isset($value['type']) && $value['type'] == 0) 1296 $isValidSignature = true; 961 1297 } 962 1298 } … … 969 1305 970 1306 if (Config::module('useCaldav', 'expressoCalendar')) { 971 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 972 973 $calendario = DAViCalAdapter::findCalendars(); 1307 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 1308 $calendario = DAViCalAdapter::findCalendars(); 974 1309 } 975 1310 976 1311 if (Config::module('useCaldav', 'expressoCalendar') && is_array($calendario) && count($calendario) > 0) { 977 foreach ($calendario as $i => $v) { 978 979 $urlA = explode('/', $v->url); 980 $name = isset($v->displayname) ? $v->displayname : $urlA[(count($urlA) - 2)]; 981 $cal = array('name' => $name, 982 'description' => isset($v->description) ? $v->description : $name, 983 'timezone' => isset($v->timezone) ? $v->timezone : (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 984 'dtstamp' => time() . '000', 985 'location' => $urlA[(count($urlA) - 3)] . '/' . $urlA[(count($urlA) - 2)] 986 ); 987 988 $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 989 990 991 992 $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 993 'calendar' => $calCreated['id'], 994 'isOwner' => '1', 995 'dtstamp' => time() . '000', 996 'fontColor' => 'FFFFFF', 997 'backgroundColor' => '3366CC', 998 'borderColor' => '3366CC', 999 ); 1000 1001 $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 1002 1003 1004 DAViCalAdapter::importCollection($v->url, $calCreated['id']); 1005 } 1312 foreach ($calendario as $i => $v) { 1313 1314 $urlA = explode('/', $v->url); 1315 $name = isset($v->displayname) ? $v->displayname : $urlA[(count($urlA) - 2)]; 1316 $cal = array('name' => $name, 1317 'description' => isset($v->description) ? $v->description : $name, 1318 'timezone' => isset($v->timezone) ? $v->timezone : (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 1319 'dtstamp' => time() . '000', 1320 'location' => $urlA[(count($urlA) - 3)] . '/' . $urlA[(count($urlA) - 2)] 1321 ); 1322 1323 $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 1324 1325 if(!$calCreated){ 1326 throw new Exception('Error to create calendar'); 1327 return false; 1328 } 1329 1330 $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 1331 'calendar' => $calCreated['id'], 1332 'isOwner' => '1', 1333 'dtstamp' => time() . '000', 1334 'fontColor' => 'FFFFFF', 1335 'backgroundColor' => '3366CC', 1336 'borderColor' => '3366CC', 1337 ); 1338 1339 $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 1340 1341 if(!$sigCreated){ 1342 throw new Exception('Error to create signature'); 1343 return false; 1344 } 1345 1346 DAViCalAdapter::importCollection($v->url, $calCreated['id']); 1347 } 1006 1348 } else { 1007 //Criaremos uma agenda padrão 1008 $cal = array('name' => 'Calendario', 1009 'description' => 'Calendario Padrão', 1010 'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 1011 'dtstamp' => time() . '000' 1012 ); 1013 1014 $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 1015 1016 $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 1017 'calendar' => $calCreated['id'], 1018 'isOwner' => '1', 1019 'dtstamp' => time() . '000', 1020 'fontColor' => 'FFFFFF', 1021 'backgroundColor' => '3366CC', 1022 'borderColor' => '3366CC', 1023 ); 1024 1025 $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 1026 } 1027 1028 $result = Controller::find($original['URI'], $original['properties'] ? $original['properties'] : null, $original['criteria']); 1349 //Criaremos uma agenda padrão 1350 $cal = array('name' => 'Calendario', 1351 'description' => 'Calendario Padrão', 1352 'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 1353 'dtstamp' => time() . '000' 1354 ); 1355 1356 $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 1357 1358 $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 1359 'calendar' => $calCreated['id'], 1360 'isOwner' => '1', 1361 'dtstamp' => time() . '000', 1362 'fontColor' => 'FFFFFF', 1363 'backgroundColor' => '3366CC', 1364 'borderColor' => '3366CC', 1365 ); 1366 1367 $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 1368 } 1369 1370 $original['criteria']['filter'][] = array('isRecursion' => true); 1371 $result = Controller::find($original['URI'], $original['properties'] ? $original['properties'] : null, $original['criteria']); 1029 1372 return false; 1030 }1373 } 1031 1374 } 1032 1375 … … 1058 1401 1059 1402 public function davcalCreateCollection(&$uri, &$params, &$criteria, $original) { 1060 if (Config::module('useCaldav', 'expressoCalendar')) {1061 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';1062 DAViCalAdapter::mkcalendar($params['location'], $params['name'], isset($params['description']) ? $params['description'] : '' );1063 }1403 if (Config::module('useCaldav', 'expressoCalendar')) { 1404 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 1405 DAViCalAdapter::mkcalendar($params['location'], $params['name'], isset($params['description']) ? $params['description'] : '' ); 1406 } 1064 1407 } 1065 1408 1066 1409 public function davcalDeleteCollection(&$uri, &$params, &$criteria, $original) { 1067 if (Config::module('useCaldav', 'expressoCalendar') && Config::module('onRemoveCascadeCalDav')) {1068 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';1069 $calendar = Controller::read($uri);1070 DAViCalAdapter::rmCalendar($calendar['location']);1071 }1410 if (Config::module('useCaldav', 'expressoCalendar') && Config::module('onRemoveCascadeCalDav')) { 1411 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 1412 $calendar = Controller::read($uri); 1413 DAViCalAdapter::rmCalendar($calendar['location']); 1414 } 1072 1415 } 1073 1416 1074 1417 public function davcalUpdateCollection(&$uri, &$params, &$criteria, $original) { 1075 if (Config::module('useCaldav', 'expressoCalendar')) {1076 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php';1077 if (isset($params['location'])) {1078 $calendar = Controller::read($uri);1079 if ($calendar['location'] !== $params['location'])1080 DAViCalAdapter::mvcalendar($calendar['location'], $params['location']);1081 }1082 }1418 if (Config::module('useCaldav', 'expressoCalendar')) { 1419 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 1420 if (isset($params['location'])) { 1421 $calendar = Controller::read($uri); 1422 if ($calendar['location'] !== $params['location']) 1423 DAViCalAdapter::mvcalendar($calendar['location'], $params['location']); 1424 } 1425 } 1083 1426 } 1084 1427 -
branches/2.4/prototype/modules/calendar/interceptors/Notifications.php
r7175 r7228 475 475 476 476 if (count($part) > 0) 477 self::sendMail($data, $ical, implode(',', $part), $subject, 'notify_cancel_body');478 }477 self::sendMail($data, $ical, implode(',', $part), $subject, 'notify_cancel_body'); 478 } 479 479 } 480 480 … … 521 521 foreach ($params as $i => $v) //Verifica se ouve alteração no evento 522 522 if (isset($schedulableOld[$i]) && $schedulableOld[$i] != $v && $i != 'participants') { 523 $schedulable[$i] = $v;524 $alt = true;523 $schedulable[$i] = $v; 524 $alt = true; 525 525 } 526 526 … … 539 539 540 540 static private function parseTimeDate($time, $timezone) { 541 return strtotime($time . ' ' . $timezone) . '000';541 return strtotime($time . ' ' . $timezone) . '000'; 542 542 } 543 543 -
branches/2.4/prototype/modules/calendar/js/calendar.codecs.js
r6754 r7228 22 22 fontColor: "fff", 23 23 timezone: 'America/Sao_Paulo', 24 weekStart: 'SUN' 24 weekStart: 'SUN', 25 useDesktopNotification: 0 25 26 }; 26 27 … … 31 32 } 32 33 } 34 35 updateActivity = false; 33 36 34 37 constantsParticipant = { … … 54 57 importCalendar: null, 55 58 sharedCalendar: null, 56 copyCalendar: null 59 copyCalendar: null, 60 assingCalendar: null 57 61 } 58 62 } … … 81 85 borderColor: '#' + signature.borderColor || User.preferences.borderColor, 82 86 textColor: '#' + signature.fontColor || User.preferences.fontColor, 83 87 className: [], 84 88 editable: signature.isOwner 85 89 } … … 129 133 return returns; 130 134 }; 131 135 console.log(evtObj); 132 136 var res = $.map(evtObj, function( objEvent ){ 133 137 return { … … 137 141 user: objEvent.user, 138 142 acl: constantAcl(objEvent.acl) , 139 aclValues: objEvent.acl 143 aclValues: objEvent.acl, 144 owner: objEvent.owner 140 145 }; 141 146 }); … … 187 192 }); 188 193 189 /*Todo Melhorias ser ão feitas na API*/194 /*Todo Melhorias serço feitas na API*/ 190 195 //DataLayer.poll( "schedulable" ); 191 196 … … 195 200 DataLayer.commit( false, false, function(){ 196 201 Calendar.rerenderView(true); 202 if(updateActivity) 203 refreshTaskActivity(); 197 204 }); 198 205 } … … 262 269 user: User.me.id, 263 270 calendar: { 264 id: Calendar.calendarOf[form.signature].id,271 id: !!!parseInt(form.type) ? Calendar.calendarOf[form.signature].id : Calendar.groupOf[form.signature].id, 265 272 name: Encoder.htmlEncode(form.name), 266 273 description: Encoder.htmlEncode(form.description), … … 384 391 385 392 393 }); 394 395 DataLayer.codec( "schedulable", "taskEdit", { 396 397 decoder: function( evtObj ){ 398 Encoder.EncodeType = "entity"; 399 400 if( notArray = $.type(evtObj) !== "array" ) 401 evtObj = [ evtObj ]; 402 403 var pref = User.preferences; 404 405 var res = $.map(evtObj, function( form ){ 406 407 return DataLayer.merge({ 408 id: form.idTask, 409 percentage: form.percentage, 410 type: '2', 411 status: form.taskStatus, 412 participants : $.map(form.attendee, function( attendee, i ){ 413 if(isNaN(attendee)){ 414 return{ 415 id: attendee, 416 acl: form.attendeeAcl[i], 417 delegatedFrom: !!form.delegatedFrom[i] ? form.delegatedFrom[i] : 0, 418 isOrganizer: (form.attendee_organizer == attendee ? 1 : 0 ), 419 isExternal: !!parseInt(form.attendeeType[i]) ? 1 : 0, 420 acl: form.attendeeAcl[i].replace('o', '') 421 }; 422 }else{ 423 if(DataLayer.get('participant', attendee).user == User.me.id){ 424 var me = { 425 user: User.me.id, 426 status: form.status, 427 id: attendee, 428 isOrganizer: 0, 429 receiveNotification : (!!form.receiveNotification ? 1 : 0), 430 alarms: typeof(form.alarmTime) != 'undefined' ? 431 $.map( form.alarmTime || [], function( alarmTime, i ){ 432 433 if( alarmTime === "" ) 434 return( null ); 435 436 return !!form.alarmId[i] ? 437 { 438 type: form.alarmType[i], 439 unit: form.alarmUnit[i], 440 time: form.alarmTime[i], 441 id: form.alarmId[i] 442 } : 443 { 444 type: form.alarmType[i], 445 unit: form.alarmUnit[i], 446 time: form.alarmTime[i] 447 }; 448 }) : [] 449 }; 450 451 if(form.startDate){ 452 var tzId = DataLayer.get('schedulable', form.idEvent).timezone || User.preferences.timezone, 453 formatString = pref.dateFormat + " " + pref.hourFormat; 454 455 DataLayer.put('notification', { 456 participant: me.id, 457 type: 'suggestion', 458 startTime: Date.parseExact(form.startDate + (!!form.allDay ? " 00:00": " "+$.trim(form.startHour)) , formatString ).toString('yyyy-MM-dd HH:mm:00'), 459 endTime: Date.parseExact(form.endDate + ( !!form.allDay ? " 00:00": " "+$.trim(form.endHour)), formatString ).toString('yyyy-MM-dd HH:mm:00'), 460 allDay: ( !!form.allDay ? 1 : 0 ), 461 schedulable: form.idEvent 462 }); 463 464 } 465 return me; 466 }else return(null); 467 }; 468 }) 469 }, (form.group != form.lastGroup? {calendar: form.group, lastCalendar: form.lastGroup} : {})) 470 }); 471 return notArray ? res[0] : res; 472 }, 473 474 encoder: function( evtObj ){} 475 386 476 }); 387 477 … … 510 600 calendar: objEvent.calendar, 511 601 summary: objEvent.summary, 602 type: !!objEvent.type ? objEvent.type : 1, 512 603 description: objEvent.description, 513 604 timezone: objEvent.timezone, … … 518 609 endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat), 519 610 allDay: !!parseInt( objEvent.allDay ), 611 dueDate: objEvent.dueDate, 612 dueTime: objEvent.dueTime, 613 priority: objEvent.priority, 520 614 attachments: $.map(objEvent.attachments || [], function( attachment, i ){ 521 615 var attach = DataLayer.get('schedulableToAttachment', attachment, false); … … 595 689 }); 596 690 691 DataLayer.codec( "schedulable", "task", { 692 693 decoder: function( evtObj ){ 694 Encoder.EncodeType = "entity"; 695 696 if( notArray = $.type(evtObj) !== "array" ) 697 evtObj = [ evtObj ]; 698 699 var pref = User.preferences; 700 701 var res = $.map(evtObj, function( form ){ 702 703 var tzId = form.timezone || Calendar.signatureOf[form.group].calendar.timezone || User.preferences.timezone, 704 705 formatString = pref.dateFormat + " " + pref.hourFormat; 706 707 return DataLayer.merge({ 708 "class": form["class"], 709 startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 710 endTime: (form.dueDate == '' ) ? 711 Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00') : 712 Date.parseExact(form.dueDate + " "+$.trim(form.dueTime) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 713 due: (form.dueDate == '' ) ? 0 : Date.parseExact(form.dueDate + " "+$.trim(form.dueTime) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 714 allDay: ( form.dueDate == '' ? 1 : 0 ), 715 status: form.taskStatus, 716 id: form.idTask, 717 location: form.location, 718 type: !!form.type ? form.type : 2, 719 percentage: form.percentage, 720 priority: form.priority, 721 category: form.category, 722 summary: form.summary == '' ? 'Tarefa sem título' : form.summary, 723 description: form.description, 724 timezone: tzId, 725 attachments: $.map(form.attachment || [], function( attachment, i ){ 726 return { 727 attachment: attachment 728 } 729 }), 730 participants: $.map( form.attendee || [], function( attendee, i ){ 731 732 if( !attendee || attendee === "" ) 733 return( null ); 734 735 var participant = {}; 736 participant.user = (attendee!= User.me.id) ? DataLayer.get('participant', attendee).user : attendee ; 737 738 if( participant.user === User.me.id ){ 739 return DataLayer.merge({ 740 id: attendee, 741 isOrganizer: (form.attendee_organizer == attendee ? 1 : 0 ), 742 alarms: participant.alarms = $.map( form.alarmTime || [], function( alarmTime, i ){ 743 if( alarmTime === "" ) 744 return( null ); 745 return !!form.alarmId[i] ? { 746 type: form.alarmType[i], 747 unit: form.alarmUnit[i], 748 time: form.alarmTime[i], 749 id: form.alarmId[i] 750 }: 751 752 { 753 type: form.alarmType[i], 754 unit: form.alarmUnit[i], 755 time: form.alarmTime[i] 756 }; 757 }), 758 status: !!form.status ? form.status : 3 759 }, (form.delegatedFrom[i] != '0' && form.delegatedFrom[i] != '') ? { 760 delegatedFrom: form.delegatedFrom[i] 761 } : {}); 762 }else{ 763 return { 764 id: attendee, 765 isOrganizer: (form.attendee_organizer == attendee ? 1 : 0 ), 766 isExternal: !!parseInt(form.attendeeType[i]) ? 1 : 0 767 }; 768 }; 769 }) 770 }, form.lastGroup ? (( form.lastGroup == form.group ) ? {} : {calendar: form.group, lastGroup: form.lastGroup}) : {calendar: form.group}); 771 }); 772 773 return notArray ? res[0] : res; 774 }, 775 776 encoder: function( evtObj ){ 777 778 var notArray = false; 779 780 if( notArray = $.type(evtObj) !== "array" ) 781 evtObj = [ evtObj ]; 782 783 var statusParticipants = {}, isAttendee = false, 784 785 statusLabels = [ '', 'accepted', 'tentative', 'cancelled', 'unanswered', 'delegated' ], 786 787 participantInfo = {}, delegatedFrom = {}, me = DataLayer.copy( User.me ); 788 789 var delegateAttendee = {}; 790 791 for( var i = 0; i < statusLabels.length; i++ ) 792 statusParticipants[ statusLabels[i] ] = 0; 793 794 var res = $.map(evtObj, function( objEvent ){ 795 796 if(!(typeof(objEvent) == 'object')) 797 return (null); 798 799 var limitAttendee = false; 800 801 return { 802 "class": objEvent["class"], 803 id: objEvent.id, 804 location: objEvent.location, 805 category: objEvent.category, 806 taskStatus: objEvent.status, 807 groups: Calendar.groups, 808 group: objEvent.group ? objEvent.group : objEvent.calendar, 809 summary: objEvent.summary, 810 type: !!objEvent.type ? objEvent.type : 2, 811 description: objEvent.description, 812 timezone: objEvent.timezone, 813 timezones: Timezone.timezones, 814 percentage: (objEvent.percentage) ? objEvent.percentage : '0', 815 priority: objEvent.priority, 816 startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 817 startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 818 endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 819 endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat), 820 dueDate: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : new Date( parseInt(objEvent.due) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 821 dueTime: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.due)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 822 allDay: !!parseInt( objEvent.allDay ), 823 historic: !!objEvent.historic ? decodeHistoric(objEvent) : [] , 824 attachments: $.map(objEvent.attachments || [], function( attachment, i ){ 825 var attach = DataLayer.get('schedulableToAttachment', attachment, false); 826 //TODO - Verificar na API retorno de id sobre os conceitos em que s?o utilizados tabelas de liga??o 827 if(!attach.name) return(null); 828 829 var ext = attach.name.split('.'); 830 attach.name = attach.name.length < 10 ? attach.name : ( ext.length == 1 ? attach.name.substr(0, 10) : (attach.name.substr(0, 6) + '.' + ext[ext.length -1])); 831 attach.size = formatBytes(attach.size); 832 return attach; 833 }), 834 attendee: $.map(objEvent.participants || [], function( participant, i ){ 835 836 if(delegateAttendee[participant]) 837 return(null); 838 839 var attend = DataLayer.get('participant', (participant.id || participant)); 840 attend.user = DataLayer.get('user', attend.user); 841 842 statusParticipants[ statusLabels[attend.status] ]++; 843 844 if(attend.user.mail == User.me.mail) 845 isAttendee = true; 846 847 if( attend.user.id === me.id ){ 848 participantInfo.user = { 849 id: attend.id, 850 status : attend.status, 851 delegatedFrom: attend.delegatedFrom || '0', 852 acl: attend.acl, 853 receiveNotification : attend.receiveNotification, 854 alarms : $.map(attend.alarms || [], function( alarm ){ 855 var alarm = DataLayer.get('alarm', alarm); 856 return (alarm == "" ? (null) : alarm); 857 }) 858 }; 859 me = attend; 860 return(null); 861 }; 862 863 var person = { 864 id: attend.id, 865 name: attend.user.name != 'false' ? attend.user.name : '', 866 mail: attend.user.mail, 867 status : attend.status, 868 isExternal: attend.isExternal, 869 acl: attend.acl, 870 delegatedFrom: attend.delegatedFrom 871 }; 872 873 if(!!parseInt(attend.delegatedFrom)){ 874 delegatedFrom[attend.delegatedFrom] = DataLayer.copy(person); 875 return(null); 876 } 877 878 if( !!parseInt(attend.isOrganizer)){ 879 participantInfo.organizer = DataLayer.copy(person); 880 return(null); 881 }; 882 883 return (person); 884 }), 885 organizer: participantInfo.organizer || me, 886 isOrganizer: (participantInfo.organizer || me).id == me.id, 887 alarms: !!participantInfo.user ? participantInfo.user.alarms : [], 888 status: !!participantInfo.user ? participantInfo.user.status : 1, 889 isAttendee: isAttendee, 890 me: me, 891 delegatedFrom: delegatedFrom, 892 statusParticipants: (objEvent.sizeAttendees != "") ? objEvent.statusAttendees : statusParticipants, 893 sizeAttendeeLimit: (objEvent.sizeAttendees != "") ? objEvent.sizeAttendees : false 894 }; 895 }); 896 return (notArray ? res[0] : res); 897 } 898 }); 899 900 function decodeHistoric ( evt ) { 901 var historic = evt.historic; 902 var decoded = []; 903 var attributeDecoded = { 904 'startTime': 'Data de inicio', 905 'endTime' : 'Data de fim', 906 'summary' : 'Título', 907 'description': 'Descrição', 908 'status': 'Status', 909 'percentage': 'Porcentagem', 910 'priority': 'Prioridade', 911 'due' : 'Previsão de término' 912 }; 913 914 var statusDecoded = { 915 1: 'Sem ações', 916 2: 'Em processo', 917 3: 'Finalzada', 918 4: 'Cancelada' 919 }; 920 921 var decodeDate = function(time){ 922 return new Date( parseInt( time) ).setTimezoneOffset( Timezone.timezone( evt.timezone ) ).toString( User.preferences.dateFormat+' - '+User.preferences.hourFormat ); 923 }; 924 925 var decodeItem = function(historic){ 926 switch(historic.attribute){ 927 case 'startTime': 928 case 'endTime' : 929 case 'due': 930 return { 931 user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user), 932 attribute : attributeDecoded[historic.attribute], 933 beforeValue : decodeDate(historic.beforeValue), 934 afterValue : decodeDate(historic.afterValue), 935 time: decodeDate(historic.time) 936 } 937 break; 938 case 'participant': 939 return{ 940 user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user), 941 attribute : historic.beforeValue == '' ? ('Novo participante') : ('Rem. participante'), 942 beforeValue : historic.beforeValue == '' ? '' : historic.beforeValue.mail, 943 afterValue : historic.afterValue == '' ? '' : historic.afterValue.mail, 944 time: decodeDate(historic.time) 945 } 946 break; 947 case 'attachment': 948 return{ 949 user : $.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user), 950 attribute : historic.beforeValue == '' ? ('Novo anexo') : ('Rem. anexo'), 951 beforeValue : historic.beforeValue, 952 afterValue : historic.afterValue, 953 time: decodeDate(historic.time) 954 } 955 case 'percentage': 956 return{ 957 user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user), 958 attribute :attributeDecoded[historic.attribute], 959 beforeValue : historic.beforeValue+' %', 960 afterValue : historic.afterValue+' %', 961 time: decodeDate(historic.time) 962 } 963 case 'status': 964 return{ 965 user :$.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user), 966 attribute :attributeDecoded[historic.attribute], 967 beforeValue : statusDecoded[historic.beforeValue], 968 afterValue : statusDecoded[historic.afterValue], 969 time: decodeDate(historic.time) 970 } 971 break; 972 default: 973 return { 974 user : $.type(historic.user) == 'object' ? historic.user : DataLayer.get('user', historic.user), 975 attribute : attributeDecoded[historic.attribute], 976 beforeValue : historic.beforeValue, 977 afterValue : historic.afterValue, 978 time: decodeDate(historic.time) 979 } 980 break; 981 982 } 983 } 984 985 for(var i = 0; i < historic.length; i++) 986 decoded.push(decodeItem(historic[i])); 987 988 return decoded; 989 990 } 991 992 DataLayer.codec( "schedulable", "taskSearch", { 993 994 decoder: function( evtObj ){ 995 996 }, 997 998 encoder: function( evtObj ){ 999 1000 var notArray = false; 1001 1002 if( notArray = $.type(evtObj) !== "array" ) 1003 evtObj = [ evtObj ]; 1004 1005 var res = $.map(evtObj, function( objEvent ){ 1006 1007 if(!(typeof(objEvent) == 'object')) 1008 return (null); 1009 1010 return { 1011 id: objEvent.id, 1012 summary: objEvent.summary, 1013 description: !!objEvent.summary ? objEvent.summary : objEvent.description, 1014 startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 1015 startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 1016 endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 1017 endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat), 1018 dueDate: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : new Date( parseInt(objEvent.due) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 1019 dueTime: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.due)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 1020 allDay: !!parseInt( objEvent.allDay ), 1021 percentage: (objEvent.percentage) ? objEvent.percentage : '0', 1022 status: objEvent.status, 1023 priority: objEvent.priority 1024 } 1025 }); 1026 return (notArray ? res[0] : res); 1027 } 1028 }); 1029 1030 DataLayer.codec( "schedulable", "activity", { 1031 1032 decoder: function( evtObj ){ 1033 Encoder.EncodeType = "entity"; 1034 1035 if( notArray = $.type(evtObj) !== "array" ) 1036 evtObj = [ evtObj ]; 1037 1038 var pref = User.preferences; 1039 1040 var res = $.map(evtObj, function( form ){ 1041 1042 var tzId = form.timezone || Calendar.signatureOf[form.group].calendar.timezone || User.preferences.timezone, 1043 formatString = pref.dateFormat + " " + pref.hourFormat; 1044 1045 var decodeParticipants = function(attend){ 1046 return [DataLayer.merge( 1047 { 1048 user: User.me.id, 1049 isOrganizer: 1, 1050 acl: 'row', 1051 alarms: $.map( form.alarmTime || [], function( alarmTime, i ){ 1052 if( alarmTime === "" ) 1053 return( null ); 1054 return !!form.alarmId[i] ? { 1055 type: form.alarmType[i], 1056 unit: form.alarmUnit[i], 1057 time: form.alarmTime[i], 1058 id: form.alarmId[i] 1059 }: 1060 1061 { 1062 type: form.alarmType[i], 1063 unit: form.alarmUnit[i], 1064 time: form.alarmTime[i] 1065 }; 1066 }) 1067 }, attend != '0' ? {id: attend} : {})]; 1068 }; 1069 1070 return DataLayer.merge({ 1071 "class": form["class"], 1072 startTime: Date.parseExact(form.startDate + " "+$.trim(form.startHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 1073 endTime: (form.dueDate == '' )? 0 : Date.parseExact(form.dueDate + " "+$.trim(form.dueHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 1074 due: (form.dueDate == '' )? 0 : Date.parseExact(form.dueDate + " "+$.trim(form.dueHour) , formatString ).toString(!!form.allDay ? 'yyyy-MM-dd 00:00:00' : 'yyyy-MM-dd HH:mm:00'), 1075 allDay: ( !!form.allDay ? 1 : 0 ), 1076 status: form.activityStatus, 1077 id: form.idActivity, 1078 type: !!form.type ? form.type : 2, 1079 percentage: form.percentage, 1080 priority: form.priority, 1081 category: form.category, 1082 summary: form.summary == '' ? 'Atividade sem título' : form.summary, 1083 description: form.description, 1084 timezone: tzId, 1085 attachments: $.map(form.attachment || [], function( attachment, i ){ 1086 return { 1087 attachment: attachment 1088 } 1089 }), 1090 participants: decodeParticipants(form.idAttendee), 1091 taskToActivity:$.map( form.idtask || [], function( task, i ){ 1092 1093 return DataLayer.merge({ 1094 task: task, 1095 owner: User.me.id 1096 }, form.idTaskToActivity[i] != '' ? {id: form.idTaskToActivity[i]} : {}); 1097 1098 }) 1099 }, form.lastGroup ? (( form.lastGroup == form.group ) ? {} : {calendar: form.group, lastGroup: form.lastGroup}) : {calendar: form.group}); 1100 }); 1101 1102 return notArray ? res[0] : res; 1103 }, 1104 1105 encoder: function( evtObj ){ 1106 1107 var notArray = false; 1108 1109 if( notArray = $.type(evtObj) !== "array" ) 1110 evtObj = [ evtObj ]; 1111 1112 var res = $.map(evtObj, function( objEvent ){ 1113 1114 if(!(typeof(objEvent) == 'object')) 1115 return (null); 1116 1117 var historic = []; 1118 1119 var decodeTasks = function(obj){ 1120 1121 var tasks = {}, task = {}; 1122 1123 for(var i =0; i < obj.taskToActivity.length; i++){ 1124 1125 taskToActivity = DataLayer.get('taskToActivity', obj.taskToActivity[i]); 1126 task = taskToActivity.task; 1127 1128 if($.type(task) != 'object') 1129 task = DataLayer.get('schedulable', task); 1130 1131 //Resolve problemas com atualização na camada Cliente 1132 if(!$.isNumeric(task.startTime)){ 1133 DataLayer.remove('schedulable', task.id, false); 1134 task = DataLayer.get('schedulable', task.id); 1135 } 1136 1137 tasks[task.id] = { 1138 taskToActivity: taskToActivity.id, 1139 allDay: !!parseInt(task.allDay), 1140 dueDate: (!task.due || task.due == '' || task.due == '0') ? '' : new Date( parseInt(task.due) ).setTimezoneOffset( Timezone.timezone( task.timezone ) ).toString( User.preferences.dateFormat ), 1141 dueTime: (!task.due || task.due == '' || task.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(task.due)), task.timezone, obj.calendar, obj.DayLigth, 'startTime'), User.preferences.hourFormat), 1142 startDate: new Date( parseInt(task.startTime) ).setTimezoneOffset( Timezone.timezone( task.timezone ) ).toString( User.preferences.dateFormat ), 1143 startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(task.startTime)), task.timezone, task.calendar, obj.DayLigth, 'startTime'), User.preferences.hourFormat), 1144 endDate: new Date( parseInt(task.endTime) - (!!parseInt(task.allDay) ? 86400000 : 0) ).setTimezoneOffset( Timezone.timezone( task.timezone ) ).toString( User.preferences.dateFormat ), 1145 endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(task.endTime)), task.timezone, obj.calendar, obj.DayLigth, 'endTime'), User.preferences.hourFormat), 1146 status: task.status, 1147 percentage: task.percentage, 1148 priority: task.priority, 1149 summary: task.summary 1150 } 1151 1152 tasks[task.id].description = tasks[task.id].startDate + ' - ' + (!!task.summary ? task.summary : task.description); 1153 1154 historic.push({'task': (!!task.summary ? task.summary : task.description) , 'historic': decodeHistoric(task)}); 1155 } 1156 1157 tasks.length = obj.taskToActivity.length; 1158 return tasks; 1159 1160 }; 1161 1162 return { 1163 "class": objEvent["class"], 1164 id: objEvent.id, 1165 location: objEvent.location, 1166 category: objEvent.category, 1167 activityStatus: objEvent.status, 1168 groups: Calendar.groups, 1169 group: objEvent.group ? objEvent.group : objEvent.calendar, 1170 summary: objEvent.summary, 1171 type: !!objEvent.type ? objEvent.type : 2, 1172 description: objEvent.description, 1173 timezone: objEvent.timezone, 1174 timezones: Timezone.timezones, 1175 percentage: (objEvent.percentage) ? objEvent.percentage : '0', 1176 priority: objEvent.priority, 1177 startDate: new Date( parseInt(objEvent.startTime) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 1178 startHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.startTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 1179 endDate: new Date( parseInt(objEvent.endTime) - (!!parseInt(objEvent.allDay) ? 86400000 : 0) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 1180 endHour: dateCalendar.formatDate(Timezone.getDateEvent(new Date(parseInt(objEvent.endTime)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'endTime'), User.preferences.hourFormat), 1181 dueDate: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : new Date( parseInt(objEvent.due) ).setTimezoneOffset( Timezone.timezone( objEvent.timezone ) ).toString( User.preferences.dateFormat ), 1182 dueTime: (!objEvent.due || objEvent.due == '' || objEvent.due == '0') ? '' : dateCalendar.formatDate(Timezone.getDateEvent(new Date( parseInt(objEvent.due)), objEvent.timezone, objEvent.calendar, objEvent.DayLigth, 'startTime'), User.preferences.hourFormat), 1183 allDay: !!parseInt( objEvent.allDay ), 1184 historic: historic, 1185 tasks: objEvent.taskToActivity ? decodeTasks(objEvent) : {}, 1186 attachments: $.map(objEvent.attachments || [], function( attachment, i ){ 1187 var attach = DataLayer.get('schedulableToAttachment', attachment, false); 1188 //TODO - Verificar na API retorno de id sobre os conceitos em que s?o utilizados tabelas de liga??o 1189 if(!attach.name) return(null); 1190 1191 var ext = attach.name.split('.'); 1192 attach.name = attach.name.length < 10 ? attach.name : ( ext.length == 1 ? attach.name.substr(0, 10) : (attach.name.substr(0, 6) + '.' + ext[ext.length -1])); 1193 attach.size = formatBytes(attach.size); 1194 return attach; 1195 }), 1196 me : User.me, 1197 attendee: $.map(objEvent.participants || [], function( participant, i ){ 1198 1199 var attend = DataLayer.get('participant', (participant.id || participant)); 1200 attend.user = DataLayer.get('user', attend.user); 1201 1202 return { 1203 id: attend.id, 1204 alarms : $.map(attend.alarms || [], function( alarm ){ 1205 var alarm = DataLayer.get('alarm', alarm); 1206 return (alarm == "" ? (null) : alarm); 1207 }) 1208 }; 1209 }) 1210 1211 }; 1212 }); 1213 return (notArray ? res[0] : res); 1214 } 1215 }); 597 1216 598 1217 function decodeOwnerCalendar(calendar){ … … 727 1346 id: form.idEvent, 728 1347 location: form.location, 1348 type: 1, 729 1349 category: form.category, 730 summary: form.summary, 1350 priority: form.priority, 1351 summary: form.summary == '' ? 'Evento sem título' : form.summary, 731 1352 description: form.description, 732 1353 timezone: tzId, … … 800 1421 801 1422 var pref = User.preferences; 802 803 var res = DataLayer.encode('schedulable:preview', evtObj); 1423 var res = []; 1424 1425 for(var i = 0; i < evtObj.length; i++){ 1426 res.push(DataLayer.encode('schedulable:' + (evtObj[i].type == '1' ? 'preview' : ( !!evtObj[i].taskToActivity ? 'activity': 'task')) , evtObj[i])); 1427 } 804 1428 805 1429 if( !notArray ){ … … 814 1438 815 1439 for (var i=0; i < res.length; i++) { 1440 1441 res[i].type = (res[i].type == '2' && !!res[i].tasks) ? '3' : res[i].type; 816 1442 817 1443 var startDate = Date.parseExact( res[i]['startDate'], User.preferences.dateFormat ); … … 836 1462 'endDate': new Date( occurrences[ii] + duration ).toString( User.preferences.dateFormat ) 837 1463 } ); 838 839 840 841 842 res2.repeat = typeRepeat[res[i].repeat.frequency]; 1464 1465 if(res[i].repeat) 1466 res2.repeat = typeRepeat[res[i].repeat.frequency]; 843 1467 844 1468 while (counter.compareTo( currentDate ) == 0) { … … 868 1492 }); 869 1493 1494 1495 DataLayer.codec( "schedulable", "print", { 1496 1497 decoder: function( evtObj ){ 1498 1499 }, 1500 1501 1502 encoder: function( evtObj ){ 1503 1504 if(!(!!evtObj)) 1505 evtObj = []; 1506 1507 var notArray = false; 1508 1509 if( notArray = $.type(evtObj) !== "array" ) 1510 evtObj = [ evtObj ]; 1511 1512 var pref = User.preferences; 1513 var res = []; 1514 1515 for(var i = 0; i < evtObj.length; i++){ 1516 res.push(DataLayer.encode('schedulable:' + (evtObj[i].type == '1' ? 'preview' : ( !!evtObj[i].taskToActivity ? 'activity': 'task')) , evtObj[i])); 1517 } 1518 1519 if( !notArray ){ 1520 var dates = {}; 1521 1522 var typeRepeat = { 1523 'none': false, 1524 'daily': 'Repetição diária', 1525 'weekly': 'Repetição semanal', 1526 'monthly': 'Repetição mensal', 1527 'yearly': 'repetição anual' 1528 } 1529 1530 for (var i=0; i < res.length; i++) { 1531 res[i].type = (res[i].type == '2' && !!res[i].tasks) ? '3' : res[i].type; 1532 1533 var startDate = Date.parseExact( res[i]['startDate'], User.preferences.dateFormat ); 1534 var endDate = Date.parseExact( res[i]['endDate'], User.preferences.dateFormat ); 1535 1536 var duration = parseInt( endDate.getTime() ) - parseInt( startDate.getTime() ); 1537 1538 var occurrences = [ startDate.getTime() ]; 1539 1540 if( res[i].occurrences ) 1541 { 1542 occurrences = res[i].occurrences; 1543 } 1544 1545 for( var ii = 0; ii < occurrences.length; ii++ ) 1546 { 1547 var currentDate = new Date( occurrences[ii] ); 1548 var counter = currentDate.clone(); 1549 1550 var res2 = $.extend( {}, res[i], { 1551 'startDate': currentDate.toString( User.preferences.dateFormat ), 1552 'endDate': new Date( occurrences[ii] + duration ).toString( User.preferences.dateFormat ) 1553 }); 1554 1555 if(res[i].repeat) 1556 res2.repeat = typeRepeat[res[i].repeat.frequency]; 1557 1558 var index = dateCalendar.dayNames[counter.getDay()] +' '+counter.toString('dd/MM'); 1559 1560 if(!dates[index] || !$.isArray(dates[index].events)) 1561 dates[index] = {events: []}; 1562 1563 res2['isOneDay'] = res2.startDate == res2.endDate ? true : false; 1564 1565 dates[index].events.push(res2); 1566 1567 } 1568 } 1569 1570 var calendarView = $('#calendar').fullCalendar('getView'); 1571 var start = calendarView.start.getTime(); 1572 var end = (calendarView.end.getTime() - (calendarView.name == 'month' ? 86400000 : 0 )); 1573 var next = start; 1574 var response = []; 1575 while (next){ 1576 var index = dateCalendar.dayNames[new Date(next).getDay()] +' '+ new Date(next).toString('dd/MM'); 1577 1578 var event = {}; 1579 event[index] = {events: dates[index] ? dates[index].events : false}; 1580 1581 response[response.length] = event; 1582 next = (next + 86400000) > end ? false : (next + 86400000); 1583 } 1584 res = {events: response}; 1585 } 1586 1587 return notArray ? res[0] : res; 1588 } 1589 1590 }); 1591 870 1592 DataLayer.codec( "participant", "detail", { 871 1593 … … 937 1659 938 1660 if(!(typeof(evt) == 'object') || (evt.id.indexOf('java') >= 0)) 939 return (null);1661 return (null); 940 1662 941 1663 evt.calendar = evt.calendar || "1"; 942 1664 943 1665 if( !grouped[ evt.calendar ] ) 944 grouped[ evt.calendar ] = [];1666 grouped[ evt.calendar ] = []; 945 1667 946 1668 var calendar = DataLayer.get('calendar', evt.calendar); 947 1669 1670 var taskEditable = function(idTask){ 1671 for(var i = 0; i < evt.participants.length; i++){ 1672 attendee = DataLayer.get('participant', evt.participants[i]); 1673 if(attendee.user == User.me.id) 1674 return attendee.isOrganizer == '1' ? 1675 { 1676 editable: true, 1677 disableResizing: false, 1678 disableDragging: false, 1679 className: 'fullcalendar-context-menu event-type-2 event-id-'+idTask+' calendar-id-'+calendar.id 1680 } 1681 : 1682 { 1683 editable: false, 1684 disableResizing: true, 1685 disableDragging: true, 1686 className: 'blocked-event-permision fullcalendar-not-context-menu event-id-'+idTask 1687 }; 1688 } 1689 } 1690 948 1691 var eventEditable = function(idEvent, isRecurrence, Recurrence){ 949 if(Calendar.signatureOf[calendar.id].isOwner == "1"){ 950 var attendee = {}; 951 for(var i = 0; i < evt.participants.length; i++){ 952 attendee = DataLayer.get('participant', evt.participants[i]); 953 if(attendee.user == User.me.id) 954 return (attendee.acl.indexOf('w') >= 0 || attendee.acl.indexOf('o') >= 0 ) ? { 955 selectable: true, 956 className: 'fullcalendar-context-menu event-id-'+idEvent+' calendar-id-'+calendar.id+ (isRecurrence ? ' isRecurrence Recurrence-id-'+Recurrence : '') 957 } : { 958 editable: false, 959 selectable: true , 960 className: 'blocked-event-permision fullcalendar-not-context-menu event-id-'+idEvent 1692 if(Calendar.signatureOf[calendar.id].isOwner == "1"){ 1693 var attendee = {}; 1694 for(var i = 0; i < evt.participants.length; i++){ 1695 attendee = DataLayer.get('participant', evt.participants[i]); 1696 if(attendee.user == User.me.id) 1697 return (attendee.acl.indexOf('w') >= 0 || attendee.acl.indexOf('o') >= 0 ) ? 1698 { 1699 selectable: true, 1700 className: 'fullcalendar-context-menu event-type-1 event-id-'+idEvent+' calendar-id-'+calendar.id+ (isRecurrence ? ' isRecurrence Recurrence-id-'+Recurrence : '') 1701 } : { 1702 editable: false, 1703 selectable: true , 1704 className: 'blocked-event-permision fullcalendar-not-context-menu event-id-'+idEvent 1705 }; 1706 } 1707 return { 1708 editable: false, 1709 className: 'blocked-event-permision fullcalendar-not-context-menu event-id-'+idEvent+' calendar-id-'+calendar.id, 1710 selectable: true, 1711 disableDragging: isRecurrence 961 1712 }; 962 } 963 return { 964 editable: false, 965 className: 'blocked-event-permision fullcalendar-not-context-menu event-id-'+idEvent+' calendar-id-'+calendar.id, 966 selectable: true, 967 disableDragging: isRecurrence 968 }; 969 } 970 else{ 971 var aclSignature = Calendar.signatureOf[calendar.id].permission; 1713 } 1714 else{ 1715 var aclSignature = Calendar.signatureOf[calendar.id].permission; 1716 1717 var mountClass = function(acl){ 1718 var returns = "" 1719 returns += acl['write'] ? "" : 'blocked-event-permision '; 1720 returns += acl['busy'] ? 'fullcalendar-not-context-menu ' : (acl['read'] ? 'fullcalendar-context-menu '+ (isRecurrence ? ' isRecurrence Recurrence-id-'+Recurrence : '') : ''); 1721 returns += 'event-id-'+idEvent+' calendar-id-'+calendar.id; 1722 return returns; 1723 } 972 1724 973 var mountClass = function(acl){ 974 var returns = "" 975 returns += acl['write'] ? "" : 'blocked-event-permision '; 976 returns += acl['busy'] ? 'fullcalendar-not-context-menu ' : (acl['read'] ? 'fullcalendar-context-menu '+ (isRecurrence ? ' isRecurrence Recurrence-id-'+Recurrence : '') : ''); 977 returns += 'event-id-'+idEvent+' calendar-id-'+calendar.id; 978 return returns; 979 } 980 return DataLayer.merge({ 981 editable: aclSignature.acl['write'] && !isRecurrence, 982 disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false), 983 disableDragging : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true: false), 984 className: mountClass(aclSignature.acl) 985 }, aclSignature.acl['busy'] ? { 986 title: 'Ocupado', 987 selectable: false 988 } : { 989 selectable: true 990 }); 991 } 992 1725 return DataLayer.merge({ 1726 editable: aclSignature.acl['write'] && !isRecurrence, 1727 disableResizing : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true : false), 1728 disableDragging : (((aclSignature.acl['busy'] && !aclSignature.acl['write']) || (!aclSignature.acl['write'] && aclSignature.acl['read'])) ? true: false), 1729 className: mountClass(aclSignature.acl) 1730 }, aclSignature.acl['busy'] ? 1731 { 1732 title: 'Ocupado', 1733 selectable: false 1734 } : { 1735 selectable: true 1736 } 1737 ); 1738 } 993 1739 } 1740 1741 var duration = parseInt( evt.endTime ) - parseInt( evt.startTime ), isRepeat = false; 1742 1743 var occurrences = []; 994 1744 995 var duration = parseInt( evt.endTime ) - parseInt( evt.startTime ), isRepeat = false; 996 997 var occurrences = []; 998 999 if( evt.occurrences ) 1000 { 1001 isRepeat = true; 1002 occurrences = evt.occurrences; 1745 if( evt.occurrences ) 1746 { 1747 isRepeat = true; 1748 occurrences = evt.occurrences; 1003 1749 }else 1004 occurrences[ occurrences.length ] = evt.startTime;1750 occurrences[ occurrences.length ] = evt.startTime; 1005 1751 1006 1752 //occurrences = DataLayer.unique( occurrences ).sort(); 1007 1753 var typeEvent; 1008 1754 for( var i = 0; i < occurrences.length; i++ ) 1009 grouped[ evt.calendar ].push( DataLayer.merge({ 1010 id: evt.URI || evt.id+ '-' + i, 1011 title: Encoder.htmlDecode(evt.summary), 1012 start: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) ), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving), 1013 end: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) + duration - (!!parseInt(evt.allDay) ? 86400000 : 0)), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving), 1014 allDay: parseInt( evt.allDay ), 1015 isRepeat: isRepeat, 1016 occurrence: i, 1017 calendar: evt.calendar 1018 }, eventEditable(evt.id, isRepeat, i ) ) ); 1755 { 1756 typeEvent = (evt.type == 2 && evt.taskToActivity ? 3 : evt.type) 1757 grouped[ evt.calendar ].push( DataLayer.merge( 1758 { 1759 id: evt.URI || evt.id+ '-' + i, 1760 title: Encoder.htmlDecode(evt.summary), 1761 start: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) ), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving), 1762 end: Timezone.getDateCalendar(new Date( parseInt( occurrences[i] ) + duration - (!!parseInt(evt.allDay) ? 86400000 : 0)), calendar.timezone, !!evt.DayLigth ? evt.DayLigth.calendar.startTime : Timezone.daylightSaving), 1763 allDay: parseInt( evt.allDay ), 1764 isRepeat: isRepeat, 1765 occurrence: i, 1766 type: typeEvent, 1767 calendar: evt.calendar 1768 }, (parseInt(typeEvent) == 1 ? eventEditable(evt.id, isRepeat, i ) : (parseInt(typeEvent) == 2 ? taskEditable(evt.id) : {editable: false, disableResizing: true, disableDragging: true})))); 1769 } 1019 1770 }); 1020 1771 … … 1035 1786 return { 1036 1787 filter: ['AND', 1037 ['OR', 1788 ['OR', 1038 1789 ['AND', 1039 1790 ['>=', 'rangeEnd', filter.start.getTime()], 1040 ['<=', 'rangeEnd', filter.end.getTime()] ,1791 ['<=', 'rangeEnd', filter.end.getTime()] 1041 1792 ], 1042 1793 ['AND', 1043 1794 ['>=', 'rangeStart', filter.start.getTime()], 1044 ['<=', 'rangeStart', filter.end.getTime()] ,1795 ['<=', 'rangeStart', filter.end.getTime()] 1045 1796 ], 1046 1797 ['AND', 1047 1798 ['<=', 'rangeStart', filter.start.getTime()], 1048 ['>=', 'rangeEnd', filter.end.getTime()] ,1799 ['>=', 'rangeEnd', filter.end.getTime()] 1049 1800 ] 1050 1801 ], 1051 ['IN', 'calendar', Calendar.calendarIds]1802 ['IN', 'calendar', $.merge( Calendar.calendarIds, Calendar.groupIds )] 1052 1803 ], 1053 1804 criteria: { -
branches/2.4/prototype/modules/calendar/js/calendar.contentMenu.js
r6754 r7228 8 8 9 9 var classes = $(this).attr('class').split(" "); 10 var idEvent = false, idRecurrence = false, idCalendar = false;10 var idEvent = false, typeEvent = false,idRecurrence = false, idCalendar = false; 11 11 12 12 //recupera o id do calendar eo id do evento para tratamento 13 13 for(var i = 0; i < classes.length; i++){ 14 if (classes[i].indexOf("event-id-") >= 0 ){ 15 idEvent = classes[i].replace(/[a-zA-Z-]+/g, ''); 16 continue; 17 }else if (classes[i].indexOf("Recurrence-id-") >= 0 ){ 18 idRecurrence = classes[i].replace(/[a-zA-Z-]+/g, ''); 19 continue; 20 }else if (classes[i].indexOf("calendar-id-") >= 0 ){ 21 idCalendar = classes[i].replace(/[a-zA-Z-]+/g, ''); 22 continue; 23 } 24 } 14 if (classes[i].indexOf("event-id-") >= 0 ){ 15 idEvent = classes[i].replace(/[a-zA-Z-]+/g, ''); 16 continue; 17 }else if (classes[i].indexOf("Recurrence-id-") >= 0 ){ 18 idRecurrence = classes[i].replace(/[a-zA-Z-]+/g, ''); 19 continue; 20 }else if (classes[i].indexOf("calendar-id-") >= 0 ){ 21 idCalendar = classes[i].replace(/[a-zA-Z-]+/g, ''); 22 continue; 23 }else if (classes[i].indexOf("event-type-") >= 0 ){ 24 typeEvent = classes[i].replace(/[a-zA-Z-]+/g, ''); 25 continue; 26 } 27 } 25 28 26 var schedulable = DataLayer.get('schedulable', idEvent); 27 29 var schedulable = DataLayer.get('schedulable', idEvent); 28 30 var isRecurrence = DataLayer.get('repeat', schedulable.repeat).frequency || false; 29 31 30 32 var top = $('#divAppbox').scrollTop(); 31 33 32 var template = DataLayer.render( 'templates/menu_context_event.ejs', {event: schedulable.id , 33 top: (event.clientY - 135 + top), left: (event.clientX - 445), 34 var template = DataLayer.render( 'templates/menu_context_event.ejs', 35 { 36 event: schedulable.id , 37 top: (event.clientY - 135 + top), 38 left: (event.clientX - 445), 34 39 signature: Calendar.signatureOf[idCalendar], 35 calendars: Calendar.calendars, isRecurrence: (!isRecurrence || isRecurrence == 'none') ? false : true, 36 idRecurrence: idRecurrence 37 }); 40 calendars: Calendar[parseInt(typeEvent) == 1 ? 'calendars' : 'groups'], 41 isRecurrence: (!isRecurrence || isRecurrence == 'none') ? false : true, 42 idRecurrence: idRecurrence, 43 typeEvent: typeEvent 44 }); 38 45 39 46 $('#context-menu-event').html(template); 40 47 41 42 43 44 45 46 47 48 49 50 51 48 var method = function(value){ 49 switch (value){ 50 case "ocurrency": 51 return '2' 52 case "copy": 53 return '1'; 54 case "move": 55 return '0'; 56 } 57 } 58 52 59 $('#context-menu-event').find('li.menu-item').hover( 53 60 function () { 54 61 $(this).addClass("li-hover").find('a').addClass('ui-state-hover'); 55 62 if($(this).hasClass('copy') || $(this).hasClass('move')) { 56 57 63 $(this).parents().find('.calendar-copy-move input[name="typeEvent"]').val( method($(this).attr('class').split(" ")[0])); 58 64 $(this).parents().find('.calendar-copy-move').show(); 59 60 } 65 if($(this).hasClass('move')) 66 $('.calendar-list.calendar-already').hide(); 67 else 68 $('.calendar-list.calendar-already').show(); 69 } 61 70 }, 62 71 function () { -
branches/2.4/prototype/modules/calendar/js/calendar.shared.js
r6994 r7228 1 1 function show_modal_shared(calendarId){ 2 3 var html = DataLayer.render('templates/shared_calendar.ejs', { 4 calendar: Calendar.calendars, 5 signature : Calendar.signatures 2 $('.qtip.qtip-blue').remove(); 3 4 var html = DataLayer.render('templates/shared_calendar.ejs', { 5 calendar: Calendar.calendars, 6 signature : Calendar.signatures 6 7 }); 7 8 … … 256 257 text: false 257 258 }).click(function () { 258 incompatibleAcl($(this), ['b' ,], ['busy']);259 incompatibleAcl($(this), ['b'], ['busy']); 259 260 dependsAcl($(this), ['r'], ['read']); 260 261 changeAcl($(this), 's'); … … 337 338 338 339 function show_modal_search_shared(){ 340 $('.qtip.qtip-blue').remove(); 339 341 340 342 var html = DataLayer.render('templates/shared_calendar.ejs', {}); … … 441 443 id: result[i].calendar.id, 442 444 name:result[i].calendar.name, 443 mail: result[i].calendar.description, 445 mail: result[i].calendar.description, 446 owner: result[i].owner, 444 447 type: 0 445 448 }) … … 452 455 name:resultPublic[i].calendar.name, 453 456 mail: resultPublic[i].calendar.description, 457 owner: resultPublic[i].owner, 454 458 type: 1 455 459 }) … … 468 472 currentCalendars[id] = { 469 473 id: id, 470 name: resultNormalize[i].name ,474 name: resultNormalize[i].name + ' ( '+resultNormalize[i].owner.uid +' )', 471 475 description: resultNormalize[i].description, 472 476 type: resultNormalize[i].type, … … 526 530 id: dataCurrent.id, 527 531 idPermission:Calendar.signatures[i].id , 528 name: dataCurrent.name ,529 description: dataCurrent.description, 532 name: dataCurrent.name + ' ( ' + Calendar.signatures[i].permission.owner.uid + ' )', 533 description: dataCurrent.description, 530 534 type: Calendar.signatures[i].permission.type, 531 535 isCalendar: true, … … 550 554 'buttons': ['Sim', 'Não'], 551 555 'onClose': function(clicked) { 552 553 DataLayer.remove('calendarSignature', ''+signatureId);554 DataLayer.commit( false, false, function( received ){555 556 557 558 });556 if(clicked == 'Sim'){ 557 DataLayer.remove('calendarSignature', ''+signatureId); 558 DataLayer.commit( false, false, function( received ){ 559 delete Calendar.currentViewKey; 560 Calendar.load(); 561 refresh_calendars(); 562 }); 559 563 } 560 564 } -
branches/2.4/prototype/modules/calendar/js/helpers.js
r6972 r7228 101 101 } 102 102 103 /* 104 function listEvents(){ 105 var list = $('.fc-header-right').find('.fc-button.fc-button-agendaDay').clone(); 103 function printNow(){ 104 if($("#calendar").fullCalendar('getView').name == "agendaWeek" || $("#calendar").fullCalendar('getView').name == "basicWeek" || $("#calendar").fullCalendar('getView').name == "year") 105 alert('A tela de impressão será melhor visualizada com a preferência "Paisagem" do seu browser selecionada.'); 106 107 var window_print = window.open('','ExpressoCalendar','width=800,height=600,scrollbars=yes'); 108 window_print.document.open(); 109 110 var start = $("#calendar").fullCalendar('getView').visStart.getTime()/1000; 111 var end = $("#calendar").fullCalendar('getView').visEnd.getTime()/1000; 112 var criteria = DataLayer.criteria("schedulable:calendar", {'start':start, 'end':end} ); 113 114 var data = DataLayer.get("schedulable:print", criteria); 115 116 if($("#calendar").fullCalendar('getView').name == "month"){ 117 window_print.document.write(DataLayer.render('templates/calendar_month_print.ejs', { 118 'InfoPage' : $("#calendar").fullCalendar('getView').title, 119 'days' : data 120 } )); 121 } 122 if($("#calendar").fullCalendar('getView').name == "agendaDay" || $("#calendar").fullCalendar('getView').name == "basicDay"){ 123 window_print.document.write(DataLayer.render('templates/calendar_day_print.ejs', { 124 'InfoPage' : $("#calendar").fullCalendar('getView').title, 125 'days' : data 126 } )); 127 } 128 if($("#calendar").fullCalendar('getView').name == "agendaWeek" || $("#calendar").fullCalendar('getView').name == "basicWeek"){ 129 window_print.document.write(DataLayer.render('templates/calendar_week_print.ejs', { 130 'InfoPage' : $("#calendar").fullCalendar('getView').title, 131 'days' : data 132 })); 133 134 var aux = 0; 135 setTimeout(function(){$(window_print.document).find(".all-day").each(function(){ 136 if($(this).height() > aux) 137 aux = $(this).height(); 138 }); 139 $(window_print.document).find(".all-day").each(function(){ 140 $(this).height(aux); 141 }); 142 $(window_print.document).find(".all-day-line .write").height(aux); 143 aux = 0; 144 },20); 145 } 146 if($("#calendar").fullCalendar('getView').name == "year"){ 147 window_print.document.write(DataLayer.render('templates/calendar_year_print.ejs', { 148 'html' : $('#calendar .fc-content').html(), 149 'header': $('#calendar').find('.fc-header-center h2').text() 150 } )); 151 } 152 window_print.document.close(); 153 window_print.print(); 154 } 155 156 function printEvents(){ 157 //var html = DataLayer.render( path + 'templates/attendee_permissions.ejs', {} ); 158 var print = $('.fc-header-right').find('.fc-button.fc-button-agendaDay').clone(); 159 106 160 $('.fc-header-right').find('.fc-button-year').toggleClass('fc-corner-right'); 107 list.addClass('fc-corner-right'); 108 list.addClass('fc-button-listagem'); 109 list.removeClass('fc-button-agendaDay'); 110 list.removeClass('fc-corner-left'); 111 list.find('.fc-button-content').html('Listagem'); 112 $('.fc-header-right').append(list); 113 } 114 */ 161 print.addClass('fc-corner-right'); 162 print.addClass('fc-button-print'); 163 print.removeClass('fc-button-agendaDay'); 164 print.removeClass('fc-corner-left'); 165 print.find('.fc-button-content').html('Imprimir'); 166 $('.fc-header-right').append(print); 167 $('.fc-button-print').click(function(){ 168 printNow(); 169 }); 170 } 115 171 116 172 /* … … 122 178 function eventDetails( objEvent, decoded, path, isMail, repeat) 123 179 { 180 181 $('.qtip.qtip-blue').remove(); 182 124 183 attendees = {}; 125 184 … … 399 458 modal:true, 400 459 autoOpen: false, 401 width:70 2,460 width:701, 402 461 position: 'center', 403 462 close: function(event, ui) { … … 883 942 timeFormat: "hh:mm tt", 884 943 onSelect: function (selectedDateTime){ 885 if(!(User.preferences.hourFormat.length == 5)) 886 $(this).val(selectedDateTime.replace(/[\.]/gi, "")); 887 updateMap(); 944 if ((selectedDateTime.value == '__:__') || (selectedDateTime.value == '__:__ __')) 945 selectedDateTime.value = ""; 946 if(!(User.preferences.hourFormat.length == 5)) 947 $(this).val(selectedDateTime.replace(/[\.]/gi, "")); 948 updateMap(); 888 949 }, 889 950 onClose : function (selectedDateTime){ 890 951 if(!(User.preferences.hourFormat.length == 5)) 891 952 $(this).val(selectedDateTime.replace(/[\.]/gi, "")); 953 }, 954 beforeShow: function (selectedDateTime) { 955 if ((selectedDateTime.value == '__:__') || (selectedDateTime.value == '__:__ __')) 956 selectedDateTime.value = ""; 892 957 } 893 958 }); … … 936 1001 // load template of attendees 937 1002 var blkAddAtendee = UI.dialogs.addEvent.find('#calendar_addevent_details6').append(attendeeHtml); 938 if(objEvent.attendee.length) 939 callbackAttendee(); 1003 if(objEvent.attendee.length) 1004 callbackAttendee(); 940 1005 /** 941 942 1006 Opções de delegação do participante/organizer 1007 */ 943 1008 blkAddAtendee.find(".button.participant-delegate").button({ 944 1009 icons: { … … 968 1033 969 1034 UI.dialogs.addEvent.find(".attendee-list-add .add-attendee-input input").Watermark("digite um email para convidar"); 970 /* Trata a edição de um novo participante adicionado971 * 972 1035 /* 1036 * Trata a edição de um novo participante adicionado 1037 */ 973 1038 var hasNewAttendee = false; 974 1039 … … 978 1043 979 1044 blkAddAtendee.find('.attendee-list-add .add-attendee-input input').keydown(function(event) { 980 981 1045 if (event.keyCode == '13' && $(this).val() != '' || (event.keyCode == undefined && $(this).val() != '')) { 982 1046 Encoder.EncodeType = "entity"; … … 990 1054 991 1055 /** 992 993 1056 * email válido? 1057 */ 994 1058 info.match(/^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/) ? 995 1059 newAttendeeEmail = info : newAttendeeName = info; 996 1060 997 1061 /** 998 999 1000 1001 1002 1003 1004 1005 1062 * 1) busca no banco para saber se o usuário já existe 1063 * 1.1) se existe, atualiza as info na lista de participantes e nao abre o tooltip 1064 * 1.2) se não existe 1065 * a) salva como novo usuario externo no banco (apenas com email) 1066 * b) exibe tooltip pedindo o nome 1067 * c) se o usuário preenche tooltip e salva, atualiza com o nome o usuário recém criado 1068 * d) se o usuário cancela o tooltip, fica o usuário salvo apenas com email e sem nome 1069 */ 1006 1070 1007 1071 var user = DataLayer.get('user', ["=", "mail", $(this).val()]); … … 1012 1076 1013 1077 /** 1014 1015 1078 * guarda o último tooltip aberto referente à lista de participantes 1079 */ 1016 1080 lastEditAttendeeToolTip = []; 1017 1081 1018 1082 /** 1019 1020 1083 * Valida email e salva um participante externo 1084 */ 1021 1085 var saveContact = function() { 1022 1086 Encoder.EncodeType = "entity"; … … 1192 1256 $(this).val(''); 1193 1257 1194 } else if (!skipAddNewLine) { 1258 } else if (!skipAddNewLine) { 1195 1259 /** 1196 1197 1198 1260 * a) salva como novo usuario externo no banco (apenas com email) e... 1261 * adiciona novo contato externo à lista de convidados 1262 */ 1199 1263 1200 1264 userId = DataLayer.put('user', { … … 1285 1349 1286 1350 /** 1287 1288 1351 * Trata a busca de usuários para adição de participantes 1352 */ 1289 1353 blkAddAtendee.find('.add-attendee-search .ui-icon-search').click(function(event) { 1290 1354 blkAddAtendee.find('.add-attendee-search input').keydown(); … … 1374 1438 } 1375 1439 }); 1440 1376 1441 //$('.block-add-attendee .search-result-list').selectable(); 1377 1442 … … 1395 1460 }); 1396 1461 }); 1397 $('.attachment-list input').remove(); 1398 $('.row.fileupload-buttonbar .attachments-list p').remove(); 1462 $('div.new-event-win .attachment-list input').remove(); 1463 $('div.new-event-win .row.fileupload-buttonbar .attachments-list p').remove(); 1464 $('div.new-event-win .btn-danger.delete').addClass('hidden'); 1399 1465 } 1400 1466 }}); … … 1415 1481 text: false 1416 1482 }); 1417 var maxSizeFile = 2000000; 1418 $('#fileupload').fileupload({ 1419 sequentialUploads: true, 1420 add: function (e, data) { 1421 if(data.files[0].size < maxSizeFile) 1422 data.submit(); 1423 }, 1424 change: function (e, data) { 1425 $.each(data.files, function (index, file) { 1426 var attach = {}; 1427 attach.fileName = file.name; 1428 var ext = file.name.split('.'); 1429 if(file.name.length > 10) 1430 attach.fileName = ext.length == 1 ? file.name.substr(0, 10) : file.name.substr(0, 6) + '.' + ext[ext.length -1]; 1431 attach.fileSize = formatBytes(file.size); 1432 if(file.size > maxSizeFile) 1433 attach.error = 'Tamanho de arquivo nao permitido!!' 1434 1435 $('.attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', { 1436 file : attach 1437 })); 1438 1439 if(file.size < maxSizeFile){ 1440 $('.fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 1441 $('.attachments-list').find('[type=file]').addClass('hidden'); 1442 1443 }else 1444 $('.fileinput-button.new').removeClass('new'); 1445 1446 1447 $('.attachments-list').find('.button.close').button({ 1448 icons: { 1449 primary: "ui-icon-close" 1450 }, 1451 text: false 1452 }).click(function(){ 1453 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 1454 $('.attachment-list').find('input[value="'+idAttach+'"]') 1455 $(this).parent().remove(); 1456 }); 1457 1458 }) 1459 }, 1460 done: function(e, data){ 1461 var currentUpload = $('.progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide(); 1462 1463 if(!!data.result && data.result != "[]"){ 1464 var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 1465 $('.attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>'); 1466 currentUpload.removeClass('on-complete').parents('p') 1467 .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>') 1468 .find('.status-upload').addClass('ui-icon ui-icon-check'); 1469 }else 1470 currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 1471 } 1472 }); 1473 $('.attachments-list .button').button(); 1474 1475 if(!!window.FormData) 1476 $('#fileupload').bind('fileuploadstart', function () { 1477 var widget = $(this), 1478 progressElement = $('#fileupload-progress').fadeIn(), 1479 interval = 500, 1480 total = 0, 1481 loaded = 0, 1482 loadedBefore = 0, 1483 progressTimer, 1484 progressHandler = function (e, data) { 1485 loaded = data.loaded; 1486 total = data.total; 1487 }, 1488 stopHandler = function () { 1489 widget 1490 .unbind('fileuploadprogressall', progressHandler) 1491 .unbind('fileuploadstop', stopHandler); 1492 window.clearInterval(progressTimer); 1493 progressElement.fadeOut(function () { 1494 progressElement.html(''); 1495 }); 1496 }, 1497 formatTime = function (seconds) { 1498 var date = new Date(seconds * 1000); 1499 return ('0' + date.getUTCHours()).slice(-2) + ':' + 1500 ('0' + date.getUTCMinutes()).slice(-2) + ':' + 1501 ('0' + date.getUTCSeconds()).slice(-2); 1502 }, 1503 /* formatBytes = function (bytes) { 1504 if (bytes >= 1000000000) { 1505 return (bytes / 1000000000).toFixed(2) + ' GB'; 1506 } 1507 if (bytes >= 1000000) { 1508 return (bytes / 1000000).toFixed(2) + ' MB'; 1509 } 1510 if (bytes >= 1000) { 1511 return (bytes / 1000).toFixed(2) + ' KB'; 1512 } 1513 return bytes + ' B'; 1514 },*/ 1515 formatPercentage = function (floatValue) { 1516 return (floatValue * 100).toFixed(2) + ' %'; 1517 }, 1518 updateProgressElement = function (loaded, total, bps) { 1519 progressElement.html( 1520 formatBytes(bps) + 'ps | ' + 1521 formatTime((total - loaded) / bps) + ' | ' + 1522 formatPercentage(loaded / total) + ' | ' + 1523 formatBytes(loaded) + ' / ' + formatBytes(total) 1524 ); 1525 }, 1526 intervalHandler = function () { 1527 var diff = loaded - loadedBefore; 1528 if (!diff) { 1529 return; 1530 } 1531 loadedBefore = loaded; 1532 updateProgressElement( 1533 loaded, 1534 total, 1535 diff * (1000 / interval) 1536 ); 1537 }; 1538 widget 1539 .bind('fileuploadprogressall', progressHandler) 1540 .bind('fileuploadstop', stopHandler); 1541 progressTimer = window.setInterval(intervalHandler, interval); 1542 }); 1483 1484 extendsFileupload('event', path); 1543 1485 1544 1486 if(objEvent.isShared){ … … 1557 1499 } 1558 1500 1559 disponibily(objEvent, path, attendees );1501 disponibily(objEvent, path, attendees, 'event'); 1560 1502 1561 1503 /*Seleciona a agenda padrão para criação de um evento*/ … … 1573 1515 1574 1516 UI.dialogs.addEvent.dialog('open'); 1575 //$('[href="#calendar_addevent_details7"]').trigger('click'); 1576 //$('[href="#calendar_addevent_details2"]').trigger('click'); 1517 1577 1518 } 1578 1519 … … 1691 1632 1692 1633 1693 function add_tab_configure_calendar(calendar )1634 function add_tab_configure_calendar(calendar, type) 1694 1635 { 1636 $('.qtip.qtip-blue').remove(); 1637 1695 1638 var calendars = []; 1696 1639 var signatures = []; … … 1698 1641 var calendarAlarms = []; 1699 1642 1700 for (var i=0; i<Calendar.signatures.length; i++) { 1701 calendars[i] = Calendar.signatures[i].calendar; 1702 signatures[i] = Calendar.signatures[i]; 1703 signatures[i].numberDefaultAlarm = signatures[i].defaultAlarms != '' ? signatures[i].defaultAlarms.length: 0; 1704 if (calendar && calendars[i].id == calendar) 1705 previewActiveCalendarConf = i; 1706 } 1707 1708 if(!(document.getElementById('configure_tab'))) 1643 for (var i=0; i<Calendar.signatures.length; i++) { 1644 if(parseInt(Calendar.signatures[i].calendar.type) == type){ 1645 calendars.push(Calendar.signatures[i].calendar); 1646 signatures.push(Calendar.signatures[i]); 1647 length = signatures.length - 1; 1648 signatures[length].numberDefaultAlarm = signatures[length].defaultAlarms != '' ? signatures[length].defaultAlarms.length: 0; 1649 if (calendar && calendars[length].id == calendar) 1650 previewActiveCalendarConf = length; 1651 } 1652 } 1653 var tab_selector = ['configure_tab', 'configure_tab_group']; 1654 if(!(document.getElementById(tab_selector[type]))) 1709 1655 { 1710 1656 $('.positionHelper').css('display', 'none'); 1711 1657 $('.cal-list-options-btn').removeClass('fg-menu-open ui-state-active'); 1712 var tab_title = "Configurações de agendas"; 1713 $tabs.tabs( "add", "#configure_tab", tab_title ); 1658 if(type == 0){ 1659 var tab_title = "Configurações de agendas"; 1660 }else{ 1661 var tab_title = "Configurações de Grupos"; 1662 } 1663 $tabs.tabs( "add", "#"+tab_selector[type], tab_title ); 1714 1664 1715 1665 var dataColorPicker = { … … 1734 1684 DataLayer.render( 'templates/configure_calendars_itemlist.ejs', { 1735 1685 user:User, 1686 type:0, 1736 1687 calendar:calendars[nowActive], 1737 1688 signature:signatures[nowActive] 1738 1689 }, function( form_template ){ 1739 var form_content = jQuery(' .accordion-user-calendars .ui-accordion-content').eq(nowActive).html( form_template ).find('form');1690 var form_content = jQuery('#'+tab_selector[type]+' .accordion-user-calendars .ui-accordion-content').eq(nowActive).html( form_template ).find('form'); 1740 1691 form_content.find('.preferences-alarms-list .button').button({ 1741 1692 text:false, … … 1756 1707 1757 1708 form_content.find('.button-add-alarms').click(function(){ 1758 DataLayer.render( 'templates/alarms_add_itemlist.ejs', { }, function( template ){1709 DataLayer.render( 'templates/alarms_add_itemlist.ejs', {type: 0}, function( template ){ 1759 1710 jQuery('.preferences-alarms-list').append(template) 1760 1711 .find('li:last label:eq(0)').remove().end() … … 1862 1813 DataLayer.render( 'templates/configure_calendars.ejs', { 1863 1814 user:User, 1815 type: 0, 1864 1816 calendars:calendars, 1865 1817 signatures:signatures 1866 1818 }, function( template ){ 1867 var template_content = jQuery('# configure_tab').html( template ).find('.configure-calendars-win');1819 var template_content = jQuery('#'+tab_selector[type]).html( template ).find('.configure-calendars-win'); 1868 1820 template_content.find('.button').button().filter('.save').click(function(evt){ 1869 1821 if(calendarAlarms.length) 1870 1822 DataLayer.removeFilter('calendarSignatureAlarm', {filter: ['IN','id', calendarAlarms]}); 1871 1823 template_content.find('form').submit(); 1872 $tabs.tabs( "remove", "# configure_tab");1824 $tabs.tabs( "remove", "#"+tab_selector[type]); 1873 1825 DataLayer.commit( false, false, function( received ){ 1874 1826 delete Calendar.currentViewKey; … … 1879 1831 Calendar.load(); 1880 1832 }).end().filter('.cancel').click(function(evt){ 1881 $tabs.tabs( "remove", "# configure_tab");1833 $tabs.tabs( "remove", "#"+tab_selector[type]); 1882 1834 }); 1883 1835 … … 1905 1857 $('.positionHelper').css('display','none'); 1906 1858 $('.cal-list-options-btn').removeClass('fg-menu-open ui-state-active'); 1907 $tabs.tabs("select", "# configure_tab");1859 $tabs.tabs("select", "#"+tab_selector[type]); 1908 1860 $('.accordion-user-calendars').accordion( "activate" , previewActiveCalendarConf ); 1909 1861 … … 1913 1865 } 1914 1866 1915 function getSelectedCalendars( reverse ){ 1867 function getSelectedCalendars( reverse, type ){ 1868 var selector = ""; 1869 if(type == 0) 1870 selector = ".my-calendars"; 1871 if(type == 1) 1872 selector = ".my-groups-task"; 1916 1873 var selecteds = {}; 1917 1874 var cont = 0; 1918 1875 jQuery(function() { 1919 jQuery( ".my-calendars.calendar-view").each(function(i, obj) {1876 jQuery(selector+" .calendar-view").each(function(i, obj) { 1920 1877 var check_box = obj; 1921 1878 if( reverse ? !check_box.checked : check_box.checked ) { … … 1974 1931 } 1975 1932 1976 function remove_event(eventId, idCalendar ){1977 $.Zebra_Dialog('Tem certeza que deseja excluir o evento?', {1933 function remove_event(eventId, idCalendar, type){ 1934 $.Zebra_Dialog('Tem certeza que deseja excluir?', { 1978 1935 'type': 'question', 1979 1936 'overlay_opacity': '0.5', … … 1987 1944 var me = schudableDecode.me.user ? schudableDecode.me.user.id : schudableDecode.me.id; 1988 1945 1989 DataLayer.removeFilter('schedulable', {filter: ['AND', ['=','id',eventId], ['=','calendar',idCalendar], ['=','user', me]]}) 1946 var filter = {filter: ['AND', ['=','id',eventId], ['=','calendar',idCalendar], ['=','user', me]]}; 1947 1948 if(type) 1949 filter.filter.push(['=','type',type]); 1950 1951 DataLayer.removeFilter('schedulable', filter); 1990 1952 Calendar.rerenderView(true); 1991 1953 } … … 2029 1991 2030 1992 2031 function remove_calendar( ){1993 function remove_calendar(type){ 2032 1994 /* Pode ser assim $('.cal-list-options-btn.ui-state-active').attr('class').replace(/[a-zA-Z-]+/g, ''); */ 2033 $.Zebra_Dialog('Todos os eventos desta agenda serão removidos. Deseja prosseguir com a operação?', { 1995 if(!!parseInt(type)) 1996 var title = 'Todas as tarefas deste grupo serão removidas. Deseja prosseguir com a operação?'; 1997 else 1998 var title = 'Todos os eventos desta agenda serão removidos. Deseja prosseguir com a operação?'; 1999 $.Zebra_Dialog(title, { 2034 2000 'type': 'question', 2035 2001 'overlay_opacity': '0.5', … … 2047 2013 delete Calendar.currentViewKey; 2048 2014 Calendar.load(); 2049 refresh_calendars( );2015 refresh_calendars(type); 2050 2016 }); 2051 2017 } … … 2056 2022 } 2057 2023 2058 function refresh_calendars( ){2024 function refresh_calendars(type){ 2059 2025 2060 2026 var colorsSuggestions = colors_suggestions(); … … 2091 2057 }); 2092 2058 } 2059 2093 2060 doMenu(); 2061 var currentToolTip = null; 2094 2062 $('#divAppbox').on('scroll',function(){ 2095 2063 if ($('.cal-list-options-btn.fg-menu-open.ui-state-active')){ 2096 2064 var offset = $('.cal-list-options-btn.fg-menu-open.ui-state-active').offset(); 2097 2065 if (offset) 2098 2066 $('.positionHelper').css('top',offset.top); 2099 2067 } 2100 if ($('.button.config-menu.fg-menu-open')){ 2101 var offset = $('.button.config-menu.fg-menu-open').offset(); 2102 if (offset) 2103 $('.positionHelper').css('top',offset.top); 2104 } 2068 2069 if ($('.button.config-menu.fg-menu-open')){ 2070 var offset = $('.button.config-menu.fg-menu-open').offset(); 2071 if (offset) 2072 $('.positionHelper').css('top',offset.top); 2073 } 2074 2075 2076 if ($(".new-group.qtip-active").length || $(".new-calendar.qtip-active").length) 2077 $('.qtip-active').css('top',currentToolTip.offset().top - 50); 2078 2105 2079 }); 2080 2106 2081 $('ul.list-calendars .cal-list-options-btn').on('click',function(){doMenu();}); 2107 2082 2083 2084 /***************************************New Calendar***************************************/ 2108 2085 meu_container.find(".button.new-calendar").button({ 2109 2086 icons: { … … 2112 2089 text: false 2113 2090 }).click(function () { 2114 2115 if( $('.qtip.qtip-blue.qtip-active').val() !== ''){ 2116 $(this).qtip({ 2117 show: { 2118 ready: true, 2119 solo: true, 2120 when: { 2121 event: 'click' 2122 } 2123 }, 2124 hide: false, 2125 content: { 2126 text: $('<div></div>').html( DataLayer.render( 'templates/calendar_quick_add.ejs', {} ) ), 2127 title: { 2128 text:'Nova Agenda', 2129 button: '<a class="button close" href="#">close</a>' 2130 } 2131 }, 2132 style: { 2133 name: 'blue', 2134 tip: { 2135 corner: 'leftMiddle' 2136 }, 2137 border: { 2138 width: 4, 2139 radius: 8 2140 }, 2141 width: { 2142 min: 230, 2143 max:230 2144 } 2145 }, 2146 position: { 2147 corner: { 2148 target: 'rightMiddle', 2149 tooltip: 'leftMiddle' 2150 }, 2151 adjust: { 2152 x:0, 2153 y:-12 2154 } 2155 } 2156 }) 2157 .qtip("api").onShow = function(arg0) { 2158 $('.qtip-active .button.close').button({ 2159 icons: { 2160 primary: "ui-icon-close" 2161 }, 2162 text: false 2163 }) 2164 .click(function(){ 2165 meu_container.find(".button.new-calendar").qtip('destroy'); 2166 }); 2167 //TODO emplementar tratamento de duplicação de valores no location 2168 $('.qtip-active .button.save').button().click(function(){ 2169 for(var i = 0; i < Calendar.calendars.length; i++){ 2170 if(Calendar.calendars[i].location == ( User.me.uid + '/' + $('.qtip-active input').val())){ 2171 $.Zebra_Dialog('O nome desta agenda já está sendo utilizada em uma Url de outra agenda. Por favor, informe outro nome para agenda.',{ 2172 'overlay_opacity': '0.5', 2173 'type': 'warning' 2174 }); 2175 meu_container.find(".button.new").qtip('destroy'); 2176 return; 2177 } 2178 } 2091 currentToolTip = $(this); 2092 var typeCalendar = !!parseInt($(this).attr('class').match(/[0-9]+/g)) ? 2093 {type: 'new-group', title: 'Novo Grupo', typeValue: 1, prompt: 'Nome do grupo'} : 2094 {type: 'new-calendar', title: 'Nova Agenda', typeValue: 0, prompt: 'Nome da agenda'} 2095 2096 if(!$('.qtip.qtip-blue.qtip-active.'+typeCalendar.type).length){ 2097 2098 $('.qtip.qtip-blue').remove(); 2099 2100 $(this).qtip({ 2101 show: { 2102 ready: true, 2103 solo: true, 2104 when: { 2105 event: 'click' 2106 } 2107 }, 2108 hide: false, 2109 content: { 2110 text: $('<div></div>').html( DataLayer.render( 'templates/calendar_quick_add.ejs', {} ) ), 2111 title: { 2112 text: typeCalendar.title, 2113 button: '<a class="button close" href="#">close</a>' 2114 } 2115 }, 2116 style: { 2117 name: 'blue', 2118 tip: { 2119 corner: 'leftMiddle' 2120 }, 2121 border: { 2122 width: 4, 2123 radius: 8 2124 }, 2125 width: { 2126 min: 230, 2127 max:230 2128 } 2129 }, 2130 position: { 2131 corner: { 2132 target: 'rightMiddle', 2133 tooltip: 'leftMiddle' 2134 }, 2135 adjust: { 2136 x:0, 2137 y: -12 2138 2139 } 2140 } 2141 }) 2142 .qtip("api").onShow = function(arg0) { 2179 2143 2180 var selected; 2181 var color = $('.cal-colors-options-btn').each(function(index){ 2182 if ($(this).is('.color-selected')) 2183 selected = index; 2184 }); 2185 DataLayer.put( "calendarSignature", { 2186 user: User.me.id, 2187 calendar: { 2188 name: Encoder.htmlEncode($('.qtip-active input').val()), 2189 timezone: User.preferences.timezone 2190 }, 2191 isOwner: 1, 2192 fontColor: colorsSuggestions[selected]['font'].substring(1) , 2193 backgroundColor: colorsSuggestions[selected]['background'].substring(1) , 2194 borderColor: colorsSuggestions[selected]['border'].substring(1) 2195 }); 2196 DataLayer.commit( false, false, function( received ){ 2197 delete Calendar.currentViewKey; 2198 Calendar.load(); 2199 refresh_calendars(); 2200 }); 2201 meu_container.find(".button.new").qtip('destroy'); 2202 }); 2203 2204 $('.qtip-active .button.cancel').button().click(function(){ 2205 meu_container.find(".button.new").qtip('destroy'); 2206 }); 2207 2208 $(".qtip-active input").Watermark("Nome da agenda"); 2209 2210 $('.qtip-active').keydown(function(event) { 2211 if (event.keyCode == '27') { 2212 meu_container.find(".button.new").qtip('destroy'); 2213 } 2214 }); 2215 2216 $('.colors-options').prepend(buttons_colors); 2217 $('.colors-options .signed-cal-colors-options-btn-0').addClass('color-selected'); 2218 2219 var buttons = $('.cal-colors-options-btn').button(); 2220 2221 buttons.click(function(){ 2222 buttons.removeClass('color-selected'); 2223 $(this).addClass('color-selected'); 2224 }); 2225 } 2226 } 2144 $('.qtip-active .button.close').button({ 2145 icons: { 2146 primary: "ui-icon-close" 2147 }, 2148 text: false 2149 }) 2150 .click(function(){ 2151 $('.qtip.qtip-blue').remove(); 2152 }); 2153 2154 $('.qtip-active').addClass(typeCalendar.type); 2155 2156 $('.qtip-active .button.save').button().click(function(){ 2157 if(!typeCalendar.typeValue) 2158 for(var i = 0; i < Calendar.calendars.length; i++){ 2159 if(Calendar.calendars[i].location == ( User.me.uid + '/' + $('.qtip-active input').val())){ 2160 $.Zebra_Dialog('O nome desta agenda já está sendo utilizada em uma Url de outra agenda. Por favor, informe outro nome para agenda.',{ 2161 'overlay_opacity': '0.5', 2162 'type': 'warning' 2163 }); 2164 $('.qtip.qtip-blue').remove(); 2165 return; 2166 } 2167 } 2168 2169 var selected; 2170 var color = $('.cal-colors-options-btn').each(function(index){ 2171 if ($(this).is('.color-selected')) 2172 selected = index; 2173 }); 2174 DataLayer.put( "calendarSignature", { 2175 user: User.me.id, 2176 calendar: { 2177 name: Encoder.htmlEncode($('.qtip-active input').val()), 2178 timezone: User.preferences.timezone, 2179 type: typeCalendar.typeValue 2180 }, 2181 isOwner: 1, 2182 fontColor: colorsSuggestions[selected]['font'].substring(1) , 2183 backgroundColor: colorsSuggestions[selected]['background'].substring(1) , 2184 borderColor: colorsSuggestions[selected]['border'].substring(1) 2185 }); 2186 DataLayer.commit( false, false, function( received ){ 2187 delete Calendar.currentViewKey; 2188 Calendar.load(); 2189 refresh_calendars(); 2190 }); 2191 $('.qtip.qtip-blue').remove(); 2192 }); 2193 2194 $('.qtip-active .button.cancel').button().click(function(){ 2195 meu_container.find(".button.new").qtip('destroy'); 2196 }); 2197 2198 $(".qtip-active input").Watermark(typeCalendar.prompt); 2199 2200 $('.qtip-active').keydown(function(event) { 2201 if (event.keyCode == '27') 2202 meu_container.find(".button.new").qtip('destroy'); 2203 }); 2204 2205 $('.colors-options').prepend(buttons_colors); 2206 $('.colors-options .signed-cal-colors-options-btn-0').addClass('color-selected'); 2207 2208 var buttons = $('.cal-colors-options-btn').button(); 2209 2210 buttons.click(function(){ 2211 buttons.removeClass('color-selected'); 2212 $(this).addClass('color-selected'); 2213 }); 2214 } 2215 } 2227 2216 }); 2228 2217 2229 2218 $("img.cal-list-img").click(function(evt) { 2230 $(".cal-list-options_1").toggleClass( "hidden" );2219 $(".cal-list-options_1").toggleClass( "hidden" ); 2231 2220 }); 2232 2221 2222 $(".my-groups-task a.title-my-calendars").click(function() { 2223 $(".my-groups-task ul.my-list-calendars").toggleClass("hidden") 2224 $('.my-groups-task .status-list').toggleClass("ui-icon-triangle-1-s"); 2225 $('.my-groups-task .status-list').toggleClass("ui-icon-triangle-1-e"); 2226 }); 2227 2233 2228 $(".my-calendars a.title-my-calendars").click(function() { 2234 $(".my-calendars ul.my-list-calendars").toggleClass("hidden")2235 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-s");2236 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e");2229 $(".my-calendars ul.my-list-calendars").toggleClass("hidden") 2230 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-s"); 2231 $('.my-calendars .status-list').toggleClass("ui-icon-triangle-1-e"); 2237 2232 }); 2238 2233 2239 2234 $(".signed-calendars a.title-signed-calendars").click(function() { 2240 $(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden");2235 $(".signed-calendars ul.signed-list-calendars").toggleClass( "hidden"); 2241 2236 }); 2242 2237 … … 2270 2265 2271 2266 $('.calendar-view').click(function(evt){ 2272 if($tabs.tabs('option' ,'selected') == 1){2273 pageselectCallback('', 0 );2267 if($tabs.tabs('option' ,'selected') != 0){ 2268 pageselectCallback('', 0, false, type); 2274 2269 } 2275 2270 … … 2285 2280 } 2286 2281 2287 function add_events_list(keyword )2282 function add_events_list(keyword, type) 2288 2283 { 2289 2284 var tab_title = ""; 2290 2285 if (keyword){ 2291 if(keyword.length < 10) 2292 tab_title = keyword; 2293 else 2294 tab_title = keyword.substr(0,10) + '..."'; 2286 type = 2; 2287 if(keyword.length < 10) 2288 tab_title = keyword; 2289 else 2290 tab_title = keyword.substr(0,10) + '..."'; 2295 2291 }else{ 2296 tab_title = "Lista de eventos"; 2297 } 2292 if(type){ 2293 if(!!parseInt(type)) 2294 tab_title = "Lista de tarefas"; 2295 else 2296 tab_title = "Lista de eventos"; 2297 } 2298 } 2299 var tab_selector = ['tab_events_list_', 'tab_tasks_list_', 'tab_all_list_']; 2298 2300 keyword = ( keyword || '' ).replace( /\s+/g, "_" ); 2299 2301 2300 if(!(document.getElementById( 'tab_events_list_'+ (Base64.encode(keyword)).replace(/[^\w\s]/gi, "") )))2302 if(!(document.getElementById(tab_selector[type] + (Base64.encode(keyword)).replace(/[^\w\s]/gi, "") ))) 2301 2303 { 2302 2304 Encoder.EncodeType = "entity"; 2303 $tabs.tabs( "add", "# tab_events_list_"+ (Base64.encode(keyword)).replace(/[^\w\s]/gi, ""), Encoder.htmlEncode(tab_title) );2305 $tabs.tabs( "add", "#"+tab_selector[type] + (Base64.encode(keyword)).replace(/[^\w\s]/gi, ""), Encoder.htmlEncode(tab_title) ); 2304 2306 } 2305 2307 else /* Tab already opened */ 2306 2308 { 2307 $tabs.tabs("option", "selected", 2);2308 2309 2310 pageselectCallback(keyword, 0 ); // load page 1 and insert data on event_list.ejs2309 //$tabs.tabs("option", "selected", 2); 2310 } 2311 2312 pageselectCallback(keyword, 0, false, type); // load page 1 and insert data on event_list.ejs 2311 2313 2312 2314 $('.preferences-win.active .button.save, .preferences-win.active .button.cancel, .preferences-win.active .button.import, .preferences-win.active .button.export').button(); … … 2328 2330 if(paginator.indexOf('next') > 0){ 2329 2331 if(parseInt($(currentView+' [name = results]').val()) > 25) 2330 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1) );2332 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1), false, 2); 2331 2333 }else{ 2332 2334 if(parseInt($(currentView+' [name = page_index]').val()) > 0) 2333 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1) );2335 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1), false, 2); 2334 2336 } 2335 2337 }); … … 2369 2371 } 2370 2372 2371 function paginatorList(currentView, view ){2372 $(currentView+' .events-list.events-list-win.active .list-events-paginator .fc-header-title').html('<h2>'+mountTitleList( parseInt($( '[name = page_index]').val()),view)+'</h2>');2373 function paginatorList(currentView, view, type){ 2374 $(currentView+' .events-list.events-list-win.active .list-events-paginator .fc-header-title').html('<h2>'+mountTitleList( parseInt($(currentView+' [name = page_index]').val()),view)+'</h2>'); 2373 2375 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right .fc-button').removeClass('fc-state-active') 2374 2376 if(view == 'basicDay') … … 2390 2392 var goView = $(this).attr('class'); 2391 2393 if(goView.indexOf('agendaDay') > 0) 2392 pageselectCallback($(currentView+' [name = keyword]').val(), 0, ' ', 'agendaDay');2394 pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'agendaDay', type); 2393 2395 else if(goView.indexOf('month') > 0) 2394 pageselectCallback($(currentView+' [name = keyword]').val(), 0, ' ', 'month');2396 pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'month', type); 2395 2397 else if(goView.indexOf('year') > 0) 2396 pageselectCallback($(currentView+' [name = keyword]').val(), 0, ' ', 'year');2398 pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'year', type); 2397 2399 else if(goView.indexOf('agendaWeek') > 0) 2398 pageselectCallback($(currentView+' [name = keyword]').val(), 0, ' ', 'agendaWeek');2400 pageselectCallback($(currentView+' [name = keyword]').val(), 0, 'agendaWeek', type); 2399 2401 2400 2402 }); … … 2412 2414 var paginator = $(this).attr('class'); 2413 2415 if(paginator.indexOf('next') > 0) 2414 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($( '[name = page_index]').val())) +1), '', view);2416 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) +1), view, type); 2415 2417 else 2416 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($( '[name = page_index]').val())) -1), '', view);2418 pageselectCallback($(currentView+' [name = keyword]').val(), ((parseInt($(currentView+' [name = page_index]').val())) -1), view, type); 2417 2419 }); 2418 2420 } 2419 2421 2420 function paginatorListEvent(currentView, typeView, view){ 2422 function printEventList(view){ 2423 $('.fc-button-print.print-list-events').click(function(){ 2424 var window_print = window.open('','ExpressoCalendar','width=800,height=600,scrollbars=yes'); 2425 var listEvents = $(view).clone(); 2426 listEvents.find('.fc-button').remove(); 2427 listEvents.find('.details-event-list').remove(); 2428 listEvents.find('.list-events-paginator').remove(); 2429 listEvents = listEvents.html(); 2430 type = $(this).parents('.ui-tabs-panel').attr("id").split("_")[1]; 2431 2432 var data = { 2433 type : type == "tasks" ? "task-list" : ( type == "events" ? "event-list" : "search"), 2434 html : listEvents, 2435 InfoPage : $(this).parents('table.header-paginator').find( '.fc-header-title' ).text() 2436 } 2437 window_print.document.open(); 2438 window_print.document.write(DataLayer.render('templates/calendar_list_print.ejs', data)); 2439 window_print.document.close(); 2440 window_print.print(); 2441 }); 2442 } 2443 2444 function paginatorListEvent(currentView, typeView, view, type){ 2421 2445 if(!!$(currentView).find('.fc-calendar').length) 2422 2446 return; … … 2430 2454 $(currentView+' .events-list.events-list-win.active .fc-header .fc-header-center').addClass('list-events-paginator'); 2431 2455 $(currentView+' .events-list.events-list-win.active .fc-header .list-events-paginator').removeClass('fc-header-center'); 2432 2456 2433 2457 //Adicionar class no header padronizar com a tela principal 2434 $(currentView+' .events-list.events-list-win.active .fc-header').addClass('header-paginator'); 2435 $(currentView+' .events-list.events-list-win.active .header-paginator').removeClass('fc-header'); 2436 2458 $(currentView+' .events-list.events-list-win.active .fc-header .fc-button-print').addClass('print-list-events'); 2459 $(currentView+' .events-list.events-list-win.active .fc-header').addClass('header-paginator'); 2460 $(currentView+' .events-list.events-list-win.active .header-paginator').removeClass('fc-header'); 2461 2462 printEventList(currentView); 2463 2437 2464 if(typeView == 'search'){ 2438 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right ').remove()2465 $(currentView+' .events-list.events-list-win.active .header-paginator .fc-header-right span.fc-button:not(.fc-button-print)').remove(); 2439 2466 $(currentView+' .events-list.events-list-win.active .list-events-paginator .fc-header-title').html('<h2>Resultados para: '+$(currentView+' [name = keyword]').val()+'</h2>'); 2440 2467 if((parseInt($(currentView+' [name = page_index]').val()) == 0) && (parseInt($(currentView+' [name = results]').val()) <= 25)) … … 2442 2469 paginatorSearch(currentView); 2443 2470 }else 2444 paginatorList(currentView, view );2471 paginatorList(currentView, view, type); 2445 2472 } 2446 2473 … … 2450 2477 case 'basicDay': 2451 2478 case 'agendaDay': 2452 rangeStart = new Date ().add({2479 rangeStart = new Date.today().add({ 2453 2480 days: page_index 2454 2481 }).getTime(); 2455 rangeEnd = rangeStart ;2482 rangeEnd = rangeStart + 86400000; 2456 2483 break; 2457 2484 case 'agendaWeek': … … 2519 2546 } 2520 2547 2521 function pageselectCallback(keyword, page_index, jq, view){ 2522 2523 var selecteds = getSelectedCalendars(); 2524 if(!selecteds && (keyword != '' && keyword != null)){ 2525 jQuery('#tab_events_list_' + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "")|| '')).html( 2526 '<div title="Lista de eventos" class="events-list events-list-win active empty">' + 2527 '<label>Por favor selecione ao menos uma agenda.</label>' + 2548 function pageselectCallback(keyword, page_index, view, type){ 2549 $('.qtip.qtip-blue').remove(); 2550 var tab_selector = ['tab_events_list_', 'tab_tasks_list_', 'tab_all_list_']; 2551 var tab_title = ['Lista de eventos', 'Lista de tarefas']; 2552 var label_noselect_calendar = ['Por favor selecione ao menos uma agenda.', 'Por favor selecione ao menos um grupo.', 'Por favor selecione ao menos uma agenda ou grupo.']; 2553 var label_nofound_search = ['Não foi encontrado nenhum evento correspondente à sua pesquisa.', 'Não foi encontrado nenhuma tarefa ou atividade correspondente à sua pesquisa.', 'Não foi encontrado nenhum evento ou tarefa ou atividade correspondente à sua pesquisa.']; 2554 var label_nofound = ['Não foram encontrados eventos neste intervalo.', 'Não foram encontradas tarefas ou atividades neste intervalo.', 'Não foram encontrados eventos ou tarefas ou atividades neste intervalo.']; 2555 var selecteds = getSelectedCalendars(false, type); 2556 2557 if(!selecteds && (keyword != '' && keyword != null)){ 2558 jQuery('#'+tab_selector[type] + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "")|| '')).html( 2559 '<div title="'+tab_title[type]+'" class="events-list events-list-win active empty">' + 2560 '<label>'+label_noselect_calendar[type]+'</label>' + 2528 2561 '</div>' 2529 2562 ); … … 2545 2578 var results = DataLayer.get('schedulable:detail', criteria); 2546 2579 keyword = ( keyword || '' ).replace( /\s+/g, "_" ); 2547 }2580 } 2548 2581 // não há resultados 2549 2582 2550 var currentView = '# tab_events_list_'+ ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || '');2583 var currentView = '#'+tab_selector[type] + ((Base64.encode(keyword)).replace(/[^\w\s]/gi, "") || ''); 2551 2584 2552 2585 if ((((typeof(results) == 'undefined') || (!results.events_list )) && selecteds) &&(keyword != '' && keyword != null)) { 2553 2586 $(currentView).html( 2554 '<div title=" Lista de eventos" class="events-list events-list-win active empty">' +2555 '<label> Não foi encontrado nenhum evento correspondente à sua pesquisa.</label>' +2587 '<div title="'+title+'" class="events-list events-list-win active empty">' + 2588 '<label>'+label_nofound_search[type]+'</label>' + 2556 2589 '</div>' 2557 2590 ); … … 2561 2594 results['page_index'] = page_index; 2562 2595 results['keyword'] = keyword; 2563 2596 results['tab_title'] = tab_title[type]; 2564 2597 DataLayer.render( 'templates/event_list.ejs', results, function( html ){ 2565 2598 … … 2567 2600 $('.events-list-win .menu-container .button').button(); 2568 2601 2569 $(".event-details-item").parent().click(function( ){2570 2602 $(".event-details-item").parent().click(function(event){ 2603 event.stopImmediatePropagation(); 2571 2604 $(this).siblings("div.details-event-list").toggleClass("hidden") 2572 .find('.button.delete').click(function( ){2605 .find('.button.delete').click(function(event){ 2573 2606 var eventId = $(this).siblings('[name="eventid"]').val(); 2574 2607 var calendarId = $(this).siblings('[name="calendarid"]').val(); 2575 2576 remove_event(eventId, calendarId);2608 remove_event(eventId, calendarId, 2); 2609 event.stopImmediatePropagation() 2577 2610 }) 2578 .end().find('.button.edit').click(function(){ 2579 eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true ); 2611 .end().find('.button.edit').click(function(event){ 2612 switch($(this).siblings('[name="eventtype"]').val()){ 2613 case '1': 2614 eventDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true ); 2615 break; 2616 case '2': 2617 taskDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true ); 2618 break; 2619 case '3': 2620 activityDetails( DataLayer.get( "schedulable", $(this).siblings('[name="eventid"]').val() ), true ); 2621 break; 2622 } 2623 event.stopImmediatePropagation() 2624 }) 2625 .end().find('.button.print').click(function(event){ 2626 var window_print = window.open('','ExpressoCalendar','width=800,height=600,scrollbars=yes'); 2627 var html = $(this).parents("td:first").clone(); 2628 html.find(".menu-container.footer-container").remove(); 2629 html.find(".fc-header-title").remove(); 2630 var html = html.html(); 2631 var data = { 2632 type : $(this).parents('.details-event-list').hasClass("details-event") ? "event-detail" : "task-detail", 2633 html : html, 2634 InfoPage : 'Detalhes: '+$(this).parents('tr.start-date').find('td span a').text() 2635 } 2636 window_print.document.open(); 2637 window_print.document.write(DataLayer.render('templates/calendar_list_print.ejs', data)); 2638 window_print.document.close(); 2639 window_print.print(); 2640 2641 event.stopImmediatePropagation() 2580 2642 }); 2581 2643 2582 2644 }); 2583 paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search', !!view ? view : User.preferences.defaultCalView );2645 paginatorListEvent(currentView, (keyword == '' || keyword == null) ? 'list' : 'search', !!view ? view : User.preferences.defaultCalView, type); 2584 2646 }); 2585 2647 }else{ 2586 2648 $(currentView).html( 2587 '<div title=" Lista de eventos" class="events-list events-list-win active empty">' +2649 '<div title="'+title+'" class="events-list events-list-win active empty">' + 2588 2650 '<input type="hidden" name="page_index" value="'+page_index+'"></inpunt>'+ 2589 2651 '<input type="hidden" name="keyword" value="'+keyword+'"></inpunt>'+ 2590 '<label class="empty-result"> Não foram encontrados eventos neste intervalo.</label>' +2652 '<label class="empty-result">'+label_nofound[type]+'</label>' + 2591 2653 '</div>' 2592 2654 ); 2593 paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView );2594 } 2595 } 2596 if(currentView != '# tab_events_list_')2655 paginatorListEvent(currentView, 'list', !!view ? view : User.preferences.defaultCalView, type); 2656 } 2657 } 2658 if(currentView != '#'+tab_selector[type]) 2597 2659 $tabs.tabs("select", currentView); 2598 2660 } 2599 2661 2600 function show_modal_import_export(tab, calendarId) { 2662 function show_modal_import_export(tab, calendarId, typeView){ 2663 $('.qtip.qtip-blue').remove(); 2601 2664 DataLayer.render( 'templates/import_export.ejs', { 2602 calendars: Calendar.calendars, 2603 owner: User.me.id 2665 calendars: typeView == 0 ? Calendar.calendars : Calendar.groups, 2666 owner: User.me.id, 2667 typeView: typeView 2604 2668 }, function( html ){ 2605 2669 2606 2670 if (!UI.dialogs.importCalendar) { 2607 2671 UI.dialogs.importCalendar = jQuery('#div-import-export-calendar') 2608 .append('<div title="Importar e Exportar Eventos" class="import-export import-export-win active"> <div>')2672 .append('<div title="Importar e Exportar "' + (typeView == 0 ? 'Eventos' : 'Tarefas') + '" class="import-export import-export-win active"> <div>') 2609 2673 .find('.import-export-win.active').html(html).dialog({ 2610 2674 resizable: false, … … 2718 2782 2719 2783 var schedulable = DataLayer.get('schedulable', event+''); 2784 schedulable['class'] = '1'; 2720 2785 2721 2786 calendar = !!calendar ? calendar : schedulable.calendar; … … 2831 2896 } 2832 2897 } 2898 2899 function extendsFileupload(view, path){ 2900 var viewName = 'div.new-'+view+'-win'; 2901 2902 path = !!path ? path : ''; 2903 2904 var maxSizeFile = 2000000; 2905 $('#fileupload'+view).fileupload({ 2906 sequentialUploads: true, 2907 add: function (e, data) { 2908 if(data.files[0].size < maxSizeFile) 2909 data.submit(); 2910 }, 2911 change: function (e, data) { 2912 $.each(data.files, function (index, file) { 2913 var attach = {}; 2914 attach.fileName = file.name; 2915 var ext = file.name.split('.'); 2916 if(file.name.length > 10) 2917 attach.fileName = ext.length == 1 ? file.name.substr(0, 10) : file.name.substr(0, 6) + '.' + ext[ext.length -1]; 2918 attach.fileSize = formatBytes(file.size); 2919 if(file.size > maxSizeFile) 2920 attach.error = 'Tamanho de arquivo nao permitido!!' 2921 2922 $(viewName+' .attachments-list').append(DataLayer.render(path+'templates/attachment_add_itemlist.ejs', { 2923 file : attach 2924 })); 2925 2926 if(file.size < maxSizeFile){ 2927 $(viewName+' .fileinput-button.new').append(data.fileInput[0]).removeClass('new'); 2928 $(viewName+' .attachments-list').find('[type=file]').addClass('hidden'); 2929 2930 }else 2931 $(viewName+' .fileinput-button.new').removeClass('new'); 2932 2933 2934 $(viewName+' .attachments-list').find('.button.close').button({ 2935 icons: { 2936 primary: "ui-icon-close" 2937 }, 2938 text: false 2939 }).click(function(){ 2940 var idAttach = $(this).parent().find('input[name="fileId[]"]').val(); 2941 $(viewName+' .attachment-list').find('input[value="'+idAttach+'"]').remove(); 2942 $(this).parent().remove(); 2943 2944 if(!$(viewName+' .attachment-list input').length) 2945 $(viewName+' .btn-danger.delete').addClass('hidden'); 2946 2947 }); 2948 2949 }) 2950 }, 2951 done: function(e, data){ 2952 var currentUpload = $(viewName+' .progress.after-upload:first').removeClass('after-upload').addClass('on-complete').hide(); 2953 2954 if(!!data.result && data.result != "[]"){ 2955 $(viewName+' .btn-danger.delete').removeClass('hidden'); 2956 var newAttach = (attch = jQuery.parseJSON(data.result)) ? attch : jQuery.parseJSON(data.result[0].activeElement.childNodes[0].data); 2957 $(viewName+' .attachment-list').append('<input tyepe="hidden" name="attachment[]" value="'+newAttach['attachment'][0][0].id+'"/>'); 2958 currentUpload.removeClass('on-complete').parents('p') 2959 .append('<input type="hidden" name="fileId[]" value="'+newAttach['attachment'][0][0].id+'"/>') 2960 .find('.status-upload').addClass('ui-icon ui-icon-check'); 2961 }else 2962 currentUpload.removeClass('on-complete').parents('p').find('.status-upload').addClass('ui-icon ui-icon-cancel'); 2963 } 2964 }); 2965 $('.attachments-list .button').button(); 2966 2967 if(!!window.FormData) 2968 $('#fileupload'+view).bind('fileuploadstart', function () { 2969 var widget = $(this), 2970 progressElement = $('#fileupload-progress-'+view).fadeIn(), 2971 interval = 500, 2972 total = 0, 2973 loaded = 0, 2974 loadedBefore = 0, 2975 progressTimer, 2976 progressHandler = function (e, data) { 2977 loaded = data.loaded; 2978 total = data.total; 2979 }, 2980 stopHandler = function () { 2981 widget 2982 .unbind('fileuploadprogressall', progressHandler) 2983 .unbind('fileuploadstop', stopHandler); 2984 window.clearInterval(progressTimer); 2985 progressElement.fadeOut(function () { 2986 progressElement.html(''); 2987 }); 2988 }, 2989 formatTime = function (seconds) { 2990 var date = new Date(seconds * 1000); 2991 return ('0' + date.getUTCHours()).slice(-2) + ':' + 2992 ('0' + date.getUTCMinutes()).slice(-2) + ':' + 2993 ('0' + date.getUTCSeconds()).slice(-2); 2994 }, 2995 /* formatBytes = function (bytes) { 2996 if (bytes >= 1000000000) { 2997 return (bytes / 1000000000).toFixed(2) + ' GB'; 2998 } 2999 if (bytes >= 1000000) { 3000 return (bytes / 1000000).toFixed(2) + ' MB'; 3001 } 3002 if (bytes >= 1000) { 3003 return (bytes / 1000).toFixed(2) + ' KB'; 3004 } 3005 return bytes + ' B'; 3006 },*/ 3007 formatPercentage = function (floatValue) { 3008 return (floatValue * 100).toFixed(2) + ' %'; 3009 }, 3010 updateProgressElement = function (loaded, total, bps) { 3011 progressElement.html( 3012 formatBytes(bps) + 'ps | ' + 3013 formatTime((total - loaded) / bps) + ' | ' + 3014 formatPercentage(loaded / total) + ' | ' + 3015 formatBytes(loaded) + ' / ' + formatBytes(total) 3016 ); 3017 }, 3018 intervalHandler = function () { 3019 var diff = loaded - loadedBefore; 3020 if (!diff) { 3021 return; 3022 } 3023 loadedBefore = loaded; 3024 updateProgressElement( 3025 loaded, 3026 total, 3027 diff * (1000 / interval) 3028 ); 3029 }; 3030 widget 3031 .bind('fileuploadprogressall', progressHandler) 3032 .bind('fileuploadstop', stopHandler); 3033 progressTimer = window.setInterval(intervalHandler, interval); 3034 }); 3035 3036 } -
branches/2.4/prototype/modules/calendar/js/init.js
r6754 r7228 147 147 }, true ); 148 148 }); 149 150 var currentToolTip = null; 151 $('#divAppbox').on('scroll',function(){ 152 if ($(".new-task").length) 153 currentToolTip.qtip('destroy'); 154 }); 155 156 /* Quick add task 157 -----------------------------------------------------------------*/ 158 $(".button.add.add-task").click(function(event){ 159 currentToolTip = $(this); 160 var componente = $(this); 161 162 if(!$('div.qtip.qtip-blue.new-task').length){ 163 164 $('div.qtip.qtip-blue').remove(); 165 166 $(componente).qtip({ 167 show: { 168 ready: true, 169 solo: true, 170 when: { 171 event: 'click' 172 } 173 }, 174 hide: false, 175 content: { 176 text: $('<div></div>').html( DataLayer.render( 'templates/task_quick_add.ejs', {"componente" : componente} ) ), 177 title: { 178 text:'Nova Tarefa', 179 button: '<a class="button close" href="#">close</a>' 180 } 181 }, 182 style: { 183 name: 'blue', 184 tip: { 185 corner: 'leftMiddle' 186 }, 187 border: { 188 width: 4, 189 radius: 8 190 }, 191 width: { 192 min: 225, 193 max:225 194 } 195 }, 196 position: { 197 corner: { 198 target: 'rightMiddle', 199 tooltip: 'leftMiddle' 200 }, 201 adjust: { 202 x:0, 203 y:0 204 } 205 } 206 }) 207 .qtip("api").onShow = function(arg0) { 208 209 /*------------------------------------------------------------------------*/ 210 /* Seta os valores padrões nos inputs do qtip */ 211 $('div.qtip div.add-simple-task input.task').Watermark("Tarefa sem título"); 212 $('div.qtip div.add-simple-task textarea').Watermark("Descrição"); 213 /*------------------------------------------------------------------------*/ 214 215 $('.qtip-active .button.close').button({ 216 icons: { 217 primary: "ui-icon-close" 218 }, 219 text: false 220 }) 221 .click(function(){ 222 $(componente).qtip('destroy'); 223 }); 224 225 $('.qtip-active .button.save').button().click(function(){ 226 227 var title = $('div.qtip div.add-simple-task input.task').val(); 228 var description = $('div.qtip div.add-simple-task textarea').val(); 229 230 var calendar, timezone = ''; 231 232 for (var i = 0; i < Calendar.signatures.length; i++){ 233 if(Calendar.signatures[i].type == 1 && Calendar.signatures[i].calendar.type == 1){ 234 calendar = Calendar.signatures[i].calendar.id; 235 timezone = Calendar.signatures[i].calendar.timezone; 236 break; 237 } 238 } 239 240 DataLayer.put('schedulable', 241 { 242 summary: title, 243 description: description, 244 type: '2', 245 calendar: calendar, 246 timezone: timezone, 247 'class':'1', 248 status: '1', 249 startTime: new Date().toString('yyyy-MM-dd 00:00:00'), 250 endTime: new Date().toString('yyyy-MM-dd 00:00:00'), 251 allDay: '1', 252 priority: '1', 253 participants: 254 [{ 255 user: User.me.id, 256 isOrganizer: 1, 257 acl: 'row' 258 }] 259 }); 260 261 $(componente).qtip('destroy'); 262 263 }); 264 265 $('.qtip-active .button.advanced').button().click(function(){ 266 267 var startEvent = new Date(); 268 var configData = (startEvent.toString('mm') < 30) ? {minutes: (30 - parseInt(startEvent.toString('mm')))} : {hours: 1, minutes: '-'+startEvent.toString('mm')}; 269 startEvent.add(configData); 270 271 var componente = $(this); 272 var description = $('div.qtip div.add-simple-task textarea[name="description"]').val(); 273 274 taskDetails({ 275 summary: $('div.qtip div.add-simple-task input[name="summary"]').val(), 276 description: description == 'Descrição' ? '' : description, 277 startTime: startEvent.getTime(), 278 endTime: dateCalendar.decodeRange(startEvent, (!!User.preferences.defaultCalendar ? ( !!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? 279 (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration))) 280 }, true ); 281 282 $(componente).qtip('destroy'); 283 }); 284 285 $('.qtip-active .button.cancel').button().click(function(){ 286 $(componente).qtip('destroy'); 287 }); 288 289 $('.qtip-active .button').button(); 290 291 $('div.qtip.qtip-blue.qtip-active').addClass('new-task'); 292 } 293 } 294 }); 295 296 $(".button.add.add-activity").click(function(event){ 297 var startEvent = new Date(); 298 var configData = (startEvent.toString('mm') < 30) ? {minutes: (30 - parseInt(startEvent.toString('mm')))} : {hours: 1, minutes: '-'+startEvent.toString('mm')}; 299 startEvent.add(configData); 300 301 activityDetails({ 302 startTime: startEvent.getTime(), 303 endTime: dateCalendar.decodeRange(startEvent, (!!User.preferences.defaultCalendar ? ( !!Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration ? 304 (Calendar.signatureOf[User.preferences.defaultCalendar].calendar.defaultDuration) : (User.preferences.defaultDuration)) : (User.preferences.defaultDuration))) 305 }, true ); 306 307 }); 149 308 150 309 var calendar = $('#calendar').fullCalendar(DataLayer.merge({ … … 189 348 year: 'ano' 190 349 }, 191 /* 350 192 351 eventRender: function( event, element, view ){ 193 $(element).attr( 'event-id', event.id ); 194 }, 195 */ 352 $('#calendar td.fc-year-have-event').removeClass('fc-year-have-event'); 353 354 var img_icon = ""; 355 if(event.type == 1) 356 img_icon = "mini-event.png"; 357 if(event.type == 2) 358 img_icon = "mini-task.png"; 359 if(event.type == 3) 360 img_icon = "mini-activity.png"; 361 362 363 element.find(".fc-event-inner.fc-event-skin").prepend($('<img style="width: 11px; height: 13px;" class="" src="../prototype/modules/calendar/img/' + img_icon + '"></img>')); 364 }, 365 196 366 select: function( start, end, allDay, event, view ){ 197 367 if (view.name == "month") { … … 285 455 eventClick: function( evt, event, view ){ 286 456 evt.id = evt.id.split('-')[0]; 287 if(evt.selectable){288 if(evt.isRepeat){289 $.Zebra_Dialog(evt.title + ' é um evento com repetição.', {290 'type': 'question',291 'overlay_opacity': '0.5',292 'buttons': ['Editar todas ocorrências', 'Editar essa ocorrência'],293 'onClose': function(clicked) {294 if(clicked == 'Editar todas ocorrências') {295 eventDetails( DataLayer.get( "schedulable", evt.id), true);296 }else{297 /*298 * TODO - repeat foi adicionado pois melhorias devem ser feitas no rollback do299 *DataLayer, repeat somente é usado quando se trata da criação de um evento300 *pela edição de uma ocorrência.301 */302 var repeat = mount_exception(evt.id, evt.occurrence);303 304 $('.calendar-copy-move input[name="typeEvent"]').val("3");305 306 eventDetails(copyAndMoveTo(false , evt.id , false, "3", evt), true, '', false, repeat);307 }308 }309 });310 311 }else{312 var schedulable = DataLayer.get( "schedulable", evt.id);313 schedulable.calendar = evt.calendar; 314 eventDetails( schedulable, true);315 316 } 317 457 458 switch (parseInt(evt.type)){ 459 case 1: 460 if(evt.selectable){ 461 if(evt.isRepeat){ 462 $.Zebra_Dialog(evt.title + ' é um evento com repetição.', { 463 'type': 'question', 464 'overlay_opacity': '0.5', 465 'buttons': ['Editar todas ocorrências', 'Editar essa ocorrência'], 466 'onClose': function(clicked) { 467 if(clicked == 'Editar todas ocorrências') { 468 eventDetails( DataLayer.get( "schedulable", evt.id), true); 469 }else{ 470 /* 471 * TODO - repeat foi adicionado pois melhorias devem ser feitas no rollback do 472 *DataLayer, repeat somente é usado quando se trata da criação de um evento 473 *pela edição de uma ocorrência. 474 */ 475 var repeat = mount_exception(evt.id, evt.occurrence); 476 477 $('.calendar-copy-move input[name="typeEvent"]').val("3"); 478 479 eventDetails(copyAndMoveTo(false , evt.id , false, "3", evt), true, '', false, repeat); 480 } 481 } 482 }); 483 }else{ 484 var schedulable = DataLayer.get( "schedulable", evt.id); 485 schedulable.calendar = evt.calendar; 486 eventDetails( schedulable, true); 487 } 318 488 } 489 break; 490 case 2: 491 var task = DataLayer.get( "schedulable", evt.id); 492 task.group = evt.calendar; 493 taskDetails( task, true); 494 break; 495 case 3: 496 var activity = DataLayer.get( "schedulable", evt.id); 497 activity.group = evt.calendar; 498 activityDetails( activity, true); 499 break; 500 } 319 501 }, 320 502 … … 322 504 contentMenu(); 323 505 } 324 }, dateCalendar)); 325 506 }, dateCalendar)); 507 508 326 509 contentMenu(); 327 510 … … 346 529 }); 347 530 //Todo chamada do metodo que adiciona ao full calendar o botao de listagem de eventos 348 //listEvents();531 printEvents(); 349 532 }); 533 534 535 function useDesktopNotification(){ 536 return !!parseInt(User.preferences.useDesktopNotification); 537 } -
branches/2.4/prototype/modules/calendar/js/load.js
r6754 r7228 1 1 Refresh = { 2 //Tempo em que ap ós a ultima sincronização será verificado atualizações2 //Tempo em que após a ultima sincronização será verificado atualizações 3 3 timeRefresh : 180, 4 4 clookRefresh: false, … … 8 8 delete DataLayer.tasks[this.clookRefresh]; 9 9 10 //Realiza agendamentos de atualiza ção de view somente se o módulo aberto for expressoCalendar10 //Realiza agendamentos de atualização de view somente se o módulo aberto for expressoCalendar 11 11 if(User.moduleName == "expressoCalendar"){ 12 12 this.clookRefresh = (parseInt(($.now()) / 1000) + this.timeRefresh); … … 54 54 } 55 55 56 this.calendarIds = [], this. signatureOf = {}, this.calendars = [], this.calendarOf= {};56 this.calendarIds = [], this.groupIds = [], this.signatureOf = {}, this.calendars = [], this.groups = [], this.calendarOf = {}, this.groupOf= {}; 57 57 58 58 for( var i = 0; i < this.signatures.length; i++ ){ 59 59 if(this.signatures[i].isOwner == "0") 60 60 this.signatures[i].permission = DataLayer.encode('calendarToPermission:detail', this.signatures[i].permission); 61 this.signatureOf[ this.calendarIds[i] = ( this.calendars[ this.calendars.length ] = this.calendarOf[ this.signatures[i].id ] = this.signatures[i].calendar ).id ] = this.signatures[i]; 61 62 if(this.signatures[i].calendar.type == '1') 63 this.signatureOf[ this.groupIds[this.groupIds.length] = ( this.groups[ this.groups.length ] = this.groupOf[ this.signatures[i].id ] = this.signatures[i].calendar ).id ] = this.signatures[i]; 64 else 65 this.signatureOf[ this.calendarIds[ this.calendarIds.length] = ( this.calendars[ this.calendars.length ] = this.calendarOf[ this.signatures[i].id ] = this.signatures[i].calendar ).id ] = this.signatures[i]; 62 66 } 63 67 … … 67 71 68 72 rerenderView: function(force){ 69 //TODO - Remover if quando centralizar o objeto User que contem as informa ções do usuário logado em um local acessÃvel a todos módulos73 //TODO - Remover if quando centralizar o objeto User que contem as informações do usuário logado em um local acessível a todos módulos 70 74 if(User.moduleName == "expressoCalendar"){ 71 75 if((typeof($tabs) != "undefined") && $tabs.tabs('option' ,'selected') == 0){ … … 89 93 contentMenu(); 90 94 }else if((typeof($tabs) != "undefined") && $tabs.tabs('option' ,'selected') != 0) 91 pageselectCallback($('.events-list-win.active [name=keyword]').val(), 0); 95 96 pageselectCallback($('.events-list-win.active [name=keyword]').val(), 0, false, ($tabs.tabs('option' ,'selected') > 2) ? 2 : ($tabs.tabs('option' ,'selected') == 1) ? 0 : 1); 92 97 } 93 98 } 94 99 } 95 100 96 Alarms = {97 load: function(){98 var eventsDay = DataLayer.get('alarm:schedulable',['=', 'date', Date.today().getTime()]);99 if(eventsDay)100 for(var i = 0; i < eventsDay.length; i++){101 this.addAlarm( eventsDay[i] );102 }103 },104 105 addAlarm: function( eventDay ){106 if(!DataLayer.tasks[parseInt(eventDay.sendTime)]){107 DataLayer.task( parseInt(eventDay.sendTime) , function( timestamp ){108 var path = User.moduleName == 'expressoCalendar' ? '' : '../prototype/modules/calendar/';109 DataLayer.render(path+'templates/alarm.ejs',{110 event: eventDay111 }, function( html ){112 $.Zebra_Dialog(html , {113 'type': 'question',114 'overlay_opacity': '0.5',115 'buttons': ['Fechar'],116 'onClose': function(clicked) {}117 });118 });119 });120 }121 }122 }123 124 101 Calendar.load(); 125 Alarms.load(); -
branches/2.4/prototype/modules/calendar/js/map.disponibility.js
r6453 r7228 8 8 9 9 10 function updateMap( data){11 var start_date = $(".new- event-win.active .start-date").val();12 var end_date = $(".new- event-win.active .end-date").val();13 var start_time = $(".new- event-win.active .start-time").val();14 var end_time = $(".new- event-win.active .end-time").val();15 var isAllDay = $('.new- event-win.active input[name="allDay"]').is(':checked');10 function updateMap(viewName){ 11 var start_date = $(".new-"+viewName+"-win.active .start-date").val(); 12 var end_date = $(".new-"+viewName+"-win.active .end-date").val(); 13 var start_time = $(".new-"+viewName+"-win.active .start-time").val(); 14 var end_time = $(".new-"+viewName+"-win.active .end-time").val(); 15 var isAllDay = $('.new-'+viewName+'-win.active input[name="allDay"]').is(':checked'); 16 16 17 17 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; … … 21 21 22 22 23 var event = $( "#new_event_map").fullCalendar('clientEvents', 'map')[0];23 var event = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('clientEvents', 'map')[0]; 24 24 25 25 … … 28 28 event.end = endDate; 29 29 event.allDay = isAllDay; 30 $( "#new_event_map").fullCalendar( 'updateEvent', event )30 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'updateEvent', event ) 31 31 } 32 32 … … 35 35 36 36 37 function disponibily(objEvent, path, attendees ){37 function disponibily(objEvent, path, attendees, viewName){ 38 38 var formatString = User.preferences.dateFormat + " " + User.preferences.hourFormat; 39 39 var startDate = Date.parseExact( objEvent.startDate + " " + $.trim(objEvent.startHour) , formatString ); 40 40 var endDate = Date.parseExact( objEvent.endDate + " " + $.trim(objEvent.endHour) , formatString ); 41 42 var dialogName = {event: 'addEvent', task: 'addTask', activity: 'addActivity'} 41 43 42 44 var mapHtml = DataLayer.render( path+'templates/availability_map.ejs', {}); 43 $( "#calendar_addevent_details7").html(mapHtml);44 $( "#new_event_map").fullCalendar(DataLayer.merge({45 $('#calendar_add'+viewName+'_details7').html(mapHtml); 46 $('.new-'+viewName+'-win .map_disponibility').fullCalendar(DataLayer.merge({ 45 47 height : 300, 46 48 timeFormat: User.preferences.hourFormat, … … 77 79 if(!allDay){ 78 80 $('[name="allDay"]').attr("checked", false); 79 UI.dialogs .addEvent.find('.start-time, .end-time').removeClass('hidden');81 UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').removeClass('hidden'); 80 82 81 83 $('[name="startHour"]').val(start.toString(User.preferences.hourFormat)); … … 85 87 }else{ 86 88 $('[name="allDay"]').attr("checked", true); 87 UI.dialogs .addEvent.find('.start-time, .end-time').addClass('hidden');89 UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').addClass('hidden'); 88 90 } 89 91 }, … … 98 100 className : "map-event", 99 101 backgroundColor : "transparent !important", 100 editable : objEvent.acl .write || objEvent.acl.organization102 editable : objEvent.acl ? (objEvent.acl.write || objEvent.acl.organization) : true 101 103 } 102 104 ], … … 104 106 if(event.allDay){ 105 107 $('[name="allDay"]').attr("checked", true); 106 UI.dialogs .addEvent.find('.start-time, .end-time').addClass('hidden');108 UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').addClass('hidden'); 107 109 108 110 $('[name="startDate"]').val(dateCalendar.toString(event.start, User.preferences.dateFormat)); … … 111 113 }else{ 112 114 $('[name="allDay"]').attr("checked", false); 113 UI.dialogs .addEvent.find('.start-time, .end-time').removeClass('hidden');115 UI.dialogs[dialogName[viewName]].find('.start-time, .end-time').removeClass('hidden'); 114 116 115 117 $('[name="startHour"]').val(dateCalendar.formatDate(event.start, User.preferences.hourFormat)); … … 132 134 var eventSource = new Array(); 133 135 var updateMapView = function(){ 134 updateMap( );135 var view = $( "#new_event_map").fullCalendar('getView');136 updateMap(viewName); 137 var view = $('.new-'+viewName+'-win .map_disponibility').fullCalendar('getView'); 136 138 var map = {}; 137 $( "#new_event_map").fullCalendar( 'removeEventSource', eventSource );139 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'removeEventSource', eventSource ); 138 140 eventSource = new Array(); 139 141 map = {startTime : view.start.getTime(), endTime : view.end.getTime(), attendees: {}, timezone: (objEvent.timezone || User.preferences.timezone)}; … … 167 169 } 168 170 if(eventSource.length) 169 $( "#new_event_map").fullCalendar( 'addEventSource', eventSource );171 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'addEventSource', eventSource ); 170 172 }; 171 $('[href="#calendar_addevent_details7"]').click(function(eventData, eventObject){ 172 $("#new_event_map").fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString); 173 //if(eventObject == undefined) 174 updateMapView(); 173 $('[href="#calendar_add'+viewName+'_details7"]').click(function(eventData, eventObject){ 174 $('.new-'+viewName+'-win .map_disponibility').fullCalendar( 'gotoDate', Date.parseExact($('[name="startDate"]').val() + " " + $.trim($('[name="startHour"]').val()), formatString) , formatString); 175 updateMapView(); 175 176 }); 176 $( "#new_event_map").find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){177 $('.new-'+viewName+'-win .map_disponibility').find(".fc-button-prev, .fc-button-next, .fc-button-today").click(function(){ 177 178 updateMapView(); 178 179 }); -
branches/2.4/prototype/modules/calendar/templates/alarms_add_itemlist.ejs
r6393 r7228 1 <% 1 <%if(data.alarm){ 2 2 for(var i = 0; i < data.alarm.defaultAlarms.length; i++){%> 3 3 <li class="input-group"> … … 16 16 <input type="hidden" name="alarmId[]" value="" /> 17 17 <input type="hidden" name="isDefaultAlarm[]" value="<%=data.alarm.useAlarmDefault ? 1 : 0%>" /> 18 <label> antes de cada evento.</label> 18 <%if(!!!parseInt(data.type)){%> 19 <label>antes de cada evento.</label> 20 <%}else{%> 21 <label>antes de cada tarefa.</label> 22 <%}%> 19 23 <a class="button remove tiny"></a> 20 24 </li> … … 35 39 </select> 36 40 <input type="hidden" name="alarmId[]" value="" /> 37 <label> antes de cada evento.</label> 41 <%if(!!!parseInt(data.type)){%> 42 <label>antes de cada evento.</label> 43 <%}else{%> 44 <label>antes de cada tarefa.</label> 45 <%}%> 38 46 <a class="button remove tiny"></a> 39 47 </li> -
branches/2.4/prototype/modules/calendar/templates/availability_map.ejs
r5636 r7228 1 <fieldset id="availability_map"class="tab-level2">2 <div id="new_event_map" class="map" style="width : 100%;">1 <fieldset class="tab-level2"> 2 <div class="map_disponibility" style="width : 100%;"> 3 3 </div> 4 4 </fieldset> -
branches/2.4/prototype/modules/calendar/templates/calendar_list.ejs
r5927 r7228 1 <% 2 var signatures = {'calendar': [], 'taskGroup': [], 'sharedCalendar': []}; 3 for(var i = 0; i < data.signatures.length; i++) 4 { 5 if(data.signatures[i].calendar.type == 1){ 6 signatures['taskGroup'].push(data.signatures[i]); 7 }else{ 8 signatures[data.signatures[i].isOwner == 1 ? 'calendar' : 'sharedCalendar'].push(data.signatures[i]); 9 } 10 } 11 %> 12 1 13 <div class="all-list-calendars"> 2 <% var signature = data.signatures %> 3 <% var external = false %> 4 <div class="my-calendars"> 5 <a title='Minhas agendas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Minhas agendas</a> 14 15 <div class="my-groups-task"> 16 <a title='Grupos de tarefas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Grupos de tarefas</a> 6 17 <span class="status-list ui-icon ui-icon-triangle-1-s"></span> 7 <a href="#" class="button new new-calendar ">Nova Agenda</a>18 <a href="#" class="button new new-calendar 1">Novo Grupo</a> 8 19 <ul class="list-calendars my-list-calendars"> 9 <% for (var i=0; i < signature.length; i++) { 10 if(signature[i].isOwner == 1){ 11 %> 12 <li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>" title="<%= signature[i].calendar.name %>"> 20 <% for (var i=0; i < signatures['taskGroup'].length; i++) {%> 21 <li class="list-calendars-item list-calendars-item-<%= signatures['taskGroup'][i].calendar.id %>" title="<%= signatures['taskGroup'][i].calendar.name %>"> 13 22 14 23 <div> 15 <input class="calendar-view" type="checkbox" name="" value="<%= signature [i].calendar.id %>" checked="checked"/>16 <label><%= signature [i].calendar.name %></label>24 <input class="calendar-view" type="checkbox" name="" value="<%= signatures['taskGroup'][i].calendar.id %>" checked="checked"/> 25 <label><%= signatures['taskGroup'][i].calendar.name %></label> 17 26 18 27 </div> 19 <a class="cal-list-options-btn my-cal-list-options-btn-<%= signature [i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">28 <a class="cal-list-options-btn my-cal-list-options-btn-<%= signatures['taskGroup'][i].calendar.id %>" style="background-color:#<%=signatures['taskGroup'][i].backgroundColor%>; border-color:#<%= signatures['taskGroup'][i].borderColor%>;"> 20 29 <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/> 21 30 </a> 22 31 23 32 24 <div class="cal-list-options my-cal-list-options-<%= signature [i].calendar.id %> hidden">33 <div class="cal-list-options my-cal-list-options-<%= signatures['taskGroup'][i].calendar.id %> hidden"> 25 34 <ul> 26 <li><a href="#" onclick="add_tab_configure_calendar(<%= signature[i].calendar.id%>);">Configurações</a></li> 27 <li><a href="#" onclick="show_modal_import_export(0, <%= signature[i].calendar.id%>);">Importar</a></li> 28 <li><a href="#" onclick="show_modal_import_export(1, <%= signature[i].calendar.id%>);">Exportar</a></li> 29 <li><a href="#" onclick="show_modal_shared(<%= signature[i].calendar.id%>);">Compartilhar agenda</a></li> 30 <li><a href="#" onclick="remove_calendar();">Remover agenda</a></li> 35 <li><a href="#" onclick="add_tab_configure_calendar(<%= signatures['taskGroup'][i].calendar.id%>, 1);">Configurações</a></li> 36 <li><a href="#" onclick="show_modal_import_export(0,<%= signatures['taskGroup'][i].calendar.id%>, 1);">Importar</a></li> 37 <li><a href="#" onclick="show_modal_import_export(1,<%= signatures['taskGroup'][i].calendar.id%>, 1);">Exportar</a></li> 38 <%if(signatures['taskGroup'][i].type == '0'){%> 39 <li><a href="#" onclick="remove_calendar(1);">Remover Grupo</a></li> 40 <%}%> 31 41 </ul> 32 42 33 43 </div> 34 44 </li> 35 <% 36 }else 37 external = true; 38 } 39 %> 45 <%}%> 46 47 </ul> 48 </div> 49 50 <div class="my-calendars"> 51 <a title='Minhas agendas' class="title-my-calendars" aria-expanded='false' role='button' tabindex='0'>Minhas agendas</a> 52 <span class="status-list ui-icon ui-icon-triangle-1-s"></span> 53 <a href="#" class="button new new-calendar 0">Nova Agenda</a> 54 <ul class="list-calendars my-list-calendars"> 55 <% for (var i=0; i < signatures.calendar.length; i++) {%> 56 <li class="list-calendars-item list-calendars-item-<%= signatures['calendar'][i].calendar.id %>" title="<%= signatures['calendar'][i].calendar.name %>"> 57 58 <div> 59 <input class="calendar-view" type="checkbox" name="" value="<%= signatures['calendar'][i].calendar.id %>" checked="checked"/> 60 <label><%= signatures['calendar'][i].calendar.name %></label> 61 62 </div> 63 <a class="cal-list-options-btn my-cal-list-options-btn-<%= signatures['calendar'][i].calendar.id %>" style="background-color:#<%=signatures['calendar'][i].backgroundColor%>; border-color:#<%= signatures['calendar'][i].borderColor%>;"> 64 <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/> 65 </a> 66 67 68 <div class="cal-list-options my-cal-list-options-<%= signatures['calendar'][i].calendar.id %> hidden"> 69 <ul> 70 <li><a href="#" onclick="add_tab_configure_calendar(<%= signatures['calendar'][i].calendar.id%>, 0);">Configurações</a></li> 71 <li><a href="#" onclick="show_modal_import_export(0, <%= signatures['calendar'][i].calendar.id%>, 0);">Importar</a></li> 72 <li><a href="#" onclick="show_modal_import_export(1, <%= signatures['calendar'][i].calendar.id%>, 0);">Exportar</a></li> 73 <li><a href="#" onclick="show_modal_shared(<%= signatures['calendar'][i].calendar.id%>);">Compartilhar agenda</a></li> 74 <li><a href="#" onclick="remove_calendar(0);">Remover agenda</a></li> 75 </ul> 76 77 </div> 78 </li> 79 <%}%> 40 80 41 81 </ul> … … 47 87 <a href="#" class="button new new-calendar-shared tiny">Nova Agenda</a> 48 88 49 <% if (external) { %>50 89 <ul class="list-calendars signed-list-calendars"> 51 <% for (var i=0; i < signature.length; i++) { 52 if(signature[i].isOwner == 0){ 53 %> 54 <li class="list-calendars-item list-calendars-item-<%= signature[i].calendar.id %>" title="<%= signature[i].calendar.name %>"> 90 <% for (var i=0; i < signatures['sharedCalendar'].length; i++) {%> 91 <li class="list-calendars-item list-calendars-item-<%= signatures['sharedCalendar'][i].calendar.id %>" title="<%= signatures['sharedCalendar'][i].calendar.name %>"> 55 92 <div> 56 <input class="calendar-view" type="checkbox" name="" value="<%= signature[i].calendar.id %>" checked="checked"/>57 <label><%= signature[i].calendar.name %></label>58 </div>59 <a class="cal-list-options-btn my-cal-list-options-btn-<%= signature [i].calendar.id %>" style="background-color:#<%=signature[i].backgroundColor%>; border-color:#<%= signature[i].borderColor%>;">93 <input class="calendar-view" type="checkbox" name="" value="<%= signatures['sharedCalendar'][i].calendar.id %>" checked="checked"/> 94 <label><%= signatures['sharedCalendar'][i].calendar.name %></label> 95 </div> 96 <a class="cal-list-options-btn my-cal-list-options-btn-<%= signatures['sharedCalendar'][i].calendar.id %>" style="background-color:#<%=signatures['sharedCalendar'][i].backgroundColor%>; border-color:#<%= signatures['sharedCalendar'][i].borderColor%>;"> 60 97 <img src="../prototype/modules/calendar/img/arrow_down.png" width="10" height="10" class="cal-list-img"/></a> 61 <div class="cal-list-options my-cal-list-options-<%= signature [i].calendar.id %> hidden">98 <div class="cal-list-options my-cal-list-options-<%= signatures['sharedCalendar'][i].calendar.id %> hidden"> 62 99 <ul> 63 <li><a href="#" onclick="add_tab_configure_calendar(<%= signature [i].calendar.id %>);">Configurações</a></li>64 <li><a href="#" onclick="show_modal_import_export(0, <%= signature [i].calendar.id %>);">Importar</a></li>65 <li><a href="#" onclick="show_modal_import_export(1, <%= signature [i].calendar.id %>);">Exportar</a></li>66 <%if(!signature [i].permission.acl['required']){%>67 <li><a href="#" onclick="cancel_signature(<%= signature [i].id %>);">Cancelar assinatura</a></li>100 <li><a href="#" onclick="add_tab_configure_calendar(<%= signatures['sharedCalendar'][i].calendar.id %>, 0);">Configurações</a></li> 101 <li><a href="#" onclick="show_modal_import_export(0, <%= signatures['sharedCalendar'][i].calendar.id%>, 0);">Importar</a></li> 102 <li><a href="#" onclick="show_modal_import_export(1, <%= signatures['sharedCalendar'][i].calendar.id%>, 0);">Exportar</a></li> 103 <%if(!signatures['sharedCalendar'][i].permission.acl['required']){%> 104 <li><a href="#" onclick="cancel_signature(<%= signatures['sharedCalendar'][i].id %>);">Cancelar assinatura</a></li> 68 105 <%}%> 69 106 </ul> … … 72 109 73 110 </li> 74 <% 75 } 76 } 77 %> 111 <%}%> 78 112 </ul> 79 <% } %>80 113 </div> 81 114 </div> -
branches/2.4/prototype/modules/calendar/templates/calendar_search_itemlist.ejs
r6052 r7228 3 3 <input type="checkbox" name="opcao" <%= (data[i].enabled) ? '' : 'disabled="disabled"' %> /> 4 4 <input type="hidden" value="<%=data[i]['id']%>" /> 5 <label class="name"><%=data[i]['name']%> </label>5 <label class="name"><%=data[i]['name']%> ( <%=data[i]['owner']['uid']%> )</label> 6 6 <label class="mail hidden"><%=data[i]['mail']%></label> 7 7 <label class="id hidden"><%=data[i]['id']%></label> -
branches/2.4/prototype/modules/calendar/templates/configure_calendars.ejs
r5341 r7228 1 <%if(!!parseInt(data.type)){%> 2 <div class="configure-calendars-win active" title="Configurações do Grupo de Tarefas"> 3 <h3>Preferências do Grupo de Tarefas</h3> 4 <%}else{%> 1 5 <div class="configure-calendars-win active" title="Configurações da Agenda"> 2 6 <h3>Preferências da Agenda</h3> 7 <%}%> 3 8 <div class="header-menu-container"> 4 9 <a class="button cancel" href="#">Cancelar</a> … … 6 11 </div> 7 12 <% for (var i=0; i<data.signatures.length; i++) { %> 8 <fieldset class="user-calendar" title="<%= data.calendars[i].name%>" > 9 <legend><%= data.calendars[i].name%></legend> 10 11 </fieldset> 13 <fieldset class="user-calendar" title="<%= data.calendars[i].name%>" > 14 <legend><%= data.calendars[i].name%></legend> 15 </fieldset> 12 16 <%} //for each signatures %> 13 17 <!-- -
branches/2.4/prototype/modules/calendar/templates/configure_calendars_itemlist.ejs
r6584 r7228 1 <%var isOwner = parseInt(data.signature.isOwner) ? '' : 'readonly="readonly"'%> 1 <%var isOwner = parseInt(data.signature.isOwner) ? '' : 'readonly="readonly"'; 2 var isGroup = !!parseInt(data.signature.calendar.type);%> 2 3 <form method="POST" action="calendarSignature:configure"> 3 4 <input type="hidden" name="signature" value="<%=data.signature.id%>" /> 5 <input type="hidden" name="type" value="<%=data.signature.calendar.type%>" /> 4 6 5 7 <fieldset class="configurations-basic"> … … 7 9 8 10 <p class="input-group"> 11 <%if(!isGroup){%> 9 12 <label for="name">Nome da agenda:</label> 13 <%}else{%> 14 <label for="name">Nome do grupo:</label> 15 <%}%> 10 16 <input name="name" value="<%=data.calendar.name%>" <%= isOwner %> type="text" class=""/> 11 17 </p> … … 15 21 <input name="description" value="<%=data.calendar.description%>" <%= isOwner %> type="text" class=""/> 16 22 </p> 17 23 <%if(!isGroup){%> 18 24 <p class="input-group"> 19 25 <label for="duration">Duração padrão de evento:</label> 20 26 <input name="duration" value="<%=data.calendar.defaultDuration%>" <%= isOwner %> type="text" class="number"/> 21 27 </p> 22 28 <%}%> 23 29 <p class="input-group"> 30 <%if(!isGroup){%> 24 31 <label for="timezone">Fuso horário da agenda:</label> 25 <%if(data.signature.isOwner == 0){%> 32 <%}else{%> 33 <label for="timezone">Fuso horário do grupo:</label> 34 <%} if(data.signature.isOwner == 0){%> 26 35 <input name="timezone" value="<%=data.calendar.timezone%>" size="50" readonly="readonly" type="text" class=""/> 27 36 <%}else{%> … … 29 38 <%}%> 30 39 </p> 31 40 <%if(!isGroup){%> 32 41 <p class="input-group"> 33 42 <label for="location">URL:</label> 34 43 <input name="location" value="<%=data.calendar.location%>" <%= isOwner %> type="text" class=""/> 35 44 </p> 36 45 <%}%> 37 46 </fieldset> 38 47 39 48 <fieldset class="configurations-colors"> 49 <%if(!isGroup){%> 40 50 <legend class="">Cores dos eventos desta agenda</legend> 41 51 <%} else{%> 52 <legend class="">Cores das tarefas deste grupo</legend> 53 <%}%> 42 54 <div class="calendar-colorpicker"></div> 43 55 </fieldset> … … 86 98 </select> 87 99 <input type="hidden" name="alarmId[]" value="<%=data.signature.defaultAlarms[i].id%>" /> 100 <%if(!isGroup){%> 88 101 <label>antes de cada evento.</label> 102 <%}else{%> 103 <label>antes de cada tarefa.</label> 104 <%}%> 89 105 <a class="button remove tiny">Excluir</a> 90 106 </li> -
branches/2.4/prototype/modules/calendar/templates/event_add.ejs
r7069 r7228 20 20 <input type="text" class="time end-time<%= (data.event.allDay) ? ' hidden' : '' %>" value="<%= (data.event.endHour) ? data.event.endHour : '' %>" <%=(data.event.acl.organization || data.event.acl.write) ? '' : 'disabled="disabled"' %> name="endHour" /> 21 21 22 <a href="#" class="calendar_addevent_details_lnk_timezone <%=((data.event.acl.organization || data.event.acl.write)) ? '' : "hidden" %>">Fuso horário</a> 22 <a href="#" class="calendar_addevent_details_lnk_timezone <%=((data.event.acl.organization || data.event.acl.write)) ? '' : "hidden" %>">Fuso horário</a> 23 23 <!-- <input type="text" name="timezone" style="display: none;" />--> 24 24 <select name="timezone" class="hidden calendar-addevent-details-txt-timezone"> … … 171 171 <div class="overflow_add_calender"> 172 172 <fieldset id="calendar_addevent_details5" class="tab-level2"> 173 <form id="fileupload " action="attachment:detail" method="POST">173 <form id="fileuploadevent" action="attachment:detail" method="POST"> 174 174 <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> 175 175 <div class="row fileupload-buttonbar"> … … 183 183 <%}%> 184 184 <%if(data.event.acl.organization || data.event.acl.write){%> 185 <button type="button" class="button btn-danger delete ">185 <button type="button" class="button btn-danger delete <%= data.event && data.event.attachments && data.event.attachments.length ? '' : 'hidden' %>"> 186 186 <i class="icon-trash icon-white"></i> Remover Todos 187 187 </button> 188 188 <%}%> 189 189 </div> 190 <div id="fileupload-progress "></div>190 <div id="fileupload-progress-event"></div> 191 191 <div class="files-list"> 192 192 <ul class="attachments-list"> -
branches/2.4/prototype/modules/calendar/templates/event_list.ejs
r6754 r7228 1 <div title="Lista de eventos" class="events-list events-list-win active"> 1 <% 2 3 var decoder = {status: {1: 'Sem ações', 2: 'Em processo', 3: 'Completo', 4: 'Cancelado'}, priority: {1: 'Alta', 2: 'Normal', 3: 'Baixa'}} 4 5 %> 6 7 <div title="<%=data.tab_title%>" class="events-list events-list-win active"> 2 8 3 9 … … 43 49 <td> 44 50 <span> 51 <% 52 var img_type = ""; 53 var title_type = ""; 54 if(_event.type == '1'){ 55 img_type = "../prototype/modules/calendar/img/big-event.png"; 56 title_type = "Evento"; 57 }if(_event.type == '2'){ 58 img_type = "../prototype/modules/calendar/img/big-task.png"; 59 title_type = "Tarefa"; 60 }if(_event.type == '3'){ 61 img_type = "../prototype/modules/calendar/img/big-activity.png"; 62 title_type = "Atividade"; 63 } 64 %> 65 <img title="<%= title_type %>" src="<%= img_type %>"> 45 66 <a class="title event-details-item" title='<%= _event.summary %>' aria-expanded='false' role='button' tabindex='0'><%= _event.summary %></a> 46 67 <!-- TODO: FAZER FUNCIONAR DESTA FORMA --> … … 86 107 %> 87 108 </span> 88 <div class="details-event-list hidden ">109 <div class="details-event-list hidden <%= (title_type == "Evento" ? "details-event" : "details-task") %>"> 89 110 <fieldset class="fields-details-event-list"> 90 111 <%if(_event.allDay){%> 91 112 <p class="input-group date-info"> 92 <label>Duração </label>113 <label>Duração:</label> 93 114 <span class="">Dia inteiro</span> 94 115 </p> … … 108 129 </p> 109 130 <%}%> 110 <%if(_event.repeat ){%> 131 <%if(_event.type == '1'){ 132 if(_event.repeat ){%> 111 133 <p class="input-group"> 112 134 <label>Repetição</label> 113 135 <span><%= _event.repeat %></span> 114 136 </p> 115 <%}%> 116 <p class="input-group"> 117 <label>Lembretes</label> 118 <% if(_event.alarms) { %> 137 <%}}%> 138 <p class="input-group"> 139 <label>Lembretes:</label> 140 <% if(_event.alarms) { 141 var string_alarm = ""; 142 if(_event.type == '1') 143 string_alarm = 'do evento'; 144 if(_event.type == '2') 145 string_alarm = 'da tarefa'; 146 if(_event.type == '3') 147 string_alarm = 'da atividade'; 148 %> 119 149 <span class="large" > 120 150 <% for (var l=0; l < _event.alarms.length; l++) { %> 121 <span class="large" >Você será notificado por um <%=dateCalendar.alarmtype[_event.alarms[l].type]%> <%= _event.alarms[l].time %> <%= dateCalendar.timeunit[_event.alarms[l].unit]%><%=_event.alarms[l].time > 1 ? 's' : '' %> antes do evento</span>151 <span class="large" >Você será notificado por um <%=dateCalendar.alarmtype[_event.alarms[l].type]%> <%= _event.alarms[l].time %> <%= dateCalendar.timeunit[_event.alarms[l].unit]%><%=_event.alarms[l].time > 1 ? 's' : '' %> antes <%=string_alarm%></span> 122 152 <% } %> 123 153 </span> 124 154 <% } %> 125 155 </p> 126 <p class="input-group"> 127 <label>Local</label> 156 <%if(_event.type == '1'){%> 157 <p class="input-group"> 158 <label>Local:</label> 128 159 <span><%= _event.location %></span> 129 160 </p> 130 <p class="input-group"> 131 <label>Descrição </label> 161 <%}%> 162 <p class="input-group"> 163 <label>Descrição:</label> 132 164 <span class="large" ><%= _event.description %></span> 133 165 </p> 134 <!--<p class="input-group"> 166 <%if(_event.type != '1'){%> 167 <p class="input-group"> 168 <label>Prioridade:</label> 169 <span><%= decoder['priority'][_event.priority] %></span> 170 </p> 171 <p class="input-group"> 172 <label>% Conlusão:</label> 173 <span><%= _event.percentage %>%</span> 174 </p> 175 <p class="input-group"> 176 <label>Status:</label> 177 <span><%= decoder['status'][_event.status] %></span> 178 </p> 179 <% } %> 180 <!-- <p class="input-group"> 135 181 <label>Privacidade</label> 136 182 <span><%= _event.privacy %></span> 137 </p>--> 138 <p class="input-group"> 139 <label>Organizador</label> 140 <span class="large"><%= _event.organizer.user ? _event.organizer.user.name : _event.organizer.name %> (<%= _event.organizer.user ? _event.organizer.user.mail : _event.organizer.mail %>)</span> 141 </p> 142 <p class="input-group"> 143 <label>Participantes</label> 183 </p> --> 184 <%if(_event.organizer && _event.organizer.user){%> 185 <p class="input-group"> 186 <label>Organizador:</label> 187 <span class="large"><%= _event.organizer.user ? _event.organizer.user.name : _event.organizer.name %> (<%= _event.organizer.user ? _event.organizer.user.mail : _event.organizer.mail %>)</span> 188 </p> 189 <%}%> 190 <%if(_event.type != '3'){%> 191 <p class="input-group"> 192 <label>Participantes:</label> 144 193 <% if(_event.attendee) { %> 145 194 <span class="large" > … … 150 199 <% } %> 151 200 </p> 152 <p class="input-group"> 153 <label>Presença</label> 201 <%} 202 if(_event.type == '3'){%> 203 <p class="input-group"> 204 <label>Tarefas</label> 205 <% if(_event.tasks) { %> 206 <span class="large" > 207 <% for (var m in _event.tasks) { %> 208 <span class="large"><%=_event.tasks[m].description%></span> 209 <%}%> 210 </span> 211 <% } %> 212 </p> 213 <%}%> 214 215 <p class="input-group"> 216 <label>Presença:</label> 154 217 <span> 155 <% var status_name; 156 if (_event.status == 1) 157 status_name = "Eu vou"; 158 else if (_event.status == 2) 159 status_name = "Talvez"; 160 else if (_event.status == 3) 161 status_name = "Eu não vou"; 162 %> 163 <%= status_name %> 164 </span> <!-- Ta hardcodificado isso aqui? --> 165 </p> 218 <% var status_name; 219 if (_event.status == 1) 220 status_name = "Eu vou"; 221 else if (_event.status == 2) 222 status_name = "Talvez"; 223 else if (_event.status == 3) 224 status_name = "Eu não vou"; 225 %> 226 <%= status_name %> 227 </span> <!-- Ta hardcodificado isso aqui? --> 228 </p> 229 166 230 </fieldset> 167 231 <div class="menu-container footer-container"> 168 232 <input name="eventid" type="hidden" value="<%=_event.id%>"></input> 169 <input name="calendarid" type="hidden" value="<%=_event.calendar%>"></input> 233 <input name="eventtype" type="hidden" value="<%=_event.type%>"></input> 234 <input name="calendarid" type="hidden" value="<%=_event.calendar ? _event.calendar : _event.group%>"></input> 235 <a title="Imprimir" class="button print" href="#">Imprimir</a> 170 236 <a title="Excluir" class="button delete" href="#">Excluir</a> 171 237 <a title="Editar" class="button edit" href="#">Editar</a> -
branches/2.4/prototype/modules/calendar/templates/import_export.ejs
r5901 r7228 15 15 <input type="hidden" name="type" value="iCal"> 16 16 <input type="hidden" name="params[owner]" value="<%= data.owner %>"> 17 <legend class="hidden">Importar agenda</legend>17 <legend class="hidden">Importar <%=data.typeView == 0 ? 'eventos' : 'tarefas'%></legend> 18 18 <p class="input-group"> 19 19 <label for="data">Arquivo:</label> 20 20 <span class="hidden file-add"></span> 21 21 <input type="file" name="data" value=""/> 22 <span class="tip">Escolha o arquivo que contenha um ou vários eventos. A Agenda do Expresso pode importar informações de eventono formato iCal.</span>23 <label for="calendar"> Agenda:</label>22 <span class="tip">Escolha o arquivo que contenha um ou <%=data.typeView == 0 ? 'vários eventos' : 'várias tarefas'%>. <%=data.typeView == 0 ? 'A Agenda' : 'O Grupo'%> do Expresso pode importar informações de <%=data.typeView == 0 ? 'evento' : 'tarefa'%> no formato iCal.</span> 23 <label for="calendar"><%=data.typeView == 0 ? 'Agenda:' : 'Grupo:'%></label> 24 24 <select name="params[calendar]"> 25 25 <% for( var i = 0; i < data.calendars.length; i++ ){ %> … … 27 27 <% } %> 28 28 </select> 29 <span class="tip"> Agenda daqual os eventos serão importados</span>29 <span class="tip"><%=data.typeView == 0 ? 'Agenda da' : 'Grupo do'%> qual os eventos serão importados</span> 30 30 </p> 31 31 </fieldset> … … 42 42 <legend class="hidden">Exportar agenda</legend> 43 43 <p class="input-group"> 44 <label for="calendar"> Agenda:</label>44 <label for="calendar"><%=data.typeView == 0 ? 'Agenda:' : 'Grupo:'%></label> 45 45 <select name="calendar"> 46 46 <!--<option value="cal_all">Todas agendas</option>--> … … 49 49 <% } %> 50 50 </select> 51 <span class="tip">Escolha a agenda que deseja exportar. A Agenda do Expresso pode exportar informações de eventono formato iCal.</span>51 <span class="tip">Escolha <%=data.typeView == 0 ? 'a agenda' : 'o grupo'%> que deseja exportar. <%=data.typeView == 0 ? 'A Agenda' : 'O Grupo'%> do Expresso pode exportar informações de <%=data.typeView == 0 ? 'eventos' : 'tarefas'%> no formato iCal.</span> 52 52 </p> 53 53 </fieldset> -
branches/2.4/prototype/modules/calendar/templates/index.ejs
r6754 r7228 27 27 <link rel="Stylesheet" type="text/css" href="<?= PLUGINSURL ?>/timepicker/jquery-ui-timepicker-addon.css" /> 28 28 <link rel="stylesheet" type="text/css" href='<?= PLUGINSURL ?>/zebradialog/css/zebra_dialog.css'></link> 29 <link rel="stylesheet" type="text/css" href='<?= PLUGINSURL ?>/jquery.spinner/jquery.spinner.css'></link> 29 30 30 31 <link rel="stylesheet" type="text/css" href="<?= MODULESURL ?>/css/layout.css" /> … … 71 72 <script type="text/javascript" src="<?= PLUGINSURL ?>/qtip/jquery.qtip-1.0.0-rc3.min.js"></script> 72 73 <script type="text/javascript" src="<?= PLUGINSURL ?>/contextmenu/jquery.contextMenu.js"></script> 74 <script type='text/javascript' src='<?= PLUGINSURL ?>/jquery.spinner/jquery.spinner.min.js'></script> 73 75 74 76 <!-- JPicker --> … … 87 89 88 90 <script type='text/javascript' src='<?= MODULESURL ?>/js/map.disponibility.js'></script> 91 92 <script type='text/javascript' src='<?= MODULESURL ?>/js/activity.helpers.js'></script> 93 <script type='text/javascript' src='<?= MODULESURL ?>/js/task.helpers.js'></script> 89 94 <script type='text/javascript' src='<?= MODULESURL ?>/js/helpers.js'></script> 90 95 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.shared.js'></script> … … 92 97 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.codecs.js'></script> 93 98 <script type='text/javascript' src='<?= MODULESURL ?>/js/load.js'></script> 99 <script type='text/javascript' src='<?= MODULESURL ?>/js/calendar.alarms.js'></script> 94 100 95 101 <script type='text/javascript' src='<?= MODULESURL ?>/js/I18n.js'></script> … … 97 103 <script type="text/javascript" src="<?= MODULESURL ?>/js/init.js"></script> 98 104 <script type="text/javascript" src="<?= MODULESURL ?>/js/drag_area.js"></script> 105 <script type="text/javascript" src="<?= MODULESURL ?>/js/desktop.notification.js"></script> 99 106 100 107 </head> … … 107 114 <ul> 108 115 <li><a href="#" onclick="add_tab_preferences();" class="menu-command configurations">Preferências</a></li> 109 <li><a href="#" onclick="add_tab_configure_calendar();" class="menu-command configurations">Configuração de agendas</a></li> 110 <li><a href="#" onclick="show_modal_import_export(0);" class="menu-pass-through">Importar</a></li> 111 <li><a href="#" onclick="show_modal_import_export(1);" class="menu-pass-through">Exportar</a></li> 116 <li><a href="#" onclick="add_tab_configure_calendar(false, 0);" class="menu-command configurations">Configuração de agendas</a></li> 117 <li><a href="#" onclick="add_tab_configure_calendar(false, 1);" class="menu-command configurations">Configuração de grupos</a></li> 118 <li><a href="#" onclick="show_modal_import_export(0, 3, 0);" class="menu-pass-through">Importar Eventos</a></li> 119 <li><a href="#" onclick="show_modal_import_export(1, 3, 0);" class="menu-pass-through">Exportar Eventos</a></li> 120 <li><a href="#" onclick="show_modal_import_export(0, 4, 1);" class="menu-pass-through">Importar Tarefas</a></li> 121 <li><a href="#" onclick="show_modal_import_export(1, 4, 1);" class="menu-pass-through">Exportar Tarefas</a></li> 112 122 </ul> 113 123 </div> … … 120 130 <div class="block-vertical-toolbox"> 121 131 <a class="button add add-event" href="#">Adicionar evento</a> 132 <a class="button add add-task" href="#">Adicionar tarefa</a> 133 <a class="button add add-activity" href="#">Adicionar atividade</a> 122 134 <!--<a class="button add" href="#" onclick="add_events_list();">Lista de Eventos</a>--> 123 135 <div class="mini-calendar"></div> … … 131 143 <ul> 132 144 <li><a href="#calendar">Agenda</a></li> 133 <li><a href="#tab_events_list_" onclick="add_events_list();">Lista de Eventos</a></li> 145 <li><a href="#tab_events_list_" onclick="add_events_list(false, 0);">Lista de Eventos</a></li> 146 <li><a href="#tab_tasks_list_" onclick="add_events_list(false, 1);">Lista de Tarefas</a></li> 134 147 <!--<li><a href="#sandbox2">Sandbox</a></li>--> 135 148 </ul> 136 149 <div id="calendar"> </div> 137 150 <div id="tab_events_list_"> </div> 151 <div id="tab_tasks_list_"> </div> 138 152 <div id="sandbox2"> </div> 139 153 <div id="calendarShared"> </div> … … 147 161 </div> 148 162 </body> 149 150 163 </html> 151 -
branches/2.4/prototype/modules/calendar/templates/menu_context_event.ejs
r6286 r7228 40 40 <ul class="fg-menu ui-corner-all evt-option"> 41 41 <% for( var i = 0; i < data.calendars.length; i++ ){ %> 42 <li role="menuitem" class="calendar-list"><a href="#" onclick="copyAndMoveTo(<%=data.calendars[i].id %> ,<%= data.event%>, <%= data.idRecurrence%>);" class="ui-corner-all"><%=data.calendars[i].name %></a></li> 42 <li role="menuitem" class="calendar-list <%=(data.calendars[i].id == signature.calendar.id) ? 'calendar-already' : '' %>"> 43 <a href="#" onclick="copyAndMoveTo(<%=data.calendars[i].id %> ,<%= data.event%>, <%= data.idRecurrence%>);" class="ui-corner-all"><%=data.calendars[i].name %></a> 44 </li> 43 45 <% } %> 44 46 </ul> -
branches/2.4/prototype/modules/calendar/templates/participants_add_itemlist.ejs
r6203 r7228 2 2 <div style="overflow:hidden; width:100%; display:table;"> 3 3 <div class="attendee-options"> 4 <%if( !data[0].isD irty && (data[0].acl.organization || data[0].acl.write || data[0].acl.inviteGuests)){%>4 <%if( !data[0].isDelegate && (!data[0].isDirty && data[0].notEvent) || (!data[0].isDirty && data[0].acl && (data[0].acl.organization || data[0].acl.write || data[0].acl.inviteGuests))){%> 5 5 <a href="#" class="button delegate attendee-options-button-delegate new">Delegar participação a este participante</a> 6 6 <%}%> 7 <%if( data[0].acl.organization || data[0].acl.write){%>7 <%if(!data[0].noEvent && data[0].acl && (data[0].acl.organization || data[0].acl.write)){%> 8 8 <a class="button edit attendee-options-button-edit new">Editar permissões</a> 9 9 <%}%> … … 14 14 <input type="hidden" name="attendee[]" value="<%= data[0].id %>"> 15 15 <input type="hidden" name="attendeeType[]" value="<%=data[0].isExternal%>"> 16 <input type="hidden" name="attendeeAcl[]" value="r"> 16 <%if(!data[0].noEvent){%> 17 <input type="hidden" name="attendeeAcl[]" value="r"> 18 <%}%> 17 19 <input type="hidden" name="delegatedFrom[]" value="0"> 18 20 <label title="<%= data[0].name ? data[0].name : '' %>" class="name"><%= data[0].name ? data[0].name : '' %></label> … … 20 22 21 23 </div> 22 23 24 </li> -
branches/2.4/prototype/modules/calendar/templates/preferences_calendar.ejs
r7151 r7228 23 23 <label for="hourFormat">Formato de hora:</label> 24 24 <select name="hourFormat" > 25 <option value="HH:mm" <%= data.preferences.hourFormat =='HH:mm' ? 'selected="selected"':'' %>>24 horas</option> 26 <option value="hh:mm tt" <%= data.preferences.hourFormat =='hh:mm tt' ? 'selected="selected"':'' %>>12 horas (am/pm)</option> 25 <option value="HH:mm" <%= data.preferences.hourFormat =='HH:mm' ? 'selected="selected"':'' %>>24 horas</option> 26 <option value="hh:mm tt" <%= data.preferences.hourFormat =='hh:mm tt' ? 'selected="selected"':'' %>>12 horas (am/pm)</option> 27 27 </select> 28 28 </p> … … 68 68 <p class="input-group"> 69 69 <label for="defaultDuration">Duração de um compromisso (em minutos):</label> 70 <input name="defaultDuration" value="<%= data.preferences.defaultDuration%>" type="text" class="number inputNumber"/> 70 <input name="defaultDuration" value="<%= data.preferences.defaultDuration%>" type="text" class="number inputNumber"/> 71 </p> 72 73 <p class="input-group"> 74 <label for="defaultCalendar">Agenda padrão:</label> 75 <select name="defaultCalendar" > 76 <%for(var i = 0; i < data.calendars.length; i++){%> 77 <option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option> 78 <%}%> 79 </select> 71 80 </p> 72 81 73 82 <p class="input-group"> 74 <label for="defaultCalendar">Agenda padrão:</label> 75 <select name="defaultCalendar" > 76 <%for(var i = 0; i < data.calendars.length; i++){%> 77 <option value="<%=data.calendars[i].id%>"> <%= data.calendars[i].name %></option> 78 <%}%> 83 <label for="useDesktopNotification">Usar alarme desktop:</label> 84 <select name="useDesktopNotification" > 85 <option value="1" <%= data.preferences.useDesktopNotification == '1' ? 'selected="selected"' : '' %>>Sim</option> 86 <option value="0" <%= data.preferences.useDesktopNotification != '1' ? 'selected="selected"' : '' %>>Não</option> 79 87 </select> 80 88 </p> -
branches/2.4/prototype/modules/calendar/templates/shared_calendar.ejs
r7051 r7228 7 7 <dd class="calendar"> 8 8 <select class="calendar" name="calendar"> 9 <% 10 for(var i = 0; i < data.calendar.length; i++){ 11 if(data.signature[i].permission){ 12 if(data.signature[i].permission.acl.shared == false) 13 continue; 14 } 15 9 <% 10 for(var i = 0; i < data.calendar.length; i++){ 11 if(data.signature[i].permission){ 12 if(data.signature[i].permission.acl.shared == false) 13 continue; 14 } 15 %> 16 16 <option value="<%=data.calendar[i].id%>"><%=data.calendar[i].name%></option> 17 <% 18 } %> 17 18 <% 19 } %> 19 20 </select> 20 21 </dd> -
branches/2.4/prototype/modules/calendar/templates/timezone_list.ejs
r7069 r7228 1 1 <option value="">- None selected -</option> 2 2 3 <% 4 var timezones = DataLayer.dispatch('timezones'); 5 6 for (var zone in timezones.timezones){ 7 %> 8 9 <option value="<%= zone %>"> <%= zone %>(<%= timezones.timezones[zone] %>) </option> 10 3 <% 4 var timezones = DataLayer.dispatch('timezones'); 5 6 for (var zone in timezones.timezones){ 7 %> 8 9 <option value="<%= zone %>"> <%= zone %>(<%= timezones.timezones[zone] %>) </option> 10 11 11 <%}%> -
branches/2.4/prototype/modules/filters/edit-filter.ejs
r7094 r7228 86 86 <input type="checkbox" name="verifyNextRule" value="verifyNextRule" class="verifyNextRule"/> 87 87 <label><%= get_lang("Continue checking other rules if the criteria is met.")%></label> 88 </fieldset> 89 <fieldset> 90 <input type="checkbox" name="verifyNextRule" value="verifyNextRule" class="verifyNextRule"/> 91 <label><%= get_lang("Continue checking other rules if the criteria is met.")%></label> 88 92 </fieldset> 89 93 <fieldset class="fields-isexact"> -
branches/2.4/prototype/modules/filters/filters.js
r7094 r7228 217 217 .siblings( '[name="criteriaValue[]"]' ).val( filter.criteria[i].value ); 218 218 } 219 var first_fileinto_action = true; 219 var first_fileinto_action = true; 220 220 for( var i = 0; i < filter.actions.length; i++ ){ 221 221 if(filter.actions[i].type == "redirect") … … 223 223 if(filter.actions[i].type == "reject") 224 224 actions.siblings('[name="messageReject"]').val(filter.actions[i].parameter); 225 if((filter.actions[i].type == "fileinto" && first_fileinto_action) || filter.actions[i].type == "setflag"){ 225 if((filter.actions[i].type == "fileinto" && first_fileinto_action) || filter.actions[i].type == "setflag"){ 226 226 actions.parent().find('[value="'+filter.actions[i].parameter+'"]').attr("selected", "selected"); 227 if(filter.actions[i].type == "fileinto") 228 first_fileinto_action =false; 229 } 230 /*A condição abaixo é executada quando uma segunda action do tipo "fileinto" for encontrada*/ 231 if(filter.actions[i].type == "fileinto" && !first_fileinto_action){ 232 $('.fileintoInbox').attr('checked', 'True'); 233 continue; 234 } 235 /*O comando "continue" da condição acima faz com que estas linhas restantes sejam ignoradas*/ 236 actions.filter( '[value="' + filter.actions[i].type + '"]' ).attr("checked", "True"); 237 actions.filter( '[value="' + filter.actions[i].type + '"]' ).val( filter.actions[i].type ) 238 .siblings( '[name="actionParameter[]"]' ).val( filter.actions[i].parameter ); 239 } 227 if(filter.actions[i].type == "fileinto") 228 first_fileinto_action =false; 229 } 230 /*A condição abaixo é executada quando uma segunda action do tipo "fileinto" for encontrada*/ 231 if(filter.actions[i].type == "fileinto" && !first_fileinto_action){ 232 $('.fileintoInbox').attr('checked', 'True'); 233 continue; 234 } 235 /*O comando "continue" da condição acima faz com que estas linhas restantes sejam ignoradas*/ 236 actions.filter( '[value="' + filter.actions[i].type + '"]' ).attr("checked", "True"); 237 actions.filter( '[value="' + filter.actions[i].type + '"]' ).val( filter.actions[i].type ) 238 .siblings( '[name="actionParameter[]"]' ).val( filter.actions[i].parameter ); 239 } 240 240 isExact.filter('[value="'+(filter.isExact != "false"? "and" : "or")+'"]').attr("checked", "True"); 241 241 242 242 if (filter.alertMessage == 'true') $('.alertMessage').attr('checked', 'True'); 243 243 if (filter.verifyNextRule == 'true') $('.verifyNextRule').attr('checked', 'True'); -
branches/2.4/prototype/modules/filters/interceptors/FilterMapping.php
r6836 r7228 122 122 $action = $data['actions']; 123 123 124 ($i >0 && $verifyNextRule == 'false') ? $script_match = 'els' : $script_match = ''; 124 ($i >0 && $verifyNextRule == 'false') ? $script_match = 'els' : $script_match = ''; 125 125 $data['isExact'] == 'false' ? $script_match .= 'if anyof (' : $script_match .= 'if allof ('; 126 126 127 127 $verifyNextRule = 'false'; 128 128 129 129 if( is_array($criteria) ) 130 130 foreach ($criteria as $j => $value) 131 131 { 132 if ($criteria[$j]['operator'] == '!*') $script_criteria .= "not "; 133 134 switch(strtoupper($criteria[$j]['field'])) { 135 case 'TO':132 if ($criteria[$j]['operator'] == '!*') $script_criteria .= "not "; 133 134 switch(strtoupper($criteria[$j]['field'])) { 135 case 'TO': 136 136 case 'CC': 137 137 $criteria[$j]['field'] = "[\"To\", \"TO\", \"Cc\", \"CC\"]"; … … 252 252 $require_vacation = true; 253 253 $action[$k]['parameter'] = "\"" . $action[$k]['parameter'] . "\""; 254 $vacation_action = ' :subject "Fora do Escritó rio" ' . $action[$k]['parameter'] . ";";254 $vacation_action = ' :subject "Fora do Escritório" ' . $action[$k]['parameter'] . ";"; 255 255 $vacation = true; 256 256 continue; … … 274 274 $script_criteria = ""; 275 275 $script_action = ""; 276 $data['applyMessages'] = ""; 277 278 $verifyNextRule = $data['verifyNextRule'];276 $data['applyMessages'] = ""; 277 278 $verifyNextRule = $data['verifyNextRule']; 279 279 } 280 280 … … 304 304 $script_begin = "#Filtro gerado por Expresso Livre\r\n\r\n"; 305 305 $content = $script_begin . $script_header . $script_rules . "\r\n\r\n#PseudoScript#" . "\r\n#" . $json_data; 306 306 307 307 return( $content ); 308 308 } -
branches/2.4/prototype/modules/mail/css/followupflag.css
r6754 r7228 231 231 .content-alarm ul { 232 232 max-height: 100px; 233 overflow: auto;233 overflow: hidden; 234 234 } 235 235 .content-alarm { -
branches/2.4/prototype/modules/mail/js/foldertree.js
r7021 r7228 116 116 cp_tree1 = tree1; 117 117 cp_tree2 = tree2; 118 var shared_acls = {}; 119 120 $.each(cp_tree2, function(index, value){ 121 shared_acls[value.id] = value.acl_share; 122 }); 123 118 124 $("#content_folders").removeClass("menu-degrade").parent().removeClass("image-menu"); 119 125 var html = DataLayer.render('../prototype/modules/mail/templates/detailedfoldertree.ejs', {folders: [tree1, tree2, tree3]}); … … 166 172 }).end().end(); 167 173 168 folders_html.find('[id="'+selected+'"]').children().addClass("selected").end().end().find("li:first").find(".folder").not(".head_folder,.inbox,.drafts,.sent,.spam,.trash").draggable({ 174 folders_html.find('[id="'+selected+'"]').children().addClass("selected"); 175 $(".folder").not(".head_folder").not(".shared-folders").parent().find(".folder").not(".head_folder,.inbox,.drafts,.sent,.spam,.trash").draggable({ 169 176 // DRAG DE PASTAS 170 177 start : function(){ … … 280 287 url : "controller.php?"+ $.param( { action: "$this.imap_functions.move_folder", folder_to_move: folder_to_move, folder_to: folder_to } ), 281 288 success : function(data){ 289 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 282 290 data = connector.unserialize(data); 283 if(data){ 284 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 291 if(data == "Permission denied"){ 292 write_msg(get_lang("Permission denied")); 293 }else if(data){ 285 294 write_msg(get_lang("The folder was successfully moved")); 286 295 } … … 292 301 } 293 302 } 294 }).hover( 303 }); 304 $(".folder").not(".shared-folders").parent().find(".folder").hover( 295 305 function(){ 296 306 //CASO A LI NÃO TENHA UM eventNU FLUTUANTE AINDA, O eventNU É ADICIONADO! … … 298 308 var folder_ = $(this); 299 309 var folder_name; 310 var shared = { 311 head : false, 312 valid : false 313 }; 300 314 if(folder_.parent().attr('id')){ 301 315 folder_name = folder_.parent().attr('id').split(cyrus_delimiter); 302 316 folder_name = folder_name[folder_name.length -1]; 317 shared.valid = folder_.parent().attr('id').search("user/") == 0 ? true : false; 303 318 }else 304 319 folder_name = "Root"; 305 html = DataLayer.render("../prototype/modules/mail/templates/float_folder_menu.ejs", {name_folder : folder_name}); 320 321 if(shared.valid){ 322 shared.head = folder_.parent().attr('id').split(cyrus_delimiter).length == 2 ? true : false; 323 var folder_name_parts = folder_.parent().attr('id').split(cyrus_delimiter); 324 var acls = shared_acls[folder_name_parts[0]+cyrus_delimiter+folder_name_parts[1]]; 325 326 } 327 328 html = DataLayer.render("../prototype/modules/mail/templates/float_folder_menu.ejs", {name_folder : folder_name, flag : shared, acl : acls}); 306 329 //FUNÇÃO DO eventNU FLUTUANTE EDITAR < BEGIN 307 330 var esc = false; … … 334 357 type : "POST", 335 358 data : "current="+folder_id+"&rename="+new_name, 336 success : function(){ 359 success : function(data){ 360 data = connector.unserialize(data); 361 if(data == "Permission denied"){ 362 $(".folders-loading").removeClass("folders-loading"); 363 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 364 return write_msg(get_lang("Permission denied")); 365 } 337 366 write_msg(get_lang("The folder was successfully rename")); 338 367 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 339 368 } 340 369 }); 341 }else{ 342 $(".new_folder").focusout(); 370 }else{ 371 $(".new_folder").focusout(); 343 372 } 344 373 }else if( event.keyCode == 27){ … … 385 414 $(".folders-loading").removeClass("folders-loading"); 386 415 return write_msg(get_lang("Mailbox does not exist")); 416 }else if(data == "Permission denied"){ 417 $(".folders-loading").removeClass("folders-loading"); 418 cExecute("$this.imap_functions.get_folders_list&onload=true", update_menu); 419 return write_msg(get_lang("Permission denied")); 387 420 } 388 421 write_msg(get_lang("The folder %1 was successfully removed", folder_name)); … … 449 482 draw_new_tree_folder(); 450 483 }); 484 }).end().find(".float-menu-export").click(function(){ 485 //proxy_mensagens.export_all_messages($(this).parents("li:first").attr("id")) 486 487 var name_box = $(this).parents("li:first").attr("id"); 488 var name_folder = name_box.split(cyrus_delimiter)[name_box.split(cyrus_delimiter).length-1]; 489 490 var hand_export = function(data){ 491 if(!data){ 492 write_msg(get_lang('Error compressing messages (ZIP). Contact the administrator.')) 493 }else if(data["empty_folder"]){ 494 write_msg(get_lang("The selected folder is empty.")); 495 }else 496 download_attachments(null, null, data, null,null, name_folder +'.zip'); 497 } 498 cExecute("$this.exporteml.export_all",hand_export,"folder="+name_box); 499 write_msg(get_lang('You must wait while the messages will be exported...')); 451 500 }); 452 501 //FUNÇÃO DO eventNU FLUTUANTE NOVA PASTA < END -
branches/2.4/prototype/modules/mail/js/followupflag.js
r7027 r7228 178 178 * #END: Implementação do widget de input-combobox 179 179 */ 180 winElement.find('input[name="alarmDate"]').change(function(event){ 181 winElement.find('input[name="alarmTime"]').attr('disabled', ( $(this).val() == "" ? 'disabled' : false)); 182 }); 183 184 winElement.find('input[name="alarmDate"]').keyup(function(event){ 185 winElement.find('input[name="alarmTime"]').attr('disabled', ( $(this).val() == "" ? 'disabled' : false)).val(''); 186 }); 180 187 181 188 winElement.find('.button').button() … … 217 224 messageNumber : messageNumber, 218 225 isDone: isDone, 226 isSent: 0, 219 227 backgroundColor : backgroundColor 220 228 }, !!idFollowupflagged[i] ? {id: idFollowupflagged[i]} : {}); … … 271 279 272 280 } 281 selectAllFolderMsgs(false); 273 282 } 274 283 var backgroundColor = winElement.find('[name="backgroundColor"]').val(); … … 344 353 alarmFollowupflagged('followupflagAlarms'); 345 354 }); 346 355 selectAllFolderMsgs(false); 347 356 }); 348 357 … … 414 423 winElement.find('[name="alarm"]').click(function(){ 415 424 if($(this).is(":checked")){ 416 winElement.find('[name="alarmDate"] ,[name="alarmTime"]').removeAttr("disabled");425 winElement.find('[name="alarmDate"]').removeAttr("disabled"); 417 426 }else{ 418 winElement.find('[name="alarmDate"],[name="alarmTime"]').attr("disabled","disabled") ;427 winElement.find('[name="alarmDate"],[name="alarmTime"]').attr("disabled","disabled").val(''); 419 428 } 420 429 }); 430 421 431 if(winElement.find('[name="alarm"]').is(":checked")){ 422 432 winElement.find('[name="alarmDate"],[name="alarmTime"]').removeAttr("disabled"); 423 433 } 434 424 435 winElement.find('[name="done"]').click(function(){ 425 436 if($(this).is(":checked")){ … … 492 503 */ 493 504 function alarmFollowupflagged(alert_type, filter_list){ 505 var currentDate = new Date().toString("dd/MM/yyyy"); 506 var data = {alarmDeadline: false, doneDeadline: false, filtersAlarms: false}; 507 494 508 switch(alert_type){ 495 // carregar modais de sinalizadores496 509 case 'followupflagAlarms': 497 510 $('.doneDeadline').remove(); 498 511 $('.alarmDeadline').remove(); 499 var toIterate = [ 500 { 501 attrDeadline: 'doneDeadline', 502 caption: {singular:'You have one undone message today:', 503 plural:"You have %1 undone messages today:" 504 }, 505 title: get_lang('Done'), 506 enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy")) 507 }, 508 { 509 attrDeadline: 'alarmDeadline', 510 caption: { 511 singular:'You have a follow up due for today:', 512 plural:'You have %1 follow ups due for today:' 513 }, 514 title: get_lang('Follow ups'), 515 enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")) 516 } 517 ]; 518 break; 519 // carregar modal de filtros 512 data.alarmDeadline = $.cookie("fadeAlarm") != currentDate ? true : false; 513 data.doneDeadline = $.cookie("fadeCompleted") != currentDate ? true : false; 514 break; 520 515 case 'filtersAlarms': 521 516 $('.filtersDeadline').remove(); 522 var toIterate = [ 523 { 524 attrDeadline: 'filtersDeadline', 525 caption: { 526 singular:'You have an archived message:', 527 plural:'You have %1 messages archived:' 528 }, 529 title: get_lang('Filter by sender'), 530 enable: ($.cookie("fadeFilterAlarm") != (new Date).toString("dd/MM/yyyy")) 531 } 532 ]; 533 break; 534 // carregar todas as modais 517 data.filtersAlarms = $.cookie("fadeFilterAlarm") != currentDate ? true : false; 518 break; 535 519 default: 536 520 $('.gray').remove(); 537 var toIterate = [ 538 { 539 attrDeadline: 'filtersDeadline', 540 caption: { 541 singular:'You have an archived message:', 542 plural:'You have %1 messages archived:' 543 }, 544 title: get_lang('Filter by sender'), 545 enable: ($.cookie("fadeFilterAlarm") != (new Date).toString("dd/MM/yyyy")) 546 }, 547 { 548 attrDeadline: 'doneDeadline', 549 caption: {singular:'You have one undone message today:', 550 plural:"You have %1 undone messages today:" 551 }, 552 title: get_lang('Done'), 553 enable: ($.cookie("fadeCompleted") != (new Date).toString("dd/MM/yyyy")) 554 }, 555 { 556 attrDeadline: 'alarmDeadline', 557 caption: { 558 singular:'You have a follow up due for today:', 559 plural:'You have %1 follow ups due for today:' 560 }, 561 title: get_lang('Follow ups'), 562 enable: ($.cookie("fadeAlarm") != (new Date).toString("dd/MM/yyyy")) 521 data.alarmDeadline = $.cookie("fadeAlarm") != currentDate ? true : false; 522 data.doneDeadline = $.cookie("fadeCompleted") != currentDate ? true : false; 523 data.filtersAlarms = $.cookie("fadeFilterAlarm") != currentDate ? true : false; 524 break; 525 }; 526 527 var startDate = (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00'); 528 var endDate = (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00'); 529 530 if(data.alarmDeadline){ 531 var decodeAlarms = {'sent': [], 'task':[]}; 532 alarms = DataLayer.get('followupflagged', 533 { 534 filter: ['AND', ['<', 'alarmDeadline', endDate], ['=','isSent','0'], ['=','isDone','0']], 535 criteria: {deepness: 1} 536 }); 537 538 if(alarms.length > 0){ 539 var itens = []; 540 for(var i = 0; i < alarms.length; i++){ 541 542 var date = Date.parseExact(alarms[i]['alarmDeadline'], 'yyyy-MM-dd HH:mm:ss'); 543 alarms[i]['alarmDeadline'] = date.toString('dd/MM HH:mm'); 544 545 var nameFollowupflag = alarms[i]['followupflag']['id'] < 7 ? get_lang(alarms[i]['followupflag']['name']) : alarms[i]['followupflag']['name']; 546 var li_alarm = alarms[i]['alarmDeadline'] + ' - ' + nameFollowupflag + ' - ' + alarms[i]['message']['headers']['subject']; 547 548 if(alarms[i]['doneDeadline'] != ''){ 549 var dateDone = Date.parseExact(alarms[i]['doneDeadline'], 'yyyy-MM-dd HH:mm:ss'); 550 if(dateDone.getTime() < $.now()) 551 continue; 563 552 } 564 ]; 565 break; 566 } 567 var i = 0; 568 // recupera e monta os dados para serem exibidos nas modais de alarmes 569 while (it = toIterate.pop()){ 570 if (!it.enable) continue; 571 572 var alarmInRange = {}; 573 // caso for alarme de sinalizadores 574 if(it.attrDeadline == 'doneDeadline' || it.attrDeadline == 'alarmDeadline'){ 575 alarmInRange = DataLayer.get('followupflagged', {filter: ['AND', ['>', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).toString('yyyy-MM-dd 00:00:00')], ['<', it.attrDeadline, (new Date()).set({hour:0, minute:0, second:0}).addHours(24).toString('yyyy-MM-dd 00:00:00')]], criteria: {deepness: 1}}); 576 if(alarmInRange.length > 0){ 577 for(var i=0; i<alarmInRange.length; i++){ 578 if(alarmInRange[i].isDone == 1){ 579 alarmInRange.splice(i,1); 580 i--; 581 } 553 554 if(date.getTime() <= $.now()) 555 decodeAlarms.sent.push({ 556 "msg_number" : alarms[i]['messageNumber'], 557 "msg_folder" : alarms[i]['folderName'], 558 "a" : truncate(li_alarm, 34), 559 'id' : alarms[i].id 560 }); 561 else 562 decodeAlarms.task.push({ 563 a: truncate(li_alarm, 34), 564 sentTime: date.getTime() / 1000, 565 id: alarms[i].id, 566 'msg_folder': alarms[i].folderName, 567 'msg_number': alarms[i].messageNumber 568 }); 569 } 570 571 if(decodeAlarms.task.length) 572 alarmDeadline.load(decodeAlarms.task); 573 574 if(decodeAlarms.sent.length) 575 data.alarmDeadline = { 576 alarms: decodeAlarms.sent, 577 title: get_lang('Follow ups'), 578 caption: (itens.length == 1) ? get_lang('You have one undone message today:') : get_lang('You have %1 follow ups due for today:', decodeAlarms.sent.length), 579 type: 'alarmDeadline' 580 }; 581 else 582 data.alarmDeadline = false; 583 }else 584 data.alarmDeadline = false; 585 } 586 587 if(data.doneDeadline){ 588 alarms = DataLayer.get('followupflagged', {filter: ['AND', ['>', 'doneDeadline', startDate], ['<', 'doneDeadline', endDate]], criteria: {deepness: 1}}); 589 590 if(alarms.length > 0){ 591 var itens = []; 592 for(var i = 0; i < alarms.length; i++){ 593 594 var date = Date.parseExact(alarms[i]['doneDeadline'], 'yyyy-MM-dd HH:mm:ss'); 595 alarms[i]['doneDeadline'] = date.toString('dd/MM HH:mm'); 596 597 var nameFollowupflag = alarms[i]['followupflag']['id'] < 7 ? get_lang(alarms[i]['followupflag']['name']) : alarms[i]['followupflag']['name']; 598 var li_alarm = alarms[i]['doneDeadline'] + ' - ' + nameFollowupflag + ' - ' + truncate(alarms[i]['message']['headers']['subject'], 15); 599 600 itens.push({ 601 a: truncate(li_alarm, 34), 602 id: alarms[i].id, 603 'msg_folder': alarms[i].folderName, 604 'msg_number': alarms[i].messageNumber 605 }); 606 } 607 data.doneDeadline = { 608 alarms: itens, 609 title: get_lang('Done'), 610 caption: (itens.length == 1) ? get_lang('You have one undone message today:') : get_lang('You have %1 follow ups due for today:', itens.length), 611 type: 'doneDeadline' 612 }; 613 }else 614 data.doneDeadline = false; 615 } 616 617 if(data.filtersAlarms){ 618 619 alarms = filter_list; 620 621 if(alarms.length > 0){ 622 var itens = []; 623 624 for(var i=0; i<alarms.length; i++){ 625 alarms[i]['udate'] = new Date(alarms[i]['udate']*1000).toString('dd/MM HH:mm'); 626 var li_alarm = alarms[i]['udate'] + ' - ' + alarms[i]['from'] + ' - ' + alarms[i]['subject']; 627 628 itens.push({ 629 'msg_number' : alarms[i]['msg_number'], 630 'msg_folder' : alarms[i]['msg_folder'], 631 a : truncate(html_entities(li_alarm), 34), 632 id : alarms[i].id 633 }); 634 } 635 636 data.filtersAlarms = { 637 alarms: itens, 638 title: get_lang('Filter by sender'), 639 caption: (itens.length == 1) ? get_lang('You have an archived message:') : get_lang('You have %1 messages archived:', itens.length), 640 type: 'filtersDeadline', 641 captions: { 642 singular:'You have one undone message today:', 643 plural:"You have %1 undone messages today:" 582 644 } 583 }584 585 if(alarmInRange.length > 0){586 var messages_alarm = [];587 for(var i=0; i<alarmInRange.length; i++){588 var date = Date.parseExact(alarmInRange[i][it.attrDeadline], 'yyyy-MM-dd HH:mm:ss');589 if(date)590 alarmInRange[i][it.attrDeadline] = date.toString('HH:mm');591 592 if(alarmInRange[i]['followupflag']['id'] < 7){593 var nameFollowupflag = get_lang(alarmInRange[i]['followupflag']['name']);594 }else{595 var nameFollowupflag = alarmInRange[i]['followupflag']['name'];596 }597 var li_alarm = alarmInRange[i][it.attrDeadline] + ' - ' + nameFollowupflag + ' - ' + truncate(alarmInRange[i]['message']['headers']['subject'], 15);598 messages_alarm.push({599 "msg_number" : alarmInRange[i]['messageNumber'],600 "msg_folder" : alarmInRange[i]['folderName'],601 "a" : li_alarm602 });603 }604 }605 }606 // caso for alarme de filtros607 else if(filter_list){608 alarmInRange = filter_list;609 if(alarmInRange.length > 0){610 var messages_alarm = [];611 for(var i=0; i<alarmInRange.length; i++){612 613 alarmInRange[i]['udate'] = new Date(alarmInRange[i]['udate']*1000).toString('dd/MM/yyyy HH:mm');614 615 var li_alarm = alarmInRange[i]['udate'] + ' - ' + alarmInRange[i]['from'] + ' - ' + truncate(alarmInRange[i]['subject'], 15);616 messages_alarm.push({617 "msg_number" : alarmInRange[i]['msg_number'],618 "msg_folder" : alarmInRange[i]['msg_folder'],619 "a" : li_alarm620 });621 }622 }623 }624 625 if(alarmInRange.length > 0){626 // monta o subtitulo da modal627 var caption = (alarmInRange.length == 1) ?628 get_lang(it.caption.singular):629 get_lang(it.caption.plural, alarmInRange.length);630 // monta o array de dados a ser passado para o template631 var data = {632 alarmInRange : messages_alarm,633 caption: caption,634 type: it.attrDeadline,635 captions: it.caption636 645 }; 637 // tipo de modal a ser exibida 638 var type_alarm = it.attrDeadline; 639 //função chamada ao clicar no botão Ok da modal 640 var ok_function = function(event, type, type_cookie){ 641 if($(event.target).parents('.'+type).find('[name="stopAlert"]').is(':checked')){ 642 $.cookie(type_cookie, (new Date).toString("dd/MM/yyyy"), { 643 expires: 1 644 }); 645 } 646 } 647 // carrega o template dos alarmes e cria a modal utilizando o plugin freeow 648 var dialogText = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", data); 649 var titulo = '<div class="header-alarm"><span class="img_title"></span><span class="title-alarm"><strong>'+it.title+'</strong></span><span name="header-icon" class="maximize-alarm"></span></div>'; 650 $("#freeow").freeow(titulo, dialogText, { 651 classes: ["gray", type_alarm], 652 autoHide: false, 653 startStyle: null, 654 onClick: function(event){ 655 var type = ''; 656 var type_cookie = ''; 657 if($(this).hasClass('alarmDeadline')){ 658 type = 'alarmDeadline'; 659 type_cookie = 'fadeAlarm'; 660 }else if($(this).hasClass('doneDeadline')){ 661 type = 'doneDeadline'; 662 type_cookie = 'fadeCompleted'; 663 }else if($(this).hasClass('filtersDeadline')){ 664 type = 'filtersDeadline'; 665 type_cookie = 'fadeFilterAlarm'; 666 } 667 if($(event.target).hasClass('stop-alert-alarm')){ 668 return; 669 } 670 if($(event.target).hasClass('minimize-alarm')){ 671 $('.'+type).find('.content-alarm').hide(); 672 $(event.target).removeClass('minimize-alarm').addClass('maximize-alarm'); 673 return; 674 } 675 if($(event.target).hasClass('maximize-alarm')){ 676 $('.'+type).find('.content-alarm').show(); 677 $(event.target).removeClass('maximize-alarm').addClass('minimize-alarm'); 678 return; 679 } 680 if($(( !!$.browser.safari ) ? event.target.parentElement : event.target).hasClass('confirm-alarm')){ 681 ok_function(event, type, type_cookie); 682 $('.'+type).remove(); 683 return; 684 } 685 return false; 686 } 687 }); 688 // elementos do freeow desnecessários 689 $('.gray .background .content p').remove(); 690 $('.gray .icon').remove(); 691 $('.gray .close').remove(); 692 693 // botão ok da modal com jquery button 694 $('.content-alarm button').button(); 695 } 696 } 697 646 647 }else 648 data.filtersAlarms = false; 649 } 650 651 for (var i in data) 652 if(data[i] != false) 653 showAlarmsModal(data[i]); 654 698 655 // controle de qual janela de alarme estará maximizada 699 656 $('.gray').find('.content-alarm').hide(); … … 712 669 } 713 670 } 714 671 } 672 673 function showAlarmsModal(alarm){ 674 675 var ok_function = function(event, type, type_cookie){ 676 if($(event.target).parents('.'+type).find('[name="stopAlert"]').is(':checked')){ 677 $.cookie(type_cookie, (new Date).toString("dd/MM/yyyy"), { 678 expires: 1 679 }); 680 } 681 } 682 683 // carrega o template dos alarmes e cria a modal utilizando o plugin freeow 684 var dialogText = DataLayer.render("../prototype/modules/mail/templates/followupflag_alarm_list.ejs", alarm); 685 var titulo = '<div class="header-alarm"><span class="img_title"></span><span class="title-alarm"><strong>'+alarm.title+'</strong></span><span name="header-icon" class="maximize-alarm"></span></div>'; 686 687 $("#freeow").freeow(titulo, dialogText, { 688 classes: ["gray", alarm.type], 689 autoHide: false, 690 startStyle: null, 691 onClick: function(event){ 692 var type = ''; 693 var type_cookie = ''; 694 if($(this).hasClass('alarmDeadline')){ 695 type = 'alarmDeadline'; 696 type_cookie = 'fadeAlarm'; 697 }else if($(this).hasClass('doneDeadline')){ 698 type = 'doneDeadline'; 699 type_cookie = 'fadeCompleted'; 700 }else if($(this).hasClass('filtersDeadline')){ 701 type = 'filtersDeadline'; 702 type_cookie = 'fadeFilterAlarm'; 703 } 704 if($(event.target).hasClass('stop-alert-alarm')){ 705 return; 706 } 707 if($(event.target).hasClass('minimize-alarm')){ 708 $('.'+type).find('.content-alarm').hide(); 709 $(event.target).removeClass('minimize-alarm').addClass('maximize-alarm'); 710 return; 711 } 712 if($(event.target).hasClass('maximize-alarm')){ 713 $('.'+type).find('.content-alarm').show(); 714 $(event.target).removeClass('maximize-alarm').addClass('minimize-alarm'); 715 return; 716 } 717 if($(( !!$.browser.safari ) ? event.target.parentElement : event.target).hasClass('confirm-alarm')){ 718 ok_function(event, type, type_cookie); 719 $('.'+type).remove(); 720 return; 721 } 722 return false; 723 } 724 }); 725 // elementos do freeow desnecessários 726 $('.gray .background .content p').remove(); 727 $('.gray .icon').remove(); 728 $('.gray .close').remove(); 729 730 $('div.gray.alarmDeadline .button.delete').button({ 731 text: false, 732 icons:{ 733 primary: 'ui-icon-close' 734 } 735 }) 736 737 // botão ok da modal com jquery button 738 $('.content-alarm button').button(); 739 } 740 741 function cancelAlarm(element, idAlarm, messageNumber, folderName){ 742 743 $(element).parents('li').remove(); 744 745 var view = 'div.gray.alarmDeadline'; 746 var length = $(view).find('ul.message-list li').length; 747 748 if(length > 0){ 749 var msg = ''; 750 if(length == 1) 751 msg = get_lang( 'You have a follow up due for today:'); 752 else 753 msg = get_lang('You have %1 follow ups due for today:', length); 754 755 $(view).find('span.subtitle-alarm strong').html(msg); 756 }else 757 $(view).remove(); 758 759 DataLayer.put('followupflagged', 760 { 761 id: idAlarm , 762 isSent: '1', 763 folderName: folderName, 764 messageNumber: messageNumber, 765 uid: User.me.uid 766 }); 767 768 DataLayer.commit(); 769 770 } 771 772 alarmDeadline = { 773 774 775 load: function(alarm){ 776 var currentDate = new Date().toString("dd/MM/yyyy") 777 if($.cookie("fadeAlarm") != currentDate) 778 for(var i = 0; i < alarm.length; i++) 779 this.addAlarm( alarm[i] ); 780 }, 781 782 addAlarm: function(alarm){ 783 784 DataLayer.task( parseInt(alarm['sentTime']) , function( timestamp ){ 785 var view = 'div.gray.alarmDeadline'; 786 787 if(!$(view+' li.message-item.'+alarm.id).length){ 788 789 var currentDate = new Date().toString("dd/MM/yyyy") 790 if($.cookie("fadeAlarm") != currentDate) 791 792 if($('div.gray.alarmDeadline').length){ 793 794 $(view).find('ul.message-list').append(DataLayer.render("../prototype/modules/mail/templates/followupflag_alarmDeadline_add_item_list.ejs", alarm)) 795 796 var length = $(view).find('ul.message-list li').length; 797 var msg = ''; 798 if(length == 1) 799 msg = get_lang( 'You have a follow up due for today:'); 800 else 801 msg = get_lang('You have %1 follow ups due for today:', length); 802 803 $(view).find('span.subtitle-alarm strong').html(msg); 804 805 $(view+' .button.delete').button({ 806 text: false, 807 icons:{ 808 primary: 'ui-icon-close' 809 } 810 }); 811 812 }else{ 813 var item = { 814 alarms: [alarm], 815 title: get_lang('Follow ups'), 816 caption: get_lang('You have one undone message today:'), 817 type: 'alarmDeadline' 818 }; 819 showAlarmsModal(item); 820 } 821 } 822 823 }); 824 } 825 715 826 } 716 827 -
branches/2.4/prototype/modules/mail/templates/attachment.ejs
r6214 r7228 1 <div id="fileupload_msg<%=data.ID%>" class="fileupload" style="margin : 15px 0px -15px -10px; ">1 <div id="fileupload_msg<%=data.ID%>" class="fileupload" style="margin : 15px 0px -15px -10px; padding-bottom : 5px;"> 2 2 <div class="row fileupload-buttonbar"> 3 3 <div class="button-files-upload"> … … 13 13 <br /> 14 14 <div class="files-list" style="margin: 5px; padding: 5px;"> 15 < ul class="attachments-list"></ul>15 <div class="attachments-list ui-corner-all" style="display:none;"></div> 16 16 </div> 17 17 </div> 18 <div id="fileupload_msg<%=data.ID%>_droopzone" style="display:none;" class="fileupload_msg_tooltip"> 19 Solte aqui seus anexos 20 </div> -
branches/2.4/prototype/modules/mail/templates/attachment_add_itemlist.ejs
r6124 r7228 1 <li style="list-style : none;"> 2 <p class="input-group archive-info" style="margin: 0px 0 !important; height: 17px"> 3 <span title="<%=data.file.fullFileName%>" class="archive-attach name"><%=data.file.fileName%></span> 4 <span class="archive-attach size"><%=data.file.fileSize%></span> 5 <button type="button" style="margin-bottom: -4px; <%= is_webkit || is_ie ? '' : 'top : 7px;'%>" class="button close tiny upload delete-upload" title="Deletar">Deletar</button> 6 <span class="status-upload"></span> 7 <%if(data.file.error){%> 8 <span class="archive-error error"><%=data.file.error%></span> 9 <%}if(!data.file.error){%> 10 <span style="width: 110px; height: 14px; overflow:hidden"> 11 <span class="in-progress"> <img src="../prototype/modules/mail/img/loader.gif" /></span> 12 </span> 13 <%}%> 14 <label class="fileinput-button new"></label> 15 </p> 16 </li> 1 <div class="att-box ui-corner-all <%= (typeof(data.file.error) != 'boolean' ? 'invalid-email-box' : '') %>"> 2 <!--<div style="position:absolute; text-align: center; line-height: 1.9em;">--> 3 <span class="att-box-value"><%=data.file.fileName%> <b>(<%=data.file.fileSize%>)</b></span> 4 <span class="att-box-fullfilename" style="display:none;"><%=data.file.fullFileName%></span> 5 <span class="att-box-filesize" style="display:none;"><%=data.file.fileSize%></span> 6 <% if(typeof(data.file.error) == 'boolean'){ %> 7 <span class="att-box-loading"> </span> 8 <% } %> 9 <span class="att-box-delete ui-icon-close ui-icon" style="display: inline-block;" title="<%=get_lang('Remove')%>"> </span> 10 <!--</div>--> 11 </div> -
branches/2.4/prototype/modules/mail/templates/float_folder_menu.ejs
r5948 r7228 12 12 13 13 <span class="float-menu"> 14 <span class="ui-icon ui-icon-document float-menu-new floating-default" title="Nova Pasta"></span> 15 <%if(!specialFolders[data.name_folder]){ %> 16 <span class="ui-icon ui-icon-pencil float-menu-edit floating-default" title="Editar Pasta"></span> 17 <span class="ui-icon ui-icon-close float-menu-remove floating-default" title="Excluir Pasta"></span> 18 <%} 19 else if(data.name_folder == trashfolder){%> 20 <span class="ui-icon ui-icon-trash float-menu-clean floating-default" onclick="empty_trash_imap();" title="Limpar Pasta"></span> 21 <%} 22 else if(data.name_folder == spamfolder){%> 23 <span class="ui-icon ui-icon-trash float-menu-clean floating-default" onclick="empty_spam_imap();" title="Limpar Pasta"></span> 14 <%if(!data.flag.valid){ %> 15 <%if(data.name_folder != 'INBOX'){%> 16 <span class="ui-icon ui-icon-document float-menu-new floating-default" title="<%=get_lang("New Folder")%>"></span> 17 <%}%> 18 <%if(!specialFolders[data.name_folder]){ %> 19 <span class="ui-icon ui-icon-pencil float-menu-edit floating-default" title="<%=get_lang("Edit folder")%>"></span> 20 <span class="ui-icon ui-icon-close float-menu-remove floating-default" title="<%=get_lang("Delete folder")%>"></span> 21 <%} 22 else if(data.name_folder == trashfolder){%> 23 <span class="ui-icon ui-icon-trash float-menu-clean floating-default" onclick="empty_trash_imap();" title="<%=get_lang("Empty Trash")%>"></span> 24 <%} 25 else if(data.name_folder == spamfolder){%> 26 <span class="ui-icon ui-icon-trash float-menu-clean floating-default" onclick="empty_spam_imap();" title="<%=get_lang("Empty Spam")%>"></span> 27 28 <%}%> 29 30 <%}else{ %> 31 <% if(parseInt(data.acl.create)){%> 32 <span class="ui-icon ui-icon-document float-menu-new floating-default" title="<%=get_lang("New Folder")%>"></span> 33 <% if(parseInt(data.acl.delete) && parseInt(data.acl.rename) && !specialFolders[data.name_folder] && !data.flag.head){ %> 34 <span class="ui-icon ui-icon-pencil float-menu-edit floating-default" title="<%=get_lang("Edit folder")%>"></span> 35 <% } %> 36 37 <% } %> 38 <% if(parseInt(data.acl.delete) && !specialFolders[data.name_folder] && !data.flag.head){ %> 39 <span class="ui-icon ui-icon-close float-menu-remove floating-default" title="<%=get_lang("Delete folder")%>"></span> 40 <%}%> 41 <%if(data.name_folder == trashfolder && parseInt(data.acl.delete)){%> 42 <span class="ui-icon ui-icon-trash float-menu-clean floating-default" onclick="empty_trash_imap(true, $(this));" title="<%=get_lang("Empty Trash")%>"></span> 43 <%}else if(data.name_folder == spamfolder && parseInt(data.acl.delete)){%> 44 <span class="ui-icon ui-icon-trash float-menu-clean floating-default" onclick="empty_spam_imap(true, $(this));" title="<%=get_lang("Empty Spam")%>"></span> 45 <%}%> 24 46 <%}%> 25 47 <span class="ui-icon ui-icon-arrowthickstop-1-n float-menu-export floating-default" title="<%=get_lang("Export folder messages")%>"></span> 26 48 </span> -
branches/2.4/prototype/modules/mail/templates/followupflag_alarm_list.ejs
r6754 r7228 3 3 <strong><%=data.caption %></strong> 4 4 </span> 5 <ul class="message-list" >5 <ul class="message-list" style="float: left;"> 6 6 <% 7 for(var i=0; i<data.alarm InRange.length; i++){7 for(var i=0; i<data.alarms.length; i++){ 8 8 if(data.type == 'filtersDeadline') 9 var openMessageScript = "$(this).parent().remove(); var msgs_count = $('.filtersDeadline').find(' .message-item').length; if(msgs_count == 0){ $('.filtersDeadline').remove(); } $('.subtitle-alarm').find('strong').html((msgs_count == 1)?get_lang('"+data.captions.singular+"'):get_lang('"+data.captions.plural+"', msgs_count)); cExecute('$this.imap_functions.open_flagged_msg&msg_number="+data.alarmInRange[i].msg_number+"&msg_folder="+data.alarmInRange[i].msg_folder+"&alarm=true', show_msg);";9 var openMessageScript = "$(this).parent().remove(); var msgs_count = $('.filtersDeadline').find('li.message-item').length; if(msgs_count == 0){ $('.filtersDeadline').remove(); } $('.subtitle-alarm').find('strong').html((msgs_count == 1)?get_lang('"+data.captions.singular+"'):get_lang('"+data.captions.plural+"', msgs_count)); cExecute('$this.imap_functions.open_flagged_msg&msg_number="+data.alarms[i].msg_number+"&msg_folder="+data.alarms[i].msg_folder+"&alarm=true', show_msg);"; 10 10 else 11 var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarm InRange[i].msg_number+"&msg_folder="+data.alarmInRange[i].msg_folder+"&alarm=true', show_msg);";11 var openMessageScript = "cExecute('$this.imap_functions.get_info_msg&msg_number="+data.alarms[i].msg_number+"&msg_folder="+data.alarms[i].msg_folder+"&alarm=true', show_msg);"; 12 12 %> 13 <li class="message-item ">13 <li class="message-item <%= data.alarms[i].id %>"> 14 14 <a onclick="<%=openMessageScript%>"> 15 <%= data.alarm InRange[i].a %>15 <%= data.alarms[i].a %> 16 16 </a> 17 <%if( data.type == 'alarmDeadline'){%> 18 <a onclick='cancelAlarm(this, "<%= data.alarms[i].id %>", "<%= data.alarms[i].msg_number %>", "<%= data.alarms[i].msg_folder %>");' class="tiny button delete">close</a> 19 <%}%> 17 20 </li> 18 21 <% -
branches/2.4/prototype/modules/mail/templates/followupflag_configure.ejs
r6294 r7228 70 70 <input type="checkbox" name="alarm" <%=(followupflagged.alarmDeadline) ? 'checked="checked"' : '' %> /><label><%= get_lang("Alarm")%>: </label> 71 71 <input type="text" name="alarmDate" class="date" size="12" value="<%=(followupflagged.alarmDeadline) ? followupflagged.alarmDeadline.toString('dd/MM/yyyy') : '' %>" /> 72 <input type=" hidden" name="alarmTime" class="time" size="8" value="00:01" />72 <input type="text" name="alarmTime" class="time" size="8" disabled="disabled" value="<%=(followupflagged.alarmDeadline) ? followupflagged.alarmDeadline.toString('HH:mm') : '' %>" /> 73 73 </div> 74 74 <div class="completed-followup"> -
branches/2.4/prototype/modules/mail/templates/listContacts.ejs
r6754 r7228 4 4 css: 'recent', 5 5 img: 'recent', 6 text: 'Contato dinâmico'6 text: 'Contato Recente' 7 7 }, 8 '/ contacts':{8 '/personalContact':{ 9 9 css: 'personal', 10 10 img: 'personal', 11 text: 'Contato pessoal' ,11 text: 'Contato pessoal' 12 12 }, 13 13 '/sharedcontact':{ 14 14 css: 'personal', 15 15 img: 'sharedcontact', 16 text: 'Contato compartilhado' ,16 text: 'Contato compartilhado' 17 17 }, 18 18 '/groups':{ 19 19 css: 'group', 20 20 img: 'group', 21 text: 'Grupo pessoal' ,21 text: 'Grupo pessoal' 22 22 }, 23 23 '/sharedgroup':{ 24 24 css: 'group', 25 25 img: 'sharedgroup', 26 text: 'Grupo compartilhado' ,26 text: 'Grupo compartilhado' 27 27 } 28 28 } -
branches/2.4/prototype/modules/mail/templates/new_message.ejs
r7122 r7228 38 38 } 39 39 %> 40 <button class="button small reply-to-button"><%= get_lang("Reply to") %></button> 40 41 <button class="button small rich-button"><%= (preferences.plain_text_editor == 1 ? get_lang("Rich Text") : get_lang("Simple Text")) %></button> 41 42 </div> … … 93 94 </td> 94 95 </tr> 96 <tr class="reply-to-tr" style="display:none;"> 97 <td class="field" style="width: 6%;"> 98 <%= get_lang("Reply to") %>: 99 </td> 100 <td class="value" style="width: 100%;"> 101 <div class="email-area ui-corner-all"> 102 <textarea class="new-message-input reply-to email-text" name="input_aux_reply_to" type="text" value="" autocomplete="off"></textarea> 103 </div> 104 <textarea class="new-message-input reply-to" name="input_reply_to" style="width:99%; resize: none;display : none;"></textarea> 105 </td> 106 </tr> 95 107 <tr class="subject-tr"> 96 108 <td class="field"> … … 125 137 <tr class="attachment"> 126 138 <td class="field"> 139 <%=get_lang("Attachments: ")%> 127 140 <input style="display:none;" name="attDisposition<%= data.id %>" id="attDisposition<%= data.id%>" value="attachment"/> 128 141 </td> -
branches/2.4/prototype/rest/catalog/DynamicContactResource.php
r6819 r7228 331 331 private function isEnabledDynamicContacts($user){ 332 332 333 //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria)334 //dos contatos dinamicos335 $sql = 'SELECT preference_owner, preference_value '. 333 //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria) 334 //dos contatos dinamicos 335 $sql = 'SELECT preference_owner, preference_value '. 336 336 'FROM phpgw_preferences '. 337 337 'WHERE preference_app = \'expressoMail\' AND '. 338 'preference_owner in (-1,-2, ' . $user . ')'; 339 340 $preferences = Controller::service('PostgreSQL')->execResultSql($sql); 341 342 $array = array(); 343 if(count($preferences) > 0){ 344 foreach($preferences as $preference){ 345 //recupera a preferencia 346 $preference_value = unserialize( $preference['preference_value'] ); 347 348 //gera um array com o owner e o valor da preferencia: 349 //true: SIM (1) 350 //false: NAO (0) 351 //null: escolha pelo usuario/ usar padrao / sem padrao 352 $value = null; 353 if(isset($preference_value['use_dynamic_contacts'])){ 354 $value = (isset($preference_value['use_dynamic_contacts'])) ? $preference_value['use_dynamic_contacts'] == '1' : false; 355 } 356 $array[ $preference['preference_owner'] ] = $value; 357 338 'preference_owner in (-1,-2, ' . $user . ')'; 339 340 $preferences = Controller::service('PostgreSQL')->execResultSql($sql); 341 342 $array = array(); 343 if(count($preferences) > 0){ 344 foreach($preferences as $preference){ 345 //recupera a preferencia 346 $preference_value = unserialize( $preference['preference_value'] ); 347 348 //gera um array com o owner e o valor da preferencia: 349 //true: SIM (1) 350 //false: NAO (0) 351 //null: escolha pelo usuario/ usar padrao / sem padrao 352 $value = null; 353 if(isset($preference_value['use_dynamic_contacts'])){ 354 $value = (isset($preference_value['use_dynamic_contacts'])) ? $preference_value['use_dynamic_contacts'] == '1' : false; 355 } 356 $array[ $preference['preference_owner'] ] = $value; 357 } 358 358 } 359 //preferencia obrigatoria (SIM) 360 if(array_key_exists(-1,$array) && $array[-1]){ 361 return true; 362 } 363 //preferencia do user (SIM) 364 else if(array_key_exists($user,$array) && $array[$user] ){ 365 return true; 366 } 367 //preferencia padrao (SIM) escolhida pelo user 368 else if(array_key_exists($user, $array) && $array[$user] === null && 369 array_key_exists(-2, $array) && $array[-2]){ 370 return true; 371 } 372 return false; 359 360 //preferencia obrigatoria (SIM) 361 if(array_key_exists(-1,$array) && $array[-1]){ 362 return true; 363 } 364 //preferencia do user (SIM) 365 else if(array_key_exists($user,$array) && $array[$user] ){ 366 return true; 367 } 368 //preferencia padrao (SIM) escolhida pelo user 369 else if(array_key_exists($user, $array) && $array[$user] === null && 370 array_key_exists(-2, $array) && $array[-2]){ 371 return true; 372 } 373 return false; 373 374 } 374 375 } -
branches/2.4/prototype/rest/catalog/DynamicContactsResource.php
r6819 r7228 290 290 private function isEnabledDynamicContacts($user){ 291 291 292 //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria) 293 //dos contatos dinamicos 294 $sql = 'SELECT preference_owner, preference_value '. 295 'FROM phpgw_preferences '. 296 'WHERE preference_app = \'expressoMail\' AND '. 297 'preference_owner in (-1,-2, ' . $user . ')'; 298 299 $preferences = Controller::service('PostgreSQL')->execResultSql($sql); 300 301 $array = array(); 302 if(count($preferences) > 0){ 303 foreach($preferences as $preference){ 304 //recupera a preferencia 305 $preference_value = unserialize( $preference['preference_value'] ); 306 307 //gera um array com o owner e o valor da preferencia: 308 //true: SIM (1) 309 //false: NAO (0) 310 //null: escolha pelo usuario/ usar padrao / sem padrao 311 $value = null; 312 if(isset($preference_value['use_dynamic_contacts'])){ 313 $value = (isset($preference_value['use_dynamic_contacts'])) ? $preference_value['use_dynamic_contacts'] == '1' : false; 314 } 315 $array[ $preference['preference_owner'] ] = $value; 316 } 317 } 318 319 //preferencia obrigatoria (SIM) 320 if(array_key_exists(-1,$array) && $array[-1]){ 321 return true; 292 //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria) 293 //dos contatos dinamicos 294 $sql = 'SELECT preference_owner, preference_value '. 295 'FROM phpgw_preferences '. 296 'WHERE preference_app = \'expressoMail\' AND '. 297 'preference_owner in (-1,-2, ' . $user . ')'; 298 299 $preferences = Controller::service('PostgreSQL')->execResultSql($sql); 300 301 $array = array(); 302 if(count($preferences) > 0){ 303 foreach($preferences as $preference){ 304 //recupera a preferencia 305 $preference_value = unserialize( $preference['preference_value'] ); 306 307 //gera um array com o owner e o valor da preferencia: 308 //true: SIM (1) 309 //false: NAO (0) 310 //null: escolha pelo usuario/ usar padrao / sem padrao 311 $value = null; 312 if(isset($preference_value['use_dynamic_contacts'])){ 313 $value = (isset($preference_value['use_dynamic_contacts'])) ? $preference_value['use_dynamic_contacts'] == '1' : false; 322 314 } 323 //preferencia do user (SIM) 324 else if(array_key_exists($user,$array) && $array[$user] ){ 325 return true; 326 } 327 //preferencia padrao (SIM) escolhida pelo user 328 else if(array_key_exists($user, $array) && $array[$user] === null && 329 array_key_exists(-2, $array) && $array[-2]){ 330 return true; 331 } 332 return false; 315 $array[ $preference['preference_owner'] ] = $value; 316 } 317 } 318 319 //preferencia obrigatoria (SIM) 320 if(array_key_exists(-1,$array) && $array[-1]){ 321 return true; 322 } 323 //preferencia do user (SIM) 324 else if(array_key_exists($user,$array) && $array[$user] ){ 325 return true; 326 } 327 //preferencia padrao (SIM) escolhida pelo user 328 else if(array_key_exists($user, $array) && $array[$user] === null && 329 array_key_exists(-2, $array) && $array[-2]){ 330 return true; 331 } 332 return false; 333 333 } 334 334 -
branches/2.4/prototype/rest/catalog/UserContactsResource.php
r6819 r7228 282 282 283 283 $d = new Data(); 284 $i = new Item($request->resources, (($value['user'] == Config::me("uidNumber")) ? ' ContactsResource' : 'SharedContactResource'), $value['id']);284 $i = new Item($request->resources, (($value['user'] == Config::me("uidNumber")) ? 'PersonalContactResource' : 'SharedContactResource'), $value['id']); 285 285 $d->setName('id'); 286 286 $d->setValue($value['id']); … … 487 487 private function isEnabledDynamicContacts($user){ 488 488 489 //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria) 490 //dos contatos dinamicos 491 489 //recuperando as preferencias (suas preferencias, preferencia padrão, preferencia obrigatoria) 490 //dos contatos dinamicos 491 $sql = 'SELECT preference_owner, preference_value '. 492 492 'FROM phpgw_preferences '. 493 493 'WHERE preference_app = \'expressoMail\' AND '. 494 'preference_owner in (-1,-2, ' . $user . ')'; 495 496 $preferences = Controller::service('PostgreSQL')->execResultSql($sql); 497 498 $array = array(); 499 if(count($preferences) > 0){ 500 foreach($preferences as $preference){ 501 //recupera a preferencia 502 $preference_value = unserialize( $preference['preference_value'] ); 503 504 //gera um array com o owner e o valor da preferencia: 505 //true: SIM (1) 506 //false: NAO (0) 507 //null: escolha pelo usuario/ usar padrao / sem padrao 508 $value = null; 509 if(isset($preference_value['use_dynamic_contacts'])){ 510 $value = (isset($preference_value['use_dynamic_contacts'])) ? $preference_value['use_dynamic_contacts'] == '1' : false; 511 } 512 $array[ $preference['preference_owner'] ] = $value; 513 } 494 'preference_owner in (-1,-2, ' . $user . ')'; 495 496 $preferences = Controller::service('PostgreSQL')->execResultSql($sql); 497 498 $array = array(); 499 if(count($preferences) > 0){ 500 foreach($preferences as $preference){ 501 //recupera a preferencia 502 $preference_value = unserialize( $preference['preference_value'] ); 503 504 //gera um array com o owner e o valor da preferencia: 505 //true: SIM (1) 506 //false: NAO (0) 507 //null: escolha pelo usuario/ usar padrao / sem padrao 508 $value = null; 509 if(isset($preference_value['use_dynamic_contacts'])){ 510 $value = (isset($preference_value['use_dynamic_contacts'])) ? $preference_value['use_dynamic_contacts'] == '1' : false; 511 } 512 $array[ $preference['preference_owner'] ] = $value; 513 } 514 514 } 515 //preferencia obrigatoria (SIM) 516 if(array_key_exists(-1,$array) && $array[-1]){ 517 return true; 518 } 519 //preferencia do user (SIM) 520 else if(array_key_exists($user,$array) && $array[$user] ){ 521 return true; 522 } 523 //preferencia padrao (SIM) escolhida pelo user 524 else if(array_key_exists($user, $array) && $array[$user] === null && 525 array_key_exists(-2, $array) && $array[-2]){ 526 return true; 527 } 528 return false; 515 516 //preferencia obrigatoria (SIM) 517 if(array_key_exists(-1,$array) && $array[-1]){ 518 return true; 519 } 520 //preferencia do user (SIM) 521 else if(array_key_exists($user,$array) && $array[$user] ){ 522 return true; 523 } 524 //preferencia padrao (SIM) escolhida pelo user 525 else if(array_key_exists($user, $array) && $array[$user] === null && 526 array_key_exists(-2, $array) && $array[-2]){ 527 return true; 528 } 529 return false; 529 530 } 530 531 } -
branches/2.4/prototype/services/ImapServiceAdapter.php
r7072 r7228 78 78 foreach ($result as $res) { 79 79 80 $response[] = array( 80 //monta o array padrao 81 $array = array( 81 82 'id' => mb_convert_encoding( $res['folder_id'], 'UTF-8', 'UTF7-IMAP' ), 82 83 'commonName' => mb_convert_encoding( $res['folder_name'], 'UTF-8' , 'UTF7-IMAP' ), 83 84 'parentFolder' => mb_convert_encoding( $res['folder_parent'], 'UTF-8' , 'UTF7-IMAP' ), 84 85 'messageCount' => array('unseen' => isset($res['folder_unseen']) ? $res['folder_unseen'] : null, 'total' => null) 85 ); 86 } 87 86 ); 87 88 //se existir compartilhamento para pasta compartilhada 89 //adicionar array de permissoes 90 if(isset($res['acl_share'])){ 91 $array['acl_share'] = $res['acl_share']; 92 } 93 $response[] = $array; 94 } 88 95 return $response; 89 96 } … … 603 610 */ 604 611 $mailService->addHeaderField('Message-Id', UUID::generate( UUID::UUID_RANDOM, UUID::FMT_STRING ) . '@Draft'); 605 612 $mailService->addHeaderField('Reply-To', mb_convert_encoding(($data['input_reply_to']), 'ISO-8859-1', 'UTF-8,ISO-8859-1')); 606 613 $mailService->addTo(mb_convert_encoding(($data['input_to']), 'ISO-8859-1', 'UTF-8,ISO-8859-1')); 607 614 $mailService->addCc( mb_convert_encoding(($data['input_cc']), 'ISO-8859-1', 'UTF-8,ISO-8859-1')); … … 626 633 $attachment = json_decode($data['attachments'],TRUE); 627 634 628 635 if(!empty($attachment)) 629 636 foreach ($attachment as &$value) 630 637 { -
branches/2.4/prototype/services/PostgreSQL.php
r6995 r7228 52 52 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 53 53 54 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map) : ''; 55 56 $justthese = self::parseJustthese($justthese, $map); 57 58 return $this->execSql( 'SELECT '.$justthese['select'].' FROM '. (Config::get($uri['concept'],'PostgreSQL.concept')) .' '.$criteria ); 54 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map) : ''; 55 56 $justthese = self::parseJustthese($justthese, $map); 57 58 return $this->execSql( 'SELECT '.$justthese['select'].' FROM '. (Config::get($uri['concept'],'PostgreSQL.concept')) .' '.$criteria ); 59 59 } 60 60 … … 63 63 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 64 64 $justthese = self::parseJustthese($justthese, $map); 65 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\''; 65 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\''; 66 66 67 67 return $this->execSql( 'SELECT '.$justthese['select'].' FROM '. (Config::get($uri['concept'],'PostgreSQL.concept')) .$criteria , true ); 68 68 } 69 69 70 70 public function deleteAll ( $uri, $justthese = false, $criteria = false ){ 71 71 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 72 if(!self::parseCriteria ( $criteria , $map)) return false; //Validador para não apagar tabela inteira 73 72 if(!self::parseCriteria ( $criteria , $map)) return false; //Validador para não apagar tabela inteira 73 return $this->execSql( 'DELETE FROM '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '.self::parseCriteria ( $criteria ,$map) ); 74 74 } 75 75 76 76 public function delete ( $uri, $justthese = false, $criteria = false ){ 77 77 if(!isset($uri['id']) && !is_int($uri['id'])) return false; //Delete chamado apenas passando id inteiros 78 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 79 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'';80 78 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 79 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\''; 80 return $this->execSql('DELETE FROM '.(Config::get($uri['concept'],'PostgreSQL.concept')).$criteria); 81 81 } 82 82 83 83 public function replace ( $uri, $data, $criteria = false ){ 84 84 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 85 return $this->execSql('UPDATE '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '. self::parseUpdateData( $data ,$map).' '.self::parseCriteria($criteria , $map)); 86 } 87 85 return $this->execSql('UPDATE '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '. self::parseUpdateData( $data ,$map).' '.self::parseCriteria($criteria , $map)); 86 } 87 88 88 public function update ( $uri, $data, $criteria = false ){ 89 89 $map = Config::get($uri['concept'], 'PostgreSQL.mapping'); 90 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\''; 91 92 return $this->execSql('UPDATE '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '. self::parseUpdateData( $data ,$map).$criteria); 93 } 94 95 public function create ( $uri, $data ){ 96 return $this->execSql( 'INSERT INTO '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '.self::parseInsertData( $data , $uri['concept'] ), true ); 90 $criteria = ($criteria !== false) ? $this->parseCriteria ( $criteria , $map , ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\'') : ' WHERE '.$map['id'].' = \''.pg_escape_string( $uri['id'] ).'\''; 91 92 return $this->execSql('UPDATE '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '. self::parseUpdateData( $data ,$map).$criteria); 93 } 94 95 public function create ( $uri, $data ){ 96 return $this->execSql( 'INSERT INTO '.(Config::get($uri['concept'],'PostgreSQL.concept')).' '.self::parseInsertData( $data , $uri['concept'] ), true ); 97 97 } 98 98 99 99 public function execSql( $sql, $unique = false ) 100 100 { 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 101 if(!$this->con) $this->open( $this->config ); 102 103 $rs = pg_query( $this->con, $sql ); 104 105 switch( pg_num_rows( $rs ) ) 106 { 107 case -1: 108 $this->error = pg_last_error ( $this->con ); 109 return( false ); 110 111 case 0: 112 return( pg_affected_rows( $rs ) ? true : array() ); 113 114 default: 115 $return = array(); 116 117 while( $row = pg_fetch_assoc( $rs ) ) 118 $return[] = $row; 119 120 return( $unique ? $return[0] : $return ); 121 } 122 122 } 123 123 … … 125 125 //@DEPRECATED 126 126 public function execResultSql( $sql, $unique = false ){ 127 127 return $this->execSql( $sql, $unique ); 128 128 } 129 129 130 130 public function begin( $uri ) { 131 131 132 133 132 if(!$this->con) 133 $this->open( $this->config ); 134 134 135 135 $this->error = false; 136 136 pg_query($this->con, "BEGIN WORK"); 137 137 } 138 138 139 139 public function commit($uri ) { 140 140 141 142 143 144 145 146 147 148 149 150 151 141 if( $this->error !== false ) 142 { 143 $error = $this->error; 144 $this->error = false; 145 146 throw new Exception( $error ); 147 } 148 149 pg_query($this->con, "COMMIT"); 150 151 return( true ); 152 152 } 153 153 154 154 public function rollback( $uri ){ 155 155 156 156 pg_query($this->con, "ROLLBACK"); 157 157 } 158 158 159 159 public function open ( $config ){ 160 160 161 161 $this->config = $config; 162 162 … … 168 168 $rs .= ( isset($this->config['port']) && $this->config['port'] ) ? ' port='.$this->config['port'] : '' ; 169 169 170 171 172 173 174 170 if($this->con = pg_connect( $rs )) 171 return $this->con; 172 173 throw new Exception('It was not possible to enable the target connection!'); 174 //$this->con = pg_connect('host='.$config['host'].' user='.$config['user'].' password='.$config['password'].' dbname='.$config['dbname'].' options=\'--client_encoding=UTF8\''); 175 175 } 176 176 177 177 public function close(){ 178 178 179 179 pg_close($this->con); 180 180 181 181 $this->con = false; … … 188 188 189 189 private static function parseInsertData( $data , $concept){ 190 190 191 191 $map = Config::get($concept, 'PostgreSQL.mapping'); 192 192 193 194 195 196 193 $ind = array(); 194 $val = array(); 195 196 foreach ($data as $i => $v){ 197 197 if(!isset($map[$i])) continue; 198 198 199 $ind[] = $map[$i]; 200 $val[] = '\''.pg_escape_string($v).'\''; 201 } 202 return '('.implode(',', $ind).') VALUES ('.implode(',', $val).') RETURNING '.$map['id'].' as id'; 203 } 204 199 $ind[] = $map[$i]; 200 $val[] = '\''.pg_escape_string($v).'\''; 201 } 202 return '('.implode(',', $ind).') VALUES ('.implode(',', $val).') RETURNING '.$map['id'].' as id'; 203 } 204 205 205 private static function parseUpdateData( $data , &$map){ 206 207 208 206 207 $d = array(); 208 foreach ($data as $i => $v) 209 209 { 210 210 if(!isset($map[$i])) continue; … … 212 212 $d[] = $map[$i].' = \''.pg_escape_string ($v).'\''; 213 213 } 214 215 214 215 return 'SET '.implode(',', $d); 216 216 } 217 217 218 218 private static function parseCriteria( $criteria , &$map , $query = '' ){ 219 220 if( isset($criteria["filter"]) && $criteria["filter"] !== NULL ) 221 { 222 /* 223 * ex: array ( 224 * [0] 'OR', 225 * [1] array( 'OR', array( array( '=', 'campo', 'valor' ) ), 226 * [2] array( '=', 'campo' , 'valor' ), 227 * [3] array( 'IN', 'campo', array( '1' , '2' , '3' ) ) 228 * ) 229 * OR 230 * array( '=' , 'campo' , 'valor' ) 231 */ 219 220 if( isset($criteria["filter"]) && $criteria["filter"] !== NULL ) 221 { 222 /* 223 * ex: array ( 224 * [0] 'OR', 225 * [1] array( 'OR', array( array( '=', 'campo', 'valor' ) ), 226 * [2] array( '=', 'campo' , 'valor' ), 227 * [3] array( 'IN', 'campo', array( '1' , '2' , '3' ) ) 228 * ) 229 * OR 230 * array( '=' , 'campo' , 'valor' ) 231 */ 232 232 $query .= ($query === '') ? 'WHERE ('.self::parseFilter( $criteria['filter'] , $map).')' : ' AND ('.self::parseFilter( $criteria['filter'] , $map).')'; 233 234 235 236 * 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 233 } 234 /* 235 * ex: array( 'table1' => 'table2' , 'table1' => 'table2') 236 * 237 */ 238 if( isset($criteria["join"]) ) 239 { 240 foreach ($criteria["join"] as $i => $v) 241 $query .= ' AND '.$i.' = '.$v.' '; 242 } 243 244 if( isset($criteria["group"]) ) 245 { 246 $query .= ' GROUP BY '.( is_array($criteria["group"]) ? implode(', ', $criteria["group"]) : $criteria["group"] ).' '; 247 } 248 249 if( isset($criteria["order"]) ) 250 { 251 //Verificar se os atributos para o ORDER BY serao ordenados em ordem decrescente [DESC] 252 $orderDesc = ( isset($criteria["orderDesc"]) && count($criteria["order"]) == count($criteria["orderDesc"]) ) ? $criteria["orderDesc"] : false; 253 254 $query .= ' ORDER BY '.self::parseOrder( $criteria["order"], $map, $orderDesc ).' '; 255 256 } 257 258 if( isset($criteria["limit"]) ) 259 { 260 $query .= ' LIMIT '. $criteria["limit"] .' '; 261 } 262 if( isset($criteria["offset"]) ) 263 { 264 $query .= ' OFFSET '. $criteria["offset"] .' '; 265 } 266 267 return $query; 268 268 } 269 269 270 270 private static function parseFilter( $filter ,&$map){ 271 271 272 273 274 275 276 277 278 279 280 272 if( !is_array( $filter ) || count($filter) <= 0) return null; 273 274 $op = self::parseOperator( array_shift( $filter ) ); 275 276 if( is_array($filter[0]) ) 277 { 278 $nested = array(); 279 280 foreach( $filter as $i => $f ) 281 281 if( $n = self::parseFilter( $f , $map)) 282 282 $nested[] = $n; 283 283 284 284 285 286 285 return (count($nested) > 0 ) ? '('.implode( ' '.$op.' ', $nested ).')' : ''; 286 } 287 287 288 288 if(!isset($map[$filter[0]])) return ''; … … 290 290 $filter[0] = $map[$filter[0]]; 291 291 292 293 294 295 296 297 298 299 300 301 302 303 return( $filter[0].' '.$op[0]." ($igPrefix'".implode( "'$igSuffix,$igPrefix'", array_map("pg_escape_string" , $filter[1]) )."'$igSuffix)" ); 304 305 return( $filter[0].' '.$op[0]." $igPrefix'".$op[1].pg_escape_string( $filter[1] ).$op[2]."'$igSuffix" );292 $igSuffix = $igPrefix = ''; 293 294 if( strpos( $op[0], 'i' ) === 0 ) 295 { 296 $op[0] = substr( $op[0], 1 ); 297 $filter[0] = 'upper("'.$filter[0].'")'; 298 $igPrefix = 'upper('; 299 $igSuffix = ')'; 300 } 301 302 if( is_array($filter[1]) ) 303 return( $filter[0].' '.$op[0]." ($igPrefix'".implode( "'$igSuffix,$igPrefix'", array_map("pg_escape_string" , $filter[1]) )."'$igSuffix)" ); 304 305 return( $filter[0].' '.$op[0]." $igPrefix'".$op[1].pg_escape_string( $filter[1] ).$op[2]."'$igSuffix" ); 306 306 } 307 307 308 308 private static function parseOperator( $op ){ 309 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 310 switch(strtolower($op)) 311 { 312 case 'and': 313 case 'or': return( $op ); 314 case 'in': return array( $op ); 315 case '!in': return array( 'NOT IN' ); 316 case '^': return array( 'like', '%', '' ); 317 case '$': return array( 'like', '', '%' ); 318 case '*': return array( 'like', '%', '%' ); 319 case 'i^': return array( 'ilike', '%', '' ); 320 case 'i$': return array( 'ilike', '', '%' ); 321 case 'i*': return array( 'ilike', '%', '%' ); 322 default : return array( $op, '', '' ); 323 } 324 324 } 325 325 … … 352 352 $order = array( $order ); 353 353 354 355 356 357 358 359 360 361 362 363 364 354 //Caso seja feita ordenacao em ordem descrescente 355 //concatenar DESC em cada atributo 356 if($orderDesc !== false){ 357 if(!is_array($orderDesc)){ 358 $orderDesc = array( $orderDesc ); 359 } 360 361 for($i=0; $i<count($order); $i++){ 362 $order[$i] .= ($orderDesc[$i] === true) ? ' DESC' : ''; 363 } 364 } 365 365 366 366 $return = array(); -
branches/2.4/prototype/services/iCal.php
r6834 r7228 16 16 static $suportedTimzones = array('Africa/Abidjan', 'Africa/Accra', 'Africa/Addis_Ababa', 'Africa/Algiers', 'Africa/Asmara', 'Africa/Asmera', 'Africa/Bamako', 'Africa/Bangui', 'Africa/Banjul', 'Africa/Bissau', 'Africa/Blantyre', 'Africa/Brazzaville', 'Africa/Bujumbura', 'Africa/Cairo', 'Africa/Casablanca', 'Africa/Ceuta', 'Africa/Conakry', 'Africa/Dakar', 'Africa/Dar_es_Salaam', 'Africa/Djibouti', 'Africa/Douala', 'Africa/El_Aaiun', 'Africa/Freetown', 'Africa/Gaborone', 'Africa/Harare', 'Africa/Johannesburg', 'Africa/Kampala', 'Africa/Khartoum', 'Africa/Kigali', 'Africa/Kinshasa', 'Africa/Lagos', 'Africa/Libreville', 'Africa/Lome', 'Africa/Luanda', 'Africa/Lubumbashi', 'Africa/Lusaka', 'Africa/Malabo', 'Africa/Maputo', 'Africa/Maseru', 'Africa/Mbabane', 'Africa/Mogadishu', 'Africa/Monrovia', 'Africa/Nairobi', 'Africa/Ndjamena', 'Africa/Niamey', 'Africa/Nouakchott', 'Africa/Ouagadougou', 'Africa/Porto-Novo', 'Africa/Sao_Tome', 'Africa/Timbuktu', 'Africa/Tripoli', 'Africa/Tunis', 'Africa/Windhoek', 'America/Adak', 'America/Anchorage', 'America/Anguilla', 'America/Antigua', 'America/Araguaina', 'America/Argentina/Buenos_Aires', 'America/Argentina/Catamarca', 'America/Argentina/ComodRivadavia', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/La_Rioja', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Salta', 'America/Argentina/San_Juan', 'America/Argentina/San_Luis', 'America/Argentina/Tucuman', 'America/Argentina/Ushuaia', 'America/Aruba', 'America/Asuncion', 'America/Atikokan', 'America/Atka', 'America/Bahia', 'America/Barbados', 'America/Belem', 'America/Belize', 'America/Blanc-Sablon', 'America/Boa_Vista', 'America/Bogota', 'America/Boise', 'America/Buenos_Aires', 'America/Cambridge_Bay', 'America/Campo_Grande', 'America/Cancun', 'America/Caracas', 'America/Catamarca', 'America/Cayenne', 'America/Cayman', 'America/Chicago', 'America/Chihuahua', 'America/Coral_Harbour', 'America/Cordoba', 'America/Costa_Rica', 'America/Cuiaba', 'America/Curacao', 'America/Danmarkshavn', 'America/Dawson_Creek', 'America/Dawson', 'America/Denver', 'America/Detroit', 'America/Dominica', 'America/Edmonton', 'America/Eirunepe', 'America/El_Salvador', 'America/Ensenada', 'America/Fort_Wayne', 'America/Fortaleza', 'America/Glace_Bay', 'America/Godthab', 'America/Goose_Bay', 'America/Grand_Turk', 'America/Grenada', 'America/Guadeloupe', 'America/Guatemala', 'America/Guayaquil', 'America/Guyana', 'America/Halifax', 'America/Havana', 'America/Hermosillo', 'America/Indiana/Indianapolis', 'America/Indiana/Knox', 'America/Indiana/Marengo', 'America/Indiana/Petersburg', 'America/Indiana/Tell_City', 'America/Indiana/Vevay', 'America/Indiana/Vincennes', 'America/Indiana/Winamac', 'America/Indianapolis', 'America/Inuvik', 'America/Iqaluit', 'America/Jamaica', 'America/Jujuy', 'America/Juneau', 'America/Kentucky/Louisville', 'America/Kentucky/Monticello', 'America/Knox_IN', 'America/La_Paz', 'America/Lima', 'America/Los_Angeles', 'America/Louisville', 'America/Maceio', 'America/Managua', 'America/Manaus', 'America/Marigot', 'America/Martinique', 'America/Matamoros', 'America/Mazatlan', 'America/Mendoza', 'America/Menominee', 'America/Merida', 'America/Mexico_City', 'America/Miquelon', 'America/Moncton', 'America/Monterrey', 'America/Montevideo', 'America/Montreal', 'America/Montserrat', 'America/Nassau', 'America/New_York', 'America/Nipigon', 'America/Nome', 'America/Noronha', 'America/North_Dakota/Center', 'America/North_Dakota/New_Salem', 'America/Ojinaga', 'America/Panama', 'America/Pangnirtung', 'America/Paramaribo', 'America/Phoenix', 'America/Port_of_Spain', 'America/Port-au-Prince', 'America/Porto_Acre', 'America/Porto_Velho', 'America/Puerto_Rico', 'America/Rainy_River', 'America/Rankin_Inlet', 'America/Recife', 'America/Regina', 'America/Resolute', 'America/Rio_Branco', 'America/Rosario', 'America/Santa_Isabel', 'America/Santarem', 'America/Santiago', 'America/Santo_Domingo', 'America/Sao_Paulo', 'America/Scoresbysund', 'America/Shiprock', 'America/St_Barthelemy', 'America/St_Johns', 'America/St_Kitts', 'America/St_Lucia', 'America/St_Thomas', 'America/St_Vincent', 'America/Swift_Current', 'America/Tegucigalpa', 'America/Thule', 'America/Thunder_Bay', 'America/Tijuana', 'America/Toronto', 'America/Tortola', 'America/Vancouver', 'America/Virgin', 'America/Whitehorse', 'America/Winnipeg', 'America/Yakutat', 'America/Yellowknife', 'Antarctica/Casey', 'Antarctica/Davis', 'Antarctica/DumontDUrville', 'Antarctica/Macquarie', 'Antarctica/Mawson', 'Antarctica/McMurdo', 'Antarctica/Palmer', 'Antarctica/Rothera', 'Antarctica/South_Pole', 'Antarctica/Syowa', 'Antarctica/Vostok', 'Arctic/Longyearbyen', 'Asia/Aden', 'Asia/Almaty', 'Asia/Amman', 'Asia/Anadyr', 'Asia/Aqtau', 'Asia/Aqtobe', 'Asia/Ashgabat', 'Asia/Ashkhabad', 'Asia/Baghdad', 'Asia/Bahrain', 'Asia/Baku', 'Asia/Bangkok', 'Asia/Beirut', 'Asia/Bishkek', 'Asia/Brunei', 'Asia/Calcutta', 'Asia/Choibalsan', 'Asia/Chongqing', 'Asia/Chungking', 'Asia/Colombo', 'Asia/Dacca', 'Asia/Damascus', 'Asia/Dhaka', 'Asia/Dili', 'Asia/Dubai', 'Asia/Dushanbe', 'Asia/Gaza', 'Asia/Harbin', 'Asia/Ho_Chi_Minh', 'Asia/Hong_Kong', 'Asia/Hovd', 'Asia/Irkutsk', 'Asia/Istanbul', 'Asia/Jakarta', 'Asia/Jayapura', 'Asia/Jerusalem', 'Asia/Kabul', 'Asia/Kamchatka', 'Asia/Karachi', 'Asia/Kashgar', 'Asia/Kathmandu', 'Asia/Katmandu', 'Asia/Kolkata', 'Asia/Krasnoyarsk', 'Asia/Kuala_Lumpur', 'Asia/Kuching', 'Asia/Kuwait', 'Asia/Macao', 'Asia/Macau', 'Asia/Magadan', 'Asia/Makassar', 'Asia/Manila', 'Asia/Muscat', 'Asia/Nicosia', 'Asia/Novokuznetsk', 'Asia/Novosibirsk', 'Asia/Omsk', 'Asia/Oral', 'Asia/Phnom_Penh', 'Asia/Pontianak', 'Asia/Pyongyang', 'Asia/Qatar', 'Asia/Qyzylorda', 'Asia/Rangoon', 'Asia/Riyadh', 'Asia/Saigon', 'Asia/Sakhalin', 'Asia/Samarkand', 'Asia/Seoul', 'Asia/Shanghai', 'Asia/Singapore', 'Asia/Taipei', 'Asia/Tashkent', 'Asia/Tbilisi', 'Asia/Tehran', 'Asia/Tel_Aviv', 'Asia/Thimbu', 'Asia/Thimphu', 'Asia/Tokyo', 'Asia/Ujung_Pandang', 'Asia/Ulaanbaatar', 'Asia/Ulan_Bator', 'Asia/Urumqi', 'Asia/Vientiane', 'Asia/Vladivostok', 'Asia/Yakutsk', 'Asia/Yekaterinburg', 'Asia/Yerevan', 'Atlantic/Azores', 'Atlantic/Bermuda', 'Atlantic/Canary', 'Atlantic/Cape_Verde', 'Atlantic/Faeroe', 'Atlantic/Faroe', 'Atlantic/Jan_Mayen', 'Atlantic/Madeira', 'Atlantic/Reykjavik', 'Atlantic/South_Georgia', 'Atlantic/St_Helena', 'Atlantic/Stanley', 'Australia/ACT', 'Australia/Adelaide', 'Australia/Brisbane', 'Australia/Broken_Hill', 'Australia/Canberra', 'Australia/Currie', 'Australia/Darwin', 'Australia/Eucla', 'Australia/Hobart', 'Australia/LHI', 'Australia/Lindeman', 'Australia/Lord_Howe', 'Australia/Melbourne', 'Australia/NSW', 'Australia/North', 'Australia/Perth', 'Australia/Queensland', 'Australia/South', 'Australia/Sydney', 'Australia/Tasmania', 'Australia/Victoria', 'Australia/West', 'Australia/Yancowinna', 'Europe/Amsterdam', 'Europe/Andorra', 'Europe/Athens', 'Europe/Belfast', 'Europe/Belgrade', 'Europe/Berlin', 'Europe/Bratislava', 'Europe/Brussels', 'Europe/Bucharest', 'Europe/Budapest', 'Europe/Chisinau', 'Europe/Copenhagen', 'Europe/Dublin', 'Europe/Gibraltar', 'Europe/Guernsey', 'Europe/Helsinki', 'Europe/Isle_of_Man', 'Europe/Istanbul', 'Europe/Jersey', 'Europe/Kaliningrad', 'Europe/Kiev', 'Europe/Lisbon', 'Europe/Ljubljana', 'Europe/London', 'Europe/Luxembourg', 'Europe/Madrid', 'Europe/Malta', 'Europe/Mariehamn', 'Europe/Minsk', 'Europe/Monaco', 'Europe/Moscow', 'Europe/Nicosia', 'Europe/Oslo', 'Europe/Paris', 'Europe/Podgorica', 'Europe/Prague', 'Europe/Riga', 'Europe/Rome', 'Europe/Samara', 'Europe/San_Marino', 'Europe/Sarajevo', 'Europe/Simferopol', 'Europe/Skopje', 'Europe/Sofia', 'Europe/Stockholm', 'Europe/Tallinn', 'Europe/Tirane', 'Europe/Tiraspol', 'Europe/Uzhgorod', 'Europe/Vaduz', 'Europe/Vatican', 'Europe/Vienna', 'Europe/Vilnius', 'Europe/Volgograd', 'Europe/Warsaw', 'Europe/Zagreb', 'Europe/Zaporozhye', 'Europe/Zurich', 'Indian/Antananarivo', 'Indian/Chagos', 'Indian/Christmas', 'Indian/Cocos', 'Indian/Comoro', 'Indian/Kerguelen', 'Indian/Mahe', 'Indian/Maldives', 'Indian/Mauritius', 'Indian/Mayotte', 'Indian/Reunion', 'Pacific/Apia', 'Pacific/Auckland', 'Pacific/Chatham', 'Pacific/Easter', 'Pacific/Efate', 'Pacific/Enderbury', 'Pacific/Fakaofo', 'Pacific/Fiji', 'Pacific/Funafuti', 'Pacific/Galapagos', 'Pacific/Gambier', 'Pacific/Guadalcanal', 'Pacific/Guam', 'Pacific/Honolulu', 'Pacific/Johnston', 'Pacific/Kiritimati', 'Pacific/Kosrae', 'Pacific/Kwajalein', 'Pacific/Majuro', 'Pacific/Marquesas', 'Pacific/Midway', 'Pacific/Nauru', 'Pacific/Niue', 'Pacific/Norfolk', 'Pacific/Noumea', 'Pacific/Pago_Pago', 'Pacific/Palau', 'Pacific/Pitcairn', 'Pacific/Ponape', 'Pacific/Port_Moresby', 'Pacific/Rarotonga', 'Pacific/Saipan', 'Pacific/Samoa', 'Pacific/Tahiti', 'Pacific/Tarawa', 'Pacific/Tongatapu', 'Pacific/Truk', 'Pacific/Wake', 'Pacific/Wallis', 'Pacific/Yap', 'UTC'); 17 17 18 public function format($data, $params = false) 19 { 20 $timezones = array_flip(self::$timezonesMap); 21 $sytemTimezone = (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo'; 22 $params['defaultTZI'] = self::nomalizeTZID((isset($params['defaultTZI']) && $params['defaultTZI'] != 'null') ? $params['defaultTZI'] : $sytemTimezone ); 23 $params['X-WR-TIMEZONE'] = isset($timezones[$params['defaultTZI']]) ? $timezones[$params['defaultTZI']] : $params['defaultTZI']; 24 25 return (isset($params['compatible']) && $params['compatible']) ? 26 array('ical' => $this->createIcal($data, $params) , 'compatible' => $this->createCompatibleIcal($data, $params)) : 27 $this->createIcal($data, $params); 28 29 } 30 31 protected function createIcal($data, $params = false ) 32 { 33 $ical = new icalCreator(); 34 $ical->setProperty('method', isset($params['method']) ? $params['method'] : 'PUBLISH' ); 35 36 /* 37 * Seta propiedades obrigatorias para alguns softwares (Outlook) 38 */ 39 $ical->setProperty('x-wr-calname', 'Calendar Expresso'); 40 $ical->setProperty('X-WR-CALDESC', 'Calendar Expresso'); 41 $ical->setProperty('X-WR-TIMEZONE', $params['X-WR-TIMEZONE']); 42 43 foreach ($data as $i => $v) { 44 45 switch ($v['type']) { 46 case EVENT_ID: 47 $vevent = $ical->newComponent('vevent'); 48 49 $vevent->setProperty('summary', $v['summary']); 50 $vevent->setProperty('description', isset($v['description']) ? $v['description'] : ''); 51 $vevent->setProperty('location', $v['location']); 52 $vevent->setProperty('tranp', (isset($v['tranparent']) && $v['tranparent'] == TRANSP_TRANSPARENT ) ? 'TRANSPARENT' : 'OPAQUE' ); 53 54 $timezone = new DateTimeZone('UTC'); 55 $apTimezone = self::nomalizeTZID(( isset($v['timezone']) && $v['timezone'] != 'null' ) ? $v['timezone'] : $params['defaultTZI']); 56 $apTimezoneOBJ = new DateTimeZone($apTimezone); 57 58 $sTime = new DateTime('@' . (int) ($v['startTime'] / 1000), $timezone); 59 $sTime->setTimezone($apTimezoneOBJ); 60 $eTime = new DateTime('@' . (int) ($v['endTime'] / 1000), $timezone); 61 $eTime->setTimezone($apTimezoneOBJ); 62 63 if (( isset($v['repeat']) ) && ( isset($v['repeat']['frequency']) && $v['repeat']['frequency'] && $v['repeat']['frequency'] != 'none' )) 64 $vevent->setProperty('rrule', $this->formatIcalRepeat($v['repeat'])); 65 66 67 if (isset($v['allDay']) && $v['allDay'] == 1) { 68 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 69 $vevent->setProperty('dtend', $eTime->format(DATE_RFC822), array("VALUE" => "DATE")); 70 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); 71 } else { 72 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 73 $vevent->setProperty('dtend', $eTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 74 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'FALSE'); 18 public function format($data, $params = false) 19 { 20 $timezones = array_flip(self::$timezonesMap); 21 $sytemTimezone = (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo'; 22 $params['defaultTZI'] = self::nomalizeTZID((isset($params['defaultTZI']) && $params['defaultTZI'] != 'null') ? $params['defaultTZI'] : $sytemTimezone ); 23 $params['X-WR-TIMEZONE'] = isset($timezones[$params['defaultTZI']]) ? $timezones[$params['defaultTZI']] : $params['defaultTZI']; 24 25 return (isset($params['compatible']) && $params['compatible']) ? 26 array('ical' => $this->createIcal($data, $params) , 'compatible' => $this->createCompatibleIcal($data, $params)) : 27 $this->createIcal($data, $params); 28 29 } 30 31 protected function createIcal($data, $params = false ) 32 { 33 $ical = new icalCreator(); 34 $ical->setProperty('method', isset($params['method']) ? $params['method'] : 'PUBLISH' ); 35 36 /* 37 * Seta propiedades obrigatorias para alguns softwares (Outlook) 38 */ 39 $ical->setProperty('x-wr-calname', 'Calendar Expresso'); 40 $ical->setProperty('X-WR-CALDESC', 'Calendar Expresso'); 41 $ical->setProperty('X-WR-TIMEZONE', $params['X-WR-TIMEZONE']); 42 43 foreach ($data as $i => $v) { 44 45 switch ($v['type']) { 46 case EVENT_ID: 47 $vevent = $ical->newComponent('vevent'); 48 49 $vevent->setProperty('summary', $v['summary']); 50 $vevent->setProperty('description', isset($v['description']) ? $v['description'] : ''); 51 $vevent->setProperty('location', $v['location']); 52 $vevent->setProperty('tranp', (isset($v['tranparent']) && $v['tranparent'] == TRANSP_TRANSPARENT ) ? 'TRANSPARENT' : 'OPAQUE' ); 53 54 $timezone = new DateTimeZone('UTC'); 55 $apTimezone = self::nomalizeTZID(( isset($v['timezone']) && $v['timezone'] != 'null' ) ? $v['timezone'] : $params['defaultTZI']); 56 $apTimezoneOBJ = new DateTimeZone($apTimezone); 57 58 $sTime = new DateTime('@' . (int) ($v['startTime'] / 1000), $timezone); 59 $sTime->setTimezone($apTimezoneOBJ); 60 61 if (( isset($v['repeat']) ) && ( isset($v['repeat']['frequency']) && $v['repeat']['frequency'] && $v['repeat']['frequency'] != 'none' )) 62 $vevent->setProperty('rrule', $this->formatIcalRepeat($v['repeat'])); 63 64 65 if (isset($v['allDay']) && $v['allDay'] == 1) 66 { 67 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 68 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); 69 } else 70 { 71 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 72 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'FALSE'); 75 73 } 76 77 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 78 $participants = $v['participants']; 79 else 80 $participants = Controller::find(array('concept' => 'participant'), false, array('filter' => array('=', 'schedulable', $v['id']))); 81 82 if (is_array($participants) && count($participants) > 0) 83 foreach ($participants as $ii => $vv) { 84 85 if(isset($participants[$ii]['user']) && !is_array($participants[$ii]['user'])) 86 { 87 if ($vv['isExternal'] == 1) 88 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'], 'service' => 'PostgreSQL')); 89 else 90 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'])); 91 } 92 93 if ($participants[$ii]['user']['id'] == Config::me('uidNumber')) 94 { 95 $alarms = (isset($participants[$ii]['alarms'])) ? $participants[$ii]['alarms'] : Controller::find(array('concept' => 'alarm'), null, array('filter' => array('AND', array('=', 'participant', $vv['id']), array('=', 'schedulable', $v['id'])))); 96 if(is_array($alarms)) 97 self::createAlarms($alarms, $vevent); 98 } 99 100 } 101 102 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 103 $this->createAttendee($v['participants'], $vevent); 104 105 if (isset($v['attachments']) && is_array($v['attachments']) && count($v['attachments']) > 0) 106 $this->createAttachment($v['attachments'], $vevent); 107 108 $vevent->setProperty('uid', $v['uid']); 109 110 break; 111 112 default: 113 break; 114 } 115 116 } 117 118 119 return $ical->createCalendar(); 120 } 121 122 protected function createCompatibleIcal($data, $params = false ) 123 { 124 $ical = new icalCreator(); 125 $ical->setProperty('method', isset($params['method']) ? $params['method'] : 'PUBLISH' ); 126 127 /* 128 * Seta propiedades obrigatorias para alguns softwares (Outlook) 129 */ 130 $ical->setProperty('x-wr-calname', 'Calendar Expresso'); 131 $ical->setProperty('X-WR-CALDESC', 'Calendar Expresso'); 132 $ical->setProperty('X-WR-TIMEZONE', $params['X-WR-TIMEZONE']); 133 134 foreach ($data as $i => $v) { 135 136 switch ($v['type']) { 137 case EVENT_ID: 138 $vevent = $ical->newComponent('vevent'); 139 140 $vevent->setProperty('summary', $v['summary']); 141 $vevent->setProperty('description', isset($v['description']) ? $v['description'] : ''); 142 $vevent->setProperty('location', $v['location']); 143 $vevent->setProperty('tranp', (isset($v['tranparent']) && $v['tranparent'] == TRANSP_TRANSPARENT ) ? 'TRANSPARENT' : 'OPAQUE' ); 144 145 $timezone = new DateTimeZone('UTC'); 146 $sTime = new DateTime('@' . (int) ($v['startTime'] / 1000), $timezone); 147 $eTime = new DateTime('@' . (int) ($v['endTime'] / 1000), $timezone); 148 149 if (( isset($v['repeat']) ) && ( isset($v['repeat']['frequency']) && $v['repeat']['frequency'] && $v['repeat']['frequency'] != 'none' )) 150 $vevent->setProperty('rrule', $this->formatIcalRepeat($v['repeat'])); 151 152 if (isset($v['allDay']) && $v['allDay'] == 1) { 153 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 154 $vevent->setProperty('dtend', $eTime->format(DATE_RFC822), array("VALUE" => "DATE")); 155 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); 156 } else { 157 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822)); 158 $vevent->setProperty('dtend', $eTime->format(DATE_RFC822)); 159 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'FALSE'); 160 } 161 162 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 163 $participants = $v['participants']; 164 else 165 $participants = Controller::find(array('concept' => 'participant'), false, array('filter' => array('=', 'schedulable', $v['id']))); 166 167 if (is_array($participants) && count($participants) > 0) 168 foreach ($participants as $ii => $vv) { 169 170 if(isset($participants[$ii]['user']) && !is_array($participants[$ii]['user'])) 171 { 172 if ($vv['isExternal'] == 1) 173 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'], 'service' => 'PostgreSQL')); 174 else 175 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'])); 176 } 177 178 if ($participants[$ii]['user']['id'] == Config::me('uidNumber')) 179 { 180 $alarms = (isset($participants[$ii]['alarms'])) ? $participants[$ii]['alarms'] : Controller::find(array('concept' => 'alarm'), null, array('filter' => array('AND', array('=', 'participant', $vv['id']), array('=', 'schedulable', $v['id'])))); 181 if(is_array($alarms)) 182 self::createAlarms($alarms, $vevent); 183 } 184 185 } 186 187 188 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 189 $this->createAttendee($v['participants'], $vevent); 190 191 if (isset($v['attachments']) && is_array($v['attachments']) && count($v['attachments']) > 0) 192 $this->createAttachment($v['attachments'], $vevent); 193 194 $vevent->setProperty('uid', $v['uid']); 195 196 break; 197 198 default: 199 break; 74 75 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 76 $participants = $v['participants']; 77 else 78 $participants = Controller::find(array('concept' => 'participant'), false, array('filter' => array('=', 'schedulable', $v['id']))); 79 80 if (is_array($participants) && count($participants) > 0) 81 foreach ($participants as $ii => $vv) { 82 83 if(isset($participants[$ii]['user']) && !is_array($participants[$ii]['user'])) 84 { 85 if ($vv['isExternal'] == 1) 86 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'], 'service' => 'PostgreSQL')); 87 else 88 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'])); 89 } 90 91 if ($participants[$ii]['user']['id'] == Config::me('uidNumber')) 92 { 93 $alarms = (isset($participants[$ii]['alarms'])) ? $participants[$ii]['alarms'] : Controller::find(array('concept' => 'alarm'), null, array('filter' => array('AND', array('=', 'participant', $vv['id']), array('=', 'schedulable', $v['id'])))); 94 if(is_array($alarms)) 95 self::createAlarms($alarms, $vevent); 96 } 97 98 } 99 100 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 101 $this->createAttendee($v['participants'], $vevent); 102 103 if (isset($v['attachments']) && is_array($v['attachments']) && count($v['attachments']) > 0) 104 $this->createAttachment($v['attachments'], $vevent); 105 106 $vevent->setProperty('uid', $v['uid']); 107 break; 108 case TODO_ID: 109 110 $todo = $ical->newComponent('todo'); 111 112 $todo->setProperty('summary', $v['summary']); 113 $todo->setProperty('description', isset($v['description']) ? $v['description'] : ''); 114 $todo->setProperty('priority', $v['priority']); 115 $todo->setProperty('percent-complete', $v['percentage']); 116 $todo->setProperty('status', $this->_getStatusTodo($v['status'])); 117 118 $timezone = new DateTimeZone('UTC'); 119 $apTimezone = self::nomalizeTZID(( isset($v['timezone']) && $v['timezone'] != 'null' ) ? $v['timezone'] : $params['defaultTZI']); 120 $apTimezoneOBJ = new DateTimeZone($apTimezone); 121 122 $sTime = new DateTime('@' . (int) ($v['startTime'] / 1000), $timezone); 123 $sTime->setTimezone($apTimezoneOBJ); 124 $eTime = new DateTime('@' . (int) ($v['endTime'] / 1000), $timezone); 125 $eTime->setTimezone($apTimezoneOBJ); 126 127 if (isset($v['allDay']) && $v['allDay'] == 1) { 128 $todo->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 129 $todo->setProperty('dtend', $eTime->format(DATE_RFC822), array("VALUE" => "DATE")); 130 //$todo->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); 131 } else { 132 $todo->setProperty('dtstart', $sTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 133 $todo->setProperty('dtend', $eTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 134 //$todo->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'FALSE'); 135 } 136 137 if(isset($v['due']) && $v['due'] != '' && (int)$v['due'] > 0){ 138 $dueTime = new DateTime('@' . (int) ($v['due'] / 1000), $timezone); 139 $dueTime->setTimezone($apTimezoneOBJ); 140 141 $todo->setProperty('due', $dueTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 142 $todo->setProperty('dueTime', $dueTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 143 } 144 145 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 146 $participants = $v['participants']; 147 else 148 $participants = Controller::find(array('concept' => 'participant'), false, array('filter' => array('=', 'schedulable', $v['id']))); 149 150 if (is_array($participants) && count($participants) > 0) 151 foreach ($participants as $ii => $vv) { 152 153 if(isset($participants[$ii]['user']) && !is_array($participants[$ii]['user'])) 154 { 155 if ($vv['isExternal'] == 1) 156 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'], 'service' => 'PostgreSQL')); 157 else 158 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'])); 159 } 160 161 if ($participants[$ii]['user']['id'] == Config::me('uidNumber')) 162 { 163 $alarms = (isset($participants[$ii]['alarms'])) ? $participants[$ii]['alarms'] : Controller::find(array('concept' => 'alarm'), null, array('filter' => array('AND', array('=', 'participant', $vv['id']), array('=', 'schedulable', $v['id'])))); 164 if(is_array($alarms)) 165 self::createAlarms($alarms, $todo); 166 } 167 168 } 169 170 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 171 $this->createAttendee($v['participants'], $todo); 172 173 if (isset($v['attachments']) && is_array($v['attachments']) && count($v['attachments']) > 0) 174 $this->createAttachment($v['attachments'], $todo); 175 176 $todo->setProperty('uid', $v['uid']); 177 178 break; 179 default: 180 break; 200 181 } 201 182 } 183 return $ical->createCalendar(); 184 } 185 186 protected function createCompatibleIcal($data, $params = false ) 187 { 188 $ical = new icalCreator(); 189 $ical->setProperty('method', isset($params['method']) ? $params['method'] : 'PUBLISH' ); 190 191 /* 192 * Seta propiedades obrigatorias para alguns softwares (Outlook) 193 */ 194 $ical->setProperty('x-wr-calname', 'Calendar Expresso'); 195 $ical->setProperty('X-WR-CALDESC', 'Calendar Expresso'); 196 $ical->setProperty('X-WR-TIMEZONE', $params['X-WR-TIMEZONE']); 197 198 foreach ($data as $i => $v) { 199 200 switch ($v['type']) { 201 case EVENT_ID: 202 $vevent = $ical->newComponent('vevent'); 203 204 $vevent->setProperty('summary', $v['summary']); 205 $vevent->setProperty('description', isset($v['description']) ? $v['description'] : ''); 206 $vevent->setProperty('location', $v['location']); 207 $vevent->setProperty('tranp', (isset($v['tranparent']) && $v['tranparent'] == TRANSP_TRANSPARENT ) ? 'TRANSPARENT' : 'OPAQUE' ); 208 209 $timezone = new DateTimeZone('UTC'); 210 $sTime = new DateTime('@' . (int) ($v['startTime'] / 1000), $timezone); 211 $eTime = new DateTime('@' . (int) ($v['endTime'] / 1000), $timezone); 212 213 if (( isset($v['repeat']) ) && ( isset($v['repeat']['frequency']) && $v['repeat']['frequency'] && $v['repeat']['frequency'] != 'none' )) 214 $vevent->setProperty('rrule', $this->formatIcalRepeat($v['repeat'])); 215 216 if (isset($v['allDay']) && $v['allDay'] == 1) { 217 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 218 $vevent->setProperty('dtend', $eTime->format(DATE_RFC822), array("VALUE" => "DATE")); 219 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); 220 } else { 221 $vevent->setProperty('dtstart', $sTime->format(DATE_RFC822)); 222 $vevent->setProperty('dtend', $eTime->format(DATE_RFC822)); 223 $vevent->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'FALSE'); 224 } 225 226 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 227 $participants = $v['participants']; 228 else 229 $participants = Controller::find(array('concept' => 'participant'), false, array('filter' => array('=', 'schedulable', $v['id']))); 230 231 if (is_array($participants) && count($participants) > 0) 232 foreach ($participants as $ii => $vv) { 233 234 if(isset($participants[$ii]['user']) && !is_array($participants[$ii]['user'])) 235 { 236 if ($vv['isExternal'] == 1) 237 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'], 'service' => 'PostgreSQL')); 238 else 239 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'])); 240 } 241 242 if ($participants[$ii]['user']['id'] == Config::me('uidNumber')) 243 { 244 $alarms = (isset($participants[$ii]['alarms'])) ? $participants[$ii]['alarms'] : Controller::find(array('concept' => 'alarm'), null, array('filter' => array('AND', array('=', 'participant', $vv['id']), array('=', 'schedulable', $v['id'])))); 245 if(is_array($alarms)) 246 self::createAlarms($alarms, $vevent); 247 } 248 249 } 250 251 252 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 253 $this->createAttendee($v['participants'], $vevent); 254 255 if (isset($v['attachments']) && is_array($v['attachments']) && count($v['attachments']) > 0) 256 $this->createAttachment($v['attachments'], $vevent); 257 258 $vevent->setProperty('uid', $v['uid']); 259 260 break; 261 262 default: 263 break; 264 265 case TODO_ID: 266 267 $todo = $ical->newComponent('todo'); 268 269 $todo->setProperty('summary', $v['summary']); 270 $todo->setProperty('description', isset($v['description']) ? $v['description'] : ''); 271 $todo->setProperty('priority', $v['priority']); 272 $todo->setProperty('percent-complete', $v['percentage']); 273 $todo->setProperty('status', $this->_getStatusTodo($v['status'])); 274 275 $timezone = new DateTimeZone('UTC'); 276 $apTimezone = self::nomalizeTZID(( isset($v['timezone']) && $v['timezone'] != 'null' ) ? $v['timezone'] : $params['defaultTZI']); 277 $apTimezoneOBJ = new DateTimeZone($apTimezone); 278 279 $sTime = new DateTime('@' . (int) ($v['startTime'] / 1000), $timezone); 280 $sTime->setTimezone($apTimezoneOBJ); 281 282 if (isset($v['allDay']) && $v['allDay'] == 1) { 283 $todo->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 284 //$todo->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'TRUE'); 285 } else { 286 $todo->setProperty('dtstart', $sTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 287 //$todo->setProperty('X-MICROSOFT-CDO-ALLDAYEVENT', 'FALSE'); 288 } 289 290 if(isset($v['due']) && $v['due'] != '' && (int)$v['due'] > 0){ 291 $dueTime = new DateTime('@' . (int) ($v['due'] / 1000), $timezone); 292 $dueTime->setTimezone($apTimezoneOBJ); 293 294 $todo->setProperty('due', $dueTime->format(DATE_RFC822), array('TZID' => $apTimezone)); 295 } 296 297 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 298 $participants = $v['participants']; 299 else 300 $participants = Controller::find(array('concept' => 'participant'), false, array('filter' => array('=', 'schedulable', $v['id']))); 301 302 if (is_array($participants) && count($participants) > 0) 303 foreach ($participants as $ii => $vv) { 304 305 if(isset($participants[$ii]['user']) && !is_array($participants[$ii]['user'])) 306 { 307 if ($vv['isExternal'] == 1) 308 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'], 'service' => 'PostgreSQL')); 309 else 310 $participants[$ii]['user'] = Controller::read(array('concept' => 'user', 'id' => $vv['user'])); 311 } 312 313 if ($participants[$ii]['user']['id'] == Config::me('uidNumber')) 314 { 315 $alarms = (isset($participants[$ii]['alarms'])) ? $participants[$ii]['alarms'] : Controller::find(array('concept' => 'alarm'), null, array('filter' => array('AND', array('=', 'participant', $vv['id']), array('=', 'schedulable', $v['id'])))); 316 if(is_array($alarms)) 317 self::createAlarms($alarms, $todo); 318 } 319 320 } 321 322 if (isset($v['participants']) && is_array($v['participants']) && count($v['participants']) > 0) 323 $this->createAttendee($v['participants'], $todo); 324 325 if (isset($v['attachments']) && is_array($v['attachments']) && count($v['attachments']) > 0) 326 $this->createAttachment($v['attachments'], $todo); 327 328 $todo->setProperty('uid', $v['uid']); 329 330 break; 331 332 default: 333 break; 334 } 335 } 202 336 203 337 … … 205 339 } 206 340 207 protected function formatIcalRepeat($pRepeat) 208 { 209 $repeat = array(); 210 211 foreach ($pRepeat as $ir => $rv) { 212 if ($rv) { 213 if ($ir == 'frequency' && $rv !== 'none') 214 $repeat['FREQ'] = $rv; 215 else if ($ir == 'endTime') { 216 $time = new DateTime('@' . (int) ($rv / 1000), new DateTimeZone('UTC')); 217 $time->setTimezone($apTimezoneOBJ); 218 $repeat['until'] = $time->format(DATE_RFC822); 219 } else if ($ir == 'count') 220 $repeat[$ir] = $rv; 221 else if ($ir == 'interval') 222 $repeat[$ir] = $rv; 223 else if ($ir !== 'schedulable' && $ir !== 'id' && $ir !== 'startTime') 224 $repeat[$ir] = explode(',', $rv); 225 } 226 } 227 return $repeat; 228 } 341 protected function formatIcalRepeat($pRepeat) 342 { 343 $repeat = array(); 344 345 foreach ($pRepeat as $ir => $rv) { 346 if ($rv) { 347 if ($ir == 'frequency' && $rv !== 'none') 348 $repeat['FREQ'] = $rv; 349 else if ($ir == 'endTime') { 350 $time = new DateTime('@' . (int) ($rv / 1000), new DateTimeZone('UTC')); 351 $time->setTimezone($apTimezoneOBJ); 352 $repeat['until'] = $time->format(DATE_RFC822); 353 } else if ($ir == 'count') 354 $repeat[$ir] = $rv; 355 else if ($ir == 'interval') 356 $repeat[$ir] = $rv; 357 else if ($ir !== 'schedulable' && $ir !== 'id' && $ir !== 'startTime') 358 $repeat[$ir] = explode(',', $rv); 359 } 360 } 361 return $repeat; 362 } 363 229 364 230 365 public function createAlarms($alarms, &$vevent) 231 366 { 232 foreach ($alarms as $ ia => $va)367 foreach ($alarms as $va) 233 368 { 234 369 $valarm = new valarm(); … … 336 471 case 'PUBLISH': 337 472 //Caso o evento não exista o mesmo cria um novo evento, se já existir o mesmo referencia o evento com agenda 338 339 $interation = self::_makeVEVENT($schedulable, $component, $params);340 341 342 array('AND',343 array('=', 'calendar', $params['calendar']),344 array('=', 'schedulable', $schedulable['id'])345 )));346 347 348 349 350 473 if (!$schedulable = self::_getSchedulable($uid)) 474 $interation = self::_makeVEVENT($schedulable, $component, $params); 475 else{ 476 $links = Controller::read(array('concept' => 'calendarToSchedulable'), array('id'), array('filter' => 477 array('AND', 478 array('=', 'calendar', $params['calendar']), 479 array('=', 'schedulable', $schedulable['id']) 480 ))); 481 482 if(!$links && !isset($links[0])) 483 Controller::create(array('concept' => 'calendarToSchedulable'), array('calendar' => $params['calendar'], 'schedulable' => $schedulable['id'])); 484 485 } 351 486 break; 352 487 … … 365 500 $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 366 501 $pID = self::_getParticipantByMail($user[0]['mail'], $schedulable['participants']); 367 }else 368 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 369 $interation['participant://' . $pID]['status'] = $params['status']; 502 }else{ 503 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 504 //caso nõa seja participante adiciona a lista de participantes 505 if(!$pID){ 506 $pID = mt_rand() . '2(Formatter)'; 507 $interation['participant://' . $pID]['status'] = $params['status']; 508 $interation['participant://' . $pID]['user'] = $params['owner']; 509 $interation['participant://' . $pID]['isOrganizer'] = '0'; 510 $interation['participant://' . $pID]['schedulable'] = $schedulable['id']; 511 }else 512 $interation['participant://' . $pID]['status'] = $params['status']; 513 } 370 514 } 371 515 … … 572 716 $interation['schedulable://' . $schedulable['id']] = false; 573 717 break; 574 718 575 719 case 'ADD': 576 720 break; … … 624 768 else // Importar evento 625 769 $interation = self::_makeVEVENT(array(), $component, $params); 626 627 628 629 770 break; 630 771 } … … 633 774 $return[] = $interation; 634 775 break; 635 case 'VTIMEZONE': 636 637 638 break; 776 /***********************************************************************TODO*******************************************************************************/ 777 case 'VTODO': 778 switch ($method) { 779 case 'PUBLISH': 780 //Caso a tarefa não exista o mesmo cria um novo evento, se já existir o mesmo referencia o evento com agenda 781 if (!$schedulable = self::_getSchedulable($uid)) 782 $interation = self::_makeVTODO($schedulable, $component, $params); 783 else{ 784 $links = Controller::read(array('concept' => 'calendarToSchedulable'), array('id'), array('filter' => 785 array('AND', 786 array('=', 'calendar', $params['calendar']), 787 array('=', 'schedulable', $schedulable['id']) 788 ))); 789 790 if(!$links && !isset($links[0])) 791 Controller::create(array('concept' => 'calendarToSchedulable'), array('calendar' => $params['calendar'], 'schedulable' => $schedulable['id'])); 792 } 793 break; 794 795 case 'REQUEST': 796 $schedulable = self::_getSchedulable($uid); 797 798 if ($schedulable) { //Caso tarefa exista 799 if (!self::_existInMyCalendars($schedulable['id'], $params['owner'])) { 800 801 $calendarToSchedulable = array(); 802 $calendarToSchedulable['calendar'] = $params['calendar']; 803 $calendarToSchedulable['schedulable'] = $schedulable['id']; 804 $interation['calendarToSchedulable://' . mt_rand() . '(Formatter)'] = $calendarToSchedulable; 805 806 if (isset($params['status'])) { 807 if($params['owner'] != Config::me("uidNumber")){ 808 $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 809 $pID = self::_getParticipantByMail($user[0]['mail'], $schedulable['participants']); 810 }else 811 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 812 $interation['participant://' . $pID]['status'] = $params['status']; 813 } 814 Config::regSet('noAlarm', FALSE); //reativa notificação 815 } else { 816 817 if (self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence']) //Organizador esta requisitando que você atualize o evento 818 $interation = self::_makeVEVENT($schedulable, $component, $params); 819 else if ($component->getProperty('sequence', false, false) === $schedulable['sequence']) { 820 //Ler melhor rfc sobre isto 3.2.2.2 821 //Aparentemente é para retornar um ical com o evento atualizado para o attende 822 } 823 824 if (isset($params['status'])) { 825 if($params['owner'] != Config::me("uidNumber")){ 826 $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 827 $pID = self::_getParticipantByMail($user[0]['mail'], $schedulable['participants']); 828 }else{ 829 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 830 //Verifica a importação de tarefas em que não participo 831 if ($pID) { 832 $pID = mt_rand() . '2(Formatter)'; 833 $interation['participant://' . $pID]['status'] = $params['status']; 834 $interation['participant://' . $pID]['user'] = $params['owner']; 835 $interation['participant://' . $pID]['isOrganizer'] = '0'; 836 $interation['participant://' . $pID]['schedulable'] = $schedulable['id']; 837 }else 838 $interation['participant://' . $pID]['status'] = $params['status']; 839 } 840 } 841 } 842 } else { // Importar tarefa 843 $interation = self::_makeVTODO(array(), $component, $params); 844 845 if (strpos($params['prodid'], 'kigkonsult.se') !== false) { //envia notificação para fora 846 847 /* Data de Inicio */ 848 $startTime = $component->getProperty('dtstart', false, true); 849 $tzid = isset($startTime['params']['TZID']) ? $startTime['params']['TZID'] : $params['X-WR-TIMEZONE']; 850 851 /* Tiem zone do evento */ 852 if ($tzid) 853 $sc['timezone'] = self::nomalizeTZID($tzid); 854 else 855 $sc['timezone'] = isset($params['calendar_timezone']) ? $params['calendar_timezone'] : 'America/Sao_Paulo'; 856 857 $objTimezone = new DateTimeZone($sc['timezone']); 858 859 if (isset($startTime['params']['VALUE']) && $startTime['params']['VALUE'] === 'DATE' && isset($params['calendar_timezone'])) { 860 $sc['allDay'] = 1; 861 $sc['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $sc['timezone']) . '000'; 862 } elseif (isset($startTime['params']['TZID']) && !isset($startTime['value']['tz']))/* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */ 863 $sc['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $startTime['params']['TZID']) . '000'; 864 else { 865 $sc['startTime'] = self::date2timestamp($startTime['value']) . '000'; 866 if (strpos($params['prodid'], 'Outlook') !== false) { 867 //Se o ics veio em utc não aplicar horario de verão 868 $sTime = new DateTime('@' . (int) ($sc['startTime'] / 1000), new DateTimeZone('UTC')); 869 $sTime->setTimezone($objTimezone); 870 if ($sTime->format('I')) //Se o ics veio em utc não aplicar horario de verão 871 $sc['startTime'] = $sc['startTime'] - 3600000; 872 } 873 } 874 875 /* Data de Termino */ 876 $endTime = $component->getProperty('dtend', false, true); 877 878 if (isset($endTime['params']['VALUE']) && $endTime['params']['VALUE'] === 'DATE') 879 $sc['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $sc['timezone']) . '000'; 880 else if (isset($endTime['params']['TZID']) && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */ 881 $sc['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $endTime['params']['TZID']) . '000'; 882 else { 883 $sc['endTime'] = self::date2timestamp($endTime['value']) . '000'; 884 if (strpos($params['prodid'], 'Outlook') !== false) { 885 //Se o ics veio em utc não aplicar horario de verão 886 $eTime = new DateTime('@' . (int) ($sc['endTime'] / 1000), new DateTimeZone('UTC')); 887 $eTime->setTimezone($objTimezone); 888 if ($eTime->format('I')) 889 $sc['endTime'] = $sc['endTime'] - 3600000; 890 } 891 } 892 893 894 if ($uid = $component->getProperty('uid', false, false)) 895 $sc['uid'] = $uid; 896 897 $sc['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'UTF-8', 'UTF-8,ISO-8859-1'); 898 899 /* Definindo Description */ 900 if ($desc = $component->getProperty('description', false, false)) 901 $sc['description'] = mb_convert_encoding(str_ireplace(array('\n', '\t'), array("\n", "\t"), $desc), 'UTF-8', 'UTF-8,ISO-8859-1'); 902 903 if ($priority = $component->getProperty('priority', false, false)) 904 $sc['priority'] = mb_convert_encoding(str_ireplace(array('\n', '\t'), array("\n", "\t"), $priority), 'UTF-8', 'UTF-8,ISO-8859-1'); 905 906 if ($status = $component->getProperty('status', false, false)) 907 $sc['status'] = $this->decodeStatusTodo(mb_convert_encoding(str_ireplace(array('\n', '\t'), array("\n", "\t"), $status), 'UTF-8', 'UTF-8,ISO-8859-1')); 908 909 if ($percentage = $component->getProperty('percent-complete', false, false)) 910 $sc['percentage'] = mb_convert_encoding(str_ireplace(array('\n', '\t'), array("\n", "\t"), $percentage), 'UTF-8', 'UTF-8,ISO-8859-1'); 911 912 /* Definindo location */ 913 if ($location = $component->getProperty('location', false, false)) 914 $sc['location'] = mb_convert_encoding($location, 'UTF-8', 'UTF-8,ISO-8859-1'); 915 916 917 918 if ($property = $component->getProperty('organizer', FALSE, TRUE)) { 919 $participant = array(); 920 $mailUser = trim(str_replace('MAILTO:', '', $property['value'])); 921 922 $participantID = mt_rand() . '2(Formatter)'; 923 924 $participant['isOrganizer'] = '1'; 925 926 $user = null; 927 928 $participant['isExternal'] = 1; 929 /* Gera um randon id para o contexto formater */ 930 $userID = mt_rand() . '4(Formatter)'; 931 932 $user['mail'] = $mailUser; 933 $organizerMail = $mailUser; 934 935 $user['name'] = ( isset($property['params']['CN']) ) ? $property['params']['CN'] : ''; 936 $user['isExternal'] = '1'; 937 $participant['user'] = $user; 938 939 $sc['participants'][] = $participant; 940 } 941 942 943 $participant['status'] = isset($params['status']) ? $params['status'] : STATUS_ACCEPTED; 944 $participant['isOrganizer'] = '0'; 945 $participant['isExternal'] = 0; 946 $participant['user'] = array('mail' => Config::me('mail'), 'name' => Config::me('cn')); 947 $sc['participants'][] = $participant; 948 $sc['type'] = TODO_ID; 949 950 951 $ical['source'] = Controller::format(array('service' => 'iCal'), array($sc), array('method' => 'REPLY')); 952 $ical['type'] = 'application/ics'; 953 $ical['name'] = 'outlook.ics'; 954 955 $ical2['source'] = $ical['source']; 956 $ical2['type'] = 'text/calendar; method=REPLY'; 957 $ical2['name'] = 'thunderbird.ics'; 958 959 $timezone = new DateTimeZone('UTC'); 960 $sTime = new DateTime('@' . (int) ($sc['startTime'] / 1000), $timezone); 961 $eTime = new DateTime('@' . (int) ($sc['endTime'] / 1000), $timezone); 962 963 if (isset($sc['timezone'])) { 964 $sTime->setTimezone(new DateTimeZone($sc['timezone'])); 965 $eTime->setTimezone(new DateTimeZone($sc['timezone'])); 966 } 967 968 $data = array('startDate' => date_format($sTime, 'd/m/Y'), 969 'startTime' => (isset($sc['allDay']) && $sc['allDay'] ) ? '' : date_format($sTime, 'H:i'), 970 'endDate' => date_format($eTime, 'd/m/Y'), 971 'endTime' => isset($sc['allDay']) ? '' : date_format($eTime, 'H:i'), 972 'eventTitle' => $sc['summary'], 973 'eventLocation' => isset($sc['location']) ? $sc['location'] : '', 974 'timezone' => ($sc['timezone']) ? $sc['timezone'] : 'UTC', 975 'participant' => (isset($part['user']['name']) ? $part['user']['name'] : $part['user']['mail'])); 976 977 $subject['notificationType'] = 'Convite Aceito'; 978 $subject['eventTitle'] = mb_convert_encoding($sc['summary'], 'ISO-8859-1', 'ISO-8859-1,UTF-8'); 979 $subject['startDate'] = date_format($sTime, 'd/m/Y'); 980 $subject['startTime'] = ($sc['allDay']) ? '' : date_format($sTime, 'H:i'); 981 $subject['endDate'] = date_format($eTime, 'd/m/Y'); 982 $subject['endTime'] = ($sc['allDay']) ? '' : date_format($eTime, 'H:i'); 983 $subject['participant'] = Config::me('uid'); 984 985 $params['status'] = isset($params['status']) ? $params['status'] : STATUS_ACCEPTED; 986 987 switch ($params['status']) { 988 case STATUS_ACCEPTED: 989 $tpl = 'notify_accept_body'; 990 $subject['notificationType'] = 'Convite Aceito'; 991 break; 992 case STATUS_TENTATIVE: 993 $tpl = 'notify_attempt_body'; 994 $subject['notificationType'] = 'Convite aceito provisoriamente'; 995 break; 996 case STATUS_CANCELLED: 997 $tpl = 'notify_reject_body'; 998 $subject['notificationType'] = 'Convite rejeitado'; 999 break; 1000 } 1001 1002 require_once ROOTPATH . '/api/parseTPL.php'; 1003 1004 $mail = array(); 1005 $mail['attachments'][] = $ical; 1006 $mail['attachments'][] = $ical2; 1007 1008 $mail['isHtml'] = true; 1009 $mail['body'] = parseTPL::load_tpl($data, ROOTPATH . '/modules/calendar/templates/' . $tpl . '.tpl'); 1010 $mail['subject'] = parseTPL::load_tpl($subject, ROOTPATH . '/modules/calendar/templates/notify_subject.tpl'); 1011 1012 $mail['from'] = '"' . Config::me('cn') . '" <' . Config::me('mail') . '>'; 1013 $mail['to'] = $organizerMail; 1014 1015 1016 Controller::create(array('service' => 'SMTP'), $mail); 1017 } 1018 } 1019 break; 1020 1021 case 'REFRESH': 1022 break; 1023 1024 case 'CANCEL': 1025 if ($schedulable = self::_getSchedulable($uid)) 1026 $interation['schedulable://' . $schedulable['id']] = false; 1027 break; 1028 1029 case 'ADD': 1030 break; 1031 1032 case 'REPLY': 1033 if ($schedulable = self::_getSchedulable($uid)) { 1034 while ($property = $component->getProperty('attendee', FALSE, TRUE)) 1035 if ($pID = self::_getParticipantByMail(str_replace('MAILTO:', '', $property['value']), $schedulable['participants'])) 1036 $interation['participant://' . $pID] = array('id' => $pID, 'status' => constant('STATUS_' . strtoupper($property['params']['PARTSTAT']))); 1037 1038 $interation['schedulable://' . $schedulable['id']]['sequence'] = $schedulable['sequence'] + 1; 1039 } 1040 break; 1041 1042 case 'COUNTER': 1043 if ($params['acceptedSuggestion'] !== 'false') { 1044 1045 $schedulable = self::_getSchedulable($uid); 1046 $params['calendar'] = self::_existInMyCalendars($schedulable['id'], $params['owner']); 1047 1048 $interation = self::_makeCOUNTER($schedulable, $component, $params); 1049 Config::regSet('noAlarm', FALSE); 1050 } else { 1051 $response = array(); 1052 $response['from'] = $params['from']; 1053 $response['type'] = 'suggestionResponse'; 1054 $response['status'] = 'DECLINECOUNTER'; 1055 $response['schedulable'] = self::_getSchedulable($uid); 1056 1057 Controller::create(array('concept' => 'notification'), $response); 1058 } 1059 break; 1060 1061 case 'DECLINECOUNTER': 1062 break; 1063 1064 default: 1065 1066 $schedulable = self::_getSchedulable($uid); 1067 1068 if ($schedulable && ( self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence'])) { //Caso o evento exista 1069 $interation = self::_makeVEVENT($schedulable, $component, $params); 1070 1071 if (!self::_existInMyCalendars($schedulable['id'], $params['owner'])) { 1072 $calendarToSchedulable = array(); 1073 $calendarToSchedulable['calendar'] = $params['calendar']; 1074 $calendarToSchedulable['schedulable'] = $schedulable['id']; 1075 $interation['calendarToSchedulable://' . mt_rand() . '(Formatter)'] = $calendarToSchedulable; 1076 } 1077 } 1078 else // Importar evento 1079 $interation = self::_makeVEVENT(array(), $component, $params); 1080 1081 break; 1082 } 1083 1084 $return[] = $interation; 1085 break; 1086 /***********************************************************************TODO*******************************************************************************/ 1087 case 'VTIMEZONE': 1088 break; 639 1089 } 640 1090 } … … 653 1103 $interation = array(); 654 1104 $uid = $component->getProperty('uid', false, false); //Resgata o uid do componente 655 656 1105 switch (strtoupper($component->objName)) { 657 1106 case 'VEVENT': … … 659 1108 switch ($method) { 660 1109 case 'PUBLISH': 661 $interation = ICAL_ACTION_IMPORT;1110 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 662 1111 break; 663 1112 … … 670 1119 foreach ($schedulable['participants'] as $value) 671 1120 if ($value['user']['id'] == $params['owner']) { 1121 $isParticipant = true; 1122 if ($value['isOrganizer']) 1123 $isOrganizer = true; 1124 1125 if (!self::_existInMyCalendars($schedulable['id'], $params['owner'])) { 1126 $interation = ICAL_ACTION_UPDATE; 1127 $interation = ( strrpos($value['acl'], ATTENDEE_ACL_PARTICIPATION_REQUIRED) ) ? ICAL_ACTION_IMPORT_REQUIRED : array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 1128 break; 1129 } 1130 } else { 1131 if (self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence']) //Organizador esta requisitando que você atualize o evento 1132 $interation = ($isOrganizer) ? ICAL_ACTION_ORGANIZER_UPDATE : ICAL_ACTION_UPDATE; 1133 else 1134 $interation = ($isOrganizer) ? ICAL_ACTION_ORGANIZER_NONE : ICAL_ACTION_NONE; 1135 } 1136 if (!$isParticipant){ 1137 $interation = self::_checkParticipantByPermissions($schedulable); 1138 } 1139 }else 1140 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 1141 1142 if(($interation != ICAL_ACTION_NONE) && ($interation != ICAL_ACTION_ORGANIZER_NONE) && ($interation != ICAL_ACTION_ORGANIZER_UPDATE) && ($interation != ICAL_ACTION_NONE)) { 1143 if($params['owner'] != Config::me("uidNumber")){ 1144 $sig = Controller::find(array('concept' => 'calendarSignature'), array('calendar'), array('filter' => array('AND', array('=', 'user', $params['owner']), array('=', 'isOwner', '1')))); 1145 $calendars = array(); 1146 foreach ($sig as $val) 1147 $calendars[] = $val['calendar']; 1148 1149 $calendarsPermission = Controller::find(array('concept' => 'calendarToPermission'), array('calendar'), array('filter' => array('AND', array('=', 'user', Config::me("uidNumber")), array('IN', 'calendar', $calendars)))); 1150 1151 foreach ($calendarsPermission as $val) 1152 $ids[] = $val['calendar']; 1153 1154 $interation = array('action' => ICAL_ACTION_IMPORT_FROM_PERMISSION ,'calendar' => $ids); 1155 } 1156 } 1157 1158 break; 1159 1160 case 'REFRESH': 1161 break; 1162 1163 case 'CANCEL': 1164 $interation = ICAL_ACTION_DELETE; 1165 break; 1166 1167 case 'ADD': 1168 break; 1169 1170 case 'REPLY': 1171 if ($schedulable = self::_getSchedulable($uid)) { 1172 while ($property = $component->getProperty('attendee', FALSE, TRUE)) 1173 if ($attendee = self::_getParticipantByMail(str_replace('MAILTO:', '', $property['value']), $schedulable['participants'], true)) 1174 $interation = (constant('STATUS_' . strtoupper($property['params']['PARTSTAT'])) == $attendee['status']) ? ICAL_ACTION_NONE : ICAL_ACTION_REPLY; 1175 }else 1176 $interation = ICAL_NOT_FOUND; 1177 break; 1178 1179 case 'COUNTER': 1180 $interation = ICAL_ACTION_SUGGESTION; 1181 break; 1182 1183 case 'DECLINECOUNTER': 1184 $interation = ICAL_ACTION_NONE; 1185 break; 1186 1187 default: 1188 $schedulable = self::_getSchedulable($uid); 1189 1190 if ($schedulable && ( self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence'])) //Caso o evento exista 1191 $interation = ICAL_ACTION_UPDATE; 1192 else if ($schedulable) 1193 $interation = ICAL_ACTION_NONE; 1194 else // Importar evento 1195 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 1196 1197 break; 1198 } 1199 1200 $return[$uid] = $interation; 1201 break; 1202 case 'VTODO': 1203 switch ($method) { 1204 case 'PUBLISH': 1205 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'groupIds'); 1206 break; 1207 1208 case 'REQUEST': 1209 $schedulable = self::_getSchedulable($uid); 1210 1211 if ($schedulable) { //Caso o evento exista 1212 $isOrganizer = false; 1213 $isParticipant = false; 1214 1215 foreach ($schedulable['participants'] as $value) 1216 if ($value['user']['id'] == $params['owner']) { 672 1217 $isParticipant = true; 673 1218 if ($value['isOrganizer']) 674 1219 $isOrganizer = true; 675 1220 676 if (!self::_existInMyCalendars($schedulable['id'], $params['owner'])) { 677 $interation = ICAL_ACTION_UPDATE; 678 $interation = ( strrpos($value['acl'], ATTENDEE_ACL_PARTICIPATION_REQUIRED) ) ? ICAL_ACTION_IMPORT_REQUIRED : ICAL_ACTION_IMPORT; 1221 if (!self::_existInMyCalendars($schedulable['id'], $params['owner'])) { 1222 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'groupIds'); 679 1223 break; 680 1224 } … … 689 1233 } 690 1234 }else 691 $interation = ICAL_ACTION_IMPORT; 692 693 if(($interation != ICAL_ACTION_NONE) && ($interation != ICAL_ACTION_ORGANIZER_NONE) && ($interation != ICAL_ACTION_ORGANIZER_UPDATE) && ($interation != ICAL_ACTION_NONE)) { 694 if($params['owner'] != Config::me("uidNumber")){ 695 $sig = Controller::find(array('concept' => 'calendarSignature'), array('calendar'), array('filter' => array('AND', array('=', 'user', $params['owner']), array('=', 'isOwner', '1')))); 696 $calendars = array(); 697 foreach ($sig as $val) 698 $calendars[] = $val['calendar']; 699 700 $calendarsPermission = Controller::find(array('concept' => 'calendarToPermission'), array('calendar'), array('filter' => array('AND', array('=', 'user', Config::me("uidNumber")), array('IN', 'calendar', $calendars)))); 701 702 foreach ($calendarsPermission as $val) 703 $ids[] = $val['calendar']; 704 705 $interation = array('action' => ICAL_ACTION_IMPORT_FROM_PERMISSION ,'calendar' => $ids); 706 } 707 } 708 1235 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'groupIds'); 709 1236 break; 710 1237 … … 739 1266 $interation = ICAL_ACTION_NONE; 740 1267 else // Importar evento 741 $interation = ICAL_ACTION_IMPORT;1268 $interation = array('action' => ICAL_ACTION_IMPORT, 'type' => 'groupIds'); 742 1269 743 1270 break; … … 747 1274 break; 748 1275 case 'VTIMEZONE': 749 750 751 break; 1276 break; 752 1277 } 753 1278 } … … 787 1312 } 788 1313 1314 public function decodeStatusTodo( $action ) 1315 { 1316 $a = array( 1317 'NEED_ACTION' => STATUS_TODO_NEED_ACTION, 1318 'IN_PROGRESS' => STATUS_TODO_IN_PROGRESS , 1319 'COMPLETED' => STATUS_TODO_COMPLETED , 1320 'CANCELLED' => STATUS_TODO_CANCELLED 1321 ); 1322 1323 return isset($a[$action]) ? $a[$action] : 'STATUS_TODO_NEED_ACTION'; 1324 1325 } 1326 1327 1328 private function _getStatusTodo($id) { 1329 $a = array( 1330 STATUS_TODO_NEED_ACTION => 'NEED_ACTION', 1331 STATUS_TODO_IN_PROGRESS => 'IN_PROGRESS', 1332 STATUS_TODO_COMPLETED => 'COMPLETED', 1333 STATUS_TODO_CANCELLED => 'CANCELLED' 1334 ); 1335 1336 return isset($a[$id]) ? $a[$id] : 'NEED_ACTION'; 1337 } 1338 789 1339 private static function _checkParticipantByPermissions($schedulable) { 790 1340 791 $calendarIds = Controller::find(array('concept' => 'calendarSignature'), array('calendar'), array('filter' => array('AND', array('=','isOwner','0'), array('=', 'user', Config::me("uidNumber")))));792 793 if($calendarIds && isset($calendarIds[0])){794 $ids = array();795 foreach($calendarIds as $value)796 array_push($ids, $value['calendar']);797 798 $signaturesOfOwners = Controller::find(array('concept' => 'calendarSignature'), false, array('filter' => array('AND', array('IN', 'calendar', $ids) , array('=','isOwner','1')), 'deepness' => 2 ));799 800 foreach($signaturesOfOwners as $value){801 if(self::_getParticipantByMail($value['user']['mail'], $schedulable['participants'])){802 $eventoFromCalendar = Controller::read( array( 'concept' => 'calendarToSchedulable') , false, array('filter' => array('AND', array('=','schedulable',$schedulable['id']), array('=','calendar', $value['calendar']['id']))));803 804 return ($eventoFromCalendar && isset($eventoFromCalendar[0])) ? ICAL_ACTION_NONE_FROM_PERMISSION : array('action' => ICAL_ACTION_IMPORT_FROM_PERMISSION, 'calendar' => array($value['calendar']['id']) );805 }806 }807 }808 return ICAL_ACTION_ORGANIZER_NONE;1341 $calendarIds = Controller::find(array('concept' => 'calendarSignature'), array('calendar'), array('filter' => array('AND', array('=','isOwner','0'), array('=', 'user', Config::me("uidNumber"))))); 1342 1343 if($calendarIds && isset($calendarIds[0])){ 1344 $ids = array(); 1345 foreach($calendarIds as $value) 1346 array_push($ids, $value['calendar']); 1347 1348 $signaturesOfOwners = Controller::find(array('concept' => 'calendarSignature'), false, array('filter' => array('AND', array('IN', 'calendar', $ids) , array('=','isOwner','1')), 'deepness' => 2 )); 1349 1350 foreach($signaturesOfOwners as $value){ 1351 if(self::_getParticipantByMail($value['user']['mail'], $schedulable['participants'])){ 1352 $eventoFromCalendar = Controller::read( array( 'concept' => 'calendarToSchedulable') , false, array('filter' => array('AND', array('=','schedulable',$schedulable['id']), array('=','calendar', $value['calendar']['id'])))); 1353 1354 return ($eventoFromCalendar && isset($eventoFromCalendar[0])) ? ICAL_ACTION_NONE_FROM_PERMISSION : array('action' => ICAL_ACTION_IMPORT_FROM_PERMISSION, 'calendar' => array($value['calendar']['id']) ); 1355 } 1356 } 1357 } 1358 return array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 809 1359 } 810 1360 811 1361 812 private static function _getParticipantByMail($mail, &$participants ) {1362 private static function _getParticipantByMail($mail, &$participants, $isFull = false) { 813 1363 if ($participants && $participants != '') 814 1364 foreach ($participants as $i => $v) 815 1365 if ((is_array($v) && isset($v['user'])) && ($v['user']['mail'] == $mail || (isset($v['user']['mailAlternateAddress']) && in_array($mail, $v['user']['mailAlternateAddress'])))) 816 return$v['id'];1366 return !!$isFull ? $v : $v['id']; 817 1367 return false; 818 1368 } … … 903 1453 904 1454 static private function _makeVEVENT($schedulable, $component, $params) { 1455 $interation = array(); 1456 $eventID = isset($schedulable['id']) ? $schedulable['id'] : mt_rand() . '(Formatter)'; 1457 1458 /* Data de Inicio */ 1459 $startTime = $component->getProperty('dtstart', false, true); 1460 1461 $tzid = (isset($startTime['params']['TZID']) ? $startTime['params']['TZID'] : $params['X-WR-TIMEZONE']); 1462 1463 /* Tiem zone do evento */ 1464 if ($tzid){ 1465 $tzid = self::nomalizeTZID($tzid); 1466 $schedulable['timezone'] = $tzid; 1467 }else 1468 $schedulable['timezone'] = isset($params['calendar_timezone']) ? $params['calendar_timezone'] : 'America/Sao_Paulo'; 1469 1470 $objTimezone = new DateTimeZone($schedulable['timezone']); 1471 1472 if (isset($startTime['params']['VALUE']) && $startTime['params']['VALUE'] === 'DATE' && isset($params['calendar_timezone'])) { 1473 $schedulable['allDay'] = 1; 1474 $schedulable['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($startTime['value'])) . '000'; 1475 } elseif ($tzid && !isset($startTime['value']['tz'])) {/* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */ 1476 $schedulable['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($startTime['value'])) . '000'; 1477 $schedulable['allDay'] = 0; 1478 } else { 1479 $schedulable['startTime'] = self::date2timestamp($startTime['value']) . '000'; 1480 if (strpos($params['prodid'], 'Outlook') !== false) { 1481 //Se o ics veio em utc não aplicar horario de verão 1482 $sTime = new DateTime('@' . (int) ($schedulable['startTime'] / 1000), new DateTimeZone('UTC')); 1483 $sTime->setTimezone($objTimezone); 1484 if ($sTime->format('I')) //Se o ics veio em utc não aplicar horario de verão 1485 $schedulable['startTime'] = $schedulable['startTime'] - 3600000; 1486 } 1487 } 1488 1489 /* Data de Termino */ 1490 $endTime = $component->getProperty('dtend', false, true); 1491 1492 $tzid = isset($endTime['params']['TZID']) ? $endTime['params']['TZID'] : $params['X-WR-TIMEZONE']; 1493 1494 if($tzid) 1495 $tzid = self::nomalizeTZID($tzid); 1496 1497 if (isset($endTime['params']['VALUE']) && $endTime['params']['VALUE'] === 'DATE') 1498 $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($endTime['value'])) . '000'; 1499 else if ($tzid && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */ 1500 $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($endTime['value'])) . '000'; 1501 else { 1502 $schedulable['endTime'] = self::date2timestamp($endTime['value']) . '000'; 1503 if (strpos($params['prodid'], 'Outlook') !== false) { 1504 //Se o ics veio em utc não aplicar horario de verão 1505 $eTime = new DateTime('@' . (int) ($schedulable['endTime'] / 1000), new DateTimeZone('UTC')); 1506 $eTime->setTimezone($objTimezone); 1507 if ($eTime->format('I')) 1508 $schedulable['endTime'] = $schedulable['endTime'] - 3600000; 1509 } 1510 } 1511 1512 1513 $schedulable['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 1514 1515 /* Definindo Description */ 1516 if ($desc = $component->getProperty('description', false, false)) 1517 $schedulable['description'] = mb_convert_encoding(str_ireplace(array('\n', '\t'), array("\n", "\t"), $desc), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 1518 1519 /* Definindo location */ 1520 if ($location = $component->getProperty('location', false, false)) 1521 $schedulable['location'] = mb_convert_encoding($location, 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 1522 1523 1524 /* Definindo Class */ 1525 $class = $component->getProperty('class', false, false); 1526 if ($class && defined(constant(strtoupper('CLASS_' . $class)))) 1527 $schedulable['class'] = constant(strtoupper('CLASS_' . $class)); 1528 else if (!isset($schedulable['class'])) 1529 $schedulable['class'] = CLASS_PRIVATE; // padrão classe private 1530 1531 /* Definindo RRULE */ 1532 if ($rrule = $component->getProperty('rrule', false, false)) { 1533 /* Gera um randon id para o contexto formater */ 1534 $repeatID = mt_rand() . '3(Formatter)'; 1535 1536 $repeat = array(); 1537 $repeat['schedulable'] = $eventID; 1538 foreach ($rrule as $i => $v) { 1539 if (strtolower($i) == 'freq') 1540 $repeat['frequency'] = $v; 1541 else if (strtolower($i) == 'until') 1542 $repeat['endTime'] = $v; 1543 else 1544 $repeat[strtolower($i)] = $v; 1545 } 1546 1547 $interation['repeat://' . $repeatID] = $repeat; 1548 } 1549 1550 1551 $schedulable['calendar'] = $params['calendar']; 1552 1553 $participantsInEvent = array(); 1554 1555 //TODO: Participants com delegated nao estao sendo levados em conta 1556 while ($property = $component->getProperty('attendee', FALSE, TRUE)) { 1557 $participant = array(); 1558 1559 $mailUser = trim(str_replace('MAILTO:', '', $property['value'])); 1560 1561 $participantID = ($tpID = self::_getParticipantByMail($mailUser, $schedulable['participants'])) ? $tpID : mt_rand() . '2(Formatter)'; 1562 $participant['schedulable'] = $eventID; 1563 1564 if (isset($params['status']) && $mailUser == Config::me('mail')) 1565 $participant['status'] = $params['status']; 1566 else 1567 $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 1568 1569 1570 $participant['isOrganizer'] = '0'; 1571 1572 /* Verifica se este usuario é um usuario interno do ldap */ 1573 $intUser = Controller::find(array('concept' => 'user'), array('id', 'isExternal'), array('filter' => array('OR', array('=', 'mail', $mailUser), array('=', 'mailAlternateAddress', $mailUser)))); 1574 1575 $user = null; 1576 if ($intUser && count($intUser) > 0) { 1577 $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 1578 $participant['user'] = $intUser[0]['id']; 1579 } else { 1580 $participant['isExternal'] = 1; 1581 /* Gera um randon id para o contexto formater */ 1582 $userID = mt_rand() . '4(Formatter)'; 1583 1584 $user['mail'] = $mailUser; 1585 $user['isExternal'] = '1'; 1586 $user['name'] = ( isset($property['params']['CN']) ) ? $property['params']['CN'] : ''; 1587 $user['participants'] = array($participantID); 1588 $participant['user'] = $userID; 1589 $interation['user://' . $userID] = $user; 1590 } 1591 1592 $interation['participant://' . $participantID] = $participant; 1593 $schedulable['participants'][] = $participantID; 1594 }; 1595 1596 if ($property = $component->getProperty('organizer', FALSE, TRUE)) { 1597 $participant = array(); 1598 $mailUser = trim(str_replace('MAILTO:', '', $property['value'])); 1599 1600 $participantID = mt_rand() . '2(Formatter)'; 1601 1602 $participant['schedulable'] = $eventID; 1603 $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 1604 $participant['isOrganizer'] = '1'; 1605 $participant['acl'] = 'rowi'; 1606 1607 /* Verifica se este usuario é um usuario interno do ldap */ 1608 $intUser = Controller::find(array('concept' => 'user'), array('id', 'isExternal'), array('filter' => array('OR', array('=', 'mail', $mailUser), array('=', 'mailAlternateAddress', $mailUser)))); 1609 1610 $user = null; 1611 if ($intUser && count($intUser) > 0) { 1612 $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 1613 $participant['user'] = $intUser[0]['id']; 1614 } else { 1615 $participant['isExternal'] = 1; 1616 /* Gera um randon id para o contexto formater */ 1617 $userID = mt_rand() . '4(Formatter)'; 1618 1619 $user['mail'] = $mailUser; 1620 $user['name'] = ( isset($property['params']['CN']) ) ? $property['params']['CN'] : ''; 1621 $user['participants'] = array($participantID); 1622 $user['isExternal'] = '1'; 1623 $participant['user'] = $userID; 1624 $interation['user://' . $userID] = $user; 1625 } 1626 1627 $interation['participant://' . $participantID] = $participant; 1628 $schedulable['participants'][] = $participantID; 1629 } else if (!isset($schedulable['participants']) || !is_array($schedulable['participants']) || count($schedulable['participants']) < 1) {//caso não tenha organizador o usuario se torna organizador 1630 $user = Controller::read(array('concept' => 'user', 'id' => $params['owner']), array('mail')); 1631 1632 if (!self::_getParticipantByMail($user['mail'], $schedulable['participants'])) { 1633 $participantID = mt_rand() . '2(Formatter)'; 1634 1635 $participant['schedulable'] = $eventID; 1636 $participant['status'] = STATUS_CONFIRMED; 1637 $participant['isOrganizer'] = '1'; 1638 $participant['acl'] = 'rowi'; 1639 $participant['isExternal'] = 0; 1640 $participant['user'] = $params['owner']; 1641 $interation['participant://' . $participantID] = $participant; 1642 $schedulable['participants'][] = $participantID; 1643 } 1644 } 1645 1646 $alarms = array(); 1647 1648 /* Definindo ALARMES */ 1649 while ($alarmComp = $component->getComponent('valarm')) 1650 { 1651 $alarm = array(); 1652 $alarmID = mt_rand() . '6(Formatter)'; 1653 $action = $alarmComp->getProperty('action', false, true); 1654 $trygger = $alarmComp->getProperty('trigger', false, true); 1655 $alarm['type'] = self::decodeAlarmAction($action['value']); 1656 1657 if(isset($trygger['value']['day'])) 1658 { 1659 $alarm['time'] = $trygger['value']['day']; 1660 $alarm['unit'] = 'd'; 1661 } 1662 else if(isset($trygger['value']['hour'])) 1663 { 1664 $alarm['time'] = $trygger['value']['hour']; 1665 $alarm['unit'] = 'h'; 1666 } 1667 else if(isset($trygger['value']['min'])) 1668 { 1669 $alarm['time'] = $trygger['value']['min']; 1670 $alarm['unit'] = 'm'; 1671 } 1672 1673 foreach ($interation as $iint => &$vint) 1674 { 1675 if(isset($vint['user']) && $vint['user'] == Config::me('uidNumber')) 1676 { 1677 $alarm['participant'] = str_replace('participant://', '', $iint); 1678 $vint['alarms'][] = $alarmID; 1679 } 1680 } 1681 $alarm['schedulable'] = $eventID; 1682 1683 $interation['alarm://' . $alarmID ] = $alarm; 1684 1685 } 1686 1687 1688 /* Definindo DTSTAMP */ 1689 if ($dtstamp = self::_getTime($component, 'dtstamp')) 1690 $schedulable['dtstamp'] = $dtstamp; 1691 1692 /* Definindo TRANSP */ 1693 if (($tranp = $component->getProperty('transp', false, true)) && $tranp && is_string($tranp) && strtoupper($tranp) == 'OPAQUE') 1694 $schedulable['transparent'] = 1; 1695 1696 /* Definindo last_update */ 1697 if ($lastUpdate = self::_getTime($component, 'LAST-MODIFIED')) 1698 $schedulable['lastUpdate'] = $lastUpdate; 1699 1700 1701 if ($sequence = $component->getProperty('SEQUENCE', false, false)) 1702 $schedulable['sequence'] = $sequence; 1703 1704 if ($uid = $component->getProperty('uid', false, false)) 1705 ; 1706 $schedulable['uid'] = $uid; 1707 1708 while ($attach = $component->getProperty('ATTACH', FALSE, TRUE)) { 1709 1710 $attachCurrent = array('name' => $attach['params']['X-FILENAME'], 1711 'size' => strlen($attach['value']), 1712 'type' => self::_getContentType($attach['params']['X-FILENAME']) 1713 ); 1714 1715 $ids = Controller::find(array('concept' => 'attachment'), array('id'), array('filter' => array('AND', array('=', 'name', $attachCurrent['name']), array('=', 'size', $attachCurrent['size']), array('=', 'type', $attachCurrent['type'])))); 1716 1717 if (!is_array($ids)) { 1718 $attachCurrent['source'] = $attach['value']; 1719 //insere o anexo no banco e pega id para colcar no relacionamento 1720 $idAttachment = Controller::create(array('concept' => 'attachment'), $attachCurrent); 1721 }else 1722 $idAttachment = array('id' => $ids[0]['id']); 1723 1724 $calendarToAttachmentId = mt_rand() . '2(Formatter)'; 1725 $calendarToAttachment['attachment'] = $idAttachment['id']; 1726 $calendarToAttachment['schedulable'] = $eventID; 1727 $interation['schedulableToAttachment://' . $calendarToAttachmentId] = $calendarToAttachment; 1728 1729 $schedulable['attachments'][] = $calendarToAttachmentId; 1730 } 1731 1732 $schedulable['type'] = '1'; 1733 1734 $interation['schedulable://' . $eventID] = $schedulable; 1735 1736 return $interation; 1737 } 1738 1739 static private function _makeVTODO($schedulable, $component, $params) { 905 1740 $interation = array(); 906 $ eventID = isset($schedulable['id']) ? $schedulable['id'] : mt_rand() . '(Formatter)';1741 $todoID = isset($schedulable['id']) ? $schedulable['id'] : mt_rand() . '(Formatter)'; 907 1742 908 1743 /* Data de Inicio */ … … 938 1773 939 1774 /* Data de Termino */ 940 $endTime = $component->getProperty('dtend', false, true); 941 942 $tzid = isset($endTime['params']['TZID']) ? $endTime['params']['TZID'] : $params['X-WR-TIMEZONE']; 943 944 if($tzid) 945 $tzid = self::nomalizeTZID($tzid); 946 947 if (isset($endTime['params']['VALUE']) && $endTime['params']['VALUE'] === 'DATE') 948 $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($endTime['value'])) . '000'; 949 else if ($tzid && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */ 950 $schedulable['endTime'] = self::date2timestamp($endTime['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($endTime['value'])) . '000'; 951 else { 952 $schedulable['endTime'] = self::date2timestamp($endTime['value']) . '000'; 953 if (strpos($params['prodid'], 'Outlook') !== false) { 954 //Se o ics veio em utc não aplicar horario de verão 955 $eTime = new DateTime('@' . (int) ($schedulable['endTime'] / 1000), new DateTimeZone('UTC')); 956 $eTime->setTimezone($objTimezone); 957 if ($eTime->format('I')) 958 $schedulable['endTime'] = $schedulable['endTime'] - 3600000; 959 } 960 } 961 962 1775 if($due = $component->getProperty('due', false, true)){ 1776 1777 $tzid = isset($due['params']['TZID']) ? $due['params']['TZID'] : $params['X-WR-TIMEZONE']; 1778 1779 if($tzid) 1780 $tzid = self::nomalizeTZID($tzid); 1781 1782 if (isset($due['params']['VALUE']) && $due['params']['VALUE'] === 'DATE') 1783 $schedulable['due'] = self::date2timestamp($due['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($due['value'])) . '000'; 1784 else if ($tzid && !isset($endTime['value']['tz'])) /* Caso não tenha um tz na data mais exista um parametro TZID deve ser aplicado o timezone do TZID a data */ 1785 $schedulable['due'] = self::date2timestamp($due['value']) - self::_getTzOffset('UTC', $tzid, '@' . self::date2timestamp($due['value'])) . '000'; 1786 else { 1787 $schedulable['due'] = self::date2timestamp($due['value']) . '000'; 1788 if (strpos($params['prodid'], 'Outlook') !== false) { 1789 //Se o ics veio em utc não aplicar horario de verão 1790 $dueTime = new DateTime('@' . (int) ($schedulable['due'] / 1000), new DateTimeZone('UTC')); 1791 $dueTime->setTimezone($objTimezone); 1792 1793 if ($dueTime->format('I')) 1794 $schedulable['due'] = $schedulable['due'] - 3600000; 1795 } 1796 } 1797 $schedulable['endTime'] = $schedulable['due']; 1798 }else 1799 $schedulable['endTime'] = $schedulable['startTime']; 1800 1801 $schedulable['type'] = '2'; //type schedulable 963 1802 $schedulable['summary'] = mb_convert_encoding($component->getProperty('summary', false, false), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 964 1803 … … 966 1805 if ($desc = $component->getProperty('description', false, false)) 967 1806 $schedulable['description'] = mb_convert_encoding(str_ireplace(array('\n', '\t'), array("\n", "\t"), $desc), 'ISO-8859-1', 'UTF-8,ISO-8859-1'); 968 969 /* Definindo location */970 if ($location = $component->getProperty('location', false, false))971 $schedulable['location'] = mb_convert_encoding($location, 'ISO-8859-1', 'UTF-8,ISO-8859-1');972 973 1807 974 1808 /* Definindo Class */ … … 979 1813 $schedulable['class'] = CLASS_PRIVATE; // padrão classe private 980 1814 981 /* Definindo RRULE */982 if ($rrule = $component->getProperty('rrule', false, false)) {983 /* Gera um randon id para o contexto formater */984 $repeatID = mt_rand() . '3(Formatter)';985 986 $repeat = array();987 $repeat['schedulable'] = $eventID;988 foreach ($rrule as $i => $v) {989 if (strtolower($i) == 'freq')990 $repeat['frequency'] = $v;991 else if (strtolower($i) == 'until')992 $repeat['endTime'] = $v;993 else994 $repeat[strtolower($i)] = $v;995 }996 997 $interation['repeat://' . $repeatID] = $repeat;998 }999 1000 1001 1815 $schedulable['calendar'] = $params['calendar']; 1002 1816 1003 $participantsIn Event= array();1004 1005 //TODO: Participants com delegated n ão estao sendo levados em conta1817 $participantsInTodo = array(); 1818 1819 //TODO: Participants com delegated nao estao sendo levados em conta 1006 1820 while ($property = $component->getProperty('attendee', FALSE, TRUE)) { 1007 1821 $participant = array(); … … 1010 1824 1011 1825 $participantID = ($tpID = self::_getParticipantByMail($mailUser, $schedulable['participants'])) ? $tpID : mt_rand() . '2(Formatter)'; 1012 $participant['schedulable'] = $ eventID;1826 $participant['schedulable'] = $todoID; 1013 1827 1014 1828 if (isset($params['status']) && $mailUser == Config::me('mail')) … … 1050 1864 $participantID = mt_rand() . '2(Formatter)'; 1051 1865 1052 $participant['schedulable'] = $ eventID;1866 $participant['schedulable'] = $todoID; 1053 1867 $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 1054 1868 $participant['isOrganizer'] = '1'; … … 1077 1891 $interation['participant://' . $participantID] = $participant; 1078 1892 $schedulable['participants'][] = $participantID; 1079 } else if (!is_array($schedulable['participants']) || count($schedulable['participants']) < 1) {//caso não tenha organizador o usuario se torna organizador1893 } else if (!isset($schedulable['participants']) || !is_array($schedulable['participants']) || count($schedulable['participants']) < 1) {//caso não tenha organizador o usuario se torna organizador 1080 1894 $user = Controller::read(array('concept' => 'user', 'id' => $params['owner']), array('mail')); 1081 1895 … … 1083 1897 $participantID = mt_rand() . '2(Formatter)'; 1084 1898 1085 $participant['schedulable'] = $ eventID;1899 $participant['schedulable'] = $todoID; 1086 1900 $participant['status'] = STATUS_CONFIRMED; 1087 1901 $participant['isOrganizer'] = '1'; … … 1180 1994 } 1181 1995 1182 $interation['schedulable://' . $ eventID] = $schedulable;1183 1184 1996 $interation['schedulable://' . $todoID] = $schedulable; 1997 1998 return $interation; 1185 1999 } 1186 2000 … … 1191 2005 1192 2006 static private function _existInMyCalendars($id, $owner) { 1193 $sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', 'user', $owner), array('=', 'isOwner', '1')))); 2007 $sig = Controller::find(array('concept' => 'calendarSignature'), array('user', 'calendar', 'isOwner'), array('filter' => array('AND', array('=', 'isOwner', '1'), array('=', 'user', $owner)))); 2008 $sig2 = Controller::find(array('concept' => 'calendarToPermission'), array('calendar'), array('filter' => array('AND', array('*', 'acl', 'w'), array('=', 'user', $owner)))); 2009 1194 2010 $calendars = array(); 1195 foreach ($sig as $val) 1196 $calendars[] = $val['calendar']; 2011 if(is_array($sig)) 2012 foreach ($sig as $val) 2013 $calendars[] = $val['calendar']; 2014 if(is_array($sig2)) 2015 foreach ($sig2 as $val) 2016 $calendars[] = $val['calendar']; 2017 1197 2018 1198 2019 $return = Controller::find(array('concept' => 'calendarToSchedulable'), null, array('filter' => array('AND', array('IN', 'calendar', $calendars), array('=', 'schedulable', $id)))); -
branches/2.4/prototype/timezones.php
r7069 r7228 1 <?php 2 3 $zones = timezone_identifiers_list(); 4 $Time = new DateTime('now', new DateTimeZone('UTC')); 5 $timezone = array(); 6 7 8 foreach ($zones as $zone) 1 <?php 2 3 $zones = timezone_identifiers_list(); 4 $Time = new DateTime('now', new DateTimeZone('UTC')); 5 $timezone = array(); 6 7 8 foreach ($zones as $zone) 9 9 { 10 $timezone['timezones'][$zone] = $Time->setTimezone(new DateTimeZone($zone))->format('O'); 10 $timezone['timezones'][$zone] = $Time->setTimezone(new DateTimeZone($zone))->format('O'); 11 11 } 12 12 13 $localtime = localtime(time(), true); 14 $timezone['isDaylightSaving'] = !!$localtime['tm_isdst']; 15 16 echo json_encode($timezone); 17 18 ?> 13 $localtime = localtime(time(), true); 14 $timezone['isDaylightSaving'] = !!$localtime['tm_isdst']; 15 16 echo json_encode($timezone); 17 18 ?>
Note: See TracChangeset
for help on using the changeset viewer.