Ejemplo n.º 1
1
 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" . '&nbsp;&nbsp;<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" . '&nbsp;&nbsp;<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);
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
    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">&nbsp;</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);
    }
Ejemplo n.º 5
0
 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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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>&nbsp;&nbsp;<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);
 }
Ejemplo n.º 6
0
 /**
  * Fill the response array with the suggest values
  *
  * @param String value	
  *		Note: value is preceeded with "_" 
  * @param String searchFor
  * @param &Array response
  * @param &Array row
  */
 function suggestValue($value, $searchFor, &$response, &$row)
 {
     if (!GetGlobalData("handleSearchSuggestInLookup", true) || $this->lookupType == LT_LISTOFVALUES || $this->isSearchByDispalyedFieldAllowed()) {
         parent::suggestValue($value, $searchFor, $response, $row);
         return;
     }
     // "_" is added to convert number type to string in lookupsuggest.php ($value)
     $lookupSQL = $this->getLookupSQL("", substr($value, 1), false, true, false, true, true);
     $this->fillLookupFieldsIndexes();
     $qResult = $this->lookupConnection->query($lookupSQL);
     if ($data = $qResult->fetchNumeric()) {
         // "_" is added to convert number type to string
         if ($this->isDisplayFieldEncrypted) {
             $displayFieldName = $this->lookupType == LT_QUERY ? $this->displayFieldName : $this->field;
             $lookup_value = $this->ciphererDisplay->DecryptField($displayFieldName, "_" . $data[$this->displayFieldIndex]);
         } else {
             $lookup_value = "_" . $data[$this->displayFieldIndex];
         }
         parent::suggestValue($lookup_value, $searchFor, $response, $row);
     }
 }
Ejemplo n.º 7
0
 function suggestValue($value, $searchFor, &$response, &$row)
 {
     if (!GetGlobalData("handleSearchSuggestInLookup", true)) {
         parent::suggestValue($value, $searchFor, $response, $row);
         return;
     }
     global $conn;
     $lookupSQL = buildLookupSQL($this->lookupPageType, $this->field, $this->pageObject->tName, "", $value, false, true, false, true, true, true);
     $this->fillLookupFieldsIndexes();
     $rs_lookup = db_query($lookupSQL, $conn);
     if ($data = db_fetch_numarray($rs_lookup)) {
         if ($this->isDisplayFieldEncrypted) {
             $lookup_value = $this->ciphererDisplay->DecryptField($this->lookupType == LT_QUERY ? $this->displayFieldName : $this->field, $data[$this->displayFieldIndex]);
         } else {
             $lookup_value = $data[$this->displayFieldIndex];
         }
         parent::suggestValue($lookup_value, $searchFor, $response, $row);
     }
 }
Ejemplo n.º 8
0
 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" . '&nbsp;&nbsp;<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" . '&nbsp;&nbsp;<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);
 }
Ejemplo n.º 9
0
 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);
 }