[o2on-svn] [114] スレッド検索画面で、チェックボックスを使って複数のスレッドに対して処理するインターフェイスを追加。

Back to archive index

o2on svn commit o2on-****@lists*****
2008年 8月 2日 (土) 18:28:47 JST


Revision: 114
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=o2on&view=rev&rev=114
Author:   osa_p
Date:     2008-08-02 18:28:47 +0900 (Sat, 02 Aug 2008)

Log Message:
-----------
スレッド検索画面で、チェックボックスを使って複数のスレッドに対して処理するインターフェイスを追加。
上書き更新後ブラウザのキャッシュをクリアしないと、古いo2on.jsが参照されてしまうのか処理に失敗します。(落ちたりはしない)

Modified Paths:
--------------
    branches/BRANCH_0043/o2on/admin/o2on.js
    branches/BRANCH_0043/o2on/admin/query.xsl
    branches/BRANCH_0043/o2on/src.o2on/O2Server_HTTP_Admin.h

Modified: branches/BRANCH_0043/o2on/admin/o2on.js
===================================================================
--- branches/BRANCH_0043/o2on/admin/o2on.js	2008-07-31 04:24:24 UTC (rev 113)
+++ branches/BRANCH_0043/o2on/admin/o2on.js	2008-08-02 09:28:47 UTC (rev 114)
@@ -355,22 +355,49 @@
 // ---------------------------------------------------------------------------
 function deleteQuery(hash)
 {
+  if (hash == "") hash = getCheckThread();
+  if (hash == "") return;
 	document.d.act.value = "delete";
-	document.d.hash.value = hash;
+  document.d.hash.value = hash;
 	document.d.submit();
 }
 function activateQuery(hash)
 {
+  if (hash == "") hash = getCheckThread();
+  if (hash == "") return;
 	document.d.act.value = "activate";
-	document.d.hash.value = hash;
+  document.d.hash.value = hash;
 	document.d.submit();
 }
 function deactivateQuery(hash)
 {
+  if (hash == "") hash = getCheckThread();
+  if (hash == "") return;
 	document.d.act.value = "deactivate";
-	document.d.hash.value = hash;
+  document.d.hash.value = hash;
 	document.d.submit();
 }
+function checkAllThread(flag)
+{
+	elms = document.getElementsByTagName("input");
+	for (i = 0; i < elms.length; i++) {
+		if (elms[i].type == "checkbox" && elms[i].name == "thread")
+			elms[i].checked = flag;
+	}
+}
+function getCheckThread()
+{
+  var hash = "";
+	elms = document.getElementsByTagName("input");
+	for (i = 0; i < elms.length; i++) {
+		if (elms[i].type == "checkbox" && elms[i].name == "thread" && elms[i].checked == true) {
+      if (hash != '') hash = hash + ',';
+      hash = hash + elms[i].value;
+    }
+	}
+  if (hash == "") alert("対象を選択してください。");
+  return hash;
+}
 
 // ---------------------------------------------------------------------------
 //	メッセンジャー画面用

Modified: branches/BRANCH_0043/o2on/admin/query.xsl
===================================================================
--- branches/BRANCH_0043/o2on/admin/query.xsl	2008-07-31 04:24:24 UTC (rev 113)
+++ branches/BRANCH_0043/o2on/admin/query.xsl	2008-08-02 09:28:47 UTC (rev 114)
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8"?>
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-	<xsl:template match="/">
- 		<xsl:apply-templates select="keys"/>
-	</xsl:template>
-	<xsl:template match="keys">
-	  <div id="body" class="body">
+  <xsl:template match="/">
+    <xsl:apply-templates select="keys"/>
+  </xsl:template>
+  <xsl:template match="keys">
+    <div id="body" class="body">
       <div class="category">
         <form name="d" method="POST" action="/xml/query">
           スレッド検索
@@ -21,76 +21,82 @@
           <input type="submit" class="btn" style="width:80px" value="登録"/>
           <input type="hidden" name="act" value="add"/>
           <input type="hidden" name="hash"/>
- 				</form>
+        </form>
       </div>
       <div class="infomessage {info/message_type}">
         <xsl:value-of select="info/message"/>
       </div>
