Пример #1
0
      <input type='hidden' name='_uploadNum' value='<?php 
        echo $row['num'];
        ?>
' class='_uploadNum' />
      <img src="lib/images/drag.gif" height="6" width="19" class='dragger' title='<?php 
        et('Click and drag to change order.');
        ?>
' alt='' /><br/>
     </td>
<?php 
    }
    ?>
     <td width="60" style="text-align: center; vertical-align: middle; padding: 2px;">

       <?php 
    showUploadPreview($row, 50);
    ?>
     </td>
     <td width="260" style="vertical-align: top" valign="top">
       <?php 
    echo $row['_infoFields'];
    ?>
       <?php 
    et('Filename:');
    ?>
 <?php 
    echo htmlencode(pathinfo($row['filePath'], PATHINFO_BASENAME));
    ?>
     </td>
<?php 
    if (@$_REQUEST['formType'] != 'view') {
function _getColumnDisplayValueAndAttributes($fieldname, &$record)
{
    global $schema, $tableName;
    $fieldValue = @$record[$fieldname];
    $fieldSchema = @$schema[$fieldname];
    if ($fieldSchema) {
        $fieldSchema['name'] = $fieldname;
    }
    // default display value and attribute
    if (!is_array($fieldValue)) {
        $fieldValue = htmlencode($fieldValue);
    }
    $displayValue = $fieldValue;
    $tdAttributes = "style='text-align:left'";
    // date fields
    $isSpecialDatefield = in_array($fieldname, array('createdDate', 'updatedDate'));
    if (@$fieldSchema['type'] == 'date' || $isSpecialDatefield) {
        $showSeconds = @$fieldSchema['showSeconds'];
        $showTime = @$fieldSchema['showTime'];
        $use24Hour = @$fieldSchema['use24HourFormat'];
        // settings for createdDate and updatedDate
        if ($isSpecialDatefield) {
            $showSeconds = true;
            $showTime = true;
            $use24Hour = true;
        }
        $secondsFormat = '';
        if ($showSeconds) {
            $secondsFormat = ':s';
        }
        $timeFormat = '';
        if ($showTime) {
            if ($use24Hour) {
                $timeFormat = " - H:i{$secondsFormat}";
            } else {
                $timeFormat = " - h:i{$secondsFormat} A";
            }
        }
        $dateFormat = '';
        $dayMonthOrder = @$GLOBALS['SETTINGS']['dateFormat'];
        if ($dayMonthOrder == 'dmy') {
            $dateFormat = "jS M, Y" . $timeFormat;
        } elseif ($dayMonthOrder == 'mdy') {
            $dateFormat = "M jS, Y" . $timeFormat;
        } else {
            $dateFormat = "Y-m-d" . $timeFormat;
        }
        $displayValue = date($dateFormat, strtotime($fieldValue));
        if (!$fieldValue || $fieldValue == '0000-00-00 00:00:00') {
            $displayValue = '';
        }
    }
    // dragSortOrder fields
    if ($fieldname == 'dragSortOrder') {
        if (!userHasFieldAccess($schema[$fieldname])) {
            return;
        }
        // skip fields that the user has no access to
        $tdAttributes = "class='dragger'";
        $displayValue = "<input type='hidden' name='_recordNum' value='{$record['num']}' class='_recordNum' />";
        $displayValue .= "<img src='lib/images/drag.gif' height='6' width='19' class='dragger' title='" . t('Click and drag to change order.') . "' alt='' /><br/>";
    }
    // Category Section: name fields - pad category names to their depth
    $isCategorySection = @$schema['menuType'] == 'category' && $fieldname == 'name';
    if ($isCategorySection) {
        $depth = @$record["depth"];
        $parentNum = @$record["parentNum"];
        //$displayValue  = "<input type='hidden' name='_recordNum' value='{$record['num']}' class='_recordNum' />";
        //$displayValue .= "<input type='hidden' value='$fieldValue' class='_categoryName' />";
        //$displayValue .= "<input type='hidden' value='$depth' class='_categoryDepth' />";
        $displayValue = "<input type='hidden' value='{$parentNum}' class='_categoryParent' />";
        //$displayValue .= "<img style='float:left' src='lib/images/drag.gif' height='6' width='19' class='dragHandle' title='" .
        //                t('Click and drag to change order.').
        //                "' alt='' />";
        if (@$record['depth']) {
            $padding = str_repeat("&nbsp; &nbsp; &nbsp;", @$record['depth']);
            $displayValue .= $padding . ' - ';
        }
        $displayValue .= $fieldValue;
    }
    // display first thumbnail for upload fields
    if (@$fieldSchema['type'] == 'upload') {
        $displayValue = '';
        $upload = @$record[$fieldname][0];
        if ($upload) {
            ob_start();
            showUploadPreview($upload, 50);
            $displayValue = ob_get_clean();
        }
    }
    // display labels for list fields
    #if (@$fieldSchema['type'] == 'list' && $suffix == 'label') { // require ":label" field suffix in future to show labels, just do it automatic for now though.
    if (@$fieldSchema['type'] == 'list') {
        $displayValue = _getListOptionLabelByValue($fieldSchema, $record);
    }
    // display labels for checkboxes
    if (@$fieldSchema['type'] == 'checkbox') {
        if (@$fieldSchema['checkedValue'] || @$fieldSchema['uncheckedValue']) {
            $displayValue = $fieldValue ? @$fieldSchema['checkedValue'] : @$fieldSchema['uncheckedValue'];
        }
    }
    // v2.50 - display formatted textbox content
    if (@$fieldSchema['type'] == 'textbox') {
        if ($fieldSchema['autoFormat']) {
            $displayValue = @$record[$fieldname];
            // overwrite previous htmlencoded value
            $displayValue = preg_replace("/<br\\s*\\/?>\r?\n/", "\n", $displayValue);
            // remove autoformat break tags
            $displayValue = htmlencode($displayValue);
            // html encode content
        }
        $displayValue = nl2br($displayValue);
        // re-add break tags after nextlines
    }
    // return display value
    return array($displayValue, $tdAttributes);
}
?>
</th>
   </tr>
   </thead>

  <!-- table rows -->
  <?php 
$uploadCount = 0;
$uploadRecords = getUploadRecords($tableName, $_REQUEST['fieldName'], @$_REQUEST['num'], @$_REQUEST['preSaveTempId'], @$_REQUEST['uploadNums']);
foreach ($uploadRecords as $uploadRecord) {
    $uploadCount++;
    ?>
   <tr>
     <td style="padding: 2px; text-align: center; vertical-align: top;">
       <?php 
    showUploadPreview($uploadRecord, 150);
    ?>
     </td>

     <td style="padding: 10px; vertical-align: top" valign="top">
       <input type="hidden" name="uploadNums[]" value="<?php 
    echo $uploadRecord['num'];
    ?>
" />
       <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="23"><?php 
    et('Filename:');
    ?>
 &nbsp;</td>
          <td><?php