@@ -370,11 +370,12 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName,
370370 $ ucfFieldName = $ tf ->getCamelCase ($ fieldName , true );
371371 $ ccFieldName = $ tf ->getCamelCase ($ fieldName , false , true );
372372 $ t = "\t\t" ;
373- $ ret = $ pc ->getPhpCodeCommentLine ('Form Upload ' , 'Image ' . $ ucfFieldName , $ t );
373+ $ ret = $ pc ->getPhpCodeCommentLine ('Form ' , 'Image ' . $ ucfFieldName , $ t );
374+ $ ret .= $ pc ->getPhpCodeCommentLine ("Form Image {$ ucfFieldName }: " , 'Select Uploaded Image ' , $ t );
374375 $ ret .= $ xc ->getXcEqualsOperator ('$get ' . $ ucfFieldName , "\$this->getVar(' {$ fieldName }') " , null , false , $ t );
375376 $ ret .= $ pc ->getPhpCodeTernaryOperator ($ ccFieldName , '$get ' . $ ucfFieldName , '$get ' . $ ucfFieldName , "'blank.gif' " , $ t );
376377 $ ret .= $ xc ->getXcEqualsOperator ('$imageDirectory ' , "'/uploads/ {$ moduleDirname }/images/ {$ tableName }' " , null , false , $ t );
377- $ ret .= $ cc ->getClassXoopsFormElementTray ('imageTray ' , ' _OPTIONS ' , '<br> ' , $ t );
378+ $ ret .= $ cc ->getClassXoopsFormElementTray ('imageTray ' , $ language . ' FORM_UPLOAD ' , '<br> ' , $ t );
378379 $ sprintf = $ pc ->getPhpCodeSprintf ($ language . 'FORM_IMAGE_PATH ' , '".{$imageDirectory}/" ' );
379380 $ ret .= $ cc ->getClassXoopsFormSelect ('imageSelect ' , $ sprintf , $ fieldName , $ ccFieldName , 5 , 'false ' , false , $ t );
380381 $ ret .= $ xc ->getXcXoopsImgListArray ('imageArray ' , 'XOOPS_ROOT_PATH . $imageDirectory ' , $ t );
@@ -386,14 +387,13 @@ private function getXoopsFormUploadImage($language, $moduleDirname, $tableName,
386387 $ paramLabel = "\"<br><img src=' \".XOOPS_URL. \"/ \". \$imageDirectory. \"/ \". \${$ ccFieldName }. \"' name='image1' id='image1' alt='' style='max-width:100px' /> \"" ;
387388 $ xoopsFormLabel = $ cc ->getClassXoopsFormLabel ('' , "'' " , $ paramLabel , true , '' );
388389 $ ret .= $ cc ->getClassAddElement ('imageTray ' , $ xoopsFormLabel , $ t );
389- $ ret .= $ pc ->getPhpCodeCommentLine ('Form ' , 'File ' . $ ucfFieldName , $ t );
390- $ ret .= $ cc ->getClassXoopsFormElementTray ('fileSelectTray ' , "'' " , '<br> ' , $ t );
390+ $ ret .= $ pc ->getPhpCodeCommentLine ("Form Image {$ ucfFieldName }: " , 'Upload Image ' , $ t );
391391 $ getConfig = $ xc ->getXcGetConfig ($ moduleDirname , 'maxsize ' );
392- $ xoopsFormFile = $ cc ->getClassXoopsFormFile ('' , $ language . 'FORM_UPLOAD_IMAGE_ ' . $ stuTableName , 'attachedfile ' , $ getConfig , true , '' );
393- $ ret . = $ cc ->getClassAddElement ('fileSelectTray ' , $ xoopsFormFile , $ t );
394- $ xoopsFormLabel1 = $ cc ->getClassXoopsFormLabel ('' , " '' " , null , true );
395- $ ret . = $ cc ->getClassAddElement ('fileSelectTray ' , $ xoopsFormLabel1 , $ t );
396- $ ret .= $ cc -> getClassAddElement ( ' imageTray ' , ' $fileSelectTray ' , $ t );
392+ $ xoopsFormFile = $ cc ->getClassXoopsFormFile ('imageTray ' , $ language . 'FORM_UPLOAD_NEW ' , 'attachedfile ' , $ getConfig , true , '' );
393+ $ contIf = $ cc ->getClassAddElement ('imageTray ' , $ xoopsFormFile , $ t . "\t" );
394+ $ formHidden = $ cc ->getClassXoopsFormHidden ('' , $ fieldName , $ ccFieldName , true , true , $ t , true );
395+ $ contElse = $ cc ->getClassAddElement ('imageTray ' , $ formHidden , $ t . "\t" );
396+ $ ret .= $ pc -> getPhpCodeConditions ( ' $permissionUpload ' , null , null , $ contIf , $ contElse , "\t\t" );
397397 $ ret .= $ cc ->getClassAddElement ('form ' , "\$imageTray {$ required }" , $ t );
398398
399399 return $ ret ;
@@ -418,17 +418,24 @@ private function getXoopsFormUploadFile($language, $moduleDirname, $tableName, $
418418 $ cc = Tdmcreate \Files \Classes \ClassXoopsCode::getInstance ();
419419 $ ucfFieldName = $ tf ->getCamelCase ($ fieldName , true );
420420 $ stuTableName = mb_strtoupper ($ tableName );
421- $ t = "\t\t" ;
422- $ ret = $ pc ->getPhpCodeCommentLine ('Form ' , 'File ' . $ ucfFieldName , $ t );
423- $ ret .= $ cc ->getClassXoopsFormElementTray ('fileUploadTray ' , $ language . 'FORM_UPLOAD_FILE_ ' . $ stuTableName , '<br> ' , $ t );
424- $ getVar = $ xc ->getXcGetVar ('' , 'this ' , $ fieldName , true );
425- $ xoopsFormLabel = $ cc ->getClassXoopsFormLabel ('' , "'' " , $ getVar , true );
421+ $ ccFieldName = $ tf ->getCamelCase ($ fieldName , false , true );
422+
423+ $ t = "\t\t\t" ;
424+ $ ret = $ pc ->getPhpCodeCommentLine ('Form ' , 'File ' . $ ucfFieldName , "\t\t" );
425+ $ ret .= $ pc ->getPhpCodeTernaryOperator ($ ccFieldName , '$this->isNew() ' , "'' " , "\$this->getVar(' {$ fieldName }') " , "\t\t" );
426+
427+ $ uForm = $ cc ->getClassXoopsFormElementTray ('fileUploadTray ' , $ language . 'FORM_UPLOAD ' , '<br> ' , $ t );
428+ $ xoopsFormLabel = $ cc ->getClassXoopsFormLabel ('' , $ language . 'FORM_UPLOAD_FILE_ ' . $ stuTableName , $ ccFieldName , true , "\t\t" , true );
426429 $ condIf = $ cc ->getClassAddElement ('fileUploadTray ' , $ xoopsFormLabel , $ t . "\t" );
427- $ ret .= $ pc ->getPhpCodeConditions ('!$this->isNew() ' , null , null , $ condIf , false , "\t\t" );
430+ $ uForm .= $ pc ->getPhpCodeConditions ('!$this->isNew() ' , null , null , $ condIf , false , "\t \t\t" );
428431 $ getConfig = $ xc ->getXcGetConfig ($ moduleDirname , 'maxsize ' );
429432 $ xoopsFormFile = $ cc ->getClassXoopsFormFile ('' , "'' " , $ fieldName , $ getConfig , true , '' );
430- $ ret .= $ cc ->getClassAddElement ('fileUploadTray ' , $ xoopsFormFile , $ t );
431- $ ret .= $ cc ->getClassAddElement ('form ' , '$fileUploadTray ' , $ t );
433+ $ uForm .= $ cc ->getClassAddElement ('fileUploadTray ' , $ xoopsFormFile , $ t );
434+ $ uForm .= $ cc ->getClassAddElement ('form ' , '$fileUploadTray ' , $ t );
435+ $ formHidden = $ cc ->getClassXoopsFormHidden ('' , $ fieldName , $ ccFieldName , true , true , "\t\t" , true );
436+ $ contElse = $ cc ->getClassAddElement ('form ' , $ formHidden , $ t );
437+
438+ $ ret .= $ pc ->getPhpCodeConditions ('$permissionUpload ' , null , null , $ uForm , $ contElse , "\t\t" );
432439
433440 return $ ret ;
434441 }
0 commit comments