[geeklog-cvs] geeklog-1.3/public_html/admin block.php,1.52,1.53
blaine at geeklog.net
blaine at geeklog.net
Sun Nov 16 16:30:37 EST 2003
- Previous message (by thread): [geeklog-cvs] geeklog-1.3/public_html article.php,1.36,1.37 comment.php,1.46,1.47
- Next message (by thread): [geeklog-cvs] geeklog-1.3/public_html/layout/Digital_Monochrome/admin/block listside.thtml,NONE,1.1 listblocks.thtml,1.4,1.5 listitem.thtml,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /usr/cvs/geeklog/geeklog-1.3/public_html/admin
In directory geeklog_prod:/tmp/cvs-serv26080/public_html/admin
Modified Files:
block.php
Log Message:
Added enhanced Block Administration based on Concept from stratosfear. Able to move blocks Left/Right and UP/DN and enable/disable block all from the block listing.
Index: block.php
===================================================================
RCS file: /usr/cvs/geeklog/geeklog-1.3/public_html/admin/block.php,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** block.php 31 Jul 2003 12:10:44 -0000 1.52
--- block.php 16 Nov 2003 21:30:35 -0000 1.53
***************
*** 198,202 ****
$block_templates->set_var('start_block_editor', COM_startBlock ($LANG21[3],
'', COM_getBlockTemplate ('_admin_block', 'header')));
!
if ($A['type'] != 'layout') {
if (!empty($bid) && SEC_hasrights('block.delete')) {
--- 198,202 ----
$block_templates->set_var('start_block_editor', COM_startBlock ($LANG21[3],
'', COM_getBlockTemplate ('_admin_block', 'header')));
!
if ($A['type'] != 'layout') {
if (!empty($bid) && SEC_hasrights('block.delete')) {
***************
*** 272,285 ****
next($usergroups);
}
! $groupdd .= '</select>' . LB;
} else {
// They can't set the group then
$groupdd.= DB_getItem($_TABLES['groups'],'grp_name',"grp_id = '{$A['group_id']}'")
! .'<input type="hidden" name="group_id" value="'.$A['group_id'].'">';
}
$block_templates->set_var('group_dropdown', $groupdd);
$block_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
$block_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
! $block_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']));
$block_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
$block_templates->set_var('lang_phpblockoptions', $LANG21[28]);
--- 272,285 ----
next($usergroups);
}
! $groupdd .= '</select>' . LB;
} else {
// They can't set the group then
$groupdd.= DB_getItem($_TABLES['groups'],'grp_name',"grp_id = '{$A['group_id']}'")
! .'<input type="hidden" name="group_id" value="'.$A['group_id'].'">';
}
$block_templates->set_var('group_dropdown', $groupdd);
$block_templates->set_var('lang_permissions', $LANG_ACCESS['permissions']);
$block_templates->set_var('lang_perm_key', $LANG_ACCESS['permissionskey']);
! $block_templates->set_var('permissions_editor', SEC_getPermissionsHTML($A['perm_owner'],$A['perm_group'],$A['perm_members'],$A['perm_anon']));
$block_templates->set_var('lang_permissions_msg', $LANG_ACCESS['permmsg']);
$block_templates->set_var('lang_phpblockoptions', $LANG21[28]);
***************
*** 436,440 ****
. COM_siteFooter ();
}
!
return $retval;
}
--- 436,440 ----
. COM_siteFooter ();
}
!
return $retval;
}
***************
*** 448,455 ****
global $_CONF, $_TABLES, $LANG21, $LANG32, $LANG_ACCESS;
$retval = '';
$block_templates = new Template($_CONF['path_layout'] . 'admin/block');
! $block_templates->set_file(array('list'=>'listblocks.thtml', 'row'=>'listitem.thtml'));
$retval .= COM_startBlock ($LANG21[19], '',
--- 448,456 ----
global $_CONF, $_TABLES, $LANG21, $LANG32, $LANG_ACCESS;
+ // Added enhanced Block admin based on concept from stratosfear
$retval = '';
$block_templates = new Template($_CONF['path_layout'] . 'admin/block');
! $block_templates->set_file(array('list'=>'listblocks.thtml', 'row'=>'listitem.thtml', 'leftRight'=>'listside.thtml'));
$retval .= COM_startBlock ($LANG21[19], '',
***************
*** 465,469 ****
$block_templates->set_var('lang_blocktype', $LANG21[22]);
$block_templates->set_var('lang_side', $LANG21[39]);
- $block_templates->set_var('lang_blockorder', $LANG21[23]);
$block_templates->set_var('lang_blocktopic', $LANG21[24]);
$block_templates->set_var('lang_enabled', $LANG21[53]);
--- 466,469 ----
***************
*** 471,476 ****
--- 471,483 ----
$result = DB_query("SELECT * FROM {$_TABLES['blocks']} ORDER BY onleft DESC,blockorder");
$nrows = DB_numRows($result);
+ $hasPrintedRight = false;
+ $blockOrd = 10;
+ $stepNumber = 10;
for ($i = 0; $i < $nrows; $i++) {
+ if ($i == 0) {
+ $block_templates->set_var('side', $LANG21[40]);
+ $block_templates->parse('blocklist_item', 'leftRight', true);
+ }
$A = DB_fetchArray($result);
***************
*** 492,498 ****
if ($A['is_enabled'] == 1) {
! $enabled = $LANG32[20];
} else {
! $enabled = $LANG32[21];
}
$block_templates->set_var ('block_enabled', $enabled);
--- 499,505 ----
if ($A['is_enabled'] == 1) {
! $block_templates->set_var('enabled', "checked");
} else {
! $block_templates->set_var('enabled', "");
}
$block_templates->set_var ('block_enabled', $enabled);
***************
*** 500,510 ****
if ($A['onleft'] == 1) {
$side = $LANG21[40];
} else {
$side = $LANG21[41];
}
! $block_templates->set_var('block_side', $side);
! $block_templates->set_var('block_order', $A['blockorder']);
$block_templates->set_var('block_topic', $A['tid']);
$block_templates->parse('blocklist_item', 'row', true);
}
}
--- 507,539 ----
if ($A['onleft'] == 1) {
$side = $LANG21[40];
+ $blockcontrol_image = 'block-right.gif';
+ $moveTitleMsg = $LANG21[59];
+ $switchside = '1';
} else {
+ $blockcontrol_image = 'block-left.gif';
+ $moveTitleMsg = $LANG21[60];
+ $switchside = '0';
+ if (!$hasPrintedRight) {
+ $block_templates->set_var('side', $LANG21[41]);
+ $block_templates->parse('blocklist_item', 'leftRight', true);
+ $hasPrintedRight = true;
+ $blockOrd = 10;
+ }
$side = $LANG21[41];
}
! $block_templates->set_var('blockcontrol_image', $blockcontrol_image);
! $block_templates->set_var('switchside', $switchside);
! $block_templates->set_var('upTitleMsg', $LANG21[58]);
! $block_templates->set_var('moveTitleMsg', $moveTitleMsg);
! $block_templates->set_var('dnTitleMsg', $LANG21[57]);
! if ($A['blockorder'] != $blockOrd) {
! $q = "UPDATE `" . $_TABLES['blocks'] . "` SET `blockorder` = ' " .
! $blockOrd . "' WHERE `bid` = '" . $A['bid'] ."'";
! DB_query($q);
! }
! $block_templates->set_var('block_order', $blockOrd);
$block_templates->set_var('block_topic', $A['tid']);
$block_templates->parse('blocklist_item', 'row', true);
+ $blockOrd += $stepNumber;
}
}
***************
*** 517,520 ****
--- 546,608 ----
}
+ /**
+ * Move blocks UP, Down and Switch Sides - Left and Right
+ *
+ */
+
+ function moveBlock() {
+
+ global $HTTP_GET_VARS,$_CONF, $_TABLES, $LANG21;
+ $retval = '';
+
+ $bid = $HTTP_GET_VARS['bid'];
+ $where = $HTTP_GET_VARS['where'];
+
+ // if the block id exists
+ if (DB_count($_TABLES['blocks'], "bid", $bid) == 1) {
+
+ switch ($where) {
+
+ case ("up"): $q = "UPDATE `" . $_TABLES['blocks'] . "` SET blockorder = blockorder-11 WHERE `bid` = '" . $bid . "'";
+ DB_query($q);
+ break;
+
+ case ("dn"): $q = "UPDATE `" . $_TABLES['blocks'] . "` SET blockorder = blockorder+11 WHERE `bid` = '" . $bid . "'";
+ DB_query($q);
+ break;
+
+ case ("0"): $q = "UPDATE `" . $_TABLES['blocks'] . "` SET `onleft` = '1', blockorder = blockorder-1 WHERE `bid` = '" . $bid ."'";
+ DB_query($q);
+ break;
+
+ case ("1"): $q = "UPDATE `" . $_TABLES['blocks'] . "` SET `onleft` = '0',blockorder = blockorder-1 WHERE `bid` = '" . $bid ."'";
+ DB_query($q);
+ break;
+ }
+
+ } else {
+ COM_errorLOG("block admin error: Attempt to move an non existing block id: $bid");
+ }
+ echo COM_refresh($_CONF['site_admin_url'] . "/block.php");
+ exit;
+ return $retval;
+ }
+
+
+ /**
+ * Enable and Disable block
+ */
+ function changeBlockStatus($bid) {
+ global $_TABLES,$_CONF;
+ if (DB_getItem($_TABLES['blocks'],"is_enabled", "bid=$bid")) {
+ DB_query("UPDATE {$_TABLES['blocks']} set is_enabled = '0' WHERE bid=$bid");
+ return;
+ } else {
+ DB_query("UPDATE {$_TABLES['blocks']} set is_enabled = '1' WHERE bid=$bid");
+ return;
+ }
+ }
+
+
// MAIN
if (isset ($HTTP_POST_VARS['mode'])) {
***************
*** 531,537 ****
}
if (($mode == $LANG21[56]) && !empty ($LANG21[56])) { // delete
if (!isset ($bid) || empty ($bid) || ($bid == 0)) {
! COM_errorLog ('Attempted to delete block bid=' . $bid);
$display .= COM_refresh ($_CONF['site_admin_url'] . '/block.php');
} else {
--- 619,629 ----
}
+ if (isset($HTTP_POST_VARS['blkChange'])) {
+ changeBlockStatus($HTTP_POST_VARS['blkChange']);
+ }
+
if (($mode == $LANG21[56]) && !empty ($LANG21[56])) { // delete
if (!isset ($bid) || empty ($bid) || ($bid == 0)) {
! COM_errorLog ('Attempted to delete block, bid empty or null, value =' . $bid);
$display .= COM_refresh ($_CONF['site_admin_url'] . '/block.php');
} else {
***************
*** 546,550 ****
.editblock($bid)
.COM_siteFooter();
! } else { // 'cancel' or no mode at all
$display .= COM_siteHeader()
.COM_showMessage($msg)
--- 638,647 ----
.editblock($bid)
.COM_siteFooter();
! } else if ($mode == "move") {
! $display .= COM_siteHeader();
! $display .= moveBlock();
! $display .= listblocks();
! $display .= COM_siteFooter();
! } else { // 'cancel' or no mode at all
$display .= COM_siteHeader()
.COM_showMessage($msg)
***************
*** 555,557 ****
echo $display;
! ?>
--- 652,654 ----
echo $display;
! ?>
\ No newline at end of file
- Previous message (by thread): [geeklog-cvs] geeklog-1.3/public_html article.php,1.36,1.37 comment.php,1.46,1.47
- Next message (by thread): [geeklog-cvs] geeklog-1.3/public_html/layout/Digital_Monochrome/admin/block listside.thtml,NONE,1.1 listblocks.thtml,1.4,1.5 listitem.thtml,1.4,1.5
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the geeklog-cvs
mailing list