アマゾンのフルフィルメントの確認
元記事はこちらです。
■Application.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#" sessionmanagement="yes" sessiontimeout=#CreateTimeSpan(1, 0, 0, 0)# > <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> <cfset request.amDev = "xxx"> <!-- amazon developer's token --> <cfset request.amSecretKey = "yyy"> <!-- amazon SecretKey -->
■index.cfm
<!--- デバック表示させない ---> <cfsetting showDebugOutput="no"> <cfset isFBA = false> <cfparam name="url.asin" default=""> <cfif url.asin neq ""> <cftry> <cfset isFBA = exec(url.asin)> <cfcatch> <!--- <cfdump var="#cfcatch#"> ---> </cfcatch> </cftry> </cfif> <cfoutput>#isFBA#</cfoutput> <!---=============================== exec ================================---> <cffunction name="exec" access="public" returnType="boolean" output="no"> <cfargument name="asin" type="string" required="yes"> <cfset var local = structNew()> <cfset local.page = 1> <cfset local.xml = getData(arguments.asin, local.page)> <cfset local.TotalOfferPages = local.xml.ItemLookupResponse.Items.Item.Offers.TotalOfferPages.XmlText> <cfset local.isFBA = false> <cfloop index="local.page" from="1" to="#local.TotalOfferPages#"> <!--- 2page以降 ---> <cfif (local.page neq 1)> <cfset local.xml = getData(arguments.asin, local.page)> </cfif> <cfset local.ary = XmlSearch(local.xml, "ItemLookupResponse/Items/Item/Offers/Offer")> <cfloop index="local.idx" array="#local.ary#"> <cfif (local.idx.OfferListing.IsEligibleForSuperSaverShipping.XmlText eq "1")> <cfreturn true> </cfif> </cfloop> </cfloop> <cfreturn false> </cffunction> <!---=============================== getData ================================---> <cffunction name="getData" access="public" returnType="any" output="no"> <cfargument name="asin" type="string" required="yes"> <cfargument name="page" type="string" required="yes"> <cfset var local = structNew()> <cfset local.url = "http://webservices.amazon.co.jp/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=#request.amDev#&Operation=ItemLookup&ItemId=#arguments.asin#&Condition=Used&MerchantId=All&ResponseGroup=Small,Offers&OfferPage=#arguments.page#"> <cfset local.tmp = chgAmUrl(local.url, request.amSecretKey)> <cfhttp timeout="60" url="#local.tmp#" proxyServer="#request.proxyServer#" proxyPort="#request.proxyPort#" method = "get"> <!--- 名前空間部分を削除 ---> <cfset local.xml = REReplace(cfhttp.fileContent, "\s*xmlns=""[^""]*""", "", "all")> <cfset local.xml= XmlParse(local.xml)> <cfreturn local.xml> </cffunction> <!---=============================== chgAmUrl ================================---> <cffunction name="chgAmUrl" access="public" returnType="string" output="no"> <cfargument name="url" type="string" required="yes"> <cfargument name="key" type="string" required="yes"> <cfset var local = structNew()> <cfset local.url = arguments.url> <cfset local.dateTimeString = GetHTTPTimeString(Now())> <cfset local.Timestamp = DateFormat(local.dateTimeString, "yyyy-mm-dd") & "T" & TimeFormat(local.dateTimeString, "HH:mm:ss") & "Z"> <cfif not FindNoCase("Timestamp=",local.url)> <cfset local.url = local.url & "&Timestamp=#local.Timestamp#"> </cfif> <cfset local.urlBefore = ListGetAt(local.url, 1, "?")> <cfset local.urlAfter = ListGetAt(local.url, 2, "?")> <!--- リクエスト内のコンマ (,) およびコロン (:) をURLエンコード ---> <cfset local.urlAfter = Replace(local.urlAfter, ",", "%2C", "all")> <cfset local.urlAfter = Replace(local.urlAfter, ":", "%3A", "all")> <cfset local.ary = ListToArray(local.urlAfter, "&")> <cfset local.arySort = ArraySort(local.ary, "text")> <cfset local.list = ArrayToList(local.ary, "&")> <cfset local.amHead = "GET,#ListGetAt(local.urlBefore,2,"/")#,/#ListGetAt(local.urlBefore,3,"/")#/#ListGetAt(local.urlBefore,4,"/")#"> <cfset local.tmp = ""> <cfloop index="local.idx" list="#local.amHead#"> <cfset local.tmp = local.tmp & local.idx & chr(10)> </cfloop> <cfset local.tmp = local.tmp & local.list> <!--- 変換 ---> <cfset local.sig = HMAC_SHA256(arguments.key, local.tmp)> <cfset local.sigg = BinaryEncode(local.sig, "base64")> <!--- 署名に含まれているプラス (+) とイコール (=) をURLエンコードする。---> <cfset local.sigg = Replace(local.sigg, "+", "%2B", "all")> <cfset local.sigg = Replace(local.sigg, "=", "%3D", "all")> <cfreturn local.urlBefore & "?" & local.list & "&Signature=#local.sigg#"> </cffunction> <!---=============================== HMAC_SHA256 ================================---> <cffunction name="HMAC_SHA256" returntype="binary" access="private" output="false" hint="NSA SHA-256 Algorithm"> <cfargument name="signKey" type="string" required="true" /> <cfargument name="signMessage" type="string" required="true" /> <cfset var jMsg = JavaCast("string",arguments.signMessage).getBytes("utf-8") /> <cfset var jKey = JavaCast("string",arguments.signKey).getBytes("utf-8") /> <cfset var key = createObject("java","javax.crypto.spec.SecretKeySpec") /> <cfset var mac = createObject("java","javax.crypto.Mac") /> <cfset key = key.init(jKey,"HmacSHA256") /> <cfset mac = mac.getInstance(key.getAlgorithm()) /> <cfset mac.init(key) /> <cfset mac.update(jMsg) /> <cfreturn mac.doFinal() /> </cffunction>
ColdFusionで簡易ファイルブラウザ
元記事はこちらです。
■Application.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#" sessionmanagement="yes" sessiontimeout=#CreateTimeSpan(0, 0, 10, 0)# > <cfparam name="session.key" default=""> <cfset request.key = "123"> <!---=============================== path OSによるパスの違い Windows:\ Windows以外:/ ================================---> <cffunction name="getPath" access="public" returnType="string" output="no" hint="パスを取得(Windowsは\,それ以外は/)"> <cfset var path=""> <cfif server.os.name contains "Windows"> <cfset path = "\"> <cfelse> <cfset path = "/"> </cfif> <cfreturn path> </cffunction>
■index.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// 簡易ファイルブラウザ //////////////////////////////////////////////////////////////////---> <cfparam name="url.key" default=""> <cfparam name="form.path" default="#GetDirectoryFromPath(getCurrentTemplatePath())#"> <cfparam name="form.name" default=""> <cfparam name="form.chk" default=""> <cfparam name="form.type" default=""> <cfparam name="form.create_type" default=""> <cfif (form.create_type neq "")> <cfset dttm = dateformat(now(), "yyyymmdd") & timeformat(now(), "HHmmss") & right("00#timeformat(now(), 'l')#", 3)> <cfif (form.create_type eq "Dir")> <cfdirectory action="create" directory="#form.path##dttm#" mode="707"> </cfif> <cfif (form.create_type eq "file")> <cffile action = "write" file = "#form.path##dttm#.txt" output = "dummy" mode = "707"> </cfif> </cfif> <cfif (url.key neq "")> <cfset session.key = url.key> </cfif> <cfif (form.chk neq "")> <cfif (form.type eq "Dir")> <cfdirectory name="qDir" directory="#form.path##form.name#"> <cfif (qDir.recordCount eq 0)> <cfdirectory action="delete" directory="#form.path##form.name#"> </cfif> </cfif> <cfif (form.type eq "file")> <cffile action="delete" file="#form.path##form.name#"> </cfif> </cfif> <!--- 画面表示 ---> <cfset dsp_list(form.path)> <!---================================================================= 画面表示 ==================================================================---> <cffunction name="dsp_list" returntype="void" output="yes"> <cfargument name="path" type="string" required="yes"> <cfset var local = structNew()> <cfset local.dir = arguments.path> <cfdirectory name="local.qDir" directory="#local.dir#" sort="type,name"> <cfoutput> <table border="1"> <tr> <td> #local.dir# </td> <form action="index.cfm" method="post"> <input type="hidden" name="path" value="#ListDeleteAt(local.dir, ListLen(local.dir,'#getPath()#'),'#getPath()#')##getPath()#"> <td><input type="submit" value="up"></td> </form> <form action="index.cfm" method="post"> <input type="hidden" name="path" value="#local.dir#"> <input type="hidden" name="create_type" value="Dir"> <td><input type="submit" value="createDir"></td> </form> <form action="index.cfm" method="post"> <input type="hidden" name="path" value="#local.dir#"> <input type="hidden" name="create_type" value="file"> <td><input type="submit" value="createFile"></td> </form> </tr> </table> <table border="1"> <tr> <td>check</td> <td>type</td> <td>name</td> <cfif (session.key eq request.key)> <td> </td> </cfif> <td> </td> </tr> <cfloop query="local.qDir"> <tr> <form name="frm_#local.qDir.currentRow#" action="index.cfm" method="post"> <input type="hidden" name="path" value="#local.dir#"> <input type="hidden" name="name" value="#local.qDir.name#"> <input type="hidden" name="type" value="#local.qDir.type#"> <td> <input type="checkbox" name="chk" value="1"> </td> <td>#local.qDir.type#</td> <td>#local.qDir.name#</td> <cfif (session.key eq request.key)> <td> <input type="submit" value="del"> </td> </cfif> </form> <cfif (local.qDir.type eq "Dir")> <form name="frm_down#local.qDir.currentRow#" action="index.cfm" method="post"> <input type="hidden" name="path" value="#local.dir##local.qDir.name##getPath()#"> <td> <input type="submit" value="down"> </td> </form> <cfelse> <td> </td> </cfif> </tr> </cfloop> </table> </cfoutput> </cffunction>
数値入力項目をカンマ区切りで再表示
元記事はこちらです。
■Application.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#">
■index.cfm
<!---///////////////////////////////////////////////////////////////// 表形式の縦横計算 ・数値のみ入力 ・カンマ区切りで表示 ・入力されるたびに合計計算 //////////////////////////////////////////////////////////////////---> <cfset request.row=3> <cfset request.col=3> <cfif findNoCase("ie", cgi.HTTP_USER_AGENT)> <cfset request.js_chkNum = " if(event.keyCode<'0'.charCodeAt(0) || event.keyCode>'9'.charCodeAt(0)) return false; "> <cfelse> <cfset request.js_chkNum = " if(event.charCode<'0'.charCodeAt(0) || event.charCode>'9'.charCodeAt(0)) return false; "> </cfif> <cfset local = structNew()> <cfoutput> <html> <head> <title>test</title> <style TYPE="text/css"> <!-- th { background-color:gainsboro; } --> </style> </head> <body> <form name="frm"> <table> <tr> <td> </td> <cfloop index="local.col" from="1" to="#request.col#"> <th>#local.col#</th> </cfloop> <th>ROW TOTAL</th> </tr> <cfloop index="local.row" from="1" to="#request.row#"> <tr> <th>#local.row#</th> <cfloop index="local.col" from="1" to="#request.col#"> <td> <input type="text" name="fld_#local.row#_#local.col#" style="text-align:right;" value="0" onKeyup="js_sum(this, #local.col#, #local.row#)" onKeypress="#request.js_chkNum#" onFocus="this.select()"> </td> </cfloop> <td> <input type="text" name="fld_row_#local.row#_ttl" style="text-align:right;" readonly> </td> </tr> </cfloop> <tr> <th>COL TOTAL</th> <cfloop index="local.col" from="1" to="#request.col#"> <td> <input type="text" name="fld_col_#local.col#_ttl" style="text-align:right;" readonly> </td> </cfloop> </tr> </table> </form> <script language="JavaScript" type="text/javascript"> <!-- function js_sum(obj, col, row){ with(document.frm){ <cfif findNoCase("ie", cgi.HTTP_USER_AGENT)> //タブの場合 if(event.keyCode==9){ obj.focus(); return; } </cfif> //行の合計 ttl = 0; for(i=1;i<=#request.col#;i++){ tmp = eval("fld_"+row+"_"+i+".value"); tmp = delComma1(tmp); ttl = ttl + eval(tmp); } eval("fld_row_"+row+"_ttl").value = insertComma1(ttl.toString()); //列の合計 ttl = 0; for(i=1;i<=#request.row#;i++){ tmp = eval("fld_"+i+"_"+col+".value"); tmp = delComma1(tmp); ttl = ttl + eval(tmp); } eval("fld_col_"+col+"_ttl").value = insertComma1(ttl.toString()); //入力した数値をカンマ表示に変換 tmp = delComma1(obj.value); tmp = insertComma1(tmp.toString()); obj.value = tmp; } } //カンマ挿入関数 function insertComma1(sourceStr) { var destStr = sourceStr; var tmpStr = ""; while (destStr != (tmpStr = destStr.replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2"))) { destStr = tmpStr; } return destStr; } //カンマ削除関数 function delComma1(w) { var z = w.replace(/,/g,""); return (z); } //--> </script> </body> </html> </cfoutput>
Nozbe APIを使ったデモのソース
元記事はこちらです。
■Application.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#" sessionmanagement="yes" sessiontimeout=#CreateTimeSpan(1, 0, 0, 0)# > <!---=================================== 設定 ====================================---> <cfset request.blog_url = ""> <!--- 通常 <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> ---> <!--- 会社 <cfset request.proxyServer = "xx"> <cfset request.proxyPort = "xx"> ---> <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> <cfparam name="session.key" default=""> <!--- Nozbe key ---> <cfparam name="session.p_id" default=""> <!--- Nozbe project id ---> <cfparam name="session.style" default="color:black;"> <!--- action listの色 --->
■index.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////---> <cfparam name="url.p" default=""> <cfparam name="form.mail" default=""> <cfparam name="form.pass" default=""> <cfparam name="form.p_id" default=""> <cfparam name="form.data" default=""> <!--- 処理 ---> <cfswitch expression = "#url.p#"> <!--- hide ---> <cfcase value="hide"> <cfset session.style = "color:white;"> </cfcase> <!--- show ---> <cfcase value="show"> <cfset session.style = "color:black;"> </cfcase> <!--- login ---> <cfcase value="login"> <cfset cst_chkLogin()> </cfcase> <!--- logout ---> <cfcase value="logout"> <cfset session.key = ""> <cfset session.p_id = ""> </cfcase> <!--- listProject ---> <cfcase value="listProject"> <cfset session.p_id = ""> </cfcase> <!--- selectProject ---> <cfcase value="selectProject"> <cfset session.p_id = form.p_id> </cfcase> <!--- add ---> <cfcase value="add"> <cfset cst_createAction()> </cfcase> </cfswitch> <cfset content = ""> <cfif (session.key eq "")> <cfset content = cst_dspLogin()> <cfelse> <cfif (session.p_id eq "")> <cfset ary = cst_getProject()> <cfset content = cst_dspSelectProject(ary)> <cfelse> <cfif (url.p eq "next")> <cfset ary = cst_getNext()> <cfset content = cst_dspNext(ary)> <cfelse> <cfset ary = cst_getAction()> <cfset content = cst_dspContent(ary)> </cfif> </cfif> </cfif> <cfset cst_layout(content)> <!---================================================================= cst_dspNext ==================================================================---> <cffunction name="cst_dspNext" access="public" returnType="string" output="no"> <cfargument name="aryData" type="array" required="yes"> <cfset var local = structNew()> <cfset var ary = arguments.aryData> <cfset local.data = ""> <cfloop index="local.idx" array="#ary#"> <cfif local.idx.done eq "0"> <cfset local.data = local.data & local.idx.name & "#chr(13)##chr(10)#"> </cfif> </cfloop> <cfsavecontent variable = "local.tmp"> <cfoutput> <form name="frm_in"> <textarea name="data" cols="50" rows="10">#local.data#</textarea> </form> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_dspContent ==================================================================---> <cffunction name="cst_dspContent" access="public" returnType="string" output="no"> <cfargument name="aryData" type="array" required="yes"> <cfset var local = structNew()> <cfset var ary = arguments.aryData> <cfsavecontent variable = "local.tmp"> <cfoutput> <form name="frm_in" action="index.cfm?p=add" method="post"> <input type="text" name="data" size="50" maxlength="50"> <input type="submit" value="add"> </form> <script language="JavaScript"> document.frm_in.data.focus(); </script> <table style="#session.style#"> <!--- <cfloop index="local.idx" array="#ary#"> <tr> <td>#local.idx.name#</td> </tr> </cfloop> ---> <!--- 最新順? ---> <cfloop index="local.idx" from="#arrayLen(ary)#" to="1" step="-1"> <tr> <td>#ary[local.idx].name#</td> </tr> </cfloop> </table> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_dspSelectProject ==================================================================---> <cffunction name="cst_dspSelectProject" access="public" returnType="string" output="no"> <cfargument name="aryData" type="array" required="yes"> <cfset var local = structNew()> <cfset var ary = arguments.aryData> <cfsavecontent variable = "local.tmp"> <cfoutput> <form action="index.cfm?p=selectProject" method="post"> <table> <cfset local.chk_id = ""> <cfloop index="local.idx" array="#ary#"> <!--- 最初のデータをチェックしておく ---> <cfif (local.chk_id eq "")> <cfset local.chk_id = local.idx.id> </cfif> <tr> <td><input type="radio" name="p_id" value="#local.idx.id#" <cfif (local.chk_id eq local.idx.id)>checked</cfif>></td> <td>#local.idx.name#</td> </tr> </cfloop> </table> <input type="submit" value="send"> </form> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_dspLogin ==================================================================---> <cffunction name="cst_dspLogin" access="public" returnType="string" output="no"> <cfset var local = structNew()> <cfset local.mailpass = form.mail & form.pass> <cfsavecontent variable = "local.tmp"> <cfoutput> <cfif local.mailpass neq ""> <br> <br> <strong>retry!</strong> </cfif> <form action="index.cfm?p=login" method="post"> <table> <tr> <td>e-mail</td> <td><input type="text" name="mail" value="#form.mail#"></td> </tr> <tr> <td>password</td> <td><input type="password" name="pass" value="#form.pass#"></td> </tr> </table> <input type="submit" value="login"> </form> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_chkLogin ==================================================================---> <cffunction name="cst_chkLogin" access="public" returnType="void" output="no"> <cfset var local = structNew()> <cfset local.url = "http://www.nozbe.com/api/login/email-#form.mail#/password-#form.pass#"> <cfhttp url="#local.url#" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="get"> <cfset local.cfhttp = cfhttp.filecontent> <cfset local.data = DeserializeJSON(local.cfhttp)> <!--- keyにデータがない場合はnullが帰ってくる ---> <cfif (local.data.key eq "null")> <cfset local.data.key = ""> </cfif> <cfset session.key = local.data.key> </cffunction> <!---================================================================= cst_getProject ==================================================================---> <cffunction name="cst_getProject" access="public" returnType="array" output="no"> <cfset var local = structNew()> <cfset local.url = "http://www.nozbe.com/api/projects/key-#session.key#"> <cfhttp url="#local.url#" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="get"> <cfset local.cfhttp = cfhttp.filecontent> <cfset local.data = DeserializeJSON(local.cfhttp)> <cfreturn local.data> </cffunction> <!---================================================================= cst_getNext ==================================================================---> <cffunction name="cst_getNext" access="public" returnType="array" output="no"> <cfset var local = structNew()> <cfset local.url = "http://www.nozbe.com/api/actions/what-next/key-#session.key#"> <cfhttp url="#local.url#" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="get"> <cfset local.cfhttp = cfhttp.filecontent> <cfset local.data = DeserializeJSON(local.cfhttp)> <cfif not isArray(local.data)> <cfset local.data = arrayNew(1)> </cfif> <cfreturn local.data> </cffunction> <!---================================================================= cst_getAction ==================================================================---> <cffunction name="cst_getAction" access="public" returnType="array" output="no"> <cfset var local = structNew()> <cfset local.url = "http://www.nozbe.com/api/actions/what-project/id-#session.p_id#/key-#session.key#"> <cfhttp url="#local.url#" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="get"> <cfset local.cfhttp = cfhttp.filecontent> <cfset local.data = DeserializeJSON(local.cfhttp)> <cfif not isArray(local.data)> <cfset local.data = arrayNew(1)> </cfif> <cfreturn local.data> </cffunction> <!---================================================================= cst_createAction ==================================================================---> <cffunction name="cst_createAction" access="public" returnType="void" output="no"> <cfset var local = structNew()> <cfset local.url = "http://www.nozbe.com/api/newaction/name-#URLEncodedFormat(form.data)#/project_id-#session.p_id#/key-#session.key#"> <cfhttp url="#local.url#" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="get"> </cffunction> <!---================================================================= cst_layout ==================================================================---> <cffunction name="cst_layout" access="public" returnType="void" output="yes"> <cfargument name="content" type="string" required="yes"> <cfoutput> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css; charset=utf-8" /> <title>demo</title> <meta name="keywords" content="Nozbe,api,demo" /> <meta name="description" content="Nozbe api demo (action add,list)" /> </head> <body> <cfif (session.key neq "")> <cfif (session.p_id neq "")> <a href="javascript:js_hide()">hide</a> <a href="javascript:js_show()">show</a> <a href="javascript:js_next()">next</a> <a href="javascript:js_listProject()">listProject</a> </cfif> <a href="javascript:js_logout()">logout</a> </cfif> <a href="#request.blog_url#">check!</a> #arguments.content# <script language="JavaScript"> <!-- function js_hide(){ location.href = "index.cfm?p=hide"; } function js_show(){ location.href = "index.cfm?p=show"; } function js_listProject(){ location.href = "index.cfm?p=listProject"; } function js_next(){ location.href = "index.cfm?p=next"; } function js_logout(){ location.href = "index.cfm?p=logout"; } //--> </script> </body> </html> </cfoutput> </cffunction>
めまぴークライアントのデモ11のソース
めまぴークライアントのデモ11の記事はこちらです。
■Application.cfm
<cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#" clientmanagement="Yes" sessionmanagement="yes" loginStorage="session" sessiontimeout=#CreateTimeSpan(1, 0, 0, 0)# > <!---=================================== 設定 ====================================---> <cfparam name="cookie.user_id" default=""> <cfparam name="cookie.key" default=""> <cfparam name="session.word" default=""> <cfparam name="session.chk" default=""> <cfset request.user_id = cookie.user_id> <cfset request.key = cookie.key> <cfset request.word = session.word> <cfset request.chk = session.chk> <cfset request.cat_id = 14> <!--- 通常 <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> ---> <!--- 会社 <cfset request.proxyServer = "xx.xx.xx.xx"> <cfset request.proxyPort = "xx"> ---> <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> <cfset request.url = "http://memapi.utalab.com/index.cfm?go=">
■index.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////---> <cfparam name="url.p" default=""> <cfparam name="url.page" default="1"> <cfparam name="form.id" default=""> <cfparam name="form.c1" default=""> <cfparam name="form.c2" default=""> <cfparam name="form.c2_yyyy" default=""> <cfparam name="form.c2_mm" default=""> <cfparam name="form.c2_dd" default=""> <cfparam name="form.c3" default=""> <cfparam name="form.c4" default=""> <cfparam name="form.c4_yyyy" default=""> <cfparam name="form.c4_mm" default=""> <cfparam name="form.c4_dd" default=""> <cfparam name="form.chk" default=""> <cfswitch expression = "#url.p#"> <!--- srch ---> <cfcase value="srch"> <cfset session.word = form.word> <cfset session.chk = form.chk> </cfcase> <!--- addEnd ---> <cfcase value="addEnd"> <cfhttp url="#request.url#dataAddEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="c1" value="#form.c1#"> <cfhttpparam type="formField" name="c2" value="#form.c2_yyyy#/#form.c2_mm#/#form.c2_dd#"> <cfhttpparam type="formField" name="c3" value="#form.c3#"> <cfhttpparam type="formField" name="c4" value="NO"> </cfhttp> </cfcase> <!--- updEnd ---> <cfcase value="updEnd"> <cfhttp url="#request.url#dataUpdEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#form.id#"> <cfhttpparam type="formField" name="c1" value="#form.c1#"> <cfhttpparam type="formField" name="c2" value="#form.c2_yyyy#/#form.c2_mm#/#form.c2_dd#"> <cfhttpparam type="formField" name="c3" value="#form.c3#"> <cfset tmp = form.c4_yyyy & form.c4_mm & form.c4_dd> <cfif tmp eq ""> <cfhttpparam type="formField" name="c4" value="NO"> <cfelse> <cfhttpparam type="formField" name="c4" value="#form.c4_yyyy#/#form.c4_mm#/#form.c4_dd#"> </cfif> </cfhttp> </cfcase> <!--- delEnd ---> <cfcase value="delEnd"> <cfhttp url="#request.url#dataDelEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#form.id#"> </cfhttp> </cfcase> </cfswitch> <cfif findnocase("end", url.p)> <cflocation url="index.cfm" addtoken="no"> </cfif> <cfparam name="form.flg" default="add"> <cfif url.p eq "upd"> <cfset st = cst_getData(url.id, url.page)> <cfset form.id = st.data.id> <cfset form.c1 = st.data.c1> <cfset form.c2_yyyy = ListGetAt(st.data.c2, 1, "/")> <cfset form.c2_mm = ListGetAt(st.data.c2, 2, "/")> <cfset form.c2_dd = ListGetAt(st.data.c2, 3, "/")> <cfset form.c3 = st.data.c3> <cfset form.c4_yyyy = ""> <cfset form.c4_mm = ""> <cfset form.c4_dd = ""> <cfif st.data.c4 neq "NO"> <cfset form.c4_yyyy = ListGetAt(st.data.c4, 1, "/")> <cfset form.c4_mm = ListGetAt(st.data.c4, 2, "/")> <cfset form.c4_dd = ListGetAt(st.data.c4, 3, "/")> </cfif> <cfset form.flg = "upd"> </cfif> <cfset fm = cst_fm()> <cfset st = cst_getData("", url.page)> <cfset cst_layout(st,fm)> <!---================================================================= cst_getData ==================================================================---> <cffunction name="cst_getData" access="public" returnType="struct" output="no"> <cfargument name="id" type="string" required="yes"> <cfargument name="page" type="string" default="1"> <cfhttp url = "#request.url#dataGetEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="id" value="#arguments.id#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="fil_id" value="c2"> <cfhttpparam type="formField" name="fld_list" value="id,cat_id,c1,c2,c3,c4"> <cfhttpparam type="formField" name="srch_fld" value="c1"> <cfhttpparam type="formField" name="word" value="#session.word#"> <cfif form.chk neq ""> <cfhttpparam type="formField" name="fromto_fld" value="c4"> <!--- 未使用 ---> <cfif form.chk eq "1"> <cfhttpparam type="formField" name="from" value="NO"> <cfhttpparam type="formField" name="to" value="NO"> </cfif> <!--- 使用済 ---> <cfif form.chk eq "2"> <cfhttpparam type="formField" name="from" value="1999/01/01"> <cfhttpparam type="formField" name="to" value="2999/01/01"> </cfif> </cfif> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="#arguments.page#"> <cfhttpparam type="formField" name="type" value="wddx"> <cfhttpparam type="formField" name="debug" value=""> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfreturn outdata> </cffunction> <!---================================================================= cst_fm ==================================================================---> <cffunction name="cst_fm" access="public" returnType="string" output="no"> <cfset var local = structNew()> <cfsavecontent variable = "local.tmp"> <cfoutput> <form name="frm_in" action="index.cfm?p=addEnd" method="post"> <input type="hidden" name="page" value="1"> <input type="hidden" name="id" value="#form.id#"> <table> <tr> <th>名称</th> <td> <input type="text" name="c1" size="70" maxlength="255" value="#form.c1#"> </td> </tr> <tr> <th>賞味期限</th> <td> <select name="c2_yyyy"> <cfset local.from = dateformat(DateAdd("yyyy", -1, now()), "yyyy")> <cfset local.to = local.from + 10> <cfloop index="local.idx" from="#local.from#" to="#local.to#"> <option value="#local.idx#" <cfif form.c2_yyyy eq local.idx>selected</cfif>>#local.idx#</option> </cfloop> </select> 年 <select name="c2_mm"> <cfloop index="local.idx" from="1" to="12"> <cfset local.tmp = right("0" & local.idx, 2)> <option value="#local.tmp#" <cfif form.c2_mm eq local.tmp>selected</cfif>>#local.tmp#</option> </cfloop> </select> 月 <select name="c2_dd"> <cfloop index="local.idx" from="1" to="31"> <cfset local.tmp = right("0" & local.idx, 2)> <option value="#local.tmp#" <cfif form.c2_dd eq local.tmp>selected</cfif>>#local.tmp#</option> </cfloop> </select> 日 </td> </tr> <tr> <th>保管場所</th> <td> <input type="text" name="c3" size="70" maxlength="255" value="#form.c3#"> </td> </tr> <cfif form.flg neq "add"> <tr> <th>使用日</th> <td> <select name="c4_yyyy"> <option value=""></option> <cfset local.from = dateformat(DateAdd("yyyy", -1, now()), "yyyy")> <cfset local.to = local.from + 2> <cfloop index="local.idx" from="#local.from#" to="#local.to#"> <option value="#local.idx#" <cfif form.c4_yyyy eq local.idx>selected</cfif>>#local.idx#</option> </cfloop> </select> 年 <select name="c4_mm"> <option value=""></option> <cfloop index="local.idx" from="1" to="12"> <cfset local.tmp = right("0" & local.idx, 2)> <option value="#local.tmp#" <cfif form.c4_mm eq local.tmp>selected</cfif>>#local.tmp#</option> </cfloop> </select> 月 <select name="c4_dd"> <option value=""></option> <cfloop index="local.idx" from="1" to="31"> <cfset local.tmp = right("0" & local.idx, 2)> <option value="#local.tmp#" <cfif form.c4_dd eq local.tmp>selected</cfif>>#local.tmp#</option> </cfloop> </select> 日 </td> </tr> </cfif> </table> <cfif form.flg eq "add"> <input type="button" value="登録" onClick="js_add()"> <cfelse> <input type="button" value="更新" onClick="js_upd()"> <input type="button" value="削除" onClick="js_del()"> </cfif> <br> <br> </form> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_layout ==================================================================---> <cffunction name="cst_layout" access="public" returnType="void" output="yes"> <cfargument name="stru" type="struct" required="yes"> <cfargument name="fm" type="string" required="yes"> <cfset var st = arguments.stru> <cfset var local = structNew()> <cfoutput> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>めまぴークライアントのデモ(保存食管理)</title> <meta name="keywords" content="めまぴー,memapi" /> <meta name="description" content="めまぴークライアントのデモ(保存食管理)です。" /> <link href="common.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="index.js"></script> </head> <body> <!-- container --> <div id="container"> <!-- header --> <div id="header"> <!-- left --> <div class="left"> <h1><a href="index.cfm" accesskey="1">めまぴークライアントのデモ(保存食管理)</a></h1> <h2>by <a href="http://memapi.utalab.com/" target="_blank">めまぴー</a></h2> <!-- /.left --></div> <!-- right --> <div class="right"> <!-- /.right --></div> <!-- /##header --></div> <div class="clearblock"/> <!-- left --> <div id="left"> <!-- menu --> <div class="menu"> <p class="title">STATUS</p> <table> <tr> <th>ret</th> <td align="right" id="ret">#st.ret#</td> </tr> <tr> <th>pageCount</th> <td align="right" id="pageCount">#st.pageCount#</td> </tr> <tr> <th>recCount</th> <td align="right" id="recCount">#st.recCount#</td> </tr> </table> <!-- /.menu --></div> <!-- menu --> <div class="menu"> <p class="title">検索</p> <form name="frm_srch" action="index.cfm?p=srch" method="post"> <table> <tr> <td> <input type="text" name="word" id="word" value="#session.word#"><br> </td> </tr> <tr> <td> <select name="chk" id="chk"> <option value=""></option> <option value="1" <cfif session.chk eq 1>selected</cfif> >未使用</option> <option value="2" <cfif session.chk eq 2>selected</cfif> >使用済</option> </select> </td> </tr> <tr> <td> <input type="submit" value="検索"> </td> </tr> </table> </form> <!-- /.menu --></div> <!-- /##left --></div> <!-- center --> <div id="center"> <!-- content --> <div id="content"> <h3>保存食管理</h3> #arguments.fm# <cfif st.recCount neq 0> <table border="1"> <tr> <th>名称</th> <th>賞味期限</th> <th>保管場所</th> <th>使用日</th> </tr> <cfloop query="st.data"> <tr> <td><a href="index.cfm?p=upd&id=#st.data.id#">#st.data.c1#</a></td> <td>#st.data.c2#</td> <td>#st.data.c3#</td> <td>#st.data.c4#</td> </tr> </cfloop> </table> page: <cfloop index="local.idx" from="1" to="#st.pageCount#"> <cfif local.idx eq url.page> <strong>#local.idx#</strong> <cfelse> <a href="index.cfm?page=#local.idx#">#local.idx#</a> </cfif> </cfloop> </cfif> <!-- /##content --></div> <!-- /##center --></div> <div class="clearblock"/> <!-- footer --> <div id="footer"> <form name="frm_cookie"> <table border="0" width="100%"> <tr> <td>user_id:<input type="text" name="user_id" id="user_id" value="#request.user_id#"></td> <td>key:<input type="text" name="key" id="key" value="#request.key#"></td> <td> <input type="button" value="cookie change" onClick="js_cookie('index.cfm')"> <input type="button" value="cookie delete" onClick="js_cookie_del('index.cfm')"> </td> </tr> </table> </form> <!-- /##footer --></div> <!-- /##container --></div> </body> </html> </cfoutput> </cffunction>
めまぴークライアントのデモ10のソース
めまぴークライアントのデモ10の記事はこちらです。
■Application.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#" clientmanagement="Yes" sessionmanagement="yes" loginStorage="session" sessiontimeout=#CreateTimeSpan(1, 0, 0, 0)# > <!---=================================== 設定 ====================================---> <cfparam name="cookie.user_id" default=""> <cfparam name="cookie.key" default=""> <cfparam name="session.word" default=""> <cfparam name="session.chk1" default=""> <cfset request.user_id = cookie.user_id> <cfset request.key = cookie.key> <cfset request.word = session.word> <cfset request.chk1 = session.chk1> <cfset request.cat_id = 12> <!--- 通常 <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> ---> <!--- 会社 <cfset request.proxyServer = "xx.xx.xx.xx"> <cfset request.proxyPort = "xx"> ---> <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> <cfset request.url = "http://memapi.utalab.com/index.cfm?go="> <!---=============================== getBaseChars ================================---> <cffunction name="getBaseChars" access="public" returnType="array" output="no"> <cfset var baseList = "a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9"> <cfreturn ListToArray(baseList, " ") /> </cffunction> <!---========================================== thisURL 実行されたURL。ただしファイル名は削除。 例)http://hoge.com/ ===========================================---> <cffunction name="thisURL" access="public" returnType="string" output="no" hint="Webアプリの基本URLを取得(例)http://hoge.com/)"> <cfset var local = structNew()> <cfset local.server_name = cgi.server_name> <cfif cgi.server_port neq 80> <cfset local.server_name = local.server_name & ":" & cgi.server_port> </cfif> <cfset local.url = "#lcase(ListFirst(cgi.server_protocol,"/"))#://#local.server_name##cgi.script_name#"> <cfset local.url = ListDeleteAt(local.url, ListLen(local.url, "/"), "/") & "/"> <cfreturn local.url> </cffunction> <!---========================================== FormatBaseNData 参考:http://www.bennadel.com/index.cfm?dax=blog:1540.view ===========================================---> <cffunction name="FormatBaseNData" access="public" returntype="string" output="false"> <cfargument name="Value" type="numeric" required="true"> <cfargument name="CharacterSet" type="array" required="true"> <cfset var local = structNew()> <!--- Create the base string to be returned. ---> <cfset LOCAL.EncodedValue = "" /> <!--- Get the length of our array. This will be our radix for the conversion. NOTE: Because ColdFusion arrays start at 1, not zero, we will have to some manual offsetting when we perform the conversion. ---> <cfset LOCAL.Radix = ArrayLen( ARGUMENTS.CharacterSet ) /> <!--- Get a local copy of our value as we will be updating it as we divide into it. ---> <cfset LOCAL.Value = ARGUMENTS.Value /> <!--- When converting to a new radix, we need to keep dividing the value passed in until we hit zero (which will never have a remainder). However, because we always want to perform at least ONE division, we will break from within the loop if it hits zero rather than check for that loop conditional. ---> <cfloop condition="true"> <!--- Get the division result. ---> <cfset LOCAL.Result = Fix( LOCAL.Value / LOCAL.Radix ) /> <!--- Get the remainder of radix division. ---> <cfset LOCAL.Remainder = (LOCAL.Value MOD LOCAL.Radix) /> <!--- Take the remainder and prepend the Radix-converted string to the encoded value. Remember, since we are using arrays that start at 1, we need to add one to this value. ---> <cfset LOCAL.EncodedValue = ( ARGUMENTS.CharacterSet[ LOCAL.Remainder + 1 ] & LOCAL.EncodedValue ) /> <!--- Now that we have gotten the current, store the result value back into the value. ---> <cfset LOCAL.Value = LOCAL.Result /> <!--- Check to see if we have any more value to divide into. Once we hit zero, we are out of possible remainders. ---> <cfif NOT LOCAL.Value> <cfbreak /> </cfif> </cfloop> <!--- Return the encoded value. ---> <cfreturn LOCAL.EncodedValue /> </cffunction> <!---========================================== InputBaseNData 参考:http://www.bennadel.com/index.cfm?dax=blog:1540.view ===========================================---> <cffunction name="InputBaseNData" access="public" returntype="string" output="false"> <cfargument name="Value" type="string" required="true"> <cfargument name="CharacterSet" type="array" required="true"> <cfset var LOCAL = structNew() > <!--- Create the base number to be returned. ---> <cfset LOCAL.DecodedValue = 0 /> <!--- Get the length of our array. This will be our radix for the conversion. NOTE: Because ColdFusion arrays start at 1, not zero, we will have to some manual offsetting when we perform the conversion. ---> <cfset LOCAL.Radix = ArrayLen( ARGUMENTS.CharacterSet ) /> <!--- Convert our character set to a list so that we can easily get the numeric value of our encoded digit. ---> <cfset LOCAL.CharacterList = ArrayToList( ARGUMENTS.CharacterSet ) /> <!--- Reverse the string that was passed in. We are doing this because the right-most value is actually the smallest place and it will be easier for us to deal with in reverse. ---> <cfset LOCAL.Value = Reverse( ARGUMENTS.Value ) /> <!--- Now, break the value up into an array so that we can more easily iterate over it. ---> <cfset LOCAL.ValueArray = ListToArray( REReplace( LOCAL.Value, "(.)", "\1,", "all" ) ) /> <!--- Iterate over the array and convert each value to a power of our character set defined radix. ---> <cfloop index="LOCAL.Index" from="1" to="#ArrayLen( LOCAL.ValueArray )#" step="1"> <!--- Convert the current digit and add it to the going sum of our conversion. ---> <cfset LOCAL.DecodedValue = LOCAL.DecodedValue + ( (ListFind( LOCAL.CharacterList, LOCAL.ValueArray[ LOCAL.Index ] ) - 1) * (LOCAL.Radix ^ (LOCAL.Index - 1)) ) /> </cfloop> <!--- Return the decoded value. ---> <cfreturn LOCAL.DecodedValue /> </cffunction>
■index.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////---> <cfparam name="url.p" default=""> <cfparam name="url.page" default="1"> <cfparam name="form.word" default=""> <cfparam name="form.chk1" default="i1_desc"> <cfif url.p eq ""> <cfset url.p = cst_exec()> </cfif> <cfif url.p neq ""> <cfswitch expression = "#url.p#"> <!--- srch ---> <cfcase value="srch"> <cfset session.word = form.word> <cfset session.chk1 = form.chk1> <cfset request.word = form.word> <cfset request.chk1 = form.chk1> </cfcase> </cfswitch> <cfset st = cst_getData2(url.page)> <cfset cst_layout(st)> </cfif> <!---================================================================= cst_exec ==================================================================---> <cffunction name="cst_exec" access="public" returnType="string" output="no"> <cfset var local = structNew()> <cfset local.id = InputBaseNData( cgi.query_string, getBaseChars())> <cfset st = cst_getData(local.id)> <cfif st.data.recordCount neq 0> <!--- cnt+1 ---> <cfset cst_updData(local.id, st.data.i1)> <cflocation url="#st.data.m1#" addtoken="no"> <cfabort> <cfelse> <cfreturn "srch"> </cfif> <cfreturn ""> </cffunction> <!---================================================================= cst_getData ==================================================================---> <cffunction name="cst_getData" access="public" returnType="struct" output="no"> <cfargument name="id" type="string" required="yes"> <cfhttp url = "#request.url#dataGetEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#arguments.id#"> <cfhttpparam type="formField" name="fld_list" value="id,cat_id,c1,m1,i1"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="1"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfreturn outdata> </cffunction> <!---================================================================= cst_getData2 ==================================================================---> <cffunction name="cst_getData2" access="public" returnType="struct" output="no"> <cfargument name="page" type="string" default="1"> <cfhttp url = "#request.url#dataGetEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="fil_id" value="#request.chk1#"> <cfhttpparam type="formField" name="fld_list" value="id,cat_id,c1,m1,i1"> <cfhttpparam type="formField" name="srch_fld" value="c1"> <cfhttpparam type="formField" name="word" value="#request.word#"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="#arguments.page#"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfreturn outdata> </cffunction> <!---================================================================= cst_updData ==================================================================---> <cffunction name="cst_updData" access="public" returnType="void" output="no"> <cfargument name="id" type="string" required="yes"> <cfargument name="i1" type="string" required="yes"> <cfset var cnt = arguments.i1 + 1> <cfhttp url = "#request.url#dataUpdEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#arguments.id#"> <cfhttpparam type="formField" name="i1" value="#cnt#"> </cfhttp> </cffunction> <!---================================================================= cst_layout ==================================================================---> <cffunction name="cst_layout" access="public" returnType="void" output="yes"> <cfargument name="stru" type="struct" required="yes"> <cfset var st = arguments.stru> <cfoutput> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>めまぴークライアントのデモ(短縮URL)</title> <meta name="keywords" content="めまぴー,memapi" /> <meta name="description" content="めまぴークライアントのデモ(短縮URL)です。" /> <link href="common.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="index.js"></script> </head> <body> <!-- container --> <div id="container"> <!-- header --> <div id="header"> <!-- left --> <div class="left"> <h1><a href="index.cfm" accesskey="1">めまぴークライアントのデモ(短縮URL)</a></h1> <h2>by <a href="http://memapi.utalab.com/" target="_blank">めまぴー</a></h2> <!-- /.left --></div> <!-- right --> <div class="right"> <!-- /.right --></div> <!-- /##header --></div> <div class="clearblock"/> <!-- left --> <div id="left"> <!-- menu --> <div class="menu"> <p class="title">STATUS</p> <table> <tr> <th>ret</th> <td align="right" id="ret">#st.ret#</td> </tr> <tr> <th>pageCount</th> <td align="right" id="pageCount">#st.pageCount#</td> </tr> <tr> <th>recCount</th> <td align="right" id="recCount">#st.recCount#</td> </tr> </table> <!-- /.menu --></div> <!-- menu --> <div class="menu"> <p class="title">検索</p> <form name="frm_srch" action="index.cfm?p=srch" method="post"> <table> <tr> <td> <input type="text" name="word" id="word" value="#request.word#"><br> </td> </tr> <tr> <td> <select name="chk1"> <option value="c1" <cfif request.chk1 eq "c1">selected</cfif>>title(昇順)</option> <option value="c1_desc" <cfif request.chk1 eq "c1_desc">selected</cfif>>title(降順)</option> <option value="i1" <cfif request.chk1 eq "i1">selected</cfif>>cnt(昇順)</option> <option value="i1_desc" <cfif request.chk1 eq "i1_desc">selected</cfif>>cnt(降順)</option> </select> </td> </tr> <tr> <td> <input type="submit" value="検索"> </td> </tr> </table> </form> <!-- /.menu --></div> <!-- /##left --></div> <!-- center --> <div id="center"> <!-- content --> <div id="content"> <h3>短縮URL</h3> <table border="1" id="list"> <tr> <th>タイトル</th> <th width="1%">cnt</th> </tr> <cfloop query="st.data"> <tr> <td><a href="#thisURL()#?#FormatBaseNData( st.data.id, getBaseChars() )#" target="_blank">#st.data.c1#</a></td> <td align="right">#st.data.i1#</td> </tr> </cfloop> </table> page: <cfloop index="local.idx" from="1" to="#st.pageCount#"> <cfif local.idx eq url.page> <strong>#local.idx#</strong> <cfelse> <a href="index.cfm?page=#local.idx#">#local.idx#</a> </cfif> </cfloop> <!-- /##content --></div> <!-- /##center --></div> <div class="clearblock"/> <!-- footer --> <div id="footer"> <form name="frm_cookie"> <table border="0" width="100%"> <tr> <td>user_id:<input type="text" name="user_id" id="user_id" value="#request.user_id#"></td> <td>key:<input type="text" name="key" id="key" value="#request.key#"></td> <td> <input type="button" value="cookie change" onClick="js_cookie('index.cfm')"> <input type="button" value="cookie delete" onClick="js_cookie_del('index.cfm')"> </td> </tr> </table> </form> <!-- /##footer --></div> <!-- /##container --></div> </body> </html> </cfoutput> </cffunction>
■index_k.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////---> <cfparam name="url.p" default=""> <cfparam name="url.page" default="1"> <cfparam name="url.id" default=""> <cfparam name="form.id" default="#url.id#"> <cfparam name="form.c1" default=""> <cfparam name="form.m1" default=""> <cfswitch expression = "#url.p#"> <!--- srch ---> <cfcase value="srch"> <cfset session.word = form.word> <cfset session.chk1 = form.chk1> <cfset request.word = form.word> <cfset request.chk1 = form.chk1> </cfcase> <!--- addEnd ---> <cfcase value="addEnd"> <cfhttp url="#request.url#dataAddEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="c1" value="#form.c1#"> <cfhttpparam type="formField" name="m1" value="#form.m1#"> <cfhttpparam type="formField" name="i1" value="0"> </cfhttp> </cfcase> <!--- updEnd ---> <cfcase value="updEnd"> <cfhttp url="#request.url#dataUpdEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#form.id#"> <cfhttpparam type="formField" name="c1" value="#form.c1#"> <cfhttpparam type="formField" name="m1" value="#form.m1#"> </cfhttp> </cfcase> <!--- delEnd ---> <cfcase value="delEnd"> <cfhttp url="#request.url#dataDelEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#form.id#"> </cfhttp> </cfcase> </cfswitch> <cfif findnocase("end", url.p)> <cflocation url="index_k.cfm" addtoken="no"> </cfif> <cfset st = cst_getData("", url.page)> <cfif url.p eq "upd"> <cfset sttmp = cst_getData(form.id)> <cfset form.c1 = sttmp.data.c1> <cfset form.m1 = sttmp.data.m1> </cfif> <cfset fm = cst_fm()> <cfset cst_layout(st, fm)> <!---================================================================= cst_fm ==================================================================---> <cffunction name="cst_fm" access="public" returnType="string" output="yes"> <cfset var local = structNew()> <cfsavecontent variable = "local.tmp"> <cfoutput> <form name="frm_in" action="index_k.cfm?p=addEnd" method="post"> <input type="hidden" name="id" value="#form.id#"> <table> <tr> <th>タイトル</th> <td><input type="text" name="c1" size="70" value="#form.c1#"></td> </tr> <tr> <th>URL</th> <td> <textarea name="m1" cols="60" rows="3">#form.m1#</textarea> </td> </tr> </table> <cfif form.id eq ""> <input type="button" value="add" onClick="js_add()"> <cfelse> <input type="button" value="upd" onClick="js_upd()"> <input type="button" value="del" onClick="js_del()"> </cfif> </form> <script language="JavaScript"> <!-- function js_add(){ with(document.frm_in){ if(confirm("add OK?")){ action = "index_k.cfm?p=addEnd"; submit(); } } } function js_upd(){ with(document.frm_in){ if(confirm("upd OK?")){ action = "index_k.cfm?p=updEnd"; submit(); } } } function js_del(){ with(document.frm_in){ if(confirm("del OK?")){ action = "index_k.cfm?p=delEnd"; submit(); } } } //--> </script> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_getData ==================================================================---> <cffunction name="cst_getData" access="public" returnType="struct" output="no"> <cfargument name="id" type="string" required="yes"> <cfargument name="page" type="string" default="1"> <cfhttp url = "#request.url#dataGetEx" proxyServer = "#request.proxyServer#" proxyPort = "#request.proxyPort#" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#arguments.id#"> <cfhttpparam type="formField" name="fil_id" value="#request.chk1#"> <cfhttpparam type="formField" name="fld_list" value="id,cat_id,c1,m1,i1"> <cfhttpparam type="formField" name="srch_fld" value="c1"> <cfhttpparam type="formField" name="word" value="#request.word#"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="#arguments.page#"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfreturn outdata> </cffunction> <!---================================================================= cst_layout ==================================================================---> <cffunction name="cst_layout" access="public" returnType="void" output="yes"> <cfargument name="stru" type="struct" required="yes"> <cfargument name="fm" type="string" required="yes"> <cfset var st = arguments.stru> <cfoutput> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>めまぴークライアントのデモ(短縮URL)</title> <meta name="keywords" content="めまぴー,memapi" /> <meta name="description" content="めまぴークライアントのデモ(短縮URL)です。" /> <link href="common.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="index.js"></script> </head> <body> <!-- container --> <div id="container"> <!-- header --> <div id="header"> <!-- left --> <div class="left"> <h1><a href="index_k.cfm" accesskey="1">めまぴークライアントのデモ(短縮URL)</a></h1> <h2>by <a href="http://memapi.utalab.com/" target="_blank">めまぴー</a></h2> <!-- /.left --></div> <!-- right --> <div class="right"> <!-- /.right --></div> <!-- /##header --></div> <div class="clearblock"/> <!-- left --> <div id="left"> <!-- menu --> <div class="menu"> <p class="title">STATUS</p> <table> <tr> <th>ret</th> <td align="right" id="ret">#st.ret#</td> </tr> <tr> <th>pageCount</th> <td align="right" id="pageCount">#st.pageCount#</td> </tr> <tr> <th>recCount</th> <td align="right" id="recCount">#st.recCount#</td> </tr> </table> <!-- /.menu --></div> <!-- menu --> <div class="menu"> <p class="title">検索</p> <form name="frm_srch" action="index_k.cfm?p=srch" method="post"> <table> <tr> <td> <input type="text" name="word" id="word" value="#request.word#"><br> </td> </tr> <tr> <td> <select name="chk1"> <option value="c1" <cfif request.chk1 eq "c1">selected</cfif>>title(昇順)</option> <option value="c1_desc" <cfif request.chk1 eq "c1_desc">selected</cfif>>title(降順)</option> <option value="i1" <cfif request.chk1 eq "i1">selected</cfif>>cnt(昇順)</option> <option value="i1_desc" <cfif request.chk1 eq "i1_desc">selected</cfif>>cnt(降順)</option> </select> </td> </tr> <tr> <td> <input type="submit" value="検索"> </td> </tr> </table> </form> <!-- /.menu --></div> <!-- /##left --></div> <!-- center --> <div id="center"> <!-- content --> <div id="content"> <h3>短縮URL</h3> #arguments.fm# <br> <br> <table border="1" id="list"> <tr> <th>タイトル</th> <th>短縮URL</th> <th>cnt</th> </tr> <cfloop query="st.data"> <tr> <td><a href="index_k.cfm?p=upd&id=#st.data.id#">#st.data.c1#</a></td> <td>#thisURL()#?#FormatBaseNData( st.data.id, getBaseChars() )#</td> <td align="right">#st.data.i1#</td> </tr> </cfloop> </table> page: <cfloop index="local.idx" from="1" to="#st.pageCount#"> <cfif local.idx eq url.page> <strong>#local.idx#</strong> <cfelse> <a href="index_k.cfm?page=#local.idx#">#local.idx#</a> </cfif> </cfloop> <!-- /##content --></div> <!-- /##center --></div> <div class="clearblock"/> <!-- footer --> <div id="footer"> <form name="frm_cookie"> <table border="0" width="100%"> <tr> <td>user_id:<input type="text" name="user_id" id="user_id" value="#request.user_id#"></td> <td>key:<input type="text" name="key" id="key" value="#request.key#"></td> <td> <input type="button" value="cookie change" onClick="js_cookie('index_k.cfm')"> <input type="button" value="cookie delete" onClick="js_cookie_del('index_k.cfm')"> </td> </tr> </table> </form> <!-- /##footer --></div> <!-- /##container --></div> </body> </html> </cfoutput> </cffunction>
めまぴークライアントのデモ9のソース
めまぴークライアントのデモ9の記事はこちらです。
■Application.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <cfsetting enableCFoutputOnly="yes"> <cfapplication name="#hash( getCurrentTemplatePath() )#" clientmanagement="Yes" sessionmanagement="yes" loginStorage="session" sessiontimeout=#CreateTimeSpan(1, 0, 0, 0)# > <!---=================================== 設定 ====================================---> <cfparam name="cookie.user_id" default=""> <cfparam name="cookie.key" default=""> <cfset request.user_id = cookie.user_id> <cfset request.key = cookie.key> <cfset request.cat_id = 11> <!--- 通常 <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> ---> <!--- 会社 <cfset request.proxyServer = "xx.xx.xx.xx"> <cfset request.proxyPort = "xx"> ---> <cfset request.proxyServer = ""> <cfset request.proxyPort = "80"> <cfset request.url = "http://memapi.utalab.com/index.cfm?go="> <!--- 現在のサーバー時刻から 世界標準時 (UTC: Universal Time Coordinated) からの相対情報を取得し、 9時間プラスすることにより日本時間とする。 ---> <cfset info = GetTimeZoneInfo()> <cfset UTC = DateAdd("h", info.utcHourOffset, now())> <cfset request.now = DateAdd("h", 9, UTC)>
■index.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////---> <cfparam name="url.p" default=""> <cfparam name="url.key" default=""> <cfswitch expression = "#url.p#"> <!--- addEnd ---> <cfcase value="addEnd"> <cfset url.key = lcase(hash(createUUID()))> <cfhttp url="#request.url#dataAddEx" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="c1" value="#dateformat(request.now,'yyyy/mm/dd')# #timeformat(request.now,"HH:mm:ss.")##right("00" & timeformat(request.now,"l"),3)#"> <cfhttpparam type="formField" name="c2" value="#url.key#"> <cfhttpparam type="formField" name="c3" value="#form.c3#"> <cfhttpparam type="formField" name="i1" value="0"> </cfhttp> <cflocation url="index.cfm?key=#url.key#" addtoken="no"> </cfcase> </cfswitch> <cfif url.key neq ""> <!--- from=toにより完全一致を実現 ---> <cfhttp url="#request.url#dataGetEx" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="fil_id" value="11I1_0"> <cfhttpparam type="formField" name="fld_list" value="cat_id,id,c1,c2"> <cfhttpparam type="formField" name="fromto_fld" value="c2"> <cfhttpparam type="formField" name="from" value="#url.key#"> <cfhttpparam type="formField" name="to" value="#url.key#"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="1"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfif outData.recCount eq 0> <cfsavecontent variable="fm"> <cfoutput> <br> 既に処理が終わったか、該当データがありません。 </cfoutput> </cfsavecontent> <cfelse> <cfhttp url="#request.url#dataGetEx" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="fil_id" value="11I1_0"> <cfhttpparam type="formField" name="fld_list" value="cat_id,id,c1,c2"> <cfhttpparam type="formField" name="fromto_fld" value="c1"> <cfhttpparam type="formField" name="to" value="#outData.data.c1#"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="1"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfsavecontent variable="fm"> <cfoutput> <br> あと#evaluate("outData.recCount -1")#件待ちです。<br> <br> このURLをブックマークに登録しておくと、何件待ちか確認できます。 </cfoutput> </cfsavecontent> </cfif> <cfelse> <cfset fm = cst_fm()> </cfif> <cfset st = cst_getData()> <cfset cst_layout(st, fm)> <!---================================================================= cst_fm ==================================================================---> <cffunction name="cst_fm" access="public" returnType="string" output="yes"> <cfset var local = structNew()> <cfsavecontent variable="local.tmp"> <cfoutput> <br> <form name="frm" method="post"> <table> <tr> <th>お名前</th> <td><input type="text" name="c3"></td> </tr> </table> <input type="button" value="add" onClick="js_add()"> </form> <script language="JavaScript"> <!-- function js_add(){ with(document.frm){ if(confirm("add OK?")){ action = "index.cfm?p=addEnd"; submit(); } } } //--> </script> </cfoutput> </cfsavecontent> <cfreturn local.tmp> </cffunction> <!---================================================================= cst_getData ==================================================================---> <cffunction name="cst_getData" access="public" returnType="struct" output="no"> <cfhttp url="#request.url#dataGetEx" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="fil_id" value="11I1_0"> <cfhttpparam type="formField" name="fld_list" value="cat_id,id,c1,c2"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="1"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfreturn outData> </cffunction> <!---================================================================= cst_layout ==================================================================---> <cffunction name="cst_layout" access="public" returnType="void" output="yes"> <cfargument name="stru" type="struct" required="yes"> <cfargument name="fm" type="string" required="yes"> <cfset var local= structNew()> <cfset var st = arguments.stru> <cfoutput> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>めまぴークライアントのデモ(待ち行列)</title> <meta name="keywords" content="めまぴー,memapi" /> <meta name="description" content="めまぴークライアントのデモ(待ち行列)です。" /> <link href="common.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="index.js"></script> </head> <body> <!-- container --> <div id="container"> <!-- header --> <div id="header"> <!-- left --> <div class="left"> <h1><a href="index.cfm" accesskey="1">めまぴークライアントのデモ(待ち行列)</a></h1> <h2>by <a href="http://memapi.utalab.com/" target="_blank">めまぴー</a></h2> <!-- /.left --></div> <!-- right --> <div class="right"> <!-- /.right --></div> <!-- /##header --></div> <div class="clearblock"/> <!-- left --> <div id="left"> <!-- menu --> <div class="menu"> <p class="title">STATUS</p> <table> <tr> <th>ret</th> <td align="right" id="ret">#st.ret#</td> </tr> <tr> <th>pageCount</th> <td align="right" id="pageCount">#st.pageCount#</td> </tr> <tr> <th>recCount</th> <td align="right" id="recCount">#st.recCount#</td> </tr> </table> <!-- /.menu --></div> <!-- /##left --></div> <!-- center --> <div id="center"> <!-- content --> <div id="content"> <h3>待ち行列</h3> #arguments.fm# <!-- /##content --></div> <!-- /##center --></div> <div class="clearblock"/> <!-- footer --> <div id="footer"> <form name="frm_cookie"> <table border="0" width="100%"> <tr> <td>user_id:<input type="text" name="user_id" id="user_id" value="#request.user_id#"></td> <td>key:<input type="text" name="key" id="key" value="#request.key#"></td> <td> <input type="button" value="cookie change" onClick="js_cookie()"> <input type="button" value="cookie delete" onClick="js_cookie_del()"> </td> </tr> </table> </form> <!-- /##footer --></div> <!-- /##container --></div> </body> </html> </cfoutput> </cffunction>
■index_k.cfm
<cfprocessingdirective pageEncoding = "UTF-8"> <!---///////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////---> <cfparam name="url.p" default=""> <cfparam name="url.page" default="1"> <cfswitch expression = "#url.p#"> <!--- exec ---> <cfcase value="exec"> <cfhttp url="#request.url#dataUpdEx" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="id" value="#form.id#"> <cfhttpparam type="formField" name="i1" value="1"> </cfhttp> </cfcase> </cfswitch> <cfset st = cst_getData(url.page)> <cfset cst_layout(st)> <!---================================================================= cst_getData ==================================================================---> <cffunction name="cst_getData" access="public" returnType="struct" output="no"> <cfargument name="page" type="string" required="yes"> <cfhttp url="#request.url#dataGetEx" method="post"> <cfhttpparam type="formField" name="user_id" value="#request.user_id#"> <cfhttpparam type="formField" name="key" value="#request.key#"> <cfhttpparam type="formField" name="cat_id" value="#request.cat_id#"> <cfhttpparam type="formField" name="fil_id" value="11I1_0"> <cfhttpparam type="formField" name="fld_list" value="cat_id,id,c1,c2,c3"> <cfhttpparam type="formField" name="row" value="10"> <cfhttpparam type="formField" name="page" value="#arguments.page#"> <cfhttpparam type="formField" name="type" value="wddx"> </cfhttp> <cfwddx action="wddx2cfml" input="#cfhttp.filecontent#" output="outData"> <cfreturn outdata> </cffunction> <!---================================================================= cst_layout ==================================================================---> <cffunction name="cst_layout" access="public" returnType="void" output="yes"> <cfargument name="stru" type="struct" required="yes"> <cfset var local= structNew()> <cfset var qry = ""> <cfoutput> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="content-style-type" content="text/css; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>めまぴークライアントのデモ(待ち行列)</title> <meta name="keywords" content="めまぴー,memapi" /> <meta name="description" content="めまぴークライアントのデモ(待ち行列)です。" /> <link href="common.css" rel="stylesheet" type="text/css" media="all" /> <script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="index.js"></script> </head> <body> <!-- container --> <div id="container"> <!-- header --> <div id="header"> <!-- left --> <div class="left"> <h1><a href="index_k.cfm" accesskey="1">めまぴークライアントのデモ(待ち行列)</a></h1> <h2>by <a href="http://memapi.utalab.com/" target="_blank">めまぴー</a></h2> <!-- /.left --></div> <!-- right --> <div class="right"> <!-- /.right --></div> <!-- /##header --></div> <div class="clearblock"/> <!-- left --> <div id="left"> <!-- menu --> <div class="menu"> <p class="title">STATUS</p> <table> <tr> <th>ret</th> <td align="right" id="ret">#st.ret#</td> </tr> <tr> <th>pageCount</th> <td align="right" id="pageCount">#st.pageCount#</td> </tr> <tr> <th>recCount</th> <td align="right" id="recCount">#st.recCount#</td> </tr> </table> <!-- /.menu --></div> <!-- /##left --></div> <!-- center --> <div id="center"> <!-- content --> <div id="content"> <h3>待ち行列</h3> <cfif arguments.stru.recCount eq 0> 行列はありません。 <cfelse> <cfset qry = arguments.stru.data> <form name="frm" method="post"> <input type="hidden" name="id" value=""> #arguments.stru.recCount# rec <table border="1"> <tr> <th>登録日時</th> <th>登録者</th> </tr> <cfloop query="qry"> <tr> <td> <cfif (qry.currentRow eq 1) and (url.page eq 1)> <a href="javascript:js_exec(#qry.id#)">#qry.c1#</a> <cfelse> #qry.c1# </cfif> </td> <td>#qry.c3#</td> </tr> </cfloop> </table> page: <cfloop index="local.idx" from="1" to="#st.pageCount#"> <cfif local.idx eq url.page> <strong>#local.idx#</strong> <cfelse> <a href="index_k.cfm?page=#local.idx#">#local.idx#</a> </cfif> </cfloop> </form> </cfif> <script language="JavaScript"> <!-- function js_exec(pID){ with(document.frm){ if(confirm("syori OK?")){ id.value = pID; action = "index_k.cfm?p=exec"; submit(); } } } //--> </script> <!-- /##content --></div> <!-- /##center --></div> <div class="clearblock"/> <!-- footer --> <div id="footer"> <form name="frm_cookie"> <table border="0" width="100%"> <tr> <td>user_id:<input type="text" name="user_id" id="user_id" value="#request.user_id#"></td> <td>key:<input type="text" name="key" id="key" value="#request.key#"></td> <td> <input type="button" value="cookie change" onClick="js_cookie()"> <input type="button" value="cookie delete" onClick="js_cookie_del()"> </td> </tr> </table> </form> <!-- /##footer --></div> <!-- /##container --></div> </body> </html> </cfoutput> </cffunction>