Overview

Packages

  • Actions
  • Codegen
  • Controls
    • Base
  • DatabaseAdapters
  • Events
  • None
  • Sessions
  • Tests

Classes

  • AbstractControl_CodeGenerator
  • AjaxTimingForm
  • BasicForm
  • BasicOrmTests
  • BBCodeParser
  • CacheTests
  • CalculatorForm
  • CalculatorWidget
  • ComplexColumn
  • DataRepeaterExample
  • Event
  • ExampleCheckColumn1
  • ExampleCheckColumn2
  • ExampleForm
  • Examples
  • ExampleService
  • ExamplesForm
  • ExampleSingleForm
  • ExpandAsArrayTests
  • HtmlJqDoc
  • InjectForm
  • JavaScriptHelper
  • JqAttributes
  • JqControlGen
  • JqDoc
  • JqIcon
  • Method
  • ModelConnectorTests
  • MyControl
  • MyQSlider_ChangeEvent
  • NavPanel
  • NestedTabForm
  • Option
  • Order
  • PaginatorForm
  • ParamsForm
  • PersistentExampleForm
  • PersonEditPanel
  • PluginEditForm
  • PluginManagerForm
  • Project
  • ProjectEditPanel
  • ProjectListForm
  • ProjectPickerListBox
  • ProjectViewPanel
  • QAbstractCacheProvider
  • QAbstractHtmlTableColumn
  • QAbstractHtmlTableDataColumn
  • QAccordion
  • QAccordion_ActivateEvent
  • QAccordion_BeforeActivateEvent
  • QAccordion_CreateEvent
  • QAccordionBase
  • QAccordionGen
  • QAction
  • QActionControl
  • QAjaxAction
  • QAjaxControlAction
  • QAjaxResponse
  • QAlertAction
  • QApplication
  • QApplicationBase
  • QArchive
  • QAutocomplete
  • QAutocomplete_ChangeEvent
  • QAutocomplete_CloseEvent
  • QAutocomplete_CodeGenerator
  • QAutocomplete_CreateEvent
  • QAutocomplete_FocusEvent
  • QAutocomplete_OpenEvent
  • QAutocomplete_ResponseEvent
  • QAutocomplete_SearchEvent
  • QAutocomplete_SelectEvent
  • QAutocomplete_SourceEvent
  • QAutocompleteBase
  • QAutocompleteBase_CodeGenerator
  • QAutocompleteGen
  • QAutocompleteListItem
  • QBackspaceKeyEvent
  • QBaseClass
  • QBlockControl
  • QBlurControlAction
  • QBlurEvent
  • QBorderCollapse
  • QBorderStyle
  • QBrowserType
  • QButton
  • QButtonBase
  • QCache
  • QCacheDeleteAction
  • QCacheDeleteAllAction
  • QCacheProviderAPC
  • QCacheProviderLocalMemory
  • QCacheProviderLocalMemoryTest
  • QCacheProviderMemcache
  • QCacheProviderNoCache
  • QCacheProviderProxy
  • QCacheSetAction
  • QCalendar
  • QCalendarType
  • QCallType
  • QCausesValidation
  • QCellClickEvent
  • QChangeEvent
  • QCheckBox
  • QCheckBox_CodeGenerator
  • QCheckBoxBase_CodeGenerator
  • QCheckBoxLegacyColumn
  • QCheckBoxList
  • QCheckBoxList_CodeGenerator
  • QCheckBoxListBase_CodeGenerator
  • QClickEvent
  • QCodeGen
  • QCodeGenBase
  • QConfirmAction
  • QContextMenuEvent
  • QControl
  • QControl_CodeGenerator
  • QControlBase
  • QControlBase_CodeGenerator
  • QControlBaseTests
  • QControlCategoryType
  • QControlGrouping
  • QControlLabel
  • QControlProxy
  • QConvertNotation
  • QConvertNotationBase
  • QCrossScripting
  • QCryptography
  • QCss
  • QCssAction
  • QCssClassAction
  • QCssTests
  • QCsvTextBox
  • QCursor
  • QDatabaseBase
  • QDatabaseCodeGen
  • QDatabaseFieldBase
  • QDatabaseFieldType
  • QDatabaseForeignKey
  • QDatabaseIndex
  • QDatabaseResultBase
  • QDatabaseRowBase
  • QDatabaseTests
  • QDataGrid
  • QDataGrid_CheckBoxColumn
  • QDataGrid_CodeGenerator
  • QDataGrid_SortEvent
  • QDataGridBase
  • QDataGridBase_CodeGenerator
  • QDataGridLegacy
  • QDataGridLegacyBase
  • QDataGridLegacyColumn
  • QDataGridLegacyRow
  • QDataGridLegacyRowStyle
  • QDataRepeater
  • QDatepicker
  • QDatepicker_BeforeShowDayEvent
  • QDatepicker_BeforeShowEvent
  • QDatepicker_CalculateWeekEvent
  • QDatepicker_ChangeMonthYearEvent
  • QDatepicker_CloseEvent
  • QDatepicker_SelectEvent
  • QDatepicker_SelectEvent2
  • QDatepickerBase
  • QDatepickerBox
  • QDatepickerBox_BeforeShowDayEvent
  • QDatepickerBox_BeforeShowEvent
  • QDatepickerBox_CalculateWeekEvent
  • QDatepickerBox_ChangeMonthYearEvent
  • QDatepickerBox_CloseEvent
  • QDatepickerBox_CodeGenerator
  • QDatepickerBox_SelectEvent
  • QDatepickerBoxBase
  • QDatepickerBoxBase_CodeGenerator
  • QDatepickerBoxGen
  • QDatepickerGen
  • QDateTime
  • QDateTimePicker
  • QDateTimePicker_CodeGenerator
  • QDateTimePickerBase_CodeGenerator
  • QDateTimePickerFormat
  • QDateTimePickerType
  • QDateTimeSpan
  • QDateTimeTests
  • QDateTimeTextBox
  • QDbBackedFormStateHandler
  • QDbBackedSessionHandler
  • QDialog
  • QDialog_BeforeCloseEvent
  • QDialog_ButtonEvent
  • QDialog_CloseEvent
  • QDialog_CreateEvent
  • QDialog_DragEvent
  • QDialog_DragStartEvent
  • QDialog_DragStopEvent
  • QDialog_FocusEvent
  • QDialog_OpenEvent
  • QDialog_ResizeEvent
  • QDialog_ResizeStartEvent
  • QDialog_ResizeStopEvent
  • QDialogBase
  • QDialogBox
  • QDialogGen
  • QDisplayStyle
  • QDoubleClickEvent
  • QDownArrowKeyEvent
  • QDragDropEvent
  • QDraggable
  • QDraggable_CreateEvent
  • QDraggable_DragEvent
  • QDraggable_StartEvent
  • QDraggable_StopEvent
  • QDraggableBase
  • QDraggableGen
  • QDroppable
  • QDroppable_ActivateEvent
  • QDroppable_CreateEvent
  • QDroppable_DeactivateEvent
  • QDroppable_DropEvent
  • QDroppable_OutEvent
  • QDroppable_OverEvent
  • QDroppableBase
  • QDroppableGen
  • QDropZoneGrouping
  • QEmailAttachment
  • QEmailMessage
  • QEmailServer
  • QEmailStringAttachment
  • QEmailTextBox
  • QEnterKeyEvent
  • QErrorAttribute
  • QEscapeKeyEvent
  • QEvent
  • QFieldset
  • QFile
  • QFileAsset
  • QFileAssetBase
  • QFileAssetDialog
  • QFileAssetType
  • QFileControl
  • QFileFormStateHandler
  • QFilterType
  • QFloatTextBox
  • QFloatTextBox_CodeGenerator
  • QFloatTextBoxBase_CodeGenerator
  • QFocusControlAction
  • QFocusEvent
  • QFocusInEvent
  • QFocusOutEvent
  • QFolder
  • QFontFamily
  • QForm
  • QFormBase
  • QFormGen
  • QFormStateHandler
  • QGridLines
  • QHideCalendarAction
  • QHideDialog
  • QHideDialogBox
  • QHListControl
  • QHListItem
  • QHorizontalAlign
  • QHtml
  • QHtmlAttributeManager
  • QHtmlAttributeManagerBase
  • QHtmlReporter
  • QHtmlTable
  • QHtmlTable_CodeGenerator
  • QHtmlTableBase
  • QHtmlTableCallableColumn
  • QHtmlTableCheckBoxColumn
  • QHtmlTableCheckBoxColumn_ClickEvent
  • QHtmlTableIndexedColumn
  • QHtmlTableLinkColumn
  • QHtmlTableNodeColumn
  • QHtmlTablePropertyColumn
  • QI18n
  • QI18nTests
  • QImageBase
  • QImageBrowser
  • QImageBrowserBase
  • QImageBrowserNav
  • QImageBrowserThumbnails
  • QImageButton
  • QImageControl
  • QImageControlBase
  • QImageFileAsset
  • QImageLabel
  • QImageLabelBase
  • QImageRollover
  • QImageType
  • QIndex
  • QInformixPdoDatabase
  • QInformixPdoDatabaseField
  • QInformixPdoDatabaseResult
  • QInformixPdoDatabaseRow
  • QInputEvent
  • QInstallationValidationResult
  • QInstallationValidator
  • QIntegerTextBox
  • QIntegerTextBox_CodeGenerator
  • QIntegerTextBoxBase_CodeGenerator
  • QJavaScriptAction
  • QJQAction
  • QJQBounceAction
  • QJqButton
  • QJqButton_CreateEvent
  • QJqButtonBase
  • QJqButtonGen
  • QJqCheckBox
  • QJqCheckBox_CreateEvent
  • QJqCheckBoxBase
  • QJqCheckBoxGen
  • QJQHideAction
  • QJQHideEffectAction
  • QJQHighlightAction
  • QJQPulsateAction
  • QJqRadioButton
  • QJqRadioButton_CreateEvent
  • QJqRadioButtonBase
  • QJqRadioButtonGen
  • QJQShakeAction
  • QJQShowAction
  • QJQShowEffectAction
  • QJQSizeAction
  • QJQToggleAction
  • QJQToggleEffectAction
  • QJQTransferAction
  • QJqUiEvent
  • QJqUiPropertyEvent
  • QJsClosure
  • QJsFunction
  • QJsNoQuoteKey
  • QJsParameterList
  • QJsPriority
  • QJsTimer
  • QJsTimerBase
  • QJsVarName
  • QKeyDownEvent
  • QKeyPressEvent
  • QKeyUpEvent
  • QLabel
  • QLabel_CodeGenerator
  • QLabelBase_CodeGenerator
  • QLexer
  • QLinkButton
  • QListBox
  • QListBox_CodeGenerator
  • QListBoxBase
  • QListBoxBase_CodeGenerator
  • QListControl
  • QListControl_CodeGenerator
  • QListControlBase_CodeGenerator
  • QListItem
  • QListItemBase
  • QListItemStyle
  • QManyToManyReference
  • QMenu
  • QMenu_BlurEvent
  • QMenu_CreateEvent
  • QMenu_FocusEvent
  • QMenu_SelectEvent
  • QMenuBase
  • QMenuGen
  • QMimeType
  • QModelConnectorArgumentType
  • QModelConnectorCreateType
  • QModelConnectorEditDlg
  • QModelConnectorOptions
  • QModelConnectorParam
  • QMouseDownEvent
  • QMouseEnterEvent
  • QMouseLeaveEvent
  • QMouseMoveEvent
  • QMouseOutEvent
  • QMouseOverEvent
  • QMouseUpEvent
  • QMultiLevelCacheProvider
  • QMySqlDatabase
  • QMySqlDatabaseField
  • QMySqlDatabaseResult
  • QMySqli5ClusterDatabase
  • QMySqli5Database
  • QMySqli5DatabaseField
  • QMySqli5DatabaseResult
  • QMySqliDatabase
  • QMySqliDatabaseField
  • QMySqliDatabaseResult
  • QMySqliDatabaseRow
  • QNoScriptAjaxAction
  • QNumericTextBox
  • QOnEvent
  • QOracleDatabase
  • QOracleDatabaseField
  • QOracleDatabaseResult
  • QOracleDatabaseRow
  • QOrderedListType
  • QOverflow
  • QPaginatedControl
  • QPaginator
  • QPaginatorBase
  • QPanel
  • QPartialQueryBuilder
  • QPdoDatabase
  • QPdoDatabaseResult
  • QPgConditionILike
  • QPgConditionJsonContains
  • QPgQ
  • QPosition
  • QPostgreSqlDatabase
  • QPostgreSqlDatabaseField
  • QPostgreSqlDatabaseResult
  • QPostgreSqlDatabaseRow
  • QPostgreSqlPdoDatabase
  • QPostgreSqlPdoDatabaseField
  • QPostgreSqlPdoDatabaseResult
  • QPostgreSqlPdoDatabaseRow
  • QProgressbar
  • QProgressbar_ChangeEvent
  • QProgressbar_CompleteEvent
  • QProgressbar_CreateEvent
  • QProgressbarBase
  • QProgressbarGen
  • QQ
  • QQAggregationClause
  • QQAliasTests
  • QQAssociationNode
  • QQAverage
  • QQClause
  • QQColumnNode
  • QQCondition
  • QQConditionAll
  • QQConditionAnd
  • QQConditionBetween
  • QQConditionComparison
  • QQConditionEqual
  • QQConditionExists
  • QQConditionGreaterOrEqual
  • QQConditionGreaterThan
  • QQConditionIn
  • QQConditionIsNotNull
  • QQConditionIsNull
  • QQConditionLessOrEqual
  • QQConditionLessThan
  • QQConditionLike
  • QQConditionLogical
  • QQConditionNone
  • QQConditionNot
  • QQConditionNotBetween
  • QQConditionNotEqual
  • QQConditionNotExists
  • QQConditionNotIn
  • QQConditionNotLike
  • QQConditionOr
  • QQCount
  • QQDistinct
  • QQExpand
  • QQExpandAsArray
  • QQExpandVirtualNode
  • QQFuncTests
  • QQFunctionNode
  • QQGroupBy
  • QQHavingClause
  • QQLimitInfo
  • QQMathNode
  • QQMathOpTests
  • QQMaximum
  • QQMinimum
  • QQNamedValue
  • QQNode
  • QQNoParentNode
  • QQOrderBy
  • QQReverseReferenceNode
  • QQSelect
  • QQSubQueryCountNode
  • QQSubQueryNode
  • QQSubQuerySqlNode
  • QQSum
  • QQTableNode
  • QQuery
  • QQueryBuilder
  • QQueryExpansion
  • QQVirtualNode
  • QRadioButton
  • QRadioButtonList
  • QRadioButtonList_CodeGenerator
  • QRadioButtonListBase_CodeGenerator
  • QRedirectAction
  • QReference
  • QRegex
  • QRegisterClickPositionAction
  • QRepeatDirection
  • QRequestMode
  • QResetTimerAction
  • QResizable
  • QResizable_CreateEvent
  • QResizable_ResizeEvent
  • QResizable_StartEvent
  • QResizable_StopEvent
  • QResizableBase
  • QResizableGen
  • QResizeHandleDirection
  • QRestServiceCodeGen
  • QReverseReference
  • QRssCategory
  • QRssFeed
  • QRssImage
  • QRssItem
  • QSampleControl
  • QSampleTranslation
  • QSelectable
  • QSelectable_CreateEvent
  • QSelectable_SelectedEvent
  • QSelectable_SelectingEvent
  • QSelectable_StartEvent
  • QSelectable_StopEvent
  • QSelectable_UnselectedEvent
  • QSelectable_UnselectingEvent
  • QSelectableBase
  • QSelectableGen
  • QSelectControlAction
  • QSelectEvent
  • QSelectionMode
  • QSelectMenu
  • QSelectMenu_ChangeEvent
  • QSelectMenu_CloseEvent
  • QSelectMenu_CreateEvent
  • QSelectMenu_FocusEvent
  • QSelectMenu_OpenEvent
  • QSelectMenu_SelectEvent
  • QSelectMenuBase
  • QSelectMenuGen
  • QServerAction
  • QServerControlAction
  • QSessionFormStateHandler
  • QSetValueAction
  • QShowCalendarAction
  • QShowDialog
  • QShowDialogBox
  • QSlider
  • QSlider_ChangeEvent
  • QSlider_CodeGenerator
  • QSlider_CreateEvent
  • QSlider_SlideEvent
  • QSlider_StartEvent
  • QSlider_StopEvent
  • QSliderBase
  • QSliderBase_CodeGenerator
  • QSliderGen
  • QSoapMethod
  • QSoapParameter
  • QSoapService
  • QSortable
  • QSortable_ActivateEvent
  • QSortable_BeforeStopEvent
  • QSortable_ChangeEvent
  • QSortable_CreateEvent
  • QSortable_DeactivateEvent
  • QSortable_OutEvent
  • QSortable_OverEvent
  • QSortable_ReceiveEvent
  • QSortable_RemoveEvent
  • QSortable_SortEvent
  • QSortable_StartEvent
  • QSortable_StopEvent
  • QSortable_UpdateEvent
  • QSortableBase
  • QSortableGen
  • QSpinner
  • QSpinner_ChangeEvent
  • QSpinner_CreateEvent
  • QSpinner_SpinEvent
  • QSpinner_StartEvent
  • QSpinner_StopEvent
  • QSpinnerBase
  • QSpinnerGen
  • QSqlColumn
  • QSqLite3PdoDatabase
  • QSqLite3PdoDatabaseField
  • QSqLite3PdoDatabaseResult
  • QSqLite3PdoDatabaseRow
  • QSqlServer2005Database
  • QSqlServer2005DatabaseField
  • QSqlServer2005DatabaseResult
  • QSqlServer2005DatabaseRow
  • QSqlServerDatabase
  • QSqlServerDatabaseField
  • QSqlServerDatabaseResult
  • QSqlServerDatabaseRow
  • QSqlTable
  • QStack
  • QStopPropagationAction
  • QString
  • QStringTest
  • QTabKeyEvent
  • QTabs
  • QTabs_ActivateEvent
  • QTabs_BeforeActivateEvent
  • QTabs_BeforeLoadEvent
  • QTabs_CreateEvent
  • QTabs_LoadEvent
  • QTabsBase
  • QTabsGen
  • QTag
  • QTagStyler
  • QTerminateAction
  • QTestControl
  • QTestForm
  • QTextAlign
  • QTextBox
  • QTextBox_CodeGenerator
  • QTextBoxBase
  • QTextBoxBase_CodeGenerator
  • QTextMode
  • QTimer
  • QTimerExpiredEvent
  • QTimerTests
  • QToggleCssClassAction
  • QToggleDisplayAction
  • QToggleEnableAction
  • QTranslationPoParser
  • QTreeNav
  • QTreeNavItem
  • QType
  • QTypeTable
  • QTypeTests
  • QUnitTestCaseBase
  • QUnorderedListStyle
  • QUpArrowKeyEvent
  • QUrlTextBox
  • QVerticalAlign
  • QVirtualAttributeColumn
  • QWaitIcon
  • QWatcher
  • QWatcherBase
  • QWatcherCache
  • QWatcherDB
  • QWatcherNone
  • QWriteBox
  • RecordsSummary
  • RefreshForm
  • SampleComposite
  • SampleForm
  • SelectableLabel
  • SelectForm
  • SpeedForm
  • TestImageBrowser
  • UrlForm

