Explorar o código

Move the old version of templates to trunk/apps

Mark Crane %!s(int64=13) %!d(string=hai) anos
pai
achega
011189de78

+ 50 - 0
templates/root.php

@@ -0,0 +1,50 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+
+// make sure the PATH_SEPARATOR is defined
+	if (!defined("PATH_SEPARATOR")) {
+		if ( strpos( $_ENV[ "OS" ], "Win" ) !== false ) { define("PATH_SEPARATOR", ";"); } else { define("PATH_SEPARATOR", ":"); }
+	}
+
+// make sure the document_root is set
+	$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", "/", $_SERVER["SCRIPT_FILENAME"]);
+	$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
+	$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
+	//echo "DOCUMENT_ROOT: ".$_SERVER["DOCUMENT_ROOT"]."<br />\n";
+	//echo "PHP_SELF: ".$_SERVER["PHP_SELF"]."<br />\n";
+	//echo "SCRIPT_FILENAME: ".$_SERVER["SCRIPT_FILENAME"]."<br />\n";
+
+// if the project directory exists then add it to the include path otherwise add the document root to the include path
+	if (is_dir($_SERVER["DOCUMENT_ROOT"].'/fusionpbx')){
+		define('PROJECT_PATH', '/fusionpbx');
+		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER["DOCUMENT_ROOT"].'/fusionpbx' );
+	}
+	else {
+		define('PROJECT_PATH', '');
+		set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] );
+	}
+
+?>

+ 138 - 0
templates/template_restore_default.php

@@ -0,0 +1,138 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+include "root.php";
+require_once "includes/config.php";
+require_once "includes/checkauth.php";
+
+if (ifgroup("superadmin")) {
+	//access granted
+}
+else {
+	echo "access denied";
+	return;
+}
+
+//remove the old menu
+	$sql  = "delete from v_templates ";
+	$sql .= "where v_id = '$v_id' and templatename = 'default' ";
+	$sql .= "or v_id = '$v_id' and templatename = 'horizontal' ";
+	//echo $sql;
+	$db->exec(check_sql($sql));
+
+//load the default database into a sqlite memory database
+		$filename = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/includes/install/sql/sqlite.sql';
+		$file_contents = file_get_contents($filename);
+		unset($filename);
+		try {
+			//$db_default = new PDO('sqlite:'.$dbfilepath.'/'.$dbfilename); //sqlite 3
+			$db_default = new PDO('sqlite::memory:'); //sqlite 3
+			//$db_default->beginTransaction();
+		}
+		catch (PDOException $error) {
+			print "error: " . $error->getMessage() . "<br/>";
+			die();
+		}
+
+		//replace \r\n with \n then explode on \n
+			$file_contents = str_replace("\r\n", "\n", $file_contents);
+
+		//loop line by line through all the lines of sql code
+			$stringarray = explode("\n", $file_contents);
+			$x = 0;
+			foreach($stringarray as $sql) {
+				try {
+					$db_default->query($sql);
+				}
+				catch (PDOException $error) {
+					echo "error: " . $error->getMessage() . " sql: $sql<br/>";
+					//die();
+				}
+				$x++;
+			}
+			unset ($file_contents, $sql);
+			//$db_default->commit();
+
+//load the default menu into an array
+	$sql = "";
+	$sql .= "select * from v_templates ";
+	$sql .= "where v_id = '$v_id' ";
+	$prepstatement = $db_default->prepare(check_sql($sql));
+	$prepstatement->execute();
+	$menu_array = $prepstatement->fetchAll();
+
+//use the menu array to restore the default menu
+	foreach ($menu_array as &$row) {
+		$templateid = $row["templateid"];
+		$templatelanguage = $row["templatelanguage"];
+		$templatename = $row["templatename"];
+		$templatedesc = $row["templatedesc"];
+		$template = $row["template"];
+		$templatemenutype = $row["templatemenutype"];
+		$templatemenucss = $row["templatemenucss"];
+		$template_default = $row["template_default"];
+
+		//insert the defaul menu into the database
+			$sql = "insert into v_templates ";
+			$sql .= "(";
+			$sql .= "v_id, ";
+			$sql .= "templateid, ";
+			$sql .= "templatelanguage, ";
+			$sql .= "templatename, ";
+			$sql .= "templatedesc, ";
+			$sql .= "template, ";
+			$sql .= "templatemenutype, ";
+			$sql .= "templatemenucss, ";
+			$sql .= "template_default ";
+			$sql .= ")";
+			$sql .= "values ";
+			$sql .= "(";
+			$sql .= "'$v_id', ";
+			$sql .= "'$templateid', "; 
+			$sql .= "'$templatelanguage', ";
+			$sql .= "'$templatename', ";
+			$sql .= "'$templatedesc', ";
+			$sql .= "'$template', ";
+			$sql .= "'$templatemenutype', ";
+			$sql .= "'$templatemenucss', ";
+			$sql .= "'$template_default' ";
+			$sql .= ")";
+			$db->exec(check_sql($sql));
+			unset($sql);
+
+	}
+
+	//restore the default theme files
+		//place holder
+
+	require_once "includes/header.php";
+	echo "<meta http-equiv=\"refresh\" content=\"2;url=templates.php\">\n";
+	echo "<div align='center'>\n";
+	echo "Restore Complete\n";
+	echo "</div>\n";
+	require_once "includes/footer.php";
+	return;
+
+?>

