a much needed hack - backend subpaging...

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

a much needed hack - backend subpaging...

Post by Fulvio Romanin »

ok ladies and gents, here it is: imho, one of the most necessary features missing in phpwcms; the backend subpaging.
Phpwcms needed something like this: handling hundreds of articles to fake a news system was crazy as sh*t in large sites. Since keywords can categorize articles, the main problem was now the impossibility to handle backend levels with like 200 articles or even more. (Allright, phpwcms ain't born to handle such tasks, but it's getting SO big so we should improve it!) :)
Today i was having dinner with a couple friends of mine, both working with php and custom-built cms's and one of the guys offered to "give a look" to my problem (of course, yes, i'll pay him...). And in less than one day he did the job i was waiting for like two years! :)
There it is:

Image

of course it's a hack. You can't have reptags in the backend. :)
(wow, backend reptags - what interesting concept, oliver! :shock:)
Actually i don't even know which files he changed - i just got back on the site and -shazam - found it working. But it's such a relief for me to see such feature implemented i had to share it with you even if the hack is not yet finished! :D
Man, it was TWO YEARS i needed this! ;)

Actually there are a couple bugs yet: if you click the first time on the subsequent number, the level gets closed, and yet you can't transfer articles from one subtable to another (feature unneeded in news systems, though, if you just think about it). I guess those will be fixed too quite early, and, as long as i'll get my hands on the hacked files, i'll just post them here (give us at least a week...). :)

man, i'm happy 8)
Completeness is reached through subtraction, not through addition
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Sounds real good Fulvio ;)
Let's hope Oliver can check and approve this nice improvement and integrate it... :wink: 8)
Thanks for sharing :D
Oh.. do you think this script can adapt also to content parts (long listings) :roll:

Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

Fulvio, stop it :!: you're ashaming the whole community with ur:

1) waaaauuuw sites!
2) damn usefull hacks!

How can we, humble humans, keep up? :oops: ... ;)

Great thing u did there! Thx

Cheers
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

@ studioZ: no, actually this is thought just for articles; never even THOUGHT about that chance :|

@ kosse: stop that ;) :oops: - if you knew how much i consider myself inconsistant as a designer, you'll just wonder how i can keep up doing this as a work :)
Completeness is reached through subtraction, not through addition
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

there it is, yet uncommented (sorry). Works fine with 1.2.5; i tried with 1.2.1 but wasn't working :| - will check that later. I tested it on a couple sites and it's fine.... file is include/inc_lib/admin.functions.inc.php

Code: Select all

