예제 #1
0
function dais_pagetree($SelectType = 'S', $Default = 0, $Name = 'My Pages', $callback = false, $ValueName, $ID = 0, $Level = 1)
{
    global $wpdb;
    if ($SelectType == 'M') {
        $SelType = '[]';
        $InputType = 'checkbox';
        $SelectLight = 'selector';
    } else {
        $SelType = '';
        $InputType = 'radio';
        $SelectLight = 'bglight';
    }
    $Result = $wpdb->get_results("SELECT ID, post_title FROM {$wpdb->posts} WHERE post_parent = {$ID} AND post_type='page' AND post_status = 'publish'");
    //$Result = mysql_query($Query);
    $Row = 'list_row2';
    $Tree = '';
    foreach ($Result as $Page) {
        $Icon = 'page.png';
        $Script = '';
        if (is_array($Default)) {
            if (in_array($Page->ID, $Default)) {
                $Script = 'checked="checked"';
            }
        }
        $callbackscript = '';
        if (!empty($callback)) {
            $callbackscript = 'onchange="' . $callback . '(this.value);"';
        }
        $Row = dais_rowswitch($Row);
        //$Tree .= '<div style="padding:3px;" class="'.$Row.'"><label for="pageNo'.$Page['ID'].'"><img src="system/dais/images/'.$Icon.'" width="16" height="16" border="0" align="middle" /><input name="Data[Content][PageList]'.$SelType.'" type="'.$InputType.'" id="pageNo'.$Page['ID'].'" value="'.$Page['ID'].'" '.$Script.'  '.$callbackscript.' >'.$Page['Title'].'</label></div>';
        $Tree .= '<div style="padding:3px 3px 3px ' . 3 * ($Level * 4) . 'px;" class="list_row4"><label for="' . $ValueName . '_' . $Page->ID . '"><img src="' . WP_PLUGIN_URL . '/db-toolkit/images/' . $Icon . '" width="16" height="16" border="0" align="absmiddle" /><input name="Data[Content][' . $ValueName . ']' . $SelType . '" type="' . $InputType . '" id="' . $ValueName . '_' . $Page->ID . '" value="' . $Page->ID . '" ' . $Script . '  ' . $callbackscript . ' > ' . $Page->post_title . '</label>';
        $Tree .= '</div>';
        $Tree .= dais_pagetree($SelectType, $Default, $Name, $callback, $ValueName, $Page->ID, $Level + 1);
    }
    return $Tree;
}
예제 #2
0
function di_showItem($EID, $Item, $Setup = false)
{
    $Element = getelement($EID);
    $Config = $Element['Content'];
    $queryJoin = '';
    $queryWhere = array();
    $queryLimit = '';
    $querySelects = array();
    $WhereTag = '';
    $groupBy = '';
    $orderStr = '';
    $countSelect = '';
    // setup columns
    if (!empty($Config['_FormLayout'])) {
        parse_str($Config['_FormLayout'], $Columns);
        if (empty($Columns['FieldList_left'])) {
            unset($Columns);
            unset($Config['_FormLayout']);
        }
    }
    //setup Field Types
    foreach ($Config['_Field'] as $Field => $Type) {
        // explodes to:
        // [0] = Field plugin dir
        // [1] = Field plugin type
        $Config['_Field'][$Field] = explode('_', $Type);
    }
    // field type filters
    $joinIndex = 'a';
    foreach ($Config['_IndexType'] as $Field => $Type) {
        $querySelects[$Field] = 'prim.`' . $Field . '`';
    }
    if (!empty($Config['_CloneField'])) {
        foreach ($Config['_CloneField'] as $CloneKey => $Clone) {
            //echo 'BEFORE';
            //vardump($querySelects);
            foreach ($querySelects as $selectKey => $selectScan) {
                $queryJoin = str_replace($CloneKey, $Clone['Master'], $queryJoin);
                $WhereTag = str_replace($CloneKey, $Clone['Master'], $WhereTag);
                if (strstr($selectScan, " AS ") === false) {
                    //echo $Clone['Master'].' - concat <br />';
                    if (strstr($selectScan, "_sourceid_") === false) {
                        $querySelects[$selectKey] = str_replace($CloneKey, $Clone['Master'] . '` AS `' . $CloneKey, $selectScan);
                    }
                }
            }
            //echo 'After';
            //vardump($querySelects);
        }
    }
    // Build Query
    foreach ($Config['_Field'] as $Field => $Type) {
        // Run Filters that have been set through each field type
        if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Type[0] . '/queryfilter.php')) {
            include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Type[0] . '/queryfilter.php';
        }
        //apply a generic keyword filter to each field is a key word has been sent
        if (!empty($_SESSION['reportFilters'][$EID]['_keywords'])) {
            if ($WhereTag == '') {
                $WhereTag = " WHERE ";
            }
            $keyField = 'prim.' . $Field;
            if (strpos($querySelects[$Field], ' AS ') !== false) {
                $keyField = strtok($querySelects[$Field], ' AS ');
            }
            $preWhere[] = $keyField . " LIKE '%" . $_SESSION['reportFilters'][$EID]['_keywords'] . "%' ";
            //dump($_SESSION['reportFilters'][$EID]);
        }
        $joinIndex++;
    }
    //post clone fixes
    foreach ($querySelects as $fieldToFix => $select) {
        if (!empty($Config['_CloneField'][$fieldToFix])) {
            $cloneReturns[$fieldToFix] = explode(' AS ', $select);
        }
    }
    if (!empty($cloneReturns)) {
        foreach ($cloneReturns as $cloneKey => $cloneField) {
            $pureName = trim(str_replace('prim.', '', $cloneField[0]), '`');
            if (!empty($cloneReturns[$pureName])) {
                $cloneReturns[$cloneKey][0] = $cloneReturns[$pureName][0];
                $querySelects[$cloneKey] = implode(' AS ', $cloneReturns[$cloneKey]);
            }
        }
    }
    // create Query Selects and Where clause string
    $querySelect = implode(',', $querySelects);
    if (!empty($Setup)) {
        $queryWhere = 'prim.' . $Setup['_filterField'] . ' = \'' . $Item . '\'';
    } else {
        $queryWhere = 'prim.' . $Config['_ReturnFields'][0] . ' = \'' . $Item . '\'';
    }
    if (!empty($queryWhere)) {
        $WhereTag = " WHERE ";
    } else {
        $WhereTag = "";
    }
    if (is_array($groupBy)) {
        $groupBy = 'GROUP BY (' . implode(',', $groupBy) . ')';
        $countLimit = '';
        $entryCount = true;
        //add totals selects to count
        if (is_array($countSelect)) {
            $countSelect = ',' . implode(',', $countSelect);
        }
    }
    $Query = "SELECT " . $querySelect . " FROM `" . $Config['_main_table'] . "` AS prim \n " . $queryJoin . " \n " . $WhereTag . " \n " . $queryWhere . "\n " . $groupBy . " \n " . $orderStr . " \n LIMIT 1;";
    // Wrap fields with ``
    //foreach($querySelects as $Field=>$FieldValue){
    //   $Query = str_replace($Field, '`'.$Field.'`', $Query);
    //}
    // Query Results
    //$Res = mysql_query($Query);
    //echo $Query.'<br /><br /><br />';
    //echo mysql_error();
    //vardump($Config['_ReturnFields']);
    //$Data = mysql_fetch_assoc($Res);
    $Data = dr_BuildReportGrid($EID, false, false, false, 'data', false, array($Config['_ReturnFields'][0] => $Item));
    if (!empty($Config['_UseViewTemplate'])) {
        //dump($Config);
        $PreReturn = $Config['_ViewTemplateContentWrapperStart'];
        $PreReturn .= $Config['_ViewTemplatePreContent'];
        $PreReturn .= $Config['_ViewTemplateContent'];
        $PreReturn .= $Config['_ViewTemplatePostContent'];
        $PreReturn .= $Config['_ViewTemplateContentWrapperEnd'];
        //echo $Config['_ViewTemplateContent'];
        $newTitle = 'View Item';
        if (!empty($Config['_ViewFormText'])) {
            $newTitle = $Config['_ViewFormText'];
        }
        foreach ($Config['_Field'] as $Field => $Types) {
            if (!empty($Config['_ViewFormText'])) {
                //dump($Data);
                if (!empty($Data['_outvalue'][$Field])) {
                    $newTitle = str_replace('{{' . $Field . '}}', $Data['_outvalue'][$Field], $newTitle);
                } else {
                    $newTitle = str_replace('{{' . $Field . '}}', $Data[$Field], $newTitle);
                }
            }
            //	dump($Type);
            if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php')) {
                if (!empty($Config['_FieldTitle'][$Field])) {
                    $name = $Config['_FieldTitle'][$Field];
                } else {
                    $name = df_parseCamelCase($Field);
                }
                $PreReturn = str_replace('{{_' . $Field . '_name}}', $name, $PreReturn);
                if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php')) {
                    $Out = false;
                    include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php';
                    $PreReturn = str_replace('{{' . $Field . '}}', $Out, $PreReturn);
                }
                $PreReturn = str_replace('{{_PageID}}', $Element['ParentDocument'], $PreReturn);
                $PreReturn = str_replace('{{_PageName}}', getdocument($Element['ParentDocument']), $PreReturn);
                $PreReturn = str_replace('{{_EID}}', $EID, $PreReturn);
            }
        }
        $Output['title'] = $newTitle;
        $Output['width'] = $Config['_popupWidthview'];
        $Output['html'] = $PreReturn;
        return $Output;
    }
    //dump($Data);
    $Row = 'list_row2';
    $LeftColumn = '';
    $RightColumn = '';
    $FarRightColumn = '';
    //vardump($Config);
    //dump($Config['_Field']);
    if (!empty($Config['_gridViewLayout'])) {
        //$Config['_gridViewLayout'] = str_replace('=viewrow', '=row', $Config['_gridLayoutView']);
        parse_str($Config['_gridViewLayout'], $Layout);
        //vardump($Config['_gridView']);
        //vardump($Layout);
        $Form = '';
        $CurrRow = '0';
        $CurrCol = '0';
        $Index = 0;
        $newTitle = 'View Item';
        if (!empty($Config['_ViewFormText'])) {
            $newTitle = $Config['_ViewFormText'];
        }
        //dump($Setup);
        foreach ($Config['_gridView'] as $row => $cols) {
            $Form .= "<div style=\"clear: both;\" class=\"view-gen-row\" id=\"pg-view-" . $row . "\">\n";
            foreach ($cols as $col => $width) {
                $Form .= "<div class=\"view-" . $row . "-" . $col . "\" style=\"float: left; overflow: hidden; width: " . $width . ";\">\n";
                $Form .= "<div id=\"pg-view-" . $row . "-" . $col . "\" class=\"view-gen-row view-gen-col view-col-" . $col . "\">\n";
                // check for section breaks
                $contentKeys = array_keys($Layout, $row . '_' . $col);
                foreach ($contentKeys as $Field) {
                    $Field = str_replace('View_Field_', '', $Field);
                    $FieldSet = $Config['_Field'][$Field];
                    if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/conf.php') && count($FieldSet) == 2) {
                        include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/conf.php';
                        if (!empty($FieldTypes[$FieldSet[1]]['visible']) && (empty($Config['_CloneField'][$Field]) || !empty($FieldTypes[$FieldSet[1]]['cloneview']))) {
                            // Check if is visible or not
                            $Out = false;
                            $Type = $FieldSet[1];
                            $Types = $FieldSet;
                            $Form .= "<label class=\"view-gen-lable singletext\" for=\"entry_" . $Element['ID'] . "_" . $Field . "\" id=\"lable_" . $Element['ID'] . "_" . $Field . "\">" . $Config['_FieldTitle'][$Field] . "</label>\n";
                            $Form .= "<div class=\"view-gen-field-data-wrapper\" id=\"view-data-" . $Field . "\">\n";
                            //$Val = $Defaults[$Field];]
                            include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/output.php';
                            //$Form = str_replace('{{'.$Field.'}}', $Out, $Form);
                            $Form .= $Out;
                            $Form .= "&nbsp;</div>\n";
                            $Form .= "<span class=\"description\" id=\"caption_" . $Element['ID'] . "_" . $Field . "\">\n";
                            $Form .= $Config['_FieldCaption'][$Field] . '&nbsp';
                            $Form .= "</span>\n";
                        } else {
                            if (empty($FieldTypes[$FieldSet[1]]['visible'])) {
                                ob_start();
                                $Val = $Defaults[$Field];
                                include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $FieldSet[0] . '/input.php';
                                $Hidden .= ob_get_clean();
                            }
                        }
                    } else {
                        if (!empty($Config['_SectionBreak'][$Field])) {
                            $Form .= "<div class=\"sectionbreak\">\n";
                            $Form .= "<h2>" . $Config['_SectionBreak'][$Field]['Title'] . "</h2>\n";
                            if (!empty($Config['_SectionBreak'][$Field]['Caption'])) {
                                $Form .= "<span class=\"description\">" . $Config['_SectionBreak'][$Field]['Caption'] . "</span>\n";
                            }
                            $Form .= "</div>\n";
                        }
                        $Form .= '&nbsp;';
                    }
                }
                if (empty($contentKeys)) {
                    $Form .= '&nbsp;';
                }
                $Form .= "</div>\n";
                $Form .= "</div>\n";
            }
            $Form .= "</div>\n";
        }
        $Form .= '<div style="clear:left;"></div>';
        $Shown = '';
        // add title
        if (!empty($Config['_ViewFormText'])) {
            //dump($Data);
            if (!empty($Data['_outvalue'][$Field])) {
                $newTitle = str_replace('{{' . $Field . '}}', $Data['_outvalue'][$Field], $newTitle);
            } else {
                $newTitle = str_replace('{{' . $Field . '}}', $Data[$Field], $newTitle);
            }
            $Output['title'] = $newTitle;
        }
        $Output['width'] = '420';
        if (!empty($Config['_popupWidthview'])) {
            $Output['width'] = $Config['_popupWidthview'];
        }
        $Output['html'] = '<div class="formular">' . $Form . '</div>';
        if (!empty($Config['_Show_Edit'])) {
            $OutPut['edit'] = true;
        }
        return $Output;
    }
    if (!empty($Config['_FormLayout'])) {
        parse_str($Config['_FormLayout'], $Columns);
        if (empty($Columns['FieldList_left'])) {
            unset($Columns);
            unset($Config['_FormLayout']);
        }
    }
    if (!empty($Columns)) {
        foreach ($Columns as $Key => $Side) {
            if ($Key == 'FieldList_Main') {
                $ColumnSet = 'LeftColumn';
            }
            if ($Key == 'FieldList_left') {
                $ColumnSet = 'RightColumn';
            }
            if ($Key == 'FieldList_right') {
                $ColumnSet = 'FarRightColumn';
            }
            foreach ($Side as $Entry) {
                if (substr($Entry, 0, 12) != 'SectionBreak') {
                    $Row = dais_rowSwitch($Row);
                    $Field = $Entry;
                    $Types = $Config['_Field'][$Field];
                    ${$ColumnSet} .= $FieldSet[1];
                    //ob_start();
                    //dump($Config['_Field']);
                    //$$ColumnSet = ob_get_clean();
                    //$$ColumnSet .= $FieldSet[0].'<br />';
                    if (!empty($Config['_FieldTitle'][$Field])) {
                        $FieldTitle = $Config['_FieldTitle'][$Field];
                    } else {
                        $FieldTitle = df_parsecamelcase($Field);
                    }
                    if (!empty($Types[1])) {
                        include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php';
                        if ($FieldTypes[$Types[1]]['visible'] == true) {
                            $Out = false;
                            $Out = '<div id="lable_' . $Element['ID'] . '_' . $Field . '" for="entry_' . $Element['ID'] . '_' . $Field . '" class="view-gen-lable"><strong>' . $FieldTitle . '</strong></div>';
                            include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php';
                            ${$ColumnSet} .= $Out;
                        }
                    }
                } else {
                    ${$ColumnSet} .= '<h3>' . $Config['_SectionBreak']['_' . $Entry] . '</h3>';
                }
            }
        }
    } else {
        foreach ($Config['_Field'] as $Field => $Types) {
            $Row = dais_rowswitch($Row);
            if (!empty($Types[1])) {
                if (!empty($Config['_FieldTitle'][$Field])) {
                    $FieldTitle = $Config['_FieldTitle'][$Field];
                } else {
                    $FieldTitle = df_parsecamelcase($Field);
                }
                include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php';
                if ($FieldTypes[$Types[1]]['visible'] == true) {
                    $Out = false;
                    $Out = '<div id="lable_' . $Element['ID'] . '_' . $Field . '" for="entry_' . $Element['ID'] . '_' . $Field . '" class="view-gen-lable"><strong>' . $FieldTitle . '</strong></div>';
                    include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/output.php';
                    //echo $Out;
                    if (!empty($Columns)) {
                        if (in_array($Field, $Columns['FieldList_Main'])) {
                            $LeftColumn .= $Out;
                        } elseif (in_array($Field, $Columns['FieldList_left'])) {
                            $RightColumn .= $Out;
                        }
                    } else {
                        $RightColumn .= $Out;
                    }
                }
            }
        }
    }
    if (!empty($Config['_titleField'])) {
        //infobox($Setup['_Prefix'].$Data[$Setup['_titleField']].$Setup['Suffix']);
        $OutPut['title'] = $Config['_Prefix'] . $Data[$Config['_titleField']] . $Config['Suffix'];
    } else {
        //echo '<h2>View Entry</h2>';
        $OutPut['title'] = 'View Entry';
        //$Setup['_Prefix'].$Data[$Setup['_titleField']].$Setup['Suffix'];
    }
    $Return = '<table width="100%" border="0" cellspacing="0" cellpadding="2">
		<tr>';
    $OutPut['width'] = 300;
    if (!empty($LeftColumn)) {
        $ColWidth = '33';
        if (empty($FarRightColumn)) {
            $ColWidth = '50';
        }
        $Return .= '<td width="' . $ColWidth . '%" valign="top">' . $LeftColumn . '</td>';
        $OutPut['width'] = $OutPut['width'] + 100;
    }
    if (!empty($RightColumn)) {
        $Return .= '<td valign="top">' . $RightColumn . '</td>';
        $OutPut['width'] = $OutPut['width'] + 100;
    }
    if (!empty($FarRightColumn)) {
        $Return .= '<td width="33%" valign="top">' . $FarRightColumn . '</td>';
        $OutPut['width'] = $OutPut['width'] + 100;
    }
    $Return .= '</tr>';
    $Return .= '</table>';
    if (!empty($Config['_Show_Edit'])) {
        $OutPut['edit'] = true;
        //$Return .= '<input type="button" value="Edit" class="close" onclick="dr_BuildUpDateForm('.$EID.', '.$Item.');" />';
    }
    if (!empty($Config['_EnableAudit'])) {
        $revres = mysql_query("SELECT count(_ID) as Rev FROM `_audit_" . $Config['_main_table'] . "` WHERE `" . $Config['_ReturnFields'][0] . "` = '" . $Data[$Config['_ReturnFields'][0]] . "';");
        if ($revres) {
            if (mysql_num_rows($revres) == 1) {
                $R = mysql_fetch_assoc($revres);
                $Return .= '<div class="captions">Revision ' . $R['Rev'] . '</div>';
            }
        }
    }
    $OutPut['html'] = $Return;
    return $OutPut;
}
예제 #3
0
             $Dets = pathinfo($File['StoredFilename']);
             $ext = strtolower($Dets['extension']);
             if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/' . $ext . '.gif')) {
                 $Icon = '<img src="' . WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/' . $ext . '.gif" border="0" align="absmiddle" title="' . $File['OriganalFileName'] . '" /> ';
             } else {
                 $Icon = '<img src="' . WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/file.gif" border="0" align="absmiddle" title="' . $File['OriganalFileName'] . '" /> ';
             }
             $Out .= '<div class="' . $Row . '"><a href="' . $File['StoredFilename'] . '" target="_blank">' . $Icon . ' ' . $File['OriganalFileName'] . '</a></div>';
         }
         break;
     }
     //$Values = $Data[$Field];
     $Out = '';
     $Row = 'list_row2';
     foreach ($Values as $Value) {
         $Row = dais_rowswitch($Row);
         $File = explode('|', $Value);
         $Dets = pathinfo($File[1]);
         $ext = strtolower($Dets['extension']);
         if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/' . $ext . '.gif')) {
             $Icon = '<img src="' . WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/' . $ext . '.gif" border="0" align="absmiddle" title="' . $File[1] . '" /> ';
         } else {
             $Icon = '<img src="' . WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/file/icons/file.gif" border="0" align="absmiddle" title="' . $File[1] . '" /> ';
         }
         $Out .= '<div class="' . $Row . '"><a href="' . $File[0] . '" target="_blank">' . $Icon . ' ' . $Dets['basename'] . '</a></div>';
     }
     break;
 } else {
     $File = explode('|', $Value);
     $Dets = pathinfo($File[1]);
     $ext = strtolower($Dets['extension']);
예제 #4
0
 function df_tableReportSetup($Table, $EID, $Config = false, $Column = 'M')
 {
     $PreReturn = array();
     if (empty($Table)) {
         return;
     }
     global $wpdb;
     if ($Column == 'Linking') {
         $result = mysql_query("SHOW COLUMNS FROM `" . $Table . "`");
         if (mysql_num_rows($result) > 0) {
             $Row = 'list_row4';
             while ($row = mysql_fetch_assoc($result)) {
                 //$Row = dais_rowSwitch($Row);
                 $FieldList[] = $row['Field'];
             }
         }
         $Field = '__' . uniqid();
         $name = df_parseCamelCase($Field);
         $name = df_parseCamelCase($Field);
         //echo '<div id="Field_'.$Field.'" class="'.$Row.' table_sorter" style="padding:3px;"><input type="checkbox" name="null" id="use_'.$Field.'" checked="checked" onclick="dr_enableDisableField(this);" />&nbsp;'.ucwords($name).' : '.df_FilterTypes($Field, $Table, $row).'<span id="ExtraSetting_'.$Field.'"></span></div>';
         $PreReturn[$Field] .= '<div id="Field_' . $Field . '" class="admin_list_row3 table_sorter postbox cloned" style="width:550px;"><img src="' . WP_PLUGIN_URL . '/db-toolkit/images/cancel.png" align="absmiddle" onclick="jQuery(\'#Field_' . $Field . '\').remove();" style="float:right; padding:5px;" /><img src="' . WP_PLUGIN_URL . '/db-toolkit/images/cog.png" align="absmiddle" onclick="jQuery(\'#overide_' . $Field . '\').toggle();" style="float:right; padding:5px;" /><h3 class="fieldTypeHandle">' . df_parseCamelCase($Field) . '</h3>';
         // Linking Master
         $PreReturn[$Field] .= '<div style="padding:5px;">';
         $PreReturn[$Field] .= 'Master Field: <select name="Data[Content][_CloneField][' . $Field . '][Master]" id="master_' . $Field . '">';
         foreach ($FieldList as $MasterField) {
             // add default here
             $PreReturn[$Field] .= '<option value="' . $MasterField . '">' . $MasterField . '</option>';
         }
         $PreReturn[$Field] .= '</select>';
         $PreReturn[$Field] .= '</div>';
         $PreReturn[$Field] .= '<div id="overide_' . $Field . '" class="admin_config_panel" style="display:none; position:reletive;">';
         //New Options
         $Justify = '';
         $Width = '';
         $Title = df_parseCamelCase($Field);
         $Caption = '';
         $inlineSel = '';
         $SSel = '';
         $SClass = 'button';
         $USel = '';
         $UClass = 'button';
         $RSel = '';
         $RClass = 'button';
         if (!empty($Config)) {
             if (!empty($Defaults['_WidthOverride'][$Field])) {
                 $Width = $Defaults['_WidthOverride'][$Field];
             }
             if (!empty($Config['Content']['_Required'][$Field])) {
                 $RSel = 'checked="checked"';
                 $RClass = 'button-primary';
             }
             if (empty($Config['Content']['_Sortable'][$Field])) {
                 $SSel = 'checked="checked"';
                 $SClass = 'button-primary';
             }
             if (!empty($Config['Content']['_Unique'][$Field])) {
                 $USel = 'checked="checked"';
                 $UClass = 'button-primary';
             }
             if (!empty($Config['Content']['_FieldTitle'][$Field])) {
                 $Title = $Config['Content']['_FieldTitle'][$Field];
             }
             if (!empty($Config['Content']['_FieldCaption'][$Field])) {
                 $Caption = $Config['Content']['_FieldCaption'][$Field];
             }
             if (!empty($Config['Content']['_InlineEdit'][$Field])) {
                 $inlineSel = 'checked="checked"';
             }
             if (!empty($Config['Content']['_Justify'][$Field])) {
                 $Justify = $Config['Content']['_Justify'][$Field];
             }
         }
         $PreReturn[$Field] .= '<div style="padding:3px;">Title: <input type="text" value="' . $Title . '" name="Data[Content][_FieldTitle][' . $Field . ']" /> ';
         $PreReturn[$Field] .= 'Caption: <input type="text" value="' . $Caption . '" name="Data[Content][_FieldCaption][' . $Field . ']" />';
         $PreReturn[$Field] .= df_FormWidthSetup($Field, $fieldFormWidth);
         $PreReturn[$Field] .= '</div>';
         $PreReturn[$Field] .= '<div style="padding:3px;">List Column Width: <input type="text" style="width:40px;" value="' . $Width . '" name="Data[Content][_WidthOverride][' . $Field . ']" /> ';
         $PreReturn[$Field] .= df_alignmentSetup($Field, $Justify) . '</div>';
         //$PreReturn[$Field] .= '<div class="admin_list_row2">Unique: <input type="checkbox" name="Data[Content][_Unique]['.$Field.']" id="unique_'.$Field.'" '.$USel.' /></div>';
         //$PreReturn[$Field] .= '<div class="admin_list_row1">Reguired: </div>';
         //$PreReturn[$Field] .= '<div class="admin_list_row2">Sortable: </div>';
         //$PreReturn[$Field] .= '<div style="padding:3px;">Inline Editing: <input type="checkbox" name="Data[Content][_InlineEdit]['.$Field.']" id="sortable_'.$Field.'" '.$inlineSel.' /></div>';
         $PreReturn[$Field] .= '</div>';
         $PreReturn[$Field] .= '<div class="admin_config_toolbar"> <div style="float:left; width:180px;">' . df_fieldTypes($Field, $Table, $row, $Defaults['_Field']) . '</div>' . dr_reportListTypes($Field, $Defaults['_IndexType'][$Field]);
         $PreReturn[$Field] .= ' &nbsp;<span class="' . $UClass . '" id="unique_' . $Field . '" onclick="df_setToggle(\'unique_' . $Field . '\');" title="Unique"><span style="background: url(' . WP_PLUGIN_URL . '/db-toolkit/data_report/unique.png) left center no-repeat; padding:5px 8px;"></span></span>';
         $PreReturn[$Field] .= ' &nbsp;<span class="' . $RClass . '" id="required_' . $Field . '" onclick="df_setToggle(\'required_' . $Field . '\');" title="Required"><span style="background: url(' . WP_PLUGIN_URL . '/db-toolkit/data_report/required.png) left center no-repeat; padding:5px 8px;"></span></span>';
         $PreReturn[$Field] .= ' &nbsp;<span class="' . $SClass . '" id="issortable_' . $Field . '" onclick="df_setToggle(\'issortable_' . $Field . '\');" title="Sortable"><span style="background: url(' . WP_PLUGIN_URL . '/db-toolkit/data_report/table_sort.png) left center no-repeat; padding:5px 8px;"></span></span>';
         $PreReturn[$Field] .= '<input style="display:none;" type="checkbox" name="Data[Content][_Unique][' . $Field . ']" id="unique_' . $Field . '_check" ' . $USel . ' />';
         $PreReturn[$Field] .= '<input style="display:none;" type="checkbox" name="Data[Content][_Required][' . $Field . ']" id="required_' . $Field . '_check" ' . $RSel . ' />';
         $PreReturn[$Field] .= '<input style="display:none;" type="checkbox" name="Data[Content][_Sortable][' . $Field . ']" id="issortable_' . $Field . '_check" ' . $SSel . ' />';
         $PreReturn[$Field] .= '<div class="widefat" id="' . $Field . '_FieldTypePanel" style="display:none; text-align:left;"></div>';
         $PreReturn[$Field] .= '</div><div class="admin_config_panel" style="text-align:right;" id="ExtraSetting_' . $Field . '">';
         unset($Types);
         $Types = explode('_', $Defaults['_Field'][$Field]);
         if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php')) {
             include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php';
             $func = $FieldTypes[$Types[1]]['func'];
             if ($func != 'null') {
                 if ($func != '') {
                     $PreReturn[$Field] .= '<div class="admin_list_row3" id="' . $Field . '_configPanel" style="display:none; text-align:left;">';
                     $PreReturn[$Field] .= '<h3>' . $Field . ' Config</h3><div class="admin_config_panel">';
                     $PreReturn[$Field] .= $func($Field, $Table, $Config);
                     $PreReturn[$Field] .= '</div></div>';
                     $PreReturn[$Field] .= '<input type="button" class="button" style="margin-top:5px;" value="Setup" onclick="toggle(\'' . $Field . '_configPanel\');" />';
                 }
             }
         }
         $PreReturn[$Field] .= '</div></div>';
         return $PreReturn[$Field];
     }
     if ($EID == 'false') {
         $Defaults = $Config['Content'];
         $Config['Content']['_main_table'] = $Table;
         //dump($Defaults);
         if (!empty($Defaults['_FormLayout'])) {
             parse_str($Defaults['_FormLayout'], $Columns);
         }
         $Return = '';
         $result = mysql_query("SHOW COLUMNS FROM `" . $Table . "`");
         if (mysql_num_rows($result) > 0) {
             $Row = 'list_row4';
             while ($row = mysql_fetch_assoc($result)) {
                 //$Row = dais_rowSwitch($Row);
                 $FieldList[] = $row['Field'];
                 $Field = $row['Field'];
                 $PreReturn[$Field] = df_makeFieldConfigBox($Field, $Config, $Defaults);
             }
         }
         if (!empty($Defaults['_Field']) && $Column != 'N') {
             foreach ($Defaults['_Field'] as $Key => $Value) {
                 if (!empty($PreReturn[$Key])) {
                     $Return .= $PreReturn[$Key];
                     unset($PreReturn[$Key]);
                 } else {
                     //if(substr($Key,0,2) == '__'){
                     $Return .= df_makeFieldConfigBox($Key, $Config, $Defaults);
                     //}
                 }
             }
         }
         if (!empty($PreReturn)) {
             foreach ($PreReturn as $Key => $newFields) {
                 $Return .= $newFields;
             }
         }
     } else {
         $Ref = getelement($EID);
         $Return = '';
         $Row = 'list_row2';
         foreach ($Ref['Content']['_Field'] as $Field => $FieldSet) {
             $Row = dais_rowswitch($Row);
             //$Return .= '<div id="Field_'.$Field.'" class="'.$Row.' table_sorter" style="padding:3px;"><img src="'.WP_PLUGIN_DIR.'/db-toolkit/data_report/arrow_out.png" align="absmiddle" class="OrderSorter" />&nbsp;<img src="'.WP_PLUGIN_DIR.'/db-toolkit/data_report/tag.png" align="absmiddle" onclick="jQuery(\'#overide_'.$Field.'\').toggle();" /><input type="texfield" style="width:40px; display:none;" name="Data[Content][_WidthOverride]['.$Field.']" id="overide_'.$Field.'" /> &nbsp;'.df_parseCamelCase($Field).' : '.df_FilterTypes($Field, $Table, $row).'<span id="ExtraSetting_'.$Field.'"></span></div>';
             $Return .= '<div id="Field_' . $Field . '" class="' . $Row . ' table_sorter" style="padding:3px;"><img src="' . WP_PLUGIN_DIR . '/db-toolkit/data_report/arrow_out.png" align="absmiddle" class="OrderSorter" />';
             $Return .= '&nbsp;<img src="' . WP_PLUGIN_DIR . '/db-toolkit/data_report/tag.png" align="absmiddle" onclick="jQuery(\'#overide_' . $Field . '\').toggle();" /><span id="overide_' . $Field . '" style="display:none;">';
             //New Options
             $Return .= '&nbsp;Width: <input type="texfield" style="width:40px;" name="Data[Content][_WidthOverride][' . $Field . ']" />&nbsp;';
             $Return .= df_alignmentSetup($Field);
             $Return .= '</span> &nbsp;' . df_parseCamelCase($Field) . ' : ' . dr_reportListTypes($Field, $Ref['Content']['_IndexType']) . df_fieldTypes($Field, $Table, $row, $Ref['Content']['_Field']) . '<span id="ExtraSetting_' . $Field . '">';
             $Types = explode('_', $FieldSet);
             if (file_exists(WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php')) {
                 include WP_PLUGIN_DIR . '/db-toolkit/data_form/fieldtypes/' . $Types[0] . '/conf.php';
                 $func = $FieldTypes[$Types[1]]['func'];
                 if ($func != 'null') {
                     $Return .= '<div style="padding:3px; text-align:right;"><input type="button" class="button" style="margin-top:5px;" value="Setup" onclick="toggle(\'' . $Field . '_configPanel\');" /></div>';
                     $Return .= '<blockquote id="' . $Field . '_configPanel">';
                     $Return .= '<h3>' . $Field . ' Config</h3>';
                     $Return .= $func($Field, $Table, $Ref);
                     $Return .= '</blockquote>';
                 }
             }
             $Return .= '</span></div>';
             //df_fieldTypes($Field, $Table, $row, $Defaults)
         }
         $Return .= '<input type="hidden" id="referencePage" style="width:40px;" name="Data[Content][_ReferencePage]" value="' . $Ref['ParentDocument'] . '" />';
     }
     return $Return;
 }