Ignore:
Timestamp:
2012/02/19 02:22:11 (15 years ago)
Author:
Seasoft
Message:

#1613 (ソース整形・ソースコメントの改善)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/Smarty/templates/admin/order/product_select.tpl

    r21535 r21537  
    2424<!--{include file="`$smarty.const.TEMPLATE_ADMIN_REALDIR`admin_popup_header.tpl"}--> 
    2525 
    26 <script type="text/javascript"> 
    27 <!-- 
    28 self.moveTo(20,20);self.focus(); 
    29  
    30 function func_submit(product_id, class_name1, class_name2) { 
    31     var err_text = ''; 
    32     var fm = window.opener.document.form1; 
    33     var fm1 = window.opener.document; 
    34     var class1 = "classcategory_id" + product_id + "_1"; 
    35     var class2 = "classcategory_id" + product_id + "_2"; 
    36  
    37     var class1_id = document.getElementById(class1).value; 
    38     var class2_id = document.getElementById(class2).value; 
    39     var product_class_id = document.getElementById("product_class_id" + product_id).value; 
    40     var opner_product_id = 'add_product_id'; 
    41     var opner_product_class_id = 'add_product_class_id'; 
    42     var tpl_no = '<!--{$tpl_no}-->'; 
    43  
    44     if (tpl_no != '') { 
    45         opner_product_id = 'edit_product_id'; 
    46         opner_product_class_id = 'edit_product_class_id'; 
    47         fm1.getElementById("no").value = escape('<!--{$tpl_no}-->'); 
     26<script type="text/javascript">//<![CDATA[ 
     27    self.moveTo(20,20);self.focus(); 
     28 
     29    function func_submit(product_id, class_name1, class_name2) { 
     30        var err_text = ''; 
     31        var fm = window.opener.document.form1; 
     32        var fm1 = window.opener.document; 
     33        var class1 = "classcategory_id" + product_id + "_1"; 
     34        var class2 = "classcategory_id" + product_id + "_2"; 
     35 
     36        var class1_id = document.getElementById(class1).value; 
     37        var class2_id = document.getElementById(class2).value; 
     38        var product_class_id = document.getElementById("product_class_id" + product_id).value; 
     39        var opner_product_id = 'add_product_id'; 
     40        var opner_product_class_id = 'add_product_class_id'; 
     41        var tpl_no = '<!--{$tpl_no}-->'; 
     42 
     43        if (tpl_no != '') { 
     44            opner_product_id = 'edit_product_id'; 
     45            opner_product_class_id = 'edit_product_class_id'; 
     46            fm1.getElementById("no").value = escape('<!--{$tpl_no}-->'); 
     47        } 
     48        if (document.getElementById(class1).type == 'select-one' && class1_id == '__unselected') { 
     49            err_text = class_name1 + "を選択してください。\n"; 
     50        } 
     51        if (document.getElementById(class2).type == 'select-one' && class2_id == '') { 
     52            err_text = err_text + class_name2 + "を選択してください。\n"; 
     53        } 
     54        if (err_text != '') { 
     55            alert(err_text); 
     56            return false; 
     57        } 
     58 
     59        fm1.getElementById(opner_product_id).value = product_id; 
     60        fm1.getElementById(opner_product_class_id).value = product_class_id; 
     61 
     62        fm.mode.value = 'select_product_detail'; 
     63        fm.anchor_key.value = 'order_products'; 
     64        fm.submit(); 
     65        window.close(); 
     66 
     67        return true; 
    4868    } 
    49     if (document.getElementById(class1).type == 'select-one' && class1_id == '__unselected') { 
    50         err_text = class_name1 + "を選択してください。\n"; 
     69 
     70    // 規格2に選択肢を割り当てる。 
     71    function fnSetClassCategories(form, classcat_id2_selected) { 
     72        sele1 = form.classcategory_id1; 
     73        sele2 = form.classcategory_id2; 
     74        product_id = form.product_id.value; 
     75 
     76        if (sele1) { 
     77            if (sele2) { 
     78                // 規格2の選択肢をクリア 
     79                count = sele2.options.length; 
     80                for(i = count; i >= 0; i--) { 
     81                    sele2.options[i] = null; 
     82                } 
     83 
     84                // 規格2に選択肢を割り当てる 
     85                classcats = productsClassCategories[product_id][sele1.value]; 
     86                i = 0; 
     87                for (var classcat_id2_key in classcats) { 
     88                    classcategory_id2 = classcats[classcat_id2_key].classcategory_id2; 
     89                    sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcategory_id2); 
     90                    if (classcategory_id2 == classcat_id2_selected) { 
     91                        sele2.options[i].selected = true; 
     92                    } 
     93                    i++; 
     94                } 
     95            } 
     96            fnCheckStock(form); 
     97        } 
    5198    } 
    52     if (document.getElementById(class2).type == 'select-one' && class2_id == '') { 
    53         err_text = err_text + class_name2 + "を選択してください。\n"; 
     99 
     100    function fnCheckStock(form) { 
     101        product_id = form.product_id.value; 
     102        classcat_id1 = form.classcategory_id1.value; 
     103        classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : ''; 
     104        classcat2 = productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 
     105        // 商品規格 
     106        eleDynamic = document.getElementById('product_class_id' + product_id); 
     107        if ( 
     108            classcat2 
     109            && typeof classcat2.product_class_id != 'undefined' 
     110            && String(classcat2.product_class_id).length >= 1 
     111        ) { 
     112            eleDynamic.value = classcat2.product_class_id; 
     113        } else { 
     114            eleDynamic.value = '' 
     115        } 
    54116    } 
    55     if (err_text != '') { 
    56         alert(err_text); 
    57         return false; 
    58     } 
    59  
    60     fm1.getElementById(opner_product_id).value = product_id; 
    61     fm1.getElementById(opner_product_class_id).value = product_class_id; 
    62  
    63     fm.mode.value = 'select_product_detail'; 
    64     fm.anchor_key.value = 'order_products'; 
    65     fm.submit(); 
    66     window.close(); 
    67  
    68     return true; 
    69 } 
    70 //--> 
    71 </script> 
    72  
    73  
    74 <script type="text/javascript">//<![CDATA[ 
    75 // 規格2に選択肢を割り当てる。 
    76 function fnSetClassCategories(form, classcat_id2_selected) { 
    77     sele1 = form.classcategory_id1; 
    78     sele2 = form.classcategory_id2; 
    79     product_id = form.product_id.value; 
    80  
    81     if (sele1) { 
    82         if (sele2) { 
    83             // 規格2の選択肢をクリア 
    84             count = sele2.options.length; 
    85             for(i = count; i >= 0; i--) { 
    86                 sele2.options[i] = null; 
    87             } 
    88  
    89             // 規格2に選択肢を割り当てる 
    90             classcats = productsClassCategories[product_id][sele1.value]; 
    91             i = 0; 
    92             for (var classcat_id2_key in classcats) { 
    93                 classcategory_id2 = classcats[classcat_id2_key].classcategory_id2; 
    94                 sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcategory_id2); 
    95                 if (classcategory_id2 == classcat_id2_selected) { 
    96                     sele2.options[i].selected = true; 
    97                 } 
    98                 i++; 
    99             } 
    100         } 
    101         fnCheckStock(form); 
    102     } 
    103 } 
    104  
    105 function fnCheckStock(form) { 
    106     product_id = form.product_id.value; 
    107     classcat_id1 = form.classcategory_id1.value; 
    108     classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : ''; 
    109     classcat2 = productsClassCategories[product_id][classcat_id1]['#' + classcat_id2]; 
    110     // 商品規格 
    111     eleDynamic = document.getElementById('product_class_id' + product_id); 
    112     if ( 
    113         classcat2 
    114         && typeof classcat2.product_class_id != 'undefined' 
    115         && String(classcat2.product_class_id).length >= 1 
    116     ) { 
    117         eleDynamic.value = classcat2.product_class_id; 
    118     } else { 
    119         eleDynamic.value = '' 
    120     } 
    121 } 
    122 //]]> 
    123 </script> 
     117//]]></script> 
    124118 
    125119<!--▼検索フォーム--> 
Note: See TracChangeset for help on using the changeset viewer.