<?php
/*************************************************************************************
   Copyright notice

   (c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.

   This script is part of PHPWCMS. The PHPWCMS web content management system is
   free software; you can redistribute it and/or modify it under the terms of
   the GNU General Public License as published by the Free Software Foundation;
   either version 2 of the License, or (at your option) any later version.

   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
   A copy is found in the textfile GPL.txt and important notices to the license
   from the author is found in LICENSE.txt distributed with these scripts.

   This script is distributed in the hope that it will be useful, but WITHOUT ANY
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
   PARTICULAR PURPOSE.  See the GNU General Public License for more details.

   This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/

//26-04-2004 Oliver Georgi -> $level seems to be unused
//19-11-2004 Fernando Batista -> Copy article, Copy strutures :http://fernandobatista.web.pt
//31-03-2005 Fernando Batista -> copy&cut Article Content :http://fernandobatista.web.pt

function struct_list ($id, $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode=1, $forbid_cut=0, $forbid_copy=0, $counter=0) {

        $counter++;
        $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".intval($id)." ORDER BY acat_sort;";
        if($result = mysql_query($sql, $dbcon) or die("error while browsing structure".$sql)) {
                $count_row = 0;
                while($row = mysql_fetch_array($result)) {
                        //$struct[$sx] = $row; $sx++;
                        $struct[$count_row] = $row;
                        $count_row++;
                }
                mysql_free_result($result);

                if(isset($struct[0])) {
                        foreach($struct as $key => $value) {
                               struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon);
                        }
                }
        }
}

function struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon) {

        $page_val                = ($listmode) ? "do=admin&p=6" : "do=articles";
        $child_count        = get_root_childcount($struct[$key]["acat_id"], $dbcon);
        $child_sort         = (($child_count+1)*10);

        $forbid_cut                = ($struct[$key]["acat_struct"] == $cut_id || $forbid_cut) ? 1 : 0;
        $forbid_copy               = ($struct[$key]["acat_struct"] == $copy_id || $forbid_copy) ? 1 : 0;

        $an = html_specialchars($struct[$key]["acat_name"]);
        $a  = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
        $a .= "<td width=\"450\">";
        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n";
        $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+(14*($counter-1)))."\" height=\"1\">"; //14
        $a .= ($child_count) ? "<a href=\"phpwcms.php?".$page_val."&open=".$struct[$key]["acat_id"].":".((!empty($_SESSION["structure"][$struct[$key]["acat_id"]]))?0:1)."\">" : "";
        $a .= "<img src=\"img/symbole/plus_".(($child_count) ? ((!empty($_SESSION["structure"][ $struct[$key]["acat_id"] ])) ? "close" : "open") : "empty");
        $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($child_count) ? "</a>" : "");
        $a .= "<img src=\"img/symbole/page_".((!$struct[$key]["acat_hidden"])?1:7).".gif\" width=\"11\" height=\"15\" ";
        $a .= getAltTitle('ID: '.$struct[$key]["acat_id"].($struct[$key]["acat_alias"] ? " \nALIAS: ".html_specialchars($struct[$key]["acat_alias"]) : ""));
        $a .= "></td>\n";
        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
        $a .= "<td class=\"dir\"><strong>".$an."</strong></td>\n</tr>\n</table></td>\n<td width=\"88\" nowrap>";

        $a .= listmode_edits ($listmode,$struct,$key,$an,$copy_article_content,$cut_article_content,$copy_article,$copy_id,$cut_article,$cut_id,$forbid_cut,$forbid_copy,$count_row,$child_sort);

        $a .= "</td>\n</tr>\n";
        echo $a;

        if(isset($_SESSION["structure"][$struct[$key]["acat_id"]]) && $_SESSION["structure"][$struct[$key]["acat_id"]]) {

                if(!$listmode) {
					struct_articlelist ($struct[$key]["acat_id"], $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $struct[$key]["acat_order"]);
				}

                //26-04-2004 Oliver Georgi
                //struct_list ($struct[$key]["acat_id"], $dbcon, $cut_id, $cut_article, $listmode, $forbid_cut, $counter, $level);
                //$level seems to be unused
                struct_list ($struct[$key]["acat_id"], $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode, $forbid_cut, $forbid_copy, $counter);

        }

}

function get_root_childcount($id, $dbcon) {
        //Ermittelt Anzahl bereits vorhandener aktiver Unterlevels
        $p1_count = $p2_count = 0;
        $id = intval($id);
        if($p_result = mysql_query("SELECT COUNT(acat_id) FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".$id.";", $dbcon)) {
                if($p_row = mysql_fetch_row($p_result)) $p1_count = $p_row[0];
                mysql_free_result($p_result);
        }
        if($p_result = mysql_query("SELECT COUNT(article_id) FROM ".DB_PREPEND."phpwcms_article WHERE article_deleted=0 AND article_cid=".$id.";", $dbcon)) {
                if($p_row = mysql_fetch_row($p_result)) $p2_count = $p_row[0];
                mysql_free_result($p_result);
        }
        return $p1_count + $p2_count;
}

//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
function get_article_content_count($id, $dbcon) {
        $p_count = 0;
        $id = intval($id);
        if($p_result = mysql_query("SELECT COUNT(acontent_id) FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_trash=0 AND acontent_aid=".$id.";", $dbcon)) {
                if($p_row = mysql_fetch_row($p_result)) $p_count = $p_row[0];
                mysql_free_result($p_result);
        }
        return $p_count;
}
//31-03-2005 Fernando Batista  end-------------------

function struct_articlelist ($struct_id, $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $article_order=0) {

        $count_article        = 0;
        $article_order        = intval($article_order);
        $show_sort = (!$article_order || $article_order == 1) ? 1 : 0;
		$offset=($_GET[$struct_id."_offset"]!="") ? $_GET[$struct_id."_offset"] : 0;
		$records=($_GET["records"]!="") ? $_GET["records"] : 15;

        $ao = get_order_sort($article_order);
        echo "\n\n\n".'<!-- ORDER: '.$ao[2].' //-->'."\n\n\n";

        $sql_count =        "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ".
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ".
        "ORDER BY ".$ao[2].";";
		if($result = mysql_query($sql_count, $GLOBALS['db']) or die ("error while browsing related articles")) {
                $record_count = mysql_num_rows($result);
                mysql_free_result($result);
        }		
		
		$sql =        "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ".
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ".
        "ORDER BY ".$ao[2]." LIMIT $offset,$records;";
        //"ORDER BY article_sort;";
        if($result = mysql_query($sql, $GLOBALS['db']) or die ("error while browsing related articles")) {
                while($row = mysql_fetch_array($result)) {
                        $article[$count_article] = $row;
                        $count_article++;
                }
                mysql_free_result($result);
        }
		
        if(isset($article[0])) {
                foreach($article as $akey => $avalue) {
					$at = html_specialchars(str_replace("'", '"', $article[$akey]["article_title"])); 
                                            
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
				    if($cut_article == $article[$akey]["article_id"] ) {
                        $a = "<tr bgColor='#B4E101'>\n";
                    }elseif($copy_article == $article[$akey]["article_id"]){  
                    	$a = "<tr bgColor='#B4E101'>\n";  
				    }else{
                        $a = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";
				    }	
                        
                        $a .= "<td width=\"450\">";
                        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n";
    
                        $acontent_count =  get_article_content_count($article[$akey]["article_id"], $GLOBALS['db']);

                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
                              $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"1\">";
                              $a .= ($acontent_count) ? "<a href=\"phpwcms.php?do=articles&opena=".$article[$akey]["article_id"].":".((!empty($_SESSION["structure"]["article"][$article[$akey]["article_id"]]))?0:1)."\">" : "";
                              $a .= "<img src=\"img/symbole/plus_".(($acontent_count) ? ((!empty($_SESSION["structure"]["article"][ $article[$akey]["article_id"] ])) ? "close" : "open") : "empty");
                              $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($acontent_count) ? "</a>" : "");
                        }else{
                              $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+29+(14*($counter-1)))."\" height=\"1\">";
                        }
//31-03-2005 Fernando Batista  end-------------------

                        $a .= "<img src=\"img/symbole/text_1.gif\" width=\"11\" height=\"15\" ";
                        $a .= getAltTitle($GLOBALS["BL"]['be_func_struct_articleID'].": ".$article[$akey]["article_id"]);
                        $a .= "></td>\n";
                        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n";
                        $a .= "<td class=\"dir\"><a href=\"index.php?id=".$article[$akey]["article_cid"].",".$article[$akey]["article_id"];
                        $a .= ",0,0,1,0\" target=\"_blank\" title=\"".$GLOBALS["BL"]['be_func_struct_preview'].": ".$at."\">";
                        $a .= $at."</a></td>\n</tr>\n</table></td>\n<td width=\"88\" nowrap>";

                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
                                $a .= "<a href=\"phpwcms.php?do=articles&p=2&s=1&id=".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_edit']." \n[".$at."]\">";
                                $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }

                        if($cut_article != $article[$akey]["article_id"] && !$cut_article_content) {
                                $a .= "<a href=\"phpwcms.php?do=articles&acut=".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_cut']." \n[".$at."]\">";
                                $a .= "<img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
                       } elseif($cut_article_content) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=7|".$cut_article_content."|".$article[$akey]["article_id"]."|-10";
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste0'];
                                $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";                    
//31-03-2005 Fernando Batista  end-------------------
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS["BL"]['be_func_struct_nocut'].'">';
                                $a .= "<img src=\"img/button/cut_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }

                        if($copy_article != $article[$akey]["article_id"] && !$copy_article_content) {
                                $a .= "<a href=\"phpwcms.php?do=articles&acopy=".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_copy']." \n[".$at."]\">";
                                $a .= "<img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
                        } elseif($copy_article_content) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=8|".$copy_article_content."|".$article[$akey]["article_id"]."|-10";
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste0'];
                                $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";                    
//31-03-2005 Fernando Batista  end-------------------
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS["BL"]['be_func_struct_nocopy'].'">';
                                $a .= "<img src=\"img/button/copy_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }

                        //Sortierungslink
                        $sort_up        = ($count_article > 1 && $akey && $show_sort) ? 1 : 0;
                        $sort_down        = ($count_article > 1 && $akey + 1 < $count_article && $show_sort) ? 1 : 0;

                        //davor sortieren
                        $a .= ($sort_up) ? '<a href="include/inc_act/act_structure.php?do=4|'.$article[$akey]["article_id"].'|'.
                        ($akey*10).'|'.$article[$akey-1]["article_id"].'|'.(($akey+1)*10).
                        '" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':'';
                        $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_up)?"</a>":"");
                        //dahinter sortieren
                        $a .= ($sort_down) ? '<a href="include/inc_act/act_structure.php?do=4|'.$article[$akey]["article_id"]."|".
                        (($akey+2)*10)."|".$article[$akey+1]["article_id"]."|".(($akey+1)*10).
                        '" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':'';
                        $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_down)?"</a>":"");

                        //active und visible Status wechseln
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=3,".$article[$akey]["article_id"].",,".(($article[$akey]["article_aktiv"])?0:1);
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">';
                        $a .= "<img src=\"img/button/visible_11x11_".$article[$akey]["article_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=4,".$article[$akey]["article_id"].",,".(($article[$akey]["article_public"])?0:1);
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_spublic'].'">';
                        $a .= "<img src=\"img/button/public_11x11_".$article[$akey]["article_public"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";

                        //Article Löschen
                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
                                $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=1,".$article[$akey]["article_id"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_article']." \n[".$at."]\" ";
                                $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_func_struct_del_jsmsg']." \\n[".js_singlequote($at)."] ');return document.MM_returnValue\">";
                                $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }
                        $a .= "</td>\n</tr>\n";
                        echo $a;
						if ($record_count > $records && count($article)==$akey+1)
						{
							$pages = ceil($record_count/$records);
							$pager = "<tr><td nowrap><img style=\"float:left;\" src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"20\"><div style=\"float:left;padding:2px;color:#C00;background:#EEE;\">";
							$page = 1;
							$p_do = ($_GET["do"]!="") ? $_GET["do"] : "articles";
							if ($_GET["open"]!="")
								$p_open =  $_GET["open"];
							else{
								$p_open="";
								foreach ($_SESSION["structure"] as $structure_id)
									$p_open.=$structure_id.":";
								$p_open=substr($p_open, 0, -1);
							}	
							while ($page <= $pages){
								if ($offset==($page*$records-$records))
									$pager.= "| <b>$page</b> ";
								else
									$pager.= "| <a href=\"phpwcms.php?do=".$p_do."&open=".$p_open."&".$struct_id."_offset=".($records*$page-$records)."\">$page</a> ";
								$page++;
							}
							$pager.= "|<br /><b>$record_count</b> records totali</div>";
							$pager.= "</td></tr>\n";
							echo $pager;
						}
//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------

			$sql  = "SELECT acontent_id, acontent_sorting, acontent_trash, acontent_block FROM ".DB_PREPEND."phpwcms_articlecontent ";
			$sql .= "WHERE acontent_aid=".$article[$akey]["article_id"]." ORDER BY acontent_block, acontent_sorting, acontent_id";
			if($result = mysql_query($sql, $GLOBALS['db']) or die("error while listing contents for this article")) {
				$sc = 0; $scc = 0; //Sort-Zwischenzähler
				while($row = mysql_fetch_row($result)) {
					$scc++;
					if($row[2] == 0) {
						$sc++;
						$sbutton[$sc]["id"]    = $row[0];
						$sbutton[$sc]["sort"]  = $row[1];
						$sbutton[$sc]["block"] = $row[3];
					}
				}
			}
			if($sc) {
				//Jetzt aufbauen der Sortieranweisung
				foreach($sbutton as $key => $value) {
					if($key == 1) {
						// if 1st content part in list
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\">";
						
					} elseif(isset($sbutton[$key-1]["block"]) && $sbutton[$key-1]["block"] != $sbutton[$key]["block"]) {
						// if this content part is selected for different block than previous
						$sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\">";
						
					} else {
						$sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key-1]["sort"]."|".
						$sbutton[$key-1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$GLOBALS["BL"]['be_article_cnt_up']."\"><img src=\"img/button/sort_1_1.gif\" border=\"0\"></a>";
	
					}
					if($key == $sc) {
						// if this is the last content part in list
						$sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\">";
					
					} elseif(isset($sbutton[$key+1]["block"]) && $sbutton[$key+1]["block"] != $sbutton[$key]["block"]) {
						// if this is the last content part in current block and next is different
					    $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\">";
						
					} else {
						$sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=".
						$sbutton[$key]["id"].":".$sbutton[$key+1]["sort"]."|".
						$sbutton[$key+1]["id"].":".$sbutton[$key]["sort"].
						"\" title=\"".$GLOBALS["BL"]['be_article_cnt_down']."\"><img src=\"img/button/sort_2_1.gif\" border=\"0\"></a>";

					}
					$sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"].
					//changed - not neccessary - Oliver: 10-04-2005
					//"<img src=\"img/leer.gif\" width=\"1\" height=\"1\">".
					$sbutton[$key]["bottom"];
				}
				unset($sbutton);
			}

//-----------------------
						if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
							if(isset($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) && $_SESSION["structure"]["article"][$article[$akey]["article_id"]]) {
                        		struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $GLOBALS['db']);
                       		}
                        }
//31-03-2005 Fernando Batista  end-------------------
                }			
        }
}


//31-03-2005 Fernando Batista start-----------------------------------------------------------------------------------------------------------
function struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $db){

		$a = '';
	
         $sql =  "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent ".
                 "WHERE acontent_aid=".$article[$akey]["article_id"]." AND acontent_trash=0 ".
                 "ORDER BY acontent_block, acontent_sorting, acontent_id;";
         if($result = mysql_query($sql, $db) or die("error while listing contents for this article")) {

             while($article_content = mysql_fetch_assoc($result)) {

				if($cut_article_content == $article_content["acontent_id"] ) {
                       $a .= "<tr bgColor='#FFA801'>\n";
                }elseif($copy_article_content == $article_content["acontent_id"]){       
                	   $a .= "<tr bgColor='#FFA801'>\n";
				}else{
                       $a .= "<tr onMouseOver=\"this.bgColor='#FFDE01';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";	//#F1F5F9							
				}					
                       $a .= "<td><img src=\"img/leer.gif\" width=\"".(14+14+29+(14*($counter-1)))."\" height=\"1\"><td>";	//$counter-1           
                       $a .= "<td align=\"right\"><img src=\"img/symbole/content_9x11.gif\" width=\"9\" height=\"11\" border=\"0\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"></td>";
                       $a .= "<td width=\"300\" class=\"v09\" style=\"color:#727889;\" style=\"padding-top:1px;padding-bottom:1px;\">";
                       $a .= "[ID:".$article_content["acontent_id"]."] ";
                       $a .= "<strong>".$GLOBALS["wcs_content_type"][$article_content["acontent_type"]]."</strong>";                       
                       $a .= "</td>";                                                   
                       $a .= "<td align=\"left\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"><img src=\"img/symbole/block.gif\" width=\"9\" height=\"11\" border=\"0\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"></td>";  
                       $a .= "<td width=\"150\" align=\"left\"  class=\"v09\" style=\"color:#727889;\">".htmlentities(' {'.$article_content['acontent_block'].'} ')."</td>";                     
                       $a .= '<td width="88" nowrap style="padding-top:1px;padding-bottom:1px;">';

					   $at = " [ID:".$article_content["acontent_id"]."] ".$GLOBALS["wcs_content_type"][$article_content["acontent_type"]]." ";                       
              
                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
                                $a .= "<a href=\"phpwcms.php?do=articles&p=2&s=1&aktion=2&id=".$article[$akey]["article_id"]."&acid=".$article_content["acontent_id"];
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_content_edit']." [".$at."]\">";
                                $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }
//----------------
                                                                                 
                if($cut_article_content) {
                        if($cut_article_content != $article_content["acontent_id"]) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=7|".$cut_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste'];
                                $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]";
                                $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($article_content["acontent_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=articles&accut=".$article_content["acontent_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_cut']." [".$at;
                                $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_cut']."\">";
                                $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                }
                if($copy_article_content) {
                        if($copy_article_content != $article_content["acontent_id"]) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=8|".$copy_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste'];
                                $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]";
                                $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($article_content["acontent_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=articles&accopy=".$article_content["acontent_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_content_copy']." [".$at;
                                $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_copy']."\">";
                                $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } 
                
                		$a .=$sbutton_string[$article_content["acontent_id"]];
                 
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=2,".$article_content["acontent_aid"].",".$article_content["acontent_id"].",".(($article_content["acontent_visible"])?0:1);
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">';
                        $a .= "<img src=\"img/button/visible_11x11_".$article_content["acontent_visible"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
						
						// added space between visible icon and delete icon
						$a .= '<img src="img/leer.gif" width="11" height="1" border="0" alt="">';
				
                        if($article_content["acontent_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) {
                                $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=9,".$article_content["acontent_aid"].",".$article_content["acontent_id"];
                                $a .= "\" title=\"".$GLOBALS['BL']['be_article_cnt_delpart']." [".$at."]\" ";
                                $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_article_cnt_delpart']." \\n[".js_singlequote($at)."] ');return document.MM_returnValue\">";
                                $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                        }
                        	                                         
//-------                                   
                        $a .= "</td>";
                        $a .= "\n</tr>";
            }
                
                		if($a){
                		$aa  = "<tr>\n<td colspan=\"2\">"; // bgColor=#F1F5F9 
                        $aa .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"538\">\n";
                		$aa .= $a;	
                 		$aa .= "</table></td></tr>";	
                		echo $aa;
                		}                                                          
         }
}
//31-03-2005 Fernando Batista  end-------------------





function listmode_edits ($listmode, $struct, $key, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, $forbid_cut, $forbid_copy, $count_row, $child_sort) {

        //Unterscheidung, welche bearbeitungsfunktionen angezeigt werden sollen
        $a = ""; 
        switch($listmode) {
                case 0:                $a .= "<a href=\"phpwcms.php?do=articles&p=1&struct=".$struct[$key]["acat_id"]."\" ";
                $a .= "title=\"".$GLOBALS['BL']['be_func_struct_new_article']." \n[".$an."]\">";
                $a .= "<img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                if($cut_article) { //Wenn ID zum Artikelausschneiden angegeben
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=3|".$cut_article."|";
                        $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an;
                        $a .= "]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                } else {
                        $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\">";
                }
                if($copy_article) {
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=5|".$copy_article."|";
                        $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an;
                        $a .= "]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                } else {
                        $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\">";
                }

                $a .= "<img src=\"img/button/sort_1_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                $a .= "<img src=\"img/button/sort_2_0.gif\" width=\"11\" height=\"11\" border=\"0\">";
                $a .= "<img src=\"img/button/visible_11x11a_".$struct[$key]["acat_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\">";
                $a .= "<img src=\"img/button/public_11x11a_".$struct[$key]["acat_public"].".gif\" width=\"11\" height=\"11\" border=\"0\">";
                break;

                case 1:                $a .= "<a href=\"phpwcms.php?do=admin&p=6&struct=".$struct[$key]["acat_id"]."&sort=".$child_sort."\" title=\"";
                $a .= $GLOBALS['BL']['be_func_struct_insert_level']." [".$an."]\"><img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";

                if($cut_id) {
                        if($cut_id != $struct[$key]["acat_id"] && !$forbid_cut) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=1|".$cut_id."|".$struct[$key]["acat_id"]."|";
                                $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level'];
                                $a .= " [".$an."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"";
                                $a .= ($forbid_cut) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n".
                                $GLOBALS['BL']['be_func_struct_no_paste2']."\n".
                                $GLOBALS['BL']['be_func_struct_no_paste3'] :
                                $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]";
                                $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($struct[$key]["acat_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6&cut=".$struct[$key]["acat_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_struct_cut_level']." [".$an;
                                $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_cut']."\">";
                                $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                }
                if($copy_id) {
                        if($copy_id != $struct[$key]["acat_id"] && !$forbid_copy) {
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=6|".$copy_id."|".$struct[$key]["acat_id"]."|";
                                $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level'];
                                $a .= " [".$an."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"";
                                $a .= ($forbid_copy) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n".
                                $GLOBALS['BL']['be_func_struct_no_paste2']."\n".
                                $GLOBALS['BL']['be_func_struct_no_paste3'] :
                                $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]";
                                $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                } else {
                        if($struct[$key]["acat_id"]) {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6&cop=".$struct[$key]["acat_id"]."\" title=\"";
                                $a .= $GLOBALS['BL']['be_func_struct_copy_level']." [".$an;
                                $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        } else {
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_copy']."\">";
                                $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                        }
                }
                //if($struct[$key]["acat_id"]) {
                $a .= "<a href=\"phpwcms.php?do=admin&p=6&struct=";
                if($struct[$key]["acat_id"]) {
                        $a .= $struct[$key]["acat_struct"]."&cat=".$struct[$key]["acat_id"];
                } else {
                        $a .= 'index';
                }
                $a .= '" title="'.$GLOBALS['BL']['be_func_struct_sedit'].' ['.$an.']">';
                $a .= "<img src=\"img/button/edit_22x11.gif\" width=\"22\" height=\"11\" border=\"0\"></a>";
                //} else {
                //        $a .= "<img src=\"img/leer.gif\" width=\"22\" height=\"1\">";
                //}

                //Sortierungslink
                $sort_up        = (($count_row>1 && $key)?1:0);
                $sort_down        = (($count_row>1 && $key+1<$count_row)?1:0);

                //davor sortieren
                $a .= ($sort_up)? "<a href=\"include/inc_act/act_structure.php?do=2|".$struct[$key]["acat_id"]."|".($key*10)."|".$struct[$key-1]["acat_id"].
                "|".(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':'';
                $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_up)?"</a>":"");
                //dahinter sortieren
                $a .= ($sort_down)? "<a href=\"include/inc_act/act_structure.php?do=2|".$struct[$key]["acat_id"]."|".(($key+2)*10)."|".$struct[$key+1]["acat_id"].
                "|".(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':'';
                $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_down)?"</a>":"");

                if($struct[$key]["acat_id"]) {
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=9|".$struct[$key]["acat_id"];
                        $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_struct']." [".$an."]\" ";
                        $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_func_struct_del_sjsmsg']." \\n\\n[".js_singlequote($an)."] ');return document.MM_returnValue\">";
                        $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";
                }
                break;

                default:        $a .= "&nbsp;";
        }
        return $a;
}

?>
Completeness is reached through subtraction, not through addition
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

the code is messed up inside phpwcms eg use the code function ...
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

as i told,
there it is, yet uncommented (sorry).
:D

you just have to copy it all, and overwrite (backup first!!!) the old file...
Completeness is reached through subtraction, not through addition
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

Works as expected here :wink:
Great! :D
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

Fulvio Romanin wrote:as i told,
there it is, yet uncommented (sorry).
:D

you just have to copy it all, and overwrite (backup first!!!) the old file...
I havent said it doenst work - I meant when use the quote tag the code is ugly eg use code-tag
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
StudioZ
Posts: 802
Joined: Fri 28. May 2004, 19:57
Location: Québec, Canada
Contact:

Post by StudioZ »

frold wrote:I havent said it doenst work - I meant when use the quote tag the code is ugly eg use code-tag
Oh... OK then... :wink:

Code: Select all

I understand what you mean now! :) 
Cheers,
Image
PhpWCMS Evangelist, -- iRoutier.com Running phpWCMS 1.4.2, r354 -> Great Version!!!!
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

frold wrote: I havent said it doenst work - I meant when use the quote tag the code is ugly eg use code-tag
I have changed it...
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
Kosse
Posts: 1066
Joined: Thu 9. Sep 2004, 12:08
Location: Brussels, Belgium
Contact:

Post by Kosse »

Hi Fulvio, did the **** between the two files,
you can comment(edit the // ) if u have time ;)

// here are the differences:

// FIRST CHANGE

Code: Select all

// ORIGINAL ->	line 123 (blank line)
// CHANGE --->	insert two lines		
	  $offset=($_GET[$struct_id."_offset"]!="") ? $_GET[$struct_id."_offset"] : 0;
      $records=($_GET["records"]!="") ? $_GET["records"] : 15;

// SECOND CHANGE

Code: Select all

// ORIGINAL ->	lines 127 to 130
        $sql = "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ".
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ".
        "ORDER BY ".$ao[2].";";
// CHANGE --->	4 first lines almost the same, just $sql_count = instead of $sql =      then putting 8 lines for the count function with an if 
        $sql_count = "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ".
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ".
        "ORDER BY ".$ao[2].";";
      if($result = mysql_query($sql_count, $GLOBALS['db']) or die ("error while browsing related articles")) {
                $record_count = mysql_num_rows($result);
                mysql_free_result($result);
        }      
		$sql = "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ".
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ".
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ".
        "ORDER BY ".$ao[2]." LIMIT $offset,$records;";

// THIRD CHANGE

Code: Select all

// ORIGINAL ->	line 248 just after line 247
			echo $a;
// CHANGE ---> paste if condition
			echo $a;
	if ($record_count > $records && count($article)==$akey+1)
		{
		$pages = ceil($record_count/$records);
		$pager = "<tr><td nowrap><img style=\"float:left;\" src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"20\"><div style=\"float:left;padding:2px;color:#C00;background:#EEE;\">";
		$page = 1;
		$p_do = ($_GET["do"]!="") ? $_GET["do"] : "articles";
			if ($_GET["open"]!="")
				$p_open =  $_GET["open"];
			else{
				$p_open="";
				foreach ($_SESSION["structure"] as $structure_id)
					$p_open.=$structure_id.":";
					$p_open=substr($p_open, 0, -1);
				}   
			while ($page <= $pages){
				if ($offset==($page*$records-$records))
					$pager.= "| <b>$page</b> ";
				else
					$pager.= "| <a href=\"phpwcms.php?do=".$p_do."&open=".$p_open."&".$struct_id."_offset=".($records*$page-$records)."\">$page</a> ";
					$page++;
									}
			$pager.= "|<br /><b>$record_count</b> total records</div>";
			$pager.= "</td></tr>\n";
			echo $pager;
		}
I did it 'cos I know you're busy studying your keyboard from very close... :D :D

Cheers
User avatar
Fulvio Romanin
Posts: 394
Joined: Thu 4. Dec 2003, 11:12
Location: Udine, Italy
Contact:

Post by Fulvio Romanin »

:) good one, kosse... always precious...
Completeness is reached through subtraction, not through addition
Ben_Hook
Posts: 29
Joined: Sun 4. Dec 2005, 21:19

**Update**

Post by Ben_Hook »

Hey.. I translated the page count thing to english... here is the code...

Code: Select all

<?php 
/************************************************************************************* 
   Copyright notice 

   (c) 2002-2005 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 

   This script is part of PHPWCMS. The PHPWCMS web content management system is 
   free software; you can redistribute it and/or modify it under the terms of 
   the GNU General Public License as published by the Free Software Foundation; 
   either version 2 of the License, or (at your option) any later version. 

   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 
   A copy is found in the textfile GPL.txt and important notices to the license 
   from the author is found in LICENSE.txt distributed with these scripts. 

   This script is distributed in the hope that it will be useful, but WITHOUT ANY 
   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
   PARTICULAR PURPOSE.  See the GNU General Public License for more details. 

   This copyright notice MUST APPEAR in all copies of the script! 
*************************************************************************************/ 

