コード例 #1
0
 /**
  * Proccess record values
  *
  * @param array $record
  * @param array $data
  * @param string $keylink
  */
 function proccessRecordValue(&$data, &$keylink, $listFieldInfo)
 {
     $value = "";
     if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_IMAGE) {
         if (ShowThumbnail($listFieldInfo['fName'], $this->tName)) {
             $thumbPref = GetThumbnailPrefix($listFieldInfo['fName'], $this->tName);
             $value .= "<a";
             if (IsUseiBox($listFieldInfo['fName'], $this->tName)) {
                 $value .= " rel='ibox'";
             } else {
                 $value .= " target=_blank";
             }
             $value .= " href='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
             $value .= "<img border=0";
             if ($this->is508) {
                 $value .= " alt=\"Image from DB\"";
             }
             $value .= " src='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($thumbPref) . "&alt=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
             $value .= "</a>";
         } else {
             $value = "<img";
             if ($this->is508) {
                 $value .= " alt=\"Image from DB\"";
             }
             $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName);
             $value .= $imgWidth ? " width=" . $imgWidth : "";
             $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName);
             $value .= $imgHeight ? " height=" . $imgHeight : "";
             $value .= " border=0";
             $value .= " src='imager.php?table=" . $this->shortTableName . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
         }
     } else {
         if ($listFieldInfo['viewFormat'] == FORMAT_FILE_IMAGE) {
             if (CheckImageExtension($data[$listFieldInfo['fName']])) {
                 if (ShowThumbnail($listFieldInfo['fName'], $this->tName)) {
                     // show thumbnail
                     $thumbPref = GetThumbnailPrefix($listFieldInfo['fName'], $this->tName);
                     $thumbname = $thumbPref . $data[$listFieldInfo['fName']];
                     if (substr(GetLinkPrefix($listFieldInfo['fName'], $this->tName), 0, 7) != "http://" && !myfile_exists(GetUploadFolder($listFieldInfo['fName']) . $thumbname)) {
                         $thumbname = $data[$listFieldInfo['fName']];
                     }
                     $value = "<a";
                     if (IsUseiBox($listFieldInfo['fName'], $this->tName)) {
                         $value .= " rel='ibox'";
                     } else {
                         $value .= " target=_blank";
                     }
                     $value .= " href=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $data[$listFieldInfo['fName']])) . "\">";
                     $value .= "<img";
                     if ($thumbname == $data[$listFieldInfo['fName']]) {
                         $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName);
                         $value .= $imgWidth ? " width=" . $imgWidth : "";
                         $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName);
                         $value .= $imgHeight ? " height=" . $imgHeight : "";
                     }
                     $value .= " border=0";
                     if ($this->is508) {
                         $value .= " alt=\"" . htmlspecialchars($data[$listFieldInfo['fName']]) . "\"";
                     }
                     $value .= " src=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $thumbname)) . "\"></a>";
                 } else {
                     $value = "<img";
                     $imgWidth = GetImageWidth($listFieldInfo['fName'], $this->tName);
                     $value .= $imgWidth ? " width=" . $imgWidth : "";
                     $imgHeight = GetImageHeight($listFieldInfo['fName'], $this->tName);
                     $value .= $imgHeight ? " height=" . $imgHeight : "";
                     $value .= " border=0";
                     if ($this->is508) {
                         $value .= " alt=\"" . htmlspecialchars($data[$listFieldInfo['fName']]) . "\"";
                     }
                     $value .= " src=\"" . htmlspecialchars(AddLinkPrefix($listFieldInfo['fName'], $data[$listFieldInfo['fName']])) . "\">";
                 }
             }
         } else {
             if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_FILE) {
                 $fileNameF = GetFilenameField($listFieldInfo['fName'], $this->tName);
                 if ($fileNameF) {
                     $fileName = $data[$fileNameF];
                     if (!$fileName) {
                         $fileName = "file.bin";
                     }
                 } else {
                     $fileName = "file.bin";
                 }
                 if (strlen($data[$listFieldInfo['fName']])) {
                     $value = "<a href='getfile.php?table=" . $this->shortTableName . "&filename=" . rawurlencode($fileName) . "&field=" . rawurlencode($listFieldInfo['fName']) . $keylink . "'>";
                     $value .= htmlspecialchars($fileName);
                     $value .= "</a>";
                 }
             } else {
                 if ($listFieldInfo['viewFormat'] == FORMAT_AUDIO) {
                     $fileName = GetData($data, $listFieldInfo['fName'], FORMAT_NONE);
                     $fieldIsUrl = GetFieldData($this->tName, $listFieldInfo['fName'], "fieldIsVideoUrl", false);
                     if (strlen($fileName)) {
                         $absFileName = "";
                         if (!$fieldIsUrl && GetFieldData($this->tName, $listFieldInfo['fName'], "Absolute", false)) {
                             $absFileName = GetUploadFolder($listFieldInfo['fName']) . $fileName;
                         } elseif (!$fieldIsUrl) {
                             $absFileName = getabspath(GetUploadFolder($listFieldInfo['fName']) . $fileName);
                         }
                         // if file
                         if ($fieldIsUrl || file_exists($absFileName)) {
                             $titleField = GetFieldData($this->tName, $listFieldInfo['fName'], 'audioTitleField', "");
                             $title = "";
                             if ($titleField) {
                                 $title = htmlspecialchars(GetData($data, $titleField, ViewFormat($titleField, $titleField)));
                             }
                             if ($fieldIsUrl) {
                                 $href = $fileName;
                             } else {
                                 $href = 'download.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink;
                             }
                             $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="' . $href . '">' . $title . '</a>';
                         }
                     }
                 } else {
                     if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_AUDIO) {
                         $titleField = GetFieldData($this->tName, $listFieldInfo['fName'], 'audioTitleField', "");
                         $title = "";
                         if ($titleField) {
                             $title = htmlspecialchars(GetData($data, $titleField, ViewFormat($titleField, $titleField)));
                         }
                         if (@$data[$listFieldInfo['fName']] != NULL) {
                             $value = '<a class="htrack" type="audio/mpeg" title="' . $title . '" href="getfile.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink . '">' . $title . '</a>';
                         } else {
                             $value = $title;
                         }
                     } else {
                         if ($listFieldInfo['viewFormat'] == FORMAT_VIDEO) {
                             $value = "";
                             $fieldIsUrl = GetFieldData($this->tName, $listFieldInfo['fName'], "fieldIsVideoUrl", false);
                             $fileName = GetData($data, $listFieldInfo['fName'], FORMAT_NONE);
                             if (strlen($fileName)) {
                                 $absFileName = "";
                                 if (!$fieldIsUrl && GetFieldData($this->tName, $listFieldInfo['fName'], "Absolute", false)) {
                                     $absFileName = GetUploadFolder($listFieldInfo['fName']) . $fileName;
                                 } elseif (!$fieldIsUrl) {
                                     $absFileName = getabspath(GetUploadFolder($listFieldInfo['fName']) . $fileName);
                                 }
                                 // if file
                                 if ($fieldIsUrl || file_exists($absFileName)) {
                                     $videoId = 'video_' . GoodFieldName(htmlspecialchars($listFieldInfo['fName'])) . '_' . $this->recId;
                                     if ($fieldIsUrl) {
                                         $href = $fileName;
                                     } else {
                                         $href = 'download.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink;
                                     }
                                     $value = '<a href="' . $href . '" style="display:block;width:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoWidth', "") . 'px;height:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoHeight', "") . 'px;" id="' . $videoId . '"></a>';
                                     $this->controlsMap['video'][] = $videoId;
                                 }
                             }
                         } else {
                             if ($listFieldInfo['viewFormat'] == FORMAT_DATABASE_VIDEO) {
                                 if (@$data[$listFieldInfo['fName']] != NULL) {
                                     $videoId = 'video_' . GoodFieldName(htmlspecialchars($listFieldInfo['fName'])) . '_' . $this->recId;
                                     $value = '<a href="getfile.php?table=' . $this->shortTableName . '&field=' . rawurlencode($listFieldInfo['fName']) . $keylink . '" style="display:block;width:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoWidth', 0) . 'px;height:' . GetFieldData($this->tName, $listFieldInfo['fName'], 'videoHeight', 0) . 'px;" id="' . $videoId . '"></a>';
                                     $this->controlsMap['video'][] = $videoId;
                                 }
                             } else {
                                 if ($listFieldInfo['viewFormat'] == FORMAT_MAP) {
                                     $value = '<div id="littleMap_' . GoodFieldName($listFieldInfo['fName']) . '_' . $this->recId . '" style="width: ' . $this->googleMapCfg['fieldsAsMap'][$listFieldInfo['fName']]['width'] . 'px; height: ' . $this->googleMapCfg['fieldsAsMap'][$listFieldInfo['fName']]['height'] . 'px;"></div>';
                                 } else {
                                     if (($listFieldInfo['editFormat'] == EDIT_FORMAT_LOOKUP_WIZARD || $listFieldInfo['editFormat'] == EDIT_FORMAT_RADIO) && GetLookupType($listFieldInfo['fName'], $this->tName) == LT_LOOKUPTABLE && GetLWLinkField($listFieldInfo['fName'], $this->tName) != GetLWDisplayField($listFieldInfo['fName'], $this->tName)) {
                                         $value = DisplayLookupWizard($listFieldInfo['fName'], $data[$listFieldInfo['fName']], $data, $keylink, MODE_LIST);
                                     } else {
                                         if (NeedEncode($listFieldInfo['fName'], $this->tName)) {
                                             $value = ProcessLargeText(GetData($data, $listFieldInfo['fName'], $listFieldInfo['viewFormat']), "field=" . rawurlencode($listFieldInfo['fName']) . $keylink, "", MODE_LIST);
                                         } else {
                                             $value = GetData($data, $listFieldInfo['fName'], $listFieldInfo['viewFormat']);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     // create address field as center link
     $value = $this->addCenterLink($value, $listFieldInfo['fName']);
     return $value;
 }
コード例 #2
0
function BuildEditControl($field, $value, $format, $edit, $fieldNum = 0, $id = "", $validate, $additionalCtrlParams, &$pageObj)
{
    global $rs, $data, $strTableName, $filenamelist, $keys, $locale_info, $jscode;
    $inputStyle = 'style="';
    $inputStyle .= $additionalCtrlParams['style'] ? $additionalCtrlParams['style'] : '';
    //$inputStyle .= ($additionalCtrlParams['hidden'] ? 'display: none;' : '');
    $inputStyle .= '"';
    $cfieldname = GoodFieldName($field) . "_" . $id;
    $cfield = "value_" . GoodFieldName($field) . "_" . $id;
    $ctype = "type_" . GoodFieldName($field) . "_" . $id;
    $is508 = isEnableSection508();
    $strLabel = Label($field);
    if ($fieldNum) {
        $cfield = "value" . $fieldNum . "_" . GoodFieldName($field) . "_" . $id;
        $ctype = "type" . $fieldNum . "_" . GoodFieldName($field) . "_" . $id;
    }
    $type = GetFieldType($field);
    $arr = "";
    $iquery = "field=" . rawurlencode($field);
    $keylink = "";
    $arrKeys = GetTableKeys($strTableName);
    for ($j = 0; $j < count($arrKeys); $j++) {
        $keylink .= "&key" . ($j + 1) . "=" . rawurlencode($data[$arrKeys[$j]]);
    }
    $iquery .= $keylink;
    $isHidden = isset($additionalCtrlParams['hidden']) && $additionalCtrlParams['hidden'];
    echo '<span id="edit' . $id . '_' . GoodFieldName($field) . '_' . $fieldNum . '" class="runner-nowrap"' . ($isHidden ? ' style="display:none"' : '') . '">';
    if ($format == EDIT_FORMAT_FILE && $edit == MODE_SEARCH) {
        $format = "";
    }
    if ($format == EDIT_FORMAT_TEXT_FIELD) {
        if (IsDateFieldType($type)) {
            echo '<input id="' . $ctype . '" type="hidden" name="' . $ctype . '" value="date' . EDIT_DATE_SIMPLE . '">' . GetDateEdit($field, $value, 0, $fieldNum, $edit, $id, $pageObj);
        } else {
            if ($edit == MODE_SEARCH) {
                echo '<input id="' . $cfield . '" ' . $inputStyle . ' type="text" autocomplete="off" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . '" ' . GetEditParams($field) . ' value="' . htmlspecialchars($value) . '">';
            } else {
                echo '<input id="' . $cfield . '" ' . $inputStyle . ' type="text" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . '" ' . GetEditParams($field) . ' value="' . htmlspecialchars($value) . '">';
            }
        }
    } else {
        if ($format == EDIT_FORMAT_TIME) {
            echo '<input id="' . $ctype . '" ' . $inputStyle . ' type="hidden" name="' . $ctype . '" value="time">';
            $arr_number = parsenumbers((string) $value);
            if (count($arr_number) == 6) {
                $value = mysprintf("%d:%02d:%02d", array($arr_number[3], $arr_number[4], $arr_number[5]));
            }
            $timeAttrs = GetFieldData($strTableName, $field, "FormatTimeAttrs", array());
            if (count($timeAttrs)) {
                if ($timeAttrs["useTimePicker"]) {
                    $convention = $timeAttrs["hours"];
                    $loc = getLacaleAmPmForTimePicker($convention, true);
                    $tpVal = getValForTimePicker($type, $value, $loc['locale']);
                    echo '<input type="text" ' . $inputStyle . ' name="' . $cfield . '" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'id="' . $cfield . '" ' . GetEditParams($field) . ' value="' . htmlspecialchars($tpVal['val']) . '">';
                    echo '&nbsp;';
                    echo '<img class="runner-imgclock" src="images/clock.gif" alt="Time" border="0" style="margin:4px 0 0 6px; visibility: hidden;" id="trigger-test-' . $cfield . '" />';
                } else {
                    echo '<input id="' . $cfield . '" ' . $inputStyle . ' type="text" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . '" ' . GetEditParams($field) . ' value="' . htmlspecialchars($value) . '">';
                }
            }
        } else {
            if ($format == EDIT_FORMAT_TEXT_AREA) {
                $nWidth = GetNCols($field);
                $nHeight = GetNRows($field);
                if (UseRTE($field)) {
                    $value = RTESafe($value);
                } else {
                    echo '<textarea id="' . $cfield . '" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . '" style="';
                    if (!isMobile()) {
                        echo "width: " . $nWidth . "px;";
                    }
                    echo 'height: ' . $nHeight . 'px;">' . htmlspecialchars($value) . '</textarea>';
                }
            } else {
                if ($format == EDIT_FORMAT_PASSWORD) {
                    echo '<input ' . $inputStyle . ' id="' . $cfield . '" type="Password" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . '" ' . GetEditParams($field) . ' value="' . htmlspecialchars($value) . '">';
                } else {
                    if ($format == EDIT_FORMAT_DATE) {
                        echo '<input id="' . $ctype . '" type="hidden" name="' . $ctype . '" value="date' . DateEditType($field) . '">' . GetDateEdit($field, $value, DateEditType($field), $fieldNum, $edit, $id, $pageObj);
                    } else {
                        if ($format == EDIT_FORMAT_RADIO) {
                            BuildRadioControl($field, $value, $fieldNum, $id, $edit);
                        } else {
                            if ($format == EDIT_FORMAT_CHECKBOX) {
                                if ($edit == MODE_ADD || $edit == MODE_INLINE_ADD || $edit == MODE_EDIT || $edit == MODE_INLINE_EDIT) {
                                    $checked = "";
                                    if ($value && $value != 0) {
                                        $checked = " checked";
                                    }
                                    echo '<input id="' . $ctype . '" type="hidden" name="' . $ctype . '" value="checkbox">';
                                    echo '<input id="' . $cfield . '" type="Checkbox" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $cfield . '" ' . $checked . '>';
                                } else {
                                    echo '<input id="' . $ctype . '" type="hidden" name="' . $ctype . '" value="checkbox">';
                                    echo '<select id="' . $cfield . '" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . 'name="' . $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>";
                                }
                            } else {
                                if ($format == EDIT_FORMAT_DATABASE_IMAGE || $format == EDIT_FORMAT_DATABASE_FILE) {
                                    $disp = "";
                                    $strfilename = "";
                                    //$onchangefile="";
                                    if ($edit == MODE_EDIT || $edit == MODE_INLINE_EDIT) {
                                        $value = db_stripslashesbinary($value);
                                        $itype = SupposeImageType($value);
                                        $thumbnailed = false;
                                        $thumbfield = "";
                                        if ($itype) {
                                            if ($thumbnailed) {
                                                $disp = "<a ";
                                                if (IsUseiBox($field, $strTableName)) {
                                                    $disp .= " rel='ibox'";
                                                } else {
                                                    $disp .= " target=_blank";
                                                }
                                                $disp .= " href=\"imager.php?table=" . GetTableURL($strTableName) . "&" . $iquery . "&rndVal=" . rand(0, 32768) . "\">";
                                                $disp .= "<img id=\"image_" . GoodFieldName($field) . "_" . $id . "\" name=\"" . $cfield . "\" border=0";
                                                if (isEnableSection508()) {
                                                    $disp .= " alt=\"Image from DB\"";
                                                }
                                                $disp .= " src=\"imager.php?table=" . GetTableURL($strTableName) . "&field=" . rawurlencode($thumbfield) . "&alt=" . rawurlencode($field) . $keylink . "&rndVal=" . rand(0, 32768) . "\">";
                                                $disp .= "</a>";
                                            } else {
                                                $disp = '<img id="image_' . GoodFieldName($field) . '_' . $id . '" name="' . $cfield . '"';
                                                if (isEnableSection508()) {
                                                    $disp .= ' alt="Image from DB"';
                                                }
                                                $disp .= ' border=0 src="imager.php?table=' . GetTableURL($strTableName) . '&' . $iquery . "&rndVal=" . rand(0, 32768) . '">';
                                            }
                                        } else {
                                            if (strlen($value)) {
                                                $disp = '<img id="image_' . GoodFieldName($field) . '_' . $id . '" name="' . $cfield . '" border=0 ';
                                                if (isEnableSection508()) {
                                                    $disp .= ' alt="file"';
                                                }
                                                $disp .= ' src="images/file.gif">';
                                            } else {
                                                $disp = '<img id="image_' . GoodFieldName($field) . '_' . $id . '" name="' . $cfield . '" border="0"';
                                                if (isEnableSection508()) {
                                                    $disp .= ' alt=" "';
                                                }
                                                $disp .= ' src="images/no_image.gif">';
                                            }
                                        }
                                        //	filename
                                        if ($format == EDIT_FORMAT_DATABASE_FILE && !$itype && strlen($value)) {
                                            if (!($filename = @$data[GetFilenameField($field)])) {
                                                $filename = "file.bin";
                                            }
                                            $disp = '<a href="getfile.php?table=' . GetTableURL($strTableName) . '&filename=' . htmlspecialchars($filename) . '&' . $iquery . '".>' . $disp . '</a>';
                                        }
                                        //	filename edit
                                        if ($format == EDIT_FORMAT_DATABASE_FILE && GetFilenameField($field)) {
                                            if (!($filename = @$data[GetFilenameField($field)])) {
                                                $filename = "";
                                            }
                                            if ($edit == MODE_INLINE_EDIT) {
                                                $strfilename = '<br><label for="filename_' . $cfieldname . '">' . mlang_message("FILENAME") . '</label>&nbsp;&nbsp;<input type="text" ' . $inputStyle . ' id="filename_' . $cfieldname . '" name="filename_' . $cfieldname . '" size="20" maxlength="50" value="' . htmlspecialchars($filename) . '">';
                                            } else {
                                                $strfilename = '<br><label for="filename_' . $cfieldname . '">' . mlang_message("FILENAME") . '</label>&nbsp;&nbsp;<input type="text" ' . $inputStyle . ' id="filename_' . $cfieldname . '" name="filename_' . $cfieldname . '" size="20" maxlength="50" value="' . htmlspecialchars($filename) . '">';
                                            }
                                        }
                                        $strtype = '<br><input id="' . $ctype . '_keep" type="Radio" name="' . $ctype . '" value="file0" checked>' . mlang_message("KEEP");
                                        if ((strlen($value) || $edit == MODE_INLINE_EDIT) && !IsRequired($field)) {
                                            $strtype .= '<input id="' . $ctype . '_delete" type="Radio" name="' . $ctype . '" value="file1">' . mlang_message("DELETE");
                                        }
                                        $strtype .= '<input id="' . $ctype . '_update" type="Radio" name="' . $ctype . '" value="file2">' . mlang_message("UPDATE");
                                    } else {
                                        //	if Add mode
                                        $strtype = '<input id="' . $ctype . '" type="hidden" name="' . $ctype . '" value="file2">';
                                        if ($format == EDIT_FORMAT_DATABASE_FILE && GetFilenameField($field)) {
                                            $strfilename = '<br><label for="filename_' . $cfieldname . '">' . mlang_message("FILENAME") . '</label>&nbsp;&nbsp;<input type="text" ' . $inputStyle . ' id="filename_' . $cfieldname . '" name="filename_' . $cfieldname . '" size="20" maxlength="50">';
                                        }
                                    }
                                    if ($edit == MODE_INLINE_EDIT && $format == EDIT_FORMAT_DATABASE_FILE) {
                                        $disp = "";
                                    }
                                    echo $disp . $strtype;
                                    if ($edit == MODE_EDIT || $edit == MODE_INLINE_EDIT) {
                                        echo '<br>';
                                    }
                                    echo '<input type="File" ' . $inputStyle . ' id="' . $cfield . '" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . ' name="' . $cfield . '" >' . $strfilename;
                                    echo '<input type="Hidden" id="notempty_' . $cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">';
                                } else {
                                    if ($format == EDIT_FORMAT_LOOKUP_WIZARD) {
                                        BuildSelectControl($field, $value, $fieldNum, $edit, $id, $additionalCtrlParams, $pageObj);
                                    } else {
                                        if ($format == EDIT_FORMAT_HIDDEN) {
                                            echo '<input id="' . $cfield . '" type="Hidden" name="' . $cfield . '" value="' . htmlspecialchars($value) . '">';
                                        } else {
                                            if ($format == EDIT_FORMAT_READONLY) {
                                                echo '<input id="' . $cfield . '" type="Hidden" name="' . $cfield . '" value="' . htmlspecialchars($value) . '">';
                                            } else {
                                                if ($format == EDIT_FORMAT_FILE) {
                                                    $disp = "";
                                                    $strfilename = "";
                                                    $function = "";
                                                    if ($edit == MODE_EDIT || $edit == MODE_INLINE_EDIT) {
                                                        //	show current file
                                                        if (ViewFormat($field) == FORMAT_FILE || ViewFormat($field) == FORMAT_FILE_IMAGE) {
                                                            $disp = GetData($data, $field, ViewFormat($field)) . "<br>";
                                                        }
                                                        $filename = $value;
                                                        //	filename edit
                                                        $filename_size = 30;
                                                        if (UseTimestamp($field)) {
                                                            $filename_size = 50;
                                                        }
                                                        $strfilename = '<input type=hidden name="filenameHidden_' . $cfieldname . '" value="' . htmlspecialchars($filename) . '"><br>' . mlang_message("FILENAME") . '&nbsp;&nbsp;<input type="text" style="background-color:gainsboro" disabled id="filename_' . $cfieldname . '" name="filename_' . $cfieldname . '" size="' . $filename_size . '" maxlength="100" value="' . htmlspecialchars($filename) . '">';
                                                        if ($edit == MODE_INLINE_EDIT) {
                                                            $strtype = '<br><input id="' . $ctype . '_keep" type="Radio" name="' . $ctype . '" value="upload0" checked class="runner-uploadtype">' . mlang_message("KEEP");
                                                        } else {
                                                            $strtype = '<br><input id="' . $ctype . '_keep" type="Radio" name="' . $ctype . '" value="upload0" checked class="runner-uploadtype">' . mlang_message("KEEP");
                                                        }
                                                        if ((strlen($value) || $edit == MODE_INLINE_EDIT) && !IsRequired($field)) {
                                                            $strtype .= '<input id="' . $ctype . '_delete" type="Radio" name="' . $ctype . '" value="upload1" class="runner-uploadtype">' . mlang_message("DELETE");
                                                        }
                                                        $strtype .= '<input id="' . $ctype . '_update" type="Radio" name="' . $ctype . '" value="upload2" class="runner-uploadtype">' . mlang_message("UPDATE");
                                                    } else {
                                                        //	if Adding record
                                                        $filename_size = 30;
                                                        if (UseTimestamp($field)) {
                                                            $filename_size = 50;
                                                        }
                                                        $strtype = '<input id="' . $ctype . '" type="hidden" name="' . $ctype . '" value="upload2">';
                                                        $strfilename = '<br>' . mlang_message("FILENAME") . '&nbsp;&nbsp;<input type="text" id="filename_' . $cfieldname . '" name="filename_' . $cfieldname . '" size="' . $filename_size . '" maxlength="100">';
                                                    }
                                                    echo $disp . $strtype . $function;
                                                    if ($edit == MODE_EDIT || $edit == MODE_INLINE_EDIT) {
                                                        echo '<br>';
                                                    }
                                                    echo '<input type="File" id="' . $cfield . '" ' . (($edit == MODE_INLINE_EDIT || $edit == MODE_INLINE_ADD) && $is508 == true ? 'alt="' . $strLabel . '" ' : '') . ' name="' . $cfield . '" >' . $strfilename;
                                                    echo '<input type="Hidden" id="notempty_' . $cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">';
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (count($validate['basicValidate']) && array_search('IsRequired', $validate['basicValidate']) !== false) {
        echo '&nbsp;<font color="red">*</font></span>';
    } else {
        echo '</span>';
    }
}
コード例 #3
0
 function getFormattedRow($value)
 {
     $row = array('row_data' => true);
     $keylink = "";
     for ($i = 0; $i < count($this->tKeyFields); $i++) {
         $keylink .= "&key" . ($i + 1) . "=" . htmlspecialchars(rawurlencode(@$value[$this->tKeyFields[$i]]));
     }
     for ($i = 0; $i < count($this->fieldsArr); $i++) {
         // for change pseudo foreach with condition with PHP for
         // foreach Fields as @f filter @f.bReportPage && (@TABLE.bReportShowDetails || @TABLE.arrReportGroupFields[strGroupField==@f.strName && nGroupInterval==0].len) order nReportPageOrder
         $pass = false;
         for ($j = 0; $j < count($this->repGroupFields); $j++) {
             if (!$this->fieldsArr[$i]['repPage'] || !($this->repShowDet || $this->repGroupFields[$j]['strGroupField'] == $this->fieldsArr[$i]['name'] && $this->repGroupFields[$j]['groupInterval'] === 0)) {
                 $pass = true;
             }
         }
         if ($pass) {
             continue;
         }
         if ($this->fieldsArr[$i]['viewFormat'] == FORMAT_DATABASE_IMAGE) {
             if (!$this->forExport) {
                 if ($this->fieldsArr[$i]['showThumb']) {
                     $val .= "<a ";
                     if (IsUseiBox($this->fieldsArr[$i]['name'], $this->tName)) {
                         $val .= " rel='ibox'";
                     } else {
                         $val .= " target=_blank";
                     }
                     $val .= " href=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">";
                     $val .= "<img border=0";
                     if (isEnableSection508()) {
                         $val .= " alt=\"Image from DB\"";
                     }
                     $val .= " src=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['thumbnail'])) . "&alt=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['repPage'])) . $keylink . "\">";
                     $val .= "</a>";
                 } else {
                     $val = "<img";
                     if ($this->fieldsArr[$i]['imageWidth']) {
                         $val .= " width=" . $this->fieldsArr[$i]['imageWidth'];
                     }
                     if ($this->fieldsArr[$i]['imageHeight']) {
                         $val .= " height=" . $this->fieldsArr[$i]['imageHeight'];
                     }
                     $val .= " border=0";
                     if (isEnableSection508()) {
                         $val .= " alt=\"Image from DB\"";
                     }
                     $val .= " src=\"imager.php?table=" . $this->shortTName . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">";
                 }
             } else {
                 $val = mlang_message("LONG_BINARY");
             }
         } elseif ($this->fieldsArr[$i]['viewFormat'] == FORMAT_FILE_IMAGE) {
             if (!$this->forExport) {
                 if (CheckImageExtension($value[$this->fieldsArr[$i]['name']])) {
                     if ($this->fieldsArr[$i]['showThumb']) {
                         // show thumbnail
                         $thumbname = $this->fieldsArr[$i]['thumbnail'] . $value[$this->fieldsArr[$i]['name']];
                         if (substr($this->fieldsArr[$i]['strhlPrefix'], 0, 7) != "http://" && !myfile_exists(getabspath($this->fieldsArr[$i]['strhlPrefix'] . $thumbname))) {
                             $thumbname = $value[$this->fieldsArr[$i]['name']];
                         }
                         $val = "<a";
                         if (IsUseiBox($this->fieldsArr[$i]['name'], $this->tName)) {
                             $val .= " rel='ibox'";
                         } else {
                             $val .= " target=_blank";
                         }
                         $val .= " href=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']])) . "\">";
                         $val .= "<img";
                         if ($thumbname == $value[$this->fieldsArr[$i]['name']]) {
                             if ($this->fieldsArr[$i]['imageWidth']) {
                                 $val .= " width=" . $this->fieldsArr[$i]['imageWidth'];
                             }
                             if ($this->fieldsArr[$i]['imageHeight']) {
                                 $val .= " height=" . $this->fieldsArr[$i]['imageHeight'];
                             }
                         }
                         $val .= " border=0";
                         if (isEnableSection508()) {
                             $val .= " alt=\"" . htmlspecialchars($value[$this->fieldsArr[$i]['name']]) . "\"";
                         }
                         $val .= " src=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $thumbname)) . "\"></a>";
                     } else {
                         $val = "<img";
                         if ($this->fieldsArr[$i]['imageWidth']) {
                             $val .= " width=" . $this->fieldsArr[$i]['imageWidth'];
                         }
                         if ($this->fieldsArr[$i]['imageHeight']) {
                             $val .= " height=" . $this->fieldsArr[$i]['imageHeight'];
                         }
                         $val .= " border=0";
                         if (isEnableSection508()) {
                             $val .= " alt=\"" . htmlspecialchars($value[$this->fieldsArr[$i]['name']]) . "\"";
                         }
                         $val .= " src=\"" . htmlspecialchars(AddLinkPrefix($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']])) . "\">";
                     }
                 }
             } else {
                 $val = mlang_message("LONG_BINARY");
             }
         } elseif ($this->fieldsArr[$i]['viewFormat'] == FORMAT_DATABASE_FILE) {
             if (!$this->forExport) {
                 if ($this->fieldsArr[$i]['fileName']) {
                     $filename = $value[$this->fieldsArr[$i]['fileName']];
                     if (!$filename) {
                         $filename = "file.bin";
                     }
                 } else {
                     $filename = "file.bin";
                 }
                 if (strlen($value[$this->fieldsArr[$i]['name']])) {
                     $val = "<a href=\"getfile.php?table=" . $this->shortTName . "&filename=" . rawurlencode($filename) . "&field=" . rawurlencode(htmlspecialchars($this->fieldsArr[$i]['name'])) . $keylink . "\">";
                     $val .= htmlspecialchars($filename);
                     $val .= "</a>";
                 }
             } else {
                 $val = mlang_message("LONG_BINARY");
             }
         } elseif (($this->fieldsArr[$i]['editFormat'] == EDIT_FORMAT_LOOKUP_WIZARD || $this->fieldsArr[$i]['editFormat'] == EDIT_FORMAT_RADIO) && GetLookupType($this->fieldsArr[$i]['name'], $this->tName) == LT_LOOKUPTABLE) {
             $val = DisplayLookupWizard($this->fieldsArr[$i]['name'], $value[$this->fieldsArr[$i]['name']], $value, $keylink, $this->mode);
         } elseif (NeedEncode($this->fieldsArr[$i]['name'], $this->tName)) {
             $val = ProcessLargeText(GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']), "field=" . rawurlencode($this->fieldsArr[$i]['name']) . $keylink, "", $this->mode);
         } else {
             //$val = GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']);
             if ($this->fieldsArr[$i]['viewFormat'] == FORMAT_CHECKBOX && $this->forExport) {
                 $val = GetData($value, $this->fieldsArr[$i]['name'], FORMAT_NONE);
             } else {
                 $val = GetData($value, $this->fieldsArr[$i]['name'], $this->fieldsArr[$i]['viewFormat']);
             }
         }
         $row[$this->fieldsArr[$i]['goodName'] . "_value"] = $val;
     }
     if ($this->repLayout == REPORT_BLOCK) {
         $row[GoodFieldName('nonewgroup')] = true;
     }
     return $row;
 }