Beispiel #1
0
function installTemplate($str)
{
    global $sourceFolder;
    $len = strlen($str);
    $templateName = name($str, ".");
    if (substr($str, $len - 4, 4) == ".zip") {
        $zip = new ZipArchive();
        if ($zip->open($str) === TRUE) {
            $templatePath = $sourceFolder . "/uploads/templates/" . $templateName . "/";
            while (file_exists($templatePath)) {
                $templatePath = $sourceFolder . "/uploads/templates/" . rand() . "/";
            }
            $zip->extractTo($templatePath);
            $zip->close();
        } else {
            return array("1", $str);
        }
    } else {
        return array("2", $str);
    }
    $templateArray = "";
    $templates = getAvailableTemplates();
    foreach ($templates as $template) {
        $templateArray .= "'" . $template . "', ";
    }
    $templateArray = rtrim($templateArray, ", ");
    $templateActualPath = actualPath($templatePath);
    if ($templateActualPath == NULL) {
        return array("0", $str, $templatePath);
    }
    $call = "";
    $issueExcess = "";
    $ignoreall = "";
    $issues = "";
    $issuetypes = reportIssues($templateActualPath, $issues);
    if ($issues != "") {
        $issues = "\n\t <table name='issues_table'>\n\t <tr><th>S.No.</th><th>Issue Details</th><th>Issue Type</th><th>Ignore ?</th></tr>\n\t {$issues}\n\t </table>\n\t ";
    }
    if ($issuetypes[0] == 1) {
        //$issuetypes[0] is fatal and [1] is ignorable
        displayerror("Some fatal issues were found with the template. Please click on Cancel Installation button and fix the issues");
        $call = "2";
    }
    if ($issuetypes[0] == 0 && $issuetypes[1] == 1) {
        displaywarning("Some issues were found with the template. You may chose to ignore them.");
        $ignoreall = "<input type=button value='Ignore All' onClick='igall();'>";
        $issueExcess = <<<EXTRA
<script type="text/javascript">

function igall() {
\tvar id = 0;
\twhile(document.getElementById('issue_' + id))
\t\tignore(id++);
}
</script>
EXTRA;
    }
    global $ICONS;
    $RET = <<<RET
<script type="text/javascript">
function ignore(id) {
\tif(document.getElementById('button_' + id)) {
\t\tdocument.getElementById('issue_' + id).className = 'ignored';
\t\tdocument.getElementById('button_' + id).value = 'Ignored !';
\t\tdocument.getElementById('button_' + id).disabled = 'disabled';
\t}
}
function validate() {
\tvar id = 0;
\twhile(document.getElementById('issue_' + id)) {
\t\tif(document.getElementById('issue_' + id).className == 'issue') {
\t\t\talert("There are one or more issue(s) unresolved. Fix them and Submit.");
\t\t\treturn false;
\t\t}
\t\tid++;
\t}
\tvar templates = new Array('common',{$templateArray});
\tfor(template in templates)
\t\tif(document.getElementById('templatename').value == templates[template]) {
\t\t\talert("Template with that name already exist in server. Choose some other name.");
\t\t\treturn false;
\t\t}
\treturn true;
}
function validate2() {
\talert("You have one or more required variable missing. So you can not submit the template. Hit cancel.");
\treturn false;
}
</script>

<fieldset>
<legend>{$ICONS['Templates Management']['small']}Finalize Template</legend>
{$issues}
{$ignoreall}
{$issueExcess}
<form method=POST action='./+admin&subaction=template&subsubaction=finalize' onSubmit='return validate{$call}()'>
Template Name: <input type=text id='templatename' name='template' value='{$templateName}'><input type=submit value="Install Template"><br/><br/>
The following template names are already used :<b> 'common', {$templateArray}</b><br/>
<input type=hidden name='path' value='{$templateActualPath}'>
<input type=hidden name='del' value='{$templatePath}'>
<input type=hidden name='file' value='{$str}'>

</form>
<form method=POST action='./+admin&subaction=template&subsubaction=cancel' onSubmit='myconfirm()'>
<input type=hidden name='path' value='{$templatePath}'>
<input type=hidden name='file' value='{$str}'>
<input type=submit value="Cancel Installation">
</form>
</fieldset>
RET;
    return $RET;
}
Beispiel #2
0
/**
 * Enter description here...
 *
 * @param string $folder
 * @return string
 */