//26-04-2004 Oliver Georgi -> $level seems to be unused 
//19-11-2004 Fernando Batista -> Copy article, Copy strutures :http://fernandobatista.web.pt 
//31-03-2005 Fernando Batista -> copy&cut Article Content :http://fernandobatista.web.pt 

function struct_list ($id, $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode=1, $forbid_cut=0, $forbid_copy=0, $counter=0) { 

        $counter++; 
        $sql  = "SELECT * FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".intval($id)." ORDER BY acat_sort;"; 
        if($result = mysql_query($sql, $dbcon) or die("error while browsing structure".$sql)) { 
                $count_row = 0; 
                while($row = mysql_fetch_array($result)) { 
                        //$struct[$sx] = $row; $sx++; 
                        $struct[$count_row] = $row; 
                        $count_row++; 
                } 
                mysql_free_result($result); 

                if(isset($struct[0])) { 
                        foreach($struct as $key => $value) { 
                               struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon); 
                        } 
                } 
        } 
} 

function struct_levellist($struct, $key, $counter, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $forbid_cut, $forbid_copy, $listmode, $cut_article, $count_row, $dbcon) { 

        $page_val                = ($listmode) ? "do=admin&p=6" : "do=articles"; 
        $child_count        = get_root_childcount($struct[$key]["acat_id"], $dbcon); 
        $child_sort         = (($child_count+1)*10); 

        $forbid_cut                = ($struct[$key]["acat_struct"] == $cut_id || $forbid_cut) ? 1 : 0; 
        $forbid_copy               = ($struct[$key]["acat_struct"] == $copy_id || $forbid_copy) ? 1 : 0; 

        $an = html_specialchars($struct[$key]["acat_name"]); 
        $a  = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n"; 
        $a .= "<td width=\"450\">"; 
        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n"; 
        $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+(14*($counter-1)))."\" height=\"1\">"; //14 
        $a .= ($child_count) ? "<a href=\"phpwcms.php?".$page_val."&open=".$struct[$key]["acat_id"].":".((!empty($_SESSION["structure"][$struct[$key]["acat_id"]]))?0:1)."\">" : ""; 
        $a .= "<img src=\"img/symbole/plus_".(($child_count) ? ((!empty($_SESSION["structure"][ $struct[$key]["acat_id"] ])) ? "close" : "open") : "empty"); 
        $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($child_count) ? "</a>" : ""); 
        $a .= "<img src=\"img/symbole/page_".((!$struct[$key]["acat_hidden"])?1:7).".gif\" width=\"11\" height=\"15\" "; 
        $a .= getAltTitle('ID: '.$struct[$key]["acat_id"].($struct[$key]["acat_alias"] ? " \nALIAS: ".html_specialchars($struct[$key]["acat_alias"]) : "")); 
        $a .= "></td>\n"; 
        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n"; 
        $a .= "<td class=\"dir\"><strong>".$an."</strong></td>\n</tr>\n</table></td>\n<td width=\"88\" nowrap>"; 

        $a .= listmode_edits ($listmode,$struct,$key,$an,$copy_article_content,$cut_article_content,$copy_article,$copy_id,$cut_article,$cut_id,$forbid_cut,$forbid_copy,$count_row,$child_sort); 

        $a .= "</td>\n</tr>\n"; 
        echo $a; 

        if(isset($_SESSION["structure"][$struct[$key]["acat_id"]]) && $_SESSION["structure"][$struct[$key]["acat_id"]]) { 

                if(!$listmode) { 
               struct_articlelist ($struct[$key]["acat_id"], $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $struct[$key]["acat_order"]); 
            } 

                //26-04-2004 Oliver Georgi 
                //struct_list ($struct[$key]["acat_id"], $dbcon, $cut_id, $cut_article, $listmode, $forbid_cut, $counter, $level); 
                //$level seems to be unused 
                struct_list ($struct[$key]["acat_id"], $dbcon, $copy_article_content, $cut_article_content, $copy_id, $copy_article, $cut_id, $cut_article, $listmode, $forbid_cut, $forbid_copy, $counter); 

        } 

} 