-    	<table width="100%">
-    	  <tr>
-    	    <td class="layout" valign="bottom" width="40%">
-          	<span>
-                <xsl:value-of select="info/count"/>
-          	</span>
+      <table width="100%">
+        <tr>
+          <td class="layout" valign="bottom" width="40%">
+            <span>
+              <xsl:value-of select="info/count"/>スレッド 
+            </span>
+            <input type="button" value="å…¨" onClick="checkAllThread(true)"/>
+            <input type="button" value="解" onClick="checkAllThread(false)"/>
+            <input type="button" value="無効にする" onClick="deactivateQuery('')"/>
+            <input type="button" value="有効にする" onClick="activateQuery('')"/>
+            <input type="button" value="削除" onClick="deleteQuery('')"/>
           </td>
           <td class="layout" width="20%">
-         	  <input type="button" class="btn" value="再表示" onClick="Reload()"/>
+            <input type="button" class="btn" value="再表示" onClick="Reload()"/>
           </td>
           <td class="layout" width="40%" align="right">
           </td>
-    	  </tr>
-    	</table>
-    	<table width="100%">
-      	<tr>
-        	<th></th>
-        	<th class="sort" onClick="Sort('date','text')">補完日時</th>
-        	<th class="sort" onClick="Sort('size','number')">所有size</th>
-        	<th class="sort" onClick="Sort('title','text')">タイトル / メモ</th>
-        	<th class="sort" onClick="Sort('url','text')">URL / Hash</th>
-      	</tr>
-  			<xsl:apply-templates select="key">
+        </tr>
+      </table>
+      <table width="100%">
+        <tr>
+          <th></th>
+          <th class="sort" onClick="Sort('date','text')">補完日時</th>
+          <th class="sort" onClick="Sort('size','number')">所有size</th>
+          <th class="sort" onClick="Sort('title','text')">タイトル / メモ</th>
+          <th class="sort" onClick="Sort('url','text')">URL / Hash</th>
+        </tr>
+        <xsl:apply-templates select="key">
           <xsl:sort select="SORTKEY" data-type="SORTTYPE" order="SORTORDER"/>
         </xsl:apply-templates>
-  		</table>
+      </table>
     </div>
-	</xsl:template>
-	<xsl:template match="key">
-	  <xsl:param name="limit" select="LIMIT"/>
-  	<tr>
-  	  <td class="{enable}">
+  </xsl:template>
+  <xsl:template match="key">
+  <xsl:param name="limit" select="LIMIT"/>
+    <tr>
+      <td class="{enable}">
+        <input type="checkbox" class="checkbox btn" name="thread" value="{hash}"/>
         <xsl:if test="enable = 'enable'">
-    	    <input type="button" value="無効にする" onClick="deactivateQuery('{hash}')"/>
-    	  </xsl:if>
+          <input type="button" value="無効にする" onClick="deactivateQuery('{hash}')"/>
+        </xsl:if>
         <xsl:if test="enable = 'disable'">
-    	    <input type="button" value="有効にする" onClick="activateQuery('{hash}')"/>
-    	  </xsl:if>
-  	    <input type="button" value="削除" onClick="deleteQuery('{hash}')"/>
-  	  </td>
-  		<td class="{enable} C">
-  			<xsl:value-of select="date"/>
-  		</td>
-  		<td class="{enable} R">
-  			<xsl:value-of select="format-number(size, '###,###,###,###')"/>
-  		</td>
-  		<td class="{enable}" valign="top">
-  		  <xsl:if test="size and size != 0 and title and title != ''">
+          <input type="button" value="有効にする" onClick="activateQuery('{hash}')"/>
+        </xsl:if>
+        <input type="button" value="削除" onClick="deleteQuery('{hash}')"/>
+      </td>
+      <td class="{enable} C">
+        <xsl:value-of select="date"/>
+      </td>
+      <td class="{enable} R">
+        <xsl:value-of select="format-number(size, '###,###,###,###')"/>
+      </td>
+      <td class="{enable}" valign="top">
+        <xsl:if test="size and size != 0 and title and title != ''">
           <a href="javascript:openDat('{hash}')">
-    				<xsl:value-of select="title"/>
-    		  </a>
-    		</xsl:if>
-  		  <xsl:if test="not(size) or size = 0 or not(title) or title = ''">
-    			<xsl:value-of select="title"/>
-    		</xsl:if>
-    		<br/>
-   			<xsl:value-of select="note"/>
-  		</td>
-  		<td class="{enable}">
-  		  <span onClick="selectText(this)">
-    			<xsl:value-of select="url"/>
-    		</span>
-  			<br/>
-   			<xsl:value-of select="hash"/>
-  		</td>
-  	</tr>
-	</xsl:template>
+            <xsl:value-of select="title"/>
+          </a>
+        </xsl:if>
+        <xsl:if test="not(size) or size = 0 or not(title) or title = ''">
+          <xsl:value-of select="title"/>
+        </xsl:if>
+        <br/>
+        <xsl:value-of select="note"/>
+      </td>
+      <td class="{enable}">
+        <span onClick="selectText(this)">
+          <xsl:value-of select="url"/>
+        </span>
+        <br/>
+        <xsl:value-of select="hash"/>
+      </td>
+    </tr>
+  </xsl:template>
 </xsl:stylesheet>

