Author: david
Date: Fri Aug 26 18:11:51 2011
New Revision: 9618

Log:
Incomplete work on dialog to update upload limit

Added:
   trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php
   trunk/apps/qubit/modules/repository/templates/_uploadLimit.php

Added: 
trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/repository/actions/uploadLimitComponent.class.php  
Fri Aug 26 18:11:51 2011        (r9618)
@@ -0,0 +1,62 @@
+<?php
+
+/*
+ * This file is part of Qubit Toolkit.
+ *
+ * Qubit Toolkit is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Qubit Toolkit is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Qubit Toolkit.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+class RepositoryUploadLimitComponent extends sfComponent
+{
+  // Arrays not allowed in class constants
+  $NAMES = array(
+    'type',
+    'limit'
+  );
+
+  protected function addFields()
+  {
+    // Define 'limit' text field
+    $this->form->setValidator($name, new sfValidatorNumber(
+      array('required' => false, 'min' => 0),
+      array('min' => 'value must be greater than %min%')
+    );
+
+    $this->form->setWidget($name, new sfWidgetFormInputText);
+
+    // Define 'type' radio
+    $choices = array(
+      'disabled' => __('Disable uploads for this %1%', array('%1%' => 
sfConfig::get('app_ui_label_repository'))),
+      'limited' => __('Set the upload limit to: 
'.$this->form->limit->render()),
+      'unlimited' => __('Unlimited uploads', array('%1%' => 
sfConfig::get('app_ui_label_repository'))));
+
+    $this->form->setValidator($name, new sfValidatorChoice(array('choices' => 
array_keys($choices))));
+    $this->form->setWidget($name, new sfWidgetFormChoice(array(
+      'choices' => $choices)
+      'expanded' => true
+    ));
+  }
+
+  public function processForm()
+  {
+
+  }
+
+  public function execute($request)
+  {
+    parent::execute($request);
+
+    $this->form->getWidgetSchema()->setNameFormat('uploadLimit[%s]');
+  }
+}

Added: trunk/apps/qubit/modules/repository/templates/_uploadLimit.php
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ trunk/apps/qubit/modules/repository/templates/_uploadLimit.php      Fri Aug 
26 18:11:51 2011        (r9618)
@@ -0,0 +1,21 @@
+<?php 
$sf_response->addStylesheet('/vendor/yui/container/assets/skins/sam/container', 
'first') ?>
+<?php $sf_response->addJavaScript('/vendor/yui/datasource/datasource-min') ?>
+<?php $sf_response->addJavaScript('/vendor/yui/container/container-min') ?>
+<?php $sf_response->addJavaScript('dialog') ?>
+
+<?php use_helper('Javascript') ?>
+
+<!-- NOTE dialog.js wraps this *entire* table in a YUI dialog -->
+<div class="section" id="uploadLimit">
+
+  <h3><?php echo __('Change disk upload quota') ?></h3>
+
+  <div>
+
+    <?php echo $form->type
+      ->label(__('Upload quota'))
+      ->renderRow() ?>
+
+  </div>
+
+</div>

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to