Changeset 5888 for sandbox/2.4-expresso-api
- Timestamp:
- 04/05/12 17:00:04 (12 years ago)
- Location:
- sandbox/2.4-expresso-api
- Files:
-
- 237 added
- 13 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
sandbox/2.4-expresso-api
- Property svn:ignore
-
old new 2 2 header.inc.php 3 3 ._header.inc.php 4 .htaccess.swp
-
- Property svn:ignore
-
sandbox/2.4-expresso-api/.htaccess
r5419 r5888 126 126 RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK|OPTIONS|HEAD)$ [NC] 127 127 RewriteRule ^.*$ - [F] 128 RewriteRule ^rest(.*)$ prototype/rest/$1 [QSA,L] 128 129 129 130 # -
sandbox/2.4-expresso-api/home.php
r5042 r5888 98 98 echo parse_navbar(); 99 99 } 100 // Default Applications (Home Page)101 $default_apps = Array(102 'workflow',103 'expressoMail1_2',104 'calendar',105 'news_admin'106 );107 $sorted_apps = array();108 $user_apps = $GLOBALS['phpgw_info']['user']['apps'];109 @reset($user_apps);110 for($i = 0; $i < count($default_apps);$i++) {111 if(array_key_exists($default_apps[$i], $user_apps)){112 $sorted_apps[] = $default_apps[$i];113 }114 }115 116 foreach($GLOBALS['phpgw_info']['user']['apps'] as $i => $p) {117 $sorted_apps[] = $p['name'];118 }119 120 $portal_oldvarnames = array('mainscreen_showevents', 'homeShowEvents','homeShowLatest','mainscreen_showmail','mainscreen_showbirthdays','mainscreen_show_new_updated');121 $done = array();122 // Display elements, within appropriate table cells123 @reset($sorted_apps);124 $idx = 1;125 echo "<table width='100%' cellpadding=5>";126 foreach($sorted_apps as $appname)127 {128 if((int)$done[$appname] == 1 || empty($appname)){129 continue;130 }131 $varnames = $portal_oldvarnames;132 $varnames[] = 'homepage_display';133 $thisd = 0;134 $tmp = '';135 136 foreach($varnames as $varcheck)137 {138 139 /*if($appname == 'expressoMail1_2') {140 $tmp = $appname;141 $appname = 'expressoMail';142 }*/143 100 144 if(array_search($appname, $default_apps) !== False){ 145 $thisd = 1; 146 break; 147 } 148 if($GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]=='True') { 149 $thisd = 1; 150 break; 151 } 152 else { 153 $_thisd = (int)$GLOBALS['phpgw_info']['user']['preferences'][$appname][$varcheck]; 154 if($_thisd > 0) { 155 $thisd = $_thisd; 156 break; 157 } 158 } 159 } 101 //Inicio 102 echo ' 103 <link rel="Stylesheet" type="text/css" href="prototype/plugins/jquery/jquery-ui.css" /> 104 105 <script type="text/javascript" src="prototype/plugins/jquery/jquery.min.js"></script> 106 107 <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.min.js"></script> 108 <script type="text/javascript" src="prototype/plugins/jquery/jquery-ui.custom.min.js"></script> 109 <script src="prototype/plugins/json2/json2.js" language="javascript"></script> 110 <script src="prototype/plugins/ejs/ejs.js" language="javascript"></script> 111 <script src="prototype/plugins/store/jquery.store.js" language="javascript"></script> 112 113 <script src="prototype/api/datalayer.js" language="javascript"></script> 114 115 <script type="text/javascript" src="prototype/plugins/datejs/date-pt-BR.js"></script> 116 <script type="text/javascript" src="prototype/plugins/datejs/sugarpak.js"></script> 117 <script type="text/javascript" src="prototype/plugins/datejs/parser.js"></script> 160 118 161 if($thisd > 0) 162 { 163 if($tmp) { 164 $appname = $tmp; 165 $tmp = ''; 166 } 167 if($idx == 0) { 168 print '<tr>'; 169 } 170 print '<td style="vertical-align:top;" width="45%">'; 171 $GLOBALS['phpgw']->hooks->single('home',$appname); 172 print '</td>'; 173 174 if($idx == 2){ 175 $idx = 0; 176 print '</tr>'; 177 } 178 $idx++; 179 $neworder[] = $appname; 180 } 181 $done[$appname] = 1; 182 } 183 print '</table>'; 119 <script type="text/javascript" src="prototype/plugins/countdown/jquery.countdown.min.js"></script> 120 <script type="text/javascript" src="prototype/plugins/countdown/jquery.countdown-pt-BR.js"></script> 121 122 <script type="text/javascript" src="prototype/modules/home/js/home.js"></script> 123 <link rel="Stylesheet" type="text/css" href="prototype/modules/home/css/home.css" /> 124 '; 125 126 echo' 127 <tr> 128 <td> 129 <div class="portlets" style="width: 100%;"></div> 130 <td> 131 </tr>'; 132 133 //Fim 184 134 $GLOBALS['phpgw']->common->phpgw_footer(); 185 135 ?> -
sandbox/2.4-expresso-api/phpgwapi/templates/default/login_default.php
r5281 r5888 177 177 else 178 178 $_POST['login'] = $_POST['user']; 179 180 /** 181 * LOGIN OAUTH POR CURL 182 */ 183 $ch = curl_init(); 184 185 $param = 'grant_type=password'; 186 $param .= '&client_id=' . $GLOBALS['oauth']['client_id']; 187 $param .= '&client_secret=' . $GLOBALS['oauth']['client_secret']; 188 $param .= '&username=' . $_POST['user']; 189 $param .= '&password=' . $_POST['passwd']; 190 191 // set URL and other appropriate options 192 curl_setopt($ch, CURLOPT_URL, $GLOBALS['oauth']['url_token']); 193 curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: */*')); 194 curl_setopt($ch, CURLOPT_POST, TRUE); 195 curl_setopt($ch, CURLOPT_POSTFIELDS, $param); 196 curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); //configura para nao imprimir a saida na tela 197 curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);//Passe um nï¿œmero long como parï¿œmetro que contï¿œm o limite de tempo, em segundos, que vocï¿œ permite as funᅵᅵes CURL levar. 198 199 // grab URL and pass it to the browser 200 $res = curl_exec($ch); 201 202 // close cURL resource, and free up system resources 203 curl_close($ch); 204 $a = json_decode($res); 205 206 if ( isset($a->access_token) ) { 207 $_SESSION['oauth']['access_token'] = $a->access_token; 208 $_SESSION['oauth']['expires_in'] = $a->expires_in; 209 $_SESSION['oauth']['token_type'] = $a->token_type; 210 $_SESSION['oauth']['scope'] = $a->scope; 211 $_SESSION['oauth']['refresh_token'] = $a->refresh_token; 212 213 214 } 215 else { 216 } 217 /** 218 * #################### 219 */ 220 179 221 } 180 222 if(getenv('REQUEST_METHOD') != 'POST' && $_SERVER['REQUEST_METHOD'] != 'POST' && … … 598 640 if(isset($ultima_revisao)) $tmpl->set_var('ultima_rev','<br>' . $ultima_revisao); 599 641 600 // Adiciona c ódigo personalizado de outro template642 // Adiciona cï¿œdigo personalizado de outro template 601 643 // que esteja utilizando o login_default.php 602 644 if(is_file('.'.$template_dir.'/login.inc.php')) { -
sandbox/2.4-expresso-api/prototype/api
-
Property
svn:ignore
set to
.datalayer.js.kate-swp
-
Property
svn:ignore
set to
-
sandbox/2.4-expresso-api/prototype/api/config.php
r5764 r5888 20 20 21 21 static function me($config) 22 { 23 22 { 24 23 return isset($_SESSION['wallet']['user'][$config]) ? $_SESSION['wallet']['user'][$config] : false; 25 24 } -
sandbox/2.4-expresso-api/prototype/api/datalayer.js
r5724 r5888 221 221 222 222 return( result ); 223 }, 224 225 /** 226 * This method is used to read resources from the server. 227 * 228 * @param uri Uri of the resource that gonna be readed. 229 * @param callback A function that is called when the resource is loaded successfully. When the parameter is ignored the request is made synchrounsly. 230 * @param accept The attribute accept that is used to ask the target format to the server 231 * @return The target resource when the callback is ommitted ( made it synchronous ) 232 */ 233 234 read: function( uri, callback, accept ){ 235 //return this.send( this.dispatchPath + 'rest' + uri, [ 'get', accept || 'json' ], false, callback ); 236 //http://expressodev.prognus.com.br/cristiano/expresso-api/rest/maillast 237 238 return this.send( ('rest' + uri), [ 'get', accept || 'json' ], true, callback, !!!callback, 239 {'beforeSend' : function (xhr){ 240 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 241 }); 242 243 }, 244 245 /** 246 * This method is used to create resources from the server. 247 * 248 * @param uri Uri of the resource that gonna be readed. 249 * @param callback A function that is called when the resource is created on the server successfully. When the parameter is ignored the request is made synchrounsly. 250 * @param accept The attribute accept that is used to ask the target format to the server. 251 * @return The result response of the create from the server when the callback is ommitted ( made it synchronous ) 252 */ 253 254 create: function( uri, data, callback, accept ){ 255 256 return this.send( this.dispatchPath + 'rest' + uri, [ 'post', accept || 'json' ], data, callback, !!!callback, 257 {'beforeSend' : function (xhr){ 258 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 259 }); 260 261 }, 262 263 /** 264 * This method is used to update resources from the server. 265 * 266 * @param uri Uri of the resource that gonna be readed. 267 * @param callback A function that is called when the resource is update on the server successfully. When the parameter is ignored the request is made synchrounsly. 268 * @param accept The attribute accept that is used to ask the target format to the server 269 * @return The result response of the update from the server when the callback is ommitted ( made it synchronous ) 270 */ 271 272 update: function( uri, data, callback, accept ){ 273 274 return this.send( this.dispatchPath + 'rest' + uri, [ 'put', accept || 'json' ], data, callback, !!!callback, 275 {'beforeSend' : function (xhr){ 276 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 277 }); 278 279 }, 280 281 /** 282 * This method is used to delete resources from the server. 283 * 284 * @param uri Uri of the resource that gonna be readed. 285 * @param callback A function that is called when the resource is deleted successfully in the server. When the parameter is ignored the request is made synchrounsly. 286 * @param accept The attribute accept that is used to ask the target format to the server 287 * @return The result response of the delete from the server when the callback is ommitted ( made it synchronous ) 288 */ 289 290 "delete": function( uri, callback, accept ){ 291 292 return this.send( this.dispatchPath + 'rest' + uri, [ 'delete', accept || 'json' ], false, callback, !!!callback, 293 {'beforeSend' : function (xhr){ 294 xhr.setRequestHeader('Authorization', "OAUTH Bearer " + DataLayer.me.token)} 295 }); 296 223 297 }, 224 298 … … 1991 2065 1992 2066 if( !this.dispatchPath ) 1993 this.dispatchPath = " ../../";2067 this.dispatchPath = "prototype/"; 1994 2068 1995 2069 if( !this.templatePath ) … … 2006 2080 2007 2081 this.start(); 2082 this.me = this.dispatch( "me" ); 2008 2083 } 2009 2084 } -
sandbox/2.4-expresso-api/prototype/config/OpenLDAP.srv
r5534 r5888 5 5 host = 127.0.0.1 6 6 7 ;context = dc=exemplo.com 8 ;user = 9 ;password = 7 context = "dc=prognus" 8 user = "cn=admin,dc=prognus" 9 password = "prognus" -
sandbox/2.4-expresso-api/prototype/config/PostgreSQL.srv
r5534 r5888 3 3 [config] 4 4 port = 5432 5 dbname= expresso 5 dbname= expresso24cristianoAPI 6 6 user=postgres 7 host = /var/run/postgresql 8 ;conexão via tcp 7 host = /tmp 9 8 ;host = 127.0.0.1 10 9 -
sandbox/2.4-expresso-api/prototype/config/oauthCliente.ini
r5514 r5888 1 ; [service] 2 ; OpenLDAP = '' 3 ; PostgreSQL = external 4 ; 5 ; [service.conflict] 6 ; checkExternal = modules/calendar/interceptors/DBMapping.php 7 8 service = OpenLDAP 9 PostgreSQL.concept = calendar_ex_participant 10 11 [model.hasMany] 12 participants = participant.user 13 14 [PostgreSQL.before.create] 15 insertOwnerLink = modules/calendar/interceptors/DBMapping.php 16 17 [OpenLDAP.before.create] 18 encodeURIUser = modules/calendar/interceptors/DBMapping.php 19 encodeCreateConcept = modules/calendar/interceptors/DBMapping.php 20 21 [OpenLDAP.before.find] 22 encodeFindUser = modules/calendar/interceptors/LDAPMapping.php 23 24 [OpenLDAP.after.find] 25 findExternalPaticipants = modules/calendar/interceptors/DBMapping.php 26 27 [before.update] 28 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 29 30 [before.create] 31 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 1 service = PostgreSQL 2 PostgreSQL.concept = clients 32 3 33 4 [PostgreSQL.mapping] 34 id = id 35 name = name 36 mail = mail 37 owner = owner 38 39 [OpenLDAP.mapping] 40 id = uidNumber 41 name = cn 42 mail = mail 43 uid = uid 44 givenName = givenName 45 sn = sn 46 displayName = displayName 47 mailAlternateAddress = mailAlternateAddress 48 phpgwAccountStatus = phpgwAccountStatus 49 accountStatus = accountStatus 50 objectClass = objectClass 51 phpgwAccountType = phpgwAccountType 52 phpgwAccountVisible = phpgwAccountVisible 5 client_id = client_id 6 client_secret = client_secret 7 redirect_uri = redirect_uri -
sandbox/2.4-expresso-api/prototype/config/oauthCode.ini
r5514 r5888 1 ; [service] 2 ; OpenLDAP = '' 3 ; PostgreSQL = external 4 ; 5 ; [service.conflict] 6 ; checkExternal = modules/calendar/interceptors/DBMapping.php 7 8 service = OpenLDAP 9 PostgreSQL.concept = calendar_ex_participant 10 11 [model.hasMany] 12 participants = participant.user 13 14 [PostgreSQL.before.create] 15 insertOwnerLink = modules/calendar/interceptors/DBMapping.php 16 17 [OpenLDAP.before.create] 18 encodeURIUser = modules/calendar/interceptors/DBMapping.php 19 encodeCreateConcept = modules/calendar/interceptors/DBMapping.php 20 21 [OpenLDAP.before.find] 22 encodeFindUser = modules/calendar/interceptors/LDAPMapping.php 23 24 [OpenLDAP.after.find] 25 findExternalPaticipants = modules/calendar/interceptors/DBMapping.php 26 27 [before.update] 28 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 29 30 [before.create] 31 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 1 service = PostgreSQL 2 PostgreSQL.concept = auth_codes 32 3 33 4 [PostgreSQL.mapping] 34 id = id 35 name = name 36 mail = mail 37 owner = owner 38 39 [OpenLDAP.mapping] 40 id = uidNumber 41 name = cn 42 mail = mail 43 uid = uid 44 givenName = givenName 45 sn = sn 46 displayName = displayName 47 mailAlternateAddress = mailAlternateAddress 48 phpgwAccountStatus = phpgwAccountStatus 49 accountStatus = accountStatus 50 objectClass = objectClass 51 phpgwAccountType = phpgwAccountType 52 phpgwAccountVisible = phpgwAccountVisible 5 redirect_uri = redirect_uri 6 scope = scope 7 expires = expires 8 code = code 9 client_id = client_id 10 user_id = user_id -
sandbox/2.4-expresso-api/prototype/config/oauthRefreshToken.ini
r5514 r5888 1 ; [service] 2 ; OpenLDAP = '' 3 ; PostgreSQL = external 4 ; 5 ; [service.conflict] 6 ; checkExternal = modules/calendar/interceptors/DBMapping.php 7 8 service = OpenLDAP 9 PostgreSQL.concept = calendar_ex_participant 10 11 [model.hasMany] 12 participants = participant.user 13 14 [PostgreSQL.before.create] 15 insertOwnerLink = modules/calendar/interceptors/DBMapping.php 16 17 [OpenLDAP.before.create] 18 encodeURIUser = modules/calendar/interceptors/DBMapping.php 19 encodeCreateConcept = modules/calendar/interceptors/DBMapping.php 20 21 [OpenLDAP.before.find] 22 encodeFindUser = modules/calendar/interceptors/LDAPMapping.php 23 24 [OpenLDAP.after.find] 25 findExternalPaticipants = modules/calendar/interceptors/DBMapping.php 26 27 [before.update] 28 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 29 30 [before.create] 31 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 1 service = PostgreSQL 2 PostgreSQL.concept = refresh_tokens 32 3 33 4 [PostgreSQL.mapping] 34 id = id 35 name = name 36 mail = mail 37 owner = owner 38 39 [OpenLDAP.mapping] 40 id = uidNumber 41 name = cn 42 mail = mail 43 uid = uid 44 givenName = givenName 45 sn = sn 46 displayName = displayName 47 mailAlternateAddress = mailAlternateAddress 48 phpgwAccountStatus = phpgwAccountStatus 49 accountStatus = accountStatus 50 objectClass = objectClass 51 phpgwAccountType = phpgwAccountType 52 phpgwAccountVisible = phpgwAccountVisible 5 refresh_token = refresh_token 6 client_id = client_id 7 user_id = user_id 8 expires = expires 9 scope = scope 10 refresh_token = refresh_token -
sandbox/2.4-expresso-api/prototype/config/oauthToken.ini
r5514 r5888 1 ; [service] 2 ; OpenLDAP = '' 3 ; PostgreSQL = external 4 ; 5 ; [service.conflict] 6 ; checkExternal = modules/calendar/interceptors/DBMapping.php 7 8 service = OpenLDAP 9 PostgreSQL.concept = calendar_ex_participant 10 11 [model.hasMany] 12 participants = participant.user 13 14 [PostgreSQL.before.create] 15 insertOwnerLink = modules/calendar/interceptors/DBMapping.php 16 17 [OpenLDAP.before.create] 18 encodeURIUser = modules/calendar/interceptors/DBMapping.php 19 encodeCreateConcept = modules/calendar/interceptors/DBMapping.php 20 21 [OpenLDAP.before.find] 22 encodeFindUser = modules/calendar/interceptors/LDAPMapping.php 23 24 [OpenLDAP.after.find] 25 findExternalPaticipants = modules/calendar/interceptors/DBMapping.php 26 27 [before.update] 28 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 29 30 [before.create] 31 encodeServiceUser = modules/calendar/interceptors/DBMapping.php 1 service = PostgreSQL 2 PostgreSQL.concept = access_tokens 32 3 33 4 [PostgreSQL.mapping] 34 id = id 35 name = name 36 mail = mail 37 owner = owner 38 39 [OpenLDAP.mapping] 40 id = uidNumber 41 name = cn 42 mail = mail 43 uid = uid 44 givenName = givenName 45 sn = sn 46 displayName = displayName 47 mailAlternateAddress = mailAlternateAddress 48 phpgwAccountStatus = phpgwAccountStatus 49 accountStatus = accountStatus 50 objectClass = objectClass 51 phpgwAccountType = phpgwAccountType 52 phpgwAccountVisible = phpgwAccountVisible 5 oauth_token = oauth_token 6 client_id = client_id 7 user_id = user_id 8 expires = expires 9 scope = scope 10 refresh_token = refresh_token -
sandbox/2.4-expresso-api/prototype/config/user.ini
r5514 r5888 23 23 24 24 [OpenLDAP.after.find] 25 findExternalPaticipants = modules/calendar/interceptors/DBMapping.php25 ;findExternalPaticipants = modules/calendar/interceptors/DBMapping.php 26 26 27 27 [before.update] … … 51 51 phpgwAccountType = phpgwAccountType 52 52 phpgwAccountVisible = phpgwAccountVisible 53 password = userPassword -
sandbox/2.4-expresso-api/prototype/me.php
r5399 r5888 4 4 5 5 $me = Controller::read(array('concept' => 'user', 'service' => 'OpenLDAP' , 'id' => Config::me('uidNumber'))); 6 6 $me['token'] = $_SESSION['oauth']['access_token']; 7 7 echo json_encode( $me ); 8 8 -
sandbox/2.4-expresso-api/prototype/modules/calendar/interceptors/DBMapping.php
r5752 r5888 175 175 $lastExceptions = Controller::find( array( 'concept' => 'repeatOccurrence' ), array("occurrence") , array( 'filter' => array('AND', array( '=', 'repeat', $id ) , array( '=', 'exception', 1 ) ) )); 176 176 177 //Recurepa as exece ções anteriores caso exista177 //Recurepa as execeᅵᅵes anteriores caso exista 178 178 if(isset($lastExceptions) && count($lastExceptions)) 179 179 foreach($lastExceptions as $key => $value) … … 236 236 if( $start || $end ) 237 237 { 238 Controller::begin( array( 'service' => 'PostgreSQL') );238 //Controller::begin( array( 'service' => 'PostgreSQL') ); 239 239 240 240 foreach( $result as $id => $res ) … … 334 334 $u = $result->format('U') * 1000; 335 335 336 if( $u > $end ) //data da repeti ção atual maior que a data final da busca do usuario ?336 if( $u > $end ) //data da repetiᅵᅵo atual maior que a data final da busca do usuario ? 337 337 break; 338 338 … … 632 632 $result[$i]['calendar'] = Controller::read( array( 'concept' => 'calendar' , 'id' => $v['calendar']), false, false); 633 633 $result[$i]['defaultAlarms'] = Controller::find( array( 'concept' => 'calendarSignatureAlarm' ) , false ,array( 'filter' => array('=', 'calendarSignature' , $v['id']) )); 634 //Caso n ão seja o dono da agenda retorna o objeto permission com as acls634 //Caso nï¿œo seja o dono da agenda retorna o objeto permission com as acls 635 635 if($result[$i]['isOwner'] == 0){ 636 636 $permission = Controller::find( array( 'concept' => 'calendarToPermission'), false ,array( 'filter' => array('AND', array('=', 'calendar' , $v['calendar']), array('=', 'user', Config::me('uidNumber') ) ) ) ); … … 749 749 ))); 750 750 751 return false; /* Mata o restante da execu ção */751 return false; /* Mata o restante da execuᅵᅵo */ 752 752 } 753 753 … … 786 786 public function createDefaultSignature( &$uri , &$result , &$criteria , $original ){ 787 787 788 //Caso uma busca n ão retorne nenhum resultado e foi buscado pelas assinaturas do usuario logado apenas788 //Caso uma busca nï¿œo retorne nenhum resultado e foi buscado pelas assinaturas do usuario logado apenas 789 789 if(count($result) <= 0 && 790 790 ( $original['criteria']['filter'][0] == '=' && … … 837 837 else 838 838 { 839 //Criaremos uma agenda padr ão839 //Criaremos uma agenda padrï¿œo 840 840 $cal = array('name' => 'Calendario', 841 'description' => 'Calendario Padr ão',841 'description' => 'Calendario Padrï¿œo', 842 842 'timezone' => (date_default_timezone_get()) ? date_default_timezone_get() : 'America/Sao_Paulo', 843 843 'dtstamp' => time().'000' -
sandbox/2.4-expresso-api/prototype/services/OpenLDAP.php
r5441 r5888 19 19 if( isset($criteria["order"]) ) 20 20 ldap_sort( $this->con, $sr, $criteria["order"] ); 21 21 22 22 return self::_formatEntries( ldap_get_entries( $this->con, $sr ) , $map); 23 23 }
Note: See TracChangeset
for help on using the changeset viewer.