Modified: branches/BRANCH_0043/o2on/src.o2on/O2Server_HTTP_Admin.h
===================================================================
--- branches/BRANCH_0043/o2on/src.o2on/O2Server_HTTP_Admin.h	2008-07-31 04:24:24 UTC (rev 113)
+++ branches/BRANCH_0043/o2on/src.o2on/O2Server_HTTP_Admin.h	2008-08-02 09:28:47 UTC (rev 114)
@@ -636,12 +636,18 @@
 					// remove query
 					it = hdr->queries.find("hash");
 					if (it != hdr->queries.end()) {
-						if (it->second.size() >= HASHSIZE*2) {
-							hashT hash;
-							hash.assign(it->second.c_str(), it->second.size());
-							if (QueryDB->DeleteKey(hash)) {
-								msg = L"íœ‚µ‚Ü‚µ‚½";
-								QueryDB->Save(Profile->GetQueryFilePath());
+						strarray hasharray;
+						// comma separate
+						if (split(it->second.c_str(), ",", hasharray ) > 0) {
+							for (uint hashidx = 0; hashidx < hasharray.size(); hashidx++) {
+								if (hasharray[ hashidx ].size() >= HASHSIZE*2) {
+									hashT hash;
+									hash.assign( hasharray[ hashidx ].c_str(), hasharray[ hashidx ].size() );
+									if (QueryDB->DeleteKey(hash)) {
+										msg = L"íœ‚µ‚Ü‚µ‚½";
+										QueryDB->Save(Profile->GetQueryFilePath());
+									}
+								}
 							}
 						}
 					}
@@ -650,12 +656,18 @@
 					// activate query
 					it = hdr->queries.find("hash");
 					if (it != hdr->queries.end()) {
-						if (it->second.size() >= HASHSIZE*2) {
-							hashT hash;
-							hash.assign(it->second.c_str(), it->second.size());
-							if (QueryDB->SetEnable(hash,true)) {
-								msg = L"—LŒø‚É‚µ‚Ü‚µ‚½";
-								QueryDB->Save(Profile->GetQueryFilePath());
+						strarray hasharray;
+						// comma separate
+						if (split(it->second.c_str(), ",", hasharray ) > 0) {
+							for (uint hashidx = 0; hashidx < hasharray.size(); hashidx++) {
+								if (hasharray[ hashidx ].size() >= HASHSIZE * 2) {
+									hashT hash;
+									hash.assign( hasharray[ hashidx ].c_str(), hasharray[ hashidx ].size() );
+									if (QueryDB->SetEnable(hash,true)) {
+										msg = L"—LŒø‚É‚µ‚Ü‚µ‚½";
+										QueryDB->Save(Profile->GetQueryFilePath());
+									}
+								}
 							}
 						}
 					}
@@ -664,12 +676,18 @@
 					// deactivate query
 					it = hdr->queries.find("hash");
 					if (it != hdr->queries.end()) {
-						if (it->second.size() >= HASHSIZE*2) {
-							hashT hash;
-							hash.assign(it->second.c_str(), it->second.size());
-							if (QueryDB->SetEnable(hash,false)) {
-								msg = L"–³Œø‚É‚µ‚Ü‚µ‚½";
-								QueryDB->Save(Profile->GetQueryFilePath());
+						strarray hasharray;
+						// comma separate
+						if (split(it->second.c_str(), ",", hasharray ) > 0) {
+							for (uint hashidx = 0; hashidx < hasharray.size(); hashidx++) {
+								if (hasharray[ hashidx ].size() >= HASHSIZE * 2) {
+									hashT hash;
+									hash.assign( hasharray[ hashidx ].c_str(), hasharray[ hashidx ].size() );
+									if (QueryDB->SetEnable(hash,false)) {
+										msg = L"–³Œø‚É‚µ‚Ü‚µ‚½";
+										QueryDB->Save(Profile->GetQueryFilePath());
+									}
+								}
 							}
 						}
 					}




o2on-svn メーリングリストの案内
Back to archive index