function getAvailableTemplatesHTML($folder)
{
    $array = getAvailableTemplates($folder);
    $string = '';
    foreach ($array as $dir => $name) {
        $string .= '<option value="' . $dir . '">' . $name . '</option>';
    }
    return $string;
}
Beispiel #3
0
function templateSettingsForm()
{
    global $pageFullPath;
    global $CMSTEMPLATE;
    global $urlRequestRoot, $templateFolder, $cmsFolder;
    $globals = getGlobalSettings();
    foreach ($globals as $var => $val) {
        ${$var} = $val;
    }
    $templates = getAvailableTemplates();
    $allow_pagespecific_header = $allow_pagespecific_header == 0 ? "" : "checked";
    $allow_pagespecific_template = $allow_pagespecific_template == 0 ? "" : "checked";
    $globalform = <<<globalform
\t\t<table style="width:100%">
\t\t<tr>
\t\t<td>Default template :</td>
\t\t<td><select name='default_template'>
globalform;
    for ($i = 0; $i < count($templates); $i++) {
        if ($templates[$i] == DEF_TEMPLATE) {
            $globalform .= "<option value='" . $templates[$i] . "' selected >" . ucwords($templates[$i]) . "</option>";
        } else {
            $globalform .= "<option value='" . $templates[$i] . "' >" . ucwords($templates[$i]) . "</option>";
        }
    }
    $globalform .= <<<globalform
\t</select>
\t</td>
\t</tr>
\t<tr>
\t<td>Allow Page-specific Template ?</td>
\t<td><input name='allow_page_template' type='checkbox' {$allow_pagespecific_template}></td>
\t</tr>
\t<tr>
\t<td>Allow Page-specific Headers ?</td>
\t<td><input name='allow_page_header' type='checkbox' {$allow_pagespecific_header}></td>
\t</tr>
\t
\t<tr>
\t<td>Show Breadcrumbs Submenu ?</td>
\t<td><input name='breadcrumb_submenu' type='checkbox' {$breadcrumb_submenu}></td>
\t</tr>
\t</table>
globalform;
    return $globalform;
}
Beispiel #4
0
/**
 * Generate HTML for a form to help edit settings for a given page
 * @param $pageId Page id of the requested page
 * @param $userId User id of the current user
 * @return String containing HTML of the generated form, or a null string if required data could not be found
 */
