summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
authorchristophe.boulain <>2008-12-03 14:22:03 +0000
committerchristophe.boulain <>2008-12-03 14:22:03 +0000
commit6228873cf9d6471463d2413e7dfd7447f759baf2 (patch)
tree496a0e658330c39d4caa35602ba9f783b6f24f9c /framework/Web
parente8f239fea7351b248302a593a8e5eaa2a88c3e80 (diff)
Merge from trunk
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Javascripts/TJavaScript.php1
-rw-r--r--framework/Web/Javascripts/source/packages.php36
-rw-r--r--framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js749
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js79
-rwxr-xr-xframework/Web/Javascripts/source/prado/activecontrols/dragdrop.js24
-rw-r--r--framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js2
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html1
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.pngbin0 -> 663 bytes
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.pngbin0 -> 589 bytes
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gifbin0 -> 1553 bytes
-rwxr-xr-xframework/Web/Javascripts/source/prado/activefileupload/activefileupload.js63
-rw-r--r--framework/Web/Javascripts/source/prado/activeratings/blocks.css42
-rw-r--r--framework/Web/Javascripts/source/prado/activeratings/default.css43
-rw-r--r--framework/Web/Javascripts/source/prado/activeratings/ratings.js178
-rw-r--r--framework/Web/Javascripts/source/prado/controls/controls.js19
-rw-r--r--framework/Web/Javascripts/source/prado/datepicker/datepicker.js21
-rw-r--r--framework/Web/Javascripts/source/prado/ratings/ratings.js207
-rw-r--r--framework/Web/Javascripts/source/prado/validator/validation3.js13
-rw-r--r--framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js2
-rw-r--r--framework/Web/Services/TFeedService.php1
-rw-r--r--framework/Web/Services/TJsonService.php2
-rw-r--r--framework/Web/Services/TSoapService.php1
-rw-r--r--framework/Web/TAssetManager.php9
-rw-r--r--framework/Web/TCacheHttpSession.php1
-rw-r--r--framework/Web/THttpRequest.php1
-rw-r--r--framework/Web/THttpResponse.php1
-rw-r--r--framework/Web/THttpSession.php1
-rw-r--r--framework/Web/THttpUtility.php1
-rw-r--r--framework/Web/TUrlManager.php1
-rw-r--r--framework/Web/TUrlMapping.php50
-rw-r--r--framework/Web/UI/ActiveControls/TActiveButton.php1
-rw-r--r--framework/Web/UI/ActiveControls/TActiveControlAdapter.php9
-rw-r--r--framework/Web/UI/ActiveControls/TActiveCustomValidator.php1
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveDatePicker.php129
-rwxr-xr-xframework/Web/UI/ActiveControls/TActiveFileUpload.php315
-rw-r--r--framework/Web/UI/ActiveControls/TActiveHiddenField.php1
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLabel.php10
-rw-r--r--framework/Web/UI/ActiveControls/TActiveLinkButton.php5
-rw-r--r--framework/Web/UI/ActiveControls/TActivePageAdapter.php9
-rw-r--r--framework/Web/UI/ActiveControls/TActivePager.php9
-rw-r--r--framework/Web/UI/ActiveControls/TActivePanel.php1
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRadioButtonList.php6
-rw-r--r--framework/Web/UI/ActiveControls/TActiveRatingList.php344
-rw-r--r--framework/Web/UI/ActiveControls/TActiveTextBox.php1
-rw-r--r--framework/Web/UI/ActiveControls/TAutoComplete.php9
-rw-r--r--framework/Web/UI/ActiveControls/TBaseActiveControl.php5
-rw-r--r--framework/Web/UI/ActiveControls/TCallback.php1
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientScript.php1
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackClientSide.php1
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackEventParameter.php1
-rw-r--r--framework/Web/UI/ActiveControls/TCallbackOptions.php1
-rwxr-xr-xframework/Web/UI/ActiveControls/TDraggable.php152
-rwxr-xr-xframework/Web/UI/ActiveControls/TDropContainer.php275
-rw-r--r--framework/Web/UI/ActiveControls/TEventTriggeredCallback.php1
-rw-r--r--framework/Web/UI/ActiveControls/TInPlaceTextBox.php1
-rw-r--r--framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php24
-rw-r--r--framework/Web/UI/ActiveControls/TTriggeredCallback.php1
-rw-r--r--framework/Web/UI/ActiveControls/TValueTriggeredCallback.php1
-rw-r--r--framework/Web/UI/TCachePageStatePersister.php1
-rw-r--r--framework/Web/UI/TClientScriptManager.php10
-rw-r--r--framework/Web/UI/TCompositeControl.php1
-rw-r--r--framework/Web/UI/TControl.php8
-rw-r--r--framework/Web/UI/TControlAdapter.php1
-rw-r--r--framework/Web/UI/TForm.php1
-rw-r--r--framework/Web/UI/THtmlWriter.php1
-rw-r--r--framework/Web/UI/TPage.php8
-rw-r--r--framework/Web/UI/TPageStatePersister.php1
-rw-r--r--framework/Web/UI/TSessionPageStatePersister.php1
-rw-r--r--framework/Web/UI/TTemplateControl.php1
-rw-r--r--framework/Web/UI/TTemplateManager.php9
-rw-r--r--framework/Web/UI/WebControls/TBaseDataList.php1
-rw-r--r--framework/Web/UI/WebControls/TBaseValidator.php15
-rw-r--r--framework/Web/UI/WebControls/TBoundColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TBulletedList.php1
-rw-r--r--framework/Web/UI/WebControls/TButton.php1
-rw-r--r--framework/Web/UI/WebControls/TButtonColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TCaptcha.php1
-rw-r--r--framework/Web/UI/WebControls/TCaptchaValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TCheckBox.php18
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TCheckBoxList.php19
-rw-r--r--framework/Web/UI/WebControls/TClientScript.php1
-rw-r--r--framework/Web/UI/WebControls/TClientScriptLoader.php1
-rw-r--r--framework/Web/UI/WebControls/TColorPicker.php4
-rw-r--r--framework/Web/UI/WebControls/TCompareValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TConditional.php1
-rw-r--r--framework/Web/UI/WebControls/TContent.php1
-rw-r--r--framework/Web/UI/WebControls/TContentPlaceHolder.php1
-rw-r--r--framework/Web/UI/WebControls/TCustomValidator.php26
-rw-r--r--framework/Web/UI/WebControls/TDataGrid.php1
-rw-r--r--framework/Web/UI/WebControls/TDataGridColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TDataGridItemRenderer.php1
-rw-r--r--framework/Web/UI/WebControls/TDataGridPagerStyle.php1
-rw-r--r--framework/Web/UI/WebControls/TDataList.php1
-rw-r--r--framework/Web/UI/WebControls/TDataListItemRenderer.php1
-rw-r--r--framework/Web/UI/WebControls/TDataRenderer.php1
-rw-r--r--framework/Web/UI/WebControls/TDataSourceControl.php1
-rw-r--r--framework/Web/UI/WebControls/TDataSourceView.php1
-rw-r--r--framework/Web/UI/WebControls/TDataTypeValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TDatePicker.php46
-rw-r--r--framework/Web/UI/WebControls/TDropDownList.php19
-rw-r--r--framework/Web/UI/WebControls/TDropDownListColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TEditCommandColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TEmailAddressValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TExpression.php1
-rw-r--r--framework/Web/UI/WebControls/TFileUpload.php20
-rw-r--r--framework/Web/UI/WebControls/TFont.php1
-rw-r--r--framework/Web/UI/WebControls/THead.php21
-rw-r--r--framework/Web/UI/WebControls/THiddenField.php19
-rw-r--r--framework/Web/UI/WebControls/THtmlArea.php1
-rw-r--r--framework/Web/UI/WebControls/THyperLink.php1
-rw-r--r--framework/Web/UI/WebControls/THyperLinkColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TImage.php1
-rw-r--r--framework/Web/UI/WebControls/TImageMap.php1
-rw-r--r--framework/Web/UI/WebControls/TInlineFrame.php1
-rw-r--r--framework/Web/UI/WebControls/TItemDataRenderer.php1
-rw-r--r--framework/Web/UI/WebControls/TJavascriptLogger.php1
-rw-r--r--framework/Web/UI/WebControls/TKeyboard.php1
-rw-r--r--framework/Web/UI/WebControls/TLabel.php1
-rw-r--r--framework/Web/UI/WebControls/TLinkButton.php1
-rw-r--r--framework/Web/UI/WebControls/TListBox.php19
-rw-r--r--framework/Web/UI/WebControls/TListControlValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TListItem.php1
-rw-r--r--framework/Web/UI/WebControls/TLiteral.php1
-rw-r--r--framework/Web/UI/WebControls/TLiteralColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TMarkdown.php1
-rw-r--r--framework/Web/UI/WebControls/TMultiView.php1
-rw-r--r--framework/Web/UI/WebControls/TOutputCache.php1
-rw-r--r--framework/Web/UI/WebControls/TPager.php1
-rw-r--r--framework/Web/UI/WebControls/TPanel.php1
-rw-r--r--framework/Web/UI/WebControls/TPanelStyle.php1
-rw-r--r--framework/Web/UI/WebControls/TPlaceHolder.php1
-rw-r--r--framework/Web/UI/WebControls/TRadioButton.php1
-rw-r--r--framework/Web/UI/WebControls/TRadioButtonList.php1
-rw-r--r--framework/Web/UI/WebControls/TRangeValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TRatingList.php348
-rw-r--r--framework/Web/UI/WebControls/TRegularExpressionValidator.php21
-rw-r--r--framework/Web/UI/WebControls/TRepeatInfo.php1
-rw-r--r--framework/Web/UI/WebControls/TRepeater.php1
-rw-r--r--framework/Web/UI/WebControls/TRepeaterItemRenderer.php1
-rw-r--r--framework/Web/UI/WebControls/TRequiredFieldValidator.php1
-rw-r--r--framework/Web/UI/WebControls/TSafeHtml.php1
-rw-r--r--framework/Web/UI/WebControls/TSlider.php7
-rw-r--r--framework/Web/UI/WebControls/TStatements.php1
-rw-r--r--framework/Web/UI/WebControls/TStyle.php1
-rw-r--r--framework/Web/UI/WebControls/TTable.php1
-rw-r--r--framework/Web/UI/WebControls/TTableCell.php1
-rw-r--r--framework/Web/UI/WebControls/TTableFooterRow.php1
-rw-r--r--framework/Web/UI/WebControls/TTableHeaderCell.php1
-rw-r--r--framework/Web/UI/WebControls/TTableHeaderRow.php1
-rw-r--r--framework/Web/UI/WebControls/TTableRow.php1
-rw-r--r--framework/Web/UI/WebControls/TTemplateColumn.php1
-rw-r--r--framework/Web/UI/WebControls/TTextBox.php19
-rw-r--r--framework/Web/UI/WebControls/TTextHighlighter.php1
-rw-r--r--framework/Web/UI/WebControls/TTextProcessor.php1
-rw-r--r--framework/Web/UI/WebControls/TValidationSummary.php1
-rw-r--r--framework/Web/UI/WebControls/TWebControl.php1
-rw-r--r--framework/Web/UI/WebControls/TWebControlAdapter.php1
-rw-r--r--framework/Web/UI/WebControls/TWizard.php1
-rw-r--r--framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php1
-rw-r--r--framework/Web/UI/WebControls/TXmlTransform.php1
-rw-r--r--framework/Web/UI/WebControls/assets/captcha.php1
162 files changed, 2318 insertions, 1287 deletions
diff --git a/framework/Web/Javascripts/TJavaScript.php b/framework/Web/Javascripts/TJavaScript.php
index 511515c8..9c4741a4 100644
--- a/framework/Web/Javascripts/TJavaScript.php
+++ b/framework/Web/Javascripts/TJavaScript.php
@@ -227,4 +227,3 @@ class TJavaScript
}
}
-?>
diff --git a/framework/Web/Javascripts/source/packages.php b/framework/Web/Javascripts/source/packages.php
index 1cca7b7c..d6c04e7f 100644
--- a/framework/Web/Javascripts/source/packages.php
+++ b/framework/Web/Javascripts/source/packages.php
@@ -47,7 +47,8 @@ $packages = array(
),
'dragdrop'=>array(
- SCRIPTACULOUS_DIR.'/dragdrop.js'
+ SCRIPTACULOUS_DIR.'/dragdrop.js',
+ 'prado/activecontrols/dragdrop.js'
),
'slider'=>array(
@@ -60,6 +61,14 @@ $packages = array(
'tabpanel'=>array(
'prado/controls/tabpanel.js'
+ ),
+
+ 'activedatepicker' => array(
+ 'prado/activecontrols/activedatepicker.js'
+ ),
+
+ 'activefileupload' => array(
+ 'prado/activefileupload/activefileupload.js'
),
);
@@ -67,19 +76,20 @@ $packages = array(
//package names and their dependencies
$dependencies = array(
- 'prado' => array('prado'),
- 'effects' => array('prado', 'effects'),
- 'validator' => array('prado', 'validator'),
- 'logger' => array('prado', 'logger'),
- 'datepicker' => array('prado', 'datepicker'),
- 'colorpicker' => array('prado', 'colorpicker'),
- 'ajax' => array('prado', 'effects', 'ajax'),
- 'dragdrop' => array('prado', 'effects', 'dragdrop'),
- 'slider' => array('prado', 'slider'),
- 'keyboard' => array('prado', 'keyboard'),
- 'tabpanel' => array('prado', 'tabpanel'),
+ 'prado' => array('prado'),
+ 'effects' => array('prado', 'effects'),
+ 'validator' => array('prado', 'validator'),
+ 'logger' => array('prado', 'logger'),
+ 'datepicker' => array('prado', 'datepicker'),
+ 'colorpicker' => array('prado', 'colorpicker'),
+ 'ajax' => array('prado', 'effects', 'ajax'),
+ 'dragdrop' => array('prado', 'effects', 'ajax', 'dragdrop'),
+ 'slider' => array('prado', 'slider'),
+ 'keyboard' => array('prado', 'keyboard'),
+ 'tabpanel' => array('prado', 'tabpanel'),
+ 'activedatepicker' => array('datepicker', 'ajax', 'activedatepicker'),
+ 'activefileupload' => array('prado', 'ajax', 'activefileupload'),
);
return array($packages, $dependencies);
-?>
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
index 7ee4c0e6..d5cae7b8 100644
--- a/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activecontrols3.js
@@ -1,362 +1,387 @@
-/**
- * Generic postback control.
- */
-Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl,
-{
- onPostBack : function(event, options)
- {
- var request = new Prado.CallbackRequest(options.EventTarget, options);
- request.dispatch();
- Event.stop(event);
- }
-});
-
-/**
- * TActiveButton control.
- */
-Prado.WebUI.TActiveButton = Class.extend(Prado.WebUI.CallbackControl);
-/**
- * TActiveLinkButton control.
- */
-Prado.WebUI.TActiveLinkButton = Class.extend(Prado.WebUI.CallbackControl);
-
-Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton,
-{
- onPostBack : function(event, options)
- {
- this.addXYInput(event,options);
- var request = new Prado.CallbackRequest(options.EventTarget, options);
- request.dispatch();
- Event.stop(event);
- }
-});
-/**
- * Active check box.
- */
-Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl,
-{
- onPostBack : function(event, options)
- {
- var request = new Prado.CallbackRequest(options.EventTarget, options);
- if(request.dispatch()==false)
- Event.stop(event);
- }
-});
-
-/**
- * TActiveRadioButton control.
- */
-Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox);
-
-
-Prado.WebUI.TActiveCheckBoxList = Base.extend(
-{
- constructor : function(options)
- {
- for(var i = 0; i<options.ItemCount; i++)
- {
- var checkBoxOptions = Object.extend(
- {
- ID : options.ListID+"_c"+i,
- EventTarget : options.ListName+"$c"+i
- }, options);
- new Prado.WebUI.TActiveCheckBox(checkBoxOptions);
- }
- }
-});
-
-Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList;
-
-/**
- * TActiveTextBox control, handles onchange event.
- */
-Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox,
-{
- onInit : function(options)
- {
- this.options=options;
- if(options['TextMode'] != 'MultiLine')
- Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
- if(this.options['AutoPostBack']==true)
- Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
- },
-
- doCallback : function(event, options)
- {
- var request = new Prado.CallbackRequest(options.EventTarget, options);
- request.dispatch();
- if (!Prototype.Browser.IE)
- Event.stop(event);
- }
-});
-
-/**
- * TAutoComplete control.
- */
-Prado.WebUI.TAutoComplete = Class.extend(Autocompleter.Base, Prado.WebUI.TActiveTextBox.prototype);
-Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
-{
- initialize : function(options)
- {
- this.options = options;
- this.hasResults = false;
- this.baseInitialize(options.ID, options.ResultPanel, options);
- Object.extend(this.options,
- {
- onSuccess : this.onComplete.bind(this)
- });
-
- if(options.AutoPostBack)
- this.onInit(options);
- },
-
- doCallback : function(event, options)
- {
- if(!this.active)
- {
- var request = new Prado.CallbackRequest(this.options.EventTarget, options);
- request.dispatch();
- Event.stop(event);
- }
- },
-
- //Overrides parent implementation, fires onchange event.
- onClick: function(event)
- {
- var element = Event.findElement(event, 'LI');
- this.index = element.autocompleteIndex;
- this.selectEntry();
- this.hide();
- Event.fireEvent(this.element, "change");
- },
-
- getUpdatedChoices : function()
- {
- var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
- Prado.Callback(this.options.EventTarget, options, null, this.options);
- },
-
- /**
- * Overrides parent implements, don't update if no results.
- */
- selectEntry: function()
- {
- if(this.hasResults)
- {
- this.active = false;
- this.updateElement(this.getCurrentEntry());
- var options = [this.index, "__TAutoComplete_onSuggestionSelected__"];
- Prado.Callback(this.options.EventTarget, options, null, this.options);
- }
- },
-
- onComplete : function(request, boundary)
- {
- var result = Prado.Element.extractContent(request.transport.responseText, boundary);
- if(typeof(result) == "string")
- {
- if(result.length > 0)
- {
- this.hasResults = true;
- this.updateChoices(result);
- }
- else
- {
- this.active = false;
- this.hasResults = false;
- this.hide();
- }
- }
- }
-});
-
-/**
- * Time Triggered Callback class.
- */
-Prado.WebUI.TTimeTriggeredCallback = Base.extend(
-{
- constructor : function(options)
- {
- this.options = Object.extend({ Interval : 1 }, options || {});
- Prado.WebUI.TTimeTriggeredCallback.register(this);
- },
-
- startTimer : function()
- {
- setTimeout(this.onTimerEvent.bind(this), 100);
- if(typeof(this.timer) == 'undefined' || this.timer == null)
- this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
- },
-
- stopTimer : function()
- {
- if(typeof(this.timer) != 'undefined')
- {
- clearInterval(this.timer);
- this.timer = null;
- }
- },
-
- onTimerEvent : function()
- {
- var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
- request.dispatch();
- }
-},
-//class methods
-{
- timers : {},
-
- register : function(timer)
- {
- Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer;
- },
-
- start : function(id)
- {
- if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
- Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();
- },
-
- stop : function(id)
- {
- if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
- Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();
- }
-});
-
-Prado.WebUI.ActiveListControl = Base.extend(
-{
- constructor : function(options)
- {
- this.element = $(options.ID);
- if(this.element)
- {
- this.options = options;
- Event.observe(this.element, "change", this.doCallback.bind(this));
- }
- },
-
- doCallback : function(event)
- {
- var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
- request.dispatch();
- Event.stop(event);
- }
-});
-
-Prado.WebUI.TActiveDropDownList = Prado.WebUI.ActiveListControl;
-Prado.WebUI.TActiveListBox = Prado.WebUI.ActiveListControl;
-
-/**
- * Observe event of a particular control to trigger a callback request.
- */
-Prado.WebUI.TEventTriggeredCallback = Base.extend(
-{
- constructor : function(options)
- {
- this.options = options;
- var element = $(options['ControlID']);
- if(element)
- Event.observe(element, this.getEventName(element), this.doCallback.bind(this));
- },
-
- getEventName : function(element)
- {
- var name = this.options.EventName;
- if(typeof(name) == "undefined" && element.type)
- {
- switch (element.type.toLowerCase())
- {
- case 'password':
- case 'text':
- case 'textarea':
- case 'select-one':
- case 'select-multiple':
- return 'change';
- }
- }
- return typeof(name) == "undefined" || name == "undefined" ? 'click' : name;
- },
-
- doCallback : function(event)
- {
- var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
- request.dispatch();
- if(this.options.StopEvent == true)
- Event.stop(event);
- }
-});
-
-/**
- * Observe changes to a property of a particular control to trigger a callback.
- */
-Prado.WebUI.TValueTriggeredCallback = Base.extend(
-{
- count : 1,
-
- observing : true,
-
- constructor : function(options)
- {
- this.options = options;
- this.options.PropertyName = this.options.PropertyName || 'value';
- var element = $(options['ControlID']);
- this.value = element ? element[this.options.PropertyName] : undefined;
- Prado.WebUI.TValueTriggeredCallback.register(this);
- this.startObserving();
- },
-
- stopObserving : function()
- {
- clearTimeout(this.timer);
- this.observing = false;
- },
-
- startObserving : function()
- {
- this.timer = setTimeout(this.checkChanges.bind(this), this.options.Interval*1000);
- },
-
- checkChanges : function()
- {
- var element = $(this.options.ControlID);
- if(element)
- {
- var value = element[this.options.PropertyName];
- if(this.value != value)
- {
- this.doCallback(this.value, value);
- this.value = value;
- this.count=1;
- }
- else
- this.count = this.count + this.options.Decay;
- if(this.observing)
- this.time = setTimeout(this.checkChanges.bind(this),
- parseInt(this.options.Interval*1000*this.count));
- }
- },
-
- doCallback : function(oldValue, newValue)
- {
- var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
- var param = {'OldValue' : oldValue, 'NewValue' : newValue};
- request.setCallbackParameter(param);
- request.dispatch();
- }
-},
-//class methods
-{
- timers : {},
-
- register : function(timer)
- {
- Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer;
- },
-
- stop : function(id)
- {
- Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();
- }
-});
+/**
+ * Generic postback control.
+ */
+Prado.WebUI.CallbackControl = Class.extend(Prado.WebUI.PostBackControl,
+{
+ onPostBack : function(event, options)
+ {
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ request.dispatch();
+ Event.stop(event);
+ }
+});
+
+/**
+ * TActiveButton control.
+ */
+Prado.WebUI.TActiveButton = Class.extend(Prado.WebUI.CallbackControl);
+/**
+ * TActiveLinkButton control.
+ */
+Prado.WebUI.TActiveLinkButton = Class.extend(Prado.WebUI.CallbackControl);
+
+Prado.WebUI.TActiveImageButton = Class.extend(Prado.WebUI.TImageButton,
+{
+ onPostBack : function(event, options)
+ {
+ this.addXYInput(event,options);
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ request.dispatch();
+ Event.stop(event);
+ this.removeXYInput(event,options);
+ }
+});
+/**
+ * Active check box.
+ */
+Prado.WebUI.TActiveCheckBox = Class.extend(Prado.WebUI.CallbackControl,
+{
+ onPostBack : function(event, options)
+ {
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ if(request.dispatch()==false)
+ Event.stop(event);
+ }
+});
+
+/**
+ * TActiveRadioButton control.
+ */
+Prado.WebUI.TActiveRadioButton = Class.extend(Prado.WebUI.TActiveCheckBox);
+
+
+Prado.WebUI.TActiveCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var checkBoxOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TActiveCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TActiveRadioButtonList = Prado.WebUI.TActiveCheckBoxList;
+
+/**
+ * TActiveTextBox control, handles onchange event.
+ */
+Prado.WebUI.TActiveTextBox = Class.extend(Prado.WebUI.TTextBox,
+{
+ onInit : function(options)
+ {
+ this.options=options;
+ if(options['TextMode'] != 'MultiLine')
+ Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", this.doCallback.bindEvent(this,options));
+ },
+
+ doCallback : function(event, options)
+ {
+ var request = new Prado.CallbackRequest(options.EventTarget, options);
+ request.dispatch();
+ if (!Prototype.Browser.IE)
+ Event.stop(event);
+ }
+});
+
+/**
+ * TAutoComplete control.
+ */
+Prado.WebUI.TAutoComplete = Class.extend(Autocompleter.Base, Prado.WebUI.TActiveTextBox.prototype);
+Prado.WebUI.TAutoComplete = Class.extend(Prado.WebUI.TAutoComplete,
+{
+ initialize : function(options)
+ {
+ this.options = options;
+ this.hasResults = false;
+ this.baseInitialize(options.ID, options.ResultPanel, options);
+ Object.extend(this.options,
+ {
+ onSuccess : this.onComplete.bind(this)
+ });
+
+ if(options.AutoPostBack)
+ this.onInit(options);
+ },
+
+ doCallback : function(event, options)
+ {
+ if(!this.active)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, options);
+ request.dispatch();
+ Event.stop(event);
+ }
+ },
+
+ //Overrides parent implementation, fires onchange event.
+ onClick: function(event)
+ {
+ var element = Event.findElement(event, 'LI');
+ this.index = element.autocompleteIndex;
+ this.selectEntry();
+ this.hide();
+ Event.fireEvent(this.element, "change");
+ },
+
+ getUpdatedChoices : function()
+ {
+ var options = new Array(this.getToken(),"__TAutoComplete_onSuggest__");
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ },
+
+ /**
+ * Overrides parent implements, don't update if no results.
+ */
+ selectEntry: function()
+ {
+ if(this.hasResults)
+ {
+ this.active = false;
+ this.updateElement(this.getCurrentEntry());
+ var options = [this.index, "__TAutoComplete_onSuggestionSelected__"];
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ }
+ },
+
+ onComplete : function(request, boundary)
+ {
+ var result = Prado.Element.extractContent(request.transport.responseText, boundary);
+ if(typeof(result) == "string")
+ {
+ if(result.length > 0)
+ {
+ this.hasResults = true;
+ this.updateChoices(result);
+ }
+ else
+ {
+ this.active = false;
+ this.hasResults = false;
+ this.hide();
+ }
+ }
+ }
+});
+
+/**
+ * Time Triggered Callback class.
+ */
+Prado.WebUI.TTimeTriggeredCallback = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = Object.extend({ Interval : 1 }, options || {});
+ Prado.WebUI.TTimeTriggeredCallback.register(this);
+ },
+
+ startTimer : function()
+ {
+ setTimeout(this.onTimerEvent.bind(this), 100);
+ if(typeof(this.timer) == 'undefined' || this.timer == null)
+ this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
+ },
+
+ stopTimer : function()
+ {
+ if(typeof(this.timer) != 'undefined')
+ {
+ clearInterval(this.timer);
+ this.timer = null;
+ }
+ },
+
+ resetTimer : function()
+ {
+ if(typeof(this.timer) != 'undefined')
+ {
+ clearInterval(this.timer);
+ this.timer = null;
+ this.timer = setInterval(this.onTimerEvent.bind(this),this.options.Interval*1000);
+ }
+ },
+
+ onTimerEvent : function()
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.dispatch();
+ },
+
+ setInterval : function(value)
+ {
+ if (this.options.Interval != value){
+ this.options.Interval = value;
+ this.resetTimer();
+ }
+ }
+},
+//class methods
+{
+ timers : {},
+
+ register : function(timer)
+ {
+ Prado.WebUI.TTimeTriggeredCallback.timers[timer.options.ID] = timer;
+ },
+
+ start : function(id)
+ {
+ if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].startTimer();
+ },
+
+ stop : function(id)
+ {
+ if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].stopTimer();
+ },
+
+ setInterval : function (id,value)
+ {
+ if(Prado.WebUI.TTimeTriggeredCallback.timers[id])
+ Prado.WebUI.TTimeTriggeredCallback.timers[id].setInterval(value);
+ }
+});
+
+Prado.WebUI.ActiveListControl = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.element = $(options.ID);
+ if(this.element)
+ {
+ this.options = options;
+ Event.observe(this.element, "change", this.doCallback.bind(this));
+ }
+ },
+
+ doCallback : function(event)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.dispatch();
+ Event.stop(event);
+ }
+});
+
+Prado.WebUI.TActiveDropDownList = Prado.WebUI.ActiveListControl;
+Prado.WebUI.TActiveListBox = Prado.WebUI.ActiveListControl;
+
+/**
+ * Observe event of a particular control to trigger a callback request.
+ */
+Prado.WebUI.TEventTriggeredCallback = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = options;
+ var element = $(options['ControlID']);
+ if(element)
+ Event.observe(element, this.getEventName(element), this.doCallback.bind(this));
+ },
+
+ getEventName : function(element)
+ {
+ var name = this.options.EventName;
+ if(typeof(name) == "undefined" && element.type)
+ {
+ switch (element.type.toLowerCase())
+ {
+ case 'password':
+ case 'text':
+ case 'textarea':
+ case 'select-one':
+ case 'select-multiple':
+ return 'change';
+ }
+ }
+ return typeof(name) == "undefined" || name == "undefined" ? 'click' : name;
+ },
+
+ doCallback : function(event)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ request.dispatch();
+ if(this.options.StopEvent == true)
+ Event.stop(event);
+ }
+});
+
+/**
+ * Observe changes to a property of a particular control to trigger a callback.
+ */
+Prado.WebUI.TValueTriggeredCallback = Base.extend(
+{
+ count : 1,
+
+ observing : true,
+
+ constructor : function(options)
+ {
+ this.options = options;
+ this.options.PropertyName = this.options.PropertyName || 'value';
+ var element = $(options['ControlID']);
+ this.value = element ? element[this.options.PropertyName] : undefined;
+ Prado.WebUI.TValueTriggeredCallback.register(this);
+ this.startObserving();
+ },
+
+ stopObserving : function()
+ {
+ clearTimeout(this.timer);
+ this.observing = false;
+ },
+
+ startObserving : function()
+ {
+ this.timer = setTimeout(this.checkChanges.bind(this), this.options.Interval*1000);
+ },
+
+ checkChanges : function()
+ {
+ var element = $(this.options.ControlID);
+ if(element)
+ {
+ var value = element[this.options.PropertyName];
+ if(this.value != value)
+ {
+ this.doCallback(this.value, value);
+ this.value = value;
+ this.count=1;
+ }
+ else
+ this.count = this.count + this.options.Decay;
+ if(this.observing)
+ this.time = setTimeout(this.checkChanges.bind(this),
+ parseInt(this.options.Interval*1000*this.count));
+ }
+ },
+
+ doCallback : function(oldValue, newValue)
+ {
+ var request = new Prado.CallbackRequest(this.options.EventTarget, this.options);
+ var param = {'OldValue' : oldValue, 'NewValue' : newValue};
+ request.setCallbackParameter(param);
+ request.dispatch();
+ }
+},
+//class methods
+{
+ timers : {},
+
+ register : function(timer)
+ {
+ Prado.WebUI.TValueTriggeredCallback.timers[timer.options.ID] = timer;
+ },
+
+ stop : function(id)
+ {
+ Prado.WebUI.TValueTriggeredCallback.timers[id].stopObserving();
+ }
+});
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
new file mode 100755
index 00000000..87b48bf3
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activecontrols/activedatepicker.js
@@ -0,0 +1,79 @@
+/**
+ * TActiveDatePicker control
+ */
+Prado.WebUI.TActiveDatePicker = Class.extend(Prado.WebUI.TDatePicker,
+{
+ initialize : function(options)
+ {
+ this.options = options || [];
+ this.control = $(options.ID);
+ this.dateSlot = new Array(42);
+ this.weekSlot = new Array(6);
+ this.minimalDaysInFirstWeek = 4;
+ this.selectedDate = this.newDate();
+ this.positionMode = 'Bottom';
+
+ //which element to trigger to show the calendar
+ if(this.options.Trigger)
+ {
+ this.trigger = $(this.options.Trigger) ;
+ var triggerEvent = this.options.TriggerEvent || "click";
+ }
+ else
+ {
+ this.trigger = this.control;
+ var triggerEvent = this.options.TriggerEvent || "focus";
+ }
+
+ // Popup position
+ if(this.options.PositionMode == 'Top')
+ {
+ this.positionMode = this.options.PositionMode;
+ }
+
+ Object.extend(this,options);
+
+ Event.observe(this.trigger, triggerEvent, this.show.bindEvent(this));
+
+ // Listen to change event
+ if(this.options.InputMode == "TextBox")
+ {
+ Event.observe(this.control, "change", this.onDateChanged.bindEvent(this));
+ }
+ else
+ {
+ var day = Prado.WebUI.TDatePicker.getDayListControl(this.control);
+ var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control);
+ var year = Prado.WebUI.TDatePicker.getYearListControl(this.control);
+ Event.observe (day, "change", this.onDateChanged.bindEvent(this));
+ Event.observe (month, "change", this.onDateChanged.bindEvent(this));
+ Event.observe (year, "change", this.onDateChanged.bindEvent(this));
+
+ }
+
+ },
+
+ // Respond to change event on the textbox or dropdown list
+ // This method raises OnDateChanged event on client side if it has been defined,
+ // and raise the callback request
+ onDateChanged : function ()
+ {
+ var date;
+ if (this.options.InputMode == "TextBox")
+ {
+ date=this.control.value;
+ }
+ else
+ {
+ var day = Prado.WebUI.TDatePicker.getDayListControl(this.control).selectedIndex+1;
+ var month = Prado.WebUI.TDatePicker.getMonthListControl(this.control).selectedIndex;
+ var year = Prado.WebUI.TDatePicker.getYearListControl(this.control).value;
+ date=new Date(year, month, day, 0,0,0).SimpleFormat(this.Format, this);
+ }
+ if (typeof(this.options.OnDateChanged) == "function") this.options.OnDateChanged(this, date);
+
+ // Make callback request
+ var request = new Prado.CallbackRequest(this.options.EventTarget,this.options);
+ request.dispatch();
+ }
+});
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
new file mode 100755
index 00000000..0b42afd5
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activecontrols/dragdrop.js
@@ -0,0 +1,24 @@
+/**
+ * DropContainer control
+ */
+
+Prado.WebUI.DropContainer = Class.extend(Prado.WebUI.CallbackControl);
+
+Object.extend(Prado.WebUI.DropContainer.prototype,
+{
+ initialize: function(options)
+ {
+ this.options = options;
+ Object.extend (this.options,
+ {
+ onDrop: this.onDrop.bind(this)
+ });
+
+ Droppables.add (options.ID, this.options);
+ },
+
+ onDrop: function(dragElement, dropElement)
+ {
+ Prado.Callback(this.options.EventTarget, dragElement.id, null, this.options);
+ }
+});
diff --git a/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js b/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js
index 87b8ddde..51e3f489 100644
--- a/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js
+++ b/framework/Web/Javascripts/source/prado/activecontrols/inlineeditor.js
@@ -188,7 +188,7 @@ Prado.WebUI.TInPlaceTextBox = Base.extend(
if(this.options.AutoHide)
this.showLabel();
}
- else if (Event.keyCode(e) == Event.KEY_RETURN)
+ else if (Event.keyCode(e) == Event.KEY_RETURN && this.options.TextMode != 'MultiLine')
Event.stop(e);
},
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html
new file mode 100755
index 00000000..44f50ce4
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadBlank.html
@@ -0,0 +1 @@
+<!-- Nothing here to see, move right along. --> \ No newline at end of file
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png
new file mode 100755
index 00000000..98badd7f
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadComplete.png
Binary files differ
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png
new file mode 100755
index 00000000..26c529fc
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadError.png
Binary files differ
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif
new file mode 100755
index 00000000..085ccaec
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activefileupload/ActiveFileUploadIndicator.gif
Binary files differ
diff --git a/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
new file mode 100755
index 00000000..9f57f912
--- /dev/null
+++ b/framework/Web/Javascripts/source/prado/activefileupload/activefileupload.js
@@ -0,0 +1,63 @@
+Prado.WebUI.TActiveFileUpload = Base.extend(
+{
+ constructor : function(options)
+ {
+ this.options = options || {};
+ Prado.WebUI.TActiveFileUpload.register(this);
+
+ this.input = $(options.inputID);
+ this.flag = $(options.flagID);
+ this.form = $(options.formID);
+
+ this.indicator = $(options.indicatorID);
+ this.complete = $(options.completeID);
+ this.error = $(options.errorID);
+
+ // set up events
+ Event.observe(this.input,"change",this.fileChanged.bind(this));
+ },
+
+ fileChanged:function(){
+ // show the upload indicator, and hide the complete and error indicators (if they areSn't already).
+ this.flag.value = '1';
+ this.complete.style.display = 'none';
+ this.error.style.display = 'none';
+ this.indicator.style.display = '';
+
+ // set the form to submit in the iframe, submit it, and then reset it.
+ this.oldtargetID = this.form.target;
+ this.form.target = this.options.targetID;
+ this.form.submit();
+ this.form.target = this.oldtargetID;
+ },
+
+ finishUpload:function(options){
+ // hide the display indicator.
+ this.flag.value = '';
+ this.indicator.style.display = 'none';
+ if (this.options.targetID == options.targetID){
+ // show the complete indicator.
+ if (options.errorCode == 0){
+ this.complete.style.display = '';
+ this.input.value = '';
+ } else {
+ this.error.style.display = '';
+ }
+ Prado.Callback(this.options.EventTarget, options, null, this.options);
+ }
+ }
+},
+{
+// class methods
+ controls : {},
+
+ register : function(control)
+ {
+ Prado.WebUI.TActiveFileUpload.controls[control.options.ID] = control;
+ },
+
+ onFileUpload: function(options)
+ {
+ Prado.WebUI.TActiveFileUpload.controls[options.clientID].finishUpload(options);
+ }
+}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/source/prado/activeratings/blocks.css b/framework/Web/Javascripts/source/prado/activeratings/blocks.css
deleted file mode 100644
index bb846094..00000000
--- a/framework/Web/Javascripts/source/prado/activeratings/blocks.css
+++ /dev/null
@@ -1,42 +0,0 @@
-.TActiveRatingList_blocks
-{
- border-collapse: collapse;
-}
-.TActiveRatingList_blocks input, .TActiveRatingList_blocks label
-{
- display: none;
-}
-
-.TActiveRatingList_blocks td
-{
- width: 18px;
- height: 9px;
- padding: 1px;
-}
-
-.TActiveRatingList_blocks td.rating
-{
- background-image: url(blocks_combined.gif);
- background-repeat: no-repeat;
- cursor: pointer;
- background-position: 1px 0px;
-}
-.TActiveRatingList_blocks td.rating_selected
-{
- background-position: 1px -100px;
-}
-
-.TActiveRatingList_blocks td.rating_half
-{
- background-position: 1px -200px;
-}
-
-.TActiveRatingList_blocks td.rating_hover
-{
- background-position: 1px -300px;
-}
-
-.TActiveRatingList_blocks td.rating_disabled
-{
- cursor: default !important;
-}
diff --git a/framework/Web/Javascripts/source/prado/activeratings/default.css b/framework/Web/Javascripts/source/prado/activeratings/default.css
deleted file mode 100644
index ba90eb27..00000000
--- a/framework/Web/Javascripts/source/prado/activeratings/default.css
+++ /dev/null
@@ -1,43 +0,0 @@
-.TActiveRatingList_default
-{
- border-collapse: collapse;
-}
-.TActiveRatingList_default input, .TActiveRatingList_default label
-{
- display: none;
-}
-
-.TActiveRatingList_default td
-{
- width: 18px;
- height: 18px;
- padding: 0;
-}
-
-.TActiveRatingList_default td.rating
-{
- background-image: url(default_combined.gif);
- background-repeat: no-repeat;
- cursor: pointer;
- background-position: 0px 0px;
-}
-
-.TActiveRatingList_default td.rating_selected
-{
- background-position: 0px -100px;
-}
-
-.TActiveRatingList_default td.rating_half
-{
- background-position: 0px -200px;
-}
-
-.TActiveRatingList_default td.rating_hover
-{
- background-position: 0px -300px;
-}
-
-.TActiveRatingList_default td.rating_disabled
-{
- cursor: default !important;
-} \ No newline at end of file
diff --git a/framework/Web/Javascripts/source/prado/activeratings/ratings.js b/framework/Web/Javascripts/source/prado/activeratings/ratings.js
deleted file mode 100644
index 4eeddbd8..00000000
--- a/framework/Web/Javascripts/source/prado/activeratings/ratings.js
+++ /dev/null
@@ -1,178 +0,0 @@
-Prado.WebUI.TActiveRatingList = Base.extend(
-{
- selectedIndex : -1,
- rating: -1,
- enabled : true,
- readOnly : false,
-
- constructor : function(options)
- {
- var cap = $(options.CaptionID);
- this.options = Object.extend(
- {
- caption : cap ? cap.innerHTML : ''
- }, options || {});
-
- Prado.WebUI.TActiveRatingList.register(this);
- this._init();
- this.selectedIndex = options.SelectedIndex;
- this.rating = options.Rating;
- if(options.Rating <= 0 && options.SelectedIndex >= 0)
- this.rating = options.SelectedIndex+1;
- this.showRating(this.rating);
- },
-
- _init: function(options)
- {
- Element.addClassName($(this.options.ListID),this.options.Style);
- this.radios = new Array();
- var index=0;
- for(var i = 0; i<this.options.ItemCount; i++)
- {
- var radio = $(this.options.ListID+'_c'+i);
- var td = radio.parentNode.parentNode;
- if(radio && td.tagName.toLowerCase()=='td')
- {
- this.radios.push(radio);
- Event.observe(td, "mouseover", this.hover.bindEvent(this,index));
- Event.observe(td, "mouseout", this.recover.bindEvent(this,index));
- Event.observe(td, "click", this.click.bindEvent(this, index));
- index++;
- Element.addClassName(td,"rating");
- }
- }
- },
-
- hover : function(ev,index)
- {
- if(this.enabled==false) return;
- for(var i = 0; i<this.radios.length; i++)
- {
- var node = this.radios[i].parentNode.parentNode;
- var action = i <= index ? 'addClassName' : 'removeClassName'
- Element[action](node,"rating_hover");
- Element.removeClassName(node,"rating_selected");
- Element.removeClassName(node,"rating_half");
- }
- this.showCaption(this.getIndexCaption(index));
- },
-
- recover : function(ev,index)
- {
- if(this.enabled==false) return;
- this.showRating(this.rating);
- this.showCaption(this.options.caption);
- },
-
- click : function(ev, index)
- {
- if(this.enabled==false) return;
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].checked = (i == index);
-
- this.selectedIndex = index;
- this.setRating(index+1);
-
- this.dispatchRequest(ev);
- },
-
- dispatchRequest : function(ev)
- {
- var requestOptions = Object.extend(
- {
- ID : this.options.ListID+"_c"+this.selectedIndex,
- EventTarget : this.options.ListName+"$c"+this.selectedIndex
- },this.options);
- var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
- if(request.dispatch()==false)
- Event.stop(ev);
- },
-
- setRating : function(value)
- {
- this.rating = value;
- var base = Math.floor(value-1);
- var remainder = value - base-1;
- var halfMax = this.options.HalfRating["1"];
- var index = remainder > halfMax ? base+1 : base;
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].checked = (i == index);
-
- var caption = this.getIndexCaption(index);
- this.setCaption(caption);
- this.showCaption(caption);
-
- this.showRating(value);
- },
-
- showRating: function(value)
- {
- var base = Math.floor(value-1);
- var remainder = value - base-1;
- var halfMin = this.options.HalfRating["0"];
- var halfMax = this.options.HalfRating["1"];
- var index = remainder > halfMax ? base+1 : base;
- var hasHalf = remainder >= halfMin && remainder <= halfMax;
- for(var i = 0; i<this.radios.length; i++)
- {
- var node = this.radios[i].parentNode.parentNode;
- var action = i > index ? 'removeClassName' : 'addClassName';
- Element[action](node, "rating_selected");
- if(i==index+1 && hasHalf)
- Element.addClassName(node, "rating_half");
- else
- Element.removeClassName(node, "rating_half");
- Element.removeClassName(node,"rating_hover");
- }
- },
-
- getIndexCaption : function(index)
- {
- return index > -1 ? this.radios[index].value : this.options.caption;
- },
-
- showCaption : function(value)
- {
- var caption = $(this.options.CaptionID);
- if(caption) caption.innerHTML = value;
- $(this.options.ListID).title = value;
- },
-
- setCaption : function(value)
- {
- this.options.caption = value;
- this.showCaption(value);
- },
-
- setEnabled : function(value)
- {
- this.enabled = value;
- for(var i = 0; i<this.radios.length; i++)
- {
- var action = value ? 'removeClassName' : 'addClassName'
- Element[action](this.radios[i].parentNode.parentNode, "rating_disabled");
- }
- }
-},
-{
-ratings : {},
-register : function(rating)
-{
- Prado.WebUI.TActiveRatingList.ratings[rating.options.ListID] = rating;
-},
-
-setEnabled : function(id,value)
-{
- Prado.WebUI.TActiveRatingList.ratings[id].setEnabled(value);
-},
-
-setRating : function(id,value)
-{
- Prado.WebUI.TActiveRatingList.ratings[id].setRating(value);
-},
-
-setCaption : function(id,value)
-{
- Prado.WebUI.TActiveRatingList.ratings[id].setCaption(value);
-}
-}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/source/prado/controls/controls.js b/framework/Web/Javascripts/source/prado/controls/controls.js
index bea18e76..dac7a0c0 100644
--- a/framework/Web/Javascripts/source/prado/controls/controls.js
+++ b/framework/Web/Javascripts/source/prado/controls/controls.js
@@ -69,12 +69,9 @@ Object.extend(Prado.WebUI.TImageButton.prototype,
*/
onPostBack : function(event, options)
{
- if(!this.hasXYInput)
- {
- this.addXYInput(event,options);
- this.hasXYInput = true;
- }
+ this.addXYInput(event,options);
Prado.PostBack(event, options);
+ this.removeXYInput(event,options);
},
/**
@@ -111,6 +108,18 @@ Object.extend(Prado.WebUI.TImageButton.prototype,
y_input = INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});
this.element.parentNode.appendChild(y_input);
}
+ },
+
+ /**
+ * Remove hidden inputs for x,y-click capturing
+ * @param event DOM click event.
+ * @param array image button options.
+ */
+ removeXYInput : function(event,options)
+ {
+ id = options['EventTarget'];
+ this.element.parentNode.removeChild($(id+"_x"));
+ this.element.parentNode.removeChild($(id+"_y"));
}
});
diff --git a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
index 834e89cf..a16cc3d6 100644
--- a/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
+++ b/framework/Web/Javascripts/source/prado/datepicker/datepicker.js
@@ -67,6 +67,7 @@ Prado.WebUI.TDatePicker.prototype =
this.weekSlot = new Array(6);
this.minimalDaysInFirstWeek = 4;
this.selectedDate = this.newDate();
+ this.positionMode = 'Bottom';
//which element to trigger to show the calendar
if(this.options.Trigger)
@@ -79,6 +80,12 @@ Prado.WebUI.TDatePicker.prototype =
this.trigger = this.control;
var triggerEvent = this.options.TriggerEvent || "focus";
}
+
+ // Popup position
+ if(this.options.PositionMode == 'Top')
+ {
+ this.positionMode = this.options.PositionMode;
+ }
Object.extend(this,options);
@@ -309,8 +316,8 @@ Prado.WebUI.TDatePicker.prototype =
if(this.iePopUp)
{
this.iePopUp.style.display = "block";
- this.iePopUp.style.top = (this._calDiv.offsetTop -1 ) + "px";
this.iePopUp.style.left = (this._calDiv.offsetLeft -1)+ "px";
+ this.iePopUp.style.top = (this._calDiv.offsetTop -1 ) + "px";
this.iePopUp.style.width = Math.abs(this._calDiv.offsetWidth -2)+ "px";
this.iePopUp.style.height = (this._calDiv.offsetHeight + 1)+ "px";
if(cleanup) this.iePopUp.style.display = "none";
@@ -603,12 +610,10 @@ Prado.WebUI.TDatePicker.prototype =
var pos = this.control.positionedOffset();
pos[1] += this.getDatePickerOffsetHeight();
-
- this._calDiv.style.display = "block";
this._calDiv.style.top = (pos[1]-1) + "px";
+ this._calDiv.style.display = "block";
this._calDiv.style.left = pos[0] + "px";
- this.ieHack(false);
this.documentClickEvent = this.hideOnClick.bindEvent(this);
this.documentKeyDownEvent = this.keyPressed.bindEvent(this);
Event.observe(document.body, "click", this.documentClickEvent);
@@ -620,6 +625,14 @@ Prado.WebUI.TDatePicker.prototype =
}
Event.observe(document,"keydown", this.documentKeyDownEvent);
this.showing = true;
+
+ if(this.positionMode=='Top')
+ {
+ this._calDiv.style.top = ((pos[1]-1) - this.getDatePickerOffsetHeight() - this._calDiv.offsetHeight) + 'px';
+ if(Prado.Browser().ie)
+ this.iePopup = this._calDiv.style.top;
+ }
+ this.ieHack(false);
}
},
diff --git a/framework/Web/Javascripts/source/prado/ratings/ratings.js b/framework/Web/Javascripts/source/prado/ratings/ratings.js
index e1770f1f..8af32bb9 100644
--- a/framework/Web/Javascripts/source/prado/ratings/ratings.js
+++ b/framework/Web/Javascripts/source/prado/ratings/ratings.js
@@ -1,60 +1,205 @@
-Prado.WebUI.TRatingList = Class.create();
-Prado.WebUI.TRatingList.prototype =
+Prado.WebUI.TRatingList = Base.extend(
{
selectedIndex : -1,
+ rating: -1,
+ readOnly : false,
- initialize : function(options)
+ constructor : function(options)
{
- this.options = options;
- this.element = $(options['ID']);
- Element.addClassName(this.element,options.cssClass);
- this.radios = document.getElementsByName(options.field);
- for(var i = 0; i<this.radios.length; i++)
+ var cap = $(options.CaptionID);
+ this.options = Object.extend(
+ {
+ caption : cap ? cap.innerHTML : ''
+ }, options || {});
+
+ Prado.WebUI.TRatingList.register(this);
+ this._init();
+ this.selectedIndex = options.SelectedIndex;
+ this.rating = options.Rating;
+ this.readOnly = options.ReadOnly
+ if(options.Rating <= 0 && options.SelectedIndex >= 0)
+ this.rating = options.SelectedIndex+1;
+ this.setReadOnly(this.readOnly);
+ },
+
+ _init: function(options)
+ {
+ Element.addClassName($(this.options.ListID),this.options.Style);
+ this.radios = new Array();
+ this._mouseOvers = new Array();
+ this._mouseOuts = new Array();
+ this._clicks = new Array();
+ var index=0;
+ for(var i = 0; i<this.options.ItemCount; i++)
{
- Event.observe(this.radios[i].parentNode.parentNode, "mouseover", this.hover.bindEvent(this,i));
- Event.observe(this.radios[i].parentNode.parentNode, "mouseout", this.recover.bindEvent(this,i));
- Event.observe(this.radios[i].parentNode.parentNode, "click", this.click.bindEvent(this, i));
+ var radio = $(this.options.ListID+'_c'+i);
+ var td = radio.parentNode.parentNode;
+ if(radio && td.tagName.toLowerCase()=='td')
+ {
+ this.radios.push(radio);
+ this._mouseOvers.push(this.hover.bindEvent(this,index));
+ this._mouseOuts.push(this.recover.bindEvent(this,index));
+ this._clicks.push(this.click.bindEvent(this,index));
+ index++;
+ Element.addClassName(td,"rating");
+ }
}
- this.caption = CAPTION();
- this.element.appendChild(this.caption);
- this.selectedIndex = options.selectedIndex;
- this.setRating(this.selectedIndex);
},
hover : function(ev,index)
{
+ if(this.readOnly==true) return;
for(var i = 0; i<this.radios.length; i++)
- this.radios[i].parentNode.parentNode.className = (i<=index) ? "rating_hover" : "";
- this.setCaption(index);
+ {
+ var node = this.radios[i].parentNode.parentNode;
+ var action = i <= index ? 'addClassName' : 'removeClassName'
+ Element[action](node,"rating_hover");
+ Element.removeClassName(node,"rating_selected");
+ Element.removeClassName(node,"rating_half");
+ }
+ this.showCaption(this.getIndexCaption(index));
},
recover : function(ev,index)
{
- for(var i = 0; i<=index; i++)
- Element.removeClassName(this.radios[i].parentNode.parentNode, "rating_hover");
- this.setRating(this.selectedIndex);
+ if(this.readOnly==true) return;
+ this.showRating(this.rating);
+ this.showCaption(this.options.caption);
},
click : function(ev, index)
{
+ if(this.readOnly==true) return;
for(var i = 0; i<this.radios.length; i++)
this.radios[i].checked = (i == index);
this.selectedIndex = index;
- this.setRating(index);
- if(typeof(this.options.onChange)=="function")
- this.options.onChange(this,index);
+ this.setRating(index+1);
+
+ if(this.options['AutoPostBack']==true){
+ this.dispatchRequest(ev);
+ }
+ },
+
+ dispatchRequest : function(ev)
+ {
+ var requestOptions = Object.extend(
+ {
+ ID : this.options.ListID+"_c"+this.selectedIndex,
+ EventTarget : this.options.ListName+"$c"+this.selectedIndex
+ },this.options);
+ Prado.PostBack(ev, requestOptions);
+ },
+
+ setRating : function(value)
+ {
+ this.rating = value;
+ var base = Math.floor(value-1);
+ var remainder = value - base-1;
+ var halfMax = this.options.HalfRating["1"];
+ var index = remainder > halfMax ? base+1 : base;
+ for(var i = 0; i<this.radios.length; i++)
+ this.radios[i].checked = (i == index);
+
+ var caption = this.getIndexCaption(index);
+ this.setCaption(caption);
+ this.showCaption(caption);
+
+ this.showRating(this.rating);
+ },
+
+ showRating: function(value)
+ {
+ var base = Math.floor(value-1);
+ var remainder = value - base-1;
+ var halfMin = this.options.HalfRating["0"];
+ var halfMax = this.options.HalfRating["1"];
+ var index = remainder > halfMax ? base+1 : base;
+ var hasHalf = remainder >= halfMin && remainder <= halfMax;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+ var node = this.radios[i].parentNode.parentNode;
+ var action = i > index ? 'removeClassName' : 'addClassName';
+ Element[action](node, "rating_selected");
+ if(i==index+1 && hasHalf)
+ Element.addClassName(node, "rating_half");
+ else
+ Element.removeClassName(node, "rating_half");
+ Element.removeClassName(node,"rating_hover");
+ }
+ },
+
+ getIndexCaption : function(index)
+ {
+ return index > -1 ? this.radios[index].value : this.options.caption;
+ },
+
+ showCaption : function(value)
+ {
+ var caption = $(this.options.CaptionID);
+ if(caption) caption.innerHTML = value;
+ $(this.options.ListID).title = value;
},
- setRating: function(index)
+ setCaption : function(value)
{
- for(var i = 0; i<=index; i++)
- this.radios[i].parentNode.parentNode.className = "rating_selected";
- this.setCaption(index);
+ this.options.caption = value;
+ this.showCaption(value);
},
- setCaption : function(index)
+ setReadOnly : function(value)
+ {
+ this.readOnly = value;
+ for(var i = 0; i<this.radios.length; i++)
+ {
+
+ var action = value ? 'addClassName' : 'removeClassName';
+ Element[action](this.radios[i].parentNode.parentNode, "rating_disabled");
+
+ var action = value ? 'stopObserving' : 'observe';
+ var td = this.radios[i].parentNode.parentNode;
+ Event[action](td, "mouseover", this._mouseOvers[i]);
+ Event[action](td, "mouseout", this._mouseOuts[i]);
+ Event[action](td, "click", this._clicks[i]);
+ }
+
+ this.showRating(this.rating);
+ }
+},
+{
+ratings : {},
+register : function(rating)
+{
+ Prado.WebUI.TRatingList.ratings[rating.options.ListID] = rating;
+},
+
+setReadOnly : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setReadOnly(value);
+},
+
+setRating : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setRating(value);
+},
+
+setCaption : function(id,value)
+{
+ Prado.WebUI.TRatingList.ratings[id].setCaption(value);
+}
+});
+
+Prado.WebUI.TActiveRatingList = Prado.WebUI.TRatingList.extend(
+{
+ dispatchRequest : function(ev)
{
- this.caption.innerHTML = index > -1 ?
- this.radios[index].value : this.options.caption;
+ var requestOptions = Object.extend(
+ {
+ ID : this.options.ListID+"_c"+this.selectedIndex,
+ EventTarget : this.options.ListName+"$c"+this.selectedIndex
+ },this.options);
+ var request = new Prado.CallbackRequest(requestOptions.EventTarget, requestOptions);
+ if(request.dispatch()==false)
+ Event.stop(ev);
}
-};
+
+});
diff --git a/framework/Web/Javascripts/source/prado/validator/validation3.js b/framework/Web/Javascripts/source/prado/validator/validation3.js
index c9dba7a1..a3b803d8 100644
--- a/framework/Web/Javascripts/source/prado/validator/validation3.js
+++ b/framework/Web/Javascripts/source/prado/validator/validation3.js
@@ -686,7 +686,7 @@ Prado.WebUI.TValidationSummary.prototype =
{
switch(type)
{
- case "List":
+ case "SimpleList":
return { header : "<br />", first : "", pre : "", post : "<br />", last : ""};
case "SingleParagraph":
return { header : " ", first : "", pre : "", post : " ", last : "<br />"};
@@ -1668,6 +1668,7 @@ Prado.WebUI.TRegularExpressionValidator = Class.extend(Prado.WebUI.TBaseValidato
* @constructor initialize
* @param {object} options - Additional constructor option:
* @... {string} ValidationExpression - Regular expression to match against.
+ * @... {string} PatternModifiers - Pattern modifiers: combinations of g, i, and m
*/
/**
@@ -1678,12 +1679,12 @@ Prado.WebUI.TRegularExpressionValidator = Class.extend(Prado.WebUI.TBaseValidato
evaluateIsValid : function()
{
var value = this.getValidationValue();
- if (value.length <= 0)
+ if (value.length <= 0)
return true;
- var rx = new RegExp(this.options.ValidationExpression);
- var matches = rx.exec(value);
- return (matches != null && value == matches[0]);
+ var rx = new RegExp(this.options.ValidationExpression,this.options.PatternModifiers);
+ var matches = rx.exec(value);
+ return (matches != null && value == matches[0]);
}
});
@@ -1847,6 +1848,8 @@ Prado.WebUI.TCaptchaValidator = Class.extend(Prado.WebUI.TBaseValidator,
{
var a = this.getValidationValue();
var h = 0;
+ if (this.options.CaseSensitive==false)
+ a = a.toUpperCase();
for(var i = a.length-1; i >= 0; --i)
h += a.charCodeAt(i);
return h == this.options.TokenHash;
diff --git a/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js b/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js
index bf429c26..14f9546e 100644
--- a/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js
+++ b/framework/Web/Javascripts/source/scriptaculous-1.8.1/dragdrop.js
@@ -407,7 +407,7 @@ var Draggable = Class.create({
if(this.options.ghosting) {
if (!this.element._originallyAbsolute)
Position.relativize(this.element);
- delete this.element._originallyAbsolute;
+ this.element._originallyAbsolute=null;
Element.remove(this._clone);
this._clone = null;
}
diff --git a/framework/Web/Services/TFeedService.php b/framework/Web/Services/TFeedService.php
index fea39290..7ecd10a7 100644
--- a/framework/Web/Services/TFeedService.php
+++ b/framework/Web/Services/TFeedService.php
@@ -143,4 +143,3 @@ interface IFeedContentProvider
public function getContentType();
}
-?>
diff --git a/framework/Web/Services/TJsonService.php b/framework/Web/Services/TJsonService.php
index 93ad10d2..e3ed9a7f 100644
--- a/framework/Web/Services/TJsonService.php
+++ b/framework/Web/Services/TJsonService.php
@@ -92,7 +92,7 @@ class TJsonService extends TService
throw new TConfigurationException('jsonservice_class_required',$id);
}
else
- throw new THttpException(404,'jsonservice_feed_unknown',$id);
+ throw new THttpException(404,'jsonservice_provider_unknown',$id);
}
/**
diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php
index 259fa5f8..f5962647 100644
--- a/framework/Web/Services/TSoapService.php
+++ b/framework/Web/Services/TSoapService.php
@@ -612,4 +612,3 @@ class TSoapServer extends TApplicationComponent
}
}
-?>
diff --git a/framework/Web/TAssetManager.php b/framework/Web/TAssetManager.php
index d8028d93..7925d209 100644
--- a/framework/Web/TAssetManager.php
+++ b/framework/Web/TAssetManager.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web
@@ -113,7 +113,7 @@ class TAssetManager extends TModule
{
$this->_basePath=Prado::getPathOfNamespace($value);
if($this->_basePath===null || !is_dir($this->_basePath) || !is_writable($this->_basePath))
- throw new TInvalidDataValueException('assetmanage_basepath_invalid',$value);
+ throw new TInvalidDataValueException('assetmanager_basepath_invalid',$value);
}
}
@@ -267,7 +267,10 @@ class TAssetManager extends TModule
else if(is_file($src.DIRECTORY_SEPARATOR.$file))
{
if(@filemtime($dst.DIRECTORY_SEPARATOR.$file)<@filemtime($src.DIRECTORY_SEPARATOR.$file))
+ {
@copy($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
+ @chmod($dst.DIRECTORY_SEPARATOR.$file, PRADO_CHMOD);
+ }
}
else
$this->copyDirectory($src.DIRECTORY_SEPARATOR.$file,$dst.DIRECTORY_SEPARATOR.$file);
@@ -333,4 +336,4 @@ class TAssetManager extends TModule
}
-?>
+?>
diff --git a/framework/Web/TCacheHttpSession.php b/framework/Web/TCacheHttpSession.php
index 0d89a519..daa94122 100644
--- a/framework/Web/TCacheHttpSession.php
+++ b/framework/Web/TCacheHttpSession.php
@@ -148,4 +148,3 @@ class TCacheHttpSession extends THttpSession
}
}
-?>
diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php
index d595c1b9..7100a4c5 100644
--- a/framework/Web/THttpRequest.php
+++ b/framework/Web/THttpRequest.php
@@ -1237,4 +1237,3 @@ class THttpRequestUrlFormat extends TEnumerable
const Path='Path';
}
-?>
diff --git a/framework/Web/THttpResponse.php b/framework/Web/THttpResponse.php
index 44a853b0..fd45acf5 100644
--- a/framework/Web/THttpResponse.php
+++ b/framework/Web/THttpResponse.php
@@ -574,4 +574,3 @@ class THttpResponse extends TModule implements ITextWriter
}
}
-?>
diff --git a/framework/Web/THttpSession.php b/framework/Web/THttpSession.php
index 251db64b..96d70704 100644
--- a/framework/Web/THttpSession.php
+++ b/framework/Web/THttpSession.php
@@ -708,4 +708,3 @@ class THttpSessionCookieMode extends TEnumerable
const Only='Only';
}
-?>
diff --git a/framework/Web/THttpUtility.php b/framework/Web/THttpUtility.php
index c6e7c3fc..a410b957 100644
--- a/framework/Web/THttpUtility.php
+++ b/framework/Web/THttpUtility.php
@@ -48,4 +48,3 @@ class THttpUtility
}
}
-?>
diff --git a/framework/Web/TUrlManager.php b/framework/Web/TUrlManager.php
index 778b762a..f87bee8f 100644
--- a/framework/Web/TUrlManager.php
+++ b/framework/Web/TUrlManager.php
@@ -139,4 +139,3 @@ class TUrlManager extends TModule
}
}
-?>
diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php
index e1deea0f..83dd99b6 100644
--- a/framework/Web/TUrlMapping.php
+++ b/framework/Web/TUrlMapping.php
@@ -76,7 +76,7 @@ class TUrlMapping extends TUrlManager
/**
* @var TUrlMappingPattern[] list of patterns.
*/
- private $_patterns=array();
+ protected $_patterns=array();
/**
* @var TUrlMappingPattern matched pattern.
*/
@@ -92,7 +92,7 @@ class TUrlMapping extends TUrlManager
/**
* @var array rules for constructing URLs
*/
- private $_constructRules=array();
+ protected $_constructRules=array();
private $_urlPrefix='';
@@ -264,7 +264,8 @@ class TUrlMapping extends TUrlManager
if(is_string($key))
$params[$key]=$value;
}
- $params[$pattern->getServiceID()]=$pattern->getServiceParameter();
+ if (!$pattern->getIsWildCardPattern())
+ $params[$pattern->getServiceID()]=$pattern->getServiceParameter();
return $params;
}
}
@@ -299,6 +300,8 @@ class TUrlMapping extends TUrlManager
if(!(is_array($getItems) || ($getItems instanceof Traversable)))
$getItems=array();
$key=$serviceID.':'.$serviceParam;
+ $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ?
+ $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*';
if(isset($this->_constructRules[$key]))
{
foreach($this->_constructRules[$key] as $rule)
@@ -306,6 +309,17 @@ class TUrlMapping extends TUrlManager
if($rule->supportCustomUrl($getItems))
return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems);
}
+ }
+ elseif(isset($this->_constructRules[$wildCardKey]))
+ {
+ foreach($this->_constructRules[$wildCardKey] as $rule)
+ {
+ if($rule->supportCustomUrl($getItems))
+ {
+ $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam;
+ return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems);
+ }
+ }
}
}
return parent::constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems);
@@ -399,6 +413,8 @@ class TUrlMappingPattern extends TComponent
private $_manager;
private $_caseSensitive=true;
+
+ private $_isWildCardPattern=false;
/**
* Constructor.
@@ -428,6 +444,8 @@ class TUrlMappingPattern extends TComponent
{
if($this->_serviceParameter===null)
throw new TConfigurationException('urlmappingpattern_serviceparameter_required', $this->getPattern());
+ if(strpos($this->_serviceParameter,'*')!==false)
+ $this->_isWildCardPattern=true;
}
/**
@@ -444,6 +462,11 @@ class TUrlMappingPattern extends TComponent
$params[]='{'.$key.'}';
$values[]='(?P<'.$key.'>'.$value.')';
}
+ if ($this->getIsWildCardPattern()) {
+ $params[]='{*}';
+ // service parameter must not contain '=' and '/'
+ $values[]='(?P<'.$this->getServiceID().'>[^=/]+)';
+ }
$params[]='/';
$values[]='\\/';
$regexp=str_replace($params,$values,trim($this->getPattern(),'/').'/');
@@ -585,6 +608,14 @@ class TUrlMappingPattern extends TComponent
}
/**
+ * @return boolean whether this pattern is a wildcard pattern
+ * @since 3.1.4
+ */
+ public function getIsWildCardPattern() {
+ return $this->_isWildCardPattern;
+ }
+
+ /**
* @param array list of GET items to be put in the constructed URL
* @return boolean whether this pattern IS the one for constructing the URL with the specified GET items.
* @since 3.1.1
@@ -616,10 +647,8 @@ class TUrlMappingPattern extends TComponent
// for the GET variables matching the pattern, put them in the URL path
foreach($getItems as $key=>$value)
{
- if($encodeGetItems)
- $value=urlencode($value);
- if($this->_parameters->contains($key))
- $replace['{'.$key.'}']=$value;
+ if($this->_parameters->contains($key) || $key==='*' && $this->getIsWildCardPattern())
+ $replace['{'.$key.'}']=$encodeGetItems ? rawurlencode($value) : $value;
else
$extra[$key]=$value;
}
@@ -637,12 +666,12 @@ class TUrlMappingPattern extends TComponent
{
if(is_array($value))
{
- $name=urlencode($name.'[]');
+ $name=rawurlencode($name.'[]');
foreach($value as $v)
- $url2.=$amp.$name.'='.urlencode($v);
+ $url2.=$amp.$name.'='.rawurlencode($v);
}
else
- $url2.=$amp.urlencode($name).'='.urlencode($value);
+ $url2.=$amp.rawurlencode($name).'='.rawurlencode($value);
}
}
else
@@ -664,4 +693,3 @@ class TUrlMappingPattern extends TComponent
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveButton.php b/framework/Web/UI/ActiveControls/TActiveButton.php
index 992f41e3..0990ff41 100644
--- a/framework/Web/UI/ActiveControls/TActiveButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveButton.php
@@ -130,4 +130,3 @@ class TActiveButton extends TButton implements ICallbackEventHandler, IActiveCon
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
index 88e4fdfe..34872f98 100644
--- a/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActiveControlAdapter.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.ActiveControls
@@ -97,7 +97,7 @@ class TActiveControlAdapter extends TControlAdapter
$data = $this->getPage()->getPostDataLoaders();
if(count($data) > 0)
{
- $options = TJavascript::encode($data,false);
+ $options = TJavaScript::encode($data,false);
$script = "Prado.CallbackRequest.addPostLoaders({$options});";
$cs->registerEndScript($key, $script);
}
@@ -146,12 +146,12 @@ class TActiveControlAdapter extends TControlAdapter
* Starts viewstate tracking if necessary after when controls has been loaded
*/
public function onLoad($param)
- {
+ {
if($this->getIsTrackingPageState())
{
$this->_stateTracker = new TCallbackPageStateTracker($this->getControl());
$this->_stateTracker->trackChanges();
- }
+ }
parent::onLoad($param);
}
@@ -560,4 +560,3 @@ class TMapCollectionDiff extends TViewStateDiff
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
index 8428c810..6c74aa7d 100644
--- a/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
+++ b/framework/Web/UI/ActiveControls/TActiveCustomValidator.php
@@ -239,4 +239,3 @@ class TActiveCustomValidatorClientSide extends TCallbackClientSide
return is_null($changes) ? true : $changes;
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveDatePicker.php b/framework/Web/UI/ActiveControls/TActiveDatePicker.php
new file mode 100755
index 00000000..052ed199
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TActiveDatePicker.php
@@ -0,0 +1,129 @@
+<?php
+/**
+ * TActiveDatePicker class file
+ *
+ * @author Bradley Booms <Bradley.Booms@nsighttel.com>
+ * @author Christophe Boulain <Christophe.Boulain@gmail.com>
+ * @link http://www.pradosoft.com/
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @license http://www.pradosoft.com/license/
+ * @version $Id$
+ * @package System.Web.UI.ActiveControls
+ */
+
+/**
+ * Load active control adapter.
+ */
+Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
+
+/**
+ * TActiveDatePicker class
+ *
+ * The active control counter part to date picker control.
+ * When the date selection is changed, the {@link onCallback OnCallback} event is
+ * raised.
+ *
+ * @author Bradley Booms <Bradley.Booms@nsighttel.com>
+ * @author Christophe Boulain <Christophe.Boulain@gmail.com>
+ * @version $Id$
+ * @package System.Web.UI.ActiveControls
+ * @since 3.1.3
+ */
+class TActiveDatePicker extends TDatePicker implements ICallbackEventHandler, IActiveControl {
+
+
+ /**
+ * Get javascript date picker options.
+ * @return array date picker client-side options
+ */
+ protected function getDatePickerOptions(){
+ $options = parent::getDatePickerOptions();
+ $options['EventTarget'] = $this->getUniqueID();
+ return $options;
+ }
+
+ /**
+ * Creates a new callback control, sets the adapter to
+ * TActiveControlAdapter. If you override this class, be sure to set the
+ * adapter appropriately by, for example, by calling this constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setAdapter(new TActiveControlAdapter($this));
+ }
+
+ /**
+ * @return TBaseActiveCallbackControl standard callback control options.
+ */
+ public function getActiveControl(){
+ return $this->getAdapter()->getBaseActiveControl();
+ }
+
+ /**
+ * Client-side Text property can only be updated after the OnLoad stage.
+ * @param string text content for the textbox
+ */
+ public function setText($value){
+ parent::setText($value);
+ if($this->getActiveControl()->canUpdateClientSide() && $this->getHasLoadedPostData()){
+ $cb=$this->getPage()->getCallbackClient();
+ $cb->setValue($this, $value);
+ if ($this->getInputMode()==TDatePickerInputMode::DropDownList)
+ {
+ $s = Prado::createComponent('System.Util.TDateTimeStamp');
+ $date = $s->getDate($this->getTimeStampFromText());
+ $id=$this->getClientID();
+ $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'day', 'Value', $date['mday'], 'select');
+ $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'month', 'Value', $date['mon']-1, 'select');
+ $cb->select($id.TControl::CLIENT_ID_SEPARATOR.'year', 'Value', $date['year'], 'select');
+
+ }
+ }
+ }
+
+ /**
+ * Raises the callback event. This method is required by {@link
+ * ICallbackEventHandler} interface.
+ * This method is mainly used by framework and control developers.
+ * @param TCallbackEventParameter the event parameter
+ */
+ public function raiseCallbackEvent($param){
+ $this->onCallback($param);
+ }
+
+ /**
+ * This method is invoked when a callback is requested. The method raises
+ * 'OnCallback' event to fire up the event handlers. If you override this
+ * method, be sure to call the parent implementation so that the event
+ * handler can be invoked.
+ * @param TCallbackEventParameter event parameter to be passed to the event handlers
+ */
+ public function onCallback($param){
+ $this->raiseEvent('OnCallback', $this, $param);
+ }
+
+ /**
+ * Registers the javascript code to initialize the date picker.
+ */
+ protected function registerCalendarClientScript()
+ {
+ if($this->getShowCalendar())
+ {
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerPradoScript("activedatepicker");
+
+ if(!$cs->isEndScriptRegistered('TDatePicker.spacer'))
+ {
+ $spacer = $this->getAssetUrl('spacer.gif');
+ $code = "Prado.WebUI.TDatePicker.spacer = '$spacer';";
+ $cs->registerEndScript('TDatePicker.spacer', $code);
+ }
+
+ $options = TJavaScript::encode($this->getDatePickerOptions());
+ $code = "new Prado.WebUI.TActiveDatePicker($options);";
+ $cs->registerEndScript("prado:".$this->getClientID(), $code);
+ }
+ }
+}
+?>
diff --git a/framework/Web/UI/ActiveControls/TActiveFileUpload.php b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
new file mode 100755
index 00000000..e1b85f0d
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TActiveFileUpload.php
@@ -0,0 +1,315 @@
+<?php
+/**
+ * TActiveFileUpload.php
+ *
+ * @author Bradley Booms <Bradley.Booms@nsighttel.com>
+ * @author Christophe Boulain <Christophe.Boulain@gmail.com>
+ * @version $Id$
+ */
+
+/**
+ * Load TActiveControlAdapter and TFileUpload.
+ */
+Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
+Prado::using('System.Web.UI.WebControls.TFileUpload');
+
+/**
+ * TActiveFileUpload
+ *
+ * TActiveFileUpload displays a file upload field on a page. Upon postback,
+ * the text entered into the field will be treated as the name of the file
+ * that will be uploaded to the server. The property {@link getHasFile HasFile}
+ * indicates whether the file upload is successful. If successful, the file
+ * may be obtained by calling {@link saveAs} to save it at a specified place.
+ * You can use {@link getFileName FileName}, {@link getFileType FileType},
+ * {@link getFileSize FileSize} to get the original client-side file name,
+ * the file mime type, and the file size information. If the upload is not
+ * successful, {@link getErrorCode ErrorCode} contains the error code
+ * describing the cause of failure.
+ *
+ * TActiveFileUpload raises {@link onFileUpload OnFileUpload} event if a file is uploaded
+ * (whether it succeeds or not).
+ *
+ * TActiveFileUpload actually does a postback in a hidden IFrame, and then does a callback.
+ * This callback then raises the {@link onFileUpload OnFileUpload} event. After the postback
+ * a status icon is displayed; either a green checkmark if the upload is successful,
+ * or a red x if there was an error.
+ *
+ * @author Bradley Booms <Bradley.Booms@nsighttel.com>
+ * @author Christophe Boulain <Christophe.Boulain@gmail.com>
+ *
+ * @version $Id$
+ */
+class TActiveFileUpload extends TFileUpload implements IActiveControl, ICallbackEventHandler, INamingContainer
+{
+
+ const SCRIPT_PATH = 'prado/activefileupload';
+
+ /**
+ * @var THiddenField a flag to tell which component is doing the callback.
+ */
+ private $_flag;
+ /**
+ * @var TImage that spins to show that the file is being uploaded.
+ */
+ private $_busy;
+ /**
+ * @var TImage that shows a green check mark for completed upload.
+ */
+ private $_success;
+ /**
+ * @var TImage that shows a red X for incomplete upload.
+ */
+ private $_error;
+ /**
+ * @var TInlineFrame used to submit the data in an "asynchronous" fashion.
+ */
+ private $_target;
+
+
+ /**
+ * Creates a new callback control, sets the adapter to
+ * TActiveControlAdapter. If you override this class, be sure to set the
+ * adapter appropriately by, for example, by calling this constructor.
+ */
+ public function __construct(){
+ parent::__construct();
+ $this->setAdapter(new TActiveControlAdapter($this));
+ }
+
+
+ /**
+ * @param string asset file in the self::SCRIPT_PATH directory.
+ * @return string asset file url.
+ */
+ protected function getAssetUrl($file='')
+ {
+ $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
+ return $base.'/'.self::SCRIPT_PATH.'/'.$file;
+ }
+
+
+ /**
+ * This method is invoked when a file is uploaded.
+ * If you override this method, be sure to call the parent implementation to ensure
+ * the invocation of the attached event handlers.
+ * @param TEventParameter event parameter to be passed to the event handlers
+ */
+ public function onFileUpload($param){
+ if ($this->_flag->getValue() && $this->getPage()->getIsPostBack()){
+ // save the file so that it will persist past the end of this return.
+ $localName = str_replace('\\', '/', tempnam(Prado::getPathOfNamespace($this->getTempPath()),''));
+ parent::saveAs($localName);
+
+ $filename=addslashes($this->getFileName());
+ // return some javascript to display a completion status.
+ echo <<<EOS
+<script language="Javascript">
+ Options = new Object();
+ Options.clientID = '{$this->getClientID()}';
+ Options.targetID = '{$this->_target->getUniqueID()}';
+ Options.localName = '$localName';
+ Options.fileName = '{$filename}';
+ Options.fileSize = '{$this->getFileSize()}';
+ Options.fileType = '{$this->getFileType()}';
+ Options.errorCode = '{$this->getErrorCode()}';
+ parent.Prado.WebUI.TActiveFileUpload.onFileUpload(Options);
+</script>
+EOS;
+ exit();
+ }
+ }
+
+ /**
+ * @return string the path where the uploaded file will be stored temporarily, in namespace format
+ * default "Application.runtime.*"
+ */
+ public function getTempPath(){
+ return $this->getViewState('TempPath', 'Application.runtime.*');
+ }
+
+ /**
+ * @param string the path where the uploaded file will be stored temporarily in namespace format
+ * default "Application.runtime.*"
+ */
+ public function setTempPath($value){
+ $this->setViewState('TempNamespace',$value,'Application.runtime.*');
+ }
+
+ /**
+ * @throws TInvalidDataValueException if the {@link getTempPath TempPath} is not writable.
+ */
+ public function onInit($sender){
+ parent::onInit($sender);
+ if (!is_writable(Prado::getPathOfNamespace($this->getTempPath()))){
+ throw new TInvalidDataValueException("activefileupload_temppath_invalid", $this->getTempPath());
+ }
+ }
+
+ /**
+ * Raises <b>OnFileUpload</b> event.
+ *
+ * This method is required by {@link ICallbackEventHandler} interface.
+ * This method is mainly used by framework and control developers.
+ * @param TCallbackEventParameter the event parameter
+ */
+ public function raiseCallbackEvent($param){
+ $cp = $param->getCallbackParameter();
+ if ($key = $cp->targetID == $this->_target->getUniqueID()){
+ $_FILES[$key]['name'] = $cp->fileName;
+ $_FILES[$key]['size'] = intval($cp->fileSize);
+ $_FILES[$key]['type'] = $cp->fileType;
+ $_FILES[$key]['error'] = intval($cp->errorCode);
+ $_FILES[$key]['tmp_name'] = $cp->localName;
+ $this->loadPostData($key, null);
+
+ $this->raiseEvent('OnFileUpload', $this, $param);
+ }
+ }
+
+ /**
+ * Publish the javascript
+ */
+ public function onPreRender($param){
+ parent::onPreRender($param);
+ $this->getPage()->getClientScript()->registerPradoScript('activefileupload');
+ }
+
+
+ public function createChildControls(){
+ $this->_flag = Prado::createComponent('THiddenField');
+ $this->_flag->setID('Flag');
+ $this->getControls()->add($this->_flag);
+
+ $this->_busy = Prado::createComponent('TImage');
+ $this->_busy->setID('Busy');
+ $this->_busy->setImageUrl($this->getAssetUrl('ActiveFileUploadIndicator.gif'));
+ $this->_busy->setStyle("display:none");
+ $this->getControls()->add($this->_busy);
+
+ $this->_success = Prado::createComponent('TImage');
+ $this->_success->setID('Success');
+ $this->_success->setImageUrl($this->getAssetUrl('ActiveFileUploadComplete.png'));
+ $this->_success->setStyle("display:none");
+ $this->getControls()->add($this->_success);
+
+ $this->_error = Prado::createComponent('TImage');
+ $this->_error->setID('Error');
+ $this->_error->setImageUrl($this->getAssetUrl('ActiveFileUploadError.png'));
+ $this->_error->setStyle("display:none");
+ $this->getControls()->add($this->_error);
+
+ $this->_target = Prado::createComponent('TInlineFrame');
+ $this->_target->setID('Target');
+ $this->_target->setFrameUrl($this->getAssetUrl('ActiveFileUploadBlank.html'));
+ $this->_target->setStyle("width:0px; height:0px;");
+ $this->_target->setShowBorder(false);
+ $this->getControls()->add($this->_target);
+ }
+
+
+ /**
+ * Removes localfile on ending of the callback.
+ */
+ public function onUnload($param){
+ if ($this->getPage()->getIsCallback() &&
+ $this->getHasFile() &&
+ file_exists($this->getLocalName())){
+ unlink($this->getLocalName());
+ }
+ parent::onUnload($param);
+ }
+
+ /**
+ * @return TBaseActiveCallbackControl standard callback control options.
+ */
+ public function getActiveControl(){
+ return $this->getAdapter()->getBaseActiveControl();
+ }
+
+ /**
+ * Adds ID attribute, and renders the javascript for active component.
+ * @param THtmlWriter the writer used for the rendering purpose
+ */
+ public function addAttributesToRender($writer){
+ parent::addAttributesToRender($writer);
+ $writer->addAttribute('id',$this->getClientID());
+
+ $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(),$this->getClientOptions());
+ }
+
+ /**
+ * @return string corresponding javascript class name for this control.
+ */
+ protected function getClientClassName(){
+ return 'Prado.WebUI.TActiveFileUpload';
+ }
+
+ /**
+ * Gets the client side options for this control.
+ * @return array ( inputID => input client ID,
+ * flagID => flag client ID,
+ * targetName => target unique ID,
+ * formID => form client ID,
+ * indicatorID => upload indicator client ID,
+ * completeID => complete client ID,
+ * errorID => error client ID)
+ */
+ protected function getClientOptions(){
+ $options['ID'] = $this->getClientID();
+ $options['EventTarget'] = $this->getUniqueID();
+
+ $options['inputID'] = $this->getClientID();
+ $options['flagID'] = $this->_flag->getClientID();
+ $options['targetID'] = $this->_target->getUniqueID();
+ $options['formID'] = $this->getPage()->getForm()->getClientID();
+ $options['indicatorID'] = $this->_busy->getClientID();
+ $options['completeID'] = $this->_success->getClientID();
+ $options['errorID'] = $this->_error->getClientID();
+ return $options;
+ }
+
+ /**
+ * Saves the uploaded file.
+ * @param string the file name used to save the uploaded file
+ * @param boolean whether to delete the temporary file after saving.
+ * If true, you will not be able to save the uploaded file again.
+ * @return boolean true if the file saving is successful
+ */
+ public function saveAs($fileName,$deleteTempFile=true){
+ if (($this->getErrorCode()===UPLOAD_ERR_OK) && (file_exists($this->getLocalName()))){
+ if ($deleteTempFile)
+ return rename($this->getLocalName(),$fileName);
+ else
+ return copy($this->getLocalName(),$fileName);
+ } else
+ return false;
+ }
+
+ /**
+ * @return TImage the image displayed when an upload
+ * completes successfully.
+ */
+ public function getSuccessImage(){
+ $this->ensureChildControls();
+ return $this->_success;
+ }
+
+ /**
+ * @return TImage the image displayed when an upload
+ * does not complete successfully.
+ */
+ public function getErrorImage(){
+ $this->ensureChildControls();
+ return $this->_error;
+ }
+
+ /**
+ * @return TImage the image displayed when an upload
+ * is in progress.
+ */
+ public function getBusyImage(){
+ $this->ensureChildControls();
+ return $this->_busy;
+ }
+} \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TActiveHiddenField.php b/framework/Web/UI/ActiveControls/TActiveHiddenField.php
index 378fc76f..6d837cb2 100644
--- a/framework/Web/UI/ActiveControls/TActiveHiddenField.php
+++ b/framework/Web/UI/ActiveControls/TActiveHiddenField.php
@@ -114,4 +114,3 @@ class TActiveHiddenField extends THiddenField implements ICallbackEventHandler,
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveLabel.php b/framework/Web/UI/ActiveControls/TActiveLabel.php
index e4b4bc6f..4105e3dc 100644
--- a/framework/Web/UI/ActiveControls/TActiveLabel.php
+++ b/framework/Web/UI/ActiveControls/TActiveLabel.php
@@ -77,6 +77,14 @@ class TActiveLabel extends TLabel implements IActiveControl
$this->getPage()->getCallbackClient()->setAttribute($this, 'for', $id);
}
}
+
+ /**
+ * Adds attribute id to the renderer.
+ * @param THtmlWriter the writer used for the rendering purpose
+ */
+ protected function addAttributesToRender($writer) {
+ $writer->addAttribute('id',$this->getClientID());
+ parent::addAttributesToRender($writer);
+ }
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveLinkButton.php b/framework/Web/UI/ActiveControls/TActiveLinkButton.php
index 5a863a9d..f1551b40 100644
--- a/framework/Web/UI/ActiveControls/TActiveLinkButton.php
+++ b/framework/Web/UI/ActiveControls/TActiveLinkButton.php
@@ -11,6 +11,11 @@
*/
/**
+ * Load active control adapter.
+ */
+Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
+
+/**
* TActiveLinkButton is the active control counter part to TLinkButton.
*
* When a TActiveLinkButton is clicked, rather than a normal post back request a
diff --git a/framework/Web/UI/ActiveControls/TActivePageAdapter.php b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
index 684082b8..c52f0775 100644
--- a/framework/Web/UI/ActiveControls/TActivePageAdapter.php
+++ b/framework/Web/UI/ActiveControls/TActivePageAdapter.php
@@ -155,7 +155,7 @@ class TActivePageAdapter extends TControlAdapter
$responseData = $response->getAdapter()->getResponseData();
if(!is_null($responseData))
{
- $data = TJavascript::jsonEncode($responseData);
+ $data = TJavaScript::jsonEncode($responseData);
$this->appendContentPart($response, self::CALLBACK_DATA_HEADER, $data);
//$response->appendHeader(self::CALLBACK_DATA_HEADER.': '.$data);
@@ -186,7 +186,7 @@ class TActivePageAdapter extends TControlAdapter
//output the actions
$executeJavascript = $this->getCallbackClientHandler()->getClientFunctionsToExecute();
- $actions = TJavascript::jsonEncode($executeJavascript);
+ $actions = TJavaScript::jsonEncode($executeJavascript);
$this->appendContentPart($response, self::CALLBACK_ACTION_HEADER, $actions);
//$response->appendHeader(self::CALLBACK_ACTION_HEADER.': '.$actions);
}
@@ -264,7 +264,7 @@ class TActivePageAdapter extends TControlAdapter
{
$param = $this->getRequest()->itemAt(TPage::FIELD_CALLBACK_PARAMETER);
if(strlen($param) > 0)
- $this->_callbackEventParameter=TJavascript::jsonDecode((string)$param);
+ $this->_callbackEventParameter=TJavaScript::jsonDecode((string)$param);
}
return $this->_callbackEventParameter;
}
@@ -315,7 +315,7 @@ class TCallbackErrorHandler extends TErrorHandler
if($this->getApplication()->getMode()===TApplication::STATE_DEBUG)
{
$response = $this->getApplication()->getResponse();
- $trace = TJavascript::jsonEncode($this->getExceptionStackTrace($exception));
+ $trace = TJavaScript::jsonEncode($this->getExceptionStackTrace($exception));
$response->appendHeader('HTTP/1.0 500 Internal Error');
$response->appendHeader(TActivePageAdapter::CALLBACK_ERROR_HEADER.': '.$trace);
}
@@ -367,4 +367,3 @@ class TInvalidCallbackException extends TException
{
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActivePager.php b/framework/Web/UI/ActiveControls/TActivePager.php
index 7e5ee33e..9dd856c9 100644
--- a/framework/Web/UI/ActiveControls/TActivePager.php
+++ b/framework/Web/UI/ActiveControls/TActivePager.php
@@ -176,12 +176,16 @@ class TActivePager extends TPager implements IActiveControl, ICallbackEventHandl
// Update all the buttons pagers attached to the same control.
// Dropdown pagers doesn't need to be re-rendered.
$controlToPaginate=$this->getControlToPaginate();
- foreach ($this->getNamingContainer()->findControlsByType('TActivePager') as $control)
+ foreach ($this->getNamingContainer()->findControlsByType('TActivePager', false) as $control)
{
if ($control->getMode() !== TPagerMode::DropDownList && $control->getControlToPaginate()===$controlToPaginate)
+ {
$control->render($param->getNewWriter());
+ // FIXME : With some very fast machine, the getNewWriter() consecutive calls are in the same microsecond, resulting
+ // of getting the same boundaries in ajax response. Wait 1 microsecond to avoid this.
+ usleep(1);
+ }
}
-
// Raise callback event
$this->onCallback($param);
}
@@ -202,4 +206,3 @@ class TActivePager extends TPager implements IActiveControl, ICallbackEventHandl
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActivePanel.php b/framework/Web/UI/ActiveControls/TActivePanel.php
index ef41a1dd..51e9fb08 100644
--- a/framework/Web/UI/ActiveControls/TActivePanel.php
+++ b/framework/Web/UI/ActiveControls/TActivePanel.php
@@ -89,4 +89,3 @@ class TActivePanel extends TPanel implements IActiveControl
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
index 10602427..63ef8ef4 100644
--- a/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRadioButtonList.php
@@ -11,6 +11,12 @@
*/
/**
+ * Load active control adapter and active radio button.
+ */
+Prado::using('System.Web.UI.ActiveControls.TActiveListControlAdapter');
+Prado::using('System.Web.UI.ActiveControls.TActiveRadioButton');
+
+/**
* TActiveRadioButtonList class.
*
* The active control counter part to radio button list control.
diff --git a/framework/Web/UI/ActiveControls/TActiveRatingList.php b/framework/Web/UI/ActiveControls/TActiveRatingList.php
index 4ec7b6c3..473ca06a 100644
--- a/framework/Web/UI/ActiveControls/TActiveRatingList.php
+++ b/framework/Web/UI/ActiveControls/TActiveRatingList.php
@@ -3,8 +3,9 @@
* TActiveRatingList class file.
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
+ * @author Bradley Booms <bradley[dot]booms[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.ActiveControls
@@ -13,107 +14,85 @@
/**
* TActiveRatingList Class
*
- * Displays clickable images that represent a TActiveRadioButtonList
+ * Displays clickable images that represent a TRadioButtonList
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @author Bradley Booms <bradley[dot]booms[at]gmail[dot]com>
* @version $Id$
* @package System.Web.UI.ActiveControls
* @since 3.1
*/
-class TActiveRatingList extends TActiveRadioButtonList
+class TActiveRatingList extends TRatingList implements IActiveControl, ICallbackEventHandler
{
- const SCRIPT_PATH = 'prado/activeratings';
-
- /**
- * @var array list of published rating images.
- */
- private $_ratingImages = array();
-
/**
- * Sets the default repeat direction to horizontal.
+ * Creates a new callback control, sets the adapter to
+ * TActiveListControlAdapter. If you override this class, be sure to set the
+ * adapter appropriately by, for example, by calling this constructor.
*/
public function __construct()
{
+ $this->setAdapter(new TActiveListControlAdapter($this));
+ $this->setAutoPostBack(true);
parent::__construct();
- $this->setRepeatDirection(TRepeatDirection::Horizontal);
- }
-
- /**
- * @return boolean whether the items in the column can be edited. Defaults to false.
- */
- public function getReadOnly()
- {
- return $this->getViewState('ReadOnly',false);
}
/**
- * @param boolean whether the items in the column can be edited
+ * @return TBaseActiveCallbackControl standard callback control options.
*/
- public function setReadOnly($value)
+ public function getActiveControl()
{
- $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
+ return $this->getAdapter()->getBaseActiveControl();
}
/**
- * The repeat layout must be Table.
- * @param string repeat layout type
- * @throws TInvaliddataValueException when repeat layout is not Table.
+ * @return TCallbackClientSide client side request options.
*/
- public function setRepeatLayout($value)
+ public function getClientSide()
{
- if($value!==TRepeatLayout::Table)
- throw new TInvalidDataValueException('ratinglist_table_layout_only');
- else
- parent::setRepeatLayout($value);
+ return $this->getAdapter()->getBaseActiveControl()->getClientSide();
}
/**
- * @return float rating value.
+ * Raises the callback event. This method is required by {@link
+ * ICallbackEventHandler} interface.
+ * This method is mainly used by framework and control developers.
+ * @param TCallbackEventParameter the event parameter
*/
- public function getRating()
+ public function raiseCallbackEvent($param)
{
- return $this->getViewState('Rating',0.0);
+ $this->onCallback($param);
}
/**
- * @param float rating value, also sets the selected Index
+ * This method is invoked when a callback is requested. The method raises
+ * 'OnCallback' event to fire up the event handlers. If you override this
+ * method, be sure to call the parent implementation so that the event
+ * handler can be invoked.
+ * @param TCallbackEventParameter event parameter to be passed to the event handlers
*/
- public function setRating($value)
+ public function onCallback($param)
{
- $rating = TPropertyValue::ensureFloat($value);
- $this->setViewState('Rating', $rating);
- $canUpdate = $this->getActiveControl()->getEnableUpdate();
- $this->getActiveControl()->setEnableUpdate(false);
- parent::setSelectedIndex($this->getRatingIndex($rating));
- $this->getActiveControl()->setEnableUpdate($canUpdate);
- if($this->getActiveControl()->canUpdateClientSide())
- $this->callClientFunction('setRating',$rating);
+ $this->raiseEvent('OnCallback', $this, $param);
}
/**
- * @param float rating value
- * @return int rating as integer
+ * @param boolean whether the items in the column can be edited
*/
- protected function getRatingIndex($rating)
+ public function setReadOnly($value)
{
- $interval = $this->getHalfRatingInterval();
- $base = intval($rating)-1;
- $remainder = $rating-$base-1;
- return $remainder > $interval[1] ? $base+1 : $base;
+ parent::setReadOnly($value);
+ $value = $this->getReadOnly();
+ $this->callClientFunction('setReadOnly',$value);
}
/**
- * @param int change the rating selection index
+ * @param float rating value, also sets the selected Index
*/
- public function setSelectedIndex($value)
+ public function setRating($value)
{
- $value = TPropertyValue::ensureInteger($value);
- $canUpdate = $this->getActiveControl()->getEnableUpdate();
- $this->getActiveControl()->setEnableUpdate(false);
- parent::setSelectedIndex($value);
- $this->getActiveControl()->setEnableUpdate($canUpdate);
- if($this->getActiveControl()->canUpdateClientSide())
- $this->callClientFunction('setRating',$value+1);
+ parent::setRating($value);
+ $value = $this->getRating();
+ $this->callClientFunction('setRating',$value);
}
/**
@@ -123,250 +102,22 @@ class TActiveRatingList extends TActiveRadioButtonList
*/
protected function callClientFunction($func,$value)
{
- $client = $this->getPage()->getCallbackClient();
- $code = $this->getClientClassName().'.'.$func;
- $client->callClientFunction($code,array($this,$value));
- }
-
- /**
- * @return string control or html element ID for displaying a caption.
- */
- public function getCaptionID()
- {
- return $this->getViewState('CaptionID', '');
- }
-
- /**
- * @param string control or html element ID for displaying a caption.
- */
- public function setCaptionID($value)
- {
- $this->setViewState('CaptionID', $value, '');
- }
-
- protected function getCaptionControl()
- {
- if(($id=$this->getCaptionID())!=='')
- {
- if($control=$this->getParent()->findControl($id))
- return $control;
- }
- throw new TInvalidDataValueException(
- 'ratinglist_invalid_caption_id',$id,$this->getID());
- }
-
- public function setCaption($value)
- {
- $this->getCaptionControl()->setText($value);
- if($this->getActiveControl()->canUpdateClientSide())
- $this->callClientFunction('setCaption',$value);
- }
-
- public function getCaption()
- {
- return $this->getCaptionControl()->getText();
- }
-
- /**
- * @param boolean true to enable the rating to be changed.
- */
- public function setEnabled($value)
- {
- $value = TPropertyValue::ensureBoolean($value);
- parent::setEnabled($value);
if($this->getActiveControl()->canUpdateClientSide())
- $this->callClientFunction('setEnabled',$value);
- }
-
- /**
- * @param string set the rating style, default is "default"
- */
- public function setRatingStyle($value)
- {
- $this->setViewState('RatingStyle', $value, 'default');
- }
-
- /**
- * @return TActiveRatingListStyle current rating style
- */
- public function getRatingStyle()
- {
- return $this->getViewState('RatingStyle', 'default');
- }
-
- /**
- * Sets the interval such that those rating values within the interval
- * will be considered as a half star rating.
- * @param array rating display half value interval, default is array(0.3, 0.7);
- */
- public function setHalfRatingInterval($value)
- {
- $this->setViewState('HalfRating',
- TPropertyValue::ensureArray($value), array(0.3, 0.7));
- }
-
- /**
- * @return array rating display half value interval, default is array(0.3, 0.7);
- */
- public function getHalfRatingInterval()
- {
- return $this->getViewState('HalfRating', array(0.3, 0.7));
- }
-
- /**
- * @return string rating style css class name.
- */
- protected function getRatingStyleCssClass()
- {
- return 'TActiveRatingList_'.$this->getRatingStyle();
- }
-
- /**
- * @return array list of post back options.
- */
- protected function getPostBackOptions()
- {
- $options = parent::getPostBackOptions();
- $options['Style'] = $this->getRatingStyleCssClass();
- $options['CaptionID'] = $this->getCaptionControlID();
- $options['SelectedIndex'] = $this->getSelectedIndex();
- $options['Rating'] = $this->getRating();
- $options['HalfRating'] = $this->getHalfRatingInterval();
- return $options;
- }
-
- /**
- * Registers the javascript code for initializing the active control
- * only if {@link setReadOnly ReadOnly} property is false.
- */
- protected function renderClientControlScript($writer)
- {
- if($this->getReadOnly()===false)
- parent::renderClientControlScript($writer);
- }
-
- /**
- * @return string find the client ID of the caption control.
- */
- protected function getCaptionControlID()
- {
- if(($id=$this->getCaptionID())!=='')
{
- if($control=$this->getParent()->findControl($id))
- {
- if($control->getVisible(true))
- return $control->getClientID();
- }
- else
- return $id;
+ $client = $this->getPage()->getCallbackClient();
+ $code = parent::getClientClassName().'.'.$func;
+ $client->callClientFunction($code,array($this,$value));
}
- return '';
}
/**
- * @param string asset file in the self::SCRIPT_PATH directory.
- * @return string asset file url.
+ * @param string caption text
*/
- protected function getAssetUrl($file='')
- {
- $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
- return $base.'/'.self::SCRIPT_PATH.'/'.$file;
- }
-
- /**
- * @param string rating style name
- * @return string URL of the css style file
- */
- protected function publishRatingListStyle($style)
- {
- $cs = $this->getPage()->getClientScript();
- $url = $this->getAssetUrl($style.'.css');
- if(!$cs->isStyleSheetFileRegistered($url))
- $cs->registerStyleSheetFile($url, $url);
- return $url;
- }
-
- /**
- * @param string rating style name
- * @param string rating image file extension, default is '.gif'
- * @return array URL of publish the rating images
- */
- protected function publishRatingListImages($style, $fileExt='.gif')
- {
- $types = array('blank', 'selected', 'half', 'combined');
- $files = array();
- foreach($types as $type)
- $files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
- return $files;
- }
-
- /**
- * Add rating style class name to the class attribute
- * when {@link setReadOnly ReadOnly} property is true and when the
- * {@link setCssClass CssClass} property is empty.
- * @param THtmlWriter renderer
- */
- public function render($writer)
- {
- if($this->getReadOnly())
- $writer->addAttribute('class', $this->getRatingStyleCssClass());
- else
- {
- $writer->addAttribute('id',$this->getClientID());
- $this->getActiveControl()->registerCallbackClientScript(
- $this->getClientClassName(), $this->getPostBackOptions());
- }
- parent::render($writer);
- }
-
- /**
- * Publish the the rating style css file and rating image files.
- */
- public function onPreRender($param)
- {
- parent::onPreRender($param);
-
- $this->publishRatingListStyle($this->getRatingStyle());
- $this->_ratingImages = $this->publishRatingListImages($this->getRatingStyle());
- }
-
- /**
- * Renders the rating images if {@link setReadOnly ReadOnly} is true
- * otherwise render the radio buttons.
- */
- public function renderItem($writer,$repeatInfo,$itemType,$index)
- {
- if($this->getReadOnly())
- $this->renderStaticRating($writer, $repeatInfo, $itemType, $index);
- else
- parent::renderItem($writer, $repeatInfo, $itemType, $index);
- }
-
- /**
- * Renders the static rating images.
- */
- protected function renderStaticRating($writer, $repeatInfo, $itemType, $index)
- {
- $image = new TImage;
- $image->setImageUrl($this->_ratingImages[$this->getRatingImageType($index)]);
- $image->setAlternateText($this->getRating());
- $image->render($writer);
- }
-
- /**
- * @param integer rating image index
- * @return string the rating image corresponding to current index to be rendered.
- */
- protected function getRatingImageType($index)
+ public function setCaption($value)
{
- $rating = floatval($this->getRating());
- $int = intval($rating);
- $limit = $this->getHalfRatingInterval();
- if($index < $int || ($rating < $index+1 && $rating > $index+$limit[1]))
- return 'selected';
- if($rating >= $index+$limit[0] && $rating <= $index+$limit[1])
- return 'half';
- return 'blank';
+ parent::setCaption($value);
+ // if it's an active control, this should not be needed.
+ $this->callClientFunction('setCaption',$value);
}
/**
@@ -380,4 +131,3 @@ class TActiveRatingList extends TActiveRadioButtonList
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TActiveTextBox.php b/framework/Web/UI/ActiveControls/TActiveTextBox.php
index f7acfe6a..97efe008 100644
--- a/framework/Web/UI/ActiveControls/TActiveTextBox.php
+++ b/framework/Web/UI/ActiveControls/TActiveTextBox.php
@@ -123,4 +123,3 @@ class TActiveTextBox extends TTextBox implements ICallbackEventHandler, IActiveC
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TAutoComplete.php b/framework/Web/UI/ActiveControls/TAutoComplete.php
index c1379ac1..5a3633ec 100644
--- a/framework/Web/UI/ActiveControls/TAutoComplete.php
+++ b/framework/Web/UI/ActiveControls/TAutoComplete.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.ActiveControls
@@ -328,7 +328,7 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
{
$string = strtr($string,array('\t'=>"\t",'\n'=>"\n",'\r'=>"\r"));
$token = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);
- $options['tokens'] = TJavascript::encode($token,false);
+ $options['tokens'] = TJavaScript::encode($token,false);
}
if($this->getAutoPostBack())
{
@@ -343,8 +343,8 @@ class TAutoComplete extends TActiveTextBox implements INamingContainer
if(($minchars=$this->getMinChars())!=='')
$options['minChars'] = $minchars;
if(($frequency=$this->getFrequency())!=='')
- $options['frequency'] = $frequency;
- $options['CausesValidation'] = $this->getCausesValidation();
+ $options['frequency'] = $frequency;
+ $options['CausesValidation'] = $this->getCausesValidation();
$options['ValidationGroup'] = $this->getValidationGroup();
return $options;
}
@@ -438,4 +438,3 @@ class TAutoCompleteTemplate extends TComponent implements ITemplate
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php
index 4ede6ff6..8f55e27b 100644
--- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php
+++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.ActiveControls
@@ -385,8 +385,7 @@ class TBaseActiveCallbackControl extends TBaseActiveControl
*/
public function getJsCallbackOptions()
{
- return TJavascript::encode($this->getClientSideOptions());
+ return TJavaScript::encode($this->getClientSideOptions());
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TCallback.php b/framework/Web/UI/ActiveControls/TCallback.php
index 2e0fed69..c1559c1f 100644
--- a/framework/Web/UI/ActiveControls/TCallback.php
+++ b/framework/Web/UI/ActiveControls/TCallback.php
@@ -99,4 +99,3 @@ class TCallback extends TControl implements ICallbackEventHandler, IActiveContro
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
index bc02182d..8f275ef8 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php
@@ -670,4 +670,3 @@ class TCallbackClientScript extends TApplicationComponent
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TCallbackClientSide.php b/framework/Web/UI/ActiveControls/TCallbackClientSide.php
index a11204fb..57436278 100644
--- a/framework/Web/UI/ActiveControls/TCallbackClientSide.php
+++ b/framework/Web/UI/ActiveControls/TCallbackClientSide.php
@@ -322,4 +322,3 @@ class TCallbackClientSide extends TClientSideOptions
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TCallbackEventParameter.php b/framework/Web/UI/ActiveControls/TCallbackEventParameter.php
index 8e33407d..f08d40a9 100644
--- a/framework/Web/UI/ActiveControls/TCallbackEventParameter.php
+++ b/framework/Web/UI/ActiveControls/TCallbackEventParameter.php
@@ -85,4 +85,3 @@ class TCallbackEventParameter extends TEventParameter
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TCallbackOptions.php b/framework/Web/UI/ActiveControls/TCallbackOptions.php
index 745cef17..7c48b795 100644
--- a/framework/Web/UI/ActiveControls/TCallbackOptions.php
+++ b/framework/Web/UI/ActiveControls/TCallbackOptions.php
@@ -51,4 +51,3 @@ class TCallbackOptions extends TControl
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TDraggable.php b/framework/Web/UI/ActiveControls/TDraggable.php
new file mode 100755
index 00000000..e4e4c4c4
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TDraggable.php
@@ -0,0 +1,152 @@
+<?php
+/**
+ * TDraggable class file
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
+ * @copyright Copyright &copy; 2008, PradoSoft
+ * @license http://www.pradosoft.com/license
+ * @version $Id$
+ */
+
+/**
+ * TDraggable is a control which can be dragged
+ *
+ * This control will make "draggable" control.
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
+ * @copyright Copyright &copy; 2008, PradoSoft
+ * @license http://www.pradosoft.com/license
+ * @version $Id$
+ */
+class TDraggable extends TPanel
+{
+ /**
+ * Set the handle id or css class
+ * @param string
+ */
+ public function setHandle ($value)
+ {
+ $this->setViewState('DragHandle', TPropertyValue::ensureString($value), null);
+ }
+
+ /**
+ * Get the handle id or css class
+ * @return string
+ */
+ public function getHandle ()
+ {
+ return $this->getViewState('DragHandle', null);
+ }
+
+ /**
+ * Determine if draggable element should revert to it orginal position
+ * upon release in an non-droppable container.
+ * @return boolean true to revert
+ */
+ public function getRevert()
+ {
+ return $this->getViewState('Revert', true);
+ }
+
+ /**
+ * Sets whether the draggable element should revert to it orginal position
+ * upon release in an non-droppable container.
+ * @param boolean true to revert
+ */
+ public function setRevert($value)
+ {
+ $this->setViewState('Revert', TPropertyValue::ensureBoolean($value), true);
+ }
+
+ /**
+ * Determine if the element should be cloned when dragged
+ * If true, Clones the element and drags the clone, leaving the original in place until the clone is dropped.
+ * Defaults to false
+ * @return boolean true to clone the element
+ */
+ public function getGhosting ()
+ {
+ return $this->getViewState('Ghosting', false);
+ }
+
+ /**
+ * Sets wether the element should be cloned when dragged
+ * If true, Clones the element and drags the clone, leaving the original in place until the clone is dropped.
+ * Defaults to false
+ * @return boolean true to clone the element
+ */
+ public function setGhosting ($value)
+ {
+ $this->setViewState('Ghosting', TPropertyValue::ensureBoolean($value), false);
+ }
+
+ /**
+ * Determine if the element should be constrainted in one direction or not
+ * @return CDraggableConstraint
+ */
+ public function getConstraint()
+ {
+ return $this->getViewState('Constraint', TDraggableConstraint::None);
+ }
+
+ /**
+ * Set wether the element should be constrainted in one direction
+ * @param CDraggableConstraint
+ */
+ public function setConstraint($value)
+ {
+ $this->setViewState('Constraint', TPropertyValue::ensureEnum($value, 'TDraggableConstraint'), TDraggableConstraint::None);
+ }
+
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+ $writer->addAttribute('id',$this->getClientID());
+ $cs=$this->getPage()->getClientScript();
+ $cs->registerPradoScript('dragdrop');
+ $options=TJavascript::encode($this->getPostBackOptions());
+ $class=$this->getClientClassName();
+ $code="new {$class}('{$this->getClientId()}', {$options}) ";
+ $cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
+ }
+
+ /**
+ * Gets the name of the javascript class responsible for performing postback for this control.
+ * This method overrides the parent implementation.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName ()
+ {
+ return 'Draggable';
+ }
+
+ /**
+ * Gets the post back options for this textbox.
+ * @return array
+ */
+ protected function getPostBackOptions()
+ {
+ $options['ID'] = $this->getClientID();
+
+ if (($handle=$this->getHandle())!== null) $options['handle']=$handle;
+ $options['revert']=$this->getRevert();
+ if (($constraint=$this->getConstraint())!==TDraggableConstraint::None) $options['constraint']=strtolower($constraint);
+ $options['ghosting']=$this->getGhosting();
+
+ return $options;
+ }
+
+}
+
+class TDraggableConstraint extends TEnumerable
+{
+ const None='None';
+ const Horizontal='Horizontal';
+ const Vertical='Vertical';
+}
+?> \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TDropContainer.php b/framework/Web/UI/ActiveControls/TDropContainer.php
new file mode 100755
index 00000000..5d090d95
--- /dev/null
+++ b/framework/Web/UI/ActiveControls/TDropContainer.php
@@ -0,0 +1,275 @@
+<?php
+/**
+ * TDropContainer class file
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
+ * @copyright Copyright &copy; 2008, PradoSoft
+ * @license http://www.pradosoft.com/license
+ * @version $Id$
+ */
+
+/**
+ * Load active control adapter.
+ */
+Prado::using('System.Web.UI.ActiveControls.TActiveControlAdapter');
+/**
+ * Load active panel.
+ */
+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.
+ *
+ * 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} : raised when a TDraggable control is dropped. The dropped control is encapsulated in the event parameter
+ *
+ * @author Christophe BOULAIN (Christophe.Boulain@gmail.com)
+ * @copyright Copyright &copy; 2008, PradoSoft
+ * @license http://www.pradosoft.com/license
+ * @version $Id$
+ */
+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
+ * adapter appropriately by, for example, by calling this constructor.
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->setAdapter(new TActiveControlAdapter($this));
+ }
+
+ /**
+ * @return TBaseActiveControl standard active control options.
+ */
+ public function getActiveControl()
+ {
+ return $this->getAdapter()->getBaseActiveControl();
+ }
+
+
+ /**
+ * Gets the Css class name that this container can accept.
+ * @return string
+ */
+ public function getAcceptCssClass()
+ {
+ return $this->getViewState('Accepts', '');
+ }
+
+ /**
+ * Sets the Css class name that this container can accept.
+ * @param string comma delimited css class names.
+ */
+ public function setAcceptCssClass($value)
+ {
+ $this->setViewState('Accepts', TPropertyValue::ensureArray($value), '');
+ }
+
+ /**
+ * Sets the Css class name used when a draggble element is hovering
+ * over this container.
+ * @param string css class name during draggable hover.
+ */
+ public function setHoverCssClass($value)
+ {
+ $this->setViewState('HoverClass', $value, '');
+ }
+
+ /**
+ * Gets the Css class name used when a draggble element is hovering
+ * over this container.
+ * @return string css class name during draggable hover.
+ */
+ public function getHoverCssClass()
+ {
+ return $this->getViewState('HoverClass', '');
+ }
+
+
+ /**
+ * Raises callback event. This method is required bu {@link ICallbackEventHandler}
+ * interface.
+ * It raises the {@link onDrop OnDrop} event, then, the {@link onCallback OnCallback} event
+ * This method is mainly used by framework and control developers.
+ * @param TCallbackEventParameter the parameter associated with the callback event
+ */
+ public function raiseCallbackEvent($param)
+ {
+ $this->onDrop($param->getCallbackParameter());
+ $this->onCallback($param);
+ }
+
+ /**
+ * Raises the onDrop event.
+ * The dropped control is encapsulated into a {@link TDropContainerEventParameter}
+ *
+ * @param string $dropControlId
+ */
+ public function onDrop ($dropControlId)
+ {
+ // Find the control
+ // Warning, this will not work if you have a '_' in your control Id !
+ $control=$this->getPage();
+ $namingContainers=explode(TControl::CLIENT_ID_SEPARATOR, $dropControlId);
+ foreach ($namingContainers as $nc)
+ {
+ $control=$control->findControl($nc);
+ }
+ $this->raiseEvent('OnDrop', $this, new TDropContainerEventParameter ($control));
+
+ }
+
+ /**
+ * This method is invoked when a callback is requested. The method raises
+ * 'OnCallback' event to fire up the event handlers. If you override this
+ * method, be sure to call the parent implementation so that the event
+ * handler can be invoked.
+ * @param TCallbackEventParameter event parameter to be passed to the event handlers
+ */
+ public function onCallback($param)
+ {
+ $this->raiseEvent('OnCallback', $this, $param);
+ }
+
+ /**
+ * Gets the post back options for this textbox.
+ * @return array
+ */
+ protected function getPostBackOptions()
+ {
+ $options['ID'] = $this->getClientID();
+ $options['EventTarget'] = $this->getUniqueID();
+
+ $options['accept'] = TJavascript::encode($this->getAcceptCssClass());
+ $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.
+ * @return string the javascript class name
+ */
+ protected function getClientClassName()
+ {
+ return 'Prado.WebUI.DropContainer';
+ }
+
+
+ /**
+ * Ensure that the ID attribute is rendered and registers the javascript code
+ * for initializing the active control.
+ */
+ protected function addAttributesToRender($writer)
+ {
+ parent::addAttributesToRender($writer);
+ $writer->addAttribute('id',$this->getClientID());
+
+ $this->getPage()->getClientScript()->registerPradoScript('dragdrop');
+
+ $this->getActiveControl()->registerCallbackClientScript(
+ $this->getClientClassName(), $this->getPostBackOptions());
+ }
+
+ /**
+ * Creates child control
+ * Override parent implementation to create a container which will contain all
+ * child controls. This container will be a TActivePanel, in order to allow user
+ * to update its content on callback.
+ */
+ public function createChildControls ()
+ {
+ if ($this->_container===null)
+ {
+ $this->_container=Prado::CreateComponent('System.Web.UI.ActiveControls.TActivePanel');
+ $this->_container->setId($this->getId().'_content');
+ parent::getControls()->add($this->_container);
+ }
+ }
+
+ /**
+ * Override parent implementation to return the container control collection.
+ *
+ * @return TControlCollection
+ */
+ public function getControls()
+ {
+ $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()
+ * is called during a callback event handler, the rendering
+ * is defered until OnPreRender event is raised.
+ * @param THtmlWriter html writer
+ */
+ public function render ($writer)
+ {
+ if($this->getHasPreRendered())
+ {
+ parent::render($writer);
+ if($this->getActiveControl()->canUpdateClientSide())
+ $this->getPage()->getCallbackClient()->replaceContent($this->_container,$writer);
+ }
+ else
+ {
+ $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
+ * @version $Id$
+ */
+class TDropContainerEventParameter extends TEventParameter
+{
+ /*
+ * the id of control which has been dropped
+ * @var string
+ */
+ private $_droppedControl;
+
+ /**
+ * constructor
+ *
+ * @param string the id of control which been dropped
+ */
+ public function __construct ($control)
+ {
+ $this->_droppedControl=$control;
+ }
+
+ /**
+ * @return TDraggable
+ */
+ public function getDroppedControl ()
+ {
+ return $this->_droppedControl;
+ }
+}
+?> \ No newline at end of file
diff --git a/framework/Web/UI/ActiveControls/TEventTriggeredCallback.php b/framework/Web/UI/ActiveControls/TEventTriggeredCallback.php
index 735ff926..fe4be8a8 100644
--- a/framework/Web/UI/ActiveControls/TEventTriggeredCallback.php
+++ b/framework/Web/UI/ActiveControls/TEventTriggeredCallback.php
@@ -93,4 +93,3 @@ class TEventTriggeredCallback extends TTriggeredCallback
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
index 855e78a0..6e1c6b7a 100644
--- a/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
+++ b/framework/Web/UI/ActiveControls/TInPlaceTextBox.php
@@ -269,4 +269,3 @@ class TInPlaceTextBox extends TActiveTextBox
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
index a1410364..3dee5c59 100644
--- a/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
+++ b/framework/Web/UI/ActiveControls/TTimeTriggeredCallback.php
@@ -49,6 +49,10 @@ class TTimeTriggeredCallback extends TCallback
if($interval <= 0)
throw new TConfigurationException('callback_interval_be_positive', $this->getID());
$this->setViewState('Interval', $interval, 1);
+ if ($this->getActiveControl()->canUpdateClientSide()){
+ $client = $this->getPage()->getCallbackClient();
+ $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.setInterval', array($this, $interval));
+ }
}
/**
@@ -56,10 +60,8 @@ class TTimeTriggeredCallback extends TCallback
*/
public function startTimer()
{
- $id = $this->getClientID();
- $code = "Prado.WebUI.TTimeTriggeredCallback.start('{$id}');";
- $cs = $this->getPage()->getClientScript();
- $cs->registerEndScript("{$id}:start", $code);
+ $client = $this->getPage()->getCallbackClient();
+ $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.start', array($this));
}
/**
@@ -67,10 +69,8 @@ class TTimeTriggeredCallback extends TCallback
*/
public function stopTimer()
{
- $id = $this->getClientID();
- $code = "Prado.WebUI.TTimeTriggeredCallback.stop('{$id}');";
- $cs = $this->getPage()->getClientScript();
- $cs->registerEndScript("{$id}:stop", $code);
+ $client = $this->getPage()->getCallbackClient();
+ $client->callClientFunction('Prado.WebUI.TTimeTriggeredCallback.stop', array($this));
}
/**
@@ -110,8 +110,12 @@ class TTimeTriggeredCallback extends TCallback
parent::render($writer);
$this->getActiveControl()->registerCallbackClientScript(
$this->getClientClassName(), $this->getTriggerOptions());
- if($this->getStartTimerOnLoad())
- $this->startTimer();
+ if($this->getStartTimerOnLoad()){
+ $id = $this->getClientID();
+ $code = "Prado.WebUI.TTimeTriggeredCallback.start('{$id}');";
+ $cs = $this->getPage()->getClientScript();
+ $cs->registerEndScript("{$id}:start", $code);
+ }
}
/**
diff --git a/framework/Web/UI/ActiveControls/TTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTriggeredCallback.php
index 18679b4a..6923a53a 100644
--- a/framework/Web/UI/ActiveControls/TTriggeredCallback.php
+++ b/framework/Web/UI/ActiveControls/TTriggeredCallback.php
@@ -68,4 +68,3 @@ abstract class TTriggeredCallback extends TCallback
}
}
-?>
diff --git a/framework/Web/UI/ActiveControls/TValueTriggeredCallback.php b/framework/Web/UI/ActiveControls/TValueTriggeredCallback.php
index 5a44f380..305afd70 100644
--- a/framework/Web/UI/ActiveControls/TValueTriggeredCallback.php
+++ b/framework/Web/UI/ActiveControls/TValueTriggeredCallback.php
@@ -116,4 +116,3 @@ class TValueTriggeredCallback extends TTriggeredCallback
return 'Prado.WebUI.TValueTriggeredCallback';
}
}
-?>
diff --git a/framework/Web/UI/TCachePageStatePersister.php b/framework/Web/UI/TCachePageStatePersister.php
index 0b201d92..742bd687 100644
--- a/framework/Web/UI/TCachePageStatePersister.php
+++ b/framework/Web/UI/TCachePageStatePersister.php
@@ -199,4 +199,3 @@ class TCachePageStatePersister extends TComponent implements IPageStatePersister
}
}
-?>
diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php
index 83fdf789..f0eb6157 100644
--- a/framework/Web/UI/TClientScriptManager.php
+++ b/framework/Web/UI/TClientScriptManager.php
@@ -169,7 +169,10 @@ class TClientScriptManager extends TApplicationComponent
$scriptLoaderPath = $path.'/'.basename(self::SCRIPT_LOADER);
$scriptLoaderSrc = Prado::getFrameworkPath().DIRECTORY_SEPARATOR.self::SCRIPT_LOADER;
if(!is_file($scriptLoaderPath))
+ {
copy($scriptLoaderSrc, $scriptLoaderPath);
+ chmod($scriptLoaderPath, PRADO_CHMOD);
+ }
$url .= '/'.basename(self::SCRIPT_LOADER).'?js='.implode(',', $packages);
if($debug!==false && $this->getApplication()->getMode()===TApplicationMode::Debug)
{
@@ -230,7 +233,7 @@ class TClientScriptManager extends TApplicationComponent
$class = new TReflectionClass($callbackHandler);
$clientSide = $callbackHandler->getActiveControl()->getClientSide();
$options = array_merge($options, $clientSide->getOptions()->toArray());
- $optionString = TJavascript::encode($options);
+ $optionString = TJavaScript::encode($options);
$this->registerPradoScriptInternal('ajax');
$id = $callbackHandler->getUniqueID();
return "new Prado.CallbackRequest('{$id}',{$optionString})";
@@ -677,8 +680,8 @@ abstract class TClientSideOptions extends TComponent
*/
protected function setFunction($name, $code)
{
- if(!TJavascript::isFunction($code))
- $code = TJavascript::quoteFunction($this->ensureFunction($code));
+ if(!TJavaScript::isFunction($code))
+ $code = TJavaScript::quoteFunction($this->ensureFunction($code));
$this->setOption($name, $code);
}
@@ -717,4 +720,3 @@ abstract class TClientSideOptions extends TComponent
}
}
-?>
diff --git a/framework/Web/UI/TCompositeControl.php b/framework/Web/UI/TCompositeControl.php
index d30756e2..1cf31440 100644
--- a/framework/Web/UI/TCompositeControl.php
+++ b/framework/Web/UI/TCompositeControl.php
@@ -36,4 +36,3 @@ class TCompositeControl extends TControl implements INamingContainer
}
}
-?>
diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php
index 576db89b..1c03a04d 100644
--- a/framework/Web/UI/TControl.php
+++ b/framework/Web/UI/TControl.php
@@ -1997,6 +1997,14 @@ interface IValidatable
* @return mixed the value of the property to be validated.
*/
public function getValidationPropertyValue();
+ /**
+ * @return boolean wether this control's validators validated successfully (must default to true)
+ */
+ public function getIsValid();
+ /**
+ * @return boolean wether this control's validators validated successfully
+ */
+ public function setIsValid($value);
}
/**
diff --git a/framework/Web/UI/TControlAdapter.php b/framework/Web/UI/TControlAdapter.php
index a6263f7f..16a8c839 100644
--- a/framework/Web/UI/TControlAdapter.php
+++ b/framework/Web/UI/TControlAdapter.php
@@ -141,4 +141,3 @@ class TControlAdapter extends TApplicationComponent
}
}
-?>
diff --git a/framework/Web/UI/TForm.php b/framework/Web/UI/TForm.php
index 436352c5..2356a733 100644
--- a/framework/Web/UI/TForm.php
+++ b/framework/Web/UI/TForm.php
@@ -165,4 +165,3 @@ class TForm extends TControl
}
}
-?>
diff --git a/framework/Web/UI/THtmlWriter.php b/framework/Web/UI/THtmlWriter.php
index dd68b828..217b9663 100644
--- a/framework/Web/UI/THtmlWriter.php
+++ b/framework/Web/UI/THtmlWriter.php
@@ -254,4 +254,3 @@ class THtmlWriter extends TApplicationComponent implements ITextWriter
}
}
-?>
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php
index 1a0f04a6..12433715 100644
--- a/framework/Web/UI/TPage.php
+++ b/framework/Web/UI/TPage.php
@@ -1234,10 +1234,10 @@ class TPageStateFormatter
$str=$sm->hashData(Prado::serialize($data));
else
$str=Prado::serialize($data);
- if($page->getEnableStateEncryption())
- $str=$sm->encrypt($str);
if(extension_loaded('zlib'))
$str=gzcompress($str);
+ if($page->getEnableStateEncryption())
+ $str=$sm->encrypt($str);
return base64_encode($str);
}
@@ -1251,13 +1251,13 @@ class TPageStateFormatter
$str=base64_decode($data);
if($str==='')
return null;
- if(extension_loaded('zlib'))
- $str=@gzuncompress($str);
if($str!==false)
{
$sm=$page->getApplication()->getSecurityManager();
if($page->getEnableStateEncryption())
$str=$sm->decrypt($str);
+ if(extension_loaded('zlib'))
+ $str=@gzuncompress($str);
if($page->getEnableStateValidation())
{
if(($str=$sm->validateData($str))!==false)
diff --git a/framework/Web/UI/TPageStatePersister.php b/framework/Web/UI/TPageStatePersister.php
index e8ea0713..4b217aee 100644
--- a/framework/Web/UI/TPageStatePersister.php
+++ b/framework/Web/UI/TPageStatePersister.php
@@ -69,4 +69,3 @@ class TPageStatePersister extends TComponent implements IPageStatePersister
}
}
-?>
diff --git a/framework/Web/UI/TSessionPageStatePersister.php b/framework/Web/UI/TSessionPageStatePersister.php
index 2c93118c..f422dfa8 100644
--- a/framework/Web/UI/TSessionPageStatePersister.php
+++ b/framework/Web/UI/TSessionPageStatePersister.php
@@ -129,4 +129,3 @@ class TSessionPageStatePersister extends TComponent implements IPageStatePersist
}
}
-?>
diff --git a/framework/Web/UI/TTemplateControl.php b/framework/Web/UI/TTemplateControl.php
index e8138e30..7da54e6c 100644
--- a/framework/Web/UI/TTemplateControl.php
+++ b/framework/Web/UI/TTemplateControl.php
@@ -241,4 +241,3 @@ class TTemplateControl extends TCompositeControl
}
}
-?>
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php
index be2beba6..f44d414c 100644
--- a/framework/Web/UI/TTemplateManager.php
+++ b/framework/Web/UI/TTemplateManager.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI
@@ -174,10 +174,10 @@ class TTemplate extends TApplicationComponent implements ITemplate
* '<\/?com:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>' - component tags
* '<\/?prop:([\w\.]+)\s*>' - property tags
* '<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>' - directives
- * '<%[%#~\\$=\\[](.*?)%>' - expressions
+ * '<%[%#~\/\\$=\\[](.*?)%>' - expressions
* '<prop:([\w\.]+)((?:\s*[\w\.]+=\'.*?\'|\s*[\w\.]+=".*?"|\s*[\w\.]+=<%.*?%>)*)\s*\/>' - group subproperty tags
*/
- const REGEX_RULES='/<!--.*?--!>|<!---.*?--->|<\/?com:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>|<%[%#~\\$=\\[](.*?)%>|<prop:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/>/msS';
+ const REGEX_RULES='/<!--.*?--!>|<!---.*?--->|<\/?com:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/?>|<\/?prop:([\w\.]+)\s*>|<%@\s*((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?")*)\s*%>|<%[%#~\/\\$=\\[](.*?)%>|<prop:([\w\.]+)((?:\s*[\w\.]+\s*=\s*\'.*?\'|\s*[\w\.]+\s*=\s*".*?"|\s*[\w\.]+\s*=\s*<%.*?%>)*)\s*\/>/msS';
/**
* Different configurations of component property/event/attribute
@@ -661,6 +661,8 @@ class TTemplate extends TApplicationComponent implements ITemplate
$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->getApplication()->getParameters()->itemAt('$literal')"));
else if($str[2]==='~')
$tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')"));
+ else if($str[2]==='/')
+ $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"dirname(\$this->getApplication()->getRequest()->getApplicationUrl()).'/$literal'"));
else if($str[2]==='[')
{
$literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\"));
@@ -1064,4 +1066,3 @@ class TTemplate extends TApplicationComponent implements ITemplate
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TBaseDataList.php b/framework/Web/UI/WebControls/TBaseDataList.php
index df91a0a6..d202eab8 100644
--- a/framework/Web/UI/WebControls/TBaseDataList.php
+++ b/framework/Web/UI/WebControls/TBaseDataList.php
@@ -188,4 +188,3 @@ abstract class TBaseDataList extends TDataBoundControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TBaseValidator.php b/framework/Web/UI/WebControls/TBaseValidator.php
index add771cc..b418885c 100644
--- a/framework/Web/UI/WebControls/TBaseValidator.php
+++ b/framework/Web/UI/WebControls/TBaseValidator.php
@@ -269,8 +269,11 @@ abstract class TBaseValidator extends TLabel implements IValidator
{
$class = preg_replace ('/ '.preg_quote($cssClass).'/', '',$control->getCssClass());
if(!$this->getIsValid())
+ {
$class .= ' '.$cssClass;
- $control->setCssClass($class);
+ $control->setCssClass($class);
+ } elseif ($control->getIsValid())
+ $control->setCssClass($class);
}
}
}
@@ -493,7 +496,7 @@ abstract class TBaseValidator extends TLabel implements IValidator
$this->setIsValid(true);
$this->onValidate();
if($this->getVisible(true) && $this->getEnabled(true))
- {
+ {
// if the target is not a disabled web control
if(($target=$this->getValidationTarget())!==null && !($target instanceof TWebControl && !$target->getEnabled(true)))
{
@@ -504,10 +507,17 @@ abstract class TBaseValidator extends TLabel implements IValidator
}
else
{
+ $target->setIsValid(false);
$this->setIsValid(false);
$this->onValidationError();
}
}
+ else
+ {
+ $this->evaluateIsValid();
+ $this->setIsValid(true);
+ $this->onValidationSuccess();
+ }
}
return $this->getIsValid();
}
@@ -721,4 +731,3 @@ class TValidationDataType extends TEnumerable
const String='String';
}
-?>
diff --git a/framework/Web/UI/WebControls/TBoundColumn.php b/framework/Web/UI/WebControls/TBoundColumn.php
index 13fb6af8..264bbc6c 100644
--- a/framework/Web/UI/WebControls/TBoundColumn.php
+++ b/framework/Web/UI/WebControls/TBoundColumn.php
@@ -233,4 +233,3 @@ class TBoundColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php
index f99c7986..60cf743e 100644
--- a/framework/Web/UI/WebControls/TBulletedList.php
+++ b/framework/Web/UI/WebControls/TBulletedList.php
@@ -485,4 +485,3 @@ class TBulletedListDisplayMode extends TEnumerable
const LinkButton='LinkButton';
}
-?>
diff --git a/framework/Web/UI/WebControls/TButton.php b/framework/Web/UI/WebControls/TButton.php
index dc66e9d6..81929a28 100644
--- a/framework/Web/UI/WebControls/TButton.php
+++ b/framework/Web/UI/WebControls/TButton.php
@@ -366,4 +366,3 @@ class TButtonType extends TEnumerable
const Button='Button';
}
-?>
diff --git a/framework/Web/UI/WebControls/TButtonColumn.php b/framework/Web/UI/WebControls/TButtonColumn.php
index 24199ddd..186577e5 100644
--- a/framework/Web/UI/WebControls/TButtonColumn.php
+++ b/framework/Web/UI/WebControls/TButtonColumn.php
@@ -276,4 +276,3 @@ class TButtonColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TCaptcha.php b/framework/Web/UI/WebControls/TCaptcha.php
index 153b1d30..3c51c389 100644
--- a/framework/Web/UI/WebControls/TCaptcha.php
+++ b/framework/Web/UI/WebControls/TCaptcha.php
@@ -489,4 +489,3 @@ class TCaptcha extends TImage
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TCaptchaValidator.php b/framework/Web/UI/WebControls/TCaptchaValidator.php
index 770cd514..5477fe54 100644
--- a/framework/Web/UI/WebControls/TCaptchaValidator.php
+++ b/framework/Web/UI/WebControls/TCaptchaValidator.php
@@ -121,4 +121,3 @@ class TCaptchaValidator extends TBaseValidator
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TCheckBox.php b/framework/Web/UI/WebControls/TCheckBox.php
index faff5086..d8c2cc0b 100644
--- a/framework/Web/UI/WebControls/TCheckBox.php
+++ b/framework/Web/UI/WebControls/TCheckBox.php
@@ -43,6 +43,7 @@
class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatable, IDataRenderer, ISurroundable
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the button
@@ -125,6 +126,23 @@ class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatabl
return $this->getChecked();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* @return string the text caption of the checkbox
*/
diff --git a/framework/Web/UI/WebControls/TCheckBoxColumn.php b/framework/Web/UI/WebControls/TCheckBoxColumn.php
index 36217343..71eea97f 100644
--- a/framework/Web/UI/WebControls/TCheckBoxColumn.php
+++ b/framework/Web/UI/WebControls/TCheckBoxColumn.php
@@ -121,4 +121,3 @@ class TCheckBoxColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TCheckBoxList.php b/framework/Web/UI/WebControls/TCheckBoxList.php
index 1e1c3b10..742dd18b 100644
--- a/framework/Web/UI/WebControls/TCheckBoxList.php
+++ b/framework/Web/UI/WebControls/TCheckBoxList.php
@@ -53,6 +53,7 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
private $_isEnabled;
private $_changedEventRaised=false;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* Constructor.
@@ -428,6 +429,23 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
return $this->getSelectedValue();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Gets the name of the javascript class responsible for performing postback for this control.
* This method overrides the parent implementation.
@@ -454,4 +472,3 @@ class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingCont
}
-?>
diff --git a/framework/Web/UI/WebControls/TClientScript.php b/framework/Web/UI/WebControls/TClientScript.php
index 5369d27d..b5806a57 100644
--- a/framework/Web/UI/WebControls/TClientScript.php
+++ b/framework/Web/UI/WebControls/TClientScript.php
@@ -129,4 +129,3 @@ class TClientScript extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TClientScriptLoader.php b/framework/Web/UI/WebControls/TClientScriptLoader.php
index c916bcc5..ec763bb3 100644
--- a/framework/Web/UI/WebControls/TClientScriptLoader.php
+++ b/framework/Web/UI/WebControls/TClientScriptLoader.php
@@ -168,4 +168,3 @@ class TClientScriptLoader extends TWebControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TColorPicker.php b/framework/Web/UI/WebControls/TColorPicker.php
index 5b96723a..67a4ccfe 100644
--- a/framework/Web/UI/WebControls/TColorPicker.php
+++ b/framework/Web/UI/WebControls/TColorPicker.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -203,6 +203,7 @@ class TColorPicker extends TTextBox
$writer->addAttribute('style', "background-color:{$color};");
$writer->addAttribute('width', '20');
$writer->addAttribute('height', '20');
+ $writer->addAttribute('alt', '');
$writer->renderBeginTag('img');
$writer->renderEndTag();
$writer->renderEndTag();
@@ -270,4 +271,3 @@ class TColorPickerClientSide extends TClientSideOptions
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TCompareValidator.php b/framework/Web/UI/WebControls/TCompareValidator.php
index e5723f2a..1261cded 100644
--- a/framework/Web/UI/WebControls/TCompareValidator.php
+++ b/framework/Web/UI/WebControls/TCompareValidator.php
@@ -263,4 +263,3 @@ class TValidationCompareOperator extends TEnumerable
const LessThanEqual='LessThanEqual';
}
-?>
diff --git a/framework/Web/UI/WebControls/TConditional.php b/framework/Web/UI/WebControls/TConditional.php
index 7af6622e..fafe12c9 100644
--- a/framework/Web/UI/WebControls/TConditional.php
+++ b/framework/Web/UI/WebControls/TConditional.php
@@ -141,4 +141,3 @@ class TConditional extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TContent.php b/framework/Web/UI/WebControls/TContent.php
index ecc2a1b5..b327b440 100644
--- a/framework/Web/UI/WebControls/TContent.php
+++ b/framework/Web/UI/WebControls/TContent.php
@@ -45,4 +45,3 @@ class TContent extends TControl implements INamingContainer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TContentPlaceHolder.php b/framework/Web/UI/WebControls/TContentPlaceHolder.php
index 29e12ab3..90390d9d 100644
--- a/framework/Web/UI/WebControls/TContentPlaceHolder.php
+++ b/framework/Web/UI/WebControls/TContentPlaceHolder.php
@@ -46,4 +46,3 @@ class TContentPlaceHolder extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php
index e998cef6..0b82ac5c 100644
--- a/framework/Web/UI/WebControls/TCustomValidator.php
+++ b/framework/Web/UI/WebControls/TCustomValidator.php
@@ -4,7 +4,7 @@
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -88,7 +88,9 @@ class TCustomValidator extends TBaseValidator
*/
public function evaluateIsValid()
{
- $value=$this->getValidationValue($this->getValidationTarget());
+ $value = '';
+ if($this->getValidationTarget()!==null)
+ $value=$this->getValidationValue($this->getValidationTarget());
return $this->onServerValidate($value);
}
@@ -105,9 +107,24 @@ class TCustomValidator extends TBaseValidator
{
$param=new TServerValidateEventParameter($value,true);
$this->raiseEvent('OnServerValidate',$this,$param);
- return $param->getIsValid();
+ if($this->getValidationTarget()==null)
+ return true;
+ else
+ return $param->getIsValid();
+ }
+
+ /**
+ * @return TControl control to be validated. Null if no control is found.
+ */
+ protected function getValidationTarget()
+ {
+ if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null)
+ return $control;
+ else if(($id=$this->getControlToValidate())!=='')
+ throw new TInvalidDataTypeException('basevalidator_validatable_required',get_class($this));
+ else
+ return null;
}
-
/**
* Returns an array of javascript validator options.
@@ -191,4 +208,3 @@ class TServerValidateEventParameter extends TEventParameter
$this->_isValid=TPropertyValue::ensureBoolean($value);
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php
index c8e6c9a8..9551b376 100644
--- a/framework/Web/UI/WebControls/TDataGrid.php
+++ b/framework/Web/UI/WebControls/TDataGrid.php
@@ -2203,4 +2203,3 @@ class TDataGridPagerPosition extends TEnumerable
const TopAndBottom='TopAndBottom';
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataGridColumn.php b/framework/Web/UI/WebControls/TDataGridColumn.php
index e3c2f297..577c0068 100644
--- a/framework/Web/UI/WebControls/TDataGridColumn.php
+++ b/framework/Web/UI/WebControls/TDataGridColumn.php
@@ -565,4 +565,3 @@ class TButtonColumnType extends TEnumerable
const ImageButton='ImageButton';
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataGridItemRenderer.php b/framework/Web/UI/WebControls/TDataGridItemRenderer.php
index 8e0f9e70..62c226f6 100644
--- a/framework/Web/UI/WebControls/TDataGridItemRenderer.php
+++ b/framework/Web/UI/WebControls/TDataGridItemRenderer.php
@@ -28,4 +28,3 @@ class TDataGridItemRenderer extends TItemDataRenderer
{
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataGridPagerStyle.php b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
index dcc9d983..e29b9dc9 100644
--- a/framework/Web/UI/WebControls/TDataGridPagerStyle.php
+++ b/framework/Web/UI/WebControls/TDataGridPagerStyle.php
@@ -219,4 +219,3 @@ class TDataGridPagerStyle extends TPanelStyle
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php
index 7d0965a2..ca628b21 100644
--- a/framework/Web/UI/WebControls/TDataList.php
+++ b/framework/Web/UI/WebControls/TDataList.php
@@ -1764,4 +1764,3 @@ class TDataListItemCollection extends TList
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataListItemRenderer.php b/framework/Web/UI/WebControls/TDataListItemRenderer.php
index 5481cad7..1bf2fcb2 100644
--- a/framework/Web/UI/WebControls/TDataListItemRenderer.php
+++ b/framework/Web/UI/WebControls/TDataListItemRenderer.php
@@ -170,4 +170,3 @@ class TDataListItemRenderer extends TItemDataRenderer implements IStyleable
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataRenderer.php b/framework/Web/UI/WebControls/TDataRenderer.php
index e884afe1..4aaeec0a 100644
--- a/framework/Web/UI/WebControls/TDataRenderer.php
+++ b/framework/Web/UI/WebControls/TDataRenderer.php
@@ -50,4 +50,3 @@ abstract class TDataRenderer extends TTemplateControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataSourceControl.php b/framework/Web/UI/WebControls/TDataSourceControl.php
index e42d7381..1d0823ff 100644
--- a/framework/Web/UI/WebControls/TDataSourceControl.php
+++ b/framework/Web/UI/WebControls/TDataSourceControl.php
@@ -116,4 +116,3 @@ class TReadOnlyDataSource extends TDataSourceControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataSourceView.php b/framework/Web/UI/WebControls/TDataSourceView.php
index 7c0ee2d0..7297fd45 100644
--- a/framework/Web/UI/WebControls/TDataSourceView.php
+++ b/framework/Web/UI/WebControls/TDataSourceView.php
@@ -204,4 +204,3 @@ class TReadOnlyDataSourceView extends TDataSourceView
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDataTypeValidator.php b/framework/Web/UI/WebControls/TDataTypeValidator.php
index d4fa20c3..14017585 100644
--- a/framework/Web/UI/WebControls/TDataTypeValidator.php
+++ b/framework/Web/UI/WebControls/TDataTypeValidator.php
@@ -139,4 +139,3 @@ class TDataTypeValidator extends TBaseValidator
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TDatePicker.php b/framework/Web/UI/WebControls/TDatePicker.php
index 84455fee..770099eb 100644
--- a/framework/Web/UI/WebControls/TDatePicker.php
+++ b/framework/Web/UI/WebControls/TDatePicker.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -59,7 +59,12 @@ Prado::using('System.Web.UI.WebControls.TTextBox');
* In <tt>DropDownList</tt> mode, in addition to the popup date picker, three
* drop down list (day, month and year) are presented to select the date .
*
+ * The <b>PositionMode</b> property can be set to "Top" or "Bottom" with default
+ * as "Bottom". It specifies the position of the calendar popup, relative to the
+ * input field.
+ *
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @author Carl G. Mathisen <carlgmathisen@gmail.com>
* @version $Id$
* @package System.Web.UI.WebControls
* @since 3.0
@@ -263,6 +268,22 @@ class TDatePicker extends TTextBox
{
return $this->getViewState('UpToYear', intval(@date('Y'))+10);
}
+
+ /**
+ * @param TDatePickerPositionMode calendar UI position
+ */
+ public function setPositionMode($value)
+ {
+ $this->setViewState('PositionMode', TPropertyValue::ensureEnum($value, 'TDatePickerPositionMode'), TDatePickerPositionMode::Bottom);
+ }
+
+ /**
+ * @return TDatePickerPositionMode current calendar UI position.
+ */
+ public function getPositionMode()
+ {
+ return $this->getViewState('PositionMode', TDatePickerPositionMode::Bottom);
+ }
/**
* @return integer current selected date from the date picker as timestamp, NULL if timestamp is not set previously.
@@ -505,6 +526,7 @@ class TDatePicker extends TTextBox
$options['UpToYear'] = $this->getUpToYear();
if($this->getMode()!==TDatePickerMode::Basic)
$options['Trigger'] = $this->getDatePickerButtonID();
+ $options['PositionMode'] = $this->getPositionMode();
$options = array_merge($options, $this->getCulturalOptions());
if(!is_null($this->_clientScript))
@@ -853,8 +875,8 @@ class TDatePicker extends TTextBox
*
* The <tt>OnDateChanged</tt> event is raise when the date picker's date
* is changed.
- * The formatted date according to {@link TDatePicker::getDateFormat DateFormat} is sent
- * as parameter to this event
+ * The formatted date according to {@link TDatePicker::getDateFormat DateFormat} is sent
+ * as parameter to this event
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @version $Id$
@@ -923,4 +945,20 @@ class TDatePickerMode extends TEnumerable
const ImageButton='ImageButton';
}
-?>
+/**
+ * TDatePickerPositionMode class.
+ * TDatePickerPositionMode defines the positions available for the calendar popup, relative to the corresponding input.
+ *
+ * The following enumerable values are defined:
+ * - Top: the date picker is placed above the input field
+ * - Bottom: the date picker is placed below the input field
+ *
+ * @author Carl G. Mathisen <carlgmathisen@gmail.com>
+ * @package System.Web.UI.WebControls
+ * @since 3.1.4
+ */
+class TDatePickerPositionMode extends TEnumerable
+{
+ const Top='Top';
+ const Bottom='Bottom';
+} \ No newline at end of file
diff --git a/framework/Web/UI/WebControls/TDropDownList.php b/framework/Web/UI/WebControls/TDropDownList.php
index f00466d5..73be981c 100644
--- a/framework/Web/UI/WebControls/TDropDownList.php
+++ b/framework/Web/UI/WebControls/TDropDownList.php
@@ -40,6 +40,7 @@ Prado::using('System.Web.UI.WebControls.TListControl');
class TDropDownList extends TListControl implements IPostBackDataHandler, IValidatable
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* Adds attributes to renderer.
@@ -127,5 +128,21 @@ class TDropDownList extends TListControl implements IPostBackDataHandler, IValid
{
return $this->getSelectedValue();
}
+
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
}
-?>
diff --git a/framework/Web/UI/WebControls/TDropDownListColumn.php b/framework/Web/UI/WebControls/TDropDownListColumn.php
index cff42cad..a225abac 100644
--- a/framework/Web/UI/WebControls/TDropDownListColumn.php
+++ b/framework/Web/UI/WebControls/TDropDownListColumn.php
@@ -319,4 +319,3 @@ class TDropDownListColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TEditCommandColumn.php b/framework/Web/UI/WebControls/TEditCommandColumn.php
index f9989a4e..1699afa2 100644
--- a/framework/Web/UI/WebControls/TEditCommandColumn.php
+++ b/framework/Web/UI/WebControls/TEditCommandColumn.php
@@ -263,4 +263,3 @@ class TEditCommandColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TEmailAddressValidator.php b/framework/Web/UI/WebControls/TEmailAddressValidator.php
index c5407516..206bd23d 100644
--- a/framework/Web/UI/WebControls/TEmailAddressValidator.php
+++ b/framework/Web/UI/WebControls/TEmailAddressValidator.php
@@ -95,4 +95,3 @@ class TEmailAddressValidator extends TRegularExpressionValidator
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TExpression.php b/framework/Web/UI/WebControls/TExpression.php
index 022a0b21..34190473 100644
--- a/framework/Web/UI/WebControls/TExpression.php
+++ b/framework/Web/UI/WebControls/TExpression.php
@@ -60,4 +60,3 @@ class TExpression extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TFileUpload.php b/framework/Web/UI/WebControls/TFileUpload.php
index 47d49c0c..6658e93d 100644
--- a/framework/Web/UI/WebControls/TFileUpload.php
+++ b/framework/Web/UI/WebControls/TFileUpload.php
@@ -59,6 +59,7 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
*/
private $_errorCode=UPLOAD_ERR_NO_FILE;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the file upload control
@@ -255,6 +256,23 @@ class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidata
{
return $this->getFileName();
}
+
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
}
-?>
diff --git a/framework/Web/UI/WebControls/TFont.php b/framework/Web/UI/WebControls/TFont.php
index cb0fba93..9ba644f8 100644
--- a/framework/Web/UI/WebControls/TFont.php
+++ b/framework/Web/UI/WebControls/TFont.php
@@ -316,4 +316,3 @@ class TFont extends TComponent
$writer->addStyleAttribute('font-family',$this->_name);
}
}
-?>
diff --git a/framework/Web/UI/WebControls/THead.php b/framework/Web/UI/WebControls/THead.php
index 1b51f8ae..62ee46d3 100644
--- a/framework/Web/UI/WebControls/THead.php
+++ b/framework/Web/UI/WebControls/THead.php
@@ -4,7 +4,7 @@
*
* @author Marcus Nyeholt <tanus@users.sourceforge.net> and Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI
@@ -29,6 +29,13 @@
* <com:TMetaTag Name="keywords" Content="Prado" />
* </com:THead>
* </code>
+ *
+ * A MetaTag for "generator" is added by default if you haven't specified your own generator meta tag. You can override
+ * the property by adding the following code to your template:
+ * <com:THead>
+ * <com:TMetaTag Name="generator" Content="Custom name" />
+ * </com:THead>
+ * </code>
*
* Note, {@link TPage} has a property {@link TPage::getHead Head} that refers to
* the THead control currently on the page. A page can have at most once THead
@@ -155,14 +162,24 @@ class THead extends TControl
if(($icon=$this->getShortcutIcon())!=='')
$writer->write('<link rel="shortcut icon" href="'.$icon."\" />\n");
+ $generatorAdded = false;
if(($metaTags=$this->getMetaTags())!==null)
{
foreach($metaTags as $metaTag)
{
+ if(strtolower($metaTag->getName()) == 'generator')
+ $generatorAdded = true;
$metaTag->render($writer);
$writer->writeLine();
}
}
+ if(!$generatorAdded)
+ {
+ $metaTag = new TMetaTag();
+ $metaTag->setName('generator');
+ $metaTag->setContent(Prado::metaGenerator());
+ $metaTag->render($writer);
+ }
$cs=$page->getClientScript();
$cs->renderStyleSheetFiles($writer);
$cs->renderStyleSheets($writer);
@@ -374,4 +391,4 @@ class TMetaTagCollection extends TList
}
}
-?>
+?>
diff --git a/framework/Web/UI/WebControls/THiddenField.php b/framework/Web/UI/WebControls/THiddenField.php
index 2fbbcf99..49b1aa39 100644
--- a/framework/Web/UI/WebControls/THiddenField.php
+++ b/framework/Web/UI/WebControls/THiddenField.php
@@ -26,6 +26,7 @@
class THiddenField extends TControl implements IPostBackDataHandler, IValidatable, IDataRenderer
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the hidden field.
@@ -111,6 +112,23 @@ class THiddenField extends TControl implements IPostBackDataHandler, IValidatabl
return $this->getValue();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Raises postdata changed event.
* This method calls {@link onValueChanged} method.
@@ -204,4 +222,3 @@ class THiddenField extends TControl implements IPostBackDataHandler, IValidatabl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php
index b9245be3..7fea5862 100644
--- a/framework/Web/UI/WebControls/THtmlArea.php
+++ b/framework/Web/UI/WebControls/THtmlArea.php
@@ -473,4 +473,3 @@ class THtmlArea extends TTextBox
}
}
-?>
diff --git a/framework/Web/UI/WebControls/THyperLink.php b/framework/Web/UI/WebControls/THyperLink.php
index 3bd92ffd..217fa267 100644
--- a/framework/Web/UI/WebControls/THyperLink.php
+++ b/framework/Web/UI/WebControls/THyperLink.php
@@ -187,4 +187,3 @@ class THyperLink extends TWebControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/THyperLinkColumn.php b/framework/Web/UI/WebControls/THyperLinkColumn.php
index 8ac1177f..7db6eda8 100644
--- a/framework/Web/UI/WebControls/THyperLinkColumn.php
+++ b/framework/Web/UI/WebControls/THyperLinkColumn.php
@@ -215,4 +215,3 @@ class THyperLinkColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TImage.php b/framework/Web/UI/WebControls/TImage.php
index e1ff8535..220fa4a6 100644
--- a/framework/Web/UI/WebControls/TImage.php
+++ b/framework/Web/UI/WebControls/TImage.php
@@ -155,4 +155,3 @@ class TImage extends TWebControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TImageMap.php b/framework/Web/UI/WebControls/TImageMap.php
index 89daca44..d0cd8a0a 100644
--- a/framework/Web/UI/WebControls/TImageMap.php
+++ b/framework/Web/UI/WebControls/TImageMap.php
@@ -835,4 +835,3 @@ class THotSpotMode extends TEnumerable
const Inactive='Inactive';
}
-?>
diff --git a/framework/Web/UI/WebControls/TInlineFrame.php b/framework/Web/UI/WebControls/TInlineFrame.php
index dae728d3..c47af648 100644
--- a/framework/Web/UI/WebControls/TInlineFrame.php
+++ b/framework/Web/UI/WebControls/TInlineFrame.php
@@ -274,4 +274,3 @@ class TInlineFrameScrollBars extends TEnumerable
const Auto='Auto';
const Both='Both';
}
-?>
diff --git a/framework/Web/UI/WebControls/TItemDataRenderer.php b/framework/Web/UI/WebControls/TItemDataRenderer.php
index a57ff27d..79e0186e 100644
--- a/framework/Web/UI/WebControls/TItemDataRenderer.php
+++ b/framework/Web/UI/WebControls/TItemDataRenderer.php
@@ -81,4 +81,3 @@ abstract class TItemDataRenderer extends TDataRenderer implements IItemDataRende
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TJavascriptLogger.php b/framework/Web/UI/WebControls/TJavascriptLogger.php
index 11e64735..6d49f801 100644
--- a/framework/Web/UI/WebControls/TJavascriptLogger.php
+++ b/framework/Web/UI/WebControls/TJavascriptLogger.php
@@ -91,4 +91,3 @@ class TJavascriptLogger extends TWebControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TKeyboard.php b/framework/Web/UI/WebControls/TKeyboard.php
index 7c9357d7..9c26fab8 100644
--- a/framework/Web/UI/WebControls/TKeyboard.php
+++ b/framework/Web/UI/WebControls/TKeyboard.php
@@ -186,4 +186,3 @@ class TKeyboard extends TWebControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TLabel.php b/framework/Web/UI/WebControls/TLabel.php
index 3e61eddf..d1595ead 100644
--- a/framework/Web/UI/WebControls/TLabel.php
+++ b/framework/Web/UI/WebControls/TLabel.php
@@ -152,4 +152,3 @@ class TLabel extends TWebControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TLinkButton.php b/framework/Web/UI/WebControls/TLinkButton.php
index d847f07e..459b98cf 100644
--- a/framework/Web/UI/WebControls/TLinkButton.php
+++ b/framework/Web/UI/WebControls/TLinkButton.php
@@ -332,4 +332,3 @@ class TLinkButton extends TWebControl implements IPostBackEventHandler, IButtonC
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TListBox.php b/framework/Web/UI/WebControls/TListBox.php
index 903dbed8..1b4599fc 100644
--- a/framework/Web/UI/WebControls/TListBox.php
+++ b/framework/Web/UI/WebControls/TListBox.php
@@ -39,6 +39,7 @@ Prado::using('System.Web.UI.WebControls.TListControl');
class TListBox extends TListControl implements IPostBackDataHandler, IValidatable
{
private $_dataChanged=false;
+ private $_isValid=true;
/**
* Adds attribute name-value pairs to renderer.
@@ -220,6 +221,23 @@ class TListBox extends TListControl implements IPostBackDataHandler, IValidatabl
{
return $this->getSelectedValue();
}
+
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
}
@@ -242,4 +260,3 @@ class TListSelectionMode extends TEnumerable
const Multiple='Multiple';
}
-?>
diff --git a/framework/Web/UI/WebControls/TListControlValidator.php b/framework/Web/UI/WebControls/TListControlValidator.php
index f468a30e..f547884f 100644
--- a/framework/Web/UI/WebControls/TListControlValidator.php
+++ b/framework/Web/UI/WebControls/TListControlValidator.php
@@ -223,4 +223,3 @@ class TListControlValidator extends TBaseValidator
return $options;
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TListItem.php b/framework/Web/UI/WebControls/TListItem.php
index 2017b64e..eb72d183 100644
--- a/framework/Web/UI/WebControls/TListItem.php
+++ b/framework/Web/UI/WebControls/TListItem.php
@@ -182,4 +182,3 @@ class TListItem extends TComponent
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TLiteral.php b/framework/Web/UI/WebControls/TLiteral.php
index 0c93043a..3a7f4581 100644
--- a/framework/Web/UI/WebControls/TLiteral.php
+++ b/framework/Web/UI/WebControls/TLiteral.php
@@ -110,4 +110,3 @@ class TLiteral extends TControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TLiteralColumn.php b/framework/Web/UI/WebControls/TLiteralColumn.php
index cb97adb5..8ca87023 100644
--- a/framework/Web/UI/WebControls/TLiteralColumn.php
+++ b/framework/Web/UI/WebControls/TLiteralColumn.php
@@ -152,4 +152,3 @@ class TLiteralColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TMarkdown.php b/framework/Web/UI/WebControls/TMarkdown.php
index dc6bc5e2..d630cd29 100644
--- a/framework/Web/UI/WebControls/TMarkdown.php
+++ b/framework/Web/UI/WebControls/TMarkdown.php
@@ -73,4 +73,3 @@ class TMarkdown extends TTextHighlighter
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TMultiView.php b/framework/Web/UI/WebControls/TMultiView.php
index 6adaed5b..1f87b03f 100644
--- a/framework/Web/UI/WebControls/TMultiView.php
+++ b/framework/Web/UI/WebControls/TMultiView.php
@@ -376,4 +376,3 @@ class TView extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TOutputCache.php b/framework/Web/UI/WebControls/TOutputCache.php
index dd38ae03..c0747a11 100644
--- a/framework/Web/UI/WebControls/TOutputCache.php
+++ b/framework/Web/UI/WebControls/TOutputCache.php
@@ -582,4 +582,3 @@ class TOutputCacheCalculateKeyEventParameter extends TEventParameter
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TPager.php b/framework/Web/UI/WebControls/TPager.php
index d1a5db25..51ea2a11 100644
--- a/framework/Web/UI/WebControls/TPager.php
+++ b/framework/Web/UI/WebControls/TPager.php
@@ -790,4 +790,3 @@ class TPagerButtonType extends TEnumerable
const ImageButton='ImageButton';
}
-?>
diff --git a/framework/Web/UI/WebControls/TPanel.php b/framework/Web/UI/WebControls/TPanel.php
index 661795d7..5bbcdcca 100644
--- a/framework/Web/UI/WebControls/TPanel.php
+++ b/framework/Web/UI/WebControls/TPanel.php
@@ -234,4 +234,3 @@ class TPanel extends TWebControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TPanelStyle.php b/framework/Web/UI/WebControls/TPanelStyle.php
index 08667860..2d6ee824 100644
--- a/framework/Web/UI/WebControls/TPanelStyle.php
+++ b/framework/Web/UI/WebControls/TPanelStyle.php
@@ -276,4 +276,3 @@ class TScrollBars extends TEnumerable
const Vertical='Vertical';
}
-?>
diff --git a/framework/Web/UI/WebControls/TPlaceHolder.php b/framework/Web/UI/WebControls/TPlaceHolder.php
index ae878e2b..cdfd3873 100644
--- a/framework/Web/UI/WebControls/TPlaceHolder.php
+++ b/framework/Web/UI/WebControls/TPlaceHolder.php
@@ -26,4 +26,3 @@ class TPlaceHolder extends TControl
{
}
-?>
diff --git a/framework/Web/UI/WebControls/TRadioButton.php b/framework/Web/UI/WebControls/TRadioButton.php
index 20973732..fdaf53a8 100644
--- a/framework/Web/UI/WebControls/TRadioButton.php
+++ b/framework/Web/UI/WebControls/TRadioButton.php
@@ -318,4 +318,3 @@ class TRadioButton extends TCheckBox
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TRadioButtonList.php b/framework/Web/UI/WebControls/TRadioButtonList.php
index b225834a..a8c53dee 100644
--- a/framework/Web/UI/WebControls/TRadioButtonList.php
+++ b/framework/Web/UI/WebControls/TRadioButtonList.php
@@ -99,4 +99,3 @@ class TRadioButtonList extends TCheckBoxList
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TRangeValidator.php b/framework/Web/UI/WebControls/TRangeValidator.php
index 0f92fb45..d741118f 100644
--- a/framework/Web/UI/WebControls/TRangeValidator.php
+++ b/framework/Web/UI/WebControls/TRangeValidator.php
@@ -358,4 +358,3 @@ class TRangeValidationDataType extends TValidationDataType
{
const StringLength='StringLength';
}
-?>
diff --git a/framework/Web/UI/WebControls/TRatingList.php b/framework/Web/UI/WebControls/TRatingList.php
index 22cc0844..aba44fb0 100644
--- a/framework/Web/UI/WebControls/TRatingList.php
+++ b/framework/Web/UI/WebControls/TRatingList.php
@@ -4,7 +4,7 @@
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -21,191 +21,320 @@ Prado::using('System.Web.UI.WebControls.TRadioButtonList');
* This class is EXPERIMENTAL.
*
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
+ * @author Bradley Booms <bradley[dot]booms[at]gmail[dot]com>
* @version $Id$
* @package System.Web.UI.WebControls
* @since 3.0
*/
class TRatingList extends TRadioButtonList
{
+ /**
+ * Script path relative to the TClientScriptManager::SCRIPT_PATH
+ */
const SCRIPT_PATH='prado/ratings';
+ /**
+ * @var array list of published rating images.
+ */
private $_ratingImages = array();
+ /**
+ * Sets the default repeat direction to horizontal.
+ */
public function __construct()
{
parent::__construct();
- $this->getRepeatInfo()->setRepeatDirection('Horizontal');
+ $this->setRepeatDirection(TRepeatDirection::Horizontal);
}
+ /**
+ * @return boolean whether the items in the column can be edited. Defaults to false.
+ */
+ public function getReadOnly()
+ {
+ return $this->getViewState('ReadOnly',false);
+ }
+
+ /**
+ * @param boolean whether the items in the column can be edited
+ */
+ public function setReadOnly($value)
+ {
+ $this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
+ }
+
+ /**
+ * Wrapper for {@link setReadOnly ReadOnly} property.
+ * @return boolean whether the rating list can be edited. Defaults to true.
+ */
public function getAllowInput()
{
- return $this->getViewState('AllowInput', true);
+ return !$this->getReadOnly();
}
+ /**
+ * Wrapper for {@link setReadOnly ReadOnly} property.
+ * @param boolean whether the rating list can be edited
+ */
public function setAllowInput($value)
{
- $this->setViewState('AllowInput', TPropertyValue::ensureBoolean($value), true);
+ $this->setReadOnly(!TPropertyValue::ensureBoolean($value));
}
- public function getRating()
+ /**
+ * Wrapper for {@link setReadOnly ReadOnly} property.
+ * @param boolean whether the rating list can be edited
+ */
+ public function setEnabled($value)
{
- if($this->getAllowInput())
- return $this->getSelectedIndex();
- else
- return $this->getViewState('Rating',0);
+ $this->setReadOnly(!TPropertyValue::ensureBoolean($value));
}
- public function setRating($value)
+ /**
+ * The repeat layout must be Table.
+ * @param string repeat layout type
+ * @throws TInvaliddataValueException when repeat layout is not Table.
+ */
+ public function setRepeatLayout($value)
{
- if($this->getAllowInput())
- $this->setSelectedIndex($value);
+ if($value!==TRepeatLayout::Table)
+ throw new TInvalidDataValueException('ratinglist_table_layout_only');
else
- $this->setViewState('Rating', TPropertyValue::ensureFloat($value),0);
+ parent::setRepeatLayout($value);
}
/**
- * @param string set the rating style
+ * @return float rating value.
*/
- public function setRatingStyle($value)
+ public function getRating()
{
- $this->setViewState('RatingStyle', $value, 'default');
+ $rating = $this->getViewState('Rating', null);
+ if ($rating === null)
+ return $this->getSelectedIndex()+1;
+ else
+ return $rating;
}
/**
- * @return TRatingListStyle current rating style
+ * @param float rating value, also sets the selected Index
*/
- public function getRatingStyle()
+ public function setRating($value)
{
- return $this->getViewState('RatingStyle', 'default');
+ $value = TPropertyValue::ensureFloat($value);
+ $this->setViewState('Rating', $value, null);
+ $index = $this->getRatingIndex($value);
+ parent::setSelectedIndex($index);
+ }
+
+ public function setSelectedIndex($value)
+ {
+ $this->setRating($value+1);
+ parent::setSelectedIndex($value);
}
/**
- * @return string caption text. Default is "Rate It:".
+ * @param float rating value
+ * @return int rating as integer
*/
- public function getCaption()
+ protected function getRatingIndex($rating)
{
- return $this->getViewState('Caption', 'Rate It:');
+ $interval = $this->getHalfRatingInterval();
+ $base = intval($rating)-1;
+ $remainder = $rating-$base-1;
+ return $remainder > $interval[1] ? $base+1 : $base;
}
/**
- * @param string caption text
+ * @param int change the rating selection index
*/
- public function setCaption($value)
+ public function onSelectedIndexChanged($param)
{
- $this->setViewState('Caption', $value, 'Rate It:');
+ $value = $this->getRating();
+ $value = TPropertyValue::ensureInteger($value);
+ $this->setRating($value);
+ parent::onSelectedIndexChanged($param);
}
+ /**
+ * @return string control or html element ID for displaying a caption.
+ */
+ public function getCaptionID()
+ {
+ return $this->getViewState('CaptionID', '');
+ }
- public function setHalfRatingLimit($value)
+ /**
+ * @param string control or html element ID for displaying a caption.
+ */
+ public function setCaptionID($value)
{
- $this->setViewState('HalfRating',
- TPropertyValue::ensureArray($value), array(0.3, 0.7));
+ $this->setViewState('CaptionID', $value, '');
}
- public function getHalfRatingLimit()
+ protected function getCaptionControl()
{
- return $this->getViewState('HalfRating', array(0.3, 0.7));
+ if(($id=$this->getCaptionID())!=='')
+ {
+ if($control=$this->getParent()->findControl($id))
+ return $control;
+ }
+ throw new TInvalidDataValueException(
+ 'ratinglist_invalid_caption_id',$id,$this->getID());
}
/**
- * @param string asset file in the self::SCRIPT_PATH directory.
- * @return string asset file url.
+ * @return string caption text. Default is "Rate It:".
*/
- protected function getAssetUrl($file='')
+ public function getCaption()
{
- $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
- return $base.'/'.self::SCRIPT_PATH.'/'.$file;
+ return $this->getCaptionControl()->getText();
}
- public function getRatingClientOptions()
- {
- $options['cssClass'] = 'TRatingList_'.$this->getRatingStyle();
- $options['ID'] = $this->getClientID();
- $options['caption'] = $this->getCaption();
- $options['field'] = $this->getUniqueID();
- $options['selectedIndex'] = $this->getSelectedIndex();
+ /**
+ * @return TRatingListStyle current rating style
+ */
+ public function setCaption($value)
+ {
+ $this->getCaptionControl()->setText($value);
+ }
+
+ /**
+ * @param string set the rating style, default is "default"
+ */
+ public function setRatingStyle($value)
+ {
+ $this->setViewState('RatingStyle', $value, 'default');
+ }
+
+ /**
+ * @return TRatingListStyle current rating style
+ */
+ public function getRatingStyle()
+ {
+ return $this->getViewState('RatingStyle', 'default');
+ }
+
+ /**
+ * @return string rating style css class name.
+ */
+ protected function getRatingStyleCssClass()
+ {
+ return 'TRatingList_'.$this->getRatingStyle();
+ }
+
+ /**
+ * Sets the interval such that those rating values within the interval
+ * will be considered as a half star rating.
+ * @param array rating display half value interval, default is array(0.3, 0.7);
+ */
+ public function setHalfRatingInterval($value)
+ {
+ $this->setViewState('HalfRating',
+ TPropertyValue::ensureArray($value), array(0.3, 0.7));
+ }
+
+ /**
+ * @return array rating display half value interval, default is array(0.3, 0.7);
+ */
+ public function getHalfRatingInterval()
+ {
+ return $this->getViewState('HalfRating', array(0.3, 0.7));
+ }
+
+ /**
+ * @return array list of post back options.
+ */
+ protected function getPostBackOptions()
+ {
+ $options = parent::getPostBackOptions();
+ $options['AutoPostBack'] = $this->getAutoPostBack();
+ $options['ReadOnly'] = $this->getReadOnly();
+ $options['Style'] = $this->getRatingStyleCssClass();
+ $options['CaptionID'] = $this->getCaptionControlID();
+ $options['SelectedIndex'] = $this->getSelectedIndex();
+ $options['Rating'] = $this->getRating();
+ $options['HalfRating'] = $this->getHalfRatingInterval();
return $options;
- }
+ }
- protected function publishRatingListStyle($style)
- {
+ /**
+ * @return string find the client ID of the caption control.
+ */
+ protected function getCaptionControlID()
+ {
+ if(($id=$this->getCaptionID())!=='')
+ {
+ if($control=$this->getParent()->findControl($id))
+ {
+ if($control->getVisible(true))
+ return $control->getClientID();
+ }
+ else
+ return $id;
+ }
+ return '';
+ }
+
+ /**
+ * Publish the the rating style css file and rating image files.
+ */
+ public function onPreRender($param)
+ {
+ parent::onPreRender($param);
+ $this->publishStyle($this->getRatingStyle());
+ $this->_ratingImages = $this->publishImages($this->getRatingStyle());
+ }
+
+ /**
+ * @param string rating style name
+ * @return string URL of the css style file
+ */
+ protected function publishStyle($style)
+ {
$cs = $this->getPage()->getClientScript();
$url = $this->getAssetUrl($style.'.css');
if(!$cs->isStyleSheetFileRegistered($url))
$cs->registerStyleSheetFile($url, $url);
return $url;
- }
+ }
- protected function publishRatingListImages($style, $fileExt='.gif')
- {
- $images = array('blank', 'hover', 'selected', 'half');
+ /**
+ * @param string rating style name
+ * @param string rating image file extension, default is '.gif'
+ * @return array URL of publish the rating images
+ */
+ protected function publishImages($style, $fileExt='.gif')
+ {
+ $types = array('blank', 'selected', 'half', 'combined');
$files = array();
- foreach($images as $type)
+ foreach($types as $type)
$files[$type] = $this->getAssetUrl("{$style}_{$type}{$fileExt}");
return $files;
- }
+ }
/**
- * @param THtmlWriter writer
+ * @param string asset file in the self::SCRIPT_PATH directory.
+ * @return string asset file url.
*/
- public function onPreRender($param)
- {
- parent::onPreRender($param);
-
- $this->publishRatingListStyle($this->getRatingStyle());
- $this->_ratingImages = $this->publishRatingListImages($this->getRatingStyle());
-
- if($this->getAllowInput())
- $this->registerRatingListClientScript();
- else
- {
- $this->getRepeatInfo()->setCaption($this->getCaption());
- $this->setAttribute('title', $this->getRating());
- }
- }
-
- protected function registerRatingListClientScript()
- {
- $id = $this->getClientID();
- $scripts = $this->getPage()->getClientScript();
- $scripts->registerPradoScript('prado');
- $options = TJavaScript::encode($this->getRatingClientOptions());
- $code = "new Prado.WebUI.TRatingList($options);";
- $scripts->registerEndScript("prado:$id", $code);
- }
-
- public function renderItem($writer,$repeatInfo,$itemType,$index)
- {
- if($this->getAllowInput())
- parent::renderItem($writer, $repeatInfo, $itemType, $index);
- else
- $this->renderRatingListItem($writer, $repeatInfo, $itemType, $index);
- }
-
- protected function renderRatingListItem($writer, $repeatInfo, $itemType, $index)
- {
- $image = new TImage;
- $image->setImageUrl($this->_ratingImages[$this->getRatingImageType($index)]);
- $image->setAlternateText($this->getRating());
- $image->render($writer);
- }
-
- protected function getRatingImageType($index)
- {
- $rating = floatval($this->getRating());
- $int = intval($rating);
- $limit = $this->getHalfRatingLimit();
- if($index < $int || ($rating < $index + 1 && $rating > $index +$limit[1]))
- return 'selected';
- if($rating >= $index+$limit[0] && $rating <= $index+$limit[1])
- return 'half';
- return 'blank';
- }
+ protected function getAssetUrl($file='')
+ {
+ $base = $this->getPage()->getClientScript()->getPradoScriptAssetUrl();
+ return $base.'/'.self::SCRIPT_PATH.'/'.$file;
+ }
- public function generateItemStyle($itemType,$index)
- {
- return new TStyle;
- }
+ /**
+ * Add rating style class name to the class attribute
+ * when {@link setReadOnly ReadOnly} property is true and when the
+ * {@link setCssClass CssClass} property is empty.
+ * @param THtmlWriter renderer
+ */
+ public function render($writer)
+ {
+ $writer->addAttribute('id',$this->getClientID());
+ $this->getPage()->getClientScript()->registerPostBackControl(
+ $this->getClientClassName(), $this->getPostBackOptions());
+ parent::render($writer);
+ }
/**
* Gets the name of the javascript class responsible for performing postback for this control.
@@ -218,4 +347,3 @@ class TRatingList extends TRadioButtonList
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TRegularExpressionValidator.php b/framework/Web/UI/WebControls/TRegularExpressionValidator.php
index f0c645a4..be861e45 100644
--- a/framework/Web/UI/WebControls/TRegularExpressionValidator.php
+++ b/framework/Web/UI/WebControls/TRegularExpressionValidator.php
@@ -96,7 +96,7 @@ class TRegularExpressionValidator extends TBaseValidator
}
/**
- * @param string pattern modifiers,
+ * @param string pattern modifiers for server side validation,
* see http://www.php.net/manual/en/reference.pcre.pattern.modifiers.php
*/
public function setPatternModifiers($value)
@@ -113,6 +113,23 @@ class TRegularExpressionValidator extends TBaseValidator
}
/**
+ * @param string pattern modifiers for clientside.
+ * (Only 'g','i' and 'm' are available.)
+ */
+ public function setClientSidePatternModifiers($value)
+ {
+ $this->setViewState('ClientSidePatternModifiers', $value);
+ }
+
+ /**
+ * @return string clientside pattern modifiers, no modifiers by default.
+ */
+ public function getClientSidePatternModifiers()
+ {
+ return $this->getViewState('ClientSidePatternModifiers', '');
+ }
+
+ /**
* Returns an array of javascript validator options.
* @return array javascript validator options.
*/
@@ -120,8 +137,8 @@ class TRegularExpressionValidator extends TBaseValidator
{
$options = parent::getClientScriptOptions();
$options['ValidationExpression']=$this->getRegularExpression();
+ $options['PatternModifiers']=$this->getClientSidePatternModifiers();
return $options;
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TRepeatInfo.php b/framework/Web/UI/WebControls/TRepeatInfo.php
index ecf0ebf7..30c85f14 100644
--- a/framework/Web/UI/WebControls/TRepeatInfo.php
+++ b/framework/Web/UI/WebControls/TRepeatInfo.php
@@ -558,4 +558,3 @@ class TRepeatLayout extends TEnumerable
const Raw='Raw';
}
-?>
diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php
index 6b9c08c1..a6c9903d 100644
--- a/framework/Web/UI/WebControls/TRepeater.php
+++ b/framework/Web/UI/WebControls/TRepeater.php
@@ -1023,4 +1023,3 @@ class TRepeaterItemCollection extends TList
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TRepeaterItemRenderer.php b/framework/Web/UI/WebControls/TRepeaterItemRenderer.php
index d99da302..79ff9087 100644
--- a/framework/Web/UI/WebControls/TRepeaterItemRenderer.php
+++ b/framework/Web/UI/WebControls/TRepeaterItemRenderer.php
@@ -48,4 +48,3 @@ class TRepeaterItemRenderer extends TItemDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TRequiredFieldValidator.php b/framework/Web/UI/WebControls/TRequiredFieldValidator.php
index 8d0eaec2..e6ddd6d3 100644
--- a/framework/Web/UI/WebControls/TRequiredFieldValidator.php
+++ b/framework/Web/UI/WebControls/TRequiredFieldValidator.php
@@ -136,4 +136,3 @@ class TRequiredFieldValidator extends TBaseValidator
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TSafeHtml.php b/framework/Web/UI/WebControls/TSafeHtml.php
index 0f4de2cb..d6829f8b 100644
--- a/framework/Web/UI/WebControls/TSafeHtml.php
+++ b/framework/Web/UI/WebControls/TSafeHtml.php
@@ -62,4 +62,3 @@ class TSafeHtml extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TSlider.php b/framework/Web/UI/WebControls/TSlider.php
index 3fd8e244..ee725e99 100644
--- a/framework/Web/UI/WebControls/TSlider.php
+++ b/framework/Web/UI/WebControls/TSlider.php
@@ -4,7 +4,7 @@
*
* @author Christophe Boulain <Christophe.Boulain@gmail.com>
* @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-2008 PradoSoft
+ * @copyright Copyright &copy; 2005-2008 PradoSoft
* @license http://www.pradosoft.com/license/
* @version $Id$
* @package System.Web.UI.WebControls
@@ -218,7 +218,7 @@ class TSlider extends TWebControl implements IPostBackDataHandler, IDataRenderer
public function setValues($value)
{
$this->setViewState('Values', TPropertyValue::ensureArray($value), array());
- }
+ }
/**
* @return boolean a value indicating whether an automatic postback to the server
@@ -488,7 +488,7 @@ class TSlider extends TWebControl implements IPostBackDataHandler, IDataRenderer
// Add max if it's not in the array because of step
if (!in_array($maxValue, $values)) $values[]=$maxValue;
}
- $options['values'] = TJavascript::Encode($values,false);
+ $options['values'] = TJavaScript::Encode($values,false);
if($this->_clientScript!==null)
$options = array_merge($options,$this->_clientScript->getOptions()->toArray());
return $options;
@@ -572,4 +572,3 @@ class TSliderDirection extends TEnumerable
}
-?>
diff --git a/framework/Web/UI/WebControls/TStatements.php b/framework/Web/UI/WebControls/TStatements.php
index 09c03cb9..d07e68a1 100644
--- a/framework/Web/UI/WebControls/TStatements.php
+++ b/framework/Web/UI/WebControls/TStatements.php
@@ -61,4 +61,3 @@ class TStatements extends TControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php
index c81a6db9..7cb1d8c8 100644
--- a/framework/Web/UI/WebControls/TStyle.php
+++ b/framework/Web/UI/WebControls/TStyle.php
@@ -891,4 +891,3 @@ class TTableGridLines extends TEnumerable
const Both='Both';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTable.php b/framework/Web/UI/WebControls/TTable.php
index 9fa9130d..57efa7f7 100644
--- a/framework/Web/UI/WebControls/TTable.php
+++ b/framework/Web/UI/WebControls/TTable.php
@@ -408,4 +408,3 @@ class TTableCaptionAlign extends TEnumerable
const Right='Right';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableCell.php b/framework/Web/UI/WebControls/TTableCell.php
index 10d4f457..8bc83c52 100644
--- a/framework/Web/UI/WebControls/TTableCell.php
+++ b/framework/Web/UI/WebControls/TTableCell.php
@@ -220,4 +220,3 @@ class TTableCell extends TWebControl implements IDataRenderer
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableFooterRow.php b/framework/Web/UI/WebControls/TTableFooterRow.php
index f3c35dc3..dd0de143 100644
--- a/framework/Web/UI/WebControls/TTableFooterRow.php
+++ b/framework/Web/UI/WebControls/TTableFooterRow.php
@@ -45,4 +45,3 @@ class TTableFooterRow extends TTableRow
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableHeaderCell.php b/framework/Web/UI/WebControls/TTableHeaderCell.php
index a1a8919a..1e18cee3 100644
--- a/framework/Web/UI/WebControls/TTableHeaderCell.php
+++ b/framework/Web/UI/WebControls/TTableHeaderCell.php
@@ -122,4 +122,3 @@ class TTableHeaderScope extends TEnumerable
const Column='Column';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableHeaderRow.php b/framework/Web/UI/WebControls/TTableHeaderRow.php
index fa7e4515..7b8488bd 100644
--- a/framework/Web/UI/WebControls/TTableHeaderRow.php
+++ b/framework/Web/UI/WebControls/TTableHeaderRow.php
@@ -45,4 +45,3 @@ class TTableHeaderRow extends TTableRow
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTableRow.php b/framework/Web/UI/WebControls/TTableRow.php
index be93529e..c70f28dd 100644
--- a/framework/Web/UI/WebControls/TTableRow.php
+++ b/framework/Web/UI/WebControls/TTableRow.php
@@ -206,4 +206,3 @@ class TTableRowSection extends TEnumerable
const Footer='Footer';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTemplateColumn.php b/framework/Web/UI/WebControls/TTemplateColumn.php
index de4bc2ef..21190f23 100644
--- a/framework/Web/UI/WebControls/TTemplateColumn.php
+++ b/framework/Web/UI/WebControls/TTemplateColumn.php
@@ -254,4 +254,3 @@ class TTemplateColumn extends TDataGridColumn
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TTextBox.php b/framework/Web/UI/WebControls/TTextBox.php
index 3c3e6d0e..4e6a66e9 100644
--- a/framework/Web/UI/WebControls/TTextBox.php
+++ b/framework/Web/UI/WebControls/TTextBox.php
@@ -67,6 +67,7 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
*/
private $_safeText;
private $_dataChanged=false;
+ private $_isValid=true;
/**
* @return string tag name of the textbox
@@ -243,6 +244,23 @@ class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
return $this->getText();
}
+ /**
+ * Returns true if this control validated successfully.
+ * Defaults to true.
+ * @return bool wether this control validated successfully.
+ */
+ public function getIsValid()
+ {
+ return $this->_isValid;
+ }
+ /**
+ * @param bool wether this control is valid.
+ */
+ public function setIsValid($value)
+ {
+ $this->_isValid=TPropertyValue::ensureBoolean($value);
+ }
+
/**
* Raises <b>OnTextChanged</b> event.
* This method is invoked when the value of the {@link getText Text}
@@ -618,4 +636,3 @@ class TTextBoxAutoCompleteType extends TEnumerable
const Search='Search';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTextHighlighter.php b/framework/Web/UI/WebControls/TTextHighlighter.php
index 0356c4e7..890deb05 100644
--- a/framework/Web/UI/WebControls/TTextHighlighter.php
+++ b/framework/Web/UI/WebControls/TTextHighlighter.php
@@ -198,4 +198,3 @@ class TTextHighlighterLineNumberStyle extends TEnumerable
const Li='Li';
const Table='Table';
}
-?>
diff --git a/framework/Web/UI/WebControls/TTextProcessor.php b/framework/Web/UI/WebControls/TTextProcessor.php
index ccb78196..26dab754 100644
--- a/framework/Web/UI/WebControls/TTextProcessor.php
+++ b/framework/Web/UI/WebControls/TTextProcessor.php
@@ -84,4 +84,3 @@ abstract class TTextProcessor extends TWebControl
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TValidationSummary.php b/framework/Web/UI/WebControls/TValidationSummary.php
index 4e0e0e50..95679e15 100644
--- a/framework/Web/UI/WebControls/TValidationSummary.php
+++ b/framework/Web/UI/WebControls/TValidationSummary.php
@@ -504,4 +504,3 @@ class TValidationSummaryDisplayStyle extends TEnumerable
const Fixed='Fixed';
}
-?>
diff --git a/framework/Web/UI/WebControls/TWebControl.php b/framework/Web/UI/WebControls/TWebControl.php
index 829a9d03..2e1899ad 100644
--- a/framework/Web/UI/WebControls/TWebControl.php
+++ b/framework/Web/UI/WebControls/TWebControl.php
@@ -432,4 +432,3 @@ class TWebControl extends TControl implements IStyleable
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TWebControlAdapter.php b/framework/Web/UI/WebControls/TWebControlAdapter.php
index 35e157af..a99afe7f 100644
--- a/framework/Web/UI/WebControls/TWebControlAdapter.php
+++ b/framework/Web/UI/WebControls/TWebControlAdapter.php
@@ -69,4 +69,3 @@ class TWebControlAdapter extends TControlAdapter
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php
index 1f9e886b..774096f7 100644
--- a/framework/Web/UI/WebControls/TWizard.php
+++ b/framework/Web/UI/WebControls/TWizard.php
@@ -2153,4 +2153,3 @@ class TWizardStepType extends TEnumerable
const Finish='Finish';
}
-?>
diff --git a/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php b/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php
index 6eebce74..54d585c4 100644
--- a/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php
+++ b/framework/Web/UI/WebControls/TWizardNavigationButtonStyle.php
@@ -153,4 +153,3 @@ class TWizardNavigationButtonStyle extends TStyle
}
}
-?>
diff --git a/framework/Web/UI/WebControls/TXmlTransform.php b/framework/Web/UI/WebControls/TXmlTransform.php
index ab49ae61..991aed39 100644
--- a/framework/Web/UI/WebControls/TXmlTransform.php
+++ b/framework/Web/UI/WebControls/TXmlTransform.php
@@ -191,4 +191,3 @@ class TXmlTransform extends TControl {
}
}
-?>
diff --git a/framework/Web/UI/WebControls/assets/captcha.php b/framework/Web/UI/WebControls/assets/captcha.php
index bff2f61a..8c9ff0a3 100644
--- a/framework/Web/UI/WebControls/assets/captcha.php
+++ b/framework/Web/UI/WebControls/assets/captcha.php
@@ -221,4 +221,3 @@ function morphImage($image,$width,$height)
}
}
-?>