Changeset 692 for team

Show
Ignore:
Timestamp:
11/01/07 21:00:44 (14 months ago)
Author:
www-data
Message:

automerge commit

Location:
team/michiel/import_blogs
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • team/michiel/import_blogs

    • Property svnmerge-integrated changed from /trunk:1-682 to /trunk:1-691
  • team/michiel/import_blogs/plugins/altarchive.php

    r481 r692  
    6464                else 
    6565                        $url = "index.php?action=archive&m="; 
    66                 /* this should be a setting for this plugin */ 
    6766                /* years to show */ 
    68                 $years  = 3; 
     67                if (array_key_exists("altarchive_showyears", $this->_settings)) 
     68                        $years = $this->_settings["altarchive_showyears"]; 
     69                else 
     70                        $years  = 3; 
    6971                $output = ""; 
    7072                for ($i=date("Y"); $i>date("Y")-$years; $i--) { 
     
    120122        /* show_settings {{{ */ 
    121123        public function show_settings() { 
    122                 $output  = "<form name=\"acronym\" method=\"post\" action=\"index.php\">"; 
     124                $output  = "<form name=\"altarchive_settings\" method=\"post\" action=\"index.php\">"; 
    123125                $output .= "<input type=\"hidden\" name=\"action\" value=\"save_plugin_setting\" />"; 
    124126                $output .= "<input type=\"hidden\" name=\"plugin\" value=\"altarchive\" />"; 
     
    135137                $output .= ">".gettext("no")."</option>"; 
    136138                $output .= "</select></td>\n"; 
     139                $output .= "</tr><tr>"; 
     140                $output .= "<td>".gettext("years to show")."</td>"; 
     141                $output .= "<td><select name=\"altarchive_showyears\">"; 
     142                for ($i=1;$i<10;$i++) { 
     143                        $output .= "<option value=\"$i\""; 
     144                        if (array_key_exists("altarchive_showyears", $this->_settings) && $this->_settings["altarchive_showyears"] == $i) 
     145                                $output .= " selected=\"selected\""; 
     146                        $output .= ">$i</option>"; 
     147                } 
     148                $output .= "</select></td>"; 
    137149                $output .= "</tr><tr>"; 
    138150                $output .= "<td colspan=\"2\"><input type=\"submit\" value=\"".gettext("Save")."\" /></td>"; 
     
    158170                $res = $this->_mvblog->db->exec($sql); 
    159171                $this->_settings["altarchive_showdefaultcss"] = sprintf("%d", $requestdata["altarchive_showdefaultcss"]); 
     172                /* first look if the setting is already there */ 
     173                $sql = "SELECT COUNT(*) FROM settings WHERE settingname = 'altarchive_showyears'"; 
     174                $res = $this->_mvblog->db->query($sql); 
     175                $row = $res->fetchRow(); 
     176                if ($row[0]) { 
     177                        /* yes, so update */ 
     178                        $sql = sprintf("UPDATE settings SET settingvalue='%d' WHERE settingname='altarchive_showyears'", $requestdata["altarchive_showyears"]); 
     179                } else { 
     180                        /* no, so insert */ 
     181                        $sql = sprintf("INSERT INTO settings (settingname, settingvalue) VALUES ('altarchive_showyears', '%d')", $requestdata["altarchive_showyears"]); 
     182                } 
     183                $res = $this->_mvblog->db->exec($sql); 
     184                $this->_settings["altarchive_showyears"] = sprintf("%d", $requestdata["altarchive_showyears"]); 
    160185                $this->show_settings(); 
    161186        } 
  • team/michiel/import_blogs/plugins/altarchive_onemonth.php

    r636 r692  
    5858        /* genaltarchive_onemonth {{{ */ 
    5959        public function genaltarchive_onemonth($defaultmenu) { 
     60                /* find out what the oldest post date is */ 
     61                $q = "SELECT date FROM articles WHERE active = 1 AND public = 1 ORDER BY date LIMIT 1"; 
     62                $res = $this->_mvblog->db->query($q); 
     63                $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC); 
     64                $oldest = $row["date"]; 
     65 
    6066                $output   = ""; 
    6167                $url_next = ""; 
     
    124130                } 
    125131                $output .= "</tr><tr>\n"; 
    126                 $output .= "<td class=\"altarchive_onemonth_month_noitems\" colspan=\"3\"><a href=\"$url_prev\"><< ".strftime("%b", mktime(0, 0, 0, $_month-1, 1, $_year))."</a></td>\n"; 
     132                if ($oldest < mktime(0, 0, 0, $_month, 1, $_year)) 
     133                        $output .= "<td class=\"altarchive_onemonth_month_noitems\" colspan=\"3\"><a href=\"$url_prev\"><< ".strftime("%b", mktime(0, 0, 0, $_month-1, 1, $_year))."</a></td>\n"; 
     134                else 
     135                        $output .= "<td class=\"altarchive_onemonth_month_noitems\" colspan=\"3\">&nbsp;</td>\n"; 
    127136                $output .= "<td class=\"altarchive_onemonth_month_noitems\">&nbsp;</td>\n"; 
    128137                if (date("m") == $_month)