Commits

christiansalazar  committed 9c553b0

FIX ISSUE #56 (re-fixed) AND FIX ISSUE #73

  • Participants
  • Parent commits 3fa03d1

Comments (0)

Files changed (3)

File controllers/UiController.php

      *
      *    Para saber mas consulta acerca del funcionamiento de la sintaxis
      *    de la descripcion de un CAuthItem.  Info en CrugeAuthItemManager.php
-     *
+     * PARAMS VIA POST:
      * @param string $action  el nombre action del cual se adosara a la descr.
      * @param string $itemname el item cuya descripcion se alteara
      * @access public
      * @return void
      */
-    public function actionAjaxRbacItemDescr($action, $itemname)
+    public function actionAjaxRbacItemDescr()
     {
-
+		$action = $_POST['action']; 
+		$itemname = $_POST['itemname'];
         $item = Yii::app()->user->rbac->getAuthItem($itemname);
-
         Yii::app()->user->rbac->setTaskAction($item, $action);
-
         header("Content-type: application/json");
         echo CJSON::encode(array('description' => $item->getDescription()));
     }

File views/ui/_listauthitems.php

 	$('#list-auth-items select').each(function(){
 		$(this).change(function(){
 			var action = $(this).val();
-			var parent = $(this).attr('alt');
+			var itemname = $(this).attr('alt');
 			if(action != ''){
 				// hace la actualizacion via ajax y actualiza la descripcion
 				// del item
 				var url = '<?php echo $url_updater; ?>';
-				var dateObject = new Date();
-				var nocache = '&nocache='+dateObject.getTime();
-				url += '&action='+action;
-				url += '&itemname='+parent;
-				url += nocache;
 				var descrSpan = $(this).parent().parent().find('span.description');
 				descrSpan.html("<?php echo $loading;?>");
-				$.getJSON(url, function(data) {
-					// actualiza la descripcion segun la respuesta del ajax
-					
-					descrSpan.html(data['description']);
-				}).error(function(x){
-					descrSpan.html('error: '+x.responseText);
+				$.ajax({ url: url, cache: false, dataType: 'json', type: 'post', 
+					data: { action: action, itemname: itemname },
+					success: function(data){ descrSpan.html(data['description']); },
+					error: function(e){ descrSpan.html(
+						'error: '+e.responseText); }
 				});
 			}
 		});

File views/ui/rbaclistops.php

 
 <?php 
 	echo CrugeTranslator::t("Filtrar por Controlador:");
-
-	$list = array();
-	$list[0] = '-ver todo-';
-	$list[1] = '-Otras-';
-	$list[2] = '-Cruge-';
-	$list[3] = '-Controladoras-';
+	$ar = array(
+		'0'=>CrugeTranslator::t('Ver Todo'),
+		'1'=>CrugeTranslator::t('Otras'),
+		'2'=>CrugeTranslator::t('Cruge'),
+		//'3'=>CrugeTranslator::t('Controladoras'),
+	);
 	foreach(Yii::app()->user->rbac->enumControllers() as $c)
-		$list[$c] = $c;
-	$curFilter = isset($_GET['filter']) ? $_GET['filter'] : '';
-	echo "&nbsp;&nbsp;".CHtml::dropDownList("controllers",$curFilter
-			,$list);
-
-	$url = CHtml::normalizeUrl(array('/cruge/ui/rbaclistops'));
-	Yii::app()->clientScript->registerScript('filtrocruge', 
-	"
-		function _CrugeFilterChange() {
-			var filter = $('#controllers').val();
-			var flag=0;
-			document.location.href = '{$url}&filter='+filter+'&menuonly='+flag;
-		}
-		$('#controllers').change(_CrugeFilterChange);
-	");
+		$ar[$c] = $c;
+	// build list
+	echo "<ul class='cruge_filters'>";
+	foreach($ar as $filter=>$text)
+		echo "<li>".CHtml::link($text, array('/cruge/ui/rbaclistops',
+			'filter'=>$filter))."</li>";
+	echo "</ul>";
 ?>
 
 <?php $this->renderPartial('_listauthitems'