Changeset 658 for team

Show
Ignore:
Timestamp:
09/22/07 14:00:20 (14 months ago)
Author:
www-data
Message:

automerge commit

Location:
team/michiel/import_blogs
Files:
54 modified
3 copied

Legend:

Unmodified
Added
Removed
  • team/michiel/import_blogs

    • Property svnmerge-integrated changed from /trunk:1-654 to /trunk:1-657
  • team/michiel/import_blogs/common/mvblog.php

    r643 r658  
    245245                                                                $categories = explode(",", $row["categories_ids"]); 
    246246                                                                foreach ($categories as $v) { 
    247                                                                         if (array_key_exists($v, $this->categories)) 
     247                                                                        if (array_key_exists($v, $this->categories) && $this->categories[$v]["icon"]) 
     248                                                                                echo "<img src=\"images/categories/".$this->categories[$v]["icon"]."\" title=\"".htmlspecialchars($this->categories[$v]["name"])."\" alt=\"".htmlspecialchars($this->categories[$v]["name"])."\" class=\"category_icon\" />&nbsp;"; 
     249                                                                        elseif (array_key_exists($v, $this->categories)) 
    248250                                                                                echo htmlspecialchars($this->categories[$v]["name"])."&nbsp;"; 
    249251                                                                } 
  • team/michiel/import_blogs/common/mvblog_admin.php

    r655 r658  
    452452        function edit_cat($id) { 
    453453                $count = 0; 
     454                /* check for valid category */ 
    454455                if (!array_key_exists($id, $this->categories)) die("no valid category id"); 
     456                /* fetch icons for categories */ 
     457                $allowed_types = array("jpg", "png", "gif"); 
     458                $iconbasedir = "../images/categories/"; 
     459                $icons = array(); 
     460                if ($dh = opendir($iconbasedir)) { 
     461                        while (false !== ($v = readdir($dh))) { 
     462                                if (!is_dir($iconbasedir.$v) && in_array(substr($v, strlen($v)-3), $allowed_types)) 
     463                                        $icons[] = $v; 
     464                        } 
     465                } 
     466                asort($icons); 
     467                /* get copy of current category */ 
    455468                $cat = $this->categories[$id]; 
    456469                ?> 
     
    462475                                <h1 class="log_post_h1"><input type="text" name="cat[name]" value="<?php echo stripslashes($cat["name"]); ?>" /></h1> 
    463476                                <?php 
     477                                        /* count how many posts are holding this category */ 
    464478                                        $r =& $this->db->query(sprintf("SELECT COUNT(*) AS count FROM articles WHERE (categories_ids LIKE '%%,%1\$d' OR categories_ids LIKE '%1\$d,%%' OR categories_ids = '%d' OR categories_ids LIKE '%%,%1\$d,%%')", $id)); 
    465479                                        if (PEAR::isError($r)) { 
     
    469483                                ?> 
    470484                                <h2 class="log_post_h2"><?php echo sprintf(ngettext("%d article in this category", "%d articles in this category", $count["count"]), $count["count"]); ?></h2> 
     485                                <br /> 
     486                                <script language="Javascript1.2" type="text/javascript"> 
     487                                        function previewIcon() { 
     488                                                var selectedIcon = document.getElementById('iconselect').options[document.getElementById('iconselect').selectedIndex].value; 
     489                                                document.getElementById('iconPreview').innerHTML = '<img src="<?php echo $iconbasedir; ?>' + selectedIcon + '">'; 
     490                                        } 
     491                                </script> 
     492                                <?php 
     493                                /* show icons dropdown and preview of selected icon */ 
     494                                if (count($icons)) { 
     495                                        echo "<select name=\"cat[icon]\" id=\"iconselect\" onchange=\"previewIcon()\">\n"; 
     496                                        echo "<option value=\"0\">--</option>\n"; 
     497                                        foreach ($icons as $icon) { 
     498                                                if (array_key_exists("icon", $cat) && $cat["icon"] == $icon) 
     499                                                        $selected = " SELECTED"; 
     500                                                else 
     501                                                        $selected = ""; 
     502                                                echo "<option value=\"".$icon."\"".$selected.">".substr($icon, 0, strlen($icon)-4)."</option>\n"; 
     503                                        } 
     504                                        echo "</select>\n"; 
     505                                } 
     506                                echo gettext("choose category icon"); 
     507                                ?><br /> 
     508                                <span id="iconPreview"> 
     509                                        <?php 
     510                                        if (array_key_exists("icon", $cat)) 
     511                                                echo "<img src=\"".$iconbasedir.$cat["icon"]."\" alt=\"icon\">\n"; 
     512                                        ?> 
     513                                </span> 
    471514                        </div> 
    472515                        <div class="log_post_body"> 
     
    500543        function save_cat($cat) { 
    501544                if ($cat["id"]) { 
    502                         $query  = sprintf("UPDATE categories SET %s = '%s', %s = '%s', %s = %d, %s = %d WHERE id = %d", 
     545                        $query  = sprintf("UPDATE categories SET %s = '%s', %s = '%s', %s = %d, %s = %d, %s = '%s' WHERE id = %d", 
    503546                                $this->db_quote("name"),   preg_quote(strip_tags($cat["name"]), "'"), 
    504547                                $this->db_quote("desc"),   preg_quote(strip_tags($cat["description"]), "'"), 
    505548                                $this->db_quote("active"), $cat["active"], 
    506549                                $this->db_quote("public"), $cat["public"], 
     550                                $this->db_quote("icon"),   $cat["icon"], 
    507551                                $cat["id"] 
    508552                        ); 
    509553                } else { 
    510                         $query  = sprintf("INSERT INTO categories (%s, %s, %s, %s) VALUES ('%s', '%s', %d, %d)", 
    511                                 $this->db_quote("name"), $this->db_quote("desc"), $this->db_quote("active"), $this->db_quote("public"), 
     554                        $query  = sprintf("INSERT INTO categories (%s, %s, %s, %s, %s) VALUES ('%s', '%s', %d, %d, '%s')", 
     555                                $this->db_quote("name"), $this->db_quote("desc"), $this->db_quote("active"), $this->db_quote("public"), $this->db_quote("icon"), 
    512556                                preg_quote(strip_tags($cat["name"]), "'"), 
    513557                                preg_quote(strip_tags($cat["description"]), "'"), 
    514558                                $cat["active"], 
    515                                 $cat["public"] 
     559                                $cat["public"], 
     560                                $cat["icon"] 
    516561                        ); 
    517562                } 
  • team/michiel/import_blogs/common/mvblog_common.php

    r655 r658  
    498498                                "desc"   => "Category Description", 
    499499                                "public" => 1, 
    500                                 "active" => 1 
     500                                "active" => 1, 
     501                                "icon"   => 0 
    501502                        ) 
    502503                ); 
     
    510511                                "desc"   => $row["desc"], 
    511512                                "public" => $row["public"], 
    512                                 "active" => $row["active"] 
     513                                "active" => $row["active"], 
     514                                "icon"   => $row["icon"], 
    513515                        ); 
    514516                } 
     
    642644                                        $q = sprintf("AND public=%d AND aside = 0 AND date <= %d AND (categories_ids like '%%,%3\$d' OR categories_ids like '%3\$d,%%' OR categories_ids like '%%,%3\$d,%%' or categories_ids = '%3\$d')", $public, $options["max_time"], $options["category_id"]); 
    643645                                $title = "<p><h1 class=\"log_archive_h1\">".gettext("Archive of category")." <i>".$this->categories[$options["category_id"]]["name"]."</i></h1></p>"; 
    644                                 $desc  = "<br /><br /><div class=\"log_dossier_description\">".$this->categories[$options["category_id"]]["desc"]."</div><br />"; 
     646                                if ($this->categories[$options["category_id"]]["icon"]) 
     647                                        $icon = "<img src=\"images/categories/".$this->categories[$options["category_id"]]["icon"]."\" alt=\"".substr($this->categories[$options["category_id"]]["icon"], 0, strlen($this->categories[$options["category_id"]]["icon"])-4)."\" /><br />"; 
     648                                else 
     649                                        $icon = ""; 
     650                                $desc  = "<br /><br /><div class=\"log_dossier_description\">".$icon.$this->categories[$options["category_id"]]["desc"]."</div><br />"; 
    645651                                $url_prev = "?action=archive_cat&amp;c=".$options["category_id"]."&amp;top=".($options["top"]-$options["limit"]); 
    646652                                $url_next = "?action=archive_cat&amp;c=".$options["category_id"]."&amp;top=".($options["top"]+$options["limit"]); 
  • team/michiel/import_blogs/images/categories/README

    r627 r658  
    11This directory holds all the category icons. 
    2 If you want the 'upload new' field in the MvBlog admin 
    3 make sure you allow the webserver/php user to create new files. 
    42 
    53Feel free to populate this directory with icons using FTP/SFTP/WGET etc. 
     4 
     5By default this directory contains the images from News Topic Icons Project (version 0.4) 
     6I reduced them to 50% of the original size. 
  • team/michiel/import_blogs/style/MvBlog/index.css

    r548 r658  
    192192} 
    193193 
     194h1.log_post_caticon { 
     195        /* category icon */ 
     196        display: inline; 
     197} 
     198 
    194199h2.log_post_h2 { 
    195200        /* category */