StefanL
New Member
![New Member New Member](modules/Forums/images/ranks/1star.gif)
![](modules/Forums/images/avatars/gallery/blank.gif)
Joined: Sep 20, 2003
Posts: 5
|
Posted:
Wed Sep 24, 2003 1:50 pm |
|
I have done some 'cosmetic' changes in Raven's 'Site Navigation Block'. Changes:
* Added closing '</OPTION>' tags. * In Admin mode, you will now not get any error pages when you click on '--------', 'Invisible Modules' and 'Inactive Modules'.
Find in block-Modules.php:Code: /* Now we make the Modules block with the correspondent links */
$content .= "<SELECT NAME=\"name\" SIZE=\"8\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">";
$content .= "<OPTION VALUE=\"index.php\"><big>·</big> "._HOME;
// $content .= "<strong><big>·</big></strong> <a href=\"index.php\">"._HOME."</a><br>\n";
$sql = "SELECT title, custom_title, view FROM ".$prefix."_modules WHERE active='1' AND title!='$def_module' AND inmenu='1' ORDER BY custom_title ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$m_title = $row[title];
$custom_title = $row[custom_title];
$view = $row[view];
$m_title2 = ereg_replace("_", " ", $m_title);
if ($custom_title != "") {
$m_title2 = $custom_title;
}
if ($m_title != $main_module) {
if ((is_admin($admin) AND $view == 2) OR $view != 2) {
$content .= "<OPTION VALUE=\"modules.php?name=$m_title\"><big>·</big> $m_title2";
// $content .= "<strong><big>·</big></strong> <a href=\"modules.php?name=$m_title\">$m_title2</a><br>\n";
}
}
}
/* If you're Admin you and only you can see Inactive modules and test it */
/* If you copied a new module is the /modules/ directory, it will be added to the database */
if (is_admin($admin)) {
$handle=opendir('modules');
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$modlist .= "$file ";
}
}
closedir($handle);
$modlist = explode(" ", $modlist);
sort($modlist);
for ($i=0; $i < sizeof($modlist); $i++) {
if($modlist[$i] != "") {
$sql = "SELECT mid FROM ".$prefix."_modules WHERE title='$modlist[$i]'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$mid = $row[mid];
if ($mid == "") {
$db->sql_query("INSERT INTO ".$prefix."_modules VALUES (NULL, '$modlist[$i]', '$modlist[$i]', '0', '0', '1')");
}
}
}
$content .= "<option>--------<option>"._INVISIBLEMODULES;
// $content .= "<option><font class=\"tiny\">"._ACTIVEBUTNOTSEE."</font>";
$sql = "SELECT title, custom_title FROM ".$prefix."_modules WHERE active='1' AND inmenu='0' ORDER BY title ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$mn_title = $row[title];
$custom_title = $row[custom_title];
$mn_title2 = ereg_replace("_", " ", $mn_title);
if ($custom_title != "") {
$mn_title2 = $custom_title;
}
if ($mn_title2 != "") {
$content .= "<OPTION VALUE=\"modules.php?name=$mn_title\"><big>·</big> $mn_title2";
$dummy = 1;
} else {
$a = 1;
}
}
if ($a == 1 AND $dummy != 1) {
$content .= "<strong><big>·</big></strong> <i>"._NONE."</i><br>\n";
}
$content .= "<option>--------<option>"._NOACTIVEMODULES;
// $content .= "<font class=\"tiny\">"._FORADMINTESTS."</font></center><br>";
$sql = "SELECT title, custom_title FROM ".$prefix."_modules WHERE active='0' ORDER BY title ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$mn_title = $row[title];
$custom_title = $row[custom_title];
$mn_title2 = ereg_replace("_", " ", $mn_title);
if ($custom_title != "") {
$mn_title2 = $custom_title;
}
if ($mn_title2 != "") {
$content .= "<OPTION VALUE=\"modules.php?name=$mn_title\"><big>·</big> $mn_title2";
$dummy = 1;
} else {
$a = 1;
}
}
$content .= "</select>";
if ($a == 1 AND $dummy != 1) {
$content .= "<strong><big>·</big></strong> <i>"._NONE."</i><br>\n";
}
}
?>
|
Replace it with:
Code: /* Now we make the Modules block with the correspondent links */
$content .= "<script language=\"JavaScript\">function gotoURL(dropDown) { URL=dropDown.options[dropDown.selectedIndex].value; if(URL.length>0) { top.location.href = URL; } } </script>";
$content .= "<SELECT NAME=\"name\" SIZE=\"8\" onChange=\"gotoURL(this)\">";
// $content .= "<SELECT NAME=\"name\" SIZE=\"8\" onChange=\"top.location.href=this.options[this.selectedIndex].value\">";
$content .= "<OPTION VALUE=\"index.php\"><big>·</big> "._HOME."</OPTION>";
// $content .= "<strong><big>·</big></strong> <a href=\"index.php\">"._HOME."</a><br>\n";
$sql = "SELECT title, custom_title, view FROM ".$prefix."_modules WHERE active='1' AND title!='$def_module' AND inmenu='1' ORDER BY custom_title ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$m_title = $row[title];
$custom_title = $row[custom_title];
$view = $row[view];
$m_title2 = ereg_replace("_", " ", $m_title);
if ($custom_title != "") {
$m_title2 = $custom_title;
}
if ($m_title != $main_module) {
if ((is_admin($admin) AND $view == 2) OR $view != 2) {
$content .= "<OPTION VALUE=\"modules.php?name=$m_title\"><big>·</big> $m_title2</OPTION>";
// $content .= "<strong><big>·</big></strong> <a href=\"modules.php?name=$m_title\">$m_title2</a><br>\n";
}
}
}
/* If you're Admin you and only you can see Inactive modules and test it */
/* If you copied a new module is the /modules/ directory, it will be added to the database */
if (is_admin($admin)) {
$handle=opendir('modules');
while ($file = readdir($handle)) {
if ( (!ereg("[.]",$file)) ) {
$modlist .= "$file ";
}
}
closedir($handle);
$modlist = explode(" ", $modlist);
sort($modlist);
for ($i=0; $i < sizeof($modlist); $i++) {
if($modlist[$i] != "") {
$sql = "SELECT mid FROM ".$prefix."_modules WHERE title='$modlist[$i]'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$mid = $row[mid];
if ($mid == "") {
$db->sql_query("INSERT INTO ".$prefix."_modules VALUES (NULL, '$modlist[$i]', '$modlist[$i]', '0', '0', '1')");
}
}
}
$content .= "<OPTION VALUE=\"\">--------</OPTION><OPTION VALUE=\"\">"._INVISIBLEMODULES."</OPTION>";
// $content .= "<option><font class=\"tiny\">"._ACTIVEBUTNOTSEE."</font>";
$sql = "SELECT title, custom_title FROM ".$prefix."_modules WHERE active='1' AND inmenu='0' ORDER BY title ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$mn_title = $row[title];
$custom_title = $row[custom_title];
$mn_title2 = ereg_replace("_", " ", $mn_title);
if ($custom_title != "") {
$mn_title2 = $custom_title;
}
if ($mn_title2 != "") {
$content .= "<OPTION VALUE=\"modules.php?name=$mn_title\"><big>·</big> $mn_title2";
$dummy = 1;
} else {
$a = 1;
}
}
if ($a == 1 AND $dummy != 1) {
$content .= "<strong><big>·</big></strong> <i>"._NONE."</i><br>\n";
}
$content .= "<OPTION VALUE=\"\">--------</OPTION><OPTION VALUE=\"\">"._NOACTIVEMODULES."</OPTION>";
// $content .= "<font class=\"tiny\">"._FORADMINTESTS."</font></center><br>";
$sql = "SELECT title, custom_title FROM ".$prefix."_modules WHERE active='0' ORDER BY title ASC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$mn_title = $row[title];
$custom_title = $row[custom_title];
$mn_title2 = ereg_replace("_", " ", $mn_title);
if ($custom_title != "") {
$mn_title2 = $custom_title;
}
if ($mn_title2 != "") {
$content .= "<OPTION VALUE=\"modules.php?name=$mn_title\"><big>·</big> $mn_title2";
$dummy = 1;
} else {
$a = 1;
}
}
$content .= "</select>";
if ($a == 1 AND $dummy != 1) {
$content .= "<strong><big>·</big></strong> <i>"._NONE."</i><br>\n";
}
}
?>
|
|
|
|
Raven
Site Admin/Owner
![](modules/Forums/images/avatars/45030c033f18773153cd2.gif)
Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Wed Sep 24, 2003 3:52 pm |
|
Very nice indeed! I can't tell you how long ago I made that, but I quickly hacked it for my own use and then people started asking for it to the point that I just zipped it and made it availavle. Thanks! I will get this out ASAP. |
|
|