+ 158 - 0
templates/templates.php

@@ -0,0 +1,158 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+include "root.php";
+require_once "includes/config.php";
+require_once "includes/checkauth.php";
+if (!ifgroup("superadmin")) {
+	echo "access denied";
+	exit;
+}
+
+require_once "includes/header.php";
+require_once "includes/paging.php";
+
+$orderby = $_GET["orderby"];
+$order = $_GET["order"];
+
+
+	echo "<div align='center'>";
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='2'>\n";
+
+	echo "<tr class='border'>\n";
+	echo "	<td align=\"center\">\n";
+	echo "		<br>";
+
+
+	echo "<table width='100%' border='0'><tr>\n";
+	echo "<td width='50%' align='left' nowrap><b>Template List</b></td>\n";
+	echo "<td width='50%' align='right'>\n";
+	echo "	<input type='button' class='btn' value='Restore Default' onclick=\"document.location.href='template_restore_default.php';\" />";
+	echo "</td>\n";
+	echo "<td width='35' nowrap></td>\n";
+	echo "</tr></table>";
+
+
+	$sql = "";
+	$sql .= "select * from v_templates ";
+	$sql .= "where v_id = '$v_id' ";
+	if (strlen($orderby)> 0) { $sql .= "order by $orderby $order "; }
+	$prepstatement = $db->prepare(check_sql($sql));
+	$prepstatement->execute();
+	$result = $prepstatement->fetchAll();
+	$numrows = count($result);
+	unset ($prepstatement, $result, $sql);
+
+	$rowsperpage = 10;
+	$param = "";
+	$page = $_GET['page'];
+	if (strlen($page) == 0) { $page = 0; $_GET['page'] = 0; } 
+	list($pagingcontrols, $rowsperpage, $var3) = paging($numrows, $param, $rowsperpage); 
+	$offset = $rowsperpage * $page; 
+
+	$sql = "";
+	$sql .= "select * from v_templates ";
+	$sql .= "where v_id = '$v_id' ";
+	if (strlen($orderby)> 0) { $sql .= "order by $orderby $order "; }
+	$sql .= " limit $rowsperpage offset $offset ";
+	$prepstatement = $db->prepare(check_sql($sql));
+	$prepstatement->execute();
+	$result = $prepstatement->fetchAll();
+	$resultcount = count($result);
+	unset ($prepstatement, $sql);
+
+	$c = 0;
+	$rowstyle["0"] = "rowstyle0";
+	$rowstyle["1"] = "rowstyle1";
+
+	echo "<div align='center'>\n";
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+
+	echo "<tr>\n";
+	echo thorderby('templatename', 'Name', $orderby, $order);
+	echo thorderby('templatedesc', 'Description', $orderby, $order);
+	echo "<td align='right' width='42'>\n";
+	echo "	<a href='templates_edit.php' alt='add'>$v_link_label_add</a>\n";
+	//echo "	<input type='button' class='btn' name='' alt='add' onclick=\"window.location='templates_edit.php'\" value='+'>\n";
+	echo "</td>\n";
+	echo "<tr>\n";
+
+	if ($resultcount == 0) { //no results
+	}
+	else { //received results
+		foreach($result as $row) {
+			//print_r( $row );
+			echo "<tr >\n";
+			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[templatename]."&nbsp;</td>\n";
+			echo "	<td valign='top' class='".$rowstyle[$c]."'>".$row[templatedesc]."&nbsp;</td>\n";
+			echo "	<td valign='top' align='right'>\n";
+			echo "		<a href='templates_edit.php?id=".$row[templateid]."' alt='edit'>$v_link_label_edit</a>\n";
+			echo "		<a href='templates_delete.php?id=".$row[templateid]."' alt='delete' onclick=\"return confirm('Do you really want to delete this?')\">$v_link_label_delete</a>\n";
+			//echo "		<input type='button' class='btn' name='' alt='edit' onclick=\"window.location='templates_edit.php?id=".$row[template_id]."'\" value='e'>\n";
+			//echo "		<input type='button' class='btn' name='' alt='delete' onclick=\"if (confirm('Are you sure you want to delete this?')) { window.location='templates_delete.php?id=".$row[template_id]."' }\" value='x'>\n";
+			echo "	</td>\n";
+			echo "</tr>\n";
+			if ($c==0) { $c=1; } else { $c=0; }
+		} //end foreach
+		unset($sql, $result, $rowcount);
+	} //end if results
+
+
+	echo "<tr>\n";
+	echo "<td colspan='3' align='left'>\n";
+	echo "	<table width='100%' cellpadding='0' cellspacing='0'>\n";
+	echo "	<tr>\n";
+	echo "		<td width='33.3%' nowrap>&nbsp;</td>\n";
+	echo "		<td width='33.3%' align='center' nowrap>$pagingcontrols</td>\n";
+	echo "		<td width='33.3%' align='right'>\n";
+	echo "	<a href='templates_edit.php' alt='add'>$v_link_label_add</a>\n";
+	//echo "			<input type='button' class='btn' name='' alt='add' onclick=\"window.location='templates_edit.php'\" value='+'>\n";
+	echo "		</td>\n";
+	echo "	</tr>\n";
+ 	echo "	</table>\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+
+	echo "</table>";
+	echo "</div>";
+	echo "<br><br>";
+	echo "<br><br>";
+
+
+	echo "</td>";
+	echo "</tr>";
+	echo "</table>";
+	echo "</div>";
+	echo "<br><br>";
+
+
+require_once "includes/footer.php";
+unset ($resultcount);
+unset ($result);
+unset ($key);
+unset ($val);
+unset ($c);
+?>

