Author: ralfbecker
New Revision: 55431
URL: http://svn.stylite.de/viewvc/egroupware?rev=55431&view=rev
Log:
moving eT2 server-side to api
Added:
trunk/egroupware/api/src/Etemplate/
trunk/egroupware/api/src/Etemplate.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_new.inc.php
trunk/egroupware/api/src/Etemplate/Request/
trunk/egroupware/api/src/Etemplate/Request.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_request.inc.php
trunk/egroupware/api/src/Etemplate/Request/Cache.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_request_cache.inc.php
trunk/egroupware/api/src/Etemplate/Request/Files.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_request_files.inc.php
trunk/egroupware/api/src/Etemplate/Request/Session.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_request_session.inc.php
trunk/egroupware/api/src/Etemplate/Widget/
trunk/egroupware/api/src/Etemplate/Widget.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget.inc.php
trunk/egroupware/api/src/Etemplate/Widget/AjaxSelect.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_ajax_select.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Box.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Button.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_button.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Checkbox.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_checkbox.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Contact.php
- copied, changed from r55427, trunk/etemplate/inc/class.contact_widget.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Customfields.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_customfields.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Date.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_date.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Description.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Entry.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_entry.inc.php
trunk/egroupware/api/src/Etemplate/Widget/File.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_file.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Gantt.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_gantt.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Grid.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_grid.inc.php
trunk/egroupware/api/src/Etemplate/Widget/HistoryLog.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_historylog.inc.php
trunk/egroupware/api/src/Etemplate/Widget/HtmlArea.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_htmlarea.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Image.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_image.inc.php
trunk/egroupware/api/src/Etemplate/Widget/ItemPicker.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_itempicker.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Link.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_link.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Nextmatch.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_nextmatch.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Select.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_menupopup.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Tabbox.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_tabbox.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Taglist.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_taglist.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Template.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_template.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Textbox.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_textbox.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Toolbar.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_toolbar.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Transformer.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_transformer.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Tree.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_tree.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Url.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_url.inc.php
trunk/egroupware/api/src/Etemplate/Widget/Vfs.php
- copied, changed from r55427, trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php
trunk/egroupware/api/src/Etemplate/empty.html
- copied unchanged from r55427, trunk/etemplate/empty.html
Removed:
trunk/etemplate/empty.html
trunk/etemplate/inc/class.etemplate_request.inc.php
trunk/etemplate/inc/class.etemplate_request_cache.inc.php
trunk/etemplate/inc/class.etemplate_request_files.inc.php
trunk/etemplate/inc/class.etemplate_request_session.inc.php
trunk/etemplate/inc/class.etemplate_widget_ajax_select.inc.php
trunk/etemplate/inc/class.etemplate_widget_button.inc.php
trunk/etemplate/inc/class.etemplate_widget_checkbox.inc.php
trunk/etemplate/inc/class.etemplate_widget_customfields.inc.php
trunk/etemplate/inc/class.etemplate_widget_date.inc.php
trunk/etemplate/inc/class.etemplate_widget_entry.inc.php
trunk/etemplate/inc/class.etemplate_widget_file.inc.php
trunk/etemplate/inc/class.etemplate_widget_gantt.inc.php
trunk/etemplate/inc/class.etemplate_widget_grid.inc.php
trunk/etemplate/inc/class.etemplate_widget_historylog.inc.php
trunk/etemplate/inc/class.etemplate_widget_htmlarea.inc.php
trunk/etemplate/inc/class.etemplate_widget_image.inc.php
trunk/etemplate/inc/class.etemplate_widget_itempicker.inc.php
trunk/etemplate/inc/class.etemplate_widget_link.inc.php
trunk/etemplate/inc/class.etemplate_widget_menupopup.inc.php
trunk/etemplate/inc/class.etemplate_widget_nextmatch.inc.php
trunk/etemplate/inc/class.etemplate_widget_tabbox.inc.php
trunk/etemplate/inc/class.etemplate_widget_taglist.inc.php
trunk/etemplate/inc/class.etemplate_widget_template.inc.php
trunk/etemplate/inc/class.etemplate_widget_textbox.inc.php
trunk/etemplate/inc/class.etemplate_widget_toolbar.inc.php
trunk/etemplate/inc/class.etemplate_widget_tree.inc.php
trunk/etemplate/inc/class.etemplate_widget_url.inc.php
trunk/etemplate/inc/class.etemplate_widget_vfs.inc.php
Modified:
trunk/egroupware/api/src/Storage/Base.php
trunk/etemplate/inc/class.ajax_select_widget.inc.php
trunk/etemplate/inc/class.boetemplate.inc.php
trunk/etemplate/inc/class.contact_widget.inc.php
trunk/etemplate/inc/class.etemplate.inc.php
trunk/etemplate/inc/class.etemplate_new.inc.php
trunk/etemplate/inc/class.etemplate_widget.inc.php
trunk/etemplate/inc/class.etemplate_widget_transformer.inc.php
trunk/etemplate/inc/class.link_widget.inc.php
trunk/etemplate/inc/class.soetemplate.inc.php
— trunk/etemplate/inc/class.etemplate_new.inc.php (original)
+++ trunk/egroupware/api/src/Etemplate.php Sat Mar 19 14:06:07 2016
@@ -3,13 +3,21 @@
+namespace EGroupware\Api;
+
+// explicitly import old not yet ported classes
+use egw;
+use egw_framework;
+use egw_json_response;
+use categories; // css
/**
- New eTemplate serverside contains:
@@ -19,10 +27,8 @@
- Not longer available methods:
-
- set_(row|column)_attributes modifies template on run-time, was only used internally by etemplate itself
-
- disable_(row|column) dto.
-
if(!isset(self::$request)) self::$request = Etemplate\Request::read();
}
/**
@@ -136,7 +142,7 @@
// Include the etemplate2 javascript code
egw_framework::validate_file(’.’, ‘etemplate2’, ‘etemplate’);
@@ -154,12 +160,12 @@
if (self::$request->output_mode == -1) self::$request->output_mode = 0;
self::$request->template = $this->as_array();
-
if (empty($this->name)) throw new Exception\AssertionFailed("Template name is not set '$this->name' !");
// instanciate template to fill self::$request->sel_options for select-* widgets
// not sure if we want to handle it this way, thought otherwise we will have a few ajax request for each dialog fetching predefined selectboxes
-
$template = etemplate_widget_template::instance($this->name, $this->template_set, $this->version, $this->laod_via);
-
if (!$template) throw new egw_exception_assertion_failed("Template $this->name not instanciable! Maybe you forgot to rename template id.");
-
translation::add_app('etemplate');
-
$template = self::instance($this->name, $this->template_set, $this->version, $this->laod_via);
-
if (!$template) throw new Exception\AssertionFailed("Template $this->name not instanciable! Maybe you forgot to rename template id.");
-
Translation::add_app('etemplate');
$template->run('beforeSendToClient', array('', array('cont'=>$content)));
// some apps (eg. InfoLog) set app_header only in get_rows depending on filter settings
@@ -168,18 +174,18 @@
// compile required translations translations
$currentapp = $GLOBALS[‘egw_info’][‘flags’][‘currentapp’];
$langRequire = array(‘common’ => array(), ‘etemplate’ => array()); // keep that order
-
$langRequire[$l_app] = array('app' => $l_app, 'lang' => $lang, 'etag' => translation::etag($l_app, $lang));
-
$langRequire[$l_app] = array('app' => $l_app, 'lang' => $lang, 'etag' => Translation::etag($l_app, $lang));
}
}
foreach(array($currentapp, 'custom') as $l_app)
{
-
if (isset(translation::$loaded_apps[$l_app]))
-
{
-
$langRequire[$l_app] = array('app' => $l_app, 'lang' => translation::$loaded_apps[$l_app], 'etag' => translation::etag($l_app, translation::$loaded_apps[$l_app]));
-
if (isset(Translation::$loaded_apps[$l_app]))
-
{
-
$langRequire[$l_app] = array('app' => $l_app, 'lang' => Translation::$loaded_apps[$l_app], 'etag' => Translation::etag($l_app, Translation::$loaded_apps[$l_app]));
}
}
@@ -199,7 +205,7 @@
$dom_id = str_replace(’.’,’-’,$this->dom_id);
$load_array = array(
‘name’ => $this->name,
@@ -232,8 +238,10 @@
// set action attribute for autocomplete form tag
// as firefox complains on about:balnk action, thus we have to literaly submit the form to a blank html
$form_action = “about:blank”;
-
if (in_array(Header\UserAgent::type(), array('firefox', 'safari')))
-
{
-
$form_action = $GLOBALS['egw_info']['server']['webserver_url'].'/api/src/Etemplate/empty.html';
-
}
// check if we are in an ajax-exec call from jdots template (or future other tabbed templates)
if (isset($GLOBALS['egw']->framework->response))
{
@@ -271,7 +279,8 @@
$load_array[‘response’] = egw_json_response::get()->returnResult();
}
//
-
echo '<form target="egw_iframe_autocomplete_helper" action="'.$form_action.'" id="'.$dom_id.'" class="et2_container" data-etemplate="'.
-
htmlspecialchars(egw_json_response::json_encode($load_array), ENT_COMPAT, Translation::charset(), true).'"></form>'."\n".
'<iframe name="egw_iframe_autocomplete_helper" style="width:0;height:0;position: absolute;visibility:hidden;"></iframe>';
if ($output_mode == 2)
@@ -285,7 +294,7 @@
}
/**
-
- Fix all sel_options, as etemplate_widget_menupopup::beforeSendToClient is not run for auto-repeated stuff not understood by server
-
- Fix all sel_options, as Etemplate\Widget\Select::beforeSendToClient is not run for auto-repeated stuff not understood by server
-
-
@param array $sel_options
-
@return array
@@ -299,7 +308,7 @@
{
if (is_numeric($key) && (!is_array($value) || !isset($value[‘value’])))
{
@@ -313,13 +322,13 @@
* @param string $etemplate_exec_id
* @param array $_content
* @param boolean $no_validation
-
-
@throws egw_exception_wrong_parameter
-
-
@throws Exception\WrongParameter
*/
static public function ajax_process_content($etemplate_exec_id, array $_content, $no_validation)
{
//error_log(METHOD."(".array2string($etemplate_exec_id).’, '.array2string($_content).")");
@@ -327,7 +336,7 @@
if (!($template = self::instance(self::$request->template[‘name’], self::$request->template[‘template_set’],
self::$request->template[‘version’], self::$request->template[‘load_via’])))
{
@@ -335,7 +344,7 @@
if(!$app) list($app) = explode(’::’,self::$request->method);
if($app)
{
@@ -423,7 +432,7 @@
static public function ajax_destroy_session($_exec_id)
{
//error_log(METHOD."(’$_exec_id’)");
@@ -437,20 +446,14 @@
{
if (get_magic_quotes_gpc()) $_POST[‘value’] = stripslashes($_POST[‘value’]);
$content = json_decode($_POST[‘value’],true);
-
if($content == null && $_POST['exec'])
-
{
-
// Old etemplate submit
-
error_log("Old etemplate submitted");
-
return ExecMethod('etemplate.etemplate.process_exec');
-
}
//error_log(__METHOD__."(".array2string($content).")");
-
self::$request = etemplate_request::read($_POST['etemplate_exec_id']);
-
self::$request = Etemplate\Request::read($_POST['etemplate_exec_id']);
if (!($template = self::instance(self::$request->template['name'], self::$request->template['template_set'],
self::$request->template['version'], self::$request->template['load_via'])))
{
@@ -496,7 +499,7 @@
{
// For mobile experience try to load custom mobile templates
@@ -619,9 +622,7 @@
*/
public function debug(array $content=null)
{
-
common::egw_header();
-
_debug_array($content);
-
common::egw_footer();
-
$GLOBALS['egw']->framework->render(print_r($content, true));
}
/**
@@ -639,7 +640,7 @@
$post_max_size = ini_get(‘post_max_size’);
$max_upload = min(self::km2int($upload_max_filesize),self::km2int($post_max_size)-2800);
@@ -690,14 +691,13 @@
}
// Try to discover all widgets, as names don’t always match tags (eg: listbox is in menupopup)
-$files = scandir(EGW_INCLUDE_ROOT . ‘/etemplate/inc’);
-foreach($files as $filename)
+foreach(scandir($dir=DIR . ‘/Etemplate/Widget’) as $filename)
{
- if(strpos($filename, ‘class.etemplate_widget’) === 0)
- if(substr($filname, -4) == ‘.php’)
{
try
{
— trunk/etemplate/inc/class.etemplate_request.inc.php (original)
+++ trunk/egroupware/api/src/Etemplate/Request.php Sat Mar 19 14:06:07 2016
@@ -1,15 +1,22 @@
<?php
/**
- * eGroupWare - eTemplate request object storing request-data directly in the form itself
+ * EGroupware - eTemplate request object storing request-data directly in the form itself
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
- * @package etemplate
- * @subpackage api
+ * @package api
+ * @subpackage etemplate
* @link http://www.egroupware.org
* @author Ralf Becker