mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-21 23:43:17 +01:00
WIP EGroupware without phpgwapi&etemplate
This commit is contained in:
parent
d7eb464605
commit
4af0e7cb1c
@ -756,8 +756,12 @@ class addressbook_ui extends addressbook_bo
|
||||
'disableClass' => 'rowNoEdit',
|
||||
);
|
||||
}
|
||||
if (isset($actions['export']['children']['csv']) && !importexport_helper_functions::has_definitions('addressbook','export')) unset($actions['export']['children']['csv']);
|
||||
|
||||
if (isset($actions['export']['children']['csv']) &&
|
||||
(!isset($GLOBALS['egw_info']['user']['apps']['importexport']) ||
|
||||
!importexport_helper_functions::has_definitions('addressbook','export')))
|
||||
{
|
||||
unset($actions['export']['children']['csv']);
|
||||
}
|
||||
// Intercept open action in order to open entry into view mode instead of edit
|
||||
if (Api\Header\UserAgent::mobile())
|
||||
{
|
||||
|
@ -284,7 +284,7 @@ etemplate2.prototype.bind_unload = function()
|
||||
{
|
||||
this.destroy_session = jQuery.proxy(function(ev)
|
||||
{
|
||||
var request = egw.json(this.app+".etemplate_new.ajax_destroy_session.etemplate",
|
||||
var request = egw.json("EGroupware\\Api\\Etemplate::ajax_destroy_session",
|
||||
[this.etemplate_exec_id], null, null, false);
|
||||
request.sendRequest();
|
||||
}, this);
|
||||
|
@ -415,7 +415,7 @@ var fw_base = (function(){ "use strict"; return Class.extend(
|
||||
{
|
||||
this.serializedTabState = serialized;
|
||||
|
||||
egw.jsonq("api.jdots_framework.ajax_tab_changed_state", [data]);
|
||||
egw.jsonq("api.jdots_framework.ajax_tab_changed_state.template", [data]);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -302,7 +302,7 @@
|
||||
}
|
||||
|
||||
//Send the sort order to the server via ajax
|
||||
var req = egw.jsonq('api.jdots_framework.ajax_appsort', [name_array]);
|
||||
var req = egw.jsonq('api.jdots_framework.ajax_appsort.template', [name_array]);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -289,7 +289,7 @@
|
||||
window.setTimeout(resize_popup, 50);
|
||||
});
|
||||
}
|
||||
var et2 = new etemplate2(node, currentapp+".etemplate_new.ajax_process_content.etemplate");
|
||||
var et2 = new etemplate2(node, "EGroupware\\Api\\Etemplate::ajax_process_content");
|
||||
et2.load(data.name,data.url,data.data);
|
||||
if (typeof data.response != 'undefined')
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ egw.extend("data", egw.MODULE_APP_LOCAL, function (_app, _wnd)
|
||||
|
||||
/**
|
||||
* The dataFetch function provides an abstraction layer for the
|
||||
* corresponding "etemplate_widget_nextmatch::ajax_get_rows" function.
|
||||
* corresponding "EGroupware\Api\Etemplate\Widget\Nextmatch::ajax_get_rows" function.
|
||||
* The server returns the following structure:
|
||||
* {
|
||||
* order: [uid, ...],
|
||||
@ -429,7 +429,7 @@ egw.extend("data", egw.MODULE_APP_LOCAL, function (_app, _wnd)
|
||||
// independent of changes happening while waiting for the response
|
||||
_context.filters = jQuery.extend({}, _filters);
|
||||
var request = egw.json(
|
||||
_app+".etemplate_widget_nextmatch.ajax_get_rows.etemplate",
|
||||
"EGroupware\\Api\\Etemplate\\Widget\\Nextmatch::ajax_get_rows",
|
||||
[
|
||||
_execId,
|
||||
_queriedRange,
|
||||
@ -836,7 +836,7 @@ egw.extend("data_storage", egw.MODULE_GLOBAL, function (_app, _wnd) {
|
||||
if(typeof registeredCallbacks[_uid] !== "undefined" && registeredCallbacks[_uid].length > 0)
|
||||
{
|
||||
var _execId = registeredCallbacks[_uid][0].execId;
|
||||
// This widget ID MUST be a nextmatch, because the data call is to etemplate_widget_nexmatch
|
||||
// This widget ID MUST be a nextmatch, because the data call is to Etemplate\Widget\Nexmatch
|
||||
var nextmatchId = registeredCallbacks[_uid][0].widgetId;
|
||||
var uid = _uid.split("::");
|
||||
var context = {
|
||||
|
@ -398,7 +398,7 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
|
||||
// if there's no active jsonq request, start a new one
|
||||
if (title_uid == null)
|
||||
{
|
||||
title_uid = this.jsonq(_app+'.etemplate_widget_link.ajax_link_titles.etemplate',[{}], this.link_title_callback, this, this.link_title_before_send);
|
||||
title_uid = this.jsonq('EGroupware\\Api\\Etemplate\\Widget\\Link::ajax_link_titles',[{}], this.link_title_callback, this, this.link_title_before_send);
|
||||
}
|
||||
},
|
||||
|
||||
|
50
api/src/Header/Referer.php
Normal file
50
api/src/Header/Referer.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* EGroupware API: HTTP_REFERER header handling
|
||||
*
|
||||
* @link http://www.egroupware.org
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright 2001-2016 by RalfBecker@outdoor-training.de
|
||||
* @package api
|
||||
* @subpackage header
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
namespace EGroupware\Api\Header;
|
||||
|
||||
/**
|
||||
* Handling of HTTP_REFERER header
|
||||
*/
|
||||
class Referer
|
||||
{
|
||||
/**
|
||||
* gets an eGW conformant referer from $_SERVER['HTTP_REFERER'], suitable for direct use in the link function
|
||||
*
|
||||
* @param string $default ='' default to use if referer is not set by webserver or not determinable
|
||||
* @param string $referer ='' referer string to use, default ('') use $_SERVER['HTTP_REFERER']
|
||||
* @return string
|
||||
* @todo get "real" referer for jDots template
|
||||
*/
|
||||
static function get($default='',$referer='')
|
||||
{
|
||||
// HTTP_REFERER seems NOT to get urldecoded
|
||||
if (!$referer) $referer = urldecode($_SERVER['HTTP_REFERER']);
|
||||
|
||||
$webserver_url = $GLOBALS['egw_info']['server']['webserver_url'];
|
||||
if (empty($webserver_url) || $webserver_url{0} == '/') // url is just a path
|
||||
{
|
||||
$referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer); // removing the domain part
|
||||
}
|
||||
if (strlen($webserver_url) > 1)
|
||||
{
|
||||
list(,$referer) = explode($webserver_url,$referer,2);
|
||||
}
|
||||
$ret = str_replace('/etemplate/process_exec.php', '/index.php', $referer);
|
||||
|
||||
if (empty($ret) || strpos($ret, 'cd=yes') !== false) $ret = $default;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
UserAgent::_init_static();
|
@ -195,7 +195,7 @@ class Translation
|
||||
}
|
||||
$apps = array('common');
|
||||
// for eTemplate apps, load etemplate before app itself (allowing app to overwrite etemplate translations)
|
||||
if (class_exists('etemplate_new', false) || class_exists('etemplate', false)) $apps[] = 'etemplate';
|
||||
if (class_exists('EGroupware\\Api\\Etemplate', false) || class_exists('etemplate', false)) $apps[] = 'etemplate';
|
||||
if ($GLOBALS['egw_info']['flags']['currentapp']) $apps[] = $GLOBALS['egw_info']['flags']['currentapp'];
|
||||
// load instance specific translations last, so they can overwrite everything
|
||||
$apps[] = 'custom';
|
||||
|
@ -56,15 +56,16 @@ class boholiday
|
||||
|
||||
function boholiday()
|
||||
{
|
||||
$this->so =& CreateObject('calendar.soholiday');
|
||||
require_once(__DIR__.'/class.soholiday.inc.php');
|
||||
$this->so = new soholiday();
|
||||
|
||||
$this->start = (int)get_var('start',array('POST','GET'));
|
||||
$this->query = get_var('query',array('POST','GET'));
|
||||
$this->sort = get_var('sort',array('POST','GET'));
|
||||
$this->order = get_var('order',array('POST','GET'));
|
||||
$this->id = get_var('id',array('POST','GET'));
|
||||
$this->year = get_var('year',array('POST','GET'),date('Y'));
|
||||
$this->locale = get_var('locale',array('POST','GET'));
|
||||
$this->start = (int)$_REQUEST['start'];
|
||||
$this->query = $_REQUEST['query'];
|
||||
$this->sort = $_REQUEST['sort'];
|
||||
$this->order = $_REQUEST['order'];
|
||||
$this->id = $_REQUEST['id'];
|
||||
$this->year = (int)(!empty($_REQUEST['year']) ? $_REQUEST['year'] : date('Y'));
|
||||
$this->locale = $_REQUEST['locale'];
|
||||
if ($this->locale)
|
||||
{
|
||||
$this->locales[] = $this->locale;
|
||||
|
@ -1474,11 +1474,11 @@ class calendar_bo
|
||||
if ($end_m == 24*60-1) ++$duration;
|
||||
$duration = floor($duration/60).lang('h').($duration%60 ? $duration%60 : '');
|
||||
|
||||
$timespan = $t = common::formattime(sprintf('%02d',$start_m/60),sprintf('%02d',$start_m%60));
|
||||
$timespan = $t = Api\DateTime::to('20000101T'.sprintf('%02d',$start_m/60).sprintf('%02d',$start_m%60).'00', false);
|
||||
|
||||
if ($both) // end-time too
|
||||
{
|
||||
$timespan .= ' - '.common::formattime(sprintf('%02d',$end_m/60),sprintf('%02d',$end_m%60));
|
||||
$timespan .= ' - '.Api\DateTime::to('20000101T'.sprintf('%02d',$end_m/60).sprintf('%02d',$end_m%60).'00', false);
|
||||
// dont double am/pm if they are the same in both times
|
||||
if ($this->common_prefs['timeformat'] == 12 && substr($timespan,-2) == substr($t,-2))
|
||||
{
|
||||
|
@ -2031,7 +2031,7 @@ class calendar_uiforms extends calendar_ui
|
||||
*/
|
||||
function conflicts($event,$conflicts,$preserv)
|
||||
{
|
||||
$etpl = CreateObject('etemplate.etemplate_new','calendar.conflicts');
|
||||
$etpl = new Etemplate('calendar.conflicts');
|
||||
$allConflicts = array();
|
||||
|
||||
foreach($conflicts as $k => $conflict)
|
||||
|
@ -412,7 +412,7 @@ class calendar_uiviews extends calendar_ui
|
||||
/**
|
||||
* Displays the planner view
|
||||
*
|
||||
* @param boolean|etemplate_new $home = false if etemplate return content suitable for home-page
|
||||
* @param boolean|Etemplate $home = false if etemplate return content suitable for home-page
|
||||
*/
|
||||
function &planner($content = array(), $home=false)
|
||||
{
|
||||
|
@ -85,6 +85,7 @@ foreach(array(
|
||||
'common::egw_footer' => "\$GLOBALS['egw']->framework->footer",
|
||||
'common::show_date' => 'Api\\DateTime::server2user',
|
||||
'common::get_tpl_dir' => 'Api\\Framework\\Template::get_dir',
|
||||
'common::get_referer' => 'Api\\Header\\Referer::get',
|
||||
'country' => 'Api\\Country',
|
||||
'egw' => 'Api\\Egw',
|
||||
'egw_minimal' => 'Api\\Egw\\Base',
|
||||
@ -158,6 +159,7 @@ foreach(array(
|
||||
'etemplate_request' => 'Api\\Etemplate\\Request',
|
||||
'nextmatch_widget::category_action' => 'Api\\Etemplate\\Widget\\Nextmatch::category_action',
|
||||
'nextmatch_widget::DEFAULT_MAX_MENU_LENGTH' => 'Api\\Etemplate\\Widget\\Nextmatch::DEFAULT_MAX_MENU_LENGTH',
|
||||
'customfields_widget::update_customfield_links' => 'Api\Storage\Customfields::update_links',
|
||||
'egw_keymanager' => 'Api\\Etemplate\\KeyManager',
|
||||
// so_sql and friends
|
||||
'so_sql' => 'Api\\Storage\\Base',
|
||||
|
@ -133,10 +133,12 @@ use EGroupware\Api\Etemplate;
|
||||
$text = lang("Tomorrow is %1's birthday.", $contact['n_given'].' '.$contact['n_family']);
|
||||
break;
|
||||
default:
|
||||
list($y,$m,$d) = explode('-',$contact['bday']);
|
||||
if ($GLOBALS['egw_info']['server']['hide_birthdays'] == 'dateonly') $y = '';
|
||||
$text = lang("In %1 days (%2) is %3's birthday.",$n,
|
||||
common::dateformatorder($y,$m,$d,true),
|
||||
$date = Api\DateTime::to($contact['bday'], true);
|
||||
if ($GLOBALS['egw_info']['server']['hide_birthdays'] == 'dateonly')
|
||||
{
|
||||
$date = preg_replace('/\d{4}/', '', $date);
|
||||
}
|
||||
$text = lang("In %1 days (%2) is %3's birthday.", $n, $date,
|
||||
$contact['n_given'].' '.$contact['n_family']);
|
||||
break;
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ if (isset($_GET['tz']))
|
||||
$GLOBALS['egw']->preferences->add('common','tz',$_GET['tz']);
|
||||
$GLOBALS['egw']->preferences->save_repository();
|
||||
|
||||
if (($referer = common::get_referer()))
|
||||
if (($referer = Api\Header\Referer::get()))
|
||||
{
|
||||
Egw::redirect_link($referer);
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ class infolog_bo
|
||||
}
|
||||
}
|
||||
|
||||
if (($data = $this->so->read($info_id)) === False)
|
||||
if (!$info_id || ($data = $this->so->read($info_id)) === False)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@ -948,7 +948,7 @@ class infolog_bo
|
||||
$to_write['info_responsible'] = $values['info_responsible'];
|
||||
}
|
||||
// create (and remove) links in custom fields
|
||||
customfields_widget::update_customfield_links('infolog',$values,$old,'info_id');
|
||||
Api\Storage\Customfields::update_links('infolog',$values,$old,'info_id');
|
||||
|
||||
// Check for restore of deleted entry, restore held links
|
||||
if($old['info_status'] == 'deleted' && $values['info_status'] != 'deleted')
|
||||
@ -1361,7 +1361,7 @@ class infolog_bo
|
||||
foreach ($infos as $info)
|
||||
{
|
||||
$start = new Api\DateTime($info['info_startdate'],Api\DateTime::$user_timezone);
|
||||
$title = ($do_events?common::formattime($start->format('H'),$start->format('i')).' ':'').
|
||||
$title = ($do_events ? $start->format(false).' ' : '').
|
||||
$info['info_subject'];
|
||||
$view = Link::view('infolog',$info['info_id']);
|
||||
$size = null;
|
||||
|
@ -704,7 +704,7 @@ class infolog_ui
|
||||
}
|
||||
elseif ($own_referer === '')
|
||||
{
|
||||
$own_referer = common::get_referer();
|
||||
$own_referer = Api\Header\Referer::get();
|
||||
if (strpos($own_referer,'menuaction=infolog.infolog_ui.edit') !== false)
|
||||
{
|
||||
$own_referer = Api\Cache::getSession('infolog', 'own_session');
|
||||
@ -787,9 +787,9 @@ class infolog_ui
|
||||
}
|
||||
if (!$action)
|
||||
{
|
||||
$action = is_array($values) && $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
|
||||
$action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
|
||||
$action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : get_var('action_title',array('POST','GET'));
|
||||
$action = is_array($values) && $values['action'] ? $values['action'] : $_REQUEST['action'];
|
||||
$action_id = is_array($values) && $values['action_id'] ? $values['action_id'] : $_REQUEST['action_id'];
|
||||
$action_title = is_array($values) && $values['action_title'] ? $values['action_title'] : $_REQUEST['action_title'];
|
||||
}
|
||||
//echo "<p>".__METHOD__."(action='$action/$action_id',called_as='$called_as/$values[referer]',own_referer='$own_referer') values=\n"; _debug_array($values);
|
||||
if (!is_array($values))
|
||||
@ -1881,12 +1881,12 @@ class infolog_ui
|
||||
else // new call via GET
|
||||
{
|
||||
//echo "<p>infolog_ui::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
|
||||
$action = $action ? $action : get_var('action', array('POST','GET'));
|
||||
$action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET'));
|
||||
$info_id = $content ? $content : get_var('info_id', array('POST','GET'));
|
||||
$type = $type ? $type : get_var('type', array('POST','GET'));
|
||||
$action = $action ? $action : $_REQUEST['action'];
|
||||
$action_id = $action_id ? $action_id : $_REQUEST['action_id'];
|
||||
$info_id = $content ? $content : $_REQUEST['info_id'];
|
||||
$type = $type ? $type : $_REQUEST['type'];
|
||||
$referer = $referer !== '' ? $referer : ($_GET['referer'] ? $_GET['referer'] :
|
||||
common::get_referer('/index.php?menuaction=infolog.infolog_ui.index'));
|
||||
Api\Header\Referer::get('/index.php?menuaction=infolog.infolog_ui.index'));
|
||||
if (strpos($referer, 'msg=') !== false) $referer = preg_replace('/([&?]{1})msg=[^&]+&?/','\\1',$referer); // remove previou/old msg from referer
|
||||
$no_popup = $_GET['no_popup'];
|
||||
$print = (int) $_REQUEST['print'];
|
||||
@ -2360,7 +2360,7 @@ class infolog_ui
|
||||
{
|
||||
$icon = $this->icons[$cat][$id];
|
||||
}
|
||||
if ($icon && !is_readable(common::get_image_dir() . '/' . $icon))
|
||||
if ($icon && !Api\Image::find('infolog', $icon))
|
||||
{
|
||||
$icon = False;
|
||||
}
|
||||
|
2
json.php
2
json.php
@ -101,7 +101,7 @@ if (isset($_GET['menuaction']))
|
||||
'no_exception_handler' => true, // we already installed our own
|
||||
// only log ajax requests which represent former GET requests or submits
|
||||
// cuts down updates to egw_access_log table
|
||||
'no_dla_update' => !preg_match('/(\.etemplate_new\.ajax_process_content\.etemplate|\.jdots_framework\.ajax_exec\.template)$/', $_GET['menuaction']),
|
||||
'no_dla_update' => !preg_match('/(Etemplate::ajax_process_content|\.jdots_framework\.ajax_exec\.template)$/', $_GET['menuaction']),
|
||||
)
|
||||
);
|
||||
include_once('./header.inc.php');
|
||||
|
@ -1213,32 +1213,16 @@ class common
|
||||
}
|
||||
|
||||
/**
|
||||
* gets an eGW conformat referer from $_SERVER['HTTP_REFERER'], suitable for direct use in the link function
|
||||
* gets an eGW conformant referer from $_SERVER['HTTP_REFERER'], suitable for direct use in the link function
|
||||
*
|
||||
* @param string $default ='' default to use if referer is not set by webserver or not determinable
|
||||
* @param string $referer ='' referer string to use, default ('') use $_SERVER['HTTP_REFERER']
|
||||
* @return string
|
||||
* @todo get "real" referer for jDots template
|
||||
* @deprecated use Api\Header\Referer::get
|
||||
*/
|
||||
static function get_referer($default='',$referer='')
|
||||
{
|
||||
// HTTP_REFERER seems NOT to get urldecoded
|
||||
if (!$referer) $referer = urldecode($_SERVER['HTTP_REFERER']);
|
||||
|
||||
$webserver_url = $GLOBALS['egw_info']['server']['webserver_url'];
|
||||
if (empty($webserver_url) || $webserver_url{0} == '/') // url is just a path
|
||||
{
|
||||
$referer = preg_replace('/^https?:\/\/[^\/]+/','',$referer); // removing the domain part
|
||||
}
|
||||
if (strlen($webserver_url) > 1)
|
||||
{
|
||||
list(,$referer) = explode($webserver_url,$referer,2);
|
||||
}
|
||||
$ret = str_replace('/etemplate/process_exec.php', '/index.php', $referer);
|
||||
|
||||
if (empty($ret) || strpos($ret, 'cd=yes') !== false) $ret = $default;
|
||||
|
||||
return $ret;
|
||||
return Api\Header\Referer::get($default, $referer);
|
||||
}
|
||||
|
||||
// some depricated functions for the migration
|
||||
|
Loading…
Reference in New Issue
Block a user