PageRenderTime 267ms CodeModel.GetById 80ms app.highlight 89ms RepoModel.GetById 52ms app.codeStats 22ms

/lib/packages/blocks/blocks.php

https://bitbucket.org/navigatecms/navigatecms
PHP | 3299 lines | 2911 code | 358 blank | 30 comment | 174 complexity | f7ce073a2e8adaef57443d06b6789311 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

   1<?php
   2require_once(NAVIGATE_PATH.'/lib/packages/blocks/block.class.php');
   3require_once(NAVIGATE_PATH.'/lib/packages/blocks/block_group.class.php');
   4require_once(NAVIGATE_PATH.'/lib/packages/properties/property.class.php');
   5require_once(NAVIGATE_PATH.'/lib/packages/properties/property.layout.php');
   6require_once(NAVIGATE_PATH.'/lib/packages/extensions/extension.class.php');
   7require_once(NAVIGATE_PATH.'/lib/packages/webusers/webuser_group.class.php');
   8
   9function run()
  10{
  11	global $layout;
  12	global $DB;
  13	global $website;
  14	
  15	$out = '';
  16	$item = new block();
  17			
  18	switch($_REQUEST['act'])
  19	{
  20        case 'json':
  21		case 1:	// json data retrieval & operations
  22			switch($_REQUEST['oper'])
  23			{
  24				case 'del':	// remove rows
  25					$ids = $_REQUEST['ids'];
  26					foreach($ids as $id)
  27					{
  28						$item->load($id);
  29						$item->delete();
  30					}
  31					echo json_encode(true);
  32					break;
  33					
  34				default: // list or search	
  35					// translation of request search & order fields
  36					switch($_REQUEST['searchField'])
  37					{
  38						case 'id':
  39							$_REQUEST['searchField'] = 'b.id';
  40							break;
  41						case 'type':
  42							$_REQUEST['searchField'] = 'b.type';
  43							break;							
  44						case 'title':
  45							$_REQUEST['searchField'] = 'd.text';
  46							break;
  47						case 'category':
  48							$_REQUEST['searchField'] = 'b.category';						
  49							break;
  50						case 'dates':
  51							$_REQUEST['searchField'] = 'b.date_published';
  52							break;
  53						case 'enabled':
  54							$_REQUEST['searchField'] = 'b.enabled';
  55							break;
  56						case 'date_modified':
  57						default:
  58							$_REQUEST['searchField'] = 'b.date_modified';
  59					}
  60
  61					if($_REQUEST['sidx']=='dates')
  62						$_REQUEST['sidx'] = 'b.date_published';
  63				
  64					$page = intval($_REQUEST['page']);
  65					$max	= intval($_REQUEST['rows']);
  66					$offset = ($page - 1) * $max;
  67					$orderby= $_REQUEST['sidx'].' '.$_REQUEST['sord'];
  68					$where = " 1=1 ";
  69					
  70					if($_REQUEST['_search']=='true' || isset($_REQUEST['quicksearch']))
  71					{
  72						if(isset($_REQUEST['quicksearch']))
  73							$where .= $item->quicksearch($_REQUEST['quicksearch']);
  74						else if(isset($_REQUEST['filters']))
  75                        {
  76							$where .= navitable::jqgridsearch($_REQUEST['filters']);
  77                            // special case
  78                            if( strpos($where, 'title LIKE')!== false)
  79                            {
  80                                $where = substr_replace($where, 'd.text', strpos($where, 'title LIKE'), 5);
  81                            }
  82                        }
  83						else	// single search
  84							$where .= ' AND '.navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
  85					}
  86										
  87					$sql = ' SELECT SQL_CALC_FOUND_ROWS b.*, d.text as title 
  88							   FROM nv_blocks b
  89						  LEFT JOIN nv_webdictionary d
  90						  		 	 ON b.id = d.node_id
  91								 	AND d.node_type = "block"
  92									AND d.subtype = "title"
  93									AND d.lang = "'.$website->languages_list[0].'"
  94									AND d.website = '.$website->id.'
  95							  WHERE '.$where.'
  96							    AND b.website = '.$website->id.' 
  97						   ORDER BY '.$orderby.' 
  98							  LIMIT '.$max.'
  99							 OFFSET '.$offset;
 100
 101					if(!$DB->query($sql, 'array'))
 102					{
 103						throw new Exception($DB->get_last_error());	
 104					}
 105					
 106					$dataset = $DB->result();
 107					$total = $DB->foundRows();
 108
 109                    $block_types = block::types();
 110                    $block_types_list = array();
 111
 112                    for($i=0; $i < count($block_types); $i++)
 113                    {
 114	                    if(is_numeric($block_types[$i]['id']))
 115                            $block_types_list[$block_types[$i]['code']] = $block_types[$i]['title'];
 116	                    else
 117		                    $block_types_list[$block_types[$i]['id']] = $block_types[$i]['title'];
 118                    }
 119
 120                    $dataset = grid_notes::summary($dataset, 'block', 'id');
 121									
 122					// we need to format the values and retrieve the needed strings from the dictionary
 123					$out = array();								
 124					for($i=0; $i < count($dataset); $i++)
 125					{
 126						if(empty($dataset[$i])) continue;
 127						
 128						$access = array(
 129                            0 => '<img src="img/icons/silk/page_white_go.png" align="absmiddle" title="'.t(254, 'Everybody').'" />',
 130							1 => '<img src="img/icons/silk/lock.png" align="absmiddle" title="'.t(361, 'Web users only').'" />',
 131							2 => '<img src="img/icons/silk/user_gray.png" align="absmiddle" title="'.t(363, 'Users who have not yet signed up or signed in').'" />',
 132                            3 => '<img src="img/icons/silk/group_key.png" align="absmiddle" title="'.t(512, "Selected web user groups").'" />'
 133						);						
 134						
 135						if(empty($dataset[$i]['date_published'])) 
 136							$dataset[$i]['date_published'] = '&infin;';
 137						else
 138							$dataset[$i]['date_published'] = core_ts2date($dataset[$i]['date_published'], false);
 139							
 140						if(empty($dataset[$i]['date_unpublish'])) 
 141							$dataset[$i]['date_unpublish'] = '&infin;';	
 142						else
 143							$dataset[$i]['date_unpublish'] = core_ts2date($dataset[$i]['date_unpublish'], false);
 144							
 145						if($dataset[$i]['category'] > 0)
 146							$dataset[$i]['category'] = $DB->query_single(
 147                                'text',
 148                                'nv_webdictionary',
 149                                ' 	node_type = "structure" AND
 150                                    node_id = "'.$dataset[$i]['category'].'" AND
 151                                    subtype = "title" AND
 152                                    lang = "'.$website->languages_list[0].'"
 153                                '
 154                            );
 155
 156						$out[$i] = array(
 157							0	=> $dataset[$i]['id'],
 158							1 	=> $block_types_list[$dataset[$i]['type']],
 159                            2 	=> '<div class="list-row" data-enabled="'.$dataset[$i]['enabled'].'">'.$dataset[$i]['title'].'</div>',
 160							3	=> $dataset[$i]['date_published'].' - '.$dataset[$i]['date_unpublish'],
 161							4	=> $access[$dataset[$i]['access']],
 162							5	=> (($dataset[$i]['enabled']==1)? '<img src="img/icons/silk/accept.png" />' : '<img src="img/icons/silk/cancel.png" />'),
 163                            6 	=> $dataset[$i]['_grid_notes_html']
 164						);
 165					}
 166									
 167					navitable::jqgridJson($out, $page, $offset, $max, $total);
 168					break;
 169			}
 170			
 171			session_write_close();
 172			exit;
 173			break;
 174		
 175		case 'load':
 176        case 'edit':
 177		case 2:
 178			if(!empty($_REQUEST['id']))
 179			{
 180				$item->load(intval($_REQUEST['id']));	
 181			}
 182		
 183			if(isset($_REQUEST['form-sent']))
 184			{
 185				$item->load_from_post();
 186				try
 187				{
 188					$item->save();
 189                    property::save_properties_from_post('block', $item->id);
 190					$id = $item->id;
 191
 192					// set block order
 193                    if(!empty($item->type) && !empty($_REQUEST['blocks-order']))
 194					    block::reorder($item->type, $_REQUEST['blocks-order'], $_REQUEST['blocks-order-fixed']);
 195
 196					unset($item);
 197					$item = new block();
 198					$item->load($id);
 199                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
 200				}
 201				catch(Exception $e)
 202				{
 203					$layout->navigate_notification($e->getMessage(), true, true);	
 204				}
 205				users_log::action($_REQUEST['fid'], $item->id, 'save', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
 206			}
 207			else
 208				users_log::action($_REQUEST['fid'], $item->id, 'load', $item->dictionary[$website->languages_list[0]]['title']);
 209		
 210			$out = blocks_form($item);
 211			break;	
 212
 213        case 'delete':
 214		case 4: // remove 
 215			if(!empty($_REQUEST['id']))
 216			{
 217				$item->load(intval($_REQUEST['id']));	
 218				if($item->delete() > 0)
 219				{
 220                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
 221                    $out = blocks_list();
 222				}
 223				else
 224				{
 225					$layout->navigate_notification(t(56, 'Unexpected error.'), false);
 226					$out = blocks_form($item);
 227				}
 228				users_log::action($_REQUEST['fid'], $item->id, 'remove', $item->dictionary[$website->languages_list[0]]['title']);
 229			}
 230			break;
 231
 232        case 'duplicate':
 233            if(!empty($_REQUEST['id']))
 234            {
 235                $item->load(intval($_REQUEST['id']));
 236
 237                $properties = property::load_properties_associative(
 238                    'block', $item->type,
 239                    'block', $item->id
 240                );
 241
 242                // try to duplicate
 243                $item->id = 0;
 244                $ok = $item->insert();
 245
 246                if($ok)
 247                {
 248                    // also duplicate block properties
 249                    $ok = property::save_properties_from_array('block', $item->id, $item->type, $properties);
 250                }
 251
 252                if($ok)
 253                {
 254                    $layout->navigate_notification(t(478, 'Item duplicated successfully.'), false, false, 'fa fa-check');
 255                    $out = blocks_form($item);
 256                }
 257                else
 258                {
 259                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
 260                    $item = new block();
 261                    $item->load(intval($_REQUEST['id']));
 262                    $out = blocks_form($item);
 263                }
 264
 265                users_log::action($_REQUEST['fid'], $item->id, 'duplicate', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
 266            }
 267            break;
 268
 269        case 'path':
 270		case 5:	// search an existing path
 271			$DB->query('SELECT path as id, path as label, path as value
 272						  FROM nv_paths
 273						 WHERE path LIKE '.protect('%'.$_REQUEST['term'].'%').' 
 274						   AND website = '.$website->id.'
 275				      ORDER BY path ASC
 276					     LIMIT 10',
 277						'array');
 278						
 279			echo json_encode($DB->result());
 280							  
 281			core_terminate();		
 282			break;
 283
 284        case 'block_groups_list':
 285            $out = block_groups_list();
 286            break;
 287
 288        case 'block_groups_json':	// block groups: json data retrieval
 289			$page = intval($_REQUEST['page']);
 290			$max	= intval($_REQUEST['rows']);
 291			$offset = ($page - 1) * $max;
 292
 293			list($rs, $total) = block_group::paginated_list($offset, $max, $_REQUEST['sidx'], $_REQUEST['sord']);
 294
 295            $rs = grid_notes::summary($rs, 'block_group', 'id');
 296
 297            // translate $rs to an array of ordered fields
 298            foreach($rs as $row)
 299            {
 300                if(substr($row['blocks'], 0, 2)=='a:') // nv < 2.1
 301                    $row['blocks']	= mb_unserialize($row['blocks']);
 302                else // nv >= 2.1
 303                    $row['blocks']  = json_decode($row['blocks'], true);
 304
 305                $dataset[] = array(
 306                    'id' => $row['id'],
 307                    'code' => $row['code'],
 308                    'title' => $row['title'],
 309                    'blocks' => count($row['blocks']),
 310                    'notes' => $row['_grid_notes_html']
 311                );
 312            }
 313
 314			navitable::jqgridJson($dataset, $page, $offset, $max, $total, 'id');
 315
 316			session_write_close();
 317			exit;
 318			break;
 319
 320        case 'block_group_edit':
 321            $item = new block_group();
 322
 323            if(!empty($_REQUEST['id']))
 324            {
 325                $item->load(intval($_REQUEST['id']));
 326            }
 327
 328            if(isset($_REQUEST['form-sent']))
 329            {
 330                $item->load_from_post();
 331                try
 332                {
 333                    $item->save();
 334                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
 335                }
 336                catch(Exception $e)
 337                {
 338                    $layout->navigate_notification($e->getMessage(), true, true);
 339                }
 340                users_log::action($_REQUEST['fid'], $item->id, 'save', $item->title, json_encode($_REQUEST));
 341            }
 342            else if(!empty($_REQUEST['id']))
 343                users_log::action($_REQUEST['fid'], $item->id, 'edit', $item->title);
 344
 345			$out = block_group_form($item);
 346			break;
 347
 348        case 'block_group_delete':
 349            $item = new block_group();
 350            if(!empty($_REQUEST['id']))
 351            {
 352                $item->load(intval($_REQUEST['id']));
 353                if($item->delete() > 0)
 354                {
 355                    $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
 356                    $out = block_groups_list();
 357                }
 358                else
 359                {
 360                    $layout->navigate_notification(t(56, 'Unexpected error.'), false);
 361                    $out = block_group_form($item);
 362                }
 363                users_log::action($_REQUEST['fid'], $item->id, 'remove', $item->title);
 364            }
 365			break;
 366
 367        case 'block_types_list':
 368			$out = blocks_types_list();
 369			break;
 370			
 371		case 'block_types_json':	// block types: json data retrieval
 372			$page = intval($_REQUEST['page']);
 373			$max	= intval($_REQUEST['rows']);
 374			$offset = ($page - 1) * $max;
 375		
 376			$rs = block::types($_REQUEST['sidx'], $_REQUEST['sord']);
 377
 378            $block_modes = block::modes();
 379
 380            // translate $rs to an array of ordered fields
 381            foreach($rs as $row)
 382            {
 383                $dataset[] = array(
 384                    'id' => $row['id'],
 385                    'type' => $block_modes[$row['type']],
 386                    'code' => $row['code'],
 387                    'title' => $row['title'],
 388                    'width' => $row['width'],
 389                    'height' => $row['height']
 390                );
 391            }
 392
 393			$total = count($dataset);
 394			navitable::jqgridJson($dataset, $page, $offset, $max, $total, 'id');
 395		
 396			session_write_close();
 397			exit;
 398			break;			
 399
 400        case 'block_type_edit':
 401		case 82: // edit/create block type		
 402
 403			$item = NULL;
 404            $position = NULL;
 405            $max_id = 0;
 406
 407			$dataset = block::custom_types();
 408			for($i=0; $i < count($dataset); $i++)
 409			{
 410                if($dataset[$i]['id'] > $max_id)
 411                    $max_id = $dataset[$i]['id'];
 412
 413				if($dataset[$i]['id'] == $_REQUEST['id'])
 414				{
 415					$item = $dataset[$i];
 416                    $position = $i;
 417				}
 418			}
 419
 420			if(empty($item))
 421			{
 422				$layout->navigate_notification(t(599, "Sorry, can't display a theme block type info."));
 423				$out = blocks_types_list();
 424			}
 425			else
 426			{
 427	            if(isset($_REQUEST['form-sent']))
 428				{
 429					if(empty($item))
 430						$item = array('id' => $max_id + 1);
 431
 432					$item['type'] = $_REQUEST['type'];
 433					$item['title'] = $_REQUEST['title'];
 434	                $item['code'] = $_REQUEST['code'];
 435					$item['width'] = $_REQUEST['width'];
 436					$item['height'] = $_REQUEST['height'];
 437					$item['order'] = $_REQUEST['order'];
 438					$item['maximum'] = $_REQUEST['maximum'];
 439					$item['notes'] = pquotes($_REQUEST['notes']);
 440
 441					if(!is_null($position))
 442						$dataset[$position] = $item;
 443	                else
 444	                    $dataset[] = $item;
 445
 446					try
 447					{
 448						// save
 449						$ok = block::types_update($dataset);
 450                        $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
 451					}
 452					catch(Exception $e)
 453					{
 454						$layout->navigate_notification($e->getMessage(), true, true);
 455					}
 456				}
 457
 458				$out = blocks_type_form($item);
 459			}
 460
 461			break;
 462
 463        case 'block_type_delete':
 464		case 84: // remove block type		
 465            $dataset = block::custom_types();
 466			$item = NULL;
 467			
 468			for($i=0; $i < count($dataset); $i++)
 469			{
 470				if($dataset[$i]['id'] == $_REQUEST['id'])
 471				{
 472					unset($dataset[$i]);
 473					break;
 474				}
 475			}
 476			
 477			try
 478			{													
 479				block::types_update($dataset);
 480                $layout->navigate_notification(t(55, 'Item removed successfully.'), false);
 481                $out = blocks_types_list();
 482			}
 483			catch(Exception $e)
 484			{
 485				$out = $layout->navigate_message("error", t(23, 'Blocks'), t(56, 'Unexpected error.'));			
 486			}
 487			break;
 488
 489        case 'block_property_load':
 490            $property = new property();
 491
 492            if(!empty($_REQUEST['id']))
 493            {
 494                if(is_numeric($_REQUEST['id']))
 495                    $property->load(intval($_REQUEST['id']));
 496                else
 497                    $property->load_from_theme($_REQUEST['id'], null, 'block', $_REQUEST['block']);
 498            }
 499
 500            header('Content-type: text/json');
 501
 502            $types = property::types();
 503            $property->type_text = $types[$property->type];
 504
 505            echo json_encode($property);
 506
 507            session_write_close();
 508            exit;
 509            break;
 510
 511        case 'block_property_save': // save property details
 512
 513            $property = new property();
 514
 515            if(!empty($_REQUEST['property-id']))
 516                $property->load(intval($_REQUEST['property-id']));
 517
 518            $property->load_from_post();
 519            $property->save();
 520
 521            header('Content-type: text/json');
 522
 523            $types = property::types();
 524            $property->type_text = $types[$property->type];
 525
 526            echo json_encode($property);
 527
 528            session_write_close();
 529            exit;
 530            break;
 531
 532        case 'block_property_remove': // remove property
 533
 534            $property = new property();
 535
 536            if(!empty($_REQUEST['property-id']))
 537                $property->load(intval($_REQUEST['property-id']));
 538
 539            $property->delete();
 540
 541            session_write_close();
 542            exit;
 543            break;
 544
 545        case 'block_group_block_options':
 546            $status = null;
 547            $block_group = $_REQUEST['block_group'];
 548            $block_code = $_REQUEST['code'];
 549            $block_uid = $_REQUEST['block_uid'];
 550
 551            if(isset($_REQUEST['form-sent']))
 552                $status = property::save_properties_from_post('block_group_block', $block_code, $block_group, $block_code, $block_uid);
 553
 554            $out = block_group_block_options($block_group, $block_code, $block_uid, $status);
 555
 556            echo $out;
 557
 558            core_terminate();
 559            break;
 560
 561        case 'block_group_extension_block_options':
 562            $status = null;
 563            $block_group = $_REQUEST['block_group'];    // block_group type
 564            $block_id = $_REQUEST['block_id'];          // extension block id (type)
 565            $block_uid = $_REQUEST['block_uid'];        // extension block unique id
 566            $block_extension = $_REQUEST['block_extension'];    // extension name
 567
 568            if(isset($_REQUEST['form-sent']))
 569                $status = property::save_properties_from_post('extension_block', $block_group, $block_id, null, $block_uid);
 570
 571            $out = block_group_extension_block_options($block_group, $block_extension, $block_id, $block_uid, $status);
 572
 573            echo $out;
 574
 575            core_terminate();
 576            break;
 577
 578        case 'list':
 579		case 0:
 580		default:			
 581			$out = blocks_list();
 582			break;
 583	}
 584	
 585	return $out;
 586}
 587
 588function blocks_list()
 589{
 590    global $events;
 591	global $user;
 592
 593	$navibars = new navibars();
 594	$navitable = new navitable("blocks_list");
 595	
 596	$navibars->title(t(23, 'Blocks'));
 597
 598    // retrieve block groups, if more than 10, do not show quickmenu
 599
 600    $group_blocks_links = array();
 601    list($bg_rs, $bg_total) = block_group::paginated_list(0, 10, 'title', 'desc');
 602
 603    if($bg_total > 0 && $bg_total <= 10)
 604    {
 605        foreach($bg_rs as $bg)
 606            $group_blocks_links[] = '<a class="ui-menu-action-bigger" href="?fid=blocks&act=block_group_edit&id='.$bg['id'].'"><i class="fa fa-fw fa-caret-right"></i> '.$bg['title'].'</a>';
 607
 608        $events->add_actions(
 609            'blocks',
 610            array(
 611                'item' => null,
 612                'navibars' => &$navibars
 613            ),
 614            $group_blocks_links,
 615            '<a class="content-actions-submenu-trigger" href="?fid=blocks&act=block_groups_list">
 616                <img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> '.t(506, 'Groups').' &#9662;
 617            </a>'
 618        );
 619    }
 620
 621    $navibars->add_actions(
 622        array(
 623            (!empty($group_blocks_links)? '' : '<a href="?fid=blocks&act=block_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> '.t(506, 'Groups').'</a>'),
 624            '<a href="?fid=blocks&act=block_types_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/brick_edit.png"> '.t(167, 'Types').'</a>'
 625        )
 626    );
 627
 628	$navibars->add_actions(
 629        array(
 630            '<a href="?fid=blocks&act=edit"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> '.t(38, 'Create').'</a>',
 631			'<a href="?fid=blocks&act=list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> '.t(39, 'List').'</a>',
 632			'search_form'
 633        )
 634    );
 635	
 636	if(@$_REQUEST['quicksearch']=='true')
 637		$navitable->setInitialURL("?fid=blocks&act=json&_search=true&quicksearch=".$_REQUEST['navigate-quicksearch']);
 638	
 639	$navitable->setURL('?fid=blocks&act=json');
 640	$navitable->sortBy('date_modified', 'desc');
 641	$navitable->setDataIndex('id');
 642	$navitable->setEditUrl('id', '?fid=blocks&act=edit&id=');
 643	$navitable->enableSearch();
 644	if($user->permission("blocks.delete") == 'true')
 645		$navitable->enableDelete();
 646	$navitable->setGridNotesObjectName("block");
 647	
 648	$navitable->addCol("ID", 'id', "40", "true", "left");	
 649	$navitable->addCol(t(160, 'Type'), 'type', "120", "true", "center");	
 650	$navitable->addCol(t(67, 'Title'), 'title', "400", "true", "left");	
 651	$navitable->addCol(t(85, 'Date published'), 'dates', "100", "true", "center");	
 652	$navitable->addCol(t(364, 'Access'), 'access', "40", "true", "center");	
 653	$navitable->addCol(t(65, 'Enabled'), 'enabled', "40", "true", "center");
 654    $navitable->addCol(t(168, 'Notes'), 'note', "50", "false", "center");
 655	
 656	$navibars->add_content($navitable->generate());	
 657	
 658	return $navibars->generate();
 659}
 660
 661function blocks_form($item)
 662{
 663	global $user;
 664	global $DB;
 665	global $website;
 666	global $layout;
 667    global $events;
 668    global $theme;
 669
 670    $current_version = $_SESSION['current_version'];
 671    $extra_actions = array();
 672	
 673	$navibars = new navibars();
 674	$naviforms = new naviforms();	
 675	$layout->navigate_media_browser();	// we can use media browser in this function
 676		
 677	if(empty($item->id))
 678		$navibars->title(t(23, 'Blocks').' / '.t(38, 'Create'));	
 679	else
 680		$navibars->title(t(23, 'Blocks').' / '.t(170, 'Edit').' ['.$item->id.']');			
 681
 682		$navibars->add_actions(
 683		array(
 684			'<a href="#" onclick="javascript: navigate_media_browser();" title="Ctrl+M">
 685				<img height="16" align="absmiddle" width="16" src="img/icons/silk/images.png"> '.t(36, 'Media').'
 686			</a>'
 687		)
 688	);
 689
 690    $layout->add_script("
 691        $(document).on('keydown.ctrl_s', function (evt) { navigate_tabform_submit(1); return false; } );
 692        $(document).on('keydown.ctrl_m', function (evt) { navigate_media_browser(); return false; } );
 693    ");
 694	
 695
 696    if(!empty($item->id))
 697    {
 698        $notes = grid_notes::comments('block', $item->id);
 699        $navibars->add_actions(
 700            array(
 701                '<a href="#" onclick="javascript: navigate_display_notes_dialog();"><span class="navigate_grid_notes_span" style=" width: 20px; line-height: 16px; ">'.count($notes).'</span><img src="img/skins/badge.png" width="20px" height="18px" style="margin-top: -2px;" class="grid_note_edit" align="absmiddle" /> '.t(168, 'Notes').'</a>'
 702            )
 703        );
 704    }
 705
 706	if(empty($item->id))
 707	{
 708		$navibars->add_actions(
 709            array(
 710	            ($user->permission('blocks.create')=='true'?
 711	            '<a href="#" onclick="navigate_tabform_submit(1);" title="Ctrl+S">
 712					<img height="16" align="absmiddle" width="16" src="img/icons/silk/accept.png"> '.t(34, 'Save').'
 713				</a>' : "")
 714            )
 715        );
 716	}
 717	else
 718	{
 719		$navibars->add_actions(
 720            array(
 721	            (($user->permission('blocks.edit') == 'true') ?
 722	            '<a href="#" onclick="navigate_tabform_submit(1);" title="Ctrl+S">
 723					<img height="16" align="absmiddle" width="16" src="img/icons/silk/accept.png"> '.t(34, 'Save').'
 724				</a>' : ""),
 725	            ($user->permission("blocks.delete") == 'true' ?
 726                '<a href="#" onclick="navigate_delete_dialog();">
 727					<img height="16" align="absmiddle" width="16" src="img/icons/silk/cancel.png"> '.t(35, 'Delete').'
 728				</a>' : "")
 729            )
 730        );
 731
 732        $layout->add_script('
 733            function navigate_delete_dialog()
 734            {
 735                navigate_confirmation_dialog(
 736                    function() { window.location.href = "?fid=blocks&act=delete&id='.$item->id.'"; }, 
 737                    null, null, "'.t(35, 'Delete').'"
 738                );
 739            }
 740        ');
 741
 742        if($user->permission("blocks.create") == 'true')
 743            $extra_actions[] = '<a href="?fid=blocks&act=duplicate&id='.$item->id.'" onclick="$(this).attr(\'#\');"><img height="16" align="absmiddle" width="16" src="img/icons/silk/page_copy.png"> '.t(477, 'Duplicate').'</a>';
 744    }
 745
 746    array_unshift($extra_actions, '<a href="?fid=blocks&act=block_types_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/brick_edit.png"> '.t(167, 'Types').'</a>');
 747
 748    $events->add_actions(
 749        'blocks',
 750        array(
 751            'item' => null,
 752            'navibars' => &$navibars
 753        ),
 754        $extra_actions
 755    );
 756
 757    $group_blocks_links = array();
 758    list($bg_rs, $bg_total) = block_group::paginated_list(0, 10, 'title', 'desc');
 759
 760    if($bg_total > 0 && $bg_total <= 10)
 761    {
 762        foreach($bg_rs as $bg)
 763            $group_blocks_links[] = '<a href="?fid=blocks&act=block_group_edit&id='.$bg['id'].'"><i class="fa fa-fw fa-caret-right"></i> '.$bg['title'].'</a>';
 764
 765        $events->add_actions(
 766            'blocks',
 767            array(
 768                'item' => null,
 769                'navibars' => &$navibars
 770            ),
 771            $group_blocks_links,
 772            '<a class="content-actions-submenu-trigger" href="?fid=blocks&act=block_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> '.t(506, 'Groups').' &#9662;</a>'
 773        );
 774    }
 775    else
 776    {
 777        $navibars->add_actions(
 778            array(
 779                '<a href="?fid=blocks&act=block_groups_list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/bricks.png"> '.t(506, 'Groups').'</a>'
 780            )
 781        );
 782    }
 783	
 784	$navibars->add_actions(
 785		array(
 786			(!empty($item->id)? '<a href="?fid=blocks&act=edit"><img height="16" align="absmiddle" width="16" src="img/icons/silk/add.png"> '.t(38, 'Create').'</a>' : ''),
 787			'<a href="?fid=blocks&act=list"><img height="16" align="absmiddle" width="16" src="img/icons/silk/application_view_list.png"> '.t(39, 'List').'</a>',
 788			'search_form'
 789		)
 790	);
 791
 792    if(!empty($item->id))
 793        $layout->navigate_notes_dialog('block', $item->id);
 794
 795	$navibars->form(NULL, '?fid=blocks&act=edit');
 796
 797    $navibars->add_content('
 798        <script type="text/javascript" src="lib/packages/blocks/blocks.js?r='.$current_version->revision.'"></script>
 799    ');
 800
 801	$navibars->add_tab(t(43, "Main"));
 802	
 803	$navibars->add_tab_content($naviforms->hidden('form-sent', 'true'));
 804	$navibars->add_tab_content($naviforms->hidden('id', $item->id));	
 805	
 806	$navibars->add_tab_content_row(
 807        array(
 808            '<label>ID</label>',
 809			'<span>'.(!empty($item->id)? $item->id : t(52, '(new)')).'</span>'
 810        )
 811    );
 812
 813	$block_types = block::types();
 814	$block_types_keys = array();
 815	$block_types_info = array();	
 816	
 817	for($i=0; $i < count($block_types); $i++)
 818	{
 819        if($item->type == $block_types[$i]['code'])
 820            $block_type_width = $block_types[$i]['width'];
 821
 822		$block_size_helper = '';
 823
 824		if(!empty($block_types[$i]['width']) || !empty($block_types[$i]['height']))
 825		{
 826	        if(empty($block_types[$i]['width'])) $block_types[$i]['width'] = '***';
 827			if(empty($block_types[$i]['height'])) $block_types[$i]['height'] = '***';
 828
 829			$block_size_helper = ' ('.$block_types[$i]['width'].' x '.$block_types[$i]['height'].' px)';
 830		}
 831
 832		if(is_numeric($block_types[$i]['id']))
 833			$block_types_keys[] = $block_types[$i]['code'];     // block type created via navigate interface
 834		else
 835			$block_types_keys[] = $block_types[$i]['id'];       // block described in theme definition
 836
 837		$block_types_info[] = $block_types[$i]['title'].$block_size_helper;
 838	}
 839
 840	$navibars->add_tab_content_row(
 841        array(
 842            '<label>'.t(160, 'Type').'</label>',
 843			$naviforms->selectfield('type', $block_types_keys, $block_types_info, $item->type)
 844        )
 845    );
 846										
 847	$navibars->add_tab_content_row(
 848        array(
 849            '<label>'.t(85, 'Date published').'</label>',
 850			$naviforms->datefield('date_published', $item->date_published, true),
 851        )
 852    );
 853										
 854	$navibars->add_tab_content_row(
 855        array(
 856            '<label>'.t(90, 'Date unpublished').'</label>',
 857			$naviforms->datefield('date_unpublish', $item->date_unpublish, true),
 858        )
 859    );
 860
 861	// Notes field is deprecated, but we keep on showing the existing Notes
 862	if(!empty($item->notes))
 863	{
 864		$navibars->add_tab_content_row(
 865	        array(
 866	            '<label>'.t(168, 'Notes').'</label>',
 867				$naviforms->textarea('notes', $item->notes)
 868	        )
 869	    );
 870	}
 871
 872    $navibars->add_tab_content_row(
 873        array(
 874            '<label>'.t(364, 'Access').'</label>',
 875            $naviforms->selectfield(
 876                'access',
 877                array(
 878                    0 => 0,
 879                    1 => 2,
 880                    2 => 1,
 881                    3 => 3
 882                ),
 883                array(
 884                    0 => t(254, 'Everybody'),
 885                    1 => t(362, 'Not signed in'),
 886                    2 => t(361, 'Web users only'),
 887                    3 => t(512, 'Selected web user groups')
 888                ),
 889                $item->access,
 890                'navigate_webuser_groups_visibility($(this).val());',
 891                false,
 892                array(
 893                    1 => t(363, 'Users who have not yet signed in')
 894                )
 895            )
 896        )
 897    );
 898
 899
 900    $webuser_groups = webuser_group::all_in_array();
 901
 902    $navibars->add_tab_content_row(
 903        array(
 904            '<label>'.t(506, "Groups").'</label>',
 905            $naviforms->multiselect(
 906                'groups',
 907                array_keys($webuser_groups),
 908                array_values($webuser_groups),
 909                $item->groups
 910            )
 911        ),
 912        'webuser-groups-field'
 913    );
 914
 915    $layout->add_script('
 916        function navigate_webuser_groups_visibility(access_value)
 917        {
 918            if(access_value==3)
 919                $("#webuser-groups-field").show();
 920            else
 921                $("#webuser-groups-field").hide();
 922        }
 923
 924        navigate_webuser_groups_visibility('.$item->access.');
 925    ');
 926
 927	if(empty($item->id)) $item->enabled = true;
 928										
 929	$navibars->add_tab_content_row(
 930        array(
 931            '<label>'.t(65, 'Enabled').'</label>',
 932		    $naviforms->checkbox('enabled', $item->enabled),
 933	    )
 934    );
 935
 936	if($item->date_modified > 0)
 937	{
 938		$navibars->add_tab_content_row(
 939			array(
 940				'<label>'.t(227, 'Date modified').'</label>',
 941				core_ts2date($item->date_modified, true)
 942			)
 943		);
 944	}
 945
 946	$navibars->add_tab(t(9, "Content"));
 947
 948    switch($item->class)
 949    {
 950        case 'poll':
 951            $options = array();
 952            foreach($website->languages_list as $lang)
 953                $options[$lang] = language::name_by_code($lang);
 954
 955            $navibars->add_tab_content_row(
 956                array(
 957                    '<label>'.t(63, 'Languages').'</label>',
 958                    $naviforms->buttonset('language_selector', $options, $website->languages_list[0], "navigate_items_select_language(this);")
 959                )
 960            );
 961
 962            foreach($website->languages_list as $lang)
 963            {
 964                $navibars->add_tab_content('
 965                    <div class="language_fields" id="language_fields_'.$lang.'" style=" display: none; ">
 966                ');
 967
 968                $navibars->add_tab_content_row(
 969                    array(
 970                        '<label>'.t(558, 'Question').'</label>',
 971                        $naviforms->textfield('title-'.$lang, @$item->dictionary[$lang]['title']),
 972                        ''
 973                    )
 974                );
 975
 976                // Poll options
 977                $table = new naviorderedtable("poll_answers_table_".$lang);
 978                $table->setWidth("330px");
 979                $table->setHiddenInput("poll-answers-table-order-".$lang);
 980                $navibars->add_tab_content(
 981                    $naviforms->hidden("poll-answers-table-order-".$lang, "")
 982                );
 983
 984                $table->addHeaderColumn(t(67, 'Title'), 200);
 985                //$table->addHeaderColumn(t(237, 'Code'), 120);
 986                $table->addHeaderColumn(t(352, 'Votes'), 80);
 987                $table->addHeaderColumn(t(35, 'Remove'), 50);
 988
 989                if(!empty($item->trigger[$lang]))
 990                {
 991                    $poll_answers = $item->trigger[$lang];
 992
 993                    foreach($poll_answers as $pa)
 994                    {
 995                        $uid = uniqid();
 996                        $table->addRow(
 997                            "poll-answers-table-row-".$uid,
 998                            array(
 999                                array('content' => '<input type="text" name="poll-answers-table-title-'.$lang.'['.$uid.']" value="'.$pa['title'].'" style="width: 200px;" />', 'align' => 'left'),
1000                                //array('content' => '<input type="text" name="poll-answers-table-code-'.$lang.'['.$uid.']" value="'.$pa['code'].'" style="width: 120px;" />', 'align' => 'left'),
1001                                array('content' => '<input type="text" name="poll-answers-table-votes-'.$lang.'['.$uid.']" value="'.intval($pa['votes']).'" style="width: 80px;" />', 'align' => 'left'),
1002                                array('content' => '<img src="'.NAVIGATE_URL.'/img/icons/silk/cancel.png" style="cursor: pointer;" onclick="navigate_blocks_poll_answers_table_row_remove(this);" />', 'align' => 'center')
1003                            )
1004                        );
1005                    }
1006                }
1007
1008                $uid = uniqid();
1009                $table->addRow(
1010                    "poll-answers-table-row-model-".$lang,
1011                    array(
1012                        array('content' => '<input type="text" name="poll-answers-table-title-'.$lang.'['.$uid.']" value="" style="width: 200px;" />', 'align' => 'left'),
1013                        //array('content' => '<input type="text" name="poll-answers-table-code-'.$lang.'['.$uid.']" value="'.$uid.'" style="width: 120px;" />', 'align' => 'left'),
1014                        array('content' => '<input type="text" name="poll-answers-table-votes-'.$lang.'['.$uid.']" value="0" style="width: 80px;" />', 'align' => 'left'),
1015                        array('content' => '<img src="'.NAVIGATE_URL.'/img/icons/silk/cancel.png" style="cursor: pointer;" onclick="navigate_blocks_poll_answers_table_row_remove(this);" />', 'align' => 'center')
1016                    )
1017                );
1018
1019                $navibars->add_tab_content_row(
1020                    array(
1021                        '<label>'.t(559, "Answers").'</label>',
1022                        '<div id="poll-answers-'.$lang.'">'.$table->generate().'</div>',
1023                        '<label>&nbsp;</label>',
1024                        '<button id="poll-answers-table-add-'.$lang.'" data-lang="'.$lang.'"><img src="img/icons/silk/add.png" align="absmiddle" style="cursor:pointer;" /> '.t(472, 'Add').'</button>'
1025                    )
1026                );
1027
1028                $navibars->add_tab_content('
1029                    </div>
1030                ');
1031            }
1032
1033            foreach($website->languages_list as $alang)
1034            {
1035                $layout->add_script('
1036                    $(window).on("load", function()
1037                    {
1038                        poll_answers_table_row_models["'.$alang.'"] = $("#poll-answers-table-row-model-'.$alang.'").html();
1039                        if($("#poll_answers_table_'.$alang.'").find("tr").not(".nodrag").length > 1)
1040                            $("#poll-answers-table-row-model-'.$alang.'").hide();
1041                        navigate_naviorderedtable_poll_answers_table_'.$alang.'_reorder();
1042                    });
1043                ');
1044            }
1045
1046            $layout->add_script('
1047                var active_languages = ["'.implode('", "', array_keys($options)).'"];
1048                navigate_items_select_language("'.$website->languages_list[0].'");
1049            ');
1050            break;
1051
1052        case 'block':
1053        case 'theme':
1054        default:
1055            $options = array();
1056            foreach($website->languages_list as $lang)
1057                $options[$lang] = language::name_by_code($lang);
1058
1059            $navibars->add_tab_content_row(
1060                array(
1061                    '<label>'.t(63, 'Languages').'</label>',
1062                    $naviforms->buttonset('language_selector', $options, $website->languages_list[0], "navigate_items_select_language(this);")
1063                )
1064            );
1065
1066            foreach($website->languages_list as $lang)
1067            {
1068                $navibars->add_tab_content('<div class="language_fields" id="language_fields_'.$lang.'" style=" display: none; ">');
1069
1070                $navibars->add_tab_content_row(
1071                    array(
1072                        '<label>'.t(67, 'Title').'</label>',
1073                        $naviforms->textfield('title-'.$lang, @$item->dictionary[$lang]['title']),
1074                        ''
1075                    )
1076                );
1077
1078	            $block_trigger_types = array(
1079		            '' => t(181, 'Hidden'),
1080		            'title' => t(67, 'Title'),
1081		            'content' => t(9, 'Content'),
1082                    'image' => t(157, 'Image'),
1083                    'rollover' => t(182, 'Rollover'),
1084                    'video' => t(272, 'Video'),
1085                    'html' => 'HTML',
1086		            'links' => t(549, 'Links'),
1087		            'flash' => 'Flash'
1088	            );
1089
1090	            // check block trigger restrictions in theme definition
1091	            if(is_array($theme->blocks))
1092	            {
1093		            foreach($theme->blocks as $tb)
1094		            {
1095                        // navigate 1.x compatibility
1096                        if(!isset($tb->id) && isset($tb->code))
1097                            $tb->id = $tb->code;
1098
1099                        if($tb->id == $item->type && isset($tb->trigger))
1100			            {
1101				            if(!is_array($tb->trigger))
1102					            $tb->trigger = array($tb->trigger);
1103
1104				            foreach($block_trigger_types as $btt_key => $btt_val)
1105				            {
1106					            if(empty($btt_key) || in_array($btt_key, $tb->trigger))
1107					                continue;
1108
1109					            unset($block_trigger_types[$btt_key]);
1110				            }
1111
1112				            $block_trigger_types = array_filter($block_trigger_types);
1113			            }
1114		            }
1115	            }
1116
1117                $navibars->add_tab_content_row(array(
1118                        '<label>'.t(160, 'Type').'</label>',
1119                        $naviforms->selectfield('trigger-type-'.$lang,
1120                            array_keys($block_trigger_types),
1121                            array_values($block_trigger_types),
1122                            $item->trigger['trigger-type'][$lang],
1123                            "navigate_blocks_trigger_change('".$lang."', this);"
1124                        )
1125                    )
1126                );
1127
1128                $navibars->add_tab_content_row(
1129                    array(
1130                        '<label>'.t(157, 'Image').'</label>',
1131                        $naviforms->dropbox('trigger-image-'.$lang, @$item->trigger['trigger-image'][$lang], 'image')
1132                    )
1133                );
1134
1135
1136                $navibars->add_tab_content_row(
1137                    array(
1138                        '<label>'.t(182, 'Rollover').' (off / on)</label>',
1139                        $naviforms->dropbox('trigger-rollover-'.$lang, @$item->trigger['trigger-rollover'][$lang], 'image'),
1140                        $naviforms->dropbox('trigger-rollover-active-'.$lang, @$item->trigger['trigger-rollover-active'][$lang], 'image'),
1141                        ''
1142                    )
1143                );
1144
1145                $navibars->add_tab_content_row(
1146                    array(
1147                        '<label>'.t(272, 'Video').'</label>',
1148                        $naviforms->dropbox('trigger-video-'.$lang, @$item->trigger['trigger-video'][$lang], 'video')
1149                    )
1150                );
1151
1152                $navibars->add_tab_content_row(
1153                    array(
1154                        '<label>Flash (SWF)</label>',
1155                        $naviforms->dropbox('trigger-flash-'.$lang, @$item->trigger['trigger-flash'][$lang], 'flash'),
1156                        ''
1157                    )
1158                );
1159
1160                /* links list */
1161
1162                // check if navigate must show an icon selector
1163                $links_icons = '';
1164                if(!empty($theme) && !empty($theme->blocks))
1165                {
1166                    foreach($theme->blocks as $tb)
1167                    {
1168                        if($item->type == $tb->id)
1169                        {
1170                            $links_icons = @$tb->icons;
1171                            break;
1172                        }
1173                    }
1174                }
1175
1176                $table = new naviorderedtable("trigger_links_table_".$lang);
1177                $table->setWidth("776px");
1178                $table->setHiddenInput("trigger-links-table-order-".$lang);
1179                $navibars->add_tab_content( $naviforms->hidden("trigger-links-table-order-".$lang, "") );
1180
1181                $table->addHeaderColumn(t(242, 'Icon'), 50);
1182                $table->addHeaderColumn(t(67, 'Title'), 180);
1183                $table->addHeaderColumn(t(197, 'Link'), 390);
1184                $table->addHeaderColumn('<i class="fa fa-lg fa-fw fa-external-link" title="'.t(324, 'New window').'"></i>', 16);
1185                $table->addHeaderColumn('<i class="fa fa-lg fa-fw fa-globe" title="'.t(364, 'Access').'"></i>', 20);
1186                $table->addHeaderColumn(t(35, 'Remove'), 50);
1187
1188
1189				if(empty($item->trigger['trigger-links'][$lang]['link']))
1190				{
1191					// create a default entry
1192					$item->trigger['trigger-links'][$lang] = array(
1193						'order' => '',
1194						'icon' => '',
1195						'title' => array('0' => ''),
1196						'access' => array('0' => 0),
1197						'link' => array('0' => '')
1198					);
1199				}
1200
1201                if(!empty($item->trigger['trigger-links'][$lang]))
1202                {
1203                    $tlinks = $item->trigger['trigger-links'][$lang];
1204
1205                    foreach($tlinks['link'] as $key => $link)
1206                    {
1207                        $uid = uniqid();
1208                        $table->addRow(
1209                            uniqid('trigger-links-table-row-'),
1210                            array(
1211	                            ( empty($links_icons)?
1212	                                array('content' => '-', 'align' => 'center') :
1213	                                array('content' => '<select name="trigger-links-table-icon-'.$lang.'['.$uid.']" data-select2-value="'.$tlinks['icon'][$key].'"  data-role="icon" style="width: 190px;"></select>', 'align' => 'left')
1214                                ),
1215                                array('content' => '<input type="text" name="trigger-links-table-title-'.$lang.'['.$uid.']" value="'.$tlinks['title'][$key].'" data-role="title" style="width: 250px;" />', 'align' => 'left'),
1216                                array('content' => '<input type="text" name="trigger-links-table-link-'.$lang.'['.$uid.']" value="'.$tlinks['link'][$key].'" data-role="link" style="width: 260px;" />'.
1217                                                   '<a class="uibutton nv_block_nv_link_trigger"><i class="fa fa-sitemap"></i></a>',
1218                                      'align' => 'left',
1219                                      'style' => 'white-space: nowrap;'
1220                                ),
1221                                array('content' => '<input type="checkbox" name="trigger-links-table-new_window-'.$lang.'['.$uid.']" data-role="target" id="trigger-links-table-new_window-'.$lang.'['.$uid.']" value="1" '.($tlinks['new_window'][$key]=='1'? 'checked="checked"' : '').' />
1222                                                    <label for="trigger-links-table-new_window-'.$lang.'['.$uid.']" />',
1223                                      'align' => 'left'),
1224                                array('content' => '<input type="hidden" name="trigger-links-table-access-'.$lang.'['.$uid.']" data-role="access" id="trigger-links-table-access-'.$lang.'['.$uid.']" value="'.value_or_default($tlinks['access'][$key], 0).'" />
1225                                                    <i class="fa fa-fw fa-lg fa-eye '.($tlinks['access'][$key]=='1'? 'hidden' : '').'" onclick="navigate_blocks_trigger_links_table_row_access(this);" data-value="0" for="trigger-links-table-access-'.$lang.'['.$uid.']"></i>
1226                                                    <i class="fa fa-fw fa-lg fa-eye-slash '.($tlinks['access'][$key]=='1'? '' : 'hidden').'" onclick="navigate_blocks_trigger_links_table_row_access(this);" data-value="1" for="trigger-links-table-access-'.$lang.'['.$uid.']"></i>',
1227                                      'align' => 'center'),
1228                                array('content' => '<img src="'.NAVIGATE_URL.'/img/icons/silk/cancel.png" style="cursor: pointer;" onclick="navigate_blocks_trigger_links_table_row_remove(this);" />', 'align' => 'center')
1229                            )
1230                        );
1231                    }
1232                }
1233
1234                $uid = uniqid();
1235                $table->addRow(
1236                    "trigger-links-table-row-model-".$lang,
1237                    array(
1238	                    ( empty($links_icons)?
1239                            array('content' => '-', 'align' => 'center') :
1240                            array('content' => '<select name="trigger-links-table-icon-'.$lang.'['.$uid.']" data-select2-value="" data-role="icon" style="width: 190px;"></select>', 'align' => 'left')
1241                        ),
1242                        array('content' => '<input type="text" name="trigger-links-table-title-'.$lang.'['.$uid.']" value="" data-role="title" style="width: 250px;" />', 'align' => 'left'),
1243                        array('content' => '<input type="text" name="trigger-links-table-link-'.$lang.'['.$uid.']" value="" data-role="link" style="width: 260px;" />'.
1244											 '<a class="uibutton nv_block_nv_link_trigger"><i class="fa fa-sitemap"></i></a>',
1245                              'align' => 'left'
1246						),
1247                        array('content' => '<input type="checkbox" name="trigger-links-table-new_window-'.$lang.'['.$uid.']"  data-role="target" id="trigger-links-table-new_window-'.$lang.'['.$uid.']" value="1" />
1248                                            <label for="trigger-links-table-new_window-'.$lang.'['.$uid.']" />',
1249                              'align' => 'left'),
1250                        array('content' => '<input type="hidden" name="trigger-links-table-access-'.$lang.'['.$uid.']" data-role="access" id="trigger-links-table-access-'.$lang.'['.$uid.']" value="0" />
1251                                                    <i class="fa fa-fw fa-lg fa-eye" onclick="navigate_blocks_trigger_links_table_row_visibility(this);" data-value="0"  for="trigger-links-table-access-'.$lang.'['.$uid.']"></i>
1252                                                    <i class="fa fa-fw fa-lg fa-eye-slash hidden" onclick="navigate_blocks_trigger_links_table_row_visibility(this);" data-value="1"  for="trigger-links-table-access-'.$lang.'['.$uid.']"></i>',
1253                              'align' => 'center'),
1254                        array('content' => '<img src="'.NAVIGATE_URL.'/img/icons/silk/cancel.png" style="cursor: pointer;" onclick="navigate_blocks_trigger_links_table_row_remove(this);" />', 'align' => 'center')
1255                    )
1256                );
1257
1258                $navibars->add_tab_content_row(
1259                    array(
1260                        '<label>'.t(549, "Links").'</label>',
1261                        '<div id="trigger-links-'.$lang.'">'.$table->generate().'</div>',
1262                        '<label>&nbsp;</label>',
1263                        '<button id="trigger-links-table-add-'.$lang.'" data-lang="'.$lang.'"><img src="img/icons/silk/add.png" align="absmiddle" style="cursor:pointer;" /> '.t(472, 'Add').'</button>'
1264                    )
1265                );
1266
1267                $navibars->add_tab_content_row(
1268         

Large files files are truncated, but you can click here to view the full file