//--------------------------------------
//javascript
// required:Constants.inc
// required:DataFunc.inc
//--------------------------------------
//--------------------------------------
//材料一覧取得
//--------------------------------------
function getRecipeMaterial(RecipeID)
{
var conn=new ActiveXObject("ADODB.Connection");
var rst=new ActiveXObject("ADODB.Recordset");
var material = "";
var quantity = "";
var lineClass = 0;
var retStr = "";
var szSQL = "select 行区分, 材料名, 分量 from 材料 ";
szSQL += "where レシピID = "+ RecipeID +" order by 行番号";
conn.connectionstring=GC_CONNECTSTRING;
conn.open();
rst.open(szSQL,conn);
for(; rst.EOF == false;){
material = rst.fields("材料名").value+"";
if( material == "null" ){ material =""}
quantity = rst.fields("分量").value+"";
if( quantity == "null" ){ quantity =""}
lineClass = rst.fields("行区分").value+"";
if( lineClass == 0 || lineClass == 10 ){
retStr += "
\n";
}else{
retStr += "
\n";
}
retStr += " "+material+" | \n";
retStr += " "+quantity+" | \n";
retStr += "
\n";
if( lineClass == 0 || lineClass ==20 ){
retStr += "  | \n";
}
rst.MoveNext
}
rst.close();
rst=null;
conn.close();
conn=null;
return retStr;
}
//--------------------------------------
//作り方取得
//--------------------------------------
function getRecipeHowTo(RecipeID)
{
var conn=new ActiveXObject("ADODB.Connection");
var rst=new ActiveXObject("ADODB.Recordset");
var lineNo = 0;
var howTo = "";
var notice = "";
var image = "";
var rid = "";
var retStr = "";
var szSQL = "select 行番号, 作り方, 特記事項, 画像ファイル名, レシピID from 作り方 ";
szSQL += "where レシピID = "+ RecipeID +" order by 行番号";
conn.connectionstring=GC_CONNECTSTRING;
conn.open();
rst.open(szSQL,conn);
for(; rst.EOF == false;){
lineNo = rst.fields("行番号").value+"";
howTo = Server.HTMLEncode(rst.fields("作り方").value+"");
howTo = howTo.replace( /\n/g, "
");
// 特記事項表示の修正 2003/03/03 Mod
// notice = Server.HTMLEncode(rst.fields("特記事項").value+"");
// Deleteから復活↓↓↓ 2003/07/15 Mod
notice = Server.HTMLEncode(NToS(rst.fields("特記事項").value)+"");
if( notice != "" ){
notice = "※ "+ notice;
}
notice = notice.replace( /\n/g, "
");
image = rst.fields("画像ファイル名").value+"";
rid = rst.fields("レシピID").value+"";
retStr += " \n";
retStr += " ("+lineNo+") | \n";
retStr += " ";
if( image != "" && image != "null" ){
retStr += " "
}
retStr += howTo+" "+notice+" | \n";
retStr += "
\n";
rst.MoveNext;
}
rst.close();
rst=null;
conn.close();
conn=null;
return retStr;
}
//--------------------------------------
//画像タグ取得
//--------------------------------------
function getRecipeImage(RecipeID)
{
var conn=new ActiveXObject("ADODB.Connection");
var rst=new ActiveXObject("ADODB.Recordset");
var image = "";
var name = "";
var retStr = "";
var RID = "";
if( RecipeID == 0) return "";
var szSQL="select 画像ファイル名, 料理名,レシピ.レシピID ";
szSQL += "from レシピ left join レシピ画像 on レシピ.レシピID =レシピ画像.レシピID ";
szSQL += "where レシピ.レシピID="+RecipeID;
conn.connectionstring=GC_CONNECTSTRING;
conn.open();
rst.open(szSQL,conn);
image = rst.fields("画像ファイル名").value+"";
name = rst.fields("料理名").value+"";
RID = rst.fields("レシピID").value+"";
rst.close();
rst=null;
conn.close();
conn=null;
if( image != "" && image != "null"){
retStr += "
"
}
return retStr
}