qserver
Custom Plugin works with QServer not with QAjax
Hi folks,
i'm working on a qcubed plugin (QProgressBar) which will make use of jquery progress bar.
the plugin works good with QServer but i can't make it goes with QAjax mode here's the class
<?php
class QProgressBar extends QControl {
protected $intValue;
public function __construct($objParentObject, $strControlId = null) {
if ($objParentObject) {
parent::__construct($objParentObject, $strControlId);
}
$this->setFiles();
}
private function setFiles() {
$this->AddJavascriptFile(__JQUERY_BASE__);
$this->AddPluginJavascriptFile("QProgressBar", "jquery.ui.core.js");
$this->AddPluginJavascriptFile("QProgressBar", "jquery.ui.widget.js");
$this->AddPluginJavascriptFile("QProgressBar", "ui.progress.js");
$this->AddPluginCssFile("QProgressBar", "progressbar.css");
/*if (QApplication::IsBrowser(QBrowserType::InternetExplorer)) {
$this->AddPluginCssFile("QProgress", "Progress_ie.css");
}*/
}
protected function GetControlHtml() {
$strHtml = sprintf('<div id="progress_%s" class="%s"></div>',
$this->ControlId,
$this->CssClass);
$this->intValue = ($this->intValue) ? $this->intValue : 0;
$strJsProgress = sprintf('
$(document).ready(function(){
$("#progress_%s").progressbar({ value:%s});
$("#progress_%s").progressbar( "option", "value", %s );
});',
$this->ControlId,
$this->intValue,
$this->ControlId,
$this->intValue);
QApplication::ExecuteJavaScript($strJsProgress);
return $strHtml ;
}
public function GetEndScript() {
return null;
}
public function ParsePostData() {
return true;
}
public function Validate(){
return true;
}
public function __get($strName) {
switch ($strName) {
// APPEARANCE
case "Value":
return $this->intValue;
default:
try {
return parent::__get($strName);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
}
}
public function __set($strName, $mixValue) {
switch ($strName) {
// APPEARANCE
case "Value":
try {
$this->intValue = QType::Cast($mixValue, QType::Float);
break;
} catch (QInvalidCastException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
default:
try {
parent::__set($strName, $mixValue);
} catch (QCallerException $objExc) {
$objExc->IncrementOffset();
throw $objExc;
}
break;
}
}
}
?>Any help will be much appreciated as soon as this is fixed i'll clean the code and contribute the plugin.
Thanks
Kent
