Changeset 692
- Timestamp:
- 11/01/07 21:00:44 (14 months ago)
- Location:
- team/michiel/import_blogs
- Files:
-
- 3 modified
-
. (modified) (1 prop)
-
plugins/altarchive.php (modified) (4 diffs)
-
plugins/altarchive_onemonth.php (modified) (2 diffs)
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 64 64 else 65 65 $url = "index.php?action=archive&m="; 66 /* this should be a setting for this plugin */67 66 /* 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; 69 71 $output = ""; 70 72 for ($i=date("Y"); $i>date("Y")-$years; $i--) { … … 120 122 /* show_settings {{{ */ 121 123 public function show_settings() { 122 $output = "<form name=\"a cronym\" method=\"post\" action=\"index.php\">";124 $output = "<form name=\"altarchive_settings\" method=\"post\" action=\"index.php\">"; 123 125 $output .= "<input type=\"hidden\" name=\"action\" value=\"save_plugin_setting\" />"; 124 126 $output .= "<input type=\"hidden\" name=\"plugin\" value=\"altarchive\" />"; … … 135 137 $output .= ">".gettext("no")."</option>"; 136 138 $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>"; 137 149 $output .= "</tr><tr>"; 138 150 $output .= "<td colspan=\"2\"><input type=\"submit\" value=\"".gettext("Save")."\" /></td>"; … … 158 170 $res = $this->_mvblog->db->exec($sql); 159 171 $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"]); 160 185 $this->show_settings(); 161 186 } -
team/michiel/import_blogs/plugins/altarchive_onemonth.php
r636 r692 58 58 /* genaltarchive_onemonth {{{ */ 59 59 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 60 66 $output = ""; 61 67 $url_next = ""; … … 124 130 } 125 131 $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\"> </td>\n"; 127 136 $output .= "<td class=\"altarchive_onemonth_month_noitems\"> </td>\n"; 128 137 if (date("m") == $_month)
