diff options
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Collections/TList.php | 22 | ||||
-rw-r--r-- | framework/Collections/TMap.php | 9 | ||||
-rw-r--r-- | framework/Data/TCache.php | 88 | ||||
-rw-r--r-- | framework/Exceptions/messages.txt | 11 | ||||
-rw-r--r-- | framework/Log/TLogManager.php | 12 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TBulletedList.php | 37 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TCheckBoxList.php | 8 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TDropDownList.php | 13 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TListBox.php | 5 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TListControl.php | 5 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TRadioButton.php | 6 | ||||
-rw-r--r-- | framework/Web/UI/WebControls/TRadioButtonList.php | 17 | ||||
-rw-r--r-- | framework/core.php | 72 |
13 files changed, 200 insertions, 105 deletions
diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index 232e39c6..b9fbd589 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -25,7 +25,6 @@ * unset($list[$index]); // remove the item at $index
* if(isset($list[$index])) // if the list has an item at $index
* foreach($list as $index=>$item) // traverse each item in the list
- * $list->add("item1")->add("item2"); // adding multiple items
* </code>
* Note, count($list) will always return 1. You should use {@link getCount()}
* to determine the number of items in the list.
@@ -85,14 +84,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess }
/**
- * @return integer the number of items in the list
- */
- public function getLength()
- {
- return $this->getCount();
- }
-
- /**
* Returns the item at the specified offset.
* This method is exactly the same as {@link offsetGet}.
* @param integer the index of the item
@@ -111,7 +102,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess * Appends an item at the end of the list.
* @param mixed new item
* @throws TInvalidOperationException If the item is not allowed to be added
- * @return TList this
*/
public function add($item)
{
@@ -122,7 +112,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidOperationException('list_addition_disallowed');
- return $this;
}
/**
@@ -133,7 +122,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess * @param mixed new item
* @throws TInvalidDataValueException If the index specified exceeds the bound
* @throws TInvalidOperationException If the item is not allowed to be added
- * @return TList this
*/
public function insert($index,$item)
{
@@ -152,7 +140,7 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidOperationException('list_addition_disallowed');
- return $this;
+
}
/**
@@ -162,14 +150,13 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess * @param mixed the item to be removed.
* @throws TInvalidOperationException If the item cannot be removed
* @throws TInvalidDataValueException If the item does not exist
- * @return mixed the removed item
*/
public function remove($item)
{
if(($index=$this->indexOf($item))>=0)
{
if($this->canRemoveItem($item))
- return $this->removeAt($index);
+ $this->removeAt($index);
else
throw new TInvalidOperationException('list_item_unremovable');
}
@@ -208,7 +195,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess /**
* Removes all items in the list.
- * @return TList this
*/
public function clear()
{
@@ -250,7 +236,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess * Note, existing data in the list will be cleared first.
* @param mixed the data to be copied from, must be an array or object implementing Traversable
* @throws TInvalidDataTypeException If data is neither an array nor a Traversable.
- * @return TList this
*/
public function copyFrom($data)
{
@@ -263,7 +248,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidDataTypeException('list_data_not_iterable');
- return $this;
}
/**
@@ -271,7 +255,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess * New data will be appended to the end of the existing data.
* @param mixed the data to be merged with, must be an array or object implementing Traversable
* @throws TInvalidDataTypeException If data is neither an array nor an iterator.
- * @return TList this
*/
public function mergeWith($data)
{
@@ -282,7 +265,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidDataTypeException('list_data_not_iterable');
- return $this;
}
/**
diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php index 6647d039..73665136 100644 --- a/framework/Collections/TMap.php +++ b/framework/Collections/TMap.php @@ -24,7 +24,6 @@ * unset($map[$key]); // remove the value with the specified key
* if(isset($map[$key])) // if the map contains the key
* foreach($map as $key=>$value) // traverse the items in the map
- * $map->add("key1", "item1")->add("key2", "item2"); //multiple adds
* </code>
* Note, count($map) will always return 1. You should use {@link getCount()}
* to determine the number of items in the map.
@@ -102,7 +101,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess * @param mixed key
* @param mixed value
* @throws TInvalidOperationException if the item cannot be added
- * @return TMap this
*/
public function add($key,$value)
{
@@ -115,7 +113,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidOperationException('map_addition_disallowed');
- return $this;
}
/**
@@ -144,13 +141,11 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess /**
* Removes all items in the map.
- * @return TMap this
*/
public function clear()
{
foreach(array_keys($this->_d) as $key)
$this->remove($key);
- return $this;
}
/**
@@ -175,7 +170,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess * Note, existing data in the map will be cleared first.
* @param mixed the data to be copied from, must be an array or object implementing Traversable
* @throws TInvalidDataTypeException If data is neither an array nor an iterator.
- * @return TMap this
*/
public function copyFrom($data)
{
@@ -188,7 +182,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidDataTypeException('map_data_not_iterable');
- return $this;
}
/**
@@ -196,7 +189,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess * Existing data in the map will be kept and overwritten if the keys are the same.
* @param mixed the data to be merged with, must be an array or object implementing Traversable
* @throws TInvalidDataTypeException If data is neither an array nor an iterator.
- * @return TMap this
*/
public function mergeWith($data)
{
@@ -207,7 +199,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess }
else
throw new TInvalidDataTypeException('map_data_not_iterable');
- return $this;
}
/**
diff --git a/framework/Data/TCache.php b/framework/Data/TCache.php new file mode 100644 index 00000000..64729b46 --- /dev/null +++ b/framework/Data/TCache.php @@ -0,0 +1,88 @@ +<?php
+
+/**
+ * ICache interface.
+ *
+ * This interface must be implemented by cache managers.
+ *
+ * @author Qiang Xue <qiang.xue@gmail.com>
+ * @version $Revision: $ $Date: $
+ * @package System.Data
+ * @since 3.0
+ */
+interface ICache
+{
+ /**
+ * Retrieves a value from cache with a specified key.
+ * @return mixed the value stored in cache, false if the value is not in the cache or expired.
+ */
+ public function get($id);
+ /**
+ * Stores a value identified by a key into cache.
+ * If the cache already contains such a key, the existing value and
+ * expiration time will be replaced with the new ones.
+ *
+ * @param string the key identifying the value to be cached
+ * @param mixed the value to be cached
+ * @param integer the expiration time of the value,
+ * 0 means never expire,
+ * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
+ * a number greater than 60 means a UNIX timestamp after which the value will expire.
+ * @return boolean true if the value is successfully stored into cache, false otherwise
+ */
+ public function set($id,$value,$expire=0);
+ /**
+ * Stores a value identified by a key into cache if the cache does not contain this key.
+ * Nothing will be done if the cache already contains the key.
+ * @param string the key identifying the value to be cached
+ * @param mixed the value to be cached
+ * @param integer the expiration time of the value,
+ * 0 means never expire,
+ * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
+ * a number greater than 60 means a UNIX timestamp after which the value will expire.
+ * @return boolean true if the value is successfully stored into cache, false otherwise
+ */
+ public function add($id,$value,$expire=0);
+ /**
+ * Stores a value identified by a key into cache only if the cache contains this key.
+ * The existing value and expiration time will be overwritten with the new ones.
+ * @param string the key identifying the value to be cached
+ * @param mixed the value to be cached
+ * @param integer the expiration time of the value,
+ * 0 means never expire,
+ * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
+ * a number greater than 60 means a UNIX timestamp after which the value will expire.
+ * @return boolean true if the value is successfully stored into cache, false otherwise
+ */
+ public function replace($id,$value,$expire=0);
+ /**
+ * Deletes a value with the specified key from cache
+ * @param string the key of the value to be deleted
+ * @return boolean if no error happens during deletion
+ */
+ public function delete($id);
+ /**
+ * Deletes all values from cache.
+ * Be careful of performing this operation if the cache is shared by multiple applications.
+ */
+ public function flush();
+}
+
+interface IDependency
+{
+
+}
+
+class TTimeDependency
+{
+}
+
+class TFileDependency
+{
+}
+
+class TDirectoryDependency
+{
+}
+
+?>
\ No newline at end of file diff --git a/framework/Exceptions/messages.txt b/framework/Exceptions/messages.txt index 9869cc8c..54c8f04c 100644 --- a/framework/Exceptions/messages.txt +++ b/framework/Exceptions/messages.txt @@ -154,4 +154,13 @@ tablestyle_cellspacing_invalid = TTableStyle.CellSpacing must take an integer pagestatepersister_pagestate_corrupted = Page state is corrupted.
pagestatepersister_privatekey_invalid = TPageStatePersister.PrivateKey must take a string no shorter than 8 characters.
-listitemcollection_item_invalid = TListItemCollection can only take strings or TListItem objects.
\ No newline at end of file +listitemcollection_item_invalid = TListItemCollection can only take strings or TListItem objects.
+
+dropdownlist_selectedindices_unsupported= TDropDownList.SelectedIndices is read-only.
+
+bulletedlist_autopostback_unsupported = TBulletedList.AutoPostBack is read-only.
+bulletedlist_selectedindex_unsupported = TBulletedList.SelectedIndex is read-only.
+bulletedlist_selectedindices_unsupported= TBulletedList.SelectedIndices is read-only.
+bulletedlist_selectedvalue_unsupported = TBulletedList.SelectedValue is read-only.
+
+radiobuttonlist_selectedindices_unsupported = TRadioButtonList.SelectedIndices is read-only.
\ No newline at end of file diff --git a/framework/Log/TLogManager.php b/framework/Log/TLogManager.php index dba96e3a..8ab170ed 100644 --- a/framework/Log/TLogManager.php +++ b/framework/Log/TLogManager.php @@ -3,7 +3,7 @@ abstract class TLogManager extends TModule
{
protected $defaultSeverity = 'INFO | DEBUG | NOTICE | WARNING | ERROR | FATAL';
-
+
protected $config;
public function init($xml)
@@ -42,7 +42,7 @@ abstract class TLogManager extends TModule $log->$map($logFilter, $logWriter);
}
- if($filters->Length < 1)
+ if($filters->getCount() < 1)
{
$logFilter = new ezcLogFilter();
$logFilter->severity = $this->getFilterSeverity();
@@ -55,9 +55,9 @@ abstract class TLogManager extends TModule {
switch($xml->getAttribute('destination'))
{
- case 'file' :
+ case 'file' :
return TEzcLoggerUnixFileWriterFactory::create($xml);
- default :
+ default :
throw new TException('invalid_log_destination');
}
}
@@ -69,7 +69,7 @@ abstract class TLogManager extends TModule $serverities = explode("|", $string);
$mask = 0;
foreach($serverities as $Severity)
- $mask = $mask | $this->getSeverity($Severity);
+ $mask = $mask | $this->getSeverity($Severity);
return $mask;
}
@@ -107,7 +107,7 @@ class TEzcLoggerUnixFileWriterFactory TEzcLoggerLoader::using('ezcLogWriter');
TEzcLoggerLoader::using('ezcLogWriterFile');
TEzcLoggerLoader::using('ezcLogWriterUnixFile');
-
+
$path = $xml->getAttribute('directory');
$dir = Prado::getPathOfNamespace($path);
$file = $xml->getAttribute('filename');
diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php index 67c380bc..8256237d 100644 --- a/framework/Web/UI/WebControls/TBulletedList.php +++ b/framework/Web/UI/WebControls/TBulletedList.php @@ -11,6 +11,11 @@ */
/**
+ * Includes TListControl class
+ */
+Prado::using('System.Web.UI.WebControls.TListControl');
+
+/**
* TBulletedList class
*
* TBulletedList displays items in a bullet format.
@@ -322,6 +327,38 @@ class TBulletedList extends TListControl implements IPostBackEventHandler else
return null;
}
+
+ /**
+ * @throws TNotSupportedException if this method is invoked
+ */
+ public function setAutoPostBack($value)
+ {
+ throw new TNotSupportedException('bulletedlist_autopostback_unsupported');
+ }
+
+ /**
+ * @throws TNotSupportedException if this method is invoked
+ */
+ public function setSelectedIndex($index)
+ {
+ throw new TNotSupportedException('bulletedlist_selectedindex_unsupported');
+ }
+
+ /**
+ * @throws TNotSupportedException if this method is invoked
+ */
+ public function setSelectedIndices($indices)
+ {
+ throw new TNotSupportedException('bulletedlist_selectedindices_unsupported');
+ }
+
+ /**
+ * @throws TNotSupportedException if this method is invoked
+ */
+ public function setSelectedValue($value)
+ {
+ throw new TNotSupportedException('bulletedlist_selectedvalue_unsupported');
+ }
}
/**
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php index 3f61fba6..28ab11ea 100644 --- a/framework/Web/UI/WebControls/TCheckBoxList.php +++ b/framework/Web/UI/WebControls/TCheckBoxList.php @@ -11,9 +11,17 @@ */
/**
+ * Includes TListControl class
+ */
+Prado::using('System.Web.UI.WebControls.TListControl');
+/**
* Includes TRepeatInfo class
*/
Prado::using('System.Web.UI.WebControls.TRepeatInfo');
+/**
+ * Includes TCheckBox class
+ */
+Prado::using('System.Web.UI.WebControls.TCheckBox');
/**
* TCheckBoxList class
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php index d56e3e7e..3c459057 100644 --- a/framework/Web/UI/WebControls/TDropDownList.php +++ b/framework/Web/UI/WebControls/TDropDownList.php @@ -11,6 +11,11 @@ */
/**
+ * Includes TListControl class
+ */
+Prado::using('System.Web.UI.WebControls.TListControl');
+
+/**
* TDropDownList class
*
* TDropDownList displays a dropdown list on a Web page.
@@ -93,5 +98,13 @@ class TDropDownList extends TListControl implements IPostBackDataHandler else
return $index;
}
+
+ /**
+ * @throws TNotSupportedException if this method is invoked
+ */
+ public function setSelectedIndices($indices)
+ {
+ throw new TNotSupportedException('dropdownlist_selectedindices_unsupported');
+ }
}
?>
\ No newline at end of file diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php index db99edc5..47165c99 100644 --- a/framework/Web/UI/WebControls/TListBox.php +++ b/framework/Web/UI/WebControls/TListBox.php @@ -11,6 +11,11 @@ */
/**
+ * Includes TListControl class
+ */
+Prado::using('System.Web.UI.WebControls.TListControl');
+
+/**
* TListBox class
*
* TListBox displays a list box on a Web page that allows single or multiple selection.
diff --git a/framework/Web/UI/WebControls/TListControl.php b/framework/Web/UI/WebControls/TListControl.php index 582e03bd..265c320b 100644 --- a/framework/Web/UI/WebControls/TListControl.php +++ b/framework/Web/UI/WebControls/TListControl.php @@ -11,6 +11,11 @@ */
/**
+ * Includes TDataBoundControl class
+ */
+Prado::using('System.Web.UI.WebControls.TDataBoundControl');
+
+/**
* TListControl class
*
* TListControl is a base class for list controls, such as {@link TListBox},
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php index 83f52f69..a3d4d0c0 100644 --- a/framework/Web/UI/WebControls/TRadioButton.php +++ b/framework/Web/UI/WebControls/TRadioButton.php @@ -14,7 +14,11 @@ * Using TCheckBox parent class
*/
Prado::using('System.Web.UI.WebControls.TCheckBox');
-// using TRadioButtonList ??
+/**
+ * Using TRadioButtonList class
+ */
+Prado::using('System.Web.UI.WebControls.TRadioButtonList');
+
/**
* TRadioButton class
*
diff --git a/framework/Web/UI/WebControls/TRadioButtonList.php b/framework/Web/UI/WebControls/TRadioButtonList.php index 2f12369b..b0a36c9d 100644 --- a/framework/Web/UI/WebControls/TRadioButtonList.php +++ b/framework/Web/UI/WebControls/TRadioButtonList.php @@ -11,6 +11,15 @@ */
/**
+ * Includes TRadioButton class
+ */
+Prado::using('System.Web.UI.WebControls.TRadioButton');
+/**
+ * Includes TCheckBoxList class
+ */
+Prado::using('System.Web.UI.WebControls.TCheckBoxList');
+
+/**
* TRadioButtonList class
*
* TRadioButtonList displays a list of radiobuttons on a Web page.
@@ -70,6 +79,14 @@ class TRadioButtonList extends TCheckBoxList }
return false;
}
+
+ /**
+ * @throws TNotSupportedException if this method is invoked
+ */
+ public function setSelectedIndices($indices)
+ {
+ throw new TNotSupportedException('radiobuttonlist_selectedindices_unsupported');
+ }
}
?>
\ No newline at end of file diff --git a/framework/core.php b/framework/core.php index b2ae1d45..08481d09 100644 --- a/framework/core.php +++ b/framework/core.php @@ -41,6 +41,10 @@ require_once(PRADO_DIR.'/Data/TXmlDocument.php'); * Includes THttpUtility definition
*/
require_once(PRADO_DIR.'/Web/THttpUtility.php');
+/**
+ * Includes TCache definition
+ */
+require_once(PRADO_DIR.'/Data/TCache.php');
require_once(PRADO_DIR.'/Log/ILog.php');
@@ -103,74 +107,6 @@ interface IService }
/**
- * ICache interface.
- *
- * This interface must be implemented by cache managers.
- *
- * @author Qiang Xue <qiang.xue@gmail.com>
- * @version $Revision: $ $Date: $
- * @package System
- * @since 3.0
- */
-interface ICache
-{
- /**
- * Retrieves a value from cache with a specified key.
- * @return mixed the value stored in cache, false if the value is not in the cache or expired.
- */
- public function get($id);
- /**
- * Stores a value identified by a key into cache.
- * If the cache already contains such a key, the existing value and
- * expiration time will be replaced with the new ones.
- *
- * @param string the key identifying the value to be cached
- * @param mixed the value to be cached
- * @param integer the expiration time of the value,
- * 0 means never expire,
- * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
- * a number greater than 60 means a UNIX timestamp after which the value will expire.
- * @return boolean true if the value is successfully stored into cache, false otherwise
- */
- public function set($id,$value,$expire=0);
- /**
- * Stores a value identified by a key into cache if the cache does not contain this key.
- * Nothing will be done if the cache already contains the key.
- * @param string the key identifying the value to be cached
- * @param mixed the value to be cached
- * @param integer the expiration time of the value,
- * 0 means never expire,
- * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
- * a number greater than 60 means a UNIX timestamp after which the value will expire.
- * @return boolean true if the value is successfully stored into cache, false otherwise
- */
- public function add($id,$value,$expire=0);
- /**
- * Stores a value identified by a key into cache only if the cache contains this key.
- * The existing value and expiration time will be overwritten with the new ones.
- * @param string the key identifying the value to be cached
- * @param mixed the value to be cached
- * @param integer the expiration time of the value,
- * 0 means never expire,
- * a number less or equal than 60*60*24*30 means the number of seconds that the value will remain valid.
- * a number greater than 60 means a UNIX timestamp after which the value will expire.
- * @return boolean true if the value is successfully stored into cache, false otherwise
- */
- public function replace($id,$value,$expire=0);
- /**
- * Deletes a value with the specified key from cache
- * @param string the key of the value to be deleted
- * @return boolean if no error happens during deletion
- */
- public function delete($id);
- /**
- * Deletes all values from cache.
- * Be careful of performing this operation if the cache is shared by multiple applications.
- */
- public function flush();
-}
-
-/**
* ITextWriter interface.
*
* This interface must be implemented by writers.
|