+ 58 - 0
templates/templates_delete.php

@@ -0,0 +1,58 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+include "root.php";
+require_once "includes/config.php";
+require_once "includes/checkauth.php";
+if (!ifgroup("superadmin")) {
+	echo "access denied";
+	exit;
+}
+
+if (count($_GET)>0) {
+	$id = $_GET["id"];
+}
+
+if (strlen($id)>0) {
+	$sql = "";
+	$sql .= "delete from v_templates ";
+	$sql .= "where v_id = '$v_id' ";
+	$sql .= "and templateid = '$id' ";
+	$prepstatement = $db->prepare(check_sql($sql));
+	$prepstatement->execute();
+	unset($sql);
+}
+
+require_once "includes/header.php";
+echo "<meta http-equiv=\"refresh\" content=\"2;url=templates.php\">\n";
+echo "<div align='center'>\n";
+echo "Delete Complete\n";
+echo "</div>\n";
+
+require_once "includes/footer.php";
+return;
+
+?>
+

+ 359 - 0
templates/templates_edit.php

@@ -0,0 +1,359 @@
+<?php
+/*
+	FusionPBX
+	Version: MPL 1.1
+
+	The contents of this file are subject to the Mozilla Public License Version
+	1.1 (the "License"); you may not use this file except in compliance with
+	the License. You may obtain a copy of the License at
+	http://www.mozilla.org/MPL/
+
+	Software distributed under the License is distributed on an "AS IS" basis,
+	WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+	for the specific language governing rights and limitations under the
+	License.
+
+	The Original Code is FusionPBX
+
+	The Initial Developer of the Original Code is
+	Mark J Crane <[email protected]>
+	Portions created by the Initial Developer are Copyright (C) 2008-2010
+	the Initial Developer. All Rights Reserved.
+
+	Contributor(s):
+	Mark J Crane <[email protected]>
+*/
+include "root.php";
+require_once "includes/config.php";
+require_once "includes/checkauth.php";
+if (!ifgroup("superadmin")) {
+	echo "access denied";
+	exit;
+}
+
+//action add or update
+if (isset($_REQUEST["id"])) {
+	$action = "update";
+	$template_id = check_str($_REQUEST["id"]);
+}
+else {
+	$action = "add";
+}
+
+//POST to PHP variables
+if (count($_POST)>0) {
+	$templatename = check_str($_POST["templatename"]);
+	$templatedesc = check_str($_POST["templatedesc"]);
+	$template = $_POST["template"];
+	$templatemenutype = check_str($_POST["templatemenutype"]);
+	$templatemenucss = $_POST["templatemenucss"];
+}
+
+if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
+
+	$msg = '';
+
+	////recommend moving this to the config.php file
+	$uploadtempdir = $_ENV["TEMP"]."\\";
+	ini_set('upload_tmp_dir', $uploadtempdir);
+	////$imagedir = $_ENV["TEMP"]."\\";
+	////$filedir = $_ENV["TEMP"]."\\";
+
+	if ($action == "update") {
+		$template_id = check_str($_POST["template_id"]);
+	}
+
+	//check for all required data
+		//if (strlen($templatename) == 0) { $msg .= "Please provide: Name<br>\n"; }
+		//if (strlen($templatedesc) == 0) { $msg .= "Please provide: Description<br>\n"; }
+		//if (strlen($template) == 0) { $msg .= "Please provide: template<br>\n"; }
+		//if (strlen($templatemenutype) == 0) { $msg .= "Please provide: Menu Type<br>\n"; }
+		//if (strlen($templatemenucss) == 0) { $msg .= "Please provide: Menu CSS<br>\n"; }
+		if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
+			require_once "includes/header.php";
+			require_once "includes/persistformvar.php";
+			echo "<div align='center'>\n";
+			echo "<table><tr><td>\n";
+			echo $msg."<br />";
+			echo "</td></tr></table>\n";
+			persistformvar($_POST);
+			echo "</div>\n";
+			require_once "includes/footer.php";
+			return;
+		}
+
+	//$tmp = "\n";
+	//$tmp .= "Name: $templatename\n";
+	//$tmp .= "Description: $templatedesc\n";
+	//$tmp .= "template: $template\n";
+	//$tmp .= "Menu Type: $templatemenutype\n";
+	//$tmp .= "Menu CSS: $templatemenucss\n";
+
+
+//Add or update the database
+if ($_POST["persistformvar"] != "true") {
+	if ($action == "add") {
+		$sql = "insert into v_templates ";
+		$sql .= "(";
+		$sql .= "v_id, ";
+		$sql .= "templatename, ";
+		$sql .= "templatedesc, ";
+		$sql .= "template, ";
+		$sql .= "templatemenutype, ";
+		$sql .= "templatemenucss ";
+		$sql .= ")";
+		$sql .= "values ";
+		$sql .= "(";
+		$sql .= "'$v_id', ";
+		$sql .= "'$templatename', ";
+		$sql .= "'$templatedesc', ";
+		$sql .= "'".base64_encode($template)."', ";
+		$sql .= "'$templatemenutype', ";
+		$sql .= "'".base64_encode($templatemenucss)."' ";
+		$sql .= ")";
+		$db->exec(check_sql($sql));
+		unset($sql);
+
+		require_once "includes/header.php";
+		echo "<meta http-equiv=\"refresh\" content=\"2;url=templates.php\">\n";
+		echo "<div align='center'>\n";
+		echo "Add Complete\n";
+		echo "</div>\n";
+		require_once "includes/footer.php";
+		return;
+	} //if ($action == "add")
+
+	if ($action == "update") {
+		$sql = "update v_templates set ";
+		$sql .= "templatename = '$templatename', ";
+		$sql .= "templatedesc = '$templatedesc', ";
+		$sql .= "template = '".base64_encode($template)."', ";
+		$sql .= "templatemenutype = '$templatemenutype', ";
+		$sql .= "templatemenucss = '".base64_encode($templatemenucss)."' ";
+		$sql .= "where v_id = '$v_id'";
+		$sql .= "and templateid = '$template_id'";
+		$db->exec(check_sql($sql));
+		unset($sql);
+
+		require_once "includes/header.php";
+		echo "<meta http-equiv=\"refresh\" content=\"2;url=templates.php\">\n";
+		echo "<div align='center'>\n";
+		echo "Update Complete\n";
+		echo "</div>\n";
+		require_once "includes/footer.php";
+		return;
+	} //if ($action == "update")
+} //if ($_POST["persistformvar"] != "true") { 
+
+} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
+
+//Pre-populate the form
+if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
+	$template_id = $_GET["id"];
+	$sql = "";
+	$sql .= "select * from v_templates ";
+	$sql .= "where v_id = '$v_id' ";
+	$sql .= "and templateid = '$template_id' ";
+	$prepstatement = $db->prepare(check_sql($sql));
+	$prepstatement->execute();
+	$result = $prepstatement->fetchAll();
+	foreach ($result as &$row) {
+		$templatename = $row["templatename"];
+		$templatedesc = $row["templatedesc"];
+		$template = base64_decode($row["template"]);
+		$templatemenutype = $row["templatemenutype"];
+		$templatemenucss = base64_decode($row["templatemenucss"]);
+		break; //limit to 1 row
+	}
+	unset ($prepstatement);
+}
+
+
+	require_once "includes/header.php";
+
+
+	//--- Begin: Edit Area -----------------------------------------------------
+		echo "    <script language=\"javascript\" type=\"text/javascript\" src=\"".PROJECT_PATH."/includes/edit_area/edit_area_full.js\"></script>\n";
+		echo "    <!-- -->\n";
+
+		echo "	<script language=\"Javascript\" type=\"text/javascript\">\n";
+		echo "		editAreaLoader.init({\n";
+		echo "			id: \"template\" // id of the textarea to transform //, |, help\n";
+		echo "			,start_highlight: true\n";
+		echo "			,font_size: \"8\"\n";
+		echo "			,allow_toggle: false\n";
+		echo "			,language: \"en\"\n";
+		echo "			,syntax: \"html\"\n";
+		echo "			,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
+		echo "			,plugins: \"charmap\"\n";
+		echo "			,charmap_default: \"arrows\"\n";
+		echo "\n";
+		echo "    });\n";
+		echo "\n";
+		echo "\n";
+		echo "		editAreaLoader.init({\n";
+		echo "			id: \"templatemenucss\"	// id of the textarea to transform //, |, help\n";
+		echo "			,start_highlight: true\n";
+		echo "			,font_size: \"8\"\n";
+		echo "			,allow_toggle: false\n";
+		echo "			,language: \"en\"\n";
+		echo "			,syntax: \"css\"\n";
+		echo "			,toolbar: \"search, go_to_line,|, fullscreen, |, undo, redo, |, select_font, |, syntax_selection, |, change_smooth_selection, highlight, reset_highlight, |, help\" //new_document,\n";
+		echo "			,plugins: \"charmap\"\n";
+		echo "			,charmap_default: \"arrows\"\n";
+		echo "\n";
+		echo "    });\n";
+		echo "    </script>";
+	//--- End: Edit Area -------------------------------------------------------
+
+	echo "<div align='center'>";
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
+
+	echo "<tr class='border'>\n";
+	echo "	<td align=\"left\">\n";
+	echo "	  <br>";
+
+
+
+	echo "<form method='post' name='frm' action=''>\n";
+
+	echo "<div align='center'>\n";
+	echo "<table width='100%'  border='0' cellpadding='6' cellspacing='0'>\n";
+
+	echo "<tr>\n";
+	if ($action == "add") {
+		echo "<td width='30%' align='left' nowrap><b>Template Add</b></td>\n";
+	}
+	if ($action == "update") {
+		echo "<td width='30%' align='left' nowrap><b>Template Edit</b></td>\n";
+	}
+	echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='templates.php'\" value='Back'></td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncell' valign='top' align='left' nowrap>\n";
+	echo "	Name:\n";
+	echo "</td>\n";
+	echo "<td class='vtable' align='left'>\n";
+	echo "	<input class='formfld' type='text' name='templatename' maxlength='255' value=\"$templatename\">\n";
+	echo "<br />\n";
+	echo "\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncell' valign='top' align='left' nowrap>\n";
+	echo "	Description:\n";
+	echo "</td>\n";
+	echo "<td class='vtable' align='left'>\n";
+	echo "	<textarea class='formfld' name='templatedesc' rows='4'>$templatedesc</textarea>\n";
+	echo "<br />\n";
+	echo "\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncell' valign='top' align='left' nowrap>\n";
+	echo "	Template:\n";
+	echo "</td>\n";
+	echo "<td class='vtable' align='left'>\n";
+	echo "	<textarea name='template' id='template' rows='17' class='txt' wrap='off' >$template</textarea>\n";
+	echo "<br />\n";
+	echo "\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+
+	//echo "<tr>\n";
+	//echo "<td class='vncell' valign='top' align='left' nowrap>\n";
+	//echo "	Menu Type:\n";
+	//echo "</td>\n";
+	//echo "<td class='vtable' align='left'>\n";
+	//echo "	<input class='formfld' type='text' name='templatemenutype' maxlength='255' value=\"$templatemenutype\">\n";
+	//echo "            <select name=\"templatemenutype\" class='txt'>\n";
+	//echo "            <option value=\"\"></option>\n";
+	//if ($templatemenutype == "none") {
+	//	echo "            <option value=\"none\" selected>none</option>\n";
+	//}
+	//else {
+	//	echo "            <option value=\"none\">none</option>\n";
+	//}
+
+	//if ($templatemenutype == "horizontal") {
+	//	echo "            <option value=\"horizontal\" selected>horizontal</option>\n";
+	//}
+	//else {
+	//	echo "            <option value=\"horizontal\" selected>horizontal</option>\n";
+	//}
+
+	//if ($templatemenutype == "list") {
+	//	echo "            <option value=\"list\" >list</option>\n";
+	//}
+	//else {
+	//	echo "            <option value=\"list\">list</option>\n";
+	//}
+	//echo "            </select>";
+	//echo "<br />\n";
+	//echo "\n";
+	//echo "</td>\n";
+	//echo "</tr>\n";
+
+	echo "<tr>\n";
+	echo "<td class='vncell' valign='top' align='left' nowrap>\n";
+	echo "	Menu CSS:\n";
+	echo "</td>\n";
+	echo "<td class='vtable' align='left'>\n";
+	echo "	<textarea name='templatemenucss' id='templatemenucss' rows='17' class='txt' wrap='off'>$templatemenucss</textarea>\n";
+	echo "<br />\n";
+	echo "\n";
+	echo "</td>\n";
+	echo "</tr>\n";
+	echo "	<tr>\n";
+	echo "		<td colspan='2' align='right'>\n";
+	if ($action == "update") {
+		echo "				<input type='hidden' name='template_id' value='$template_id'>\n";
+	}
+	echo "				<input type='submit' name='submit' class='btn' value='Save'>\n";
+	echo "		</td>\n";
+	echo "	</tr>";
+
+	echo "	<tr>\n";
+	echo "	<td colspan='2' align='center'>\n";
+		echo "<table width='75%'><tr><td align='left'>\n";
+		echo "Each template should include the following tags. <br />\n";
+		echo "<br />";    
+
+		echo htmlentities("<!--{title}-->")."<br />Should be placed in between \n";
+		echo "the html &lt;title&gt;&lt;/title&gt; tags. Used to set a title on each page. \n";
+		echo "The title is defined in from the content manager title. <br />\n";
+		echo "<br />";		
+
+		echo htmlentities("<!--{head}-->")."<br />Should be placed in between \n";
+		echo "the html &lt;head&gt;&lt;/head&gt; tags. Used to place additional code when \n";
+		echo "necessary in the html head tags. For example rss feeds in some browsers are \n";
+		echo "required to be inside the html head tags.<br />\n";
+		echo "<br />";
+
+		echo htmlentities("<!--{body}-->")." &nbsp; &nbsp; <br />\n";
+		echo "Inidicates where the content should be placed inside the template. <br />\n";
+		echo "<br />";
+
+		echo htmlentities("<!--{menu}-->")." &nbsp; &nbsp; <br />\n";
+		echo "Indicates where the menu should go inside the template.<br />";
+		echo "<br />";
+
+		echo "</td></tr></table>\n";
+	echo "		</td>";
+	echo "	</tr>";
+
+	echo "</table>";
+	echo "</form>";
+
+
+	echo "	</td>";
+	echo "	</tr>";
+	echo "</table>";
+	echo "</div>";
+
+
+require_once "includes/footer.php";
+?>

