Views Admin almost completely working.

Need to code moving up and down of columns when adding / editing a new
View.
This commit is contained in:
Andre Lorbach 2008-07-18 17:36:19 +02:00
parent 037356b554
commit 64a92aabf9
7 changed files with 91 additions and 23 deletions

View File

@ -201,14 +201,17 @@ if ( isset($content['ISEDITORNEWVIEW']) && $content['ISEDITORNEWVIEW'] )
// --- Read Columns from Formdata
if ( is_array($_POST['Columns']) )
{
// Copy columns ID's
foreach ($_POST['Columns'] as $myColKey)
$content['SUBCOLUMNS'][$myColKey]['ColFieldID'] = $myColKey;
}
else // One element only
$content['COLUMNS'][$_POST['Columns']]['ColFieldID'] = $_POST['Columns'];
$content['SUBCOLUMNS'][$_POST['Columns']]['ColFieldID'] = $_POST['Columns'];
// ---
// --- Process Columns for display
$i = 0; // Help counter!
foreach ($content['COLUMNS'] as $key => &$myColumn )
foreach ($content['SUBCOLUMNS'] as $key => &$myColumn )
{
// Set Fieldcaption
if ( isset($content[ $fields[$key]['FieldCaptionID'] ]) )
@ -225,12 +228,21 @@ if ( isset($content['ISEDITORNEWVIEW']) && $content['ISEDITORNEWVIEW'] )
// ---
}
// ---
// print_r ( $content['COLUMNS'] );
}
// --- Copy fields data array
$content['FIELDS'] = $fields;
// removed already added fields
foreach ($content['SUBCOLUMNS'] as $key => &$myColumn )
{
if ( isset($content['FIELDS'][$key]) )
unset($content['FIELDS'][$key]);
}
// removed already added fields and set fieldcaption
// set fieldcaption
foreach ($content['FIELDS'] as $key => &$myField )
{
// Set Fieldcaption
@ -273,6 +285,7 @@ if ( isset($_POST['op']) )
$content['ERROR_MSG'] = $content['LN_VIEWS_ERROR_DISPLAYNAMEEMPTY'];
}
// ---
print_r ( $_POST );
if ( !isset($content['ISERROR']) )
{
@ -280,25 +293,62 @@ if ( isset($_POST['op']) )
if ( isset($_POST['subop']) )
{
// Get NewColID
$szNewColID = DB_RemoveBadChars($_POST['newcolumn']);
$szColId = DB_RemoveBadChars($_POST['newcolumn']);
// Add a new Column into our list!
if ( $_POST['subop'] == $content['LN_VIEWS_ADDCOLUMN'] && isset($_POST['newcolumn']) )
{
// Add New entry into columnlist
$content['COLUMNS'][$szNewColID]['ColFieldID'] = $szNewColID;
$content['SUBCOLUMNS'][$szColId]['ColFieldID'] = $szColId;
// Set Fieldcaption
if ( isset($content[ $fields[$szNewColID]['FieldCaptionID'] ]) )
$content['COLUMNS'][$szNewColID]['ColCaption'] = $content[ $fields[$szNewColID]['FieldCaptionID'] ];
if ( isset($content[ $fields[$szColId]['FieldCaptionID'] ]) )
$content['SUBCOLUMNS'][$szColId]['ColCaption'] = $content[ $fields[$szColId]['FieldCaptionID'] ];
else
$content['COLUMNS'][$szNewColID]['ColCaption'] = $szNewColID;
$content['SUBCOLUMNS'][$szColId]['ColCaption'] = $szColId;
// Set CSSClass
$content['COLUMNS'][$szNewColID]['colcssclass'] = count($content['COLUMNS']) % 2 == 0 ? "line1" : "line2";
$content['SUBCOLUMNS'][$szColId]['colcssclass'] = count($content['SUBCOLUMNS']) % 2 == 0 ? "line1" : "line2";
// Remove from fields list as well
if ( isset($content['FIELDS'][$szColId]) )
unset($content['FIELDS'][$szColId]);
}
// else if ()
// {
// }
}
else if ( isset($_POST['subop_delete']) )
{
// Get Column ID
$szColId = DB_RemoveBadChars($_POST['subop_delete']);
// Remove Entry from Columnslist
if ( isset($content['SUBCOLUMNS'][$szColId]) )
unset($content['SUBCOLUMNS'][$szColId]);
// Add removed entry to field list
$content['FIELDS'][$szColId] = $fields[$szColId];
// Set Fieldcaption
if ( isset($content[ $fields[$szColId]['FieldCaptionID'] ]) )
$content['FIELDS'][$szColId]['FieldCaption'] = $content[ $fields[$szColId]['FieldCaptionID'] ];
else
$content['FIELDS'][$szColId]['FieldCaption'] = $szColId;
}
else if ( isset($_POST['subop_moveup']) )
{
// Get Column ID
$szColId = DB_RemoveBadChars($_POST['subop_moveup']);
// Move Entry one UP in Columnslist
}
else if ( isset($_POST['subop_movedown']) )
{
// Get Column ID
$szColId = DB_RemoveBadChars($_POST['subop_movedown']);
// Move Entry one DOWN in Columnslist
}
else // Now SUBOP means normal processing!
{

View File

@ -75,3 +75,11 @@
border:0px solid;
background-color: transparent;
}
.borderlessbuttons
{
border:0px solid;
background-color: transparent;
width:20px;
padding: 0px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 904 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 913 B

View File

@ -435,6 +435,8 @@ function InitFrontEndVariables()
$content['MENU_INTERNAL'] = $content['BASEPATH'] . "images/icons/gear.png";
$content['MENU_EDIT_DISABLED'] = $content['BASEPATH'] . "images/icons/edit_disabled.png";
$content['MENU_DELETE_DISABLED'] = $content['BASEPATH'] . "images/icons/delete_disabled.png";
$content['MENU_MOVE_UP'] = $content['BASEPATH'] . "images/icons/nav_up_blue.png";
$content['MENU_MOVE_DOWN'] = $content['BASEPATH'] . "images/icons/nav_down_blue.png";
$content['MENU_PAGER_BEGIN'] = $content['BASEPATH'] . "images/icons/media_beginning.png";
$content['MENU_PAGER_PREVIOUS'] = $content['BASEPATH'] . "images/icons/media_rewind.png";

View File

@ -170,8 +170,8 @@ $content['LN_VIEWS_ADDEDIT'] = "Add / Edit a View";
$content['LN_VIEWS_COLUMNLIST'] = "Configured Columns";
$content['LN_VIEWS_ADDCOLUMN'] = "Add Column into list";
$content['LN_VIEWS_ERROR_DISPLAYNAMEEMPTY'] = "The DisplayName cannot be empty.";
$content['LN_VIEWS_'] = "";
$content['LN_VIEWS_'] = "";
$content['LN_VIEWS_COLUMN'] = "Column";
$content['LN_VIEWS_COLUMN_REMOVE'] = "Remove Column";
$content['LN_VIEWS_'] = "";
$content['LN_VIEWS_'] = "";
$content['LN_VIEWS_'] = "";

View File

@ -79,21 +79,29 @@
<br>
<table border="0" cellpadding="1" cellspacing="1" bgcolor="#DDDDDD" width="600" class="with_border_alternate">
<tr>
<td align="center" class="cellmenu1" colspan="2"><b>{LN_VIEWS_COLUMNLIST}</b></td>
<td align="center" class="cellmenu1" colspan="3"><b>{LN_VIEWS_COLUMNLIST}</b></td>
</tr>
<!-- BEGIN COLUMNS -->
<!-- BEGIN SUBCOLUMNS -->
<tr>
<td align="left" class="{colcssclass}">
<input type="hidden" name="Columns" value="{ColFieldID}">
<b>{ColFieldID} {ColCaption}</b>
<td align="left" class="cellmenu2" width="150"><b>{LN_VIEWS_COLUMN} {ZAEHLER}: </b></td>
<td align="left" class="{colcssclass}" width="300">
<input type="hidden" name="Columns[]" value="{ColFieldID}">
<b>{ColCaption}</b>
</td>
<td align="right" class="{cssclass}">
&nbsp;<a href="{BASEPATH}admin/views.php?op=delete&id={ID}"><img src="{MENU_DELETE}" width="16" title="{LN_SEARCH_DELETE}"></a>
<td align="center" class="{colcssclass}" width="150">
<button name="subop_moveup" type="submit" value="{ColFieldID}" class="borderlessbuttons" title="{LN_VIEWS_COLUMN_REMOVE}"><img src="{MENU_MOVE_UP}" width="16" alt="{LN_VIEWS_COLUMN_REMOVE}"></button>
<button name="subop_movedown" type="submit" value="{ColFieldID}" class="borderlessbuttons" title="{LN_VIEWS_COLUMN_REMOVE}"><img src="{MENU_MOVE_DOWN}" width="16" alt="{LN_VIEWS_COLUMN_REMOVE}"></button>
<button name="subop_delete" type="submit" value="{ColFieldID}" class="borderlessbuttons" title="{LN_VIEWS_COLUMN_REMOVE}"><img src="{MENU_DELETE}" width="16" alt="{LN_VIEWS_COLUMN_REMOVE}"></button>
<!-- &nbsp;<input type="submit" style="background-image:url({MENU_DELETE}); background-repeat:no-repeat; background-position:center;" class="borderless" name="subop_delete" value="{ColFieldID}">
&nbsp;<input type="image" src="{MENU_DELETE}" alt="{LN_VIEWS_COLUMN_REMOVE}" class="borderless" width="16" name="subop_delete_{ColFieldID}">
-->
</td>
</tr>
<!-- END COLUMNS -->
<!-- END SUBCOLUMNS -->
<tr>
<td align="center" class="line2" colspan="2">
<td align="center" class="line2" colspan="3">
<select name="newcolumn" size="1" STYLE="width: 200px">
<!-- BEGIN FIELDS -->