1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-28 00:30:09 +02:00

content: template improvements, admin cleanup

This commit is contained in:
lia
2007-01-14 11:59:11 +00:00
parent dcec02e56e
commit 6096c325b9
9 changed files with 269 additions and 135 deletions

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_class.php,v $
| $Revision: 1.3 $
| $Date: 2007-01-13 22:33:03 $
| $Revision: 1.4 $
| $Date: 2007-01-14 11:59:11 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -507,8 +507,7 @@ class content{
function getCategoryTree($id, $parent, $classcheck=TRUE){
//id : content_parent of an item
global $plugintable, $datequery;
global $agc;
global $plugintable, $datequery, $agc;
if($parent){
$agc = "";
@@ -670,9 +669,17 @@ class content{
global $sqlcountitemsincat, $plugintable, $datequery;
//$id : category content_id
$cachestring = md5($id."_".$datequery."_".e_CLASS_REGEXP);
if($ret = getcachedvars("content_countcatitems_{$cachestring}"))
{
return $ret;
}
if(!is_object($sqlcountitemsincat)){ $sqlcountitemsincat = new db; }
$n = $sqlcountitemsincat -> db_Count($plugintable, "(*)", "WHERE content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent='".intval($id)."' AND content_refer != 'sa' ".$datequery." ");
cachevars("content_countcatitems_{$cachestring}", $n);
return $n;
}
@@ -792,6 +799,12 @@ class content{
function getAuthor($content_author) {
global $sql, $plugintable, $datequery;
$cachestring = md5($content_author);
if($ret = getcachedvars("content_getauthor_{$cachestring}"))
{
return $ret;
}
if(is_numeric($content_author)){
if(!$sql -> db_Select("user", "user_id, user_name, user_email", "user_id=$content_author")){
$author_id = "0";
@@ -814,6 +827,7 @@ class content{
}
$getauthor = array($author_id, $author_name, $author_email, $content_author);
}
cachevars("content_getauthor_{$cachestring}", $getauthor);
return $getauthor;
}
@@ -834,7 +848,8 @@ class content{
}
$mainparent = $this -> getMainParent( $newid );
}
return ($mainparent ? $mainparent : "0");
$val = ($mainparent ? $mainparent : "0");
return $val;
}
@@ -1034,15 +1049,11 @@ class content{
if(isset($content_pref["content_{$mode}_authoremail"]) && $authordetails[2]){
if($authordetails[0] == "0"){
if(isset($content_pref["content_{$mode}_authoremail_nonmember"]) && $content_pref["content_{$mode}_authoremail_nonmember"] && strpos($authordetails[2], "@") ){
//$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>";
$authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]);
}else{
$authorinfo = $authordetails[1];
}
}else{
//$authorinfo = "<a href='mailto:".$authordetails[2]."'>".$authordetails[1]."</a>";
$authorinfo = preg_replace("#([a-z0-9\-_.]+?)@([\w\-]+\.([\w\-\.]+\.)*[\w]+)#i", "<a rel='external' href='javascript:window.location=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\";self.close();' onmouseover='window.status=\"mai\"+\"lto:\"+\"\\1\"+\"@\"+\"\\2\"; return true;' onmouseout='window.status=\"\";return true;'>".$authordetails[1]."</a>", $authordetails[2]);
}
}else{
@@ -1060,6 +1071,7 @@ class content{
}
/*
//admin
function popupHelp($text, $image="", $width="320", $title=""){
//$image : full path to the image you want to show on screen (uses a default doc image)
@@ -1079,6 +1091,7 @@ class content{
return $popup;
}
*/

View File

@@ -29,5 +29,6 @@ if (!defined('CONTENT_ICON_CONTENTMANAGER')) { define("CONTENT_ICON_CONTENTMANAG
if (!defined('CONTENT_ICON_CONTENTMANAGER_SMALL')) { define("CONTENT_ICON_CONTENTMANAGER_SMALL", "<img src='".$plugindir."images/manager_16.png' alt='".CONTENT_ICON_LAN_13."' title='".CONTENT_ICON_LAN_13."' style='border:0; cursor:pointer;' />"); }
if (!defined('CONTENT_ICON_ORDER_UP')) { define("CONTENT_ICON_ORDER_UP", "<img src='".$imagedir."up.png' alt='".CONTENT_ADMIN_ITEM_LAN_63."' title='".CONTENT_ADMIN_ITEM_LAN_63."' />"); }
if (!defined('CONTENT_ICON_ORDER_DOWN')) { define("CONTENT_ICON_ORDER_DOWN", "<img src='".$imagedir."down.png' alt='".CONTENT_ADMIN_ITEM_LAN_64."' title='".CONTENT_ADMIN_ITEM_LAN_64."' />"); }
if (!defined('CONTENT_ICON_DETAILS')) { define("CONTENT_ICON_DETAILS", "<img src='".$imagedir."downloads_16.png' alt='".CONTENT_ICON_LAN_16."' title='".CONTENT_ICON_LAN_16."' style='border:0; cursor:pointer;' />"); }
?>

View File

@@ -12,8 +12,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/handlers/content_form_class.php,v $
| $Revision: 1.3 $
| $Date: 2007-01-13 23:18:39 $
| $Revision: 1.4 $
| $Date: 2007-01-14 11:59:11 $
| $Author: lisa_ $
+---------------------------------------------------------------+
*/
@@ -1008,7 +1008,7 @@ class contentform{
function manage_cat(){
global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $stylespacer, $eArrayStorage, $CONTENT_ADMIN_CATEGORY_START, $CONTENT_ADMIN_CATEGORY_TABLE, $CONTENT_ADMIN_CATEGORY_END, $CONTENT_ADMIN_OPTIONS, $row, $catarray, $catid, $content_pref;
global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $stylespacer, $eArrayStorage, $CONTENT_ADMIN_CATEGORY_START, $CONTENT_ADMIN_CATEGORY_TABLE, $CONTENT_ADMIN_CATEGORY_END, $CONTENT_ADMIN_OPTIONS, $row, $catarray, $catid, $content_pref, $CONTENT_ADMIN_SPACER;
$catarray = $aa -> getCategoryTree("", "", FALSE);
$array = array_keys($catarray);
@@ -1028,6 +1028,7 @@ class contentform{
$content_pref = $aa -> getContentPref($catarray[$catid][0]);
$delete_heading = str_replace("&#39;", "\'", $row['content_heading']);
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
$CONTENT_ADMIN_OPTIONS = "<a href='".e_SELF."?cat.edit.".$catid."'>".CONTENT_ICON_EDIT."</a>
<input type='image' title='".CONTENT_ICON_LAN_1."' name='delete[cat_{$catid}]' src='".CONTENT_ICON_DELETE_BASE."' onclick=\"return jsconfirm('".$tp->toJS(CONTENT_ADMIN_JS_LAN_9."\\n\\n".CONTENT_ADMIN_JS_LAN_0."\\n\\n[".CONTENT_ADMIN_JS_LAN_6." ".$catid." : ".$delete_heading."]\\n\\n")."')\"/>";
@@ -1041,7 +1042,7 @@ class contentform{
}
function manager(){
global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $stylespacer, $eArrayStorage, $CONTENT_ADMIN_MANAGER_START, $CONTENT_ADMIN_MANAGER_TABLE, $CONTENT_ADMIN_MANAGER_END, $catarray, $catid, $row, $pre;
global $qs, $sql, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $content_pref, $stylespacer, $eArrayStorage, $CONTENT_ADMIN_MANAGER_START, $CONTENT_ADMIN_MANAGER_TABLE, $CONTENT_ADMIN_MANAGER_END, $catarray, $catid, $row, $pre, $CONTENT_ADMIN_SPACER;
$catarray = $aa -> getCategoryTree("", "", FALSE);
$array = array_keys($catarray);
@@ -1057,6 +1058,8 @@ class contentform{
$text .= "<div style='text-align:center;'>".CONTENT_ADMIN_CAT_LAN_9."</div>";
}else{
$row = $sql -> db_Fetch();
$content_pref = $aa -> getContentPref($catarray[$catid][0]);
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
$text .= $tp -> parseTemplate($CONTENT_ADMIN_MANAGER_TABLE, FALSE, $content_shortcodes);
}
}
@@ -1325,9 +1328,9 @@ class contentform{
function show_order(){
global $qs, $sql, $sql2, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $content_pref, $CONTENT_ADMIN_ORDER_START, $CONTENT_ADMIN_ORDER_TABLE, $CONTENT_ADMIN_ORDER_END, $CONTENT_ADMIN_ORDER_UPDOWN, $CONTENT_ADMIN_ORDER_SELECT, $stylespacer, $catarray, $catid, $CONTENT_ADMIN_ORDER_AMOUNT, $CONTENT_ADMIN_ORDER_CAT, $CONTENT_ADMIN_ORDER_CATALL, $CONTENT_ADMIN_BUTTON, $row;
global $qs, $sql, $sql2, $ns, $rs, $aa, $plugintable, $plugindir, $tp, $content_shortcodes, $content_pref, $CONTENT_ADMIN_ORDER_START, $CONTENT_ADMIN_ORDER_TABLE, $CONTENT_ADMIN_ORDER_END, $CONTENT_ADMIN_ORDER_UPDOWN, $CONTENT_ADMIN_ORDER_SELECT, $stylespacer, $catarray, $catid, $CONTENT_ADMIN_ORDER_AMOUNT, $CONTENT_ADMIN_ORDER_CAT, $CONTENT_ADMIN_ORDER_CATALL, $CONTENT_ADMIN_BUTTON, $row, $CONTENT_ADMIN_SPACER;
if(!getperms("0")){ header("location:".e_SELF); exit; }
//if(!getperms("0")){ header("location:".e_SELF); exit; }
$catarray = $aa -> getCategoryTree("", "", FALSE);
$array = array_keys($catarray);
@@ -1365,9 +1368,9 @@ class contentform{
//count items in category
if(!is_object($sql2)){ $sql2 = new db; }
$n = $sql2 -> db_Count($plugintable, "(*)", "WHERE content_parent='".intval($catid)."' AND content_refer != 'sa' ");
if($n > 1){
if($n > 1 || $row['content_parent'] == 0){
$CONTENT_ADMIN_ORDER_CAT = "<a href='".e_SELF."?order.".$catarray[$catid][0].".".$catid."'>".CONTENT_ICON_ORDERCAT."</a>";
$CONTENT_ADMIN_ORDER_CATALL = ($row['content_parent'] == 0 ? "<a href='".e_SELF."?order.".$catid."'>".CONTENT_ICON_ORDERALL."</a>" : "");
$CONTENT_ADMIN_ORDER_CATALL = ($row['content_parent'] == 0 ? "<a href='".e_SELF."?order.".$catid."'>".CONTENT_ICON_ORDERALL."</a>" : "&nbsp;&nbsp;&nbsp;&nbsp;");
}
$CONTENT_ADMIN_ORDER_AMOUNT = "(".($n == 1 ? $n." ".CONTENT_ADMIN_CAT_LAN_56 : $n." ".CONTENT_ADMIN_CAT_LAN_57).")";
@@ -1393,6 +1396,7 @@ class contentform{
$sel .= "</select>";
$CONTENT_ADMIN_ORDER_SELECT = $sel;
$CONTENT_ADMIN_SPACER = ($row['content_parent']==0 ? TRUE : FALSE);
$text .= $tp -> parseTemplate($CONTENT_ADMIN_ORDER_TABLE, FALSE, $content_shortcodes);
}
}
@@ -1442,7 +1446,7 @@ class contentform{
if($ccheck != 1 && $ccheck != 0){
$up = "<a href='".e_SELF."?".$qrystring.".inc.".$cid."-".$corder."'>".CONTENT_ICON_ORDER_UP."</a> ";
}else{
$up = "&nbsp;&nbsp;&nbsp;";
$up = "&nbsp;&nbsp;&nbsp;&nbsp;";
}
//down arrow
if($ccheck != $content_total){