<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -23,20 +23,96 @@
 			Route::current()-&gt;remove(&quot;tag/(name)/&quot;);
 		}
 
+		public function admin_head() {
+?&gt;
+		&lt;script type=&quot;text/javascript&quot;&gt;
+			$(function(){
+				function scanTags(){
+					$(&quot;.tags_select a&quot;).each(function(){
+						regexp = new RegExp(&quot;(, ?|^)&quot;+ $(this).text() +&quot;(, ?|$)&quot;, &quot;g&quot;)
+						if ($(&quot;#tags&quot;).val().match(regexp))
+							$(this).addClass(&quot;tag_added&quot;)
+						else
+							$(this).removeClass(&quot;tag_added&quot;)
+					})
+				}
+				scanTags()
+				$(&quot;#tags&quot;).livequery(&quot;keyup&quot;, scanTags)
+			})
+
+			function add_tag(name, link) {
+				if ($(&quot;#tags&quot;).val().match(&quot;(, |^)&quot;+ name +&quot;(, |$)&quot;)) {
+					regexp = new RegExp(&quot;(, |^)&quot;+ name +&quot;(, |$)&quot;, &quot;g&quot;)
+					$(&quot;#tags&quot;).val($(&quot;#tags&quot;).val().replace(regexp, function(match, before, after){
+						if (before == &quot;, &quot; &amp;&amp; after == &quot;, &quot;)
+							return &quot;, &quot;
+						else
+							return &quot;&quot;
+					}))
+
+					$(link).removeClass(&quot;tag_added&quot;)
+				} else {
+					if ($(&quot;#tags&quot;).val() == &quot;&quot;)
+						$(&quot;#tags&quot;).val(name)
+					else
+						$(&quot;#tags&quot;).val($(&quot;#tags&quot;).val() + &quot;, &quot;+ name)
+
+					$(link).addClass(&quot;tag_added&quot;)
+				}
+			}
+		&lt;/script&gt;
+		&lt;style type=&quot;text/css&quot; media=&quot;screen&quot;&gt;
+			.tags_select {
+				display: inline-block;
+				margin-top: .5em;
+			}
+			.tags_select a {
+				padding: .1em .4em;
+				border: .1em solid #DDDDA8;
+				background: #FFFFCA;
+				text-decoration: none;
+				border-top-width: 0;
+				border-left-width: 0;
+				color: #555;
+			}
+			.tags_select a.tag_added {
+				background: #eee;
+				border-top-width: .1em;
+				border-bottom: 0;
+				border-left-width: .1em;
+				border-right: 0;
+				border-color: #ddd;
+			}
+		&lt;/style&gt;
+&lt;?php
+		}
+
 		public function new_post_options() {
+			$tags = self::list_tags();
 ?&gt;
 					&lt;p&gt;
 						&lt;label for=&quot;tags&quot;&gt;&lt;?php echo __(&quot;Tags&quot;, &quot;tags&quot;); ?&gt; &lt;span class=&quot;sub&quot;&gt;&lt;?php echo __(&quot;(comma separated)&quot;, &quot;tags&quot;); ?&gt;&lt;/span&gt;&lt;/label&gt;
 						&lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;tags&quot; value=&quot;&quot; id=&quot;tags&quot; /&gt;
+						&lt;span class=&quot;tags_select&quot;&gt;
+&lt;?php foreach ($tags as $tag): ?&gt;
+							&lt;a href=&quot;javascript:add_tag('&lt;?php echo addslashes($tag[&quot;name&quot;]); ?&gt;', '.tag_&lt;?php echo addslashes($tag[&quot;url&quot;]); ?&gt;')&quot; class=&quot;tag_&lt;?php echo $tag[&quot;url&quot;]; ?&gt;&quot;&gt;&lt;?php echo $tag[&quot;name&quot;]; ?&gt;&lt;/a&gt;
+&lt;?php endforeach; ?&gt;
+						&lt;/span&gt;
 					&lt;/p&gt;
 &lt;?php
 		}
 
 		public function edit_post_options($post) {
+			$tags = self::list_tags();
 ?&gt;
 					&lt;p&gt;
 						&lt;label for=&quot;tags&quot;&gt;&lt;?php echo __(&quot;Tags&quot;, &quot;tags&quot;); ?&gt; &lt;span class=&quot;sub&quot;&gt;&lt;?php echo __(&quot;(comma separated)&quot;, &quot;tags&quot;); ?&gt;&lt;/span&gt;&lt;/label&gt;
 						&lt;input class=&quot;text&quot; type=&quot;text&quot; name=&quot;tags&quot; value=&quot;&lt;?php echo implode(&quot;, &quot;, self::unlinked_tags($post-&gt;unclean_tags)) ?&gt;&quot; id=&quot;tags&quot; /&gt;
+						&lt;span class=&quot;tags_select&quot;&gt;
+&lt;?php foreach ($tags as $tag): ?&gt;
+							&lt;a href=&quot;javascript:add_tag('&lt;?php echo addslashes($tag[&quot;name&quot;]); ?&gt;', '.tag_&lt;?php echo addslashes($tag[&quot;url&quot;]); ?&gt;')&quot; class=&quot;tag_&lt;?php echo $tag[&quot;url&quot;]; ?&gt;&quot;&gt;&lt;?php echo $tag[&quot;name&quot;]; ?&gt;&lt;/a&gt;
+&lt;?php endforeach; ?&gt;
+						&lt;/span&gt;
 					&lt;/p&gt;
 &lt;?php
 		}</diff>
      <filename>modules/tags/tags.php</filename>
    </modified>
    <modified>
      <diff>@@ -514,6 +514,20 @@
 		Config::set(&quot;sql&quot;, Config::get(&quot;database&quot;));
 		Config::remove(&quot;database&quot;);
 	}
+
+	function update_post_status_column() {
+		$sql = SQL::current();
+		$column = $sql-&gt;query(&quot;SHOW COLUMNS FROM __posts WHERE Field = 'status'&quot;);
+		if (!$column)
+		     return;
+
+		$result = $column-&gt;fetchObject();
+		if ($result-&gt;Type == &quot;varchar(32)&quot;)
+			return;
+
+		echo __(&quot;Updating `status` column on `posts` table...&quot;)
+		     .test($sql-&gt;query(&quot;ALTER TABLE __posts CHANGE status status VARCHAR(32) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'public'&quot;));
+	}
 ?&gt;
 &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;
 	&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
@@ -673,6 +687,8 @@
 
 		rename_database_config();
 
+		update_post_status_column();
+
 		foreach ((array) Config::get(&quot;enabled_modules&quot;) as $module)
 			if (file_exists(MAIN_DIR.&quot;/modules/&quot;.$module.&quot;/upgrades.php&quot;)) {
 				echo _f(&quot;Calling \&quot;%s\&quot; module's upgrader...&quot;, array($module)).&quot;\n&quot;;</diff>
      <filename>upgrade.php</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1203fa4e51119f191077cfe378f5dce80f78faae</id>
    </parent>
  </parents>
  <author>
    <name>Alex Suraci</name>
    <email>i.am@toogeneric.com</email>
  </author>
  <url>http://github.com/vito/chyrp/commit/c33efaf5af8bd283233a863567edc8ceabd3bd05</url>
  <id>c33efaf5af8bd283233a863567edc8ceabd3bd05</id>
  <committed-date>2008-08-17T15:15:30-07:00</committed-date>
  <authored-date>2008-08-17T15:14:31-07:00</authored-date>
  <message>* Added JS-aided tag selection when writing/editing posts in the admin. [#109 state:resolved]
* Added an update_post_status_column upgrader function.</message>
  <tree>5b4665428eb8bddb53428ecae97676b8409fa806</tree>
  <committer>
    <name>Alex Suraci</name>
    <email>i.am@toogeneric.com</email>
  </committer>
</commit>