function get_root_childcount($id, $dbcon) { 
        //Ermittelt Anzahl bereits vorhandener aktiver Unterlevels 
        $p1_count = $p2_count = 0; 
        $id = intval($id); 
        if($p_result = mysql_query("SELECT COUNT(acat_id) FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_trash=0 AND acat_struct=".$id.";", $dbcon)) { 
                if($p_row = mysql_fetch_row($p_result)) $p1_count = $p_row[0]; 
                mysql_free_result($p_result); 
        } 
        if($p_result = mysql_query("SELECT COUNT(article_id) FROM ".DB_PREPEND."phpwcms_article WHERE article_deleted=0 AND article_cid=".$id.";", $dbcon)) { 
                if($p_row = mysql_fetch_row($p_result)) $p2_count = $p_row[0]; 
                mysql_free_result($p_result); 
        } 
        return $p1_count + $p2_count; 
} 

//31-03-2005 Fernando Batista start----------------------------------------------------------------------------------------------------------- 
function get_article_content_count($id, $dbcon) { 
        $p_count = 0; 
        $id = intval($id); 
        if($p_result = mysql_query("SELECT COUNT(acontent_id) FROM ".DB_PREPEND."phpwcms_articlecontent WHERE acontent_trash=0 AND acontent_aid=".$id.";", $dbcon)) { 
                if($p_row = mysql_fetch_row($p_result)) $p_count = $p_row[0]; 
                mysql_free_result($p_result); 
        } 
        return $p_count; 
} 
//31-03-2005 Fernando Batista  end------------------- 

