/**
* stepの数と、実際の表示するステップ番号とは違いがあります!!
* 途中でステップが増える処理があるため。
* resmapを参照!
*/
var DEFAULT_FORMID_LIST = new Array(
'52abb097-9504-4555-8992-a206b1eb3b9d',
'8c3d6040-f901-4d61-9fb0-73b0c38e1b70',
'1ce1d82d-feab-415f-94da-520779aa4cd5'
);
var step = 0;
var typeRow = null;
var resmap = {
1: '1',
2: '2',
3: '3',
4: '4',
5: '5',
6: '6',
7: '7'
};
var prevDisabled = false;
var nextDisabled = false;
var hasToken = false;
var hasDocs = false;
var dfFlg = false;
var gid = '';
var formId = '';
var formType = '';
var formTitle = '';
var formSubTitle = '';
var formLastMsg = '';
var formMailAddress = '';
var ssid = '';
var formBackUrl = ''; //back_url
var formBackTxt = ''; //back_txt
var formReMail = false; //re_mail
var formReAddress = ''; //re_address
var formReSubject = ''; //re_subject
var formReMessage = ''; //re_message
var formNewFlg = ''; //Google仕様変更前後フラグ
var formData = null;
var curComp = null;
var fldsStore = null;
var newCompCnt = 0;
var newFldCnt = 0;
var current = 0;
var tm;
var option = {oem:'0'};
var colTypes = [
['テキスト', 'テキスト'],
['数値テキスト', '数値テキスト'],
['複数行テキスト', '複数行テキスト'],
['選択リスト', '選択リスト'],
['チェックボックス', 'チェックボックス'],
['ラジオボタン', 'ラジオボタン'],
['メールアドレス', 'メールアドレス']
];
var COMP_NAME = {
id: 'name', label: '名前',
fields: [
{id: 'sei', type: 'テキスト', label: '姓', required: true, size:10},
{id: 'mei', type: 'テキスト', label: '名', required: true, size:10}
]
};
var COMP_NAME_KANA = {
id: 'name_kana', label: '名前カナ',
fields: [
{id: 'sei_kana', type: 'テキスト', label: 'セイ', required: true, size:10},
{id: 'mei_kana', type: 'テキスト', label: 'メイ', required: true, size:10}
]
};
var COMP_TEL = {
id: 'tel', label: '電話番号',
fields: [
{id: 'tel1', type: '数値テキスト', label: '電話番号', required: true, size:10},
{id: 'tel2', type: '数値テキスト', label: '-', required: true, size:8},
{id: 'tel3', type: '数値テキスト', label: '-', required: true, size:8}
]
};
var COMP_SINGLE_TEXT = {
id: 'single_text', label: '単一テキスト',
fields: [
{id: 'single_text', type: 'テキスト', label: 'テキスト', required: true, size:30}
]
};
var COMP_GENDER = {
id: 'gender', label: '性別',
fields: [
{id: 'gender', type: 'ラジオボタン', label: '性別', required: true,
choices: ['男性', '女性']}
]
};
var COMP_WORKS = {
id: 'works', label: '職業',
fields: [
{id: 'works', type: '選択リスト', label: '職業', required: true,
choices: ['学生', '会社員', '公務員', '教員', '自営業', '主婦', 'その他']}
]
};
var COMP_ADDRESS = {
id: 'address', label: '住所',
fields: [
{id: 'ps_postal1', type: '数値テキスト', label: '郵便番号', required: true, size:4, re:'/^\\d{3}$/', errMsg:'数値3桁で入力してください。'},
{id: 'ps_postal2', type: '数値テキスト', label: '−', required: true, size:8, re:'/^\\d{4}$/', errMsg:'数値4桁で入力してください。'},
{id: 'prefs', type: '選択リスト', label: '都道府県', required: true,
choices: ['北海道', '青森県', '岩手県', '宮城県', '秋田県', '山形県', '福島県', '茨城県', '栃木県', '群馬県',
'埼玉県', '千葉県', '東京都', '神奈川県', '新潟県', '富山県', '石川県', '福井県', '山梨県', '長野県',
'岐阜県', '静岡県', '愛知県', '三重県', '滋賀県', '京都府', '大阪府', '兵庫県', '奈良県', '和歌山県',
'鳥取県', '島根県', '岡山県', '広島県', '山口県', '徳島県', '香川県', '愛媛県', '高知県', '福岡県',
'佐賀県', '長崎県', '熊本県', '大分県', '宮崎県', '鹿児島県', '沖縄県']},
{id: 'street1', type: 'テキスト', label: '市区町村・番地', required: true, size:30},
{id: 'street2', type: 'テキスト', label: '建物・マンション名以降', required: false, size:30}
]
};
var COMP_MAIL_ADDRESS = {
id: 'email', label: 'メールアドレス',
fields: [
{id: 'email', type: 'メールアドレス', label: 'メールアドレス', required: true, re: MAIL_MATCH, size:30, errMsg:'メールアドレスの書式で入力してください。'},
{id: 'email_check', type: 'メールアドレス', label: 'メールアドレス(確認)', required: true, re: MAIL_MATCH, size:30, errMsg:'メールアドレスの書式で入力してください。'}
]
};
var COMP_AGE = {
id: 'age', label: '年齢',
fields: [
{id: 'age', type: '選択リスト', label: '年齢', required: true,
choices: ['10歳未満', '10〜19歳', '20〜29歳', '30〜39歳', '40〜49歳', '50〜59歳', '60〜69歳', '70〜79歳', '80〜89歳', '90〜99歳', '100歳以上']}
]
};
var COMP_DATE = {
id:'cmp_date', label:'日付',
fields: [
{id: 'date_y', type: '選択リスト', label: '年', required: true, suffix: '年',
choices: ['2010', '2011', '2012', '2013', '2014', '2015', '2016', '2017']},
{id: 'date_m', type: '選択リスト', label: '月', required: true, suffix: '月',
choices: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']},
{id: 'date_d', type: '選択リスト', label: '日', required: true, suffix: '日',
choices: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']}
]
};
var year = new Date().getYear();
if (year < 2000) year += 1900;
var COMP_CALC_DATE = {
id:'calc_date', label:'日付(自動計算)',
fields: [
{id: 'calc_date_y', type: '選択リスト', label: '年', required: true, suffix: '年',
choices: [String(year-2), String(year-1), String(year), String(year+1), String(year+2), String(year+3)]},
{id: 'calc_date_m', type: '選択リスト', label: '月', required: true, suffix: '月',
choices: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']},
{id: 'calc_date_d', type: '選択リスト', label: '日', required: true, suffix: '日',
choices: ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10',
'11', '12', '13', '14', '15', '16', '17', '18', '19', '20',
'21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']}
]
};
var COMP_FAVORITE_BERRY = {
id:'fav_berry', label:'好きないちごはどれですか?',
fields: [
{id: 'fav_berry', type: 'チェックボックス', label: '好きないちご', required: true,
choices: ['あまおう', 'とちおとめ', '紅ほっぺ', 'アイベリー', 'さがほのか', 'ももいちご', '初恋の香り', 'その他']}
]
};
var compTypes = {
types:[COMP_NAME, COMP_NAME_KANA, COMP_GENDER, COMP_ADDRESS, COMP_WORKS,
COMP_TEL, COMP_MAIL_ADDRESS, COMP_AGE, COMP_DATE,COMP_CALC_DATE,
COMP_SINGLE_TEXT, COMP_FAVORITE_BERRY]
};
// プリセット
var presetForm = {
forms:[
// お問い合わせフォーム
{id: 'contact01', title: 'お問い合わせフォーム', image: '../_modules/images/form/form_thumb.png',
description: '一般的なお問い合わせフォームです。',
last_msg: 'お問い合わせありがとうございます。\nご返信までには3〜4営業日いただいております。\nあらかじめご了承ください。',
re_subject: 'お問い合わせありがとうございます',
re_message: 'お問い合わせありがとうございます。\nご返信までには3〜4営業日いただいております。\nあらかじめご了承ください。',
comps: [
COMP_NAME,
COMP_NAME_KANA,
COMP_MAIL_ADDRESS,
{id: 'desc', label: 'お問い合わせ内容',
fields: [
{id: 'desc', type: '複数行テキスト', label: 'お問い合わせ内容', required: true}
]}
],
dtls:[]
},
// 予約フォーム
{id: 'reserve01', title: '予約フォーム', image: '../_modules/images/form/form_thumb.png',
description: '宿泊施設を想定した予約フォームです。',
last_msg: 'ご予約を承りました。\nなお、お部屋の空き状況によりお客様のご希望に添えない場合もございます。\nあらかじめご了承ください。\n\n数日たっても弊宿からご連絡が行かない場合は、大変お手数ですが、ご連絡を頂けると幸いです。',
re_subject: 'ご予約ありがとうございます',
re_message: 'ご予約ありがとうございます。\n以下の内容で承りましたので、ご確認ください。',
comps: [
COMP_NAME,
COMP_NAME_KANA,
COMP_MAIL_ADDRESS,
{id: 'start_date', label: 'ご宿泊希望日',
fields: COMP_CALC_DATE.fields},
{id: 'party', label: 'ご宿泊人数',
fields: [
{id: 'adult_num', type: '数値テキスト', label: '大人', required: true, size:6, suffix: '人'},
{id: 'child_num', type: '数値テキスト', label: '子供', required: true, size:6, suffix: '人'}
]},
{id: 'desc', label: '通信欄',
fields: [
{id: 'desc', type: '複数行テキスト', label: '通信欄', required: true}
]}
],
dtls:[]
},
// アンケートフォーム
{id: 'enquete01', title: 'アンケートフォーム', image: '../_modules/images/form/form_thumb.png',
description: 'アンケートのサンプルです。',
last_msg: 'お忙しい中、アンケートへのご協力ありがとうございました!\n今後のサイト運営の参考に活用させて頂きます。',
re_subject: 'アンケートへのご協力ありがとうございました',
re_message: 'アンケートへのご協力ありがとうございました。\n以下の内容でお答え頂きました。',
comps: [
{id: 'q1', label: '当サイトの使いやすさはいかがでしたか?',
fields: [
{id: 'q1', type: 'ラジオボタン', label: 'サイトの使いやすさ', required: true,
choices:['とても良い', '良い', 'まあまあ', 'いまいち', '悪い']
}
]},
{id: 'q2', label: '当サイトをお知りになったきっかけ',
fields: [
{id: 'q2', type: 'チェックボックス', label: 'サイトを知ったきっかけ', required: true,
choices:['検索サイト', 'ブログ or ホームページ', '新聞', '雑誌', 'その他']
}
]},
{id: 'q3', label: '当サイトで気に入ったコーナー',
fields: [
{id: 'q3', type: 'チェックボックス', label: '気に入ったコーナー', required: true,
choices:['新着レビュー', 'iPhone&iPadアプリ', '今日のひとこと']
}
]},
{id: 'desc', label: '今後取り上げて欲しい内容など、自由にご記入ください。',
fields: [
{id: 'desc', type: '複数行テキスト', label: '自由記入欄', required: true}
]}
],
dtls:[]
},
// 資料請求フォーム
{id: 'catalog01', title: '資料請求フォーム', image: '../_modules/images/form/form_thumb.png',
description: '資料請求用のフォームです。
住所入力欄があります。',
last_msg: '資料請求ありがとうございます。\n発送までには3〜4営業日いただいております。\nあらかじめご了承ください。',
re_subject: '資料請求ありがとうございます',
re_message: '資料請求ありがとうございます。\n発送までには3〜4営業日いただいております。\nあらかじめご了承ください。',
comps: [
COMP_NAME,
COMP_NAME_KANA,
COMP_MAIL_ADDRESS,
COMP_ADDRESS,
COMP_WORKS
],
dtls:[]
},
// ご意見フォーム
{id: 'voice01', title: 'ご意見フォーム', image: '../_modules/images/form/form_thumb.png',
description: 'ご意見フォームのサンプルです。',
last_msg: '貴重なご意見ありがとうございました。\n今後の参考にさせて頂きます。',
re_subject: 'ご意見ありがとうございました',
re_message: '貴重なご意見ありがとうございました。\n以下の内容でご意見を頂戴いたしました。',
comps: [
{id: 'subject', label: '件名',
fields: [
{id: 'subject', type: 'テキスト', label: '件名', required: true, size: 60}
]},
{id: 'desc', label: 'ご意見・ご要望',
fields: [
{id: 'desc', type: '複数行テキスト', label: 'ご意見・ご要望', required: true}
]},
COMP_AGE,
COMP_GENDER,
COMP_MAIL_ADDRESS
],
dtls:[]
}
]
};
//sync.jsにあるDetailDatと同じにしてください。
var DetailDat = {
fields: [
{id: 'txt_required', place: '※は必須入力です。', deflabel: 'は必須入力です。', label: ''},
{id: 'txt_confirm', place: '送信確認', deflabel: 'この内容で送信します。よろしいですか?', label: ''},
{id: 'btn_confirm', place: '確認ボタンの文言', deflabel: '確認', label: ''},
{id: 'btn_transmit', place: '送信ボタンの文言', deflabel: '送信', label: ''},
{id: 'btn_correct', place: '内容を修正ボタンの文言', deflabel: '内容を修正', label: ''},
{id: 'chk_sel_required', place: '未選択エラー', deflabel: '選択してください。', label: ''},
{id: 'chk_txt_required', place: '未入力エラー', deflabel: '入力してください。', label: ''},
{id: 'chk_txt_format', place: '書式エラー', deflabel: '正しい書式で入れてください。', label: ''},
{id: 'chk_txt_limit', place: '送信制限エラー', deflabel: '送信できるテキストは500文字以内です。', label: ''},
{id: 'chk_txt_conflict', place: '不一致確認エラー', deflabel: 'と一致しません。', label: ''},
{id: 'msg_send_success', place: '送信成功の文言', deflabel: '送信を完了しました。', label: ''},
{id: 'msg_send_error', place: '送信失敗の文言', deflabel: '送信に失敗しました。', label: ''},
{id: 'msg_send_failed', place: 'タイムアウト時の文言', deflabel: 'フォームの送信に失敗した可能性があります。\n再送信してください。', label: ''}
]
};
Ext.onReady(function(){
setupCommon();
var args = location.search;
if (args.length > 0) {
// get initial data
var params = parseParam(args);
// authsubからの戻り
if (params.auth_return) {
if (params.bindcld) {
if (window.opener && !window.opener.closed){
var cldlocurl = window.location.href.replace("&bindcld=true","");
window.opener.location.href = cldlocurl;
window.close();
return;
}
}
if (params.error) {
gotoStep(1);
} else {
gid = params.g;
if (params.s) {
formId = params.s;
jQuery.getJSON('./json/', {'s' : formId}, function(json) {
formTitle = json.title;
formSubTitle = json.subtitle;
formLastMsg = json.last_msg;
formMailAddress = json.mail_address;
formBackUrl = json.back_url;
formBackTxt = json.back_txt;
formReMail = json.re_mail;
formReAddress = json.re_address;
formReSubject = json.re_subject;
formReMessage = json.re_message;
formNewFlg = json.new_flg;
ssid = json.ssid;
formData = json;
step = 3;
gotoStep(4);
});
} else {
step = 2;
gotoStep(3);
}
}
// 復元
} else {
gid = params.g;
formId = params.s;
// defaultならトップへ
for (var fmCnt = 0; fmCnt < DEFAULT_FORMID_LIST.length; fmCnt++) {
if (DEFAULT_FORMID_LIST[fmCnt] == formId) {
gid = '';
formId = '';
gotoStep(1);
dfFlg = true;
}
}
// get form info
if (!dfFlg) {
jQuery.getJSON('./json/', {'s' : formId}, function(json) {
formTitle = json.title;
formSubTitle = json.subtitle;
formLastMsg = json.last_msg;
formMailAddress = json.mail_address;
formBackUrl = json.back_url;
formBackTxt = json.back_txt;
formReMail = json.re_mail;
formReAddress = json.re_address;
formReSubject = json.re_subject;
formReMessage = json.re_message;
formNewFlg = json.new_flg;
ssid = json.ssid;
formData = json;
// Google仕様変更により再認証が必要な場合
if ((formNewFlg == '' || formNewFlg == null) || (json.authsub)) {
step = 1;
gotoStep(2);
} else {
step = 6;
gotoStep(7);
}
});
hasDocs = true;
}
}
} else {
gotoStep(1);
}
jQuery('#btn-prev').click(function(e) {
if (prevDisabled) return;
nextDisabled = false;
if (step == 1) {
location.href = '/main/';
} else if (step == 3) {
jQuery.get('./hastoken', function(data, status) {
if (data == 'True') {
hasToken = true;
}
gotoStep(step - 1);
});
/*} else if (step == 5) {
if (useMakeDocsAccount == false) step--;
gotoStep(step-1);*/
} else if (step == 5) {
//戻ってもキープ
formTitle = jQuery('#form_name').val();
formSubTitle = jQuery('#desc').val();
formLastMsg = jQuery('#last_msg').val();
formMailAddress = jQuery('#mail_address').val();
formBackUrl = jQuery('#back_url').val();
formBackTxt = jQuery('#back_txt').val();
gotoStep(step-1);
} else if (step == 6) {
//戻ってもキープ
formReMail = false;
jQuery('#re_mail').each(function(i,e){
if (e.checked) formReMail = true;
});
formReAddress = jQuery('#re_address').val();
formReSubject = jQuery('#re_subject').val();
formReMessage = jQuery('#re_message').val();
gotoStep(step-1);
} else {
gotoStep(step-1);
}
});
jQuery('#btn-next').click(function(e) {
if (nextDisabled) return;
// Token作成済みか?
if (step == 1 && !dfFlg) {
jQuery.get('./hastoken', function(data, status) {
if (data == 'True') {
hasToken = true;
}
gotoStep(step+1);
});
return;
} else if (step == 3) {
if (typeRow == null) {
msgBox('エラー', 'フォームの種類を選んでください。');
return;
}
if (formData != null && formType != typeRow.data.id) {
Ext.Msg.confirm('設定を上書きします', 'すでに設定済みのフォームデータが存在します。\n上書きしてもよろしいですか?', function(btn) {
if (btn == 'yes') {
setFormType();
gotoStep(step+1);
}
});
return;
}
setFormType();
} else if (step == 4) {
var total = store.getTotalCount();
for (var i=0; i
' +
'プレビューボタンをクリックし、ブラウザでプレビューしてください。', function() {
loadProcess(json);
});
} else {
loadProcess(json);
}*/
loadProcess(json);
} else {
clearInterval(tm);
Ext.MessageBox.hide();
msgBox('更新エラー', 'フォームデータの送信に失敗しました。\n再度、適用をクリックしてください。\n(' + json.err_msg + ')');
doubleSendFlgNum = 0;
}
},
error: function(xhr, stats) {
clearInterval(tm);
Ext.MessageBox.hide();
msgBox('更新エラー', 'フォームデータの送信に失敗しました。\n再度、適用をクリックしてください。');
doubleSendFlgNum = 0;
}
});
}
function loadProcess(json) {
keyDownEscFlag = true;
Ext.Msg.alert('SYNC for WebLiFE', 'フォームに送信されたデータは、GoogleDocsに蓄積されます。
' +
'確認するにはGoogle Docsにアクセスしてください。', function() {
keyDownEscFlag = false;
if (oemFlg.oem.length>0 && oemFlg.oem == '1') option.oem = '1';
loadTag('form5', gid, json.form_id, jQuery.toJSON(option));
});
}
function updateProgress() {
current++;
if (current == 12) current = 0;
var i = current / 11;
Ext.MessageBox.updateProgress(i, '送信中...');
}
function setFormType() {
formType = typeRow.data.id;
jQuery.each(presetForm.forms, function(i, f) {
if (f.id == formType) {
formData = copyObj(f);
return false;
}
});
formTitle = typeRow.data.title;
formLastMsg = typeRow.data.last_msg;
formReSubject = typeRow.data.re_subject;
formReMessage = typeRow.data.re_message;
}
function gotoStep(nextstep) {
if (nextstep == step) return;
nextDisabled = true;
var fn = (nextstep > step) ? nextHandler:prevHandler;
var nm = resmap[nextstep];
if (nextstep == 2 && hasToken) nm = '2-1';
var tm = new Date().getTime();
jQuery('#contents_body').load('/_modules/html/form/step' + nm + '.html?tm=' + tm, fn);
}
function nextHandler(text, status) {
if (status == 'success') {
step++;
setStepCss();
onLoadComplete();
} else {
nextDisabled = false;
}
}
function prevHandler(text, status) {
if (status == 'success') {
step--;
setStepCss();
onLoadComplete();
} else {
nextDisabled = false;
}
}
function onLoadComplete() {
/* 20150420 AuthSub廃止 非表示に
// AuthSub警告表示 20150311 START
var warnTitle = '
2015年4月20日までに、フォームの再設定を行ってください。
');
jQuery('#msg_no_mail').append(' お客さんにメールを送るときは、「項目の設定」でメールアドレスを入力項目に追加してください。');
}
jQuery('#re_address').css('background-color', (formReMail)?'#ffffff':'#F8F8F8');
jQuery('#re_subject').css('background-color', (formReMail)?'#ffffff':'#F8F8F8');
jQuery('#re_message').css('background-color', (formReMail)?'#ffffff':'#F8F8F8');
jQuery('.attention-mark').attr('style','display: ' + ((formReMail)?'visibility':'none'));
jQuery('#re_mail').click(function(e) {
checkReMailFields(this.checked, '#msg_re_mail');
jQuery('#re_address').css('background-color', (this.checked)?'#ffffff':'#F8F8F8');
jQuery('#re_subject').css('background-color', (this.checked)?'#ffffff':'#F8F8F8');
jQuery('#re_message').css('background-color', (this.checked)?'#ffffff':'#F8F8F8');
jQuery('.attention-mark').attr('style','display: '+((this.checked)?'visibility':'none'));
}).attr("checked", formReMail);
jQuery('#re_address').focus(function(e) {
checkMailAddress(this, '#msg_re_address');
}).keyup(function(e) {
checkMailAddress(this, '#msg_re_address');
}).val(formReAddress);
jQuery('#re_subject').focus(function(e) {
keyDownEscFlag = true;
}).blur(function(e) {
keyDownEscFlag = false;
}).val(formReSubject);
jQuery('#re_message').focus(function(e) {
keyDownEscFlag = true;
}).blur(function(e) {
keyDownEscFlag = false;
}).val(formReMessage);
nextDisabled = false;
} else if (step == 7) {
jQuery('#form_type').append(formData.title);
jQuery('#form_name').append(formTitle);
/*
if (formId.length > 0) {
jQuery('#csv_down').append('ダウンロード');
} else {*/
jQuery('#csv_row').hide();
//}
// TODO: スプレッドシートが関連づけられていれば、表示しリンクする。
jQuery('#useful-link-title').hide();
jQuery('#useful-link').hide();
nextDisabled = false;
} else {
nextDisabled = false;
}
}
function backbtnmark(){
if ((jQuery('#back_txt').val().length>0) || (jQuery('#back_url').val().length>0)) {
jQuery('.attention-mark').attr('style','display: visibility');
} else {
jQuery('.attention-mark').attr('style','display: none');
}
}
function setStepCss() {
var nm = resmap[step];
jQuery('#sub_title').css('background-image', 'url(/_modules/images/form/subtitle0' + nm + '.png)');
for (var i=1; i<=7; i++) {
nm = resmap[i];
var src = '/_modules/images/form/step0' + nm;
if (i == step) {
src += '_on';
}
if (document.getElementById('step' + nm))
jQuery('#step' + nm).css('background-image',
'url(' + src + '.png)');
}
/* sumit button */
btn = document.getElementById('btn-next');
if (step == 7) {
btn.className = 'btn-submit';
} else if (step == 2 && hasToken == false) {
btn.className = 'btn-next-disabled';
} else {
btn.className = 'btn-next';
}
// resize
resizeHandler();
}
// コンポーネントの一覧
function renderColumnList() {
if (formData != null) {
// store
store = new Ext.data.JsonStore ({
root: 'comps',
id: 'id',
fields: ['id', 'label', 'fields'],
remoteSort: false
});
store.loadData(formData);
// column model
var cm = new Ext.grid.ColumnModel([{
id: 'id',
header: '項目',
width: 600,
dataIndex: 'label',
renderer: formatTitle,
sortable: false,
editor: new Ext.form.TextField({
allowBlank: false
})
},{
header: '', dataIndex: '', renderer: renderCtrlCol, sortable: false, hideable: false, align: 'center'
}]);
// component combo
var compStore = new Ext.data.JsonStore({
root: 'types',
id: 'id',
fields: ['id', 'label'],
data: compTypes
});
var compTypesCombo = new Ext.form.ComboBox({
store: compStore,
displayField: 'label',
valueField: 'id',
mode: 'local',
typeAhead: true,
forceSelection: true,
triggerAction: 'all',
emptyText: '項目の種類を選択',
selectOnFocus: true,
listClass: 'x-combo-list-small'
});
// create the Grid
var grid = new Ext.grid.EditorGridPanel({
el:'main-area',
width:600,
height:350,
title:'',
store: store,
cm: cm,
trackMouseOver: true,
sm: new Ext.grid.RowSelectionModel({
singleSelect: true
}),
defaultSortable: false,
loadMask: {msg: '読み込み中...'},
clicksToEdit: true,
viewConfig: {
forceFit:true,
enableRowBody:true,
showPreview:true,
getRowClass: function(rec, rowIndex, p, store) {
var s = '';
var flds = rec.data.fields;
for (var i=0; i
含まれる入力欄:' + s;*/
return 'x-grid3-row-expanded';
}
},
bbar: [{
text: '▲', handler:function() {
store.loadData(formData);
var r = grid.getSelectionModel().getSelected();
var ridx = moveRow('▲', r ,store);
if (ridx > -1) {
curRow = grid.getStore().getAt(ridx);
grid.getSelectionModel().selectRow(ridx);
}
}
},{
text: '▼', handler:function() {
store.loadData(formData);
var r = grid.getSelectionModel().getSelected();
var ridx = moveRow('▼', r ,store);
if (ridx > -1) {
curRow = grid.getStore().getAt(ridx);
grid.getSelectionModel().selectRow(ridx);
}
}
}, '-',
'項目を追加:',
compTypesCombo
,{
text: '追加', handler: function() {
var tid = compTypesCombo.getValue();
if (tid && tid.length > 0) {
var t = getBySameField(compTypes.types, tid);
var newId = getNextCompId(tid);
var newObj = copyObj(t);
newObj.id = newId;
for (i=0; i