summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Bas <ctrlaltca@gmail.com>2014-01-05 22:44:09 +0100
committerFabio Bas <ctrlaltca@gmail.com>2014-01-05 23:23:05 +0100
commite33efebbe5971909226d18b24d2b7030d3772665 (patch)
tree6e3b1004280ee3aecd529b69888b50b90407cb50
parent2a1b748241d09a600c8f4c3176059c87371f127b (diff)
Re-enable prototype-based scripts, and enable old drag&drop controls
-rwxr-xr-xdemos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php35
-rw-r--r--framework/Web/Javascripts/packages.php80
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/dragdrop.js12
-rwxr-xr-xframework/Web/UI/ActiveControls/TDropContainer.php54
4 files changed, 96 insertions, 85 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php
index 30ef750b..7d3163dc 100755
--- a/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/DragDrop/Home.php
@@ -9,12 +9,12 @@ class Home extends TPage
parent::onInit($param);
if (!$this->getIsPostBack() && !$this->getIsCallBack())
{
-
+
$this->populateProductList();
$this->populateShoppingList();
}
}
-
+
private function getProductData ()
{
return array (
@@ -30,38 +30,41 @@ class Home extends TPage
)
);
}
-
+
private function getProduct ($key)
{
foreach ($this->getProductData() as $product)
if ($product['ProductId']==$key) return $product;
- return null;
+ return null;
}
-
+
protected function populateProductList ()
{
$this->ProductList->DataSource=$this->getProductData();
$this->ProductList->Databind();
}
-
+
protected function populateShoppingList ()
{
$this->ShoppingList->DataSource=$this->getShoppingListData();
$this->ShoppingList->Databind();
-
+
}
-
-
+
+
public function getShoppingListData ()
{
+ $a=$this->getViewState('ShoppingList', array ());
+ var_export($a);
return $this->getViewState('ShoppingList', array ());
}
-
+
public function setShoppingListData ($value)
{
+ var_export($value);
$this->setViewState('ShoppingList', TPropertyValue::ensureArray($value), array ());
}
-
+
public function addItemToCart ($sender, $param)
{
$control=$param->getDroppedControl();
@@ -82,9 +85,9 @@ class Home extends TPage
$shoppingList[$key]['ProductCount']=1;
}
$this->setShoppingListData($shoppingList);
-
+
}
-
+
public function removeItemFromCart ($sender, $param)
{
$control=$param->getDroppedControl();
@@ -99,13 +102,13 @@ class Home extends TPage
unset($shoppingList[$key]);
}
$this->setShoppingListData($shoppingList);
-
+
}
-
+
public function redrawCart ($sender, $param)
{
$this->populateShoppingList();
$this->cart->render($param->NewWriter);
-
+
}
}
diff --git a/framework/Web/Javascripts/packages.php b/framework/Web/Javascripts/packages.php
index 8223ecba..a86ac3c0 100644
--- a/framework/Web/Javascripts/packages.php
+++ b/framework/Web/Javascripts/packages.php
@@ -9,11 +9,7 @@ if (!defined('SCRIPTACULOUS_DIR')) define ('SCRIPTACULOUS_DIR', 'scriptaculous-1
//package names and its contents (files relative to the current directory)
$packages = array(
- 'prototype' => array(
- PROTOTYPE_DIR.'/prototype.js',
- SCRIPTACULOUS_DIR.'/builder.js',
- SCRIPTACULOUS_DIR.'/effects.js'
- ),
+ // base prado scripts
'prado' => array(
'prado/prado.js',
'prado/controls/controls.js'
@@ -40,15 +36,6 @@ $packages = array(
'prado/activecontrols/activecontrols3.js',
),
- 'dragdrop'=>array(
- SCRIPTACULOUS_DIR.'/dragdrop.js',
- 'prado/activecontrols/dragdrop.js'
- ),
-
- 'dragdropextra'=>array(
- 'prado/activecontrols/dragdropextra.js',
- ),
-
'slider'=>array(
'prado/controls/slider.js'
),
@@ -60,19 +47,15 @@ $packages = array(
'tabpanel'=>array(
'prado/controls/tabpanel.js'
),
-
+
'activedatepicker' => array(
'prado/activecontrols/activedatepicker.js'
),
-
+
'activefileupload' => array(
'prado/activefileupload/activefileupload.js'
),
- 'accordion'=>array(
- 'prado/controls/accordion.js'
- ),
-
'htmlarea'=>array(
'prado/controls/htmlarea.js'
),
@@ -81,14 +64,6 @@ $packages = array(
'prado/controls/htmlarea4.js'
),
- 'ratings' => array(
- 'prado/ratings/ratings.js',
- ),
-
- 'inlineeditor' => array(
- 'prado/activecontrols/inlineeditor.js'
- ),
-
// jquery
'jquery' => array(
JQUERY_DIR.'/jquery.js',
@@ -98,12 +73,43 @@ $packages = array(
JQUERY_DIR.'/jquery-ui-i18n.min.js',
),
+ // prototype + scriptaculous
+ 'prototype' => array(
+ PROTOTYPE_DIR.'/prototype.js',
+ SCRIPTACULOUS_DIR.'/builder.js',
+ SCRIPTACULOUS_DIR.'/effects.js'
+ ),
+
+ 'dragdrop'=>array(
+ SCRIPTACULOUS_DIR.'/dragdrop.js',
+ 'prado/activecontrols/dragdrop.js'
+ ),
+
+ 'dragdropextra'=>array(
+ 'prado/activecontrols/dragdropextra.js',
+ ),
+
+ 'accordion'=>array(
+ 'prado/controls/accordion.js'
+ ),
+
+ 'ratings' => array(
+ 'prado/ratings/ratings.js',
+ ),
+
+ 'inlineeditor' => array(
+ 'prado/activecontrols/inlineeditor.js'
+ ),
+
+ 'autocomplete' => array(
+ SCRIPTACULOUS_DIR.'/controls.js',
+ 'prado/activecontrols/autocomplete.js'
+ ),
);
//package names and their dependencies
$dependencies = array(
- 'prototype' => array('prototype'),
'jquery' => array('jquery'),
'prado' => array('jquery', 'prado'),
'validator' => array('jquery', 'prado', 'validator'),
@@ -119,15 +125,15 @@ $dependencies = array(
'htmlarea4' => array('jquery', 'prado', 'htmlarea4'),
'keyboard' => array('jquery', 'prado', 'keyboard'),
'slider' => array('jquery', 'prado', 'slider'),
- 'dragdrop' => array(),
-/*
- 'dragdrop' => array('prototype', 'prado', 'effects', 'ajax', 'dragdrop'),
- 'dragdropextra' => array('prototype', 'prado', 'effects', 'ajax', 'dragdrop','dragdropextra'),
- 'accordion' => array('prototype', 'prado', 'effects', 'accordion'),
- 'ratings' => array('prototype', 'prado', 'effects', 'ajax', 'ratings'),
- 'inlineeditor' => array('prototype', 'prado', 'effects', 'ajax', 'inlineeditor'),
- */
+ 'inlineeditor' => array('jquery', 'prado', 'ajax', 'inlineeditor'),
'jqueryui' => array('jquery', 'jqueryui'),
+
+ 'prototype' => array('prototype'),
+ 'dragdrop' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop'),
+ 'dragdropextra' => array('prototype', 'jquery', 'prado', 'ajax', 'dragdrop','dragdropextra'),
+ 'accordion' => array('prototype', 'jquery', 'prado', 'accordion'),
+ 'ratings' => array('prototype', 'jquery', 'prado', 'ajax', 'ratings'),
+ 'autocomplete' => array('prototype', 'jquery', 'prado', 'ajax', 'autocomplete'),
);
return array($packages, $dependencies);
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
index 7fa9e791..9e583c1f 100755
--- a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
@@ -1,20 +1,22 @@
+jQuery.noConflict();
+
/**
* DropContainer control
*/
-
-Prado.WebUI.DropContainer = jQuery.klass(Prado.WebUI.CallbackControl,
+
+Prado.WebUI.DropContainer = Class.create(Prado.WebUI.CallbackControl,
{
onInit: function(options)
{
this.options = options;
- Object.extend (this.options,
+ Object.extend (this.options,
{
onDrop: this.onDrop.bind(this)
});
-
+
Droppables.add (options.ID, this.options);
},
-
+
onDrop: function(dragElement, dropElement, event)
{
var elementId=dragElement.id.replace(/clone_/,"");
diff --git a/framework/Web/UI/ActiveControls/TDropContainer.php b/framework/Web/UI/ActiveControls/TDropContainer.php
index 43e8017c..c7ea79b5 100755
--- a/framework/Web/UI/ActiveControls/TDropContainer.php
+++ b/framework/Web/UI/ActiveControls/TDropContainer.php
@@ -1,7 +1,7 @@
<?php
/**
* TDropContainer class file
- *
+ *
* @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
* @copyright Copyright &copy; 2008, PradoSoft
* @license http://www.pradosoft.com/license
@@ -24,29 +24,29 @@ Prado::using('System.Web.UI.ActiveControls.TActivePanel');
/**
* TDropContainer is a panel where TDraggable controls can be dropped.
* When a TDraggable component is dropped into a TDropContainer, the {@link OnDrop OnDrop} event is raised.
- * The {@link TDropContainerEventParameter} param will contain the dropped control.
- *
+ * The {@link TDropContainerEventParameter} param will contain the dropped control.
+ *
* Properties :
- *
+ *
* <b>{@link setAcceptCssClass AcceptCssClass}</b> : a coma delimited classname of elements that the drop container can accept.
* <b>{@link setHoverCssClass HoverCssClass}</b>: CSS classname of the container when a draggable element hovers over the container.
- *
+ *
* Events:
- *
+ *
* <b>{@link OnDrop OnDrop}</b> : raised when a TDraggable control is dropped. The dropped control id is encapsulated in the event parameter,
* as well as mouse coordinates and key modifiers status
*
- *
+ *
* @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
* @copyright Copyright &copy; 2008, PradoSoft
* @license http://www.pradosoft.com/license
* @version $Id: TDropContainer.php 3285 2013-04-11 07:28:07Z ctrlaltca $
* @package System.Web.UI.ActiveControls
*/
-class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHandler
-{
+class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHandler
+{
private $_container=null;
-
+
/**
* Creates a new callback control, sets the adapter to
* TActiveControlAdapter. If you override this class, be sure to set the
@@ -91,7 +91,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
{
$this->setViewState('Accepts', TPropertyValue::ensureArray($value), '');
}
-
+
/**
* Sets the Css class name used when a draggble element is hovering
* over this container.
@@ -111,8 +111,8 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
{
return $this->getViewState('HoverClass', '');
}
-
-
+
+
/**
* Raises callback event. This method is required bu {@link ICallbackEventHandler}
* interface.
@@ -125,19 +125,19 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
$this->onDrop($param->getCallbackParameter());
$this->onCallback($param);
}
-
+
/**
- * Raises the onDrop event.
+ * Raises the onDrop event.
* The drop parameters are encapsulated into a {@link TDropContainerEventParameter}
- *
+ *
* @param object $dropControlId
*/
public function onDrop ($dropParams)
{
$this->raiseEvent('OnDrop', $this, new TDropContainerEventParameter ($dropParams));
-
+
}
-
+
/**
* This method is invoked when a callback is requested. The method raises
* 'OnCallback' event to fire up the event handlers. If you override this
@@ -149,7 +149,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
{
$this->raiseEvent('OnCallback', $this, $param);
}
-
+
/**
* Gets the post back options for this textbox.
* @return array
@@ -163,7 +163,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
$options['hoverclass'] = $this->getHoverCssClass();
return $options;
}
-
+
/**
* Gets the name of the javascript class responsible for performing postback for this control.
* This method overrides the parent implementation.
@@ -172,7 +172,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
protected function getClientClassName()
{
return 'Prado.WebUI.DropContainer';
- }
+ }
/**
* Registers clientscripts
@@ -198,7 +198,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getPostBackOptions());
}
-
+
/**
* Creates child control
* Override parent implementation to create a container which will contain all
@@ -214,7 +214,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
parent::getControls()->add($this->_container);
}
}
-
+
/**
* Override parent implementation to return the container control collection.
*
@@ -225,7 +225,7 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
$this->ensureChildControls();
return $this->_container->getControls();
}
-
+
/**
* Renders and replaces the panel's content on the client-side.
* When render() is called before the OnPreRender event, such as when render()
@@ -246,15 +246,15 @@ class TDropContainer extends TPanel implements IActiveControl, ICallbackEventHan
$this->getPage()->getAdapter()->registerControlToRender($this->_container,$writer);
}
}
-
+
}
/**
* TDropContainerEventParameter class
- *
+ *
* TDropContainerEventParameter encapsulate the parameter
* data for <b>OnDrop</b> event of TDropContainer components
- *
+ *
* @author Christophe BOULAIN (Christophe.Boulain@ceram.fr)
* @copyright Copyright &copy; 2008, PradoSoft
* @license http://www.pradosoft.com/license