function struct_articlelist ($struct_id, $counter, $copy_article_content, $cut_article_content, $copy_article, $cut_article, $article_order=0) { 

        $count_article        = 0; 
        $article_order        = intval($article_order); 
        $show_sort = (!$article_order || $article_order == 1) ? 1 : 0; 
      $offset=($_GET[$struct_id."_offset"]!="") ? $_GET[$struct_id."_offset"] : 0; 
      $records=($_GET["records"]!="") ? $_GET["records"] : 15; 

        $ao = get_order_sort($article_order); 
        echo "\n\n\n".'<!-- ORDER: '.$ao[2].' //-->'."\n\n\n"; 

        $sql_count =        "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ". 
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ". 
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ". 
        "ORDER BY ".$ao[2].";"; 
      if($result = mysql_query($sql_count, $GLOBALS['db']) or die ("error while browsing related articles")) { 
                $record_count = mysql_num_rows($result); 
                mysql_free_result($result); 
        }       
       
      $sql =        "SELECT article_id, article_cid, article_title, article_public, article_aktiv, article_uid, ". 
        "date_format(article_tstamp, '%Y-%m-%d %H:%i:%s') AS article_date FROM ". 
        DB_PREPEND."phpwcms_article WHERE article_cid='".$struct_id."' AND article_deleted=0 ". 
        "ORDER BY ".$ao[2]." LIMIT $offset,$records;"; 
        //"ORDER BY article_sort;"; 
        if($result = mysql_query($sql, $GLOBALS['db']) or die ("error while browsing related articles")) { 
                while($row = mysql_fetch_array($result)) { 
                        $article[$count_article] = $row; 
                        $count_article++; 
                } 
                mysql_free_result($result); 
        } 
       
        if(isset($article[0])) { 
                foreach($article as $akey => $avalue) { 
               $at = html_specialchars(str_replace("'", '"', $article[$akey]["article_title"])); 
                                            
//31-03-2005 Fernando Batista start----------------------------------------------------------------------------------------------------------- 
                if($cut_article == $article[$akey]["article_id"] ) { 
                        $a = "<tr bgColor='#B4E101'>\n"; 
                    }elseif($copy_article == $article[$akey]["article_id"]){  
                       $a = "<tr bgColor='#B4E101'>\n";  
                }else{ 
                        $a = "<tr onMouseOver=\"this.bgColor='#CCFF00';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n"; 
                }    
                        
                        $a .= "<td width=\"450\">"; 
                        $a .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n<tr>\n"; 
    
                        $acontent_count =  get_article_content_count($article[$akey]["article_id"], $GLOBALS['db']); 

                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) { 
                              $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"1\">"; 
                              $a .= ($acontent_count) ? "<a href=\"phpwcms.php?do=articles&opena=".$article[$akey]["article_id"].":".((!empty($_SESSION["structure"]["article"][$article[$akey]["article_id"]]))?0:1)."\">" : ""; 
                              $a .= "<img src=\"img/symbole/plus_".(($acontent_count) ? ((!empty($_SESSION["structure"]["article"][ $article[$akey]["article_id"] ])) ? "close" : "open") : "empty"); 
                              $a .= ".gif\" width=\"15\" height=\"15\" border=\"0\">".(($acontent_count) ? "</a>" : ""); 
                        }else{ 
                              $a .= "<td nowrap><img src=\"img/leer.gif\" width=\"".(14+29+(14*($counter-1)))."\" height=\"1\">"; 
                        } 
//31-03-2005 Fernando Batista  end------------------- 

                        $a .= "<img src=\"img/symbole/text_1.gif\" width=\"11\" height=\"15\" "; 
                        $a .= getAltTitle($GLOBALS["BL"]['be_func_struct_articleID'].": ".$article[$akey]["article_id"]); 
                        $a .= "></td>\n"; 
                        $a .= "<td><img src=\"img/leer.gif\" width=\"2\" height=\"15\"></td>\n"; 
                        $a .= "<td class=\"dir\"><a href=\"index.php?id=".$article[$akey]["article_cid"].",".$article[$akey]["article_id"]; 
                        $a .= ",0,0,1,0\" target=\"_blank\" title=\"".$GLOBALS["BL"]['be_func_struct_preview'].": ".$at."\">"; 
                        $a .= $at."</a></td>\n</tr>\n</table></td>\n<td width=\"88\" nowrap>"; 

                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) { 
                                $a .= "<a href=\"phpwcms.php?do=articles&p=2&s=1&id=".$article[$akey]["article_id"]; 
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_edit']." \n[".$at."]\">"; 
                                $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                        } 

                        if($cut_article != $article[$akey]["article_id"] && !$cut_article_content) { 
                                $a .= "<a href=\"phpwcms.php?do=articles&acut=".$article[$akey]["article_id"]; 
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_cut']." \n[".$at."]\">"; 
                                $a .= "<img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
//31-03-2005 Fernando Batista start----------------------------------------------------------------------------------------------------------- 
                       } elseif($cut_article_content) { 
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=7|".$cut_article_content."|".$article[$akey]["article_id"]."|-10"; 
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste0']; 
                                $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";                    
//31-03-2005 Fernando Batista  end------------------- 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS["BL"]['be_func_struct_nocut'].'">'; 
                                $a .= "<img src=\"img/button/cut_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 

                        if($copy_article != $article[$akey]["article_id"] && !$copy_article_content) { 
                                $a .= "<a href=\"phpwcms.php?do=articles&acopy=".$article[$akey]["article_id"]; 
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_struct_copy']." \n[".$at."]\">"; 
                                $a .= "<img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
//31-03-2005 Fernando Batista start----------------------------------------------------------------------------------------------------------- 
                        } elseif($copy_article_content) { 
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=8|".$copy_article_content."|".$article[$akey]["article_id"]."|-10"; 
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste0']; 
                                $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>";                    
//31-03-2005 Fernando Batista  end------------------- 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS["BL"]['be_func_struct_nocopy'].'">'; 
                                $a .= "<img src=\"img/button/copy_11x11_3.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 

                        //Sortierungslink 
                        $sort_up        = ($count_article > 1 && $akey && $show_sort) ? 1 : 0; 
                        $sort_down        = ($count_article > 1 && $akey + 1 < $count_article && $show_sort) ? 1 : 0; 

                        //davor sortieren 
                        $a .= ($sort_up) ? '<a href="include/inc_act/act_structure.php?do=4|'.$article[$akey]["article_id"].'|'. 
                        ($akey*10).'|'.$article[$akey-1]["article_id"].'|'.(($akey+1)*10). 
                        '" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':''; 
                        $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_up)?"</a>":""); 
                        //dahinter sortieren 
                        $a .= ($sort_down) ? '<a href="include/inc_act/act_structure.php?do=4|'.$article[$akey]["article_id"]."|". 
                        (($akey+2)*10)."|".$article[$akey+1]["article_id"]."|".(($akey+1)*10). 
                        '" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':''; 
                        $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_down)?"</a>":""); 

                        //active und visible Status wechseln 
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=3,".$article[$akey]["article_id"].",,".(($article[$akey]["article_aktiv"])?0:1); 
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">'; 
                        $a .= "<img src=\"img/button/visible_11x11_".$article[$akey]["article_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=4,".$article[$akey]["article_id"].",,".(($article[$akey]["article_public"])?0:1); 
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_spublic'].'">'; 
                        $a .= "<img src=\"img/button/public_11x11_".$article[$akey]["article_public"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 

                        //Article Löschen 
                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) { 
                                $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=1,".$article[$akey]["article_id"]; 
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_article']." \n[".$at."]\" "; 
                                $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_func_struct_del_jsmsg']." \\n[".js_singlequote($at)."] ');return document.MM_returnValue\">"; 
                                $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                        } 
                        $a .= "</td>\n</tr>\n"; 
                        echo $a; 
                  if ($record_count > $records && count($article)==$akey+1) 
                  { 
                     $pages = ceil($record_count/$records); 
                     $pager = "<tr><td nowrap><img style=\"float:left;\" src=\"img/leer.gif\" width=\"".(14+14+(14*($counter-1)))."\" height=\"20\"><div style=\"float:left;padding:2px;color:#C00;background:#EEE;\">"; 
                     $page = 1; 
                     $p_do = ($_GET["do"]!="") ? $_GET["do"] : "articles"; 
                     if ($_GET["open"]!="") 
                        $p_open =  $_GET["open"]; 
                     else{ 
                        $p_open=""; 
                        foreach ($_SESSION["structure"] as $structure_id) 
                           $p_open.=$structure_id.":"; 
                        $p_open=substr($p_open, 0, -1); 
                     }    
                     while ($page <= $pages){ 
                        if ($offset==($page*$records-$records)) 
                           $pager.= "| <b>$page</b> "; 
                        else 
                           $pager.= "| <a href=\"phpwcms.php?do=".$p_do."&open=".$p_open."&".$struct_id."_offset=".($records*$page-$records)."\">$page</a> "; 
                        $page++; 
                     } 
                     $pager.= "|<br /><b>$record_count</b> records total</div>"; 
                     $pager.= "</td></tr>\n"; 
                     echo $pager; 
                  } 