+ 27 - 0
templates/v_config.php

@@ -0,0 +1,27 @@
+<?php
+	/*
+	//application details
+		$apps[$x]['name'] = "Templates";
+		$apps[$x]['guid'] = 'zzz';
+		$apps[$x]['category'] = '';
+		$apps[$x]['subcategory'] = '';
+		$apps[$x]['version'] = '';
+		$apps[$x]['license'] = 'Mozilla Public License 1.1';
+		$apps[$x]['url'] = 'http://www.fusionpbx.com';
+		$apps[$x]['description']['en'] = 'Deprecated.';
+
+	//menu details
+		$apps[$x]['menu'][0]['title']['en'] = 'Templates';
+		$apps[$x]['menu'][0]['guid'] = 'zzz';
+		$apps[$x]['menu'][0]['parent_guid'] = 'zzz';
+		$apps[$x]['menu'][0]['category'] = 'internal';
+		$apps[$x]['menu'][0]['path'] = '/mod/zzz/zzz.php';
+		$apps[$x]['menu'][0]['groups'][] = 'admin';
+		$apps[$x]['menu'][0]['groups'][] = 'superadmin';
+
+	//permission details
+		$apps[$x]['permissions'][0]['name'] = 'zzz';
+		$apps[$x]['permissions'][0]['groups'][] = 'admin';
+		$apps[$x]['permissions'][0]['groups'][] = 'superadmin';
+	*/
+?>