OSDN Git Service

保存画像サイズの設定変更画面作成
authorCake <cake_67@users.sourceforge.jp>
Wed, 10 Feb 2010 15:39:30 +0000 (00:39 +0900)
committerCake <cake_67@users.sourceforge.jp>
Wed, 10 Feb 2010 15:39:30 +0000 (00:39 +0900)
app/controllers/site_configs_controller.php
app/models/site_config.php
app/views/site_configs/admin_edit.ctp
app/webroot/css/base.css

index 7f50c54..e2a57a0 100644 (file)
@@ -34,6 +34,18 @@ class SiteConfigsController extends AppController {
                                        $this->SiteConfig->create();
                                        $fields = $this->SiteConfig->fields['add'];
                                }
+
+                               if (
+                                       $k == 'Upload.imagefile.FileSizeMax' || 
+                                       $k == 'Upload.imagefile.WidthMax' || 
+                                       $k == 'Upload.imagefile.HeightMax'
+                               ) {
+                                       $v['value'] = intval($v['value']);
+                                       if ($v['value'] < 0) {
+                                               $v['value'] = NULL;
+                                       }
+                               }
+
                                $data['SiteConfig'] = $v;
 
                                if (!$this->SiteConfig->save($data, true, $fields)) {
index 1cf378a..83ca3f6 100644 (file)
@@ -8,6 +8,19 @@ class SiteConfig extends AppModel {
                        'id' => null,
                        'value' => 'Chara-Shee!'
                ),
+
+               'Upload.imagefile.FileSizeMax' => array(
+                       'id' => null,
+                       'value' => '500'
+               ),
+               'Upload.imagefile.WidthMax' => array(
+                       'id' => null,
+                       'value' => '780'
+               ),
+               'Upload.imagefile.HeightMax' => array(
+                       'id' => null,
+                       'value' => '600'
+               ),
        );
 
 
index 69265ec..fb9503f 100644 (file)
@@ -8,8 +8,7 @@
 <fieldset>
 <legend><?php __('Edit Site Config');?></legend>
 
-<table cellpadding="0" cellspacing="0">
-
+<table>
 <tr>
 <th><?php echo __('Site Name') ?></th>
 <td id="Site_siteName">
        echo $form->end('Submit');
 ?>
 </p>
+</div>
+
+
+<div class="upload">
+<p>
+<?php echo $form->create('SiteConfig', array('url' => array(
+       'controller' => 'site_configs',
+       'action' => 'admin_edit',
+)));?>
+<fieldset>
+<legend><?php __('Edit File Upload Config');?></legend>
+
+<table>
+<tr>
+<th><?php echo __('Upload Imagefile FileSize Max') ?></th>
+<td class="sizeInput" id="Upload_imagefileFileSizeMax">
+<input name="data[SiteConfig][Upload.imagefile.FileSizeMax][value]" type="text" value="<?php echo $this->data['SiteConfig']['Upload.imagefile.FileSizeMax']['value'];?>"> <?php __('kByte') ?>
+<input name="data[SiteConfig][Upload.imagefile.FileSizeMax][id]" type="hidden" value="<?php echo $this->data['SiteConfig']['Upload.imagefile.FileSizeMax']['id'];?>"><br>
+<?php echo $html->div('caption', __('Zero or NULL means NO LIMIT.', true)); ?>
+</td>
+</tr>
+<tr>
+<th><?php echo __('Upload Imagefile Width Max') ?></th>
+<td class="sizeInput" id="Upload_imagefileWidthMax">
+<input name="data[SiteConfig][Upload.imagefile.WidthMax][value]" type="text" value="<?php echo $this->data['SiteConfig']['Upload.imagefile.WidthMax']['value'];?>"> <?php __('px') ?>
+<input name="data[SiteConfig][Upload.imagefile.WidthMax][id]" type="hidden" value="<?php echo $this->data['SiteConfig']['Upload.imagefile.WidthMax']['id'];?>"><br>
+<?php echo $html->div('caption', __('Zero or NULL means NO LIMIT.', true)); ?>
+</td>
+</tr>
+<tr>
+<th><?php echo __('Upload Imagefile Height Max') ?></th>
+<td class="sizeInput" id="Upload_imagefileHeightMax">
+<input name="data[SiteConfig][Upload.imagefile.HeightMax][value]" type="text" value="<?php echo $this->data['SiteConfig']['Upload.imagefile.HeightMax']['value'];?>"> <?php __('px') ?>
+<input name="data[SiteConfig][Upload.imagefile.HeightMax][id]" type="hidden" value="<?php echo $this->data['SiteConfig']['Upload.imagefile.HeightMax']['id'];?>"><br>
+<?php echo $html->div('caption', __('Zero or NULL means NO LIMIT.', true)); ?>
+</td>
+</tr>
+
+</table>
+</fieldset>
+<?php
+       echo $token->create();
+       echo $form->end('Submit');
+?>
+</p>
+</div>
+
+
+</div>
 
 </div>
+
index 4b1f6c5..94da4d2 100644 (file)
@@ -628,5 +628,10 @@ div.siteConfigs table th
 }
 div.siteConfigs table td input[type=text]
 {
-       width:98%;
+       width: 98%;
 }
+div.siteConfigs table td.sizeInput input[type=text]
+{
+       width: 48px;
+}
+