Interfaces

  • ICacheAction
  • QDataList_CodeGenerator_Interface
  • QTranslationBase

Traits

  • QDataBinder
  • QListItemManager
  • QModelTrait

Exceptions

  • QCallerException
  • QCrossScriptingException
  • QCryptographyException
  • QDatabaseExceptionBase
  • QDataBindException
  • QDateTimeNullException
  • QEmailException
  • QIndexOutOfRangeException
  • QInformixPdoDatabaseException
  • QInvalidCastException
  • QInvalidFormStateException
  • QMySqliDatabaseException
  • QOptimisticLockingException
  • QOracleDatabaseException
  • QPdoDatabaseException
  • QPoParserException
  • QPostgreSqlDatabaseException
  • QPostgreSqlPdoDatabaseException
  • QRemoteAdminDeniedException
  • QSqLite3PdoDatabaseException
  • QSqlServer2005DatabaseException
  • QSqlServerDatabaseException
  • QUndefinedMethodException
  • QUndefinedPrimaryKeyException
  • QUndefinedPropertyException

Functions

  • __database_check_error
  • __QForm_EvaluateTemplate_ObHandler
  • _b
  • _indent
  • _nl
  • _p
  • _r
  • _t
  • _tp
  • _tr
  • array_trim
  • beginsWith
  • CamelCaseFromDash
  • CastToInt
  • DataGridEvalHandleError
  • DisplayMonospacedText
  • endsWith
  • GO_BACK
  • jq_anytime_gen
  • jq_control_gen
  • jq_inc_gen
  • jq_indent
  • PrintExplainStatement
  • PrintInstructions
  • QcubedHandleCodeGenParseError
  • QcubedHandleError
  • QcubedHandleException
  • QCubedShutdown
  • QDateTimeErrorHandler
  • trimOffEnd
  • trimOffFront
  • Overview
  • Package
  • Class
  1: <?php
  2:     /**
  3:      * This file contains the QFileAssetBase class.
  4:      *
  5:      * @package Controls
  6:      */
  7: 
  8:     /**
  9:      * @package Controls
 10:      *
 11:      * @property string $File
 12:      * @property string $FileName
 13:      * @property integer $Size
 14:      * @property-read string $RandomFileName
 15:      * @property string $UnacceptableMessage
 16:      * @property integer $FileAssetType
 17:      * @property string $TemporaryUploadPath
 18:      * @property boolean $ClickToView
 19:      * @property string $DialogBoxCssClass
 20:      * @property string $DialogBoxWidth
 21:      * @property string $DialogBoxHeight
 22:      * @property string $UploadText
 23:      * @property string $CancelText
 24:      * @property string $DialogBoxHtml
 25:      */
 26:     class QFileAssetBase extends QPanel {
 27:         public $imgFileIcon;
 28:         public $btnDelete;
 29:         public $btnUpload;
 30:         public $dlgFileAsset;
 31: 
 32:         protected $strAcceptibleMimeArray;
 33:         protected $strUnacceptableMessage;
 34:         protected $intFileAssetType;
 35:         protected $strFile;
 36:         protected $strFileName;
 37:         protected $intSize;
 38:         protected $strRandomFileName;
 39:         protected $blnClickToView;
 40: 
 41:         protected $strIconFilePathArray = array();
 42: 
 43:         protected $strTemporaryUploadPath;
 44: 
 45:         public function __construct($objParentObject, $strControlId = null) {
 46:             parent::__construct($objParentObject, $strControlId);
 47: 
 48:             // Setup IconFilePathArray
 49:             $this->SetupIconFilePathArray();
 50: 
 51:             // Setup Required Properties/Parameters
 52:             $this->dlgFileAsset = new QFileAssetDialog($this, 'dlgFileAsset_Upload');
 53: 
 54:             $this->imgFileIcon = new QImageControl($this);
 55:             $this->imgFileIcon->Width = 80;
 56:             $this->imgFileIcon->Height = 80;
 57:             $this->imgFileIcon->ImagePath = $this->strIconFilePathArray['blank'];
 58:             
 59:             // And finally, let's specify a CacheFolder so that the images are cached
 60:             // Notice that this CacheFolder path is a complete web-accessible relative-to-docroot path
 61:             $this->imgFileIcon->CacheFolder = __IMAGE_CACHE_ASSETS__;
 62: 
 63:             // Setup Controls
 64:             $this->btnUpload = new QLinkButton($this);
 65:             $this->btnUpload->HtmlEntities = false;
 66:             $this->SetupUpdateActions();
 67: 
 68:             // Define the "Delete" Button
 69:             $this->btnDelete = new QLinkButton($this);
 70:             $this->btnDelete->HtmlEntities = false;
 71:             $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
 72:             $this->btnDelete->AddAction(new QClickEvent(), new QTerminateAction());
 73:         }
 74: 
 75:         protected function SetupUpdateActions() {
 76:             $this->btnUpload->RemoveAllActions('click');
 77:             $this->btnUpload->AddAction(new QClickEvent(), new QShowDialog($this->dlgFileAsset));
 78:             $this->btnUpload->AddAction(new QClickEvent(), new QTerminateAction());
 79:         }
 80:         
 81:         protected function SetupIconFilePathArray() {
 82:             $this->strIconFilePathArray['blank'] = __DOCROOT__ . __IMAGE_ASSETS__ . '/file_asset_blank.png';
 83:             $this->strIconFilePathArray['default'] = __DOCROOT__ . __IMAGE_ASSETS__ . '/file_asset_default.png';
 84:             $this->strIconFilePathArray['pdf'] = __DOCROOT__ . __IMAGE_ASSETS__ . '/file_asset_pdf.png';
 85:         }
 86: 
 87:         public function Validate() {
 88:             $blnToReturn = parent::Validate();
 89: 
 90:             if ($blnToReturn) {
 91:                 if ($this->blnRequired && !$this->strFile) {
 92:                     $blnToReturn = false;
 93:                     if ($this->strName)
 94:                         $this->ValidationError = $this->strName . QApplication::Translate(' is required');
 95:                     else
 96:                         $this->ValidationError = $this->strName . QApplication::Translate('Required');
 97:                 }
 98:             }
 99: 
100:             return $blnToReturn;
101:         }
102: 
103:         public function dlgFileAsset_Upload() {
104:             // File Not Uploaded
105:             if (!file_exists($this->dlgFileAsset->flcFileAsset->File) || !$this->dlgFileAsset->flcFileAsset->Size) {
106:                 $this->dlgFileAsset->ShowError($this->strUnacceptableMessage);
107: 
108:             // File Has Incorrect MIME Type (only if an acceptiblemimearray is setup)
109:             } else if (is_array($this->strAcceptibleMimeArray) && (!array_key_exists($this->dlgFileAsset->flcFileAsset->Type, $this->strAcceptibleMimeArray))) {
110:                 $this->dlgFileAsset->ShowError($this->strUnacceptableMessage);
111: 
112:             // File Successfully Uploaded
113:             } else {
114:                 // Setup Filename, Base Filename and Extension
115:                 $strFilename = $this->dlgFileAsset->flcFileAsset->FileName;
116:                 $intPosition = strrpos($strFilename, '.');
117: 
118:                 if (is_array($this->strAcceptibleMimeArray) && array_key_exists($this->dlgFileAsset->flcFileAsset->Type, $this->strAcceptibleMimeArray))
119:                     $strExtension = $this->strAcceptibleMimeArray[$this->dlgFileAsset->flcFileAsset->Type];
120:                 else {
121:                     if ($intPosition)
122:                         $strExtension = substr($strFilename, $intPosition + 1);
123:                     else
124:                         $strExtension = null;
125:                 }
126: 
127:                 $strBaseFilename = substr($strFilename, 0, $intPosition);
128:                 $strExtension = strtolower($strExtension);
129: 
130:                 // Save the File in a slightly more permanent temporary location
131:                 $this->strRandomFileName = basename($this->dlgFileAsset->flcFileAsset->File) . rand(1000, 9999) . '.' . $strExtension;
132:                 $strTempFilePath = $this->strTemporaryUploadPath . '/' . $this->strRandomFileName;
133:                 copy($this->dlgFileAsset->flcFileAsset->File, $strTempFilePath);
134:                 $this->File = $strTempFilePath;
135: 
136:                 // Cleanup and Save Filename
137:                 $this->strFileName = preg_replace('/[^A-Z^a-z^0-9_\-]/', '', $strBaseFilename) . '.' . $strExtension;
138:                 
139:                 $this->intSize = $this->dlgFileAsset->flcFileAsset->Size;
140: 
141:                 // Hide the Dialog Box
142:                 $this->dlgFileAsset->Close();
143: 
144:                 // Refresh Thyself
145:                 $this->Refresh();
146:             }
147:         }
148: 
149:         public function GetControlHtml() {
150: /*          if ($this->objFileAsset) {
151:                 $this->strCssClass = 'FileAssetPanelItem';
152:                 $this->SetCustomStyle('background', 'url(' . $this->objFileAsset->ThumbnailUrl() . ') no-repeat');
153:             } else {
154:                 $this->strCssClass = 'FileAssetPanelItemNone';
155:                 $this->SetCustomStyle('background', null);
156:             }*/
157:             return parent::GetControlHtml();
158:         }
159: 
160:         public function btnDelete_Click() {
161:             // Create a new shell FileAsset for this panel
162:             $this->File = null;
163:             $this->Refresh();
164:         }
165: 
166:         public function __get($strName) {
167:             switch ($strName) {
168:                 case 'File': return $this->strFile;
169:                 case 'FileName': return $this->strFileName;
170:                 case 'Size': return $this->intSize;
171:                 case 'RandomFileName': return $this->strRandomFileName;
172:                 case 'UnacceptableMessage': return $this->strUnacceptableMessage;
173:                 case 'FileAssetType': return $this->intFileAssetType;
174:                 case 'TemporaryUploadPath': return $this->strTemporaryUploadPath;
175:                 case 'ClickToView': return $this->blnClickToView;
176: 
177:                 case 'DialogBoxCssClass': return $this->dlgFileAsset->CssClass;
178:                 case 'DialogBoxWidth': return $this->dlgFileAsset->Width;
179:                 case 'DialogBoxHeight': return $this->dlgFileAsset->Height;
180:                 case 'UploadText': return $this->dlgFileAsset->btnUpload->Text;
181:                 case 'CancelText': return $this->dlgFileAsset->btnCancel->Text;
182:                 case 'DialogBoxHtml': return $this->dlgFileAsset->lblMessage->Text;
183:                 
184: 
185:                 default:
186:                     try {
187:                         return parent::__get($strName);
188:                     } catch (QCallerException $objExc) {
189:                         $objExc->IncrementOffset();
190:                         throw $objExc;
191:                     }
192:             }
193:         }
194: 
195:         /**
196:          * If the Selected File is WebRoot Accessible, return a valid URL
197:          * Feel free to override this method.
198:          *
199:          * @return string Web-based URL to the File (for Downloading)
200:          */
201:         public function GetWebUrl() {
202:             // First of all, if ClickToView is NOT set, then we obvioulsy will not pass out the URL
203:             if (!$this->blnClickToView) {
204:                 return null;
205:             }
206: 
207:             // Now, we need to see if the file, itself, is actually in the docroot somewhere so that
208:             // it can be viewed, and if so, we need to return the web-based URL (relative to the docroot)
209:             if ($this->strFile) {
210:                 $filePathSubstr = substr($this->strFile, 0, strlen(__DOCROOT__));
211: 
212:                 // On Windows, we must replace all "\" with "/"
213:                 if (substr($this->strFile, 1, 2) == ':\\') {
214:                     $this->strFile = str_replace('\\', '/', $this->strFile);
215:                 }
216: 
217:                 // Convert backslashes to forward slashes (relevant for Windows only;
218:                 // see http://trac.qcu.be/projects/qcubed/ticket/176
219:                 $filePathSubstr = str_replace("\\", "/", $filePathSubstr);
220:                 $docrootNormalized = str_replace("\\", "/", __DOCROOT__);
221:                 if ($filePathSubstr == $docrootNormalized) {
222:                     return __VIRTUAL_DIRECTORY__ . substr(str_replace("\\", "/", $this->strFile), strlen(__DOCROOT__));
223:                 }
224:             }
225: 
226:             return null;
227:         }
228: 
229:         protected function SetFile($strFile) {
230:             if (!strlen($strFile)) {
231:                 // No File Selected -- Remove
232:                 $this->strFile = null;
233:                 $this->imgFileIcon->ImagePath = $this->strIconFilePathArray['blank'];
234:             } else if (!is_file($strFile)) {
235:                 // Invalid File Selected -- Throw Exception
236:                 throw new QCallerException('File Not Found: ' . $strFile);
237:             } else {
238:                 // Valid File Selected
239:                 $this->strFile = realpath($strFile);
240:                 
241:                 // Figure Out File Type, and Display Icon Accordingly
242:                 $strExtension = substr($this->strFile, strrpos($this->strFile, '.') + 1);
243:                 switch (trim(strtolower($strExtension))) {
244:                     case 'jpg':
245:                     case 'jpeg':
246:                     case 'png':
247:                     case 'gif':
248:                         $this->imgFileIcon->ImagePath = $this->strFile;
249:                         break;
250:                     case 'pdf':
251:                         $this->imgFileIcon->ImagePath = $this->strIconFilePathArray[trim(strtolower($strExtension))];
252:                         break;
253:                     default:
254:                         $this->imgFileIcon->ImagePath = $this->strIconFilePathArray['default'];
255:                         break;
256:                 }
257:             }
258: 
259:             $this->strFileName = basename($this->strFile);
260:             return $this->strFile;
261:         }
262:         
263:         protected function SetFileAssetType($intFileAssetType) {
264:             switch ($intFileAssetType) {
265:                 case QFileAssetType::Image:
266:                     $this->intFileAssetType = $intFileAssetType;
267:                     $this->strAcceptibleMimeArray = array(
268:                         'image/pjpeg' => 'jpg',
269:                         'image/jpeg' => 'jpg',
270:                         'image/jpg' => 'jpg',
271:                         'image/png' => 'png',
272:                         'image/x-png' => 'png',
273:                         'image/gif' => 'gif');
274:                     $this->strUnacceptableMessage = QApplication::Translate('Must be a JPG, PNG or GIF');
275:                     break;
276:                 case QFileAssetType::Pdf:
277:                     $this->intFileAssetType = $intFileAssetType;
278:                     $this->strAcceptibleMimeArray = array(
279:                         'application/pdf' => 'pdf',
280:                         'application/octet-stream' => 'pdf'
281:                         );
282:                     $this->strUnacceptableMessage = QApplication::Translate('Must be a PDF');
283:                     break;
284:                 case QFileAssetType::Document:
285:                     $this->intFileAssetType = $intFileAssetType;
286:                     $this->strAcceptibleMimeArray = array(
287:                         'application/pdf' => 'pdf',
288:                         'application/octet-stream' => 'pdf',
289:                         'image/pjpeg' => 'jpg',
290:                         'image/jpeg' => 'jpg',
291:                         'image/jpg' => 'jpg',
292:                         'image/png' => 'png',
293:                         'image/x-png' => 'png',
294:                         'image/gif' => 'gif');
295:                     $this->strUnacceptableMessage = QApplication::Translate('Must be a valid document (Image, PDF, etc.)');
296:                     break;
297:                 default:
298:                     throw new QCallerException('FileAssetType must be a valid QFileAssetType constant value');
299:                     break;
300:             }
301: 
302:             return $intFileAssetType;
303:         }
304: 
305:         public function __set($strName, $mixValue) {
306:             $this->blnModified = true;
307: 
308:             switch ($strName) {
309:                 case 'File':
310:                     try {
311:                         return $this->SetFile($mixValue);
312:                     } catch (QCallerException $objExc) {                        
313:                         $objExc->IncrementOffset();
314:                         throw $objExc;
315:                     }
316: 
317:                 case 'DialogBoxCssClass':
318:                     try {
319:                         $this->dlgFileAsset->CssClass = $mixValue;
320:                         $this->SetupUpdateActions();
321:                         return $this->dlgFileAsset->CssClass;
322:                     } catch (QCallerException $objExc) {
323:                         $objExc->IncrementOffset();
324:                         throw $objExc;
325:                     }
326: 
327:                 case 'DialogBoxWidth':
328:                     try {
329:                         $this->dlgFileAsset->Width = $mixValue;
330:                         $this->SetupUpdateActions();
331:                         return $this->dlgFileAsset->Width;
332:                     } catch (QCallerException $objExc) {
333:                         $objExc->IncrementOffset();
334:                         throw $objExc;
335:                     }
336: 
337:                 case 'DialogBoxHeight':
338:                     try {
339:                         $this->dlgFileAsset->Height = $mixValue;
340:                         $this->SetupUpdateActions();
341:                         return $this->dlgFileAsset->Height;
342:                     } catch (QCallerException $objExc) {
343:                         $objExc->IncrementOffset();
344:                         throw $objExc;
345:                     }
346: 
347:                 case 'UploadText':
348:                     try {
349:                         return ($this->dlgFileAsset->btnUpload->Text = $mixValue);
350:                     } catch (QCallerException $objExc) {
351:                         $objExc->IncrementOffset();
352:                         throw $objExc;
353:                     }
354: 
355:                 case 'CancelText':
356:                     try {
357:                         return ($this->dlgFileAsset->btnCancel->Text = $mixValue);
358:                     } catch (QCallerException $objExc) {
359:                         $objExc->IncrementOffset();
360:                         throw $objExc;
361:                     }
362: 
363:                 case 'DialogBoxHtml':
364:                     try {
365:                         return ($this->dlgFileAsset->lblMessage->Text = $mixValue);
366:                     } catch (QCallerException $objExc) {
367:                         $objExc->IncrementOffset();
368:                         throw $objExc;
369:                     }
370: 
371:                 case 'FileAssetType':
372:                     try {
373:                         return $this->SetFileAssetType($mixValue);
374:                     } catch (QCallerException $objExc) {                        
375:                         $objExc->IncrementOffset();
376:                         throw $objExc;
377:                     }
378: 
379:                 case 'UnacceptableMessage':
380:                     try {
381:                         return ($this->strUnacceptableMessage = QType::Cast($mixValue, QType::String));
382:                     } catch (QCallerException $objExc) {
383:                         $objExc->IncrementOffset();
384:                         throw $objExc;
385:                     }
386: 
387:                 case 'TemporaryUploadPath':
388:                     try {
389:                         return ($this->strTemporaryUploadPath = QType::Cast($mixValue, QType::String));
390:                     } catch (QCallerException $objExc) {
391:                         $objExc->IncrementOffset();
392:                         throw $objExc;
393:                     }
394: 
395:                 case 'ClickToView':
396:                     try {
397:                         return ($this->blnClickToView = QType::Cast($mixValue, QType::Boolean));
398:                     } catch (QCallerException $objExc) {
399:                         $objExc->IncrementOffset();
400:                         throw $objExc;
401:                     }
402: 
403:                 default:
404:                     try {
405:                         return parent::__set($strName, $mixValue);
406:                     } catch (QCallerException $objExc) {
407:                         $objExc->IncrementOffset();
408:                         throw $objExc;
409:                     }
410:             }           
411:         }
412:     }
API documentation generated by ApiGen