Changeset 1704137
- Timestamp:
- 07/28/2017 02:07:32 AM (8 years ago)
- Location:
- simple-schedule-notice/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
simple-schedule-notice/trunk/class-genfset.php
r1699507 r1704137 17 17 18 18 private $legend, $fields, $fldsiz, $seq, $stat; 19 private $tagstack, $tagcnt, $gerrcnt, $classdef ;19 private $tagstack, $tagcnt, $gerrcnt, $classdef, $browsername; 20 20 21 21 function __construct( $siz = 80, $classdef = array() ) { … … 25 25 // ul ... class applied to <ul> 26 26 //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; 32 33 } 33 34 … … 53 54 function input( $nam, $val = null, $uop = null ) { 54 55 //$uop ... 55 //'ex'=>extended options of <input> in array( 'key'=>'value', ...) format.56 56 //'im'=>input mode kana, email, etc. (may not work on many browsers) 57 57 //'rj'=>justified right False or True … … 63 63 $opt = array_merge( array('ty' => 'text', 'sz' => $this->fldsiz ), $uop ); 64 64 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>'; 66 81 } else { 67 82 $genstr = '<input type="' . $opt[ 'ty' ] . '" name="' . $nam . '"'; 68 83 $stylestr = ''; 69 foreach ( $opt as $ key => $opval ) {70 switch ( $ key ) {84 foreach ( $opt as $opkey => $opval ) { 85 switch ( $opkey ) { 71 86 case 'ty': 72 break;73 case 'ex':74 foreach ( $opval as $exkey => $exval ) {75 $genstr .= ' ' . $exkey . '="' . $exval . '"';76 }77 87 break; 78 88 case 'im': 79 89 $genstr .= ' inputmode="' . $opval . '"'; 80 ;81 90 break; 82 91 case 'ph': … … 101 110 } 102 111 break; 103 case '':104 break;105 112 default: 113 $genstr .= ' ' . $opkey . '="' . $opval . '"'; 106 114 break; 107 115 } … … 215 223 if ( !empty( $msg ) ) { 216 224 $str = 217 '<div' . 218 ( array_key_exists( $cat, $this->classdef ) ? ' class="' . $this->classdef[$cat] . '"' : '' ) . 219 '>' . 225 '<div' . $this->get_classstr( $cat ) . '>' . 220 226 $this->get_liststr( $msg ) . 221 227 '</div>'; … … 226 232 function close() { 227 233 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">'; 229 235 echo '<legend>' . $this->legend . '</legend>'; 230 236 } … … 258 264 } 259 265 } else { 260 foreach ( $param as $key => $value ) { //ass iatedarray266 foreach ( $param as $key => $value ) { //associative array 261 267 $str .= $key . '=' . $this->Capsul( $this->unstruct( $value ), '"' ); 262 268 } … … 316 322 } 317 323 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 } 318 342 319 343 } -
simple-schedule-notice/trunk/readme.txt
r1699248 r1704137 45 45 == Changelog == 46 46 47 = 1.0.1 = 48 * Fixed the problem that the width of "textarea" is too small on MSIE and Edge. 49 47 50 = 1.0 = 48 51 * Initial release. -
simple-schedule-notice/trunk/simple-schedule-notice.css
r1699248 r1704137 7 7 margin-bottom: 1.5em; 8 8 } 9 10 article#shdntc-general h2, h3 { 11 margin-bottom: 0.5em; 12 } 13 9 14 article#shdntc-detail h1 { 10 15 margin-bottom: 1.5em; 11 16 } 12 17 13 article#shdntc-general h2, h3 {14 margin-bottom: 0.5em;15 }16 18 article#shdntc-detail h2, h3 { 17 19 margin-bottom: 0.5em; … … 64 66 color: red; 65 67 } 66 67 /* color of placeholder */68 input[type=text]::-webkit-input-placeholder,69 input[type=text]::-webkit-input-placeholder { //Chrome70 color: olive;71 } -
simple-schedule-notice/trunk/simple-schedule-notice.js
r1699248 r1704137 27 27 fObj = document.getElementById("form_dtl"); 28 28 if ( fObj != null ) { 29 console.log(fObj.id);30 29 Chk = checked( fObj, "cycle", 4 ); 31 30 elem = fObj["YR"]; elem.disabled = (0 < Chk); bcolor( elem ); 32 31 elem = fObj["MO"]; elem.disabled = (1 < Chk); bcolor( elem ); 33 32 elem = fObj["DA"]; elem.disabled = (2 < Chk); bcolor( elem ); 34 } else {35 console.log("form_dtl not found.");36 33 } 37 34 } -
simple-schedule-notice/trunk/simple-schedule-notice.php
r1699541 r1704137 8 8 Text Domain: smpl_shcd_notice 9 9 Domain Path: /languages 10 Version: 1.0 10 Version: 1.0.1 11 11 */ 12 12 include_once 'definitions.php';
Note: See TracChangeset
for help on using the changeset viewer.