//31-03-2005 Fernando Batista start----------------------------------------------------------------------------------------------------------- 

         $sql  = "SELECT acontent_id, acontent_sorting, acontent_trash, acontent_block FROM ".DB_PREPEND."phpwcms_articlecontent "; 
         $sql .= "WHERE acontent_aid=".$article[$akey]["article_id"]." ORDER BY acontent_block, acontent_sorting, acontent_id"; 
         if($result = mysql_query($sql, $GLOBALS['db']) or die("error while listing contents for this article")) { 
            $sc = 0; $scc = 0; //Sort-Zwischenzähler 
            while($row = mysql_fetch_row($result)) { 
               $scc++; 
               if($row[2] == 0) { 
                  $sc++; 
                  $sbutton[$sc]["id"]    = $row[0]; 
                  $sbutton[$sc]["sort"]  = $row[1]; 
                  $sbutton[$sc]["block"] = $row[3]; 
               } 
            } 
         } 
         if($sc) { 
            //Jetzt aufbauen der Sortieranweisung 
            foreach($sbutton as $key => $value) { 
               if($key == 1) { 
                  // if 1st content part in list 
                  $sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\">"; 
                   
               } elseif(isset($sbutton[$key-1]["block"]) && $sbutton[$key-1]["block"] != $sbutton[$key]["block"]) { 
                  // if this content part is selected for different block than previous 
                  $sbutton[$key]["top"] = "<img src=\"img/button/sort_1_0.gif\" border=\"0\">"; 
                   
               } else { 
                  $sbutton[$key]["top"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=". 
                  $sbutton[$key]["id"].":".$sbutton[$key-1]["sort"]."|". 
                  $sbutton[$key-1]["id"].":".$sbutton[$key]["sort"]. 
                  "\" title=\"".$GLOBALS["BL"]['be_article_cnt_up']."\"><img src=\"img/button/sort_1_1.gif\" border=\"0\"></a>"; 
    
               } 
               if($key == $sc) { 
                  // if this is the last content part in list 
                  $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\">"; 
                
               } elseif(isset($sbutton[$key+1]["block"]) && $sbutton[$key+1]["block"] != $sbutton[$key]["block"]) { 
                  // if this is the last content part in current block and next is different 
                   $sbutton[$key]["bottom"] = "<img src=\"img/button/sort_2_0.gif\" border=\"0\">"; 
                   
               } else { 
                  $sbutton[$key]["bottom"] = "<a href=\"include/inc_act/act_articlecontent.php?sort=". 
                  $sbutton[$key]["id"].":".$sbutton[$key+1]["sort"]."|". 
                  $sbutton[$key+1]["id"].":".$sbutton[$key]["sort"]. 
                  "\" title=\"".$GLOBALS["BL"]['be_article_cnt_down']."\"><img src=\"img/button/sort_2_1.gif\" border=\"0\"></a>"; 

               } 
               $sbutton_string[$sbutton[$key]["id"]] = $sbutton[$key]["top"]. 
               //changed - not neccessary - Oliver: 10-04-2005 
               //"<img src=\"img/leer.gif\" width=\"1\" height=\"1\">". 
               $sbutton[$key]["bottom"]; 
            } 
            unset($sbutton); 
         } 

//----------------------- 
                  if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) { 
                     if(isset($_SESSION["structure"]["article"][$article[$akey]["article_id"]]) && $_SESSION["structure"]["article"][$article[$akey]["article_id"]]) { 
                              struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $GLOBALS['db']); 
                             } 
                        } 