function getSettingsForm($pageId, $userId)
{
    $pageId = escape($pageId);
    $page_query = "SELECT `page_name`, `page_title`, `page_displaymenu`, `page_displayinmenu`, `page_displaysiblingmenu` , `page_module`, `page_displaypageheading`,`page_template`,`page_modulecomponentid`, `page_menutype`, `page_menudepth` , `page_displayinsitemap` ,`page_displayicon`" . "FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_id`='" . $pageId . "'";
    $page_result = mysql_query($page_query);
    $page_values = mysql_fetch_assoc($page_result);
    $chkquery = "SELECT `value` FROM `" . MYSQL_DATABASE_PREFIX . "global` WHERE `attribute`='allow_pagespecific_template'";
    $row = mysql_fetch_row(mysql_query($chkquery));
    $allow_pagespecific_templates = $row[0];
    // 0 if disabled, 1 if enabled
    if (!$page_values) {
        return '';
    }
    global $ICONS;
    $modifiers = '';
    $showInMenuBox = '';
    $showInSiteMap = '';
    if ($pageId == 0) {
        $modifiers = 'disabled="disabled" ';
    }
    $showInMenuBox = '<tr><td ><label for="showinmenu">Show page in menu bar</td></label><td><input type="checkbox" name="showinmenu" id="showinmenu" ' . ($page_values['page_displayinmenu'] == 1 ? 'checked="checked" ' : '') . '/></td></tr>';
    $showInSiteMap = '<tr><td ><label for="showinsitemap">Show page in site map</td></label><td><input type="checkbox" name="showinsitemap" id="showinsitemap" ' . ($page_values['page_displayinsitemap'] == 1 ? 'checked="checked" ' : '') . '/></td></tr>';
    $showmenubar = $page_values['page_displaymenu'] == 1 ? 'checked="checked" ' : '';
    $showsiblingmenu = $page_values['page_displaysiblingmenu'] == 1 ? 'checked="checked" ' : '';
    $showheading = $page_values['page_displaypageheading'] == 1 ? 'checked="checked"' : '';
    $dbPageTemplate = $page_values['page_template'];
    $modulecomponentid = $page_values['page_modulecomponentid'];
    $displayicon = $page_values['page_displayicon'] == 1 ? 'checked="checked" ' : '';
    $templates = getAvailableTemplates();
    $page_query = "SELECT * FROM `" . MYSQL_DATABASE_PREFIX . "pages` WHERE `page_parentid` = '{$pageId}' AND `page_parentid` != `page_id` ORDER BY `page_menurank` ASC  ";
    $page_result = mysql_query($page_query) or die(mysql_error());
    $childList = "";
    $isLeaf = false;
    if (mysql_num_rows($page_result) == 0) {
        $isLeaf = true;
        $childList = "There are no child pages associated with this page.";
    } else {
        $childList = "<table border=\"1\" width=\"100%\"><tr><th>Child Pages</th><th>Display in menu bar</th><th>Display in Sitemap</th><th>Display Icon in menu</th><th>Move page up</th><th>Move page down</th><th>Delete</th></tr>";
    }
    while ($page_result_row = mysql_fetch_assoc($page_result)) {
        $childList .= '<tr><td><a href="./' . $page_result_row['page_name'] . '+settings">' . $page_result_row['page_title'] . '</a></td>' . '<td><input type="checkbox" name="menubarshowchildren[]" id="' . $page_result_row['page_name'] . '" value="' . $page_result_row['page_name'] . '" ' . ($page_result_row['page_displayinmenu'] == 1 ? 'checked="yes" ' : '') . '/></td>' . '<td><input type="checkbox" name="sitemapshowchildren[]" id="' . $page_result_row['page_name'] . '" value="' . $page_result_row['page_name'] . '" ' . ($page_result_row['page_displayinsitemap'] == 1 ? 'checked="yes" ' : '') . '/></td>' . '<td><input type="checkbox" name="childrenshowicon[]" id="' . $page_result_row['page_name'] . '" value="' . $page_result_row['page_name'] . '" ' . ($page_result_row['page_displayicon'] == 1 ? 'checked="yes" ' : '') . '/></td>' . '<td align="center"><input type="submit" name="moveUp" onclick="this.form.action+=\'' . $page_result_row['page_name'] . '\'" value="Move Up" /></td>' . '<td align="center"><input type="submit" name="moveDn" onclick="this.form.action+=\'' . $page_result_row['page_name'] . '\'" value="Move Down" /></td>' . '<td align="center"><input type="submit" name="deletePage" onclick="javascript:if(checkDelete(this,\'' . $page_result_row['page_name'] . '\')){this.form.action+=\'' . $page_result_row['page_name'] . '\'}"  value="Delete" /></td></tr>';
    }
    if (!mysql_num_rows($page_result) == 0) {
        $childList .= "</table>";
    }
    /* PAGE INHERITED INFO */
    $inheritedInfo = $inheritedPagePath = $inheritedInfoEncoded = '';
    $inheritedPageId = getPageInheritedInfo($pageId, $inheritedInfo);
    if ($inheritedPageId == $pageId) {
        $inheritedInfoEncoded = htmlentities($inheritedInfo);
    }
    if ($inheritedPageId >= 0) {
        $inheritedPagePath = getPagePath($inheritedPageId);
        global $urlRequestRoot;
        $inheritedPagePath = "<a href=\"{$urlRequestRoot}{$inheritedPagePath}+settings\">{$inheritedPagePath}</a>";
        if ($inheritedPageId != $pageId) {
            $inheritedPagePath .= ' (Browse to this page to edit the inherited information.)';
        }
    }
    $inheritedInfoText = <<<INHERITEDINFO
\t<a name="inheritinfoform"></a>
\t\t<fieldset style="padding: 8px">
\t\t\t<legend>{$ICONS['Page Inherited Info']['small']}Inherited Information</legend>
\t\t\t
\t\t\t<form name="pagesettings" action="./+settings&subaction=editinheritedinfo" method="POST">
\t\t\t\t<table>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>Inherited Information:</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t<div>
\t\t\t\t\t\t\t\t{$inheritedInfo}
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>Inherited From:</td>
\t\t\t\t\t\t<td>{$inheritedPagePath}</td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td>Add/Edit inherited information for this page:</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t<textarea name="txtInheritedInfo" style="width:98%;" rows="8" cols="80" wrap="virtual">{$inheritedInfoEncoded}</textarea>
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t</table>
\t\t\t\t<input type="submit" name="btnSubmit" value="Submit" />
\t\t\t</form>
\t\t</fieldset>
INHERITEDINFO;
    /* PAGE CREATE TEXT*/
    $createdPageSettingsText = "";
    $dbPageTemplateDisabled = "";
    $dbPageDefTemplate = "";
    if ($dbPageTemplate == DEF_TEMPLATE) {
        $dbPageDefTemplate = "checked";
        $dbPageTemplateDisabled = "disabled=true";
    }
    if (getPageModule($pageId) == "link") {
        $dereferencePagePathIds = array();
        parseUrlDereferenced($pageId, $dereferencePagePathIds);
        $dereferencePagePath = "";
        foreach ($dereferencePagePathIds as $page) {
            $info = getPageInfo($page);
            $dereferencePagePath .= $info['page_name'] . "/";
        }
        global $urlRequestRoot;
        $createdPageSettingsText = "<a name=\"childpageform\"></a> <fieldset>\n        <legend>{$ICONS['Create New Page']['small']}Create Child Page</legend>Please use the <a href='" . $urlRequestRoot . "/" . $dereferencePagePath . "+settings'>linked page settings</a> to create a child page.</fieldset>";
    } else {
        if (getPageModule($pageId) == "external") {
            $createdPageSettingsText = "<a name=\"childpageform\"></a> <fieldset>\n        <legend>{$ICONS['Create New Page']['small']}Create Child Page</legend>You cannot create a child page of a page of an \"external link\".</fieldset>";
        } else {
            $generatedTree = generateDirectoryTree($userId, "page", "settings", 0)->toHtml('childPageTreeContainer', 'childPageTree', 'childpagelink');
            $creatableTypesText = '<option value=""> </option><option value="menu">Menu</option><option value="link">Link</option><option value="external">External Link</option>';
            $createblePageTypes = getCreatablePageTypes($userId, $pageId);
            foreach ($createblePageTypes as $creatableType) {
                $creatableTypesText .= "<option value=\"{$creatableType}\">" . ucfirst($creatableType) . "</option>";
            }
            $createdPageSettingsText = <<<CREATE
\t\t    <form name="pagesettings" action="./+settings&subaction=create" onsubmit="return childOnSubmit();" method="POST">
\t\t    <script type="text/javascript" language="javascript">
\t\t\t<!--
\t\t\t\tfunction childOnSubmit(){
\t\t\t\t\tif(document.getElementById("childpagetype").selectedIndex==0) { alert("Please select a page type."); return false;}
\t\t\t\t\tif(document.getElementById("childpagename").value=="") {alert("Please fill the page name"); return false;}
\t\t\t\t\tif(document.getElementById("childpagelink").value=="" && document.getElementById("childpagetype").selectedIndex==2) {alert("Please select the linked page path"); return false;}
\t\t\t\t\tif(document.getElementById("externallink").value=="" && document.getElementById("childpagetype").selectedIndex==3) {alert("Please enter the external page path"); return false;}
\t\t\t\t}
\t\t\t\tfunction childShowTree(obj) {

\t\t\t\t\tif(obj.selectedIndex==2) {
\t\t\t\t\t\tdocument.getElementById("childlinktree").style.display="";
\t\t\t\t\t\tdocument.getElementById("childlinkentry").style.display="";
\t\t\t\t\t\tdocument.getElementById("childlinkentry1").style.display="";
\t\t\t\t\t}
\t\t\t\t\telse {
\t\t\t\t\t\tdocument.getElementById("childlinktree").style.display="none";
\t\t\t\t\t\tdocument.getElementById("childlinkentry").style.display="none";\t
\t\t\t\t\t\tdocument.getElementById("childlinkentry1").style.display="none";
\t\t\t\t\t}
\t\t\t\t\tif(obj.selectedIndex==3) {
\t\t\t\t\t\tdocument.getElementById("externallinktr").style.display="";
\t\t\t\t\t\tdocument.getElementById("externallinktr1").style.display="";
\t\t\t\t\t}
\t\t\t\t\telse {
\t\t\t\t\t\tdocument.getElementById("externallinktr").style.display="none";
\t\t\t\t\t\tdocument.getElementById("externallinktr1").style.display="none";
\t\t\t\t\t}

\t\t\t\t\tif(obj.selectedIndex==2 || obj.selectedIndex==3)
\t\t\t\t\t{
\t\t\t\t\t\tdocument.getElementById("fieldsetTemplate").style.display="none";\t
\t\t\t\t\t}
\t\t\t\t\telse document.getElementById("fieldsetTemplate").style.display="";
\t\t\t\t}
\t\t\t\tfunction toggleSelTemplate1()
\t\t\t\t{
\t\t\t\t\tvar obj=document.getElementsByName('page_template')[1];
\t\t\t\t\tobj.disabled=(obj.disabled==true?false:true);
\t\t
\t\t\t\t}
\t\t\t-->
\t\t</script>
\t\t  <a name="childpageform"></a>
\t <fieldset>
        <legend>{$ICONS['Create New Page']['small']}Create Child Page</legend>
      
        <table>
        \t<tr>
        \t\t<td valign="top">
\t\t\t\t\t<table border="1">
\t\t\t\t        <tr><td>Page type:</td><td><select name="childpagetype" id="childpagetype" onchange="childShowTree(this);">{$creatableTypesText}</select></td></tr>
\t\t\t\t        <tr><td>Page name:</td><td><input type="text" name="childpagename" id="childpagename" /></td></tr>
\t\t\t\t        <tr id="childlinkentry" style="display:none"><td>Page link:</td><td><input type="text" name="childpagelink" id="childpagelink" /></td></tr>
\t\t\t\t\t\t<tr id="childlinkentry1" style="display:none"><td>Open the child page in:</td><td><select name="linkselect" id="linktype"><Option>Same Tab</option><option>New Tab</option></select></td></tr>
\t\t\t\t        <tr id="externallinktr" style="display:none"><td>External link:</td><td><input type="text" name="externallink" id="externallink" /></td></tr>
\t\t\t\t\t\t<tr id="externallinktr1" style="display:none"><td>Open the child page in:</td><td><select name="linkselectex" id="linktypeex"><Option>Same Tab</option><option>New Tab</option></select></td></tr>
\t\t\t\t\t</table>
\t\t\t\t</td>
\t\t\t\t<td id="childlinktree" style="display:none">Click to select link path :
\t\t\t\t\t{$generatedTree}
\t\t\t\t</td>
\t\t\t</tr>
\t\t</table>
CREATE;
            $createdPageSettingsText .= <<<CREATE
\t\t\t<fieldset id="fieldsetTemplate">
\t\t\t<legend>Template</legend>
CREATE;
            if ($allow_pagespecific_templates == 1) {
                $createdPageSettingsText .= <<<CREATE
\t\t\t<table>
\t\t\t<tr>
\t\t\t<td>Use Default Template ?</td>
\t\t\t<td><input type='checkbox' name='default_template' value='yes' onchange="toggleSelTemplate1()" {$dbPageDefTemplate} /></td>
\t\t\t</tr>
\t\t\t<tr>
\t\t\t<td>Select Template</td>
\t\t\t<td><select name='page_template' {$dbPageTemplateDisabled}>
CREATE;
                for ($i = 0; $i < count($templates); $i++) {
                    if ($templates[$i] == $dbPageTemplate) {
                        $createdPageSettingsText .= "<option value='" . $templates[$i] . "' selected >" . ucwords($templates[$i]) . "</option>";
                    } else {
                        $createdPageSettingsText .= "<option value='" . $templates[$i] . "' >" . ucwords($templates[$i]) . "</option>";
                    }
                }
                $createdPageSettingsText .= "\n\t\t\t</select>\n\t\n\t\t\t</tr>\n\t\n\t\t\t</table>";
            } else {
                $createdPageSettingsText .= "Page-specific templates are disabled. Please enable it from Global Settings in Admin or click <a href='./+admin&subaction=global'>here</a>";
            }
            $createdPageSettingsText .= <<<CREATE
\t\t</fieldset><br/>
\t   \t<input type="submit" name="btnSubmit2" value="Submit" />&nbsp;&nbsp;<input type="reset" name="btnReset" value="Reset" />
      </fieldset>
      </form>
CREATE;
        }
    }
    /* PAGE CREATE TEXT ENDS*/
    /* PAGE MOVE COPY TEXT BEGINS */
    $generatedTree = generateDirectoryTree($userId, "page", "settings", 0)->toHtml('fileCopyTreeContainer', 'fileCopyTree', "parentpagepath");
    $movecopyPageSettingsText = <<<MOVECOPY
\t\t<script type="text/javascript" language="javascript">
\t\t\tfunction moveOnSubmit(){
\t\t\t\tif(document.getElementById("parentpagepath").value=="") {alert("Please fill the page path"); return false;}
\t\t\t\tif(document.getElementById("destinationpagetitle").value=="") { alert("Please select a page title."); return false;}
\t\t\t\tif(document.getElementById("destinationpagename").value=="") {alert("Please fill the page name"); return false;}
\t\t\t}
\t\t\tfunction movecopyChange(obj){
\t\t\t\tif(obj.checked==true)
\t\t\t\t\tdocument.getElementById("recursivelycopypage").disabled=true;
\t\t\t\telse
\t\t\t\t\tdocument.getElementById("recursivelycopypage").disabled=false;
\t\t\t}
\t\t-->
\t</script>
\t<form name="pagesettings" action="./+settings&subaction=move" onsubmit="return moveOnSubmit()" method="POST">
\t  <a name="copymovepageform"></a>
\t <fieldset>
        <legend>{$ICONS['Copy or Move Page']['small']}Copy or Move Page</legend>
      
\t\t<table border="1">
\t\t\t<tr>
\t\t\t\t<td valign="top">
\t\t\t        <table border="1" cellpadding="2px" cellspacing="2px">
\t\t\t        \t<tr><td colspan="2">Click on the generated page tree to select the parent page path : </td></tr>
\t\t\t          <tr><td>Path of the distination parent page :</td><td><input type="text" id="parentpagepath" name="parentpagepath"/></td></tr>
\t\t\t          <tr><td>Destination page title:</td><td><input type="text" name="destinationpagetitle" id="destinationpagetitle" value="{$page_values['page_title']}"/></td></tr>
\t\t\t          <tr><td>Destination page name:</td><td><input type="text" name="destinationpagename" id="destinationpagename" value="{$page_values['page_name']}"/></td></tr>
 \t\t\t          <tr><td><label for="deleteoriginalpage">Delete original entry (Move instead of Copy)</label></td><td><input type="checkbox" name="deleteoriginalpage" id="deleteoriginalpage" checked="true" onclick="movecopyChange(this);"/></td></tr>
 \t\t\t          <tr><td><label for="recusivelycopypage">Copy recursively? (in case of Copy)</label></td><td><input type="checkbox" name="recursivelycopypage" id="recursivelycopypage" disabled="true" /></td></tr>
 \t\t\t        </table>
 \t\t\t        Legend:
 \t\t\t        <table cellpadding="2px" cellspacing="2px">
 \t\t\t        \t<tr><td style="border: 1px solid black; width: 18px; background-color: #E8FFE8"></td><td>Accessible Items</td></tr>
 \t\t\t        \t<tr><td style="border: 1px solid black; width: 18px; background-color: #FFE8E8"></td><td>Inaccessible Items</td></tr>
 \t\t\t        </table>
\t\t\t    </td>
\t\t\t    <td valign="top">
\t\t\t\t\t<div id="pathtree">Click to select destination path : {$generatedTree}</div>
\t\t\t    </td>
\t\t\t</tr>
\t\t</table>

\t    \t<input type="submit" name="btnSubmit2" value="Submit" />&nbsp;&nbsp;<input type="reset" name="btnReset" value="Reset" />
      </fieldset>
      </form>

MOVECOPY;
    /* PAGE MOVE COPY TEXT ENDS */
    /*TAGS TEXT BEGINS */
    $pageTagsQuery = "SELECT `tag_text`, `tag_id` FROM `" . MYSQL_DATABASE_PREFIX . "pagetags` WHERE `page_id` = '{$pageId}' ORDER BY `tag_text`;";
    $pageTagsResult = mysql_query($pageTagsQuery);
    if (!$pageTagsResult) {
        displayerror(mysql_error());
    }
    //Error handling
    if (mysql_num_rows($pageTagsResult)) {
        //Checking if the page has tags
        $pageTags = "<table><tr>";
        $pageTags .= "<th> Tag Name </th>";
        $pageTags .= "<th> Delete </th></tr>";
        while ($pagetagrow = mysql_fetch_assoc($pageTagsResult)) {
            $pageTags .= "<tr>";
            $pageTags .= "<td>" . $pagetagrow['tag_text'] . "</td>";
            $pageTags .= "<td><a href='./+settings&subaction=tags&delTag={$pagetagrow[tag_id]}'>" . $ICONS['Delete']['small'] . "</a></td>";
            $pageTags .= "</tr>";
        }
        $pageTags .= "</table>";
    } else {
        $pageTags = "There are no tags yet.";
    }
    $allTagsQuery = "SELECT DISTINCT `tag_text` FROM `" . MYSQL_DATABASE_PREFIX . "pagetags` ORDER BY `tag_text;";
    $allTagsResult = mysql_query($allTagsQuery);
    if (!$allTagsResult) {
        displayerror(mysql_error());
    }
    //Error handling
    while ($alltagrow = mysql_fetch_assoc($allTagsResult)) {
        $allTags .= "<option value='{$alltagrow[tag_text]}'>";
        //dataset option for newTag input
    }
    $tagsPageSettingsText = "<fieldset><legend><a name='tags'>Page Tags</a></legend>";
    $tagsPageSettingsText .= $pageTags;
    $tagsPageSettingsText .= "<div><form action='./+settings&subaction=tags' method='post'>";
    $tagsPageSettingsText .= "<label for='newTag'>Add a tag:</label>";
    $tagsPageSettingsText .= "<input id='newTag' name='newTag' list='existingTags'></input>";
    $tagsPageSettingsText .= "<datalist id='existingTags'>";
    $tagsPageSettingsText .= $allTags;
    $tagsPageSettingsText .= "</datalist>";
    $tagsPageSettingsText .= "<input type='submit'></input></form></div>";
    $tagsPageSettingsText .= "</fieldset>";
    /* TAGS TEXT ENDS */
    global $pageFullPath;
    global $STARTSCRIPTS;
    $STARTSCRIPTS .= "toggleMenuType();";
    $parentPath = $pageId == 0 ? '' : '<a href="../+settings">Parent page link.</a>';
    $pageType = ucfirst($page_values['page_module']);
    $menuType = $page_values['page_menutype'];
    $menudepth = $page_values['page_menudepth'];
    $classictype = "";
    $multidepthtype = "";
    $completetype = "";
    $changeLink = "";
    $name = "";
    $generatedTree = "";
    $linkmcid = getDereferencedPageId($pageId);
    if ($pageType == "Link") {
        $link = getPagePath($linkmcid);
        $generatedTree = "<tr><td colspan=2><div>Choose a link:" . generateDirectoryTree($userId, "page", "settings", 0)->toHtml('linkTreeContainer', 'linkTree', 'link') . "</div></td></tr>";
        $changeLink = "<tr><td>Internally Linked To:</td><td><input type=text name='link' id='link' value={$link}></td></tr>";
    }
    if ($pageType == "External") {
        $linkquery = "SELECT `page_extlink` FROM `" . MYSQL_DATABASE_PREFIX . "external` WHERE page_modulecomponentid = " . $linkmcid;
        $linkres = mysql_fetch_row(mysql_query($linkquery));
        $link = $linkres[0];
        $changeLink = "<tr><td>Externally Linked To:</td><td><input type=text name='exlink' id='link' value={$link}></td></tr>";
    }
    if ($menuType == "classic") {
        $classictype = "selected";
    } else {
        if ($menuType == "multidepth") {
            $multidepthtype = "selected";
        } else {
            $completetype = "selected";
        }
    }
    $row = mysql_fetch_array(mysql_query("SELECT `allowComments` FROM `article_content` WHERE `page_modulecomponentid` = '{$modulecomponentid}'"));
    $allowComments = $row['allowComments'] == 1 ? 'checked="checked" ' : '';
    $formDisplay = <<<FORMDISPLAY

\t<div id="page_settings">
    <form name="pagesettings" action="./+settings&subaction=pagesettings&pageName=" method="POST" onsubmit="return settingsOnSubmit();">
\t\t<script type="text/javascript" language="javascript">
\t\t\tfunction settingsOnSubmit(){
\t\t\t\tif(!document.getElementById("pagename").disabled) {
\t\t\t\t \tif(document.getElementById("pagename").value=="") {alert("Please fill the page name."); return false;}
\t\t\t\t}
\t\t\t\tif(document.getElementById("pagetitle").value=="") { alert("Please fill the page title."); return false;}
\t\t\t}
\t\t\tfunction checkDelete(butt,fileName)
\t\t\t{
\t\t\t\tif(confirm('Are you sure you want to delete '+fileName+'?'))
\t\t\t\t  {
\t\t\t\t    return true;
\t\t\t\t    //\t\t\t    butt.form.action+=fileName;
\t\t\t\t    //butt.form.submit();
\t\t\t\t  }
\t\t\t\telse {console.log("hi");return false;}
\t\t\t}
\t\t\tfunction toggleSelTemplate2()
\t\t\t\t{
\t\t\t\t\tvar obj=document.getElementsByName('page_template')[0];
\t\t\t\t\tobj.disabled=(obj.disabled==true?false:true);
\t\t
\t\t\t\t}
\t\t\tfunction toggleMenuType()
\t\t\t\t{
\t\t\t\t\tvar obj=document.getElementById('menutype');
\t\t\t\t\tif(obj.value=="classic")
\t\t\t\t\t{
\t\t\t\t\t\tdocument.getElementById('showsiblingmenu').disabled=false;
\t\t\t\t\t\tdocument.getElementById('menudepth').disabled=true;
\t\t\t\t\t}
\t\t\t\t\telse 
\t\t\t\t\t{
\t\t\t\t\t\tdocument.getElementById('showsiblingmenu').disabled=true;
\t\t\t\t\t\tdocument.getElementById('menudepth').disabled=false;
\t\t\t\t\t}
\t\t\t\t}
\t\t</script>


        \t<br />
        <a name="topquicklinks"></a>
        <fieldset>
        <legend>{$ICONS['Page Settings']['small']}Page Settings</legend>
        <table class='iconspanel'>
        <tr>
        <td><a href='#pageinfoform'><div>{$ICONS['Page Information']['large']}<br/>Page Information</div></a></td>
        <td><a href='#childpageform'><div>{$ICONS['Create New Page']['large']}<br/>Create New Page</div></a></td>
        <td><a href='#copymovepageform'><div>{$ICONS['Copy or Move Page']['large']}<br/>Copy or Move Page</div></a></td>
        <td><a href='#inheritinfoform'><div>{$ICONS['Page Inherited Info']['large']}<br/>Page Inherited Information</div></a></td>
        </tr>
        </table>   
        </fieldset>
        
        <a name="pageinfoform"></a>
      \t<fieldset>
        \t<legend>{$ICONS['Page Information']['small']}Page Information</legend>
        \t
\t        <table border="1" cellpadding="2px" cellspacing="2px">
\t\t\t\t<tr><td>Page path:</td><td>{$pageFullPath}</td></tr>
\t        \t<tr><td>Page name:</td><td><input type="text" id="pagename" name="pagename" value="{$page_values['page_name']}" {$modifiers}/></td></tr>
\t  \t\t\t<tr><td>Page title:</td><td><input type="text" id="pagetitle" name="pagetitle" value="{$page_values['page_title']}" {$modifiers}/></td></tr>
\t  \t\t\t<tr><td >Page type: </td><td>{$pageType}</td></tr>
\t  \t\t\t{$changeLink}{$generatedTree}
\t\t\t\t<tr><td>Allow comments: </td><td><input type='checkbox' id='allowComments' name='allowComments' {$allowComments}></td></tr>
\t\t\t\t{$showInMenuBox}
\t\t\t<tr><td><label for="showheading">Show page heading</label></td><td><input type="checkbox" id="showheading" name="showheading" {$showheading} /></td></tr>
\t  \t\t\t\t
\t  \t\t\t{$showInSiteMap}\t
\t  \t\t\t
\t\t</table>
\t\t<fieldset><legend>Menu Settings</legend>
\t\t<table border="1" cellpadding="2px" cellspacing="2px">
\t\t
\t\t\t
\t\t\t\t<tr>
\t\t\t\t\t<td><label for='menutype'>Menu type</label></td>
\t\t\t\t\t<td>
\t\t\t\t\t<select name="menutype" id="menutype" onchange="toggleMenuType();">
\t\t\t\t\t\t<option value='classic' {$classictype}>Classic</option>
\t\t\t\t\t\t<option value='complete' {$completetype}>Complete</option>
\t\t\t\t\t\t<option value='multidepth' {$multidepthtype}>Multi-Depth</option>
\t\t\t\t\t</select>
\t\t\t\t\t</td>
\t\t\t\t\t<td rowspan="4"><input type="checkbox" name='menustyle_propogate' value='yes' checked="checked" />Propogate Menu settings to all child pages <br /><br /> Menu Depth = -1 : Generate Complete Menu till the last child page.</td>
\t\t\t\t<tr>
\t\t\t\t\t<td><label for='showmenubar'>Show menu bar in page</label></td>
\t\t\t\t\t<td><input type='checkbox' id='showmenubar' name='showmenubar' {$showmenubar}/></td>
\t\t\t\t</tr><tr>
\t\t\t\t\t<td><label for='showsiblingmenu'> Show sibling menu in page</label></td>
\t\t\t\t\t<td><input type='checkbox' name='showsiblingmenu' id='showsiblingmenu' {$showsiblingmenu} /></td>
\t\t\t\t</tr>
\t\t\t\t<tr>
\t\t\t\t\t<td><label for='menudepth'>Menu Depth</label></td>
\t\t\t\t\t<td><input type='text' name='menudepth' id='menudepth' value='{$menudepth}'/>  </td>
\t\t\t\t</tr><tr>
\t\t\t\t\t<td><label for='displayicon'> Show icon in menu </label></td>
\t\t\t\t\t<td><input type='checkbox' name='displayicon' id='displayicon' {$displayicon} /></td>
\t\t\t\t\t<td rowspan="4"><input type="checkbox" name='icon_propogate' value='yes' />Propogate Icon settings to all child pages </td>
\t\t\t\t</tr>
\t\t\t\t
\t        </table>
\t        </fieldset>
\t        <fieldset><legend>Template</legend>
FORMDISPLAY;
    if ($allow_pagespecific_templates == 1) {
        $formDisplay .= <<<FORMDISPLAY
\t        <table border="1" cellpadding="2px" cellspacing="2px">
\t\t\t\t
\t\t\t\t<tr>
\t\t\t\t\t<td>Use Default Template ?</td>
\t\t\t\t\t<td><input type='checkbox' name='default_template' value='yes' onchange="toggleSelTemplate2()" {$dbPageDefTemplate} /></td>
\t\t\t\t\t<td rowspan=2><input type="checkbox" name='template_propogate' value='yes' />Propogate Template setting to all child pages
\t\t\t\t\t</td>
\t\t\t\t\t</tr>
\t\t\t\t\t<tr>
\t\t\t\t\t<td>Select Template</td>
\t\t\t\t\t<td><select name='page_template' {$dbPageTemplateDisabled}>
FORMDISPLAY;
        for ($i = 0; $i < count($templates); $i++) {
            if ($templates[$i] == $dbPageTemplate) {
                $formDisplay .= "<option value='" . $templates[$i] . "' selected >" . ucwords($templates[$i]) . "</option>";
            } else {
                $formDisplay .= "<option value='" . $templates[$i] . "' >" . ucwords($templates[$i]) . "</option>";
            }
        }
        $formDisplay .= "\n\t\t\t\t\t</select>\n\t\n\t\t\t\t</tr>\n\t\t</table>";
    } else {
        $formDisplay .= "Page-specific templates are disabled. Please enable it from Global Settings in Admin or click <a href='./+admin&subaction=global'>here</a>";
    }
    $formDisplay .= <<<FORMDISPLAY
\t\t</fieldset>
\t\t
\t\t<fieldset><legend>Child Pages</legend>
\t\tChild pages: (Click on links for children's settings.) {$parentPath} <br />
\t\t{$childList}
\t        </fieldset>
\t     

    \t\t<input type="submit" name="btnSubmit" value="Submit"/>&nbsp;&nbsp;<input type="reset" name="btnReset" value="Reset" />
      \t</fieldset>
      \t<a href="#topquicklinks">Top</a>
    </form>
    \t<br/><br/>
\t\t{$createdPageSettingsText}
\t\t<a href="#topquicklinks">Top</a>
\t<br/><br/>
\t\t{$movecopyPageSettingsText}
\t\t<a href="#topquicklinks">Top</a>
\t<br/><br/>
    \t{$inheritedInfoText}
    \t<a href="#topquicklinks">Top</a>
    <br/><br/>
    \t{$tagsPageSettingsText}
    \t<a href="#topquicklinks">Top</a>
\t</div>
FORMDISPLAY;
    return $formDisplay;
}
Beispiel #5
0
/**
 * Enter description here...
 *
 * @param string $folder
 * @param string $select
 * @return string
 */
function getAvailableTemplatesHTML($folder, $select)
{
    $array = getAvailableTemplates($folder);
    $string = '';
    foreach ($array as $dir => $name) {
        if ($select == $dir) {
            $string .= '<option value="' . $dir . '" selected="selected">' . $name . '</option>';
        } else {
            $string .= '<option value="' . $dir . '">' . $name . '</option>';
        }
    }
    return $string;
}