From 3412e50b54e3daac8745234e21ab6e72be0ed165 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Wed, 04 Jun 2014 11:20:33 -0400
Subject: [PATCH] Fix attachment menu structure and aria-attributes
---
program/lib/Roundcube/rcube_output.php | 129 +++++++++++++++++++------------------------
1 files changed, 57 insertions(+), 72 deletions(-)
diff --git a/program/lib/Roundcube/rcube_output.php b/program/lib/Roundcube/rcube_output.php
index f7ac300..7ccf9a0 100644
--- a/program/lib/Roundcube/rcube_output.php
+++ b/program/lib/Roundcube/rcube_output.php
@@ -2,17 +2,15 @@
/*
+-----------------------------------------------------------------------+
- | program/include/rcube_output.php |
- | |
| This file is part of the Roundcube PHP suite |
| Copyright (C) 2005-2012 The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
| See the README file for a full license statement. |
+ | |
| CONTENTS: |
| Abstract class for output generation |
- | |
+-----------------------------------------------------------------------+
| Author: Thomas Bruederli <roundcube@gmail.com> |
| Author: Aleksander Machniak <alec@alec.pl> |
@@ -28,22 +26,17 @@
abstract class rcube_output
{
public $browser;
- public $type = 'html';
- public $ajax_call = false;
- public $framed = false;
protected $app;
protected $config;
- protected $charset = RCMAIL_CHARSET;
+ protected $charset = RCUBE_CHARSET;
protected $env = array();
- protected $pagetitle = '';
- protected $object_handlers = array();
/**
* Object constructor
*/
- public function __construct($task = null, $framed = false)
+ public function __construct()
{
$this->app = rcube::get_instance();
$this->config = $this->app->config;
@@ -61,16 +54,6 @@
return $this->env;
return null;
- }
-
- /**
- * Setter for page title
- *
- * @param string $title Page title
- */
- public function set_pagetitle($title)
- {
- $this->pagetitle = $title;
}
@@ -94,15 +77,6 @@
public function get_charset()
{
return $this->charset;
- }
-
-
- /**
- * Getter for the current skin path property
- */
- public function get_skin_path()
- {
- return $this->config->get('skin_path');
}
@@ -137,24 +111,7 @@
public function reset()
{
$this->env = array();
- $this->object_handlers = array();
- $this->pagetitle = '';
}
-
-
- /**
- * Call a client method
- *
- * @param string Method to call
- * @param ... Additional arguments
- */
- abstract function command();
-
-
- /**
- * Add a localized label to the client environment
- */
- abstract function add_label();
/**
@@ -185,31 +142,6 @@
/**
- * Register a template object handler
- *
- * @param string Object name
- * @param string Function name to call
- * @return void
- */
- public function add_handler($obj, $func)
- {
- $this->object_handlers[$obj] = $func;
- }
-
-
- /**
- * Register a list of template object handlers
- *
- * @param array Hash array with object=>handler pairs
- * @return void
- */
- public function add_handlers($arr)
- {
- $this->object_handlers = array_merge($this->object_handlers, $arr);
- }
-
-
- /**
* Send HTTP headers to prevent caching a page
*/
public function nocacheing_headers()
@@ -230,7 +162,7 @@
header("Cache-Control: private, must-revalidate");
}
else {
- header("Cache-Control: private, no-cache, must-revalidate, post-check=0, pre-check=0");
+ header("Cache-Control: private, no-cache, no-store, must-revalidate, post-check=0, pre-check=0");
header("Pragma: no-cache");
}
}
@@ -266,6 +198,59 @@
/**
+ * Create an edit field for inclusion on a form
+ *
+ * @param string col field name
+ * @param string value field value
+ * @param array attrib HTML element attributes for field
+ * @param string type HTML element type (default 'text')
+ *
+ * @return string HTML field definition
+ */
+ public static function get_edit_field($col, $value, $attrib, $type = 'text')
+ {
+ static $colcounts = array();
+
+ $fname = '_'.$col;
+ $attrib['name'] = $fname . ($attrib['array'] ? '[]' : '');
+ $attrib['class'] = trim($attrib['class'] . ' ff_' . $col);
+
+ if ($type == 'checkbox') {
+ $attrib['value'] = '1';
+ $input = new html_checkbox($attrib);
+ }
+ else if ($type == 'textarea') {
+ $attrib['cols'] = $attrib['size'];
+ $input = new html_textarea($attrib);
+ }
+ else if ($type == 'select') {
+ $input = new html_select($attrib);
+ $input->add('---', '');
+ $input->add(array_values($attrib['options']), array_keys($attrib['options']));
+ }
+ else if ($attrib['type'] == 'password') {
+ $input = new html_passwordfield($attrib);
+ }
+ else {
+ if ($attrib['type'] != 'text' && $attrib['type'] != 'hidden') {
+ $attrib['type'] = 'text';
+ }
+ $input = new html_inputfield($attrib);
+ }
+
+ // use value from post
+ if (isset($_POST[$fname])) {
+ $postvalue = rcube_utils::get_input_value($fname, rcube_utils::INPUT_POST, true);
+ $value = $attrib['array'] ? $postvalue[intval($colcounts[$col]++)] : $postvalue;
+ }
+
+ $out = $input->show($value);
+
+ return $out;
+ }
+
+
+ /**
* Convert a variable into a javascript object notation
*
* @param mixed Input value
--
Gitblit v1.9.1