Ignore:
Timestamp:
Oct 7, 2009, 9:31:04 AM (15 years ago)
Author:
LucMorizur
Message:

[Event Cats] Form submit beginning, "forced problem" improvement

Location:
extensions/event_cats/admin
Files:
3 edited

Legend:

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

    r3970 r3985  
    1010var ec_selected_action = '';
    1111var ec_selected_img = '';
    12 var ec_auto_code_digits_nb = '8';
     12var ec_auto_code_digits_default =
     13 document.getElementById('ec_in_up_auto_code_length_id').value;
     14var ec_auto_code_digits_nb = ec_auto_code_digits_default;
    1315var ec_new_code_text = '';
    1416var ec_new_user_text = '';
     
    265267}
    266268
    267 function ec_check_dis(ec_id) {
     269function ec_check_d(ec_id, ec_act) {
    268270  ec_mark_line(ec_id);
    269   return confirm(ec_JS_message['ec_confirm_disable']);
    270 }
    271 
    272 function ec_check_del(ec_id) {
    273   ec_mark_line(ec_id);
    274   return confirm(ec_JS_message['ec_confirm_delete']);
     271  if (confirm(ec_JS_message['ec_confirm_' + ec_act])) {
     272    document.getElementById('ec_act1_id').value = ec_act;
     273    document.forms['ec_up_code'].submit();
     274    /* return true;
     275  }
     276  else {
     277    return false; */
     278  }
    275279}
    276280
     
    285289
    286290function ec_init() {
     291  ec_err = '';
     292  ec_checked_line = 0;
     293  ec_selected_user = 'ec_sel_user_old';
     294  ec_selected_old_user = '-1';
     295  ec_selected_AP = '-1';
     296  ec_selected_cat = '-1';
     297  ec_selected_action = '';
     298  ec_selected_img = '';
     299  ec_new_code_text = '';
     300  ec_new_user_text = '';
     301  ec_new_psd_text = '';
     302  ec_old_new_psd_text = '';
     303  ec_test_reg = '';
     304  document.getElementById('ec_act1_id').value = '';
     305  document.getElementById('ec_in_up_pwd_warn').innerHTML = '';
    287306  ec_mark_line(0);
    288307}
  • extensions/event_cats/admin/evntcats_admin.php

    r3971 r3985  
    209209  $arg2     = $ec_entry['arg2'];
    210210  $arg2_int = intval($arg2);
    211   $log_OK   = (strpos($ec_entry['action'], 'ec_ok') !== false);
     211  $log_OK   = is_in($ec_entry['action'], 'ec_ok');
    212212 
    213213  // No specific need for "code" displaying
     
    222222  switch ($ec_entry['action']) {
    223223   
    224     case 'ec_ok_forced_pb' :
    225       $page['errors'][$ec_entry['code']] = l10n('ec_forced_pb');
     224    case 'ec_ok_f_pb' :
     225    case 'ec_ok_f_pb_img_pb' :
     226      $page['errors'][$ec_entry['code']] =
     227       $ec_entry['code'].' : '.l10n('ec_forced_pb');
    226228    case 'ec_ok' :
    227229    case 'ec_ok_img_pb' :
     
    243245           l10n('ec_dspl_ok_cat_end')
    244246          ;
    245           if ($ec_entry['action'] == 'ec_ok_img_pb') {
     247          if (is_in($ec_entry['action'], '_img_pb')) {
    246248            $url_end.= '&img='.$arg2;
    247             $page['errors'][] = l10n('ec_image_miss');
     249            $page['errors'][] =
     250             $ec_entry['code'].' : '.l10n('ec_image_miss');
    248251            $dspl.=
    249252             '<br>'.$span_err_pre.
     
    307310    break;
    308311   
     312    case 'ec_ok_f_pb_ap_pb' :
     313      $page['errors'][$ec_entry['code']] =
     314       $ec_entry['code'].' : '.l10n('ec_forced_pb');
    309315    case 'ec_nok_ap_pb' : // No need to check here if Additional Pages is
    310316    case 'ec_ok_ap_pb' :  // active : we can arrive here only when it is.
    311       $page['errors'][] = l10n('ec_add_page_miss');
    312       if ($ec_entry['action'] == 'ec_ok_ap_pb') {
     317      $page['errors'][] =
     318       $ec_entry['code'].' : '.l10n('ec_add_page_miss');
     319      if (is_in($ec_entry['action'], 'ec_ok')) {
    313320        $url_end = '&ap='.$arg2;
    314321        $dspl = l10n('ec_dspl_ok_home');
     
    326333    break;
    327334   
     335    case 'ec_ok_f_pb_cat_pb' :
     336      $page['errors'][$ec_entry['code']] =
     337       $ec_entry['code'].' : '.l10n('ec_forced_pb');
    328338    case 'ec_ok_cat_pb' :
    329339      $url_end = '&cat='.$arg1;
    330       $page['errors'][] = l10n('ec_category_miss');
     340      $page['errors'][] =
     341       $ec_entry['code'].' : '.l10n('ec_category_miss');
    331342      $dspl =
    332343       l10n('ec_dspl_nok_home').
     
    340351   
    341352    case 'ec_nok_action_pb' :
    342       $page['errors'][$ec_entry['code']] = l10n('ec_action_pb');
     353      $page['errors'][$ec_entry['code']] =
     354       $ec_entry['code'].' : '.l10n('ec_action_pb');
    343355      $username =
    344356       $span_err_pre.
     
    350362   
    351363    case 'ec_nok_userid_pb' :
    352       $page['errors'][$ec_entry['code']] = l10n('ec_username_pb');
     364      $page['errors'][$ec_entry['code']] =
     365       $ec_entry['code'].' : '.l10n('ec_username_pb');
    353366      $username =
    354367       $span_err_pre.
     
    360373   
    361374    case 'ec_nok_userid_miss' :
    362       $page['errors'][$ec_entry['code']] = l10n('ec_username_miss');
     375      $page['errors'][$ec_entry['code']] =
     376       $ec_entry['code'].' : '.l10n('ec_username_miss');
    363377      $username =
    364378       $span_err_pre.
     
    382396  $code_list[$i] = array(
    383397   'id'       => $i,
    384    'Code'     => $ec_entry['code'],
     398   'Code'     => (isset($page['errors'][$ec_entry['code']])) ?
     399    $span_err_pre.$ec_entry['code'].$span_err_end : $ec_entry['code'],
    385400   'Username' => $username,
    386    'Action'   => $ec_entry['action'],
     401   'Action'   => (is_in($ec_entry['action'], 'ec_nok_')) ?
     402    $span_err_pre.$ec_entry['action'].$span_err_end : $ec_entry['action'],
    387403   'Arg1'     => $dspl,
    388404   'Forced'   => $ec_entry['forced'],
    389405   'code_URL' => $code_URL,
    390406   'log_OK'   => $log_OK,
     407   'f_pb'     => is_in($ec_entry['action'], '_f_pb'),
    391408  );
    392409}
     
    407424$template->assign('RACINE_URL',ROOT_URL);
    408425
    409 // $template->assign('test0tpl',str_from_var($ec_lists['ec_codes']));
     426$template->assign('GET',str_from_var($_GET));
     427$template->assign('POST',str_from_var($_POST));
    410428$template->assign('test1tpl',str_from_var($ec_lists));
    411429$template->assign('test2tpl',str_from_var($page['errors']));
    412430$template->assign('test3tpl',str_from_var($code_list));
    413431
    414 /* C'est quoi, ça ?...
    415 if ( isset($_POST['submit']) )
    416   {
    417     if (isset($_POST['account']) and isset($_POST['code']))
    418       {
    419         $conf['auto_log'][$_POST['code']] = $_POST['account'];
    420       }
    421     else
    422       {
    423         $page['errors']='arg_missing';
    424       }
    425 
    426     if (isset($_POST['duplication']))
    427       {
    428         $conf['allow_user_registration'] = ($_POST['duplication'] == '1');
    429       }
    430   }
    431 */
    432 
    433432$template->set_filenames(array('evntcats_admin_content' => dirname(__FILE__).'/evntcats_admin.tpl'));
    434433$template->assign_var_from_handle('ADMIN_CONTENT','evntcats_admin_content');
  • extensions/event_cats/admin/evntcats_admin.tpl

    r3970 r3985  
    11{* <!-- Event Cats (event categories) LucMorizur June - ... 2009 --> *}
    2 
    3 {* <!-- Tabs for admin page surfing --> *} {*
    4 <ul class = "tabsheet">
    5   <li class = "selected_tab">
    6     <a href = "??...">
    7       <span>{'ec_tab_autoid'|@translate}</span>
    8     </a>
    9   </li>
    10   <li class = "normal_tab">
    11     <a href = "??...">
    12       <span>{'ec_tab_config'|@translate}</span>
    13     </a>
    14   </li>
    15 </ul> *}
    16 
    17 {* <!-- Help button --> *} {*
    18 <ul class = "HelpActions">
    19   <li>
    20     <a href = "aide" onclick = "popuphelp(this.href); return false;" title = "{'ec_help'|@translate}" style = "margin-top: -28px;" >
    21       <img src = "{$ROOT_URL}{$themeconf.admin_icon_dir}/help.png" class = "button" alt = "(?)" />
    22     </a>
    23   </li>
    24 </ul> *}
    252
    263{* <!-- Page title --> *}
     
    3714</script>
    3815
    39 {* <!-- Upper banner : infos, errors... --> *}
     16{* <!-- EC Presentation --> *}
    4017{if $ec_howto}
    4118  <div>
     
    4825</p>
    4926
     27{* <!-- Whether plugin Additionnal Pages is active or not --> *}
     28<div style = "text-align:right; font-style:italic;">
     29  {if $ec_ap_ok}
     30    {'ec_plugin_ap_ok'|@translate}
     31    <script type = "text/javascript"><!--
     32      var ec_ap_ok = true; //-->
     33    </script>
     34  {else}
     35    {'ec_plugin_ap_nok'|@translate}
     36    <script type = "text/javascript"><!--
     37      var ec_ap_ok = false; //-->
     38    </script>
     39  {/if}
     40</div>
     41
    5042{* <!-- First section : form to view and modify codes, or create a new one --> *}
    5143<form class = "filter" method = "post" name = "ec_up_code" action = "">
    52  
    53   <div style = "text-align:right; font-style:italic;">
    54     {if $ec_ap_ok}
    55       {'ec_plugin_ap_ok'|@translate}
    56       <script type = "text/javascript"><!--
    57         var ec_ap_ok = true; //-->
    58       </script>
    59     {else}
    60       {'ec_plugin_ap_nok'|@translate}
    61       <script type = "text/javascript"><!--
    62         var ec_ap_ok = false; //-->
    63       </script>
    64     {/if}
    65   </div>
     44  <input type = "hidden" id = "ec_act1_id" name = "ec_act1" />
    6645 
    6746  <div style = "text-align:center; font-weight:bold; font-size:120%;">{'ec_entry_table_title'|@translate}</div><br>
     
    10079          </a>
    10180          &nbsp;
    102           <a href = "javascript:void()" onclick = "return ec_check_del({$code_line.id});">
    103      {* envoi formulaire par JS : document.forms[nom_formulaire].submit() ( http://www.toutjavascript.com/reference/reference.php?iref=178 ) *}
    104             <img src = "{$EVNTCATS_URLS.ROOT}icon/delete.png" class = "button" style = "border:none"
     81          <a href = "javascript:void();" onclick = "ec_check_d({$code_line.id}, 'delete');">
     82            <img src = "{$EVNTCATS_URLS.ROOT}icon/delete.png" class = "button"
    10583             alt = "{'ec_url_delete'|@translate}" title = "{'ec_url_delete'|@translate}" />
    10684          </a>
    10785          {if $code_line.log_OK}
    10886            &nbsp;
    109             <a href = "javascript:void()" onclick = "return ec_check_dis({$code_line.id});">
    110               <img src = "{$EVNTCATS_URLS.ROOT}icon/disable.png" class = "button" style = "border:none"
     87            <a href = "javascript:void();" onclick = "ec_check_d({$code_line.id}, 'disable');">
     88              <img src = "{$EVNTCATS_URLS.ROOT}icon/disable.png" class = "button"
    11189               alt = "{'ec_url_disable'|@translate}" title = "{'ec_url_disable'|@translate}" />
    11290            </a>
     
    11492              &nbsp;
    11593              <a href = "javascript:void()" title = "{'ec_toggle_forced'|@translate}" onclick = "return ec_toggle_forced({$code_line.id});">
    116                 <img class = "button" style = "border:none" src = "{$EVNTCATS_URLS.ROOT}icon/forced.png"
    117                  alt = "{'ec_url_forced'|@translate}" title = "{'ec_url_forced'|@translate}"/>
     94                <img class = "button" src = "{$EVNTCATS_URLS.ROOT}icon/forced.png"
     95                 {if $code_line.f_pb} style = "border:solid medium red;" {/if}
     96                 alt = "{'ec_url_forced'|@translate}" title = "{'ec_url_forced'|@translate}"
     97                />
    11898              </a>
    11999            {else}
    120100              &nbsp;
    121101              <a href = "javascript:void()" title = "{'ec_toggle_forced'|@translate}" onclick = "return ec_toggle_forced({$code_line.id});">
    122                 <img class = "button" style = "border:none" src = "{$EVNTCATS_URLS.ROOT}icon/nforced.png"
     102                <img class = "button" src = "{$EVNTCATS_URLS.ROOT}icon/nforced.png"
    123103                 alt = "{'ec_url_nforced'|@translate}" title = "{'ec_url_nforced'|@translate}"/>
    124104              </a>
    125               &nbsp;
    126               <a href = "javascript:void()" title = "{'ec_duplicate_entry'|@translate}" onclick = "return ec_duplicate_entry({$code_line.id});">
    127                 <img src = "{$EVNTCATS_URLS.ROOT}icon/duplicate.png" class = "button" style = "border:none"
    128                  alt = "{'ec_url_duplicate'|@translate}" title = "{'ec_url_duplicate'|@translate}" />
    129               </a>
     105              {if !$code_line.f_pb}
     106                &nbsp;
     107                <a href = "javascript:void()" title = "{'ec_duplicate_entry'|@translate}" onclick = "return ec_duplicate_entry({$code_line.id});">
     108                  <img src = "{$EVNTCATS_URLS.ROOT}icon/duplicate.png" class = "button" style = "border:none"
     109                   alt = "{'ec_url_duplicate'|@translate}" title = "{'ec_url_duplicate'|@translate}" />
     110                </a>
     111              {/if}
    130112            {/if}
    131113          {/if}
     
    319301    </tr>
    320302  </table>
     303  <p>
     304    <input class = "submit" type = "submit" name = "ec_submit" value = "{'Submit'|@translate}"/>
     305    <input class = "submit" type = "reset" name = "ec_reset" value = "{'Reset'|@translate}" onclick = "ec_init();"/>
     306  </p>
    321307</form>
    322308
     
    333319  {/foreach}
    334320 
    335   ec_JS_message['ec_confirm_disable'] = "{'ec_confirm_disable'|@translate|@escape:javascript}";
    336   ec_JS_message['ec_confirm_delete'] = "{'ec_confirm_delete'|@translate|@escape:javascript}";
    337   ec_JS_message['ec_confirm_test'] = "{'ec_confirm_test'|@translate|@escape:javascript}";
     321  ec_JS_message['ec_confirm_disable']   = "{'ec_confirm_disable'|@translate|@escape:javascript}";
     322  ec_JS_message['ec_confirm_delete']    = "{'ec_confirm_delete'|@translate|@escape:javascript}";
     323  ec_JS_message['ec_confirm_test']      = "{'ec_confirm_test'|@translate|@escape:javascript}";
    338324  ec_JS_message['ec_gen_user_act_miss'] = "{'ec_gen_user_act_miss'|@translate|@escape:javascript}";
    339   ec_JS_message['ec_act_cat_miss'] = "{'ec_act_cat_miss'|@translate|@escape:javascript}";
    340   ec_JS_message['ec_new_pwd_gen'] = "{'ec_new_pwd_gen'|@translate|@escape:javascript}";
     325  ec_JS_message['ec_act_cat_miss']      = "{'ec_act_cat_miss'|@translate|@escape:javascript}";
     326  ec_JS_message['ec_new_pwd_gen']       = "{'ec_new_pwd_gen'|@translate|@escape:javascript}";
    341327 
    342328  ec_init();
     
    354340
    355341{* <!-- {$test0tpl} --> *}
     342<p>$_GET :</p>
     343{$GET}
     344<p>$_POST :</p>
     345{$POST}
     346<p>Autres :</p>
    356347{$test1tpl}
    357348{$test2tpl}
Note: See TracChangeset for help on using the changeset viewer.