Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…912cdd6b-5c7d-d5a7-a2ba-d0f0cdb91641
  • Loading branch information
juliantenney committed Oct 19, 2011
1 parent 2465c87 commit f2adccf
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 41 deletions.
6 changes: 5 additions & 1 deletion config.php
Expand Up @@ -21,7 +21,7 @@

// Change this to FALSE for production sites.
global $development;
$development = true;
$development = false;

ini_set('error_reporting', 0);
if($development) {
Expand Down Expand Up @@ -54,6 +54,10 @@ function _debug($string) {
require_once(dirname(__FILE__) . '/website_code/php/database_library.php');

$row = db_query_one("SELECT * FROM {$xerte_toolkits_site->database_table_prefix}sitedetails");

if(!$row) {
die("Error talking to database; perhaps it is offline?");
}
/**
* Access the database to get the variables
* @version 1.0
Expand Down
77 changes: 37 additions & 40 deletions website_code/php/management/templates.php
@@ -1,73 +1,70 @@
<?
<?php

require("../../../config.php");
require("../../../session.php");
require_once("../../../config.php");

require("../database_library.php");
require("../user_library.php");
require("../error_library.php");

if(is_user_admin()){

$database_id = database_connect("templates list connected","template list failed");

$query="select * from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails";
$database_id = database_connect("templates list connected","template list failed");

$query_response = mysql_query($query);
$query="select * from " . $xerte_toolkits_site->database_table_prefix . "originaltemplatesdetails";

echo "<p style=\"margin:5px\">Upload a template<br><form style=\"margin:5px\" method=\"post\" enctype=\"multipart/form-data\" id=\"importpopup\" name=\"importform\" target=\"upload_iframe\" action=\"website_code/php/import/import_template.php\" onsubmit=\"javascript:iframe_check_initialise();\"><input name=\"filenameuploaded\" type=\"file\" /><br /><input type=\"submit\" name=\"submitBtn\" value=\"Upload\" onsubmit=\"javascript:iframe_check_initialise()\" /></form></p>";
$query_response = mysql_query($query);

echo "<p style=\"margin:20px 0 0 5px\">Manage Existing templates</p>";
echo "<p style=\"margin:5px\">Upload a template<br><form style=\"margin:5px\" method=\"post\" enctype=\"multipart/form-data\" id=\"importpopup\" name=\"importform\" target=\"upload_iframe\" action=\"website_code/php/import/import_template.php\" onsubmit=\"javascript:iframe_check_initialise();\"><input name=\"filenameuploaded\" type=\"file\" /><br /><input type=\"submit\" name=\"submitBtn\" value=\"Upload\" onsubmit=\"javascript:iframe_check_initialise()\" /></form></p>";

while($row = mysql_fetch_array($query_response)){
echo "<p style=\"margin:20px 0 0 5px\">Manage Existing templates</p>";

echo "<div class=\"template\" id=\"" . $row['template_name'] . "\" savevalue=\"" . $row['template_type_id'] . "\"><p>" . $row['template_name'] . " <a href=\"javascript:templates_display('" . $row['template_name'] . "')\">View</a></p></div><div class=\"template_details\" id=\"" . $row['template_name'] . "_child\">";
echo "<p>This template is of type " . $row['template_framework'] . "</p>";
while($row = mysql_fetch_array($query_response)){

if($row['template_framework']=="xerte"){
echo "<div class=\"template\" id=\"" . $row['template_name'] . "\" savevalue=\"" . $row['template_type_id'] . "\"><p>" . $row['template_name'] . " <a href=\"javascript:templates_display('" . $row['template_name'] . "')\">View</a></p></div><div class=\"template_details\" id=\"" . $row['template_name'] . "_child\">";
echo "<p>This template is of type " . $row['template_framework'] . "</p>";

$template_check = file_get_contents($xerte_toolkits_site->root_file_path . $xerte_toolkits_site->module_path . "xerte/parent_templates/" . $row['template_name'] . "/" . $row['template_name'] . ".rlt");
if($row['template_framework']=="xerte"){

$folder = explode('"',substr($template_check,strpos($template_check,"targetFolder"),strpos($template_check,"version")-strpos($template_check,"targetFolder")));
$template_check = file_get_contents($xerte_toolkits_site->root_file_path . $xerte_toolkits_site->module_path . "xerte/parent_templates/" . $row['template_name'] . "/" . $row['template_name'] . ".rlt");

$start_point = strpos($template_check,"version");
$folder = explode('"',substr($template_check,strpos($template_check,"targetFolder"),strpos($template_check,"version")-strpos($template_check,"targetFolder")));

$version = explode('"',substr($template_check,$start_point,strpos($template_check," ",$start_point)-$start_point));
$start_point = strpos($template_check,"version");

echo "<p>This template is version number " . $version[1] . "</p>";
$version = explode('"',substr($template_check,$start_point,strpos($template_check," ",$start_point)-$start_point));

}
echo "<p>This template is version number " . $version[1] . "</p>";

echo "<p>The description for this template is <form><textarea id=\"" . $row['template_type_id'] . "desc\">" . $row['description'] . "</textarea></form></p>";
echo "<p>This template was uploaded on " . $row['date_uploaded'] . "</p>";
echo "<p>The template has the following name for users<form><textarea id=\"" . $row['template_type_id'] . "display\">" . $row['display_name'] . "</textarea></form></p>";
echo "<p>The template has the following example (0 means no example)<form><textarea id=\"" . $row['template_type_id'] . "example\">" .$row['display_id'] . "</textarea></form></p>";
echo "<p>The following users can access this template (* means everyone)<form><textarea id=\"" . $row['template_type_id'] . "access\">" .$row['access_rights'] . "</textarea></form></p>";
echo "<p>The date uploaded for this template is (altering this affects the order they are displayed / most recent first ) - <form><textarea id=\"" . $row['template_type_id'] . "_date_uploaded\">" . $row['date_uploaded'] . "</textarea></form></p>";
echo "<p>This template is currently set as ";
}

echo "<select ";
echo "<p>The description for this template is <form><textarea id=\"" . $row['template_type_id'] . "desc\">" . $row['description'] . "</textarea></form></p>";
echo "<p>This template was uploaded on " . $row['date_uploaded'] . "</p>";
echo "<p>The template has the following name for users<form><textarea id=\"" . $row['template_type_id'] . "display\">" . $row['display_name'] . "</textarea></form></p>";
echo "<p>The template has the following example (0 means no example)<form><textarea id=\"" . $row['template_type_id'] . "example\">" .$row['display_id'] . "</textarea></form></p>";
echo "<p>The following users can access this template (* means everyone)<form><textarea id=\"" . $row['template_type_id'] . "access\">" .$row['access_rights'] . "</textarea></form></p>";
echo "<p>The date uploaded for this template is (altering this affects the order they are displayed / most recent first ) - <form><textarea id=\"" . $row['template_type_id'] . "_date_uploaded\">" . $row['date_uploaded'] . "</textarea></form></p>";
echo "<p>This template is currently set as ";

if($row['active']=="0"){
echo "<select ";

echo " SelectedItem=\"true\" name=\"type\" id=\"" . $row['template_type_id'] . "active\" ><option value=\"true\">Active</option><option value=\"false\" selected=\"selected\">Unactive</option></select></p>";
if($row['active']=="0"){

}else{
echo " SelectedItem=\"true\" name=\"type\" id=\"" . $row['template_type_id'] . "active\" ><option value=\"true\">Active</option><option value=\"false\" selected=\"selected\">Unactive</option></select></p>";

echo " SelectedItem=\"true\" name=\"type\" id=\"" . $row['template_type_id'] . "active\" ><option value=\"true\" selected=\"selected\">Active</option><option value=\"false\">Unactive</option></select></p>";
}else{

}
echo " SelectedItem=\"true\" name=\"type\" id=\"" . $row['template_type_id'] . "active\" ><option value=\"true\" selected=\"selected\">Active</option><option value=\"false\">Unactive</option></select></p>";

echo "<p>Upload a new version of this template<br><form method=\"post\" enctype=\"multipart/form-data\" id=\"importpopup\" name=\"importform\" target=\"upload_iframe\" action=\"website_code/php/import/import_template.php\" onsubmit=\"javascript:iframe_check_initialise();\"><input name=\"filenameuploaded\" type=\"file\" /><br /><input type=\"hidden\" name=\"replace\" value=\"" . $row['template_type_id'] . "\" /><input type=\"hidden\" name=\"folder\" value=\"" . $row['template_name'] . "\" /><input type=\"hidden\" name=\"version\" value=\"" . $version[1] . "\" /><input type=\"submit\" name=\"submitBtn\" value=\"Upload\" onsubmit=\"javascript:iframe_check_initialise()\" /></form></p>";
}

echo "</div>";
echo "<p>Upload a new version of this template<br><form method=\"post\" enctype=\"multipart/form-data\" id=\"importpopup\" name=\"importform\" target=\"upload_iframe\" action=\"website_code/php/import/import_template.php\" onsubmit=\"javascript:iframe_check_initialise();\"><input name=\"filenameuploaded\" type=\"file\" /><br /><input type=\"hidden\" name=\"replace\" value=\"" . $row['template_type_id'] . "\" /><input type=\"hidden\" name=\"folder\" value=\"" . $row['template_name'] . "\" /><input type=\"hidden\" name=\"version\" value=\"" . $version[1] . "\" /><input type=\"submit\" name=\"submitBtn\" value=\"Upload\" onsubmit=\"javascript:iframe_check_initialise()\" /></form></p>";

echo "</div>";

}

}

}else{

echo "the feature is for administrators only";
echo "the feature is for administrators only";

}

?>
?>

0 comments on commit f2adccf

Please sign in to comment.