Changeset 4019


Ignore:
Timestamp:
10/10/09 23:10:22 (10 years ago)
Author:
LucMorizur
Message:

[Event Cats] Continue $_POST analysis (slowly)

Location:
extensions/event_cats
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/event_cats/admin/evntcats_admin.php

    r4011 r4019  
    7272// +-----------------------------------------------------------------------+ 
    7373 
    74 // Effectuer quand même un test sur $_POST['act1'] : si demande de création d'entré, mais 
    75 // que cette demande ne peut aboutir, rediriger sur page création d'entrée ; sinon sur entrées existantes. 
    76  
    7774$page['tab'] = (!($ec_exist_entries = (mysql_fetch_row(pwg_query(' 
    7875  SELECT * FROM `'.EVNTCATS_TABLE.'` 
    7976  WHERE `code` IS NOT NULL 
    8077'))))) ? 'autolog_new' : 'autolog_entries'; 
    81 if (isset($_POST['ec_act1']) and 
    82  ($_POST['ec_act1'] == 'autolog_new' or $_POST['ec_act1'] == 'duplicate_entry')) 
    83     $page['tab'] = 'autolog_new'; 
     78if (isset($_POST['ec_act1'])) { 
     79  if ( 
     80    $_POST['ec_act1'] == 'autolog_new' or 
     81    $_POST['ec_act1'] == 'duplicate_entry' 
     82  ) 
     83   $page['tab'] = 'autolog_new'; 
     84  else if ($_POST['ec_act1'] == 'create') 
     85   $page['tab'] = (ec_create_entry_OK()) ? 'autolog_entries' : 'autolog_new'; 
     86} 
    8487else if (isset($_GET['tab'])) switch ($_GET['tab']) { 
    8588  case 'autolog_new': 
  • extensions/event_cats/admin/template/autolog_new.js

    r4002 r4019  
    2323  document.getElementById(ec_selected_user).checked = 'checked'; 
    2424  switch (ec_selected_user) { 
    25     case 'ec_sel_user_none': // None 
     25    /* case 'ec_sel_user_none': // None 
    2626      ec_selected_action = 
    2727       (ec_ap_ok && (ec_selected_action != 'ec_input_action_home')) ? 
     
    3030      document.getElementById('ec_in_up_psd_txt_id').value = ''; 
    3131      document.getElementById('ec_in_up_usr_list_id').value = '-1'; 
    32     break; 
     32    break; */ 
    3333    case 'ec_sel_user_new': // New user 
    3434      document.getElementById('ec_in_up_usr_txt_id').value = 
     
    6868        document.getElementById('ec_in_up_cats_id').value = ec_selected_cat; 
    6969        document.getElementById('ec_in_up_imgs_id').value = ''; 
    70         ec_selected_user = (ec_selected_user == 'ec_sel_user_none') ? 
    71          'ec_sel_user_old' : ec_selected_user; 
     70        /* ec_selected_user = (ec_selected_user == 'ec_sel_user_none') ? 
     71         'ec_sel_user_old' : ec_selected_user; */ 
    7272        document.getElementById('ec_in_up_imgs_warn').innerHTML = ''; 
    7373      break; 
     
    7676        document.getElementById('ec_in_up_cats_id').value = ec_selected_cat; 
    7777        document.getElementById('ec_in_up_imgs_id').value = ec_selected_img; 
    78         ec_selected_user = (ec_selected_user == 'ec_sel_user_none') ? 
    79          'ec_sel_user_old' : ec_selected_user; 
     78        /* ec_selected_user = (ec_selected_user == 'ec_sel_user_none') ? 
     79         'ec_sel_user_old' : ec_selected_user; */ 
    8080        ec_check_img_text(); 
    8181      break; 
     
    237237} 
    238238 
     239function ec_check_submit() { 
     240  if (document.getElementById('ec_in_up_code_id').value == '') { 
     241    alert(ec_JS_message['ec_submit_code_miss']); 
     242    return false; 
     243  } 
     244  if (( 
     245    document.getElementById('ec_sel_user_new').checked != '' && 
     246    document.getElementById('ec_in_up_usr_txt_id').value == '' 
     247    ) || ( 
     248    document.getElementById('ec_sel_user_old').checked != '' && 
     249    document.ec_new_code.ec_in_up_usr_list.value == '-1' 
     250    ) || ( 
     251    document.getElementById('ec_sel_user_new').checked == '' && 
     252    document.getElementById('ec_sel_user_old').checked == '' 
     253    ) 
     254  ) { 
     255    alert(ec_JS_message['ec_submit_user_miss']); 
     256    return false; 
     257  } 
     258} 
     259 
    239260function ec_test() { 
    240261  alert('OK.'); 
     
    254275  ec_old_new_psd_text = ''; 
    255276  ec_test_reg = ''; 
    256   document.getElementById('ec_act1_id').value = ''; 
     277  document.getElementById('ec_act1_id').value = 'create'; 
    257278  document.getElementById('ec_in_up_pwd_warn').innerHTML = ''; 
    258   document.getElementById('ec_sel_user_none').checked = 'checked'; 
    259   document.getElementById('ec_sel_user_none').checked = ''; 
     279  document.getElementById('ec_sel_user_new').checked = 'checked'; 
     280  document.getElementById('ec_sel_user_new').checked = ''; 
    260281  document.getElementById('ec_input_action_home').checked = 'checked'; 
    261282  document.getElementById('ec_input_action_home').checked = ''; 
  • extensions/event_cats/admin/template/autolog_new.tpl

    r4011 r4019  
    4141 
    4242{* <!-- Parameters list --> *} 
    43 <form class = "filter" method = "post" name = "ec_new_code" action = ""> 
     43<form class = "filter" method = "post" name = "ec_new_code" action = "" onsubmit = "return ec_check_submit();"> 
    4444  <input type = "hidden" id = "ec_act1_id" name = "ec_act1" /> 
    4545   
     
    199199  </table> 
    200200  <p> 
    201     <input class = "submit" type = "submit{* button *}" {* name = "ec_submit" *} value = "{'Submit'|@translate}" onclick = "ec_validate();"/> 
    202     <input class = "submit" type = "reset" {* name = "ec_reset" *} value = "{'Reset'|@translate}" onclick = "ec_init();"/> 
     201    <input class = "submit" type = "submit" value = "{'Submit'|@translate}"/> 
     202    <input class = "submit" type = "reset" value = "{'Reset'|@translate}" onclick = "ec_init();"/> 
    203203  </p> 
    204204</form> 
     
    211211  ec_JS_message['ec_new_pwd_gen']       = "{'ec_new_pwd_gen'|@translate|@escape:javascript}"; 
    212212  ec_JS_message['ec_up_code_lbl_home']  = "{'ec_up_code_lbl_home'|@translate}"; 
     213  ec_JS_message['ec_submit_code_miss']  = "{'ec_submit_code_miss'|@translate}"; 
     214  ec_JS_message['ec_submit_user_miss']  = "{'ec_submit_user_miss'|@translate}"; 
    213215  ec_init(); 
    214216//--></script> 
  • extensions/event_cats/include/evntcats_funcs.inc.php

    r4011 r4019  
    298298 
    299299/* 
     300 * ec_create_entry_OK() 
     301 * returns true or false whether the creation of a new entry described by 
     302 * $_POST was OK or not. 
     303 * 
     304 * @param 
     305 *   no param 
     306 * @return 
     307 *   true if creation was OK ; false if not 
     308 */ 
     309function ec_create_entry_OK() { 
     310  return false; 
     311} 
     312 
     313/* 
    300314 * str_from_var($var) 
    301315 * returns a string easing array var informations displaying in Piwigo : 
  • extensions/event_cats/language/fr_FR/plugin.lang.php

    r4011 r4019  
    6464$lang['ec_act_cat_miss']          = 'Catégorie ?'; 
    6565$lang['ec_new_pwd_gen']           = 'Pensez à NOTER le mot de passe !'; 
     66$lang['ec_submit_code_miss']      = 'Vous devez fournir un code.'; 
     67$lang['ec_submit_user_miss']      = 'Vous devez fournir un utilisateur.'; 
    6668 
    6769// In PHP files 
  • extensions/event_cats/main.inc.php

    r3985 r4019  
    55Version: 1.0.0 
    66Description: A single URL can be enough to be identified, and a user can duplicate his account to create a new one getting immediately the same properties. / On peut être identifié grâce à un simple URL, et on peut dupliquer son compte pour créer un nouveau compte ayant immédiatement les mêmes propriétés. 
    7 Plugin URI: (Doesn't exist for the moment) 
     7Plugin URI: http://piwigo.org/svn/extensions/event_cats 
    88Author: P@t, LucMorizur 
    99Author URI: http://www.gauchon.fr, http://lucmorizur.free.fr 
Note: See TracChangeset for help on using the changeset viewer.