Plugin Directory

Changeset 1704137


Ignore:
Timestamp:
07/28/2017 02:07:32 AM (8 years ago)
Author:
ekamiya
Message:

Initial Release δ(minor fix to meet old PHP syntax).

Location:
simple-schedule-notice/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • simple-schedule-notice/trunk/class-genfset.php

    r1699507 r1704137  
    1717
    1818  private $legend, $fields, $fldsiz, $seq, $stat;
    19   private $tagstack, $tagcnt, $gerrcnt, $classdef;
     19  private $tagstack, $tagcnt, $gerrcnt, $classdef, $browsername;
    2020
    2121  function __construct( $siz = 80, $classdef = array() ) {
     
    2525    //     ul       ... class applied to <ul>
    2626    //mb_internal_encoding("UTF-8");
    27     $this->fldsiz   = $siz;
    28     $this->tagstack = array();
    29     $this->tagcnt   = 0;
    30     $this->stat     = False;
    31     $this->classdef = $classdef;
     27    $this->fldsiz      = $siz;
     28    $this->tagstack    = array();
     29    $this->tagcnt      = 0;
     30    $this->stat        = False;
     31    $this->classdef    = $classdef;
     32    $this->browsername = null;
    3233  }
    3334
     
    5354  function input( $nam, $val = null, $uop = null ) {
    5455    //$uop ...
    55     //'ex'=>extended       options of <input> in array( 'key'=>'value', ...) format.
    5656    //'im'=>input mode     kana, email, etc. (may not work on many browsers)
    5757    //'rj'=>justified right False or True
     
    6363    $opt = array_merge( array('ty' => 'text', 'sz' => $this->fldsiz ), $uop );
    6464    if ( 'textarea' == $opt[ 'ty' ] ) {
    65       $genstr = '<textarea name="' . $nam . '" rows="5" cols="' . $opt[ 'sz' ] . 'em" style="resize: both">' . $val . '</textarea>';
     65      $genstr = '<textarea name="' . $nam . '" rows="8" cols="' . $opt[ 'sz' ] . '"';
     66      $stylestr = '';
     67      switch ( $this->get_browsername() ) {
     68        case 'MSIE':
     69        case 'Trident':
     70        case 'Edge':
     71          $stylestr .= $this->Con( $stylestr, ' ' ) . 'width:' . (integer)$opt[ 'sz' ]*0.6 . 'em;';
     72          break;
     73        default:
     74          $stylestr .= $this->Con( $stylestr, ' ' ) . 'resize: both;';
     75          break;
     76      }
     77      if ( !empty( $stylestr )) {
     78        $genstr .= ' style="' . $stylestr . '"';
     79      }
     80      $genstr .= '>' . $val . '</textarea>';
    6681    } else {
    6782      $genstr = '<input type="' . $opt[ 'ty' ] . '" name="' . $nam . '"';
    6883      $stylestr = '';
    69       foreach ( $opt as $key => $opval ) {
    70         switch ( $key ) {
     84      foreach ( $opt as $opkey => $opval ) {
     85        switch ( $opkey ) {
    7186          case 'ty':
    72             break;
    73           case 'ex':
    74             foreach ( $opval as $exkey => $exval ) {
    75               $genstr .= ' ' . $exkey . '="' . $exval . '"';
    76             }
    7787            break;
    7888          case 'im':
    7989            $genstr .= '  inputmode="' . $opval . '"';
    80             ;
    8190            break;
    8291          case 'ph':
     
    101110            }
    102111            break;
    103           case '':
    104             break;
    105112          default:
     113            $genstr .= ' ' . $opkey . '="' . $opval . '"';
    106114            break;
    107115        }
     
    215223    if ( !empty( $msg ) ) {
    216224      $str =
    217         '<div' .
    218         ( array_key_exists( $cat, $this->classdef ) ? ' class="' . $this->classdef[$cat] . '"' : '' ) .
    219         '>' .
     225        '<div' . $this->get_classstr( $cat ) . '>' .
    220226        $this->get_liststr( $msg ) .
    221227        '</div>';
     
    226232  function close() {
    227233    if ( !empty( $this->legend ) ) {
    228       echo '<fieldset' . ( array_key_exists( 'fieldset', $this->classdef) ? ' class="' . $this->classdef[ 'fieldset' ] . '"' : '' ) . '" data-role="controlgroup">';
     234      echo '<fieldset' . $this->get_classstr( 'fieldset' ) . '" data-role="controlgroup">';
    229235      echo '<legend>' . $this->legend . '</legend>';
    230236    }
     
    258264        }
    259265      } else {
    260         foreach ( $param as $key => $value ) {      //assiated array
     266        foreach ( $param as $key => $value ) {      //associative array
    261267          $str .= $key . '=' . $this->Capsul( $this->unstruct( $value ), '"' );
    262268        }
     
    316322  }
    317323
     324  private function get_classstr( $key ) {
     325    return ( array_key_exists( $key, $this->classdef) ? ' class="' . $this->classdef[ $key ] . '"' : '' );
     326  }
     327
     328  private function get_browsername() {
     329    if ( empty( $this->browsername )) {
     330      $browserlist = [ 'Edge', 'MSIE', 'Trident', 'Chrome' ];  //順序に注意
     331      $this->browsername = 'unknown';
     332      foreach ( $browserlist as $key ) {
     333        $pos = strpos ( $_SERVER['HTTP_USER_AGENT'], $key );
     334        if ( ! ( False===$pos )) {
     335          $this->browsername = $key;
     336          break;
     337        }
     338      }
     339    }
     340    return $this->browsername;
     341  }
    318342
    319343}
  • simple-schedule-notice/trunk/readme.txt

    r1699248 r1704137  
    4545== Changelog ==
    4646
     47= 1.0.1 =
     48* Fixed the problem that the width of "textarea" is too small on MSIE and Edge.
     49
    4750= 1.0 =
    4851* Initial release.
  • simple-schedule-notice/trunk/simple-schedule-notice.css

    r1699248 r1704137  
    77  margin-bottom: 1.5em;
    88}
     9
     10article#shdntc-general h2, h3 {
     11  margin-bottom: 0.5em;
     12}
     13
    914article#shdntc-detail h1 {
    1015  margin-bottom: 1.5em;
    1116}
    1217
    13 article#shdntc-general h2, h3 {
    14   margin-bottom: 0.5em;
    15 }
    1618article#shdntc-detail h2, h3 {
    1719  margin-bottom: 0.5em;
     
    6466  color: red;
    6567}
    66 
    67 /* color of placeholder */
    68 input[type=text]::-webkit-input-placeholder,
    69 input[type=text]::-webkit-input-placeholder {  //Chrome
    70   color: olive;
    71 }
  • simple-schedule-notice/trunk/simple-schedule-notice.js

    r1699248 r1704137  
    2727  fObj = document.getElementById("form_dtl");
    2828  if ( fObj != null ) {
    29     console.log(fObj.id);
    3029    Chk = checked( fObj, "cycle", 4 );
    3130    elem = fObj["YR"];    elem.disabled = (0 < Chk);   bcolor( elem );
    3231    elem = fObj["MO"];    elem.disabled = (1 < Chk);   bcolor( elem );
    3332    elem = fObj["DA"];    elem.disabled = (2 < Chk);   bcolor( elem );
    34   } else {
    35     console.log("form_dtl not found.");
    3633  }
    3734}
  • simple-schedule-notice/trunk/simple-schedule-notice.php

    r1699541 r1704137  
    88  Text Domain: smpl_shcd_notice
    99  Domain Path: /languages
    10   Version: 1.0
     10  Version: 1.0.1
    1111 */
    1212include_once 'definitions.php';
Note: See TracChangeset for help on using the changeset viewer.