//31-03-2005 Fernando Batista  end------------------- 
                }          
        } 
} 


//31-03-2005 Fernando Batista start----------------------------------------------------------------------------------------------------------- 
function struct_articlecontentlist ($article, $akey, $copy_article_content, $cut_article_content, $counter, $sbutton_string, $db){ 

      $a = ''; 
    
         $sql =  "SELECT * FROM ".DB_PREPEND."phpwcms_articlecontent ". 
                 "WHERE acontent_aid=".$article[$akey]["article_id"]." AND acontent_trash=0 ". 
                 "ORDER BY acontent_block, acontent_sorting, acontent_id;"; 
         if($result = mysql_query($sql, $db) or die("error while listing contents for this article")) { 

             while($article_content = mysql_fetch_assoc($result)) { 

            if($cut_article_content == $article_content["acontent_id"] ) { 
                       $a .= "<tr bgColor='#FFA801'>\n"; 
                }elseif($copy_article_content == $article_content["acontent_id"]){        
                      $a .= "<tr bgColor='#FFA801'>\n"; 
            }else{ 
                       $a .= "<tr onMouseOver=\"this.bgColor='#FFDE01';\" onMouseOut=\"this.bgColor='#FFFFFF';\">\n";   //#F1F5F9                      
            }                
                       $a .= "<td><img src=\"img/leer.gif\" width=\"".(14+14+29+(14*($counter-1)))."\" height=\"1\"><td>";   //$counter-1            
                       $a .= "<td align=\"right\"><img src=\"img/symbole/content_9x11.gif\" width=\"9\" height=\"11\" border=\"0\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"></td>"; 
                       $a .= "<td width=\"300\" class=\"v09\" style=\"color:#727889;\" style=\"padding-top:1px;padding-bottom:1px;\">"; 
                       $a .= "[ID:".$article_content["acontent_id"]."] "; 
                       $a .= "<strong>".$GLOBALS["wcs_content_type"][$article_content["acontent_type"]]."</strong>";                        
                       $a .= "</td>";                                                    
                       $a .= "<td align=\"left\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"><img src=\"img/symbole/block.gif\" width=\"9\" height=\"11\" border=\"0\"><img src=\"img/leer.gif\" width=\"5\" height=\"1\"></td>";  
                       $a .= "<td width=\"150\" align=\"left\"  class=\"v09\" style=\"color:#727889;\">".htmlentities(' {'.$article_content['acontent_block'].'} ')."</td>";                      
                       $a .= '<td width="88" nowrap style="padding-top:1px;padding-bottom:1px;">'; 

                  $at = " [ID:".$article_content["acontent_id"]."] ".$GLOBALS["wcs_content_type"][$article_content["acontent_type"]]." ";                        
              
                        if($article[$akey]["article_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) { 
                                $a .= "<a href=\"phpwcms.php?do=articles&p=2&s=1&aktion=2&id=".$article[$akey]["article_id"]."&acid=".$article_content["acontent_id"]; 
                                $a .= "\" title=\"".$GLOBALS["BL"]['be_func_content_edit']." [".$at."]\">"; 
                                $a .= "<img src=\"img/button/edit_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<img src=\"img/button/edit_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                        } 
//---------------- 
                                                                                  
                if($cut_article_content) { 
                        if($cut_article_content != $article_content["acontent_id"]) { 
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=7|".$cut_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"]; 
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste']; 
                                $a .= " [".$at."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\""; 
                                $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]"; 
                                $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } else { 
                        if($article_content["acontent_id"]) { 
                                $a .= "<a href=\"phpwcms.php?do=articles&accut=".$article_content["acontent_id"]."\" title=\""; 
                                $a .= $GLOBALS['BL']['be_func_content_cut']." [".$at; 
                                $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_cut']."\">"; 
                                $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } 
                if($copy_article_content) { 
                        if($copy_article_content != $article_content["acontent_id"]) { 
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=8|".$copy_article_content."|".$article_content["acontent_aid"]."|".$article_content["acontent_sorting"]; 
                                $a .= "\" title=\"".$GLOBALS['BL']['be_func_content_paste']; 
                                $a .= " [".$at."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\""; 
                                $a .= $GLOBALS['BL']['be_func_content_paste_cancel']." [".$at."]"; 
                                $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } else { 
                        if($article_content["acontent_id"]) { 
                                $a .= "<a href=\"phpwcms.php?do=articles&accopy=".$article_content["acontent_id"]."\" title=\""; 
                                $a .= $GLOBALS['BL']['be_func_content_copy']." [".$at; 
                                $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=articles\" title=\"".$GLOBALS['BL']['be_func_content_no_copy']."\">"; 
                                $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } 
                
                      $a .=$sbutton_string[$article_content["acontent_id"]]; 
                  
                        $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=2,".$article_content["acontent_aid"].",".$article_content["acontent_id"].",".(($article_content["acontent_visible"])?0:1); 
                        $a .= '" title="'.$GLOBALS["BL"]['be_func_struct_svisible'].'">'; 
                        $a .= "<img src=\"img/button/visible_11x11_".$article_content["acontent_visible"].".gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                   
                  // added space between visible icon and delete icon 
                  $a .= '<img src="img/leer.gif" width="11" height="1" border="0" alt="">'; 
             
                        if($article_content["acontent_uid"] == $_SESSION["wcs_user_id"] || $_SESSION["wcs_user_admin"]) { 
                                $a .= "<a href=\"include/inc_act/act_articlecontent.php?do=9,".$article_content["acontent_aid"].",".$article_content["acontent_id"]; 
                                $a .= "\" title=\"".$GLOBALS['BL']['be_article_cnt_delpart']." [".$at."]\" "; 
                                $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_article_cnt_delpart']." \\n[".js_singlequote($at)."] ');return document.MM_returnValue\">"; 
                                $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<img src=\"img/button/del_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                        } 
                                                                     
//-------                                    
                        $a .= "</td>"; 
                        $a .= "\n</tr>"; 
            } 
                
                      if($a){ 
                      $aa  = "<tr>\n<td colspan=\"2\">"; // bgColor=#F1F5F9 
                        $aa .= "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"538\">\n"; 
                      $aa .= $a;    
                       $aa .= "</table></td></tr>";    
                      echo $aa; 
                      }                                                          
         } 
} 
//31-03-2005 Fernando Batista  end------------------- 





function listmode_edits ($listmode, $struct, $key, $an, $copy_article_content, $cut_article_content, $copy_article, $copy_id, $cut_article, $cut_id, $forbid_cut, $forbid_copy, $count_row, $child_sort) { 

        //Unterscheidung, welche bearbeitungsfunktionen angezeigt werden sollen 
        $a = ""; 
        switch($listmode) { 
                case 0:                $a .= "<a href=\"phpwcms.php?do=articles&p=1&struct=".$struct[$key]["acat_id"]."\" "; 
                $a .= "title=\"".$GLOBALS['BL']['be_func_struct_new_article']." \n[".$an."]\">"; 
                $a .= "<img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                if($cut_article) { //Wenn ID zum Artikelausschneiden angegeben 
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=3|".$cut_article."|"; 
                        $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an; 
                        $a .= "]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                } else { 
                        $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                } 
                if($copy_article) { 
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=5|".$copy_article."|"; 
                        $a .= $struct[$key]["acat_id"]."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_article']." \n[".$an; 
                        $a .= "]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                } else { 
                        $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                } 

                $a .= "<img src=\"img/button/sort_1_0.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                $a .= "<img src=\"img/button/sort_2_0.gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                $a .= "<img src=\"img/button/visible_11x11a_".$struct[$key]["acat_aktiv"].".gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                $a .= "<img src=\"img/button/public_11x11a_".$struct[$key]["acat_public"].".gif\" width=\"11\" height=\"11\" border=\"0\">"; 
                break; 

                case 1:                $a .= "<a href=\"phpwcms.php?do=admin&p=6&struct=".$struct[$key]["acat_id"]."&sort=".$child_sort."\" title=\""; 
                $a .= $GLOBALS['BL']['be_func_struct_insert_level']." [".$an."]\"><img src=\"img/button/add_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 

                if($cut_id) { 
                        if($cut_id != $struct[$key]["acat_id"] && !$forbid_cut) { 
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=1|".$cut_id."|".$struct[$key]["acat_id"]."|"; 
                                $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level']; 
                                $a .= " [".$an."]\"><img src=\"img/button/cut_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\""; 
                                $a .= ($forbid_cut) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n". 
                                $GLOBALS['BL']['be_func_struct_no_paste2']."\n". 
                                $GLOBALS['BL']['be_func_struct_no_paste3'] : 
                                $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]"; 
                                $a .= "\"><img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } else { 
                        if($struct[$key]["acat_id"]) { 
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6&cut=".$struct[$key]["acat_id"]."\" title=\""; 
                                $a .= $GLOBALS['BL']['be_func_struct_cut_level']." [".$an; 
                                $a .= "]\"><img src=\"img/button/cut_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_cut']."\">"; 
                                $a .= "<img src=\"img/button/cut_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } 
                if($copy_id) { 
                        if($copy_id != $struct[$key]["acat_id"] && !$forbid_copy) { 
                                $a .= "<a href=\"include/inc_act/act_structure.php?do=6|".$copy_id."|".$struct[$key]["acat_id"]."|"; 
                                $a .= $child_sort."\" title=\"".$GLOBALS['BL']['be_func_struct_paste_level']; 
                                $a .= " [".$an."]\"><img src=\"img/button/copy_11x11_1.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\""; 
                                $a .= ($forbid_copy) ? $GLOBALS['BL']['be_func_struct_no_paste1']."\n[".$an."]\n". 
                                $GLOBALS['BL']['be_func_struct_no_paste2']."\n". 
                                $GLOBALS['BL']['be_func_struct_no_paste3'] : 
                                $GLOBALS['BL']['be_func_struct_paste_cancel']." [".$an."]"; 
                                $a .= "\"><img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } else { 
                        if($struct[$key]["acat_id"]) { 
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6&cop=".$struct[$key]["acat_id"]."\" title=\""; 
                                $a .= $GLOBALS['BL']['be_func_struct_copy_level']." [".$an; 
                                $a .= "]\"><img src=\"img/button/copy_11x11_0.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } else { 
                                $a .= "<a href=\"phpwcms.php?do=admin&p=6\" title=\"".$GLOBALS['BL']['be_func_struct_no_copy']."\">"; 
                                $a .= "<img src=\"img/button/copy_11x11_9.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                        } 
                } 
                //if($struct[$key]["acat_id"]) { 
                $a .= "<a href=\"phpwcms.php?do=admin&p=6&struct="; 
                if($struct[$key]["acat_id"]) { 
                        $a .= $struct[$key]["acat_struct"]."&cat=".$struct[$key]["acat_id"]; 
                } else { 
                        $a .= 'index'; 
                } 
                $a .= '" title="'.$GLOBALS['BL']['be_func_struct_sedit'].' ['.$an.']">'; 
                $a .= "<img src=\"img/button/edit_22x11.gif\" width=\"22\" height=\"11\" border=\"0\"></a>"; 
                //} else { 
                //        $a .= "<img src=\"img/leer.gif\" width=\"22\" height=\"1\">"; 
                //} 

                //Sortierungslink 
                $sort_up        = (($count_row>1 && $key)?1:0); 
                $sort_down        = (($count_row>1 && $key+1<$count_row)?1:0); 

                //davor sortieren 
                $a .= ($sort_up)? "<a href=\"include/inc_act/act_structure.php?do=2|".$struct[$key]["acat_id"]."|".($key*10)."|".$struct[$key-1]["acat_id"]. 
                "|".(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_up'].'">':''; 
                $a .= "<img src=\"img/button/sort_1_".$sort_up.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_up)?"</a>":""); 
                //dahinter sortieren 
                $a .= ($sort_down)? "<a href=\"include/inc_act/act_structure.php?do=2|".$struct[$key]["acat_id"]."|".(($key+2)*10)."|".$struct[$key+1]["acat_id"]. 
                "|".(($key+1)*10).'" title="'.$GLOBALS['BL']['be_func_struct_sort_down'].'">':''; 
                $a .= "<img src=\"img/button/sort_2_".$sort_down.".gif\" width=\"11\" height=\"11\" border=\"0\">".(($sort_down)?"</a>":""); 

                if($struct[$key]["acat_id"]) { 
                        $a .= "<a href=\"include/inc_act/act_structure.php?do=9|".$struct[$key]["acat_id"]; 
                        $a .= "\" title=\"".$GLOBALS['BL']['be_func_struct_del_struct']." [".$an."]\" "; 
                        $a .= "onClick=\"GP_popupConfirmMsg('".$GLOBALS['BL']['be_func_struct_del_sjsmsg']." \\n\\n[".js_singlequote($an)."] ');return document.MM_returnValue\">"; 
                        $a .= "<img src=\"img/button/del_11x11.gif\" width=\"11\" height=\"11\" border=\"0\"></a>"; 
                } 
                break; 

                default:        $a .= "&nbsp;"; 
        } 
        return $a; 
} 

?>
  • If i bore you to death, don't say i didn't warn you.
Ben_Hook
Posts: 29
Joined: Sun 4. Dec 2005, 21:19

**Update**

Post by Ben_Hook »

[EDIT]
Oops sry double post
[/EDIT]
  • If i bore you to death, don't say i didn't warn you.
Post Reply