<?php if(Permission::model()->hasGlobalPermission('templates','delete')):?> <a class="btn btn-default" href="#" role="button" onclick='if (confirm("<?php eT("Are you sure you want to delete this template?", "js"); ?>")) window.open("<?php echo $this->createUrl('admin/templates/sa/delete/templatename/'.$templatename); ?>", "_top")'> <span class="glyphicon glyphicon-trash text-warning"></span> <?php eT("Delete"); ?> </a> <?php endif;?> <?php endif;?> </div> <!-- Right Menu --> <div class="col-md-7 text-right form-inline"> <div class="form-group"> <label for='templatedir'><?php eT("Template:"); ?></label> <select class="listboxtemplates form-control" id='templatedir' name='templatedir' onchange="javascript: window.open('<?php echo $this->createUrl("admin/templates/sa/view/editfile/".$editfile."/screenname/".$screenname); ?>/templatename/'+escape(this.value), '_top')"> <?php echo templateoptions($templates, $templatename); ?> </select> </div> <div class="form-group"> <label for='listboxtemplates'><?php eT("Screen:"); ?></label> <select class="listboxtemplates form-control" id='listboxtemplates' name='screenname' onchange="javascript: window.open('<?php echo $this->createUrl("admin/templates/sa/screenredirect/editfile/".$editfile."/templatename/".$templatename); ?>/screenname/'+escape(this.value), '_top')"> <?php echo makeoptions($screens, "id", "name", HTMLEscape($screenname) ); ?> </select> </div> <?php if(isset($fullpagebar['savebutton']['form'])):?> <a class="btn btn-success" href="#" role="button" id="save-form-button" data-form-id="<?php echo $fullpagebar['savebutton']['form']; ?>"> <span class="glyphicon glyphicon-ok" ></span> <?php eT("Save");?> </a>
} // while closedir($handle); } //**************************************************************** //** OUTPUT STARTS HERE //**************************************************************** $templatesoutput = "<script type=\"text/javascript\"> var adminlanguage='{$codelanguage}'; var highlighter='{$highlighter}'; </script>\n"; $templatesoutput .= "<script type='text/javascript'>\n" . "<!--\n" . "function copyprompt(text, defvalue, copydirectory, action)\n" . "\t{\n" . "\tif (newtemplatename=window.prompt(text, defvalue))\n" . "{\n" . "\tsendPost('admin.php','" . $_SESSION['checksessionpost'] . "',new Array('action','newname','copydir'),new Array('template'+action,newtemplatename,copydirectory));\n" . "}\n" . "\t}\n" . "function checkuploadfiletype(filename)\n" . "\t{\n" . "\tvar allowedtypes=',{$allowedtemplateuploads},';\n" . "\tvar lastdotpos=-1;\n" . "\tvar ext='';\n" . "\tif ((lastdotpos=filename.lastIndexOf('.')) < 0)\n" . "{\n" . "alert('" . $clang->gT('This file type is not allowed to be uploaded.', 'js') . "');\n" . "return false;\n" . "}\n" . "\telse\n" . "{\n" . "ext = ',' + filename.substr(lastdotpos+1) + ',';\n" . "ext = ext.toLowerCase();\n" . "if (allowedtypes.indexOf(ext) < 0)\n" . "\t{\n" . "\talert('" . $clang->gT('This file type is not allowed to be uploaded.', 'js') . "');\n" . "\treturn false;\n" . "\t}\n" . "else\n" . "\t{\n" . "\treturn true;\n" . "\t}\n" . "}\n" . "\t}\n" . "//-->\n</script>\n"; $templatesoutput .= "<div class='menubar'>\n" . "\t<div class='menubar-title ui-widget-header'>\n" . "\t<strong>" . $clang->gT('Template Editor') . "</strong>\n" . "</div>\n" . "\t<div class='menubar-main'>\n" . "\t<div class='menubar-left'>\n" . "\t<a href='{$scriptname}'" . " title=\"" . $clang->gTview("Return to survey administration") . "\">" . "<img src='{$imageurl}/home.png' name='HomeButton' alt='" . $clang->gT("Return to survey administration") . "' /></a>\n" . "\t<img src='{$imageurl}/blank.gif' alt='' width='60' height='10' />\n" . "\t<img src='{$imageurl}/seperator.gif' alt='' />"; if (isset($flashmessage)) { $templatesoutput .= '<span class="flashmessage">' . $flashmessage . '</span>'; } elseif (is_template_editable($templatename) == false) { $templatesoutput .= '<span class="flashmessage">' . sprintf($clang->gT('Note: This is a standard template. If you want to edit it %s please copy it first%s.'), "<a href='#' title=\"" . $clang->gT("Copy Template") . "\" " . "onclick=\"javascript: copyprompt('" . $clang->gT("Please enter the name for the copied template:") . "', '" . $clang->gT("copy_of_") . "{$templatename}', '{$templatename}', 'copy')\">", '</a>') . '</span>'; } $templatesoutput .= "</div>\n" . "\t<div class='menubar-right'>\n" . "<font style='boxcaption'><strong>" . $clang->gT("Template:") . "</strong> </font>" . "<select class=\"listboxtemplates\" name='templatedir' onchange='javascript: window.open(\"admin.php?action=templates&editfile={$editfile}&screenname=" . urlencode($screenname) . "&templatename=\"+escape(this.value), \"_top\")'>\n" . templateoptions($templates, $templatename) . "</select>\n" . "<a href='#' onclick=\"javascript: copyprompt('" . $clang->gT("Create new template called:") . "', '" . $clang->gT("NewTemplate") . "', 'default', 'copy')\"" . " title=\"" . $clang->gTview("Create new template") . "\" >" . "<img src='{$imageurl}/add.png' alt='" . $clang->gT("Create new template") . "' /></a>\n" . "<img src='{$imageurl}/seperator.gif' alt='' />" . "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=logout', '_top')\"" . " title=\"" . $clang->gTview("Logout") . "\" >" . "<img src='{$imageurl}/logout.png' name='Logout'" . " alt='" . $clang->gT("Logout") . "' /></a>" . "<img src='{$imageurl}/blank.gif' alt='' width='20' />" . "</div></div></div>\n" . "<font style='size:12px;line-height:2px;'> </font>"; //CSS Firefox 2 transition fix //TEMPLATE DETAILS $templatesoutput .= "\t<div class='menubar'>\n" . "<div class='menubar-title ui-widget-header'>\n" . "<strong>" . $clang->gT("Template:") . " <i>{$templatename}</i></strong>\n" . "</div>\n" . "<div class='menubar-main'>\n" . "<div class='menubar-left'>\n"; $templatesoutput .= "<img src='{$imageurl}/blank.gif' alt='' width='104' height='40'/>\n" . "\t<img src='{$imageurl}/seperator.gif' alt='' />\n"; if (!is_template_editable($templatename)) { $templatesoutput .= "<img name='RenameTemplate' src='{$imageurl}/edit_disabled.png' alt='" . $clang->gT("You can't rename a standard template.") . "' title='" . $clang->gTview("You can't rename a standard template.") . "'" . " />" . "<img name='EditName' src='{$imageurl}/delete_disabled.png' alt='" . $clang->gT("You can't delete a standard template.") . "' title='" . $clang->gTview("You can't delete a standard template.") . "'" . " />"; } else { $templatesoutput .= "<a href='#' title='" . $clang->gTview("Rename this template") . "' onclick=\"javascript: copyprompt('" . $clang->gT("Rename this template to:") . "', '{$templatename}', '{$templatename}', 'rename')\">" . "<img name='RenameTemplate' src='{$imageurl}/edit.png' alt='" . $clang->gT("Rename this template") . "'" . " /></a>"; $templatesoutput .= "<a href='#' title='" . $clang->gTview("Delete this template") . "'" . " onclick='if (confirm(\"" . $clang->gT("Are you sure you want to delete this template?", "js") . "\")) window.open(\"admin.php?action=templates&subaction=delete&templatename={$templatename}\", \"_top\")' >" . "<img name='DeleteTemplate' src='{$imageurl}/delete.png' alt='" . $clang->gT("Delete this template") . "' " . " /></a>"; } $templatesoutput .= "\t<img src='{$imageurl}/blank.gif' alt='' width='20' height='10' />\n"; if (is_writable($tempdir) && is_writable($usertemplaterootdir)) { $templatesoutput .= "\t<a href='#' onclick='javascript:window.open(\"admin.php?action=templatezip&editfile={$editfile}&screenname=" . urlencode($screenname) . "&templatename={$templatename}\", \"_top\")'" . " title=\"" . $clang->gTview("Export Template") . "\" >" . "<img name='Export' src='{$imageurl}/export.png' alt='" . $clang->gT("Export Template") . "' /></a>\n" . "<a href='#' onclick='javascript:window.open(\"admin.php?action=templates&subaction=templateupload\", \"_top\")'" . " title=\"" . $clang->gTview("Import template") . "\" >" . "<img name='ImportTemplate' src='{$imageurl}/import.png' alt='" . $clang->gT("Import template") . "' title='' /></a>\n" . "\t<img src='{$imageurl}/seperator.gif' alt='' border='0' />\n" . "<a href='#' title=\"" . $clang->gTview("Copy Template") . "\" " . "onclick=\"javascript: copyprompt('" . $clang->gT("Please enter the name for the copied template:") . "', '" . $clang->gT("copy_of_") . "{$templatename}', \t \t'{$templatename}', 'copy')\">" . "<img name='MakeCopy' src='{$imageurl}/copy.png' alt='" . $clang->gT("Copy Template") . "' /></a>"; } elseif (is_writable($usertemplaterootdir)) { $templatesoutput .= "<img name='Export' src='{$imageurl}/export_disabled.png' alt='" . $clang->gT("Export template") . ' - ' . sprintf($clang->gT("Please change the directory permissions of the folder %s in order to enable this option"), $tempdir) . "' />\n" . "<img name='ImportTemplate' src='{$imageurl}/import_disabled.png' alt='" . $clang->gT("Import template") . ' - ' . sprintf($clang->gT("Please change the directory permissions of the folder %s in order to enable this option"), $tempdir) . "' title='' />\n" . "\t<img src='{$imageurl}/seperator.gif' alt='' border='0' />\n" . "<a href='#' title=\"" . $clang->gTview("Copy Template") . "\" " . "onclick=\"javascript: copyprompt('" . $clang->gT("Please enter the name for the copied template:") . "', '" . $clang->gT("copy_of_") . "{$templatename}', '{$templatename}', 'copy')\">" . "<img name='MakeCopy' src='{$imageurl}/copy.png' alt='" . $clang->gT("Copy Template") . "' /></a>";