示例#1
0
	function mkPackage($option, $caller, $pkg)
	{
		global $ff_admpath, $ff_version, $mosConfig_fileperms;

		$id          = $pkg;
		$name        = JRequest::getVar( 'pkg_name', '');
		$title       = JRequest::getVar( 'pkg_title', '');
		$version     = JRequest::getVar( 'pkg_version', '');
		$created     = date('Y-m-d H:i:s');
		$author      = JRequest::getVar( 'pkg_author', '');
		$email       = JRequest::getVar( 'pkg_email', '');
		$url         = JRequest::getVar( 'pkg_url', '');
		$description = JRequest::getVar( 'pkg_description', '');
		$copyright   = JRequest::getVar( 'pkg_copyright', '');

		savePackage($id, $name, $title, $version, $created, $author,
					$email, $url, $description, $copyright);

		$xmlname = $ff_admpath.'/packages/'.$name.'.xml';
		$existed = file_exists($xmlname);
		if ($existed)
			if (!is_writable($xmlname))
				die('XML file is not writable!');

		$file= fopen($xmlname, "w");

		$xml  = '<?xml version="1.0" encoding="utf-8" ?>'.nl().
				'<FacileFormsPackage';
		if ($id != '') $xml .= ' id="'.$id.'"';
                if ($id == '') $xml .= ' id="'.$name.'"';
		$xml .=
				' type="autoincrement" version="'.$ff_version.'">'.nl().
				indent(1).'<name>'.expstring($name).'</name>'.nl().
				indent(1).'<title>'.expstring($title).'</title>'.nl().
				indent(1).'<version>'.expstring($version).'</version>'.nl().
				indent(1).'<creationDate>'.$created.'</creationDate>'.nl().
				indent(1).'<author>'.expstring($author).'</author>'.nl().
				indent(1).'<authorEmail>'.expstring($email).'</authorEmail>'.nl().
				indent(1).'<authorUrl>'.expstring($url).'</authorUrl>'.nl().
				indent(1).'<description>'.expstring($description).'</description>'.nl().
				indent(1).'<copyright>'.expstring($copyright).'</copyright>'.nl();

		if ($id == '')
			$ids = JRequest::getVar( 'scriptsel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_scripts ".
				"where package =  '$id' ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$scripts = _ff_select(
				"select * from #__facileforms_scripts where id in ($ids) order by  package, name, id"
			);
			for ($s = 0; $s < count($scripts); $s++) {
				$script = $scripts[$s];
				$xml .= indent(1).'<script id="'.$script->id.'">'.nl();
				if ($script->published != 1)
					$xml .= indent(2).'<published>'.$script->published.'</published>'.nl();
				if ($script->package != '')
					$xml .= indent(2).'<package>'.expstring($script->package).'</package>'.nl();
				$xml .= indent(2).'<name>'.expstring($script->name).'</name>'.nl().
						indent(2).'<title>'.expstring($script->title).'</title>'.nl();
				if ($script->type != 'Untyped')
				   $xml .= indent(2).'<type>'.expstring($script->type).'</type>'.nl();
				$script->description = trim($script->description);
				if ($script->description != '')
					$xml .= indent(2).'<description>'.expstring($script->description).'</description>'.nl();
				$script->code = trim($script->code);
				if ($script->code != '')
					$xml .= indent(2).'<code>'.expstring($script->code).'</code>'.nl();
				$xml .= indent(1).'</script>'.nl();
			} // for
		} // if

		if ($id == '')
			$ids = JRequest::getVar( 'piecesel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_pieces ".
				"where package =  '$id' ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$pieces = _ff_select(
				"select * from #__facileforms_pieces where id in ($ids) order by  package, name, id"
			);
			for ($p = 0; $p < count($pieces); $p++) {
				$piece = $pieces[$p];
				$xml .= indent(1).'<piece id="'.$piece->id.'">'.nl();
				if ($piece->published != 1)
				   $xml .= indent(2).'<published>'.$piece->published.'</published>'.nl();
				if ($piece->package != '')
					$xml .= indent(2).'<package>'.expstring($piece->package).'</package>'.nl();
				$xml .= indent(2).'<name>'.expstring($piece->name).'</name>'.nl().
						indent(2).'<title>'.expstring($piece->title).'</title>'.nl();
				if ($piece->type != 'Untyped')
				   $xml .= indent(2).'<type>'.expstring($piece->type).'</type>'.nl();
				$piece->description = trim($piece->description);
				if ($piece->description != '')
					$xml .= indent(2).'<description>'.expstring($piece->description).'</description>'.nl();
				$piece->code = trim($piece->code);
				if ($piece->code != '')
					$xml .= indent(2).'<code>'.expstring($piece->code).'</code>'.nl();
				$xml .= indent(1).'</piece>'.nl();
			} // for
		} // if

		if ($id == '')
			$ids = JRequest::getVar( 'formsel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_forms ".
				"where package =  '$id' ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$forms = _ff_select(
				"select * from #__facileforms_forms where id in ($ids) order by  package, ordering, id"
			);
			for ($f = 0; $f < count($forms); $f++) {
				$form = $forms[$f];
				$xml .= indent(1).'<form id="'.$form->id.'">'.nl();
				if ($form->published != 1) $xml .= indent(2).'<published>'.$form->published.'</published>'.nl();
				if ($form->runmode != 0) $xml .= indent(2).'<runmode>'.$form->runmode.'</runmode>'.nl();
				if ($form->package != '')
					$xml .= indent(2).'<package>'.expstring($form->package).'</package>'.nl();
				$xml .=
					indent(2).'<name>'.expstring($form->name).'</name>'.nl().
					indent(2).'<title>'.expstring($form->title).'</title>'.nl();
				if ($form->description != '') $xml .= indent(2).'<description>'.expstring($form->description).'</description>'.nl();
				if ($form->class1 != '') $xml .= indent(2).'<class1>'.expstring($form->class1).'</class1>'.nl();
				if ($form->class2 != '') $xml .= indent(2).'<class2>'.expstring($form->class2).'</class2>'.nl();
				$xml .= indent(2).'<width>'.$form->width.'</width>'.nl();
				if ($form->widthmode != 0) $xml .= indent(2).'<widthmode>'.$form->widthmode.'</widthmode>'.nl();
				$xml .= indent(2).'<height>'.$form->height.'</height>'.nl();
				if ($form->heightmode != 0) $xml .= indent(2).'<heightmode>'.$form->heightmode.'</heightmode>'.nl();
				if ($form->pages    != 1) $xml .= indent(2).'<pages>'.$form->pages.'</pages>'.nl();
				if ($form->emailntf != 1) $xml .= indent(2).'<emailntf>'.$form->emailntf.'</emailntf>'.nl();
				if ($form->emaillog != 1) $xml .= indent(2).'<emaillog>'.$form->emaillog.'</emaillog>'.nl();
				if ($form->emailxml != 0) $xml .= indent(2).'<emailxml>'.$form->emailxml.'</emailxml>'.nl();
				if ($form->emailntf == 2) {
					$form->emailadr = expstring($form->emailadr);
					if ($form->emailadr != '') $xml .= indent(2).'<emailadr>'.$form->emailadr.'</emailadr>'.nl();
				} // if
				if($form->template_code != '')$xml.=indent(2).'<template_code>'.base64_encode($form->template_code).'</template_code>';
				if($form->template_code_processed != '')$xml.=indent(2).'<template_code_processed>'.base64_encode($form->template_code_processed).'</template_code_processed>';
				if($form->template_areas != '')$xml.=indent(2).'<template_areas>'.base64_encode($form->template_areas).'</template_areas>';
				if ($form->dblog != 1) $xml .=  indent(2).'<dblog>'.$form->dblog.'</dblog>'.nl();
				$form->description = trim($form->description);
				if ($form->prevmode != 2) $xml .= indent(2).'<prevmode>'.$form->prevmode.'</prevmode>'.nl();
				if ($form->prevmode != 0 && $form->widthmode != 0 && $form->prevwidth != '')
					$xml .= indent(2).'<prevwidth>'.$form->prevwidth.'</prevwidth>'.nl();
				$this->exportScript(
					'script1',
					'#__facileforms_scripts',
					$form->script1cond,
					$form->script1id,
					$form->script1code,
					2, $xml
				);
				$this->exportScript(
					'script2',
					'#__facileforms_scripts',
					$form->script2cond,
					$form->script2id,
					$form->script2code,
					2, $xml
				);
				$this->exportScript(
					'piece1',
					'#__facileforms_pieces',
					$form->piece1cond,
					$form->piece1id,
					$form->piece1code,
					2, $xml
				);
				$this->exportScript(
					'piece2',
					'#__facileforms_pieces',
					$form->piece2cond,
					$form->piece2id,
					$form->piece2code,
					2, $xml
				);
				$this->exportScript(
					'piece3',
					'#__facileforms_pieces',
					$form->piece3cond,
					$form->piece3id,
					$form->piece3code,
					2, $xml
				);
				$this->exportScript(
					'piece4',
					'#__facileforms_pieces',
					$form->piece4cond,
					$form->piece4id,
					$form->piece4code,
					2, $xml
				);

				$elems = _ff_select(
					"select * from #__facileforms_elements where form=$form->id order by page, ordering, id"
				);
				for ($e = 0; $e < count($elems); $e++) {
					$elem = $elems[$e];
					$xml .= indent(2).'<element id="'.$elem->id.'">'.nl();
					if ($elem->page != 1) $xml .= indent(3).'<page>'.$elem->page.'</page>'.nl();
					if ($elem->published != 1) $xml .= indent(3).'<published>'.$elem->published.'</published>'.nl();
					$xml .= indent(3).'<name>'.expstring($elem->name).'</name>'.nl().
							indent(3).'<title>'.expstring($elem->title).'</title>'.nl();
					if ($elem->type != 'Static Text/HTML') $xml .= indent(3).'<type>'.$elem->type.'</type>'.nl();
					if ($elem->class1 != '') $xml .= indent(3).'<class1>'.expstring($elem->class1).'</class1>'.nl();
					if ($elem->class2 != '') $xml .= indent(3).'<class2>'.expstring($elem->class2).'</class2>'.nl();
					if (isInputElement($elem->type)) {
						if ($elem->logging != 1)
						   $xml .= indent(3).'<logging>'.$elem->logging.'</logging>'.nl();
					} // if
					if (isVisibleElement($elem->type)) {
						if ($elem->posx != NULL) $xml .= indent(3).'<posx>'.$elem->posx.'</posx>'.nl();
						if ($elem->posx != NULL && $elem->posxmode!=0) $xml .= indent(3).'<posxmode>'.$elem->posxmode.'</posxmode>'.nl();
						if ($elem->posy != NULL) $xml .= indent(3).'<posy>'.$elem->posy.'</posy>'.nl();
						if ($elem->posy != NULL && $elem->posymode!=0) $xml .= indent(3).'<posymode>'.$elem->posymode.'</posymode>'.nl();
						if ($elem->width != NULL) $xml .= indent(3).'<width>'.$elem->width.'</width>'.nl();
						if ($elem->width != NULL && $elem->widthmode!=0) $xml .= indent(3).'<widthmode>'.$elem->widthmode.'</widthmode>'.nl();
						if ($elem->height != NULL) $xml .= indent(3).'<height>'.$elem->height.'</height>'.nl();
						if ($elem->height != NULL && $elem->heightmode!=0) $xml .= indent(3).'<heightmode>'.$elem->heightmode.'</heightmode>'.nl();
					} // if
					$xml .= indent(3).'<mailback>'.$elem->mailback.'</mailback>'.nl();
					$xml .= indent(3).'<mailbackfile>'.$elem->mailbackfile.'</mailbackfile>'.nl();
					if ($elem->flag1) $xml .= indent(3).'<flag1>'.$elem->flag1.'</flag1>'.nl();
					if ($elem->flag2) $xml .= indent(3).'<flag2>'.$elem->flag2.'</flag2>'.nl();
					$elem->data1 = expstring($elem->data1);
					if ($elem->data1 != '') $xml .= indent(3).'<data1>'.$elem->data1.'</data1>'.nl();
					$elem->data2 = expstring($elem->data2);
					if ($elem->data2 != '') $xml .= indent(3).'<data2>'.$elem->data2.'</data2>'.nl();
					$elem->data3 = expstring($elem->data3);
					if ($elem->data3 != '') $xml .= indent(3).'<data3>'.$elem->data3.'</data3>'.nl();
					$this->exportScript(
						'script1',
						'#__facileforms_scripts',
						$elem->script1cond,
						$elem->script1id,
						$elem->script1code,
						3, $xml
					);
					if ($elem->script1cond > 0) {
						if ($elem->script1flag1) $xml .= indent(3).'<script1flag1>'.$elem->script1flag1.'</script1flag1>'.nl();
						if ($elem->script1flag2) $xml .= indent(3).'<script1flag2>'.$elem->script1flag2.'</script1flag2>'.nl();
					} // if
					$this->exportScript(
						'script2',
						'#__facileforms_scripts',
						$elem->script2cond,
						$elem->script2id,
						$elem->script2code,
						3, $xml
					);
					if ($elem->script2cond > 0) {
						if ($elem->script2flag1) $xml .= indent(3).'<script2flag1>'.$elem->script2flag1.'</script2flag1>'.nl();
						if ($elem->script2flag2) $xml .= indent(3).'<script2flag2>'.$elem->script2flag2.'</script2flag2>'.nl();
						if ($elem->script2flag3) $xml .= indent(3).'<script2flag3>'.$elem->script2flag3.'</script2flag3>'.nl();
						if ($elem->script2flag4) $xml .= indent(3).'<script2flag4>'.$elem->script2flag4.'</script2flag4>'.nl();
						if ($elem->script2flag5) $xml .= indent(3).'<script2flag5>'.$elem->script2flag5.'</script2flag5>'.nl();
					} // if
					$this->exportScript(
						'script3',
						'#__facileforms_scripts',
						$elem->script3cond,
						$elem->script3id,
						$elem->script3code,
						3, $xml
					);
					if ($elem->script3cond > 0) {
						if ($elem->script3msg != '') $xml .= indent(3).'<script3msg>'.expstring($elem->script3msg).'</script3msg>'.nl();
					} // if
					$xml .= indent(2).'</element>'.nl();
				} // for
				$xml .= indent(1).'</form>'.nl();
			} // for
		} // if

		if ($id == '')
			$ids = JRequest::getVar( 'menusel', array());
		else {
			$ids = array();
			$rows = _ff_select(
				"select id from #__facileforms_compmenus ".
				"where package =  '$id' and parent = 0 ".
				"order by id"
			);
			if (count($rows)) foreach ($rows as $row) $ids[] = $row->id;
		} // if
		if (count($ids) > 0) {
			$ids = implode(',', $ids);
			$menus = _ff_select(
				"select * from #__facileforms_compmenus where id in ($ids) order by  package, ordering, id"
			);
			for ($m = 0; $m < count($menus); $m++) {
				$menu = $menus[$m];
				$xml .= indent(1).'<compmenu id="'.$menu->id.'">'.nl();
				if ($menu->published != 1)
				   $xml .= indent(2).'<published>'.$menu->published.'</published>'.nl();
				$menu->img = trim($menu->img);
				if ($menu->img != '')
					$xml .= indent(2).'<img>'.expstring($menu->img).'</img>'.nl();
				if ($menu->package != '')
					$xml .= indent(2).'<package>'.expstring($menu->package).'</package>'.nl();
				$xml .= indent(2).'<title>'.expstring($menu->title).'</title>'.nl();
				$menu->name = trim($menu->name);
				if ($menu->name != '')
					$xml .= indent(2).'<name>'.expstring($menu->name).'</name>'.nl();
				if ($menu->page != 1 && $menu->page!='')
				   $xml .= indent(2).'<page>'.$menu->page.'</page>'.nl();
				if ($menu->frame != 0)
				   $xml .= indent(2).'<frame>'.$menu->frame.'</frame>'.nl();
				if ($menu->border != 0)
				   $xml .= indent(2).'<border>'.$menu->border.'</border>'.nl();
				$menu->params = trim($menu->params);
				if ($menu->params != '')
					$xml .= indent(2).'<params>'.expstring($menu->params).'</params>'.nl();

				$submenus = _ff_select(
					"select * from #__facileforms_compmenus where parent=$menu->id order by ordering, id"
				);

				for ($s = 0; $s < count($submenus); $s++) {
					$submenu = $submenus[$s];
					$xml .= indent(2).'<compmenu id="'.$submenu->id.'">'.nl();
					if ($submenu->published != 1)
					   $xml .= indent(3).'<published>'.$submenu->published.'</published>'.nl();
					$submenu->img = trim($submenu->img);
					if ($submenu->img != '')
						$xml .= indent(3).'<img>'.expstring($submenu->img).'</img>'.nl();
					if ($menu->package != '')
						$xml .= indent(3).'<package>'.expstring($submenu->package).'</package>'.nl();
					$xml .= indent(3).'<title>'.expstring($submenu->title).'</title>'.nl();
					$submenu->name = trim($submenu->name);
					if ($submenu->name != '')
						$xml .= indent(3).'<name>'.expstring($submenu->name).'</name>'.nl();
					if ($submenu->page != 1 && $submenu->page!='')
					   $xml .= indent(3).'<page>'.$submenu->page.'</page>'.nl();
					if ($submenu->frame != 0)
					   $xml .= indent(3).'<frame>'.$submenu->frame.'</frame>'.nl();
					if ($submenu->border != 0)
					   $xml .= indent(3).'<border>'.$submenu->border.'</border>'.nl();
					$submenu->params = trim($submenu->params);
					if ($submenu->params != '')
						$xml .= indent(3).'<params>'.expstring($submenu->params).'</params>'.nl();
					$xml .= indent(2).'</compmenu>'.nl();
				} // for

				$xml .= indent(1).'</compmenu>'.nl();
			} // for
		} // if

		$xml .= '</FacileFormsPackage>'.nl();
		fwrite($file, $xml);
		fclose($file);

		if (!$existed) {
			$filemode = NULL;
			if (isset($mosConfig_fileperms)) {
				if ($mosConfig_fileperms!='')
					$filemode = octdec($mosConfig_fileperms);
			} else
				$filemode = 0644;
			if (isset($filemode)) @chmod($xmlname, $filemode);
		} // if
		HTML_facileFormsConf::edit($option, $caller, $pkg, $xmlname);
	} // mkPackage
