function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); if ($this->pageObject->pageType == PAGE_SEARCH || $this->pageObject->pageType == PAGE_LIST) { echo '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="text" ' . ($mode == MODE_SEARCH ? 'autocomplete="off" ' : '') . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $this->pageObject->pSetEdit->getEditParams($this->field) . ' value="' . runner_htmlspecialchars($value) . '">'; $this->buildControlEnd($validate); return; } if ($mode == MODE_SEARCH) { $this->format = ""; } $disp = ""; $strfilename = ""; $filename_size = 30; if ($this->pageObject->pSetEdit->isUseTimestamp($this->field)) { $filename_size = 50; } if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { // show current file $newUploaderFilesData = my_json_decode($value); $newUploaderWasUsed = is_array($newUploaderFilesData) && count($newUploaderFilesData) > 0; $fileData = $newUploaderWasUsed ? $newUploaderFilesData[0] : array(); $fileName = $newUploaderWasUsed ? $fileData["usrName"] : $value; $viewFormat = $this->pageObject->pSetEdit->getViewFormat($this->field); if ($viewFormat == FORMAT_FILE || $viewFormat == FORMAT_FILE_IMAGE) { $disp = $this->getFileOrImageMarkup($value, $fileName, $newUploaderWasUsed, $fileData) . "<br />"; } // filename edit $strfilename = '<input type=hidden name="filenameHidden_' . $this->cfieldname . '" value="' . runner_htmlspecialchars($fileName) . '"><br>' . "Filename" . ' <input type="text" style="background-color:gainsboro" disabled id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100" value="' . runner_htmlspecialchars($fileName) . '">'; $strtype = '<br><input id="' . $this->ctype . '_keep" type="Radio" name="' . $this->ctype . '" value="upload0" checked class="rnr-uploadtype">' . "Keep"; if ((strlen($value) || $mode == MODE_INLINE_EDIT) && !$this->pageObject->pSetEdit->isRequired($this->field)) { $strtype .= '<input id="' . $this->ctype . '_delete" type="Radio" name="' . $this->ctype . '" value="upload1" class="rnr-uploadtype">' . "Delete"; } $strtype .= '<input id="' . $this->ctype . '_update" type="Radio" name="' . $this->ctype . '" value="upload2" class="rnr-uploadtype">' . "Update"; } else { // if Adding record $strtype = '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="upload2">'; $strfilename = '<br>' . "Filename" . ' <input type="text" id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100">'; } echo $disp . $strtype; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { echo '<br>'; } echo '<input type="File" id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . ' name="' . $this->cfield . '" >' . $strfilename; echo '<input type="Hidden" id="notempty_' . $this->cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">'; $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); if ($mode == MODE_ADD || $mode == MODE_INLINE_ADD || $mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { $checked = ""; if ($value && $value != 0) { $checked = " checked"; } echo '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="checkbox">'; echo '<input id="' . $this->cfield . '" type="Checkbox" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $checked . '>'; } else { echo '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="checkbox">'; echo '<select id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '">'; $val = array("", "on", "off"); $show = array("", "True", "False"); foreach ($val as $i => $v) { $sel = ""; if ($value === $v) { $sel = " selected"; } echo '<option value="' . $v . '"' . $sel . '>' . $show[$i] . '</option>'; } echo "</select>"; } $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); if ($mode == MODE_ADD || $mode == MODE_INLINE_ADD || $mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { $checked = ""; if ($this->connection->dbType == nDATABASE_PostgreSQL && ($value == "t" || $value != "" && $value != 0) || $this->connection->dbType != nDATABASE_PostgreSQL && $value) { $checked = " checked"; } echo '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="checkbox">'; echo '<input id="' . $this->cfield . '" type="Checkbox" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $checked . '>'; } else { echo '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="checkbox">'; echo '<select id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '">'; $val = array("" => array(), "True" => array("on", "1"), "False" => array("off", "0")); $optval = array("", "on", "off"); $show = array("", "True", "False"); foreach ($show as $key => $shownValue) { $sel = in_array($value, $val[$shownValue]) ? " selected" : ""; echo '<option value="' . $optval[$key] . '"' . $sel . '>' . $shownValue . '</option>'; } echo "</select>"; } $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); if ($this->pageObject->pageType == PAGE_SEARCH || $this->pageObject->pageType == PAGE_LIST) { echo '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="text" ' . ($mode == MODE_SEARCH ? 'autocomplete="off" ' : '') . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $this->pageObject->pSetEdit->getEditParams($this->field) . ' value="' . runner_htmlspecialchars($value) . '">'; $this->buildControlEnd($validate); return; } if ($mode == MODE_SEARCH) { $this->format = ""; } $this->formStamp = generatePassword(15); $this->initUploadHandler(); $this->upload_handler->formStamp = $this->formStamp; $filesArray = my_json_decode($value); if (!is_array($filesArray) || count($filesArray) == 0) { if (!$value) { $jsonValue = "[]"; } else { $uploadedFile = $this->upload_handler->get_file_object($value); if (is_null($uploadedFile)) { $filesArray = array(); } else { $filesArray = array(my_json_decode(my_json_encode($uploadedFile))); } } } if ($this->pageObject->pageType == PAGE_EDIT) { if (count($this->pageObject->keys) > 0) { $i = 1; foreach ($this->pageObject->keys as $keyName => $keyValue) { $this->upload_handler->tkeys .= "&key" . $i . "=" . rawurlencode($keyValue); $i++; } } } $_SESSION["mupload_" . $this->formStamp] = array(); $userFilesArray = array(); if (is_array($filesArray)) { foreach ($filesArray as $file) { $sessionArray = array(); $sessionArray["file"] = $file; $sessionArray["fromDB"] = true; $sessionArray["deleted"] = false; $_SESSION["mupload_" . $this->formStamp][$file["usrName"]] = $sessionArray; $userFile = $this->upload_handler->buildUserFile($file); if (!$userFile["isImg"]) { $userFile["isImg"] = true; $userFile["isIco"] = true; $userFile["thumbnail_url"] = $userFile["url"] . "&icon=1"; } $userFilesArray[] = $userFile; } } $jsonValue = my_json_encode($userFilesArray); echo ' <!-- The file upload form used as target for the file upload widget --> <form id="fileupload_' . $this->cfieldname . '" action="' . GetTableLink("mfhandler") . '" method="POST" enctype="multipart/form-data"> <input type="hidden" name="formStamp_' . $this->cfieldname . '" id="formStamp_' . $this->cfieldname . '" value="' . $this->formStamp . '" /> <input type="hidden" name="_action" value="POST" /> <input type="hidden" id="value_' . $this->cfieldname . '" name="value_' . $this->cfieldname . '" value="' . runner_htmlspecialchars($jsonValue) . '" /> <!-- The fileupload-buttonbar contains buttons to add/delete files and start/cancel the upload --> <div class="row fileupload-buttonbar"> <div class="span7"> <!-- The fileinput-button span is used to style the file input field as button --> <SPAN class="btn btn-success fileinput-button"> <A class="rnr-button filesUpload" href="#" ><input class="fileinput-button-input" type="file" name="files[]" value="' . "Añadir ficheros" . '" multiple />' . "Añadir ficheros" . '</A> </SPAN>' . ($this->pageObject->pSetEdit->isAutoUpload($this->field) ? '' : ' <SPAN class="btn btn-primary start"> <A class="rnr-button" href="#" >' . "Enviar" . '</A> </SPAN> <SPAN class="btn btn-warning cancel"> <A class="rnr-button" href="#" >' . "Cancelar" . '</A> </SPAN>') . ' </div> <!-- The global progress information --> <div class="fileupload-progress fade"> <!-- The global progress bar --> <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100"> <div class="bar" style="width:0;"></div> </div> <!-- The extended global progress information --> <div class="progress-extended"> </div> </div> </div> <!-- The loading indicator is shown during file processing --> <div class="fileupload-loading"></div> <!-- The dummy for FireFox --> <input type="text" name="focusDummy" class="rnr-focusDummy" /> <br> <!-- The table listing the files available for upload/download --> <table><tbody class="files"></tbody></table> </form> '; if (!isset($this->container->globalVals["muploadTemplateIncluded"])) { echo '<script type="text/x-tmpl" id="template-download">{% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-download fade"> {% if (file.error) { %} <td></td> <td class="name"><span>{%=file.name%}</span></td> <td class="size"><span dir="LTR">{%=o.formatFileSize(file.size)%}</span></td> <td class="error" colspan="2"><span class="label label-important">' . "" . '</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> {% } else { %} <td class="preview">{% if (file.thumbnail_url) { %} <a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}" {% if (!file.isIco) { %} class="zoombox zgallery" {% } %} ><img src="{%=file.thumbnail_url%}&src=1"></a> {% } else { %} {% if (file.isImg) { %} <a href="{%=file.url%}&nodisp=1" title="{%=file.name%}" rel="gallery" download="{%=file.name%}" class="zoombox zgallery"><img src="{%=file.url%}&src=1"></a> {% } %} {% } %}</td> <td class="name"> <a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&\'gallery\'%}" download="{%=file.name%}">{%=file.name%}</a> </td> <td class="size"><span dir="LTR">{%=o.formatFileSize(file.size)%}</span></td> <td colspan="2"></td> {% } %} <td class="delete"> {% if (!file.error) { %} <SPAN class="btn btn-danger delete" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}" data-name="{%=file.name%}"> <A href="#" >' . "Borrar artículos seleccionados" . '</A> </SPAN> {% } %} </td> </tr> {% } %} </script> <script type="text/x-tmpl" id="template-upload">{% for (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-upload fade"> <td class="preview"><span class="fade"></span></td> <td class="name"><span>{%=file.name%}</span></td> <td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td> {% if (file.error) { %} <td class="error" colspan="2"><span class="label label-important">' . "" . '</span> {%=locale.fileupload.errors[file.error] || file.error%}</td> {% } else if (o.files.valid && !i) { %} <td> <div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0;"></div></div> </td> <td class="start">{% if (!o.options.autoUpload) { %} <SPAN class="btn btn-primary"> <A href="#" >' . "Enviar" . '</A> </SPAN> {% } %}</td> {% } else { %} <td colspan="2"></td> {% } %} <td class="cancel">{% if (!i) { %} {% if (!file.error) { %} <SPAN class="btn btn-warning"> <A href="#" >' . "Cancelar" . '</A> </SPAN> {% } %} {% } %}</td> </tr> {% } %}</script>'; $this->container->globalVals["muploadTemplateIncluded"] = true; } $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); $disp = ""; $strfilename = ""; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { $value = db_stripslashesbinary($value); $itype = SupposeImageType($value); if ($itype) { if ($this->pageObject->pSetEdit->showThumbnail($this->field)) { $disp = "<a target=_blank"; $disp .= " href=\"imager.php?table=" . GetTableURL($this->pageObject->tName) . "&" . $this->iquery . "&rndVal=" . rand(0, 32768) . "\" class='zoombox'>"; $disp .= "<img id=\"image_" . GoodFieldName($this->field) . "_" . $this->id . "\" name=\"" . $this->cfield . "\" border=0"; if ($this->is508) { $disp .= " alt=\"Image from DB\""; } $disp .= " src=\"imager.php?table=" . GetTableURL($this->pageObject->tName) . "&field=" . rawurlencode($this->pageObject->pSetEdit->getStrThumbnail($this->field)) . "&alt=" . rawurlencode($this->field) . $this->keylink . "&rndVal=" . rand(0, 32768) . "\">"; $disp .= "</a>"; } else { $disp = '<img id="image_' . GoodFieldName($this->field) . '_' . $this->id . '" name="' . $this->cfield . '"'; if ($this->is508) { $disp .= ' alt="Image from DB"'; } $disp .= ' border=0 src="imager.php?table=' . GetTableURL($this->pageObject->tName) . '&' . $this->iquery . "&src=1&rndVal=" . rand(0, 32768) . '">'; } } else { if (strlen($value)) { $disp = '<img id="image_' . GoodFieldName($this->field) . '_' . $this->id . '" name="' . $this->cfield . '" border=0 '; if ($this->is508) { $disp .= ' alt="file"'; } $disp .= ' src="images/file.gif">'; } else { $disp = '<img id="image_' . GoodFieldName($this->field) . '_' . $this->id . '" name="' . $this->cfield . '" border="0"'; if ($this->is508) { $disp .= ' alt=" "'; } $disp .= ' src="images/no_image.gif">'; } } // filename if ($this->format == EDIT_FORMAT_DATABASE_FILE && !$itype && strlen($value)) { if (!($filename = @$data[$this->pageObject->pSetEdit->getFilenameField($this->field)])) { $filename = "file.bin"; } $disp = '<a href="getfile.php?table=' . GetTableURL($this->pageObject->tName) . '&filename=' . htmlspecialchars($filename) . '&' . $this->iquery . '".>' . $disp . '</a>'; } // filename edit if ($this->format == EDIT_FORMAT_DATABASE_FILE && $this->pageObject->pSetEdit->getFilenameField($this->field)) { if (!($filename = @$data[$this->pageObject->pSetEdit->getFilenameField($this->field)])) { $filename = ""; } if ($mode == MODE_INLINE_EDIT) { $strfilename = '<br><label for="filename_' . $this->cfieldname . '">' . "Filename" . '</label> <input type="text" ' . $this->inputStyle . ' id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="20" maxlength="50" value="' . htmlspecialchars($filename) . '">'; } else { $strfilename = '<br><label for="filename_' . $this->cfieldname . '">' . "Filename" . '</label> <input type="text" ' . $this->inputStyle . ' id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="20" maxlength="50" value="' . htmlspecialchars($filename) . '">'; } } $strtype = '<br><input id="' . $this->ctype . '_keep" type="Radio" name="' . $this->ctype . '" value="file0" checked>' . "Keep"; if (strlen($value) && !$this->pageObject->pSetEdit->isRequired($this->field)) { $strtype .= '<input id="' . $this->ctype . '_delete" type="Radio" name="' . $this->ctype . '" value="file1">' . "Delete"; } $strtype .= '<input id="' . $this->ctype . '_update" type="Radio" name="' . $this->ctype . '" value="file2">' . "Update"; } else { // if Add mode $strtype = '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="file2">'; if ($this->format == EDIT_FORMAT_DATABASE_FILE && $this->pageObject->pSetEdit->getFilenameField($this->field)) { $strfilename = '<br><label for="filename_' . $this->cfieldname . '">' . "Filename" . '</label> <input type="text" ' . $this->inputStyle . ' id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="20" maxlength="50">'; } } if ($mode == MODE_INLINE_EDIT && $this->format == EDIT_FORMAT_DATABASE_FILE) { $disp = ""; } echo $disp . $strtype; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { echo '<br>'; } echo '<input type="File" ' . $this->inputStyle . ' id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 ? 'alt="' . $this->strLabel . '" ' : '') . ' name="' . $this->cfield . '" >' . $strfilename; echo '<input type="Hidden" id="notempty_' . $this->cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">'; $this->buildControlEnd($validate); }
/** * Get the control's settings and build its HTML markup */ function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); $this->alt = ($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 ? ' alt="' . runner_htmlspecialchars($this->strLabel) . '" ' : ""; $suffix = "_" . GoodFieldName($this->field) . "_" . $this->id; $this->clookupfield = "display_value" . ($fieldNum ? $fieldNum : '') . $suffix; $this->openlookup = "open_lookup" . $suffix; $this->cfield = "value" . $suffix; $this->ctype = "type" . $suffix; if ($fieldNum) { $this->cfield = "value" . $fieldNum . $suffix; $this->ctype = "type" . $fieldNum . $suffix; } $this->categoryFieldId = GoodFieldName($this->pageObject->pSetEdit->getCategoryControl($this->field)); $this->isLinkFieldEncrypted = $this->ciphererLink->isFieldPHPEncrypted($this->field); $this->horizontalLookup = $this->pageObject->pSetEdit->isHorizontalLookup($this->field); $this->strLookupWhere = GetLWWhere($this->field, $this->lookupPageType, $this->tName); // alter "add on the fly" settings $strPerm = GetUserPermissions($this->lookupTable); if (strpos($strPerm, "A") !== false && $this->LCType != LCT_LIST && $mode != MODE_SEARCH) { $this->addnewitem = $this->pageObject->pSetEdit->isAllowToAdd($this->field); $advancedadd = !$this->pageObject->pSetEdit->isSimpleAdd($this->field); if (!$advancedadd || $this->pageObject->pageType == PAGE_REGISTER) { $this->addnewitem = false; } } // prepare multi-select attributes $this->multiple = $this->multiselect ? " multiple" : ""; $this->postfix = $this->multiselect ? "[]" : ""; if ($this->multiselect) { $avalue = splitvalues($value); } else { $avalue = array((string) $value); } $searchOption = $additionalCtrlParams["option"]; // build the control if ($this->lookupType == LT_LISTOFVALUES) { $this->buildListOfValues($avalue, $value, $mode, $searchOption); } else { // build a table-based lookup $this->isDisplayFieldEncrypted = ($this->lookupType == LT_QUERY || $this->linkAndDisplaySame) && $this->ciphererDisplay->isFieldPHPEncrypted($this->lookupType == LT_QUERY ? $this->displayFieldName : $this->field); if ($this->LCType == LCT_AJAX || $this->LCType == LCT_LIST) { $this->buildAJAXLookup($avalue, $value, $mode, $searchOption); } else { $this->buildClassicLookup($avalue, $value, $mode, $searchOption); } } $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); global $conn; $this->conn = $conn; // read control settings $this->alt = ""; if (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508) { $this->alt = ' alt="' . htmlspecialchars($this->strLabel) . '" '; } $this->cfield = "value_" . GoodFieldName($this->field) . "_" . $this->id; $this->clookupfield = "display_value" . ($fieldNum ? $fieldNum : '') . "_" . GoodFieldName($this->field) . "_" . $this->id; $this->openlookup = "open_lookup_" . GoodFieldName($this->field) . "_" . $this->id; $this->ctype = "type_" . GoodFieldName($this->field) . "_" . $this->id; if ($fieldNum) { $this->cfield = "value" . $fieldNum . "_" . GoodFieldName($this->field) . "_" . $this->id; $this->ctype = "type" . $fieldNum . "_" . GoodFieldName($this->field) . "_" . $this->id; } $this->addnewitem = false; $advancedadd = false; //$this->strCategoryControl = $this->pageObject->pSetEdit->getCategoryControl($this->field); $this->categoryFieldId = GoodFieldName($this->pageObject->pSetEdit->getCategoryControl($this->field)); $this->bUseCategory = $this->pageObject->pSetEdit->useCategory($this->field); $dependentLookups = $this->pageObject->pSetEdit->getDependentLookups($this->field); $this->isLinkFieldEncrypted = $this->ciphererLink->isFieldPHPEncrypted($this->field); $this->horizontalLookup = $this->pageObject->pSetEdit->isHorizontalLookup($this->field); //$this->inputStyle = ($additionalCtrlParams['style'] ? 'style="'.$additionalCtrlParams['style'].'"' : ''); $this->strLookupWhere = GetLWWhere($this->field, $this->lookupPageType, $this->pageObject->tName); $this->lookupSize = $this->pageObject->pSetEdit->selectSize($this->field); if ($this->LCType == LCT_CBLIST) { $this->lookupSize = 2; } // simply > 1 for CBLIST $add_page = GetTableURL($this->lookupTable) . "_add.php"; $list_page = GetTableURL($this->lookupTable) . "_list.php"; $strPerm = GetUserPermissions($this->lookupTable); // alter "add on the fly" settings if (strpos($strPerm, "A") !== false) { $this->addnewitem = $this->pageObject->pSetEdit->isAllowToAdd($this->field); $advancedadd = !$this->pageObject->pSetEdit->isSimpleAdd($this->field); if (!$advancedadd) { $this->addnewitem = false; } } // alter lookuptype settings if ($this->LCType == LCT_LIST && strpos($strPerm, "S") === false) { $this->LCType = LCT_DROPDOWN; } if ($this->LCType == LCT_LIST) { $this->addnewitem = false; } if ($mode == MODE_SEARCH) { $this->addnewitem = false; } // prepare multi-select attributes $this->multiple = ""; $this->postfix = ""; if ($this->lookupSize > 1) { $avalue = splitvalues($value); $this->multiple = " multiple"; $this->postfix = "[]"; } else { $avalue = array((string) $value); } // prepare JS code $className = "DropDownLookup"; if ($this->LCType == LCT_AJAX) { $className = "EditBoxLookup"; } elseif ($this->LCType == LCT_LIST) { $className = "ListPageLookup"; } elseif ($this->LCType == LCT_CBLIST) { $className = "CheckBoxLookup"; } // build the control /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // list of values /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if ($this->lookupType == LT_LISTOFVALUES) { $this->buildListOfValues($avalue, $value, $mode); } else { // build table-based lookup $this->isDisplayFieldEncrypted = ($this->lookupType == LT_QUERY || $this->linkAndDisplaySame) && $this->ciphererDisplay->isFieldPHPEncrypted($this->lookupType == LT_QUERY ? $this->displayFieldName : $this->field); //////////////////////////////////////////////////////////////////////////////////////////// // table-based ajax-lookup control //////////////////////////////////////////////////////////////////////////////////////////// if ($this->LCType == LCT_AJAX || $this->LCType == LCT_LIST) { $this->buildAJAXLookup($value, $mode); } else { $this->buildClassicLookup($avalue, $value, $mode); } } $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); if ($this->pageObject->pageType == PAGE_SEARCH || $this->pageObject->pageType == PAGE_LIST) { echo '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="text" ' . ($mode == MODE_SEARCH ? 'autocomplete="off" ' : '') . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $this->pageObject->pSetEdit->getEditParams($this->field) . ' value="' . htmlspecialchars($value) . '">'; $this->buildControlEnd($validate); return; } if ($mode == MODE_SEARCH) { $this->format = ""; } $disp = ""; $strfilename = ""; $function = ""; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { // show current file $fileName = $value; if ($this->pageObject->pSet->getViewFormat($this->field) == FORMAT_FILE || $this->pageObject->pSet->getViewFormat($this->field) == FORMAT_FILE_IMAGE) { $uploadFolder = $this->pageObject->pSet->getUploadFolder($this->field); if (!CheckImageExtension($value)) { $disp = "<a target=\"_blank\" href=\"" . htmlspecialchars($uploadFolder . $value) . "\">" . htmlspecialchars($value) . "</a>"; } else { $finalUploadFolder = $this->pageObject->pSet->getFinalUploadFolder($this->field); if (!myfile_exists(getabspath($finalUploadFolder . $value))) { $value = "images/no_image.gif"; } else { $value = $uploadFolder . $value; } if ($this->pageObject->pSet->showThumbnail($this->field)) { $thumbprefix = $this->pageObject->pSet->getStrThumbnail($this->field); // show thumbnail $thumbname = $thumbprefix . $fileName; if (substr($uploadFolder, 0, 7) != "http://") { if (!myfile_exists(getabspath($finalUploadFolder . $thumbname))) { $thumbname = $value; } else { $thumbname = $uploadFolder . $thumbname; } } $disp = "<a target=\"_blank\" href=\"" . htmlspecialchars($value) . "\" class='zoombox zgallery'>"; $disp .= "<img"; if (isEnableSection508()) { $disp .= " alt=\"" . htmlspecialchars($fileName) . "\""; } $disp .= " border=0"; $disp .= " src=\"" . htmlspecialchars($thumbname) . "\"></a>"; } else { if ($value != "images/no_image.gif") { if (filesize($finalUploadFolder . $fileName) > 51200) { $imageValue = "images/icons/jpg.png"; } else { $imageValue = $value; } } else { $imageValue = "images/no_image.gif"; } if (isEnableSection508()) { $disp = '<img alt=\\"' . htmlspecialchars($fileName) . '\\" src="' . htmlspecialchars($imageValue) . '" border=0>'; } else { $disp = '<img src="' . htmlspecialchars($imageValue) . '" border=0>'; } if ($imageValue != "images/no_image.gif") { $disp = "<a target=\"_blank\" href=\"" . htmlspecialchars($value) . "\">" . $disp . "</a>"; } } } $disp .= "<br />"; } // filename edit $filename_size = 30; if ($this->pageObject->pSet->isUseTimestamp($this->field)) { $filename_size = 50; } $strfilename = '<input type=hidden name="filenameHidden_' . $this->cfieldname . '" value="' . htmlspecialchars($fileName) . '"><br>' . "Filename" . ' <input type="text" style="background-color:gainsboro" disabled id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100" value="' . htmlspecialchars($fileName) . '">'; $strtype = '<br><input id="' . $this->ctype . '_keep" type="Radio" name="' . $this->ctype . '" value="upload0" checked class="runner-uploadtype">' . "Keep"; if ((strlen($value) || $mode == MODE_INLINE_EDIT) && !$this->pageObject->pSet->isRequired($this->field)) { $strtype .= '<input id="' . $this->ctype . '_delete" type="Radio" name="' . $this->ctype . '" value="upload1" class="runner-uploadtype">' . "Delete"; } $strtype .= '<input id="' . $this->ctype . '_update" type="Radio" name="' . $this->ctype . '" value="upload2" class="runner-uploadtype">' . "Update"; } else { // if Adding record $filename_size = 30; if ($this->pageObject->pSet->isUseTimestamp($this->field)) { $filename_size = 50; } $strtype = '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="upload2">'; $strfilename = '<br>' . "Filename" . ' <input type="text" id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100">'; } echo $disp . $strtype . $function; if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) { echo '<br>'; } echo '<input type="File" id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . ' name="' . $this->cfield . '" >' . $strfilename; echo '<input type="Hidden" id="notempty_' . $this->cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">'; $this->buildControlEnd($validate); }
function buildControl($value, $mode, $fieldNum = 0, $validate, $additionalCtrlParams, $data) { parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); $this->buildUserControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data); $this->buildControlEnd($validate); }