Files
Testing/include/analytics/ask_dr_bate_form.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

134 lines
11 KiB
PHP

<?php if ( !defined('PATHTOINCLUDES') ) define('PATHTOINCLUDES', $_SERVER["DOCUMENT_ROOT"] . '/include/analytics/');
include(PATHTOINCLUDES."base.php");
$em="";
$sql="SELECT
`ask_dr_bate`.`aid`,
`ask_dr_bate`.`thecontent`,
`ask_dr_bate`.`thetype`,
`ask_dr_bate`.`thelink`,
`ask_dr_bate`.`theimg`,
`ask_dr_bate`.`isactive`,
`ask_dr_bate`.`thedate`
FROM
`ask_dr_bate`
ORDER BY `ask_dr_bate`.`aid` DESC";
$query=$database->database_query($sql) or $em .= $database->database_error();
$sql2="SELECT
`ask_dr_question`.`qid`,
`ask_dr_question`.`quid`,
`ask_dr_question`.`quname`,
`ask_dr_question`.`ques`,
`ask_dr_question`.`qdate`
FROM
`ask_dr_question`
ORDER BY `ask_dr_question`.`qdate` DESC";
$query2=$database->database_query($sql2) or $em .= $database->database_error();
?>
<div id="adb_admin_container" style="border:1px solid red;position:relative;height:424px;">
<div id="adb_admin_menu" style="color:black;padding:0 5px 0 5px;height:24px;background:#efefef;line-height:22px;">
<a onclick="adb_menu('update_form')" style="cursor:pointer;cursor:hand;line-height:22px;">Update Articles</a> | <a onclick="adb_menu('theform')" style="cursor:pointer;cursor:hand;line-height:22px;">Add Article</a> | <a onclick="adb_menu('adb_a_question')" style="cursor:pointer;cursor:hand;line-height:22px;">Reader Questions</a> | <a onclick="adb_menu('adb_help')" style="cursor:pointer;cursor:hand;line-height:22px;">Help</a>
</div>
<div style="position:relative;top:0px;left:0px;">
<div id="update_form" style="position:absolute;top:0px;height:400px;overflow:auto;width:100%;background:#fff;">
<fieldset>
<legend style="color:#000;">Ask Dr. Bate - Update - Edit the text directly.</legend>
<?php $rownum=0;$imgnum=0;
while ($row = $database->database_fetch_assoc($query)) {
$rownum=$rownum+1;
$imgnum=$imgnum+1;
if($rownum % 2 != 0){$rc="odd";} else{$rc="even";}
if($imgnum % 8 == 0){$imgnum=1;}
?>
<?php if($rc=="odd") { ?>
<div id="adb_imsg_<?php echo $row["aid"];?>" style="display:none;"><span style="padding:0 10px 0 0px;color:green;">Article successfully updated. I think.</span></div>
<div class="bg-gray adb-item" style="width:100%;background:#333;width:210px;" id="ask_cw_<?php echo $row["aid"]; ?>">
<div class="adb-yellow adb-content" style="color:#ffcd1d;font-size:80%;line-height:120%;text-align:left;padding:2px;">
<a href="javascript:get_page('http://bateworld.com/ask_dr_bate.php?user=AskDrBate&blogentry_id=1642')"><img src="/include/analytics/images/dr_bate/dr_bate_<?php echo $imgnum;?>.jpg" style="float:left;margin-right:5px;width:36px;height:36px;border:none;" alt="Ask Dr. Bate"></a><a href="javascript:get_page('http://bateworld.com/ask_dr_bate.php?user=AskDrBate&blogentry_id=1642')" style="color:#ffcd1d;text-decoration:none;" id="thecontent_<?php echo $row["aid"];?>" contenteditable="true"><?php echo stripslashes($row["thecontent"]); ?></a>
<div class="adb-blog-type adb-green" style="text-align:right;font-size:85%;color:#88d293;padding-right:5px;" id="thetype_<?php echo $row["aid"]; ?>" contenteditable="true"><?php echo stripslashes($row["thetype"]); ?></div>
</div>
</div>
<div><label for="thelink" style="color:#000;display:block;">Link (required) use ask_dr_bate.php</label><input type="text" name="thelink_<?php echo $row["aid"]; ?>" id="thelink_<?php echo $row["aid"]; ?>" value="<?php echo $row["thelink"];?>" maxlength="90" required pattern="\S" style="width:100%;" /></div>
<div style="position:relative;text-align:right;"><span style="color:#000;">Display: </span><input type="checkbox" name="active_<?php echo $row["aid"];?>" id="active_<?php echo $row["aid"];?>" <?php if($row["isactive"]=="Y"){echo 'checked="checked"';}?> onchange="ask_dr_bate_active('<?php echo $row["aid"]; ?>')" /><a onclick="preview_article('<?php echo $row["aid"];?>')" style="position:absolute;left:0px;top:4px;color:green;cursor:pointer;cursor:hand;">View Article</a><button onclick="ask_dr_bate_update('<?php echo $row["aid"];?>')">Update</button></div>
<hr />
<?php } else { ?>
<div id="adb_imsg_<?php echo $row["aid"];?>" style="display:none;"><span style="padding:0 10px 0 0px;color:green;">Article successfully updated. I think.</span></div>
<div class="bg-black adb-item" style="width:100%;background:#000;width:210px;" id="ask_cw_<?php echo $row["aid"]; ?>">
<div class="adb-green adb-content" style="padding:2px;color:#88d293;font-size:80%;line-height:120%;text-align:left;">
<a href="javascript:get_page('http://bateworld.com/ask_dr_bate.php?user=AskDrBate&blogentry_id=1624')"><img src="/include/analytics/images/dr_bate/dr_bate_2.jpg" style="float:left;margin-right:5px;width:36px;height:36px;border:none;" alt="Ask Dr. Bate"></a><a href="javascript:get_page('http://bateworld.com/ask_dr_bate.php?user=AskDrBate&blogentry_id=1624')" style="color:#88d293;text-decoration:none;" id="thecontent_<?php echo $row["aid"];?>" contenteditable="true"><?php echo stripslashes($row["thecontent"]); ?></a>
<div class="adb-blog-type adb-yellow" style="text-align:right;font-size:85%;color:#ffcd1d;padding-right:5px;" id="thetype_<?php echo $row["aid"]; ?>" contenteditable="true"><?php echo stripslashes($row["thetype"]); ?></div>
</div>
</div>
<div><label for="thelink" style="color:#000;display:block;">Link (required) use ask_dr_bate.php</label><input type="text" name="thelink_<?php echo $row["aid"]; ?>" id="thelink_<?php echo $row["aid"]; ?>" value="<?php echo $row["thelink"];?>" maxlength="90" required pattern="\S" style="width:100%;" /></div>
<div style="position:relative;text-align:right;"><span style="color:#000;">Display: </span><input type="checkbox" name="active_<?php echo $row["aid"];?>" id="active_<?php echo $row["aid"];?>" <?php if($row["isactive"]=="Y"){echo 'checked="checked"';} ?> onchange="ask_dr_bate_active('<?php echo $row["aid"]; ?>')" />
<a onclick="preview_article('<?php echo $row["aid"];?>')" style="position:absolute;left:0px;top:4px;color:green;cursor:pointer;cursor:hand;">View Article</a>
<button onclick="ask_dr_bate_update('<?php echo $row["aid"];?>')">Update</button></div>
<hr />
<?php }?>
<?php }?>
</fieldset>
</div> <?php // end update form ?>
<div id="theform" style="position:absolute;top:0;left:0px;height:380px;overflow:auto;background:#fff;width:378px;display:none;">
<div id="adb_imsg"><span style="padding:0 10px 0 10px;">Article successfully added to database</span></div>
<fieldset>
<legend style="color:#000;">Ask Dr. Bate - Add Article </legend>
<div style="padding-right:2px;"><label for="thedescription">Description (required)</label><textarea name="thedescription" id="thedescription" required pattern="\S"></textarea></div>
<div><label for="thetype">Type (required) ex. Dr. Bate Q &amp; A</label><input type="text" name="thetype" id="thetype" value="" maxlength="90" size="38"
required pattern="\S" /></div>
<div><label for="thelink">Link (required) use the standard blog link</label><input type="text" name="thelink_0" id="thelink_0" value="" maxlength="90" required pattern="\S" /></div>
<div style="text-align:right;width:100%;padding-top:4px;position:relative;"><span style="color:#000;">Display: </span><input type="checkbox" name="active" id="active" /><label class="lnofloat">Active</label><button type="button" name="insert" id="insert" onclick="add_ask_dr_bate();">Add</button>
<a onclick="preview_article('0')" style="position:absolute;left:0px;top:8px;color:green;cursor:pointer;cursor:hand;">View Article</a>
</div>
</fieldset>
</div><?php // end insert form ?>
<div id="adb_a_question" style="position:absolute;top:0px;left:0px;height:400px;overflow:auto;width:100%;background:#fff;display:none;">
<div style="padding:10px;color:#000;">
<?php $rownum=0;
while ($x = $database->database_fetch_assoc($query2)) {
$rownum=$rownum+1;
if($rownum % 2 != 0){$rc="odd";} else{$rc="even";}?>
<?php if($rc=="odd") { ?>
<div class="odd">
<div><a href="javascript:get_page('http://bateworld.com/profile.php?user=<?php echo $x["quname"]; ?>')"><?php echo $x["quname"]; ?></a> <span style="float:right;"><?php echo $x["qdate"]; ?></span></div>
<div><?php echo $x["ques"];?></div>
<hr style="line-height:100%;margin:0;"/>
</div>
<?php } else { ?>
<div class="even">
<div><a href="javascript:get_page('http://bateworld.com/profile.php?user=<?php echo $x["quname"]; ?>')"><?php echo $x["quname"]; ?></a> <span style="float:right;"><?php echo $x["qdate"]; ?></span></div>
<div><?php echo $x["ques"];?></div>
<hr style="line-height:100%;margin:0;" />
</div>
<?php }?>
<?php }?>
</div>
</div>
<div id="adb_help" style="position:absolute;top:0px;left:0px;height:400px;overflow:auto;width:100%;background:#fff;display:none;">
<div style="padding:10px;">
<h2 style="font-size:100%;color:orange;margin:0px;padding:0px;">Add Dr. Bate Article</h2>
<p style="color:#000;margin-top:0px;margin-bottom:10px;">Description, type, and link are required. You can set the article to active, but it is best to do this using the edit screen where you can see how it is going to layout on the page.</p>
<p style="color:#000;margin-bottom:10px;">The link automatically replaces the standard blog link (blog.php) with ask_dr_bate.php. It is best to load the blog in your browser, grap the url from your address bar, and paste it into the form. Use View Article to check the link to make sure it is valid and is loading the Ask Dr. Bate template.</p>
<h2 style="color:orange;font-size:100%;margin:0px;padding:0px;">Update Dr. Bate Articles</h2>
<p style="margin-bottom:10px;color:#000;">You edit the description and type directly in the Ask Dr. Bate container. The container has the text and the Ask. Dr. Bate image and is style to display as it will appear on the page. Just click on the text you want to edit and type. </p>
<p style="margin-bottom:10px;color:#000;">Do not copy and paste content into the editor - it can create problems. I'll add html editing soon so any issues can be correct directly in the editor. Loading the Ask Dr. Bate Admin by click edit is the best way to check and make sure any edits are successful.</p>
<p style="margin-bottom:10px;color:#000;">The link accepts whatever you put in it without any additonal parsing or formating. The link should contain http://ask_dr_bate.php with the members username and id for the blog. You can view the link to make sure it is correct by click View Article.<p>
<p style="margin-bottom:10px;color:#000;">The article must be set to active to appear on the community page. That includes archived articles. The articles will appear in reverse order based on the they were frist entered, so if you add more than one article, add the article you want to appear first last and so forth.</p>
<h2 style="font-size:100%;color:orange;margin:0px;padding:0px;">Reader Questions</h2>
<p style="color:#000;margin-top:0px;margin-bottom:10px;">Click link and read question. Click on member name to bring up profile.</p>
</div>
</div><?php // end help ?>
</div> <?php // end adb admin ?