示例#2
0
    static function listitems($option, $pkg, &$form, $page, &$rows, $prevmode, &$checkedIds)
    {
        global $ff_processor, $ff_mospath, $ff_mossite, $ff_admicon, $ff_comsite, $ff_config, $ff_request, $ff_version, $database, $my;
        $mainframe = JFactory::getApplication();
        $database = JFactory::getDBO();
        $ff_mossite = JURI::root();
        ?>
		<script type="text/javascript">
			<!--
			var bf_submitbutton = function(pressbutton)
			{
				var form = document.adminForm;
				switch (pressbutton) {
                                        case 'close':
                                            location.href="index.php?option=com_breezingforms&act=manageforms";
                                            return;
                                            break;
					case 'copy':
					case 'move':
					case 'publish':
					case 'unpublish':
					case 'remove':
						if (form.boxchecked.value==0) {
							alert("<?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SELELEMENTS');
        ?>
");
							return;
						} // if
						break;
					default:
						break;
				} // switch
				switch (pressbutton) {
					case 'share':
						form.act.value = 'share';
						break;
					case 'sort':
						if (!confirm("<?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKSORT');
        ?>
")) return;
						break;
					case 'remove':
						if (!confirm("<?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKDELELEMENTS');
        ?>
")) return;
						break;
					case 'delpage':
						if (!confirm("<?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ASKDELPAGE');
        ?>
")) return;
						break;
					case 'movepos':
						if (form.movepixels.value=='') {
							alert("<?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_ENTPIXMOVE');
        ?>
");
							return;
						} // if
						var nonDigits = /\D/;
						if (nonDigits.test(form.movepixels.value)) {
							alert("<?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PIXMOVEINT');
        ?>
");
							return;
						} // if
						break;
					default:
						break;
				} // switch
				submitform(pressbutton);
			}; // submitbutton

                        if(typeof Joomla != "undefined"){
                            Joomla.submitbutton = bf_submitbutton;
                        }

                        submitbutton = bf_submitbutton;

			function changepage(newpage)
			{
				document.adminForm.page.value = newpage;
				submitform('');
			} // changepage

			function listItemTask( id, task )
			{
				var f = document.adminForm;
				cb = eval( 'f.' + id );
				if (cb) {
					for (i = 0; true; i++) {
						cbx = eval('f.cb'+i);
						if (!cbx) break;
						cbx.checked = false;
					} // for
					cb.checked = true;
					f.boxchecked.value = 1;
					submitbutton(task);
				}
				return false;
			} // listItemTask

<?php 
        if ($form->prevmode > 0) {
            ?>
			ff_coords = [
<?php 
            for ($i = 0; $i < count($rows); $i++) {
                $row = $rows[$i];
                if ($i) {
                    echo ",\n";
                }
                echo "\t\t\t\t[" . intval(isVisibleElement($row->type)) . ',' . intval($row->posx) . ',' . intval($row->posx) . ',' . intval($row->posxmode) . ',' . intval($row->posy) . ',' . intval($row->posy) . ',' . intval($row->posymode) . ']';
            }
            // for
            if ($i) {
                echo "\n";
            } else {
                echo "\t\t\t\t0";
            }
            ?>
			];

			var highlightTmpColor = "";
			var highlightTmpPadding = "";
			
			function highlightElement( elementIndex ){
				var f = document.adminForm;

				<?php 
            if ($ff_config->stylesheet) {
                ?>
				var fd = ff_prevframe.document;
				<?php 
            } else {
                ?>
				var fd = document;
				<?php 
            }
            // endif
            ?>
			
				var cb = eval('f.cb'+elementIndex);
				highlightTmpColor = fd.getElementById('ff_div'+cb.value).style.backgroundColor;
				highlightTmpPadding = fd.getElementById('ff_div'+cb.value).style.padding;
				
				fd.getElementById('ff_div'+cb.value).style.backgroundColor = "red";
				fd.getElementById('ff_div'+cb.value).style.padding = "5px";
			}

			function unhighlightElement( elementIndex ){
				var f = document.adminForm;

				<?php 
            if ($ff_config->stylesheet) {
                ?>
				var fd = ff_prevframe.document;
				<?php 
            } else {
                ?>
				var fd = document;
				<?php 
            }
            // endif
            ?>
			
				var cb = eval('f.cb'+elementIndex);

				fd.getElementById('ff_div'+cb.value).style.backgroundColor = highlightTmpColor;
				fd.getElementById('ff_div'+cb.value).style.padding = highlightTmpPadding;
			}

			function moveElements(direction)
			{
				var f = document.adminForm;
				var step = parseInt(f.id_movepixels.value);
				if (step==0) return;
<?php 
            if ($ff_config->stylesheet) {
                ?>
				var fd = ff_prevframe.document;
<?php 
            } else {
                ?>
				var fd = document;
<?php 
            }
            // endif
            ?>
				var i;
				for (i = 0; i < <?php 
            echo count($rows);
            ?>
; i++) {
					var cb = eval('f.cb'+i);
					if (cb.checked && ff_coords[i][0]) {
						var el = fd.getElementById('ff_div'+cb.value).style;
						var x,y,u;
						switch (direction) {
							case 'left':
								x = ff_coords[i][2];
								if (ff_coords[i][3]) u = '%'; else u = 'px';
								if (x >= 0) {
									if (x > step)
										x -= step;
									else
										x = 0;
									el.left = x+u;
								} else {
									x -= step;
									el.right = (-x)+u;
								} // if
								ff_coords[i][2] = x;
								break;
							case 'right':
								x = ff_coords[i][2];
								if (ff_coords[i][3]) u = '%'; else u = 'px';
								if (x >= 0) {
									x += step;
									el.left = x+u;
								} else {
									if ((-x) > step)
										x += step;
									else
										x = -1;
									el.right = (-y)+u;
								} // if
								ff_coords[i][2] = x;
								break;
							case 'up':
								y = ff_coords[i][5];
								if (ff_coords[i][6]) u = '%'; else u = 'px';
								if (y >= 0) {
									if (y > step)
										y -= step;
									else
										y = 0;
									el.top = y+u;
								} else {
									y -= step;
									el.bottom = (-y)+u;
								} // if
								ff_coords[i][5] = y;
								break;
							case 'down':
								y = ff_coords[i][5];
								if (ff_coords[i][6]) u = '%'; else u = 'px';
								if (y >= 0) {
									y += step;
									el.top = y+u;
								} else {
									if ((-y) > step)
										y += step;
									else
										y = -1;
									el.bottom = (-y)+u;
								} // if
								ff_coords[i][5] = y;
								break;
							default:;
						} // switch
					} // if
				} // for
				var disabled = true;
				for (i = 0; i < <?php 
            echo count($rows);
            ?>
; i++)
					if (ff_coords[i][1]!=ff_coords[i][2] || ff_coords[i][4]!=ff_coords[i][5]) {
						disabled = false;
						break;
					} // if
				f.savepos.disabled = disabled;
				f.restpos.disabled = disabled;
			} // moveElements

			function savePositions()
			{
				var f = document.adminForm;
<?php 
            if ($ff_config->stylesheet) {
                ?>
				var fd = ff_prevframe.document;
<?php 
            } else {
                ?>
				var fd = document;
<?php 
            }
            // endif
            ?>
				var i;
				var pos = '';
				for (i = 0; i < <?php 
            echo count($rows);
            ?>
; i++)
					if (ff_coords[i][1]!=ff_coords[i][2] || ff_coords[i][4]!=ff_coords[i][5]) {
						var cb = eval('f.cb'+i);
						var el = fd.getElementById('ff_div'+cb.value).style;
						if (pos != '') pos += ',';
						pos += cb.value+','+ff_coords[i][2]+','+ff_coords[i][5];
					} // if
				f.movepositions.value = pos;
				
				submitbutton('movepos');
			} // savePositions

			function restorePositions()
			{
				var f = document.adminForm;
<?php 
            if ($ff_config->stylesheet) {
                ?>
				var fd = ff_prevframe.document;
<?php 
            } else {
                ?>
				var fd = document;
<?php 
            }
            // endif
            ?>
				var i;
				for (i = 0; i < <?php 
            echo count($rows);
            ?>
; i++)
					if (ff_coords[i][1]!=ff_coords[i][2] || ff_coords[i][4]!=ff_coords[i][5]) {
						var cb = eval('f.cb'+i);
						var el = fd.getElementById('ff_div'+cb.value).style;
						var x = ff_coords[i][2] = ff_coords[i][1];
						var y = ff_coords[i][5] = ff_coords[i][4];
						var u;
						if (ff_coords[i][3]) u = '%'; else u = 'px';
						if (x >= 0) el.left = x+u; else el.right = (-x)+u;
						if (ff_coords[i][6]) u = '%'; else u = 'px';
						if (y >= 0) el.top = y+u; else el.bottom = (-y)+u;
					} // if
				f.savepos.disabled = true;
				f.restpos.disabled = true;
			} // restorePositions
<?php 
        }
        // endif
        ?>

<?php 
        if ($prevmode == 'submit') {
            ?>
			onload = function()
			{
				submitform('');
			} // onload
<?php 
        }
        // endif
        ?>
			//-->
		</script>
		<div id="overDiv" style="position:absolute;visibility:hidden;z-index:1000;"></div>
                <?php 
        //echo bf_alert('Get BreezingForms Full Version', 'http://crosstec.de/en/extensions/joomla-forms-download.html');
        ?>
                <?php 
        //echo bf_alert('More features, no footers, no messages', 'http://crosstec.de/en/extensions/joomla-forms-download.html');
        ?>
                
		<table cellpadding="4" cellspacing="1" border="0">
			<tr>
				<td nowrap>
					<table class="adminheading">
						<tr><th class="edit" nowrap>BreezingForms <?php 
        echo $ff_version;
        ?>
<br/><span class="componentheading"><?php 
        echo $form->title;
        ?>
 <?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGE');
        ?>
 <?php 
        echo $page;
        ?>
</span></th></tr>
					</table>
				</td>
				<td width="100%" align="right" nowrap>
<?php 
        JToolBarHelper::custom('new', 'new.png', 'new_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_NEW'), false);
        JToolBarHelper::custom('editform', 'edit.png', 'edit_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_EDITFORM'), false);
        JToolBarHelper::custom('copy', 'copy.png', 'copy_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_COPY'), false);
        JToolBarHelper::custom('move', 'move.png', 'move_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_MOVE'), false);
        JToolBarHelper::custom('publish', 'publish.png', 'publish_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_PUBLISH'), false);
        JToolBarHelper::custom('unpublish', 'unpublish.png', 'unpublish_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_UNPUBLISH'), false);
        JToolBarHelper::custom('remove', 'delete.png', 'delete_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_DELETE'), false);
        JToolBarHelper::custom('close', 'cancel.png', 'cancel_f2.png', BFText::_('COM_BREEZINGFORMS_TOOLBAR_QUICKMODE_CLOSE'), false);
        ?>
				</td>
			</tr>
		</table>
		<form action="index.php" method="post" name="adminForm" id="adminForm" class="adminForm">
			<table cellpadding="4" cellspacing="0" border="0" width="100%" class="adminlist table table-striped">
				<tr>
					<th nowrap align="center"><input type="checkbox" name="toggle" value="" onclick="<?php 
        $version = new JVersion();
        echo version_compare($version->getShortVersion(), '3.0', '>=') ? 'Joomla.checkAll(this);' : 'checkAll(' . count($rows) . ');';
        ?>
" /></th>
					<th nowrap align="left"><?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TITLE');
        ?>
</th>
					<th nowrap align="left"><?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_NAME');
        ?>
</th>
					<th nowrap align="left"><?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_TYPE');
        ?>
</th>
					<th nowrap align="center"><?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PUBLISHED');
        ?>
</th>
					<th nowrap align="center" colspan="2"><a href="#sort" onclick="submitbutton('sort')"><?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_REORDER');
        ?>
</a></th>
					<th nowrap align="center">X</th>
					<th nowrap align="center">Y</th>
					<th nowrap align="center"><?php 
        echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SCRIPTID');
        ?>
</th>
					<th width="100%"></th>
				</tr>
<?php 
        $k = 0;
        $boxchecked = 0;
        for ($i = 0; $i < count($rows); $i++) {
            $row = $rows[$i];
            $checked = '';
            if (in_array($row->id, $checkedIds)) {
                $checked = 'checked="checked"';
                $boxchecked++;
            }
            // if
            ?>
				<tr class="row<?php 
            echo $k;
            ?>
">
					<td nowrap align="center"><input type="checkbox" id="cb<?php 
            echo $i;
            ?>
" name="ids[]" value="<?php 
            echo $row->id;
            ?>
" onclick="<?php 
            jimport('joomla.version');
            $version = new JVersion();
            echo version_compare($version->getShortVersion(), '3.0', '>=') ? 'Joomla.isChecked(this.checked);' : 'isChecked(this.checked);';
            ?>
" <?php 
            echo $checked;
            ?>
/></td>
					<td nowrap align="left"><div id="hoverItem_ff_div<?php 
            echo $row->id;
            ?>
"><a href="#edit" onmouseout="unhighlightElement(<?php 
            echo $i;
            ?>
)" onmouseover="highlightElement(<?php 
            echo $i;
            ?>
)" onclick="return listItemTask('cb<?php 
            echo $i;
            ?>
','edit')"><?php 
            echo $row->title;
            ?>
</a></div></td>
					<td nowrap align="left"><?php 
            echo $row->name;
            ?>
</td>
					<td nowrap align="left"><?php 
            echo HTML_facileFormsElement::displayType($row->type);
            ?>
</td>
					<td nowrap align="center">
<?php 
            if ($row->published == "1") {
                echo "<a href=\"#unpublish\" onClick=\"return listItemTask('cb" . $i . "','unpublish')\"><img src=\"components/com_breezingforms/images/icons/publish_g.png\" alt=\"+\" border=\"0\" /></a>";
            } else {
                echo "<a href=\"#publish\" onClick=\"return listItemTask('cb" . $i . "','publish')\"><img src=\"components/com_breezingforms/images/icons/publish_x.png\" alt=\"-\" border=\"0\" /></a>";
            }
            // if
            ?>
					</td>
					<td nowrap align="right">
<?php 
            if ($i > 0) {
                echo "<a href=\"#orderup\" onClick=\"return listItemTask('cb" . $i . "','orderup')\"><img src=\"components/com_breezingforms/images/icons/uparrow.png\" alt=\"^\" border=\"0\" /></a>";
            }
            ?>
					</td>
					<td nowrap align="left">
<?php 
            if ($i < count($rows) - 1) {
                echo "<a href=\"#orderdown\" onClick=\"return listItemTask('cb" . $i . "','orderdown')\"><img src=\"components/com_breezingforms/images/icons/downarrow.png\" alt=\"v\" border=\"0\" /></a>";
            }
            ?>
					</td>
					<td nowrap align="right"><?php 
            echo $row->posx;
            if ($row->posxmode) {
                echo '%';
            } else {
                echo 'px';
            }
            ?>
</td>
					<td nowrap align="right"><?php 
            echo $row->posy;
            if ($row->posymode) {
                echo '%';
            } else {
                echo 'px';
            }
            ?>
</td>
					<td nowrap align="right"><?php 
            echo $row->id;
            ?>
</td>
					<td></td>
				</tr>
<?php 
            $k = 1 - $k;
        }
        // for
        ?>
			</table>
			
<?php 
        if ($form->prevmode > 0) {
            if ($form->prevmode == 1) {
                ?>
			<br /> <br />
<?php 
            } else {
                ?>
			<script type="text/javascript" src="<?php 
                echo JURI::root() . 'administrator/components/com_breezingforms/libraries/wz_dragdrop/wz_dragdrop.js';
                ?>
"></script>
			<!-- BEGIN OF SURFACE -->
			<div id="SelectOptionDialog" style="background-color: #cccccc;position:absolute;top:233px;right:15px;z-index:100;">
<?php 
            }
            ?>
			<table cellpadding="4" cellspacing="1" border="0" class="adminform" style="width:100%;">
				<tr><th colspan="2" class="title">BreezingForms - <?php 
            echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGELAY');
            ?>
</th></tr>
				<tr>
					<td colspan="2">
						<table class="menubar" cellpadding="3" cellspacing="0" border="0">
							<tr><td nowrap class="menudottedline" align="right">


                                                                <input class="btn btn-warning" onclick="submitbutton('addbefore');" type="submit" value="<?php 
            echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_ADDPAGEBEFORE'), ENT_QUOTES, 'UTF-8');
            ?>
"/>
                                                                &nbsp;&nbsp;
                                                                <input class="btn btn-warning" onclick="submitbutton('addbehind');" type="submit" value="<?php 
            echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_ADDPAGEBEHIND'), ENT_QUOTES, 'UTF-8');
            ?>
"/>
<?php 
            if ($form->pages > 1) {
                ?>
                                                                        &nbsp;&nbsp;<input class="btn btn-primary" onclick="submitbutton('movepage');" type="submit" value="<?php 
                echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_MOVEPG'), ENT_QUOTES, 'UTF-8');
                ?>
"/>
                                                                        &nbsp;&nbsp;<input class="btn btn-primary" onclick="submitbutton('delpage');" type="submit" value="<?php 
                echo htmlentities(BFText::_('COM_BREEZINGFORMS_ELEMENTS_DELPAGE'), ENT_QUOTES, 'UTF-8');
                ?>
"/>

<?php 
            }
            // if
            ?>
							</td></tr>
						</table>
					</td>
				</tr>
				<tr>
					<td valign="top">
						<table class="menubar" cellpadding="0" cellspacing="0" border="0">
							<tr>
								<td nowrap colspan="5" style="text-align:center">
								    <?php 
            if ($form->prevmode == 2) {
                ?>
									    <?php 
                echo BFText::_('COM_BREEZINGFORMS_DRAGGING');
                ?>
 <br/> <?php 
                echo BFText::_('COM_BREEZINGFORMS_DRAGGING_ON');
                ?>
 <input type="radio" id="draggingEnabled" name="dragToggle" onclick="dd.elements.SelectOptionDialog.setDraggable(true);"/> <?php 
                echo BFText::_('COM_BREEZINGFORMS_DRAGGING_OFF');
                ?>
 <input id="draggingDisabled" checked type="radio" name="dragToggle" onclick="dd.elements.SelectOptionDialog.setDraggable(false);"/>
										<br/>
									<?php 
            }
            ?>
									<input type="checkbox" id="gridshow" name="gridshow" onclick="submitbutton('gridshow');" value="1"<?php 
            if ($ff_config->gridshow == 1) {
                echo ' checked="checked"';
            }
            ?>
 /><label for="gridshow"> <?php 
            echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_GRID');
            ?>
</label>
									<hr/>
								</td>
							</tr>
							<tr>
								<td nowrap colspan="5" style="text-align:center">
									<?php 
            echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_MOVEPIX');
            ?>
:<br/>
									<input type="text" size="6" maxlength="6" id="id_movepixels" name="movepixels" value="<?php 
            echo is_int($ff_config->movepixels) ? is_int($ff_config->movepixels) : 5;
            ?>
" class="inputbox"/>
									<br/>
								</td>
							</tr>
							<tr>
								<td></td>
								<td></td>
                                                                <td align="center">
									<a href="javascript:moveElements('up');">
										<img src="<?php 
            echo $ff_admicon;
            ?>
/moveup_f2.png" width="16" height="16" alt="up" name="moveup" border="0" align="middle" />
									</a>
								</td>
								<td></td>
								<td></td>
							</tr>
							<tr>
								<td></td>
								<td>
									<a href="javascript:moveElements('left');">
										<img src="<?php 
            echo $ff_admicon;
            ?>
/movelt_f2.png" width="16" height="16" alt="left" name="moveleft" border="0" align="middle" />
									</a>
								</td>
								<td></td>
								<td align="right">
									<a href="javascript:moveElements('right');">
										<img src="<?php 
            echo $ff_admicon;
            ?>
/movert_f2.png" width="16" height="16" alt="right" name="moveright" border="0" align="middle" />
									</a>
								</td>
								<td></td>
							</tr>
							<tr>
								<td></td>
								<td></td>
								<td align="center">
									<a href="javascript:moveElements('down');">
										<img src="<?php 
            echo $ff_admicon;
            ?>
/movedn_f2.png" width="16" height="16" alt="down" name="movedown" border="0" align="middle" />
									</a>
								</td>
								<td></td>
								<td><hr/></td>
							</tr>
							<tr>
								<td colspan="5" style="text-align:center">
									<input class="btn btn-primary" id="savepos" type="button" value="<?php 
            echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_SAVE');
            ?>
" onclick="savePositions();" disabled="disabled"/><br/>
									<hr/>
                                                                        <input class="btn btn-primary" id="restpos" type="button" value="<?php 
            echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_RESTORE');
            ?>
" onclick="restorePositions();" disabled="disabled"/>
									<hr/>
								</td>
							</tr>
							<tr>
								<td colspan="5" style="text-align:center">
<?php 
            for ($p = 1; $p <= $form->pages; $p++) {
                $attribute = '';
                if ($p == $page) {
                    $attribute = 'disabled="disabled"';
                }
                echo '<input class="btn btn-primary" type="button" value="' . BFText::_('COM_BREEZINGFORMS_ELEMENTS_PAGE') . ' ' . $p . '" onclick="changepage(\'' . $p . '\');" ' . $attribute . '/><br/>';
            }
            // for
            ?>
								</td>
							</tr>
						</table>
					</td>
					<td align="center">
<?php 
            if ($ff_config->stylesheet) {
                // compose iframe url
                $url = $ff_mossite . 'index.php' . '?option=com_breezingforms' . '&amp;tmpl=component' . '&amp;Itemid=0' . '&amp;ff_form=' . $form->id . '&amp;ff_frame=1' . '&amp;ff_runmode=' . _FF_RUNMODE_PREVIEW . '&amp;ff_page=' . $page;
                reset($ff_request);
                while (list($prop, $val) = each($ff_request)) {
                    $url .= '&amp;' . $prop . '=' . urlencode($val);
                }
                // prepare iframe width
                $framewidth = 'width="';
                if ($form->widthmode) {
                    $framewidth .= $form->prevwidth . '" ';
                } else {
                    $framewidth .= $form->width . '" ';
                }
                // prepare iframe height
                $frameheight = '';
                if (!$form->heightmode) {
                    $frameheight = 'height="' . $form->height . '" ';
                }
                // assemble iframe parameters
                $params = 'name="ff_prevframe" ' . 'id="ff_prevframe" ' . 'src="' . $url . '" ' . $framewidth . $frameheight . 'frameborder="0" ' . 'scrolling="no"';
                ?>
						<iframe <?php 
                echo $params;
                ?>
>
							<p><?php 
                echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BROWSER1');
                ?>
</p>
							<p><?php 
                echo BFText::_('COM_BREEZINGFORMS_ELEMENTS_BROWSER2');
                ?>
</p>
						</iframe>
<?php 
            } else {
                $tstyle = ' style="';
                $dstyle = '';
                if ($form->widthmode) {
                    $tstyle .= 'width:' . $form->prevwidth . 'px;';
                } else {
                    $tstyle .= 'width:' . $form->width . 'px;';
                    $dstyle .= 'width:' . $form->width . 'px;';
                }
                // else
                if (!$form->heightmode) {
                    $tstyle .= 'height:' . $form->height . 'px;';
                    $dstyle .= 'height:' . $form->height . 'px;';
                }
                // if
                $tstyle .= '"';
                ?>
						<table cellpadding="0" cellspacing="0" border="0"<?php 
                echo $tstyle;
                ?>
>
							<tr><td>
								<div style="position:relative;left:0px;top:0px;<?php 
                echo $dstyle;
                ?>
">
<?php 
                $myUser = JFactory::getUser();
                $database->setQuery("select id from #__users where lower(username)=lower('" . $myUser->get('username', '') . "')");
                $id = $database->loadResult();
                if ($id) {
                    $myUser->get('id', -1);
                }
                $curdir = getcwd();
                chdir($ff_mospath);
                $ff_processor = new HTML_facileFormsProcessor(_FF_RUNMODE_PREVIEW, false, $form->id, $page, $option);
                if ($prevmode == 'submit') {
                    $ff_processor->submit();
                } else {
                    $ff_processor->view();
                }
                chdir($curdir);
                ?>
								</div>
							</td></tr>
						</table>
<?php 
            }
            // if
            ?>
					</td>
				</tr>
			</table>
			
<?php 
            if ($form->prevmode == 2) {
                ?>
			</div>
			
			<script type="text/javascript">
			<!--
			SET_DHTML('SelectOptionDialog');
			dd.elements.SelectOptionDialog.setDraggable(false);
			//-->
			</script>
			
			<input type="hidden" id="ff_itemPositions" name="ff_itemPositions" value=""/>
			
<?php 
            }
            // if
        }
        // if $form->prevmode > 0
        ?>

			<input type="hidden" name="boxchecked" value="<?php 
        echo $boxchecked;
        ?>
" />
			<input type="hidden" name="pkg" value="<?php 
        echo $pkg;
        ?>
" />
			<input type="hidden" name="option" value="<?php 
        echo $option;
        ?>
" />
			<input type="hidden" name="act" value="editpage" />
			<input type="hidden" name="task" value="" />
			<input type="hidden" name="form" value="<?php 
        echo $form->id;
        ?>
" />
			<input type="hidden" name="page" value="<?php 
        echo $page;
        ?>
" />
			<input type="hidden" name="movepositions" value="" />
		</form>
<?php 
    }