예제 #1
0
파일: jnewsbotk2.php 프로젝트: naka211/kkvn
function jnewsbot_k2_editab()
{
    $limit = 5;
    $limittotal = countK2Items();
    $setLimitk2 = jnews::setLimitPagination($limittotal);
    $task = JRequest::getVar('task');
    //filter
    if (isset($_POST['contentsearchk2'])) {
        $contentsearch = JRequest::getVar('contentsearchk2', 'post', '', 'string');
    } else {
        $contentsearch = "";
    }
    $toSearch = new stdClass();
    $toSearch->forms = '';
    //$toSearch->hidden = $hidden;
    $toSearch->listsearch = $contentsearch;
    $toSearch->id = 'contentsearchk2';
    $app = JFactory::getApplication();
    $setSortk2 = new stdClass();
    if (!isset($_POST['k2_filter_order'])) {
        $setSortk2->orderValue = "a.id";
    } else {
        $setSortk2->orderValue = $_POST['filter_order'];
    }
    $setSortk2->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.k2content.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
    $sort_select = JRequest::getVar('filter_category_id_k2', '', 'POST', 'int');
    $k2contentitems = jnewsbot_k2_getitems($contentsearch, $setLimitk2, $setSortk2, $sort_select);
    ob_start();
    $js = "var id_global, content_type, hide_title_global;\n            function setContentTag(id, hide_title_or_rendering)\n            {\n                if(id != null) {\n\n                    if(document.getElementById('for_disabled').checked === false)\n                    {\n                         document.getElementById('hide_title_yes').disabled=false;\n                    }\n\n                    if(hide_title_or_rendering ==undefined && hide_title_global == undefined)\n                    {\n                         hide_title_global = 0;\n                    }\n                    if(hide_title_or_rendering ==undefined && content_type == undefined)\n                    {\n                        content_type = 0;\n                    }\n                    if(id ==='rendering')\n                    {\n                        content_type = hide_title_or_rendering;\n                        if(id_global == undefined)  id_global = 0;\n                        if(hide_title_global == undefined) hide_title_global = 0;\n                        if(hide_title_or_rendering == 2)\n                        {\n                           // hide_title_global = 0;\n                            document.getElementById('hide_title_no').click();\n                            document.getElementById('hide_title_yes').disabled=true;\n\n                        }\n                    }\n                    if(id == 'hide_title')\n                    {\n                        hide_title_global = hide_title_or_rendering;\n                        if(id_global == undefined) id_global = 0;\n                        if(content_type == undefined) content_type = 0;\n                    }\n                    if( id % 1 === 0)\n                    {\n                        id_global = id;\n                        if(content_type == undefined) content_type = 0;\n                        if(hide_title_global == undefined) hide_title_global = 0;\n                    }\n\n                    var form = document.adminForm;\n                    if(!form){\n                            form = document.mosForm;\n                    }\n                    var tag = '{k2item:' + id_global + '|' + content_type +'|'+hide_title_global+ '}';\n                    form.k2tag.value = tag;\n\n                }\n                else\n                {           var form = document.adminForm;\n                            if(!form){\n                                    form = document.mosForm;\n                            }\n                            var tag = form.k2tag.value;     ";
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(tag)) {
                    var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= "}\n\t}";
    //if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>


<style type="text/css">
table.smartcontent {
	border: 1px solid #D5D5D5;
	background-color: #F6F6F6;
	width: 100%;
	margin-bottom: 10px;
	-moz-border-radius:3px;
	-webkit-border-radius:3px;
	padding: 5px;
}
table.smartcontent td.key {
	background-color: #f6f6f6;
	text-align: left;
	width: 140px;
	color: #666;
	font-weight: bold;
	border-bottom: 1px solid #e9e9e9;
	border-right: 1px solid #e9e9e9;
}
</style>
<div id="element-box">
<div class="t">
    <div class="t">
        <div class="t"></div>
    </div>
</div>
<div class="m">



<form id="adminForm" name="adminForm" method="post" action="index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&tmpl=component&act=tags&task=k2content">



<table class="smartcontent" width="100%">
<tr>
<td width="185" class="key">
<span class="editlinktip">
<?php 
    $tip = _JNEWS_AUTONEWS_TYPE_TIPS;
    $title = _JNEWS_AUTONEWS_TYPE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
</span>
</td>
<td style="vertical-align: top;">
<span class="editlinktip">
<?php 
    $tip = _JNEWS_TITLE_ONLY_TIPS;
    $title = _JNEWS_TITLE_ONLY;
    $title_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_INTRO_ONLY_TIPS;
    $title = _JNEWS_INTRO_ONLY;
    $intro_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_FULL_ARTICLE_TIPS;
    $title = _JNEWS_FULL_ARTICLE;
    $full_article = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    ?>
</span>
<span class="editlinktip">
    <input type="radio" onclick="setContentTag('rendering', 0)" name="content_type" value="0" checked="checked" /><?php 
    echo $full_article;
    ?>
    <input type="radio"  onclick="setContentTag('rendering', 1)" name="content_type" value="1" /><?php 
    echo $intro_only;
    ?>
    <input id="for_disabled" type="radio" onclick="setContentTag('rendering', 2)" name="content_type" value="2" /><?php 
    echo $title_only;
    ?>
</span>

</td>
<td rowspan="2">
        <input onclick="setContentTag(null)" class="inserttag" type="button" label="Insert Tag" name="Insert Tag" value="<?php 
    echo _JNEWS_TAG_INSERT_TAG;
    ?>
"/>
</td>
</tr>

<tr>
	<td width="185" class="key">
		<span class="editlinktip">
			Tag
		</span>
	</td>
	<td style="vertical-align: top;">
		<!-- 	<input type="text" onchange="setCaptionTags();" size="60px" name="jnewstagcaption"> -->
			<input type="text" size="60px" name="k2tag">
	</td>
</tr>
<tr>
	<td width="185" class="key">
		<span class="editlinktip">
                    <?php 
    $tip = _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    $title = _JNEWS_HIDE_TITLE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
		</span>
	</td>
	<td style="vertical-align: top;">
            <span class="hide_title" >
                <input id="hide_title_no" onclick="setContentTag('hide_title', 0);" type="radio" name="hide_title" value="0" checked="checked" /><?php 
    echo 'No';
    ?>
                <input id="hide_title_yes" onclick="setContentTag('hide_title', 1);" type="radio" name="hide_title" value="1" /><?php 
    echo 'Yes';
    ?>
            </span>
        </td>
</tr>
</table>
<div id="element-box">
    <div class="t">
        <div class="t">
            <div class="t"></div>
        </div>
    </div>


    <div class="m"  style="position:relative;">


    <input type="hidden" name="option" value="<?php 
    echo JNEWS_OPTION;
    ?>
" />
    <input type="hidden" name="limit" value="<?php 
    echo $limit;
    ?>
" />
<!--////////////////////////////////////////////////////-->
        <?php 
    echo jnews::setTop($toSearch, null);
    $category_list_k2 = getAllCategoriesK2();
    ?>
        <div style="position:absolute;top:5px; left:55%;">
            <select name="filter_category_id_k2" class="inputbox" onchange="this.form.submit()">
                <option value=""><?php 
    echo JText::_('JOPTION_SELECT_CATEGORY');
    ?>
</option>
                <?php 
    for ($i = 0; $i < count($category_list_k2); $i++) {
        ?>
                <option value="<?php 
        echo $category_list_k2[$i]->id;
        ?>
"  <?php 
        if ($sort_select == $category_list_k2[$i]->id) {
            echo "selected";
        }
        ?>
>
                    <?php 
        echo $category_list_k2[$i]->name;
        ?>
                </option>
               <?php 
    }
    ?>
            </select>
        </div>
        <table class="<?php 
    echo jnews::myTheme();
    ?>
" cellpadding="0" cellspacing="0">
            <tbody>
                <thead>
                    <tr>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                       <?php 
    echo _JNEWS_TAGPICKLIST_TITLE;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                           <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title_2','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                        <?php 
    echo _JNEWS_TAG_ARTICLESECTION;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.title_2') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.catid','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                        <?php 
    echo _JNEWS_TAG_ARTICLECATEGORY;
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.catid') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>
                        <th width="80px" class="title">
                                <?php 
    if ($setSortk2->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.id','<?php 
    echo $new_sort;
    ?>
', 'k2content');" href="#">
                                       <?php 
    echo "  ID";
    ?>
                                         <?php 
    if ($setSortk2->orderValue == 'a.id') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>

                        </th>

                    </tr>
                </thead>
                <?php 
    if (sizeof($k2contentitems) > 0) {
        $k = 0;
        foreach ($k2contentitems as $k2contentitem) {
            if (empty($k2contentitem->section)) {
                $k2contentitem->section = JText::_('Uncategorised');
            }
            if (empty($k2contentitem->category)) {
                $k2contentitem->category = JText::_('Uncategorised');
            }
            echo '<tr style="cursor:pointer" class="row' . $k . '" onclick="setContentTag(\'' . $k2contentitem->id . '\');" ><td>' . $k2contentitem->title . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->section . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->category . '</td><td nowrap="nowrap" align="center">' . $k2contentitem->id . '</td></tr>';
            $k = 1 - $k;
        }
    }
    ?>
            </tbody>
        </table>
   <?php 
    echo jnews::setPaginationBot($setLimitk2, 'margin:auto;');
    ?>

</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
                <input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
                <input type="hidden" value="<?php 
    echo $setSortk2->orderValue;
    ?>
" name="k2_filter_order"/>
                  <input type="hidden" value="<?php 
    echo $setSortk2->orderValue;
    ?>
" name="filter_order"/>
                <input type="hidden" value="<?php 
    echo $setSortk2->orderDir;
    ?>
" name="filter_order_Dir"/>
</form>
</div>
<div class="b">
<div class="b">
<div class="b"></div>
</div>
</div>
</div>
<?php 
    $return = ob_get_contents();
    ob_end_clean();
    return array(_JNEWS_CONTENT_ITEM, $return);
}
예제 #2
0
    public static function controlPanel()
    {
        unset($GLOBALS["task"]);
        unset($_REQUEST["task"]);
        $doc = JFactory::getDocument();
        $doc->addStyleSheet(JNEWS_URL_ADMIN . 'cssadmin/jnews.css');
        ?>
<div align="center" class="centermain">
<div id="jnews">
		<table class="">
            <tr>
         	<td width="58%" valign="top">
				<?php 
        echo backHTML::iconsPanel();
        ?>
			</td>
			<td width="42%" valign="top">

			<div style="width=100%;">

			<script type="text/javascript">
				function checkcid(myField) {
					myField.checked = true;
					isChecked(true);
				}
			</script>

			<form action="index.php" method="post" name="adminForm" id="adminForm">
				<input type="hidden" name="option" value="<?php 
        echo JNEWS_OPTION;
        ?>
" />
				<input type="hidden" name="act" value="jnews" />
				<input type="hidden" name="task" value="" />
				<input type="hidden" name="userid" value="" />
		    	<input type="hidden" name="boxchecked" value="0" />

			<?php 
        $tabs = new MosTabsjNews(1);
        $tabs->startPane('acaControlPanel');
        $tabs->startTab(_JNEWS_MENU_TAB_SUM, "acaControlPanel.Summary");
        ?>
			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
			<tbody>
				<thead>
					<tr>
					 <th class="title" style="text-align: center;"><?php 
        echo '#';
        ?>
</th>
					 <th class="title" style="text-align: center;"><?php 
        echo _JNEWS_MENU_TAB_LIST;
        ?>
</th>
					 <th class="title" style="text-align: center;"><?php 
        echo _JNEWS_MENU_MAILING_TITLE;
        ?>
</th>
					</tr>
				</thead>
			 <?php 
        $html = '';
        $totalist = 0;
        $totalmail = 0;
        $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers0'];
        $totalsent = 0;
        $nb = explode(',', $GLOBALS[JNEWS . 'activelist']);
        $size = sizeof($nb);
        $countOfLists[1] = jNews_Lists::countLists(1);
        $countOfLists[2] = jNews_Lists::countLists(2);
        $countOfLists[7] = jNews_Mailing::countMails(7, true);
        $countOfMailings[1] = jNews_Mailing::countMails(1);
        $countOfMailings[2] = jNews_Mailing::countMails(2);
        $countOfMailings[7] = jNews_Mailing::countMails(7);
        for ($i = 0; $i < $size; $i++) {
            $index = $nb[$i];
            if ($GLOBALS[JNEWS . 'listshow' . $index] > 0 and $GLOBALS[JNEWS . 'listype' . $index] == 1) {
                $row = ($i + 1) % 2;
                $html .= '<tr class="row' . $row . '">';
                $html .= '<td><b>' . @constant($GLOBALS[JNEWS . 'listnames' . $index]) . '</b></td>';
                //					$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totallist'.$index].'1 </td>';
                $html .= '<td style="text-align: center; ">' . $countOfLists[$index] . ' </td>';
                //if the value to be is less than 0 we will display 0
                if ($GLOBALS[JNEWS . 'act_totalmailing' . $index] > 0) {
                    //						$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'act_totalmailing'.$index].' </td>';
                    $html .= '<td style="text-align: center; ">' . $countOfMailings[$index] . ' </td>';
                } else {
                    $html .= '<td style="text-align: center; ">0</td>';
                }
                //					$html .= '<td style="text-align: center; ">' .$GLOBALS[JNEWS.'totalmailingsent'.$index].' </td>';
                $html .= '</tr>';
                //					$totalist = $totalist + $GLOBALS[JNEWS.'act_totallist'.$index];
                $totalist = array_sum($countOfLists);
                //					$totalmail = $totalmail + $GLOBALS[JNEWS.'act_totalmailing'.$index];
                $totalmail = array_sum($countOfMailings);
                $totalsent = $totalsent + $GLOBALS[JNEWS . 'totalmailingsent' . $index];
                if ($GLOBALS[JNEWS . 'act_totalsubcribers' . $index] > $totalsub) {
                    $totalsub = $GLOBALS[JNEWS . 'act_totalsubcribers' . $index];
                }
            }
        }
        $html .= '<tr>';
        $html .= '<td style="background-color: #CCFFFF;"><b>' . _JNEWS_CP_TOTAL . '</b></td>';
        $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalist . ' </td>';
        $html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' . $totalmail . ' </td>';
        //			$html .= '<td style="text-align: center; text-decoration: bold; background-color: #CCFFFF; border-top: 1px solid #000; ">' .$totalsent.' </td>';
        //$html .= '<td style="text-align: center; ">' .$totalsub.' </td>';
        $html .= '</tr>';
        echo $html;
        ?>
			 </tbody></table>
			 <br />
			<?php 
        if (class_exists('jNews_Auto')) {
            echo jNews_Auto::showQueue();
        }
        $tabs->endTab();
        $tabs->startTab(_JNEWS_MENU_SUBSCRIBERS, "acaControlPanel.Subscribers");
        $emailsearch = '';
        $listId = 0;
        $limittotal = jNews_Subscribers::getSubscribersCount($listId);
        $setLimitSubs = jnews::setLimitPagination($limittotal);
        ?>
			<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
			<input type="hidden" name="start" value="<?php 
        echo $setLimitSubs->start;
        ?>
" />
			<input type="hidden" name="limit" value="<?php 
        echo $setLimitSubs->end;
        ?>
" />
			<input type="hidden" name="listsearch" value="<?php 
        echo $emailsearch;
        ?>
" />

			<div style="margin-top: 10px;"><?php 
        echo jnews::setTop('', '', $setLimitSubs);
        ?>
</div>

			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
				<thead>
					<tr>
						<th class="title">#</th>
						<th class="title" style="text-align: left;"><?php 
        echo _JNEWS_INPUT_NAME;
        ?>
</th>
						<th class="title" style="text-align: left;"><?php 
        echo _JNEWS_INPUT_EMAIL;
        ?>
</th>
						<th class="title" style="text-align: center;"><?php 
        echo _JNEWS_SIGNUP_DATE;
        ?>
</th>
					</tr>
				</thead>
				<?php 
        $subscribers = jNews_Subscribers::getSubscribers($setLimitSubs->start, $setLimitSubs->end, $emailsearch, $setLimitSubs->total, $listId, '', 0, 0, 'sub_dateD', 0, 0, null, 0);
        $i = 0;
        foreach ($subscribers as $subscriber) {
            $i++;
            if (!jNews_Subscribers::validEmail($subscriber->email)) {
                continue;
            }
            ?>
				<tr class="row<?php 
            echo ($i + 2) % 2;
            ?>
">
				<td><center><?php 
            echo $i + $setLimitSubs->start;
            ?>
</center></td>
				<td style="text-align: left;">
				<a href="index.php?option=<?php 
            echo JNEWS_OPTION;
            ?>
&act=subscribers&task=show&userid=<?php 
            echo $subscriber->id;
            ?>
" >
				<?php 
            echo $subscriber->name;
            ?>
</a></td>
				<td style="text-align: left;"><?php 
            echo $subscriber->email;
            ?>
</td>
				<td style="text-align: center;">
				<?php 
            echo date('l, jS F Y h:i:s A', jnews::getNow(0, true, $subscriber->subscribe_date));
            ?>
				</td>
				</tr>
				<?php 
        }
        ?>
			</table>

			<?php 
        $tabs->endTab();
        $tabs->startTab(_JNEWS_MENU_TAB_LIST, "acaControlPanel.Lists");
        $listsearch = '';
        $lists = jNews_Lists::getLists(0, 0, 1, '', false, false, false);
        $limittotal = count($lists);
        $setLimitLists = jnews::setLimitPagination($limittotal);
        ?>

			<input type="hidden" name="listid" value="<?php 
        echo $listId;
        ?>
" />
			<input type="hidden" name="start" value="<?php 
        echo $setLimitLists->start;
        ?>
" />
			<input type="hidden" name="limit" value="<?php 
        echo $setLimitLists->end;
        ?>
" />
			<input type="hidden" name="listsearch" value="<?php 
        echo $listsearch;
        ?>
" />

			<div style="margin-top: 10px;"><?php 
        echo jnews::setTop('', '', $setLimitLists);
        ?>
</div>

			<table class="<?php 
        echo jnews::myTheme();
        ?>
">
				<thead>
				<tr>
					<th class="title">#</th>
					<th class="title" width="65%"  style="text-align: left;"><?php 
        echo _JNEWS_LIST_NAME;
        ?>
</th>
					<th class="title" width="25%"  style="text-align: left;"><?php 
        echo _JNEWS_LIST_TYPE;
        ?>
</th>
					<th class="title"  style="text-align: center;">ID</th>
				</tr>
				</thead>
			<?php 
        $lists = jNews_Lists::getLists(0, 0, 1, 'listtypeA', false, false, false, false, false, $listsearch, $setLimitLists, 0, 0);
        $i = 0;
        foreach ($lists as $list) {
            $i++;
            $link = 'index.php?option=' . JNEWS_OPTION . '&act=mailing&task=show&listid=' . $list->id;
            ?>
				<tr class="row<?php 
            echo ($i + 2) % 2;
            ?>
">
					<td><?php 
            echo $i + $setLimitLists->start;
            ?>
</td>
					<td  style="text-align: left;">
						<a href="<?php 
            echo $link;
            ?>
">
							<?php 
            echo $list->list_name;
            ?>
</a>
					</td>
					<td  style="text-align: left;"><?php 
            if ($list->list_type == 1) {
                echo _JNEWS_LIST;
            } else {
                echo _JNEWS_AR;
            }
            ?>
</td>
					<td  style="text-align: center;"><?php 
            echo $list->id;
            ?>
</td>
					</tr>
			<?php 
        }
        ?>
			<tr>
				<th colspan="4">
				</th>
			</tr>
			</table>
			<?php 
        $tabs->endTab();
        ?>
			<?php 
        $tabs->endPane();
        ?>
			</form>
		</div>
		<div style="clear:both; float:left; margin-top: 10px;">
		<?php 
        echo jnews::printM('ok', _JNEWS_SERVER_LOCAL_TIME . ' : ' . date('l, j F Y H:i:s', jnews::getNow(0, true)));
        // - date('Z')
        ?>
		</div>
   <td>
   </tr>
   </table>
   </div>
</div>
<?php 
    }
예제 #3
0
파일: jnewsbot.php 프로젝트: naka211/kkvn
function jnewsbot_content_editab($forms)
{
    if (version_compare(JVERSION, '3.0.0', '<')) {
        JHTML::_('behavior.mootools');
    } else {
        JHtmlBehavior::framework();
    }
    $siteContent = new siteContent();
    //	$limit = -1;
    $limit = 5;
    $limittotal = $siteContent->countSiteCount();
    $setLimit = jnews::setLimitPagination($limittotal);
    $action = JRequest::getVar('act', '', '', 'WORD');
    $task = JRequest::getVar('task');
    $contentsearch = JRequest::getVar('contentsearch', '');
    echo $forms['main'];
    $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
    $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
    $toSearch = new stdClass();
    $toSearch->forms = '';
    $toSearch->hidden = $hidden;
    $toSearch->listsearch = $contentsearch;
    $toSearch->id = 'contentsearch';
    $app = JFactory::getApplication();
    $setSort = new stdClass();
    if (!isset($_POST['c_filter_order'])) {
        $setSort->orderValue = "a.id";
    } else {
        $setSort->orderValue = $_POST['filter_order'];
    }
    //$setSort->orderValue = $app->getUserStateFromRequest(JNEWS_OPTION . '.content.filter_order', 'filter_order', 'a.id', 'cmd');
    $setSort->orderDir = $app->getUserStateFromRequest(JNEWS_OPTION . '.content.filter_order_Dir', 'filter_order_Dir', 'desc', 'word');
    //$setSort->orderValue  = "a.id";
    $contentItems = jnewsbot_content_getitems($contentsearch, $setLimit, $setSort);
    ob_start();
    $js = "function setContentTag(id, url, changeType , hide_title)\n           {\n\n                if(hide_title ==undefined)\n                {\n                    var check_title =  document.getElementById('hide_title_no').checked;\n                    if(check_title) hide_title = 0;\n                    else            hide_title = 1;\n\n                }\n\n\n\n                var form = document.adminForm;\n                if(!form)\n                {\n                        form = document.mosForm;\n                }\n\n                if(form.content_type[2].checked === false)\n                {\n                        document.getElementById('hide_title_yes').disabled=false;\n                }\n                else\n                {\n                      document.getElementById('hide_title_no').click();\n                      hide_title = 0;\n                      document.getElementById('hide_title_yes').disabled=true;\n                }\n                if(id!=null)\n                {\n                        for (i=0; i<form.content_type.length; i++)\n                        {\n                                if (form.content_type[i].checked)\n                                {\n                                        var content_type = form.content_type[i].value;\n                                }\n                        }";
    //   if ( @include_once( JNEWSPATH_ADMIN . 'social' .DS. 'class.social.php' ) ) {
    if (!$GLOBALS[JNEWS . 'use_tags'] and class_exists('jNews_Social') or !$GLOBALS[JNEWS . 'use_tags'] and $GLOBALS[JNEWS . 'level'] > 2) {
        $js .= "\n                            if(changeType!=null)\n                                id = document.getElementById('insertbot').value;\n\n                            template = window.top.document.getElementById('template_id');\n                            templateid = template.value;\n\n                            var tag =  id;\n                            if(id != 0)\n                                getContent(id, content_type, url,templateid);\n\n                            form.contenttag.value = tag;\n                    }\n                    //if id == null\n                    else\n                    {\n                            var tag = form.contentreplace.value;";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
        } else {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
            } else {
                $js .= 'if(window.top.insertTag(tag))
                                        {
                                            var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                                            if(need_click.length == 0) window.parent.SqueezeBox.close();
                                            else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
            }
        }
        $js .= "}\n                      }";
    } else {
        $js .= "\n                                if(changeType==null)\n                                        form.botID.value= id;\n\n                                var tag = '{contentitem:' + form.botID.value + '|' + content_type +'|'+hide_title+ '}';\n\n                                form.contenttag.value = tag;\n                    }\n                    //if id -- null\n                    else\n                    {\n\n                                var tag = form.contenttag.value;";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= " if(window.top.insertTag(tag)){window.top.document.getElementById('sbox-window').close();}";
        } else {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
            } else {
                $js .= ' if(window.top.insertTag(tag)) {
                                                var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                                                if(need_click.length == 0) window.parent.SqueezeBox.close();
                                                else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
            }
        }
        $js .= "}\n                            }";
    }
    //end function
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= "\n\n \t\t\tfunction getContent(id, content_type, url, templateid){\n\n \t\t\t\tvar ajax = new Ajax(url,\n \t\t\t\t\t{data: 'artId='+id+'&content_type='+content_type+'&templateid='+templateid,\n \t\t\t\t\tmethod: 'POST',\n \t\t\t\t\tonComplete : function(result){insertContent(result, id); }\n \t\t\t\t\t}\n \t\t\t\t);\n \t\t\t\tajax.request();\n \t\t\t}";
    } else {
        $js .= "\n \t\t\tfunction getContent(id, content_type, url,templateid){\n\n\t\t\t\tvar ajax = new Request({\n\t\t\t\turl : url,\n\t\t\t\tdata: 'artId='+id+'&content_type='+content_type+'&templateid='+templateid,\n\t\t\t\tmethod: 'POST',\n\t\t\t\tonComplete : function(result){insertContent(result, id); }\n\t\t\t\t});\n\t\t\t\tajax.send();\n \t\t\t}";
    }
    $js .= "\n \t\t\tfunction insertContent(html, id){\n\t\t\t\tvar form = document.adminForm;\n\t\t\t\tif(!form){\n\t\t\t\t\tform = document.mosForm;\n\t\t\t\t}\n\n\t\t\t\tvar root = document.createElement('div');\n\n\t\t\t\troot.innerHTML = html;\n\t\t\t\tvar body = document.getElementsByTagName('body')[0].appendChild(root);\n\n\t\t\t\troot.setAttribute(\"style\", \"width:150px; display:none\");\n\t\t\t\tvar element = document.getElementById('artcontent_'+id);\n\n\t\t\t\tform.contentreplace.value = element.innerHTML;\n\n\t\t\t\tdocument.getElementsByTagName('body')[0].removeChild(root);\n\t\t\t}\n\t\t\t";
    $url = jNews_Tools::completeLink('option=' . JNEWS_OPTION . '&act=mailing&task=articleContent', false, false, true);
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>

    <style type="text/css">
        table.smartcontent {
            border: 1px solid #D5D5D5;
            background-color: #F6F6F6;
            width: 100%;
            margin-bottom: 10px;
            -moz-border-radius:3px;
            -webkit-border-radius:3px;
            padding: 5px;
        }
        table.smartcontent td.key {
            background-color: #f6f6f6;
            text-align: left;
            width: 140px;
            color: #666;
            font-weight: bold;
            border-bottom: 1px solid #e9e9e9;
            border-right: 1px solid #e9e9e9;
        }
    </style>
    <div id="element-box">
        <div class="t">
            <div class="t">
                <div class="t"></div>
            </div>
        </div>
        <div class="m">




    <!--<form name="adminForm" method="post" action="index.php?option=<?php 
    echo JNEWS_OPTION;
    ?>
&tmpl=component">-->
            <table class="smartcontent" width="100%"">
                   <tr>
                    <td width="185" class="key">
                        <span class="editlinktip">
                            <?php 
    $tip = _JNEWS_AUTONEWS_TYPE_TIPS;
    $title = _JNEWS_AUTONEWS_TYPE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
                        </span>
                    </td>
                    <td style="vertical-align: top;">
                        <span class="editlinktip">
    <?php 
    $tip = _JNEWS_TITLE_ONLY_TIPS;
    $title = _JNEWS_TITLE_ONLY;
    $title_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_INTRO_ONLY_TIPS;
    $title = _JNEWS_INTRO_ONLY;
    $intro_only = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    $tip = _JNEWS_FULL_ARTICLE_TIPS;
    $title = _JNEWS_FULL_ARTICLE;
    $full_article = "<span class=\"editlinktip\">" . jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0) . "</span>";
    //                                $tip =  _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    //				$title =  _JNEWS_HIDE_TITLE ;
    //				$hide_title = "<span class=\"editlinktip\">" . jNews_Tools::toolTip( $tip, '', 280, 'tooltip.png', $title, '', 0 ) . "</span>";
    ?>
                        </span>
                        <span class="editlinktip">
                            <input id="content_type" type="radio" name="content_type" value="0" checked="checked" onclick="setContentTag(1,'<?php 
    echo $url;
    ?>
', 0);"/><?php 
    echo $full_article;
    ?>
                            <input id="content_type" type="radio" name="content_type" value="1" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 1);"/><?php 
    echo $intro_only;
    ?>
                            <input id="content_type" type="radio" name="content_type" value="2" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 2);"/><?php 
    echo $title_only;
    ?>
                            <!--<input id="content_type" type="radio" name="content_type" value="3" onclick="setContentTag(1, '<?php 
    //echo $url
    ?>
', 3);"/><?php 
    //echo $hide_title;
    ?>
-->
                        </span>

                    </td>
                    <td rowspan="2">
                        <input onclick="setContentTag(null,'<?php 
    echo $url;
    ?>
')" class="inserttag" type="button" label="Insert Content" name="Insert Content" value="Insert Content"/>
                    </td>
                </tr>

                <tr>
                    <td width="185" class="key">
                        <span class="editlinktip">
    <?php 
    $tip = _JNEWS_CONTENT_TIP;
    $title = _JNEWS_CONTENT_ID;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
                        </span>
                    </td>
                    <td style="vertical-align: top;">
                                    <!--  <input type="text" onchange="setCaptionTags();" size="60px" name="jnewstagcaption"> -->
                        <input id="insertbot" type="text" size="20px" name="contenttag" value="0"/>
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input id="insertbot" type="hidden" size="60px" name="contentreplace" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input id="botID" size="10px" name="botID" value="0" type="hidden"/>
                    </td>
                </tr>


                <tr>
                    <td width="185" class="key">
                        <span class="editlinktip">
                    <?php 
    $tip = _JNEWS_HIDE_TITTLE_ARTICLE_TIPS;
    $title = _JNEWS_HIDE_TITLE;
    echo jNews_Tools::toolTip($tip, '', 280, 'tooltip.png', $title, '', 0);
    ?>
                        </span>
                    </td>
                    <td style="vertical-align: top;">
                        <input id="hide_title_no" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 2, 0);" type="radio" name="hide_title" value="0" checked="checked" /><?php 
    echo 'No';
    ?>
                        <input id="hide_title_yes" onclick="setContentTag(1, '<?php 
    echo $url;
    ?>
', 2, 1);" type="radio" name="hide_title" value="1" /><?php 
    echo 'Yes';
    ?>

                    </td>
                </tr>
            </table>
            <div id="element-box">
                <div class="t">
                    <div class="t">
                        <div class="t"></div>
                    </div>
                </div>
                <div class="m" style="position:relative;">
                                    <?php 
    echo jnews::setTop($toSearch, null);
    $select_cat = version_compare(JVERSION, '1.6.0', '<') ? 'SELECT CATEGORY' : 'JOPTION_SELECT_CATEGORY';
    ?>
                    <div style="position:absolute;top:5px; left:55%;">
                    <?php 
    $sort_select = JRequest::getVar('filter_category_id', '', 'POST', 'int');
    ?>
                        <select name="filter_category_id" class="inputbox" onchange="this.form.submit()">
                            <option value=""><?php 
    echo JText::_($select_cat);
    ?>
</option>
                            <?php 
    if (version_compare(JVERSION, '1.6.0', '<')) {
        echo getCatListFromJoomla15($sort_select);
    } else {
        echo JHtml::_('select.options', JHtml::_('category.options', 'com_content'), 'value', 'text', $sort_select);
    }
    ?>
                        </select>
                    </div>
<!--                          border: 1px solid #CCCCCC;-->
                    <table class="joobilist" cellpadding="0" cellspacing="0">
                        <tbody>
                        <thead>
                            <tr>
                                <th class="title">
                                      <?php 
    if ($setSort->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                                <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.title','<?php 
    echo $new_sort;
    ?>
', 'content');" href="#">
                                                    <?php 
    echo JText::_(_JNEWS_TAGPICKLIST_TITLE);
    ?>
                                                    <?php 
    if ($setSort->orderValue == 'a.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                                </a>
    <?php 
    //echo _JNEWS_TAGPICKLIST_TITLE;
    // echo jnews::HTML_GridSort(_JNEWS_TAGPICKLIST_TITLE, 'a.title', $setSort->orderDir, $setSort->orderValue);
    ?>
                                </th>
                                <th width="80px" class="title">
                        <?php 
    //echo _JNEWS_TAG_ARTICLESECTION;
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //j15
        echo jnews::HTML_GridSort(_JNEWS_TAG_ARTICLESECTION, 'b.title', $setSort->orderDir, $setSort->orderValue);
    } else {
        ?>

                              <?php 
        if ($setSort->orderDir == 'asc') {
            $new_sort = "desc";
        } else {
            $new_sort = "asc";
        }
        ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('c.title_2','<?php 
        echo $new_sort;
        ?>
', 'content');" href="#">
                                        <?php 
        echo JText::_(_JNEWS_TAG_ARTICLESECTION);
        ?>
                                         <?php 
        if ($setSort->orderValue == 'c.title_2') {
            ?>
<i class="icon-arrow-<?php 
            echo $new_sort == "asc" ? "up" : "down";
            ?>
"></i><?php 
        }
        ?>
                                    </a>

<!--                            echo jnews::HTML_GridSort(_JNEWS_TAG_ARTICLESECTION, 'b.title', $setSort->orderDir, $setSort->orderValue);-->
                        <?php 
    }
    ?>
                                </th>
                                <th width="80px" class="title">
                                <?php 
    if ($setSort->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                    <a class="hasTip" title="" onclick="Joomla.tableOrdering('c.title','<?php 
    echo $new_sort;
    ?>
', 'content');" href="#">
                                        <?php 
    echo JText::_(_JNEWS_TAG_ARTICLECATEGORY);
    ?>
                                         <?php 
    if ($setSort->orderValue == 'c.title') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                    </a>
                    <?php 
    //echo _JNEWS_TAG_ARTICLECATEGORY;
    // echo jnews::HTML_GridSort(_JNEWS_TAG_ARTICLECATEGORY, 'c.title', $setSort->orderDir, $setSort->orderValue);
    ?>
                                </th>
                                <th width="30px" class="title">
                                    <?php 
    if ($setSort->orderDir == 'asc') {
        $new_sort = "desc";
    } else {
        $new_sort = "asc";
    }
    ?>
                                        <a class="hasTip" title="" onclick="Joomla.tableOrdering('a.id','<?php 
    echo $new_sort;
    ?>
', 'content');" href="#">
                                            ID
                                             <?php 
    if ($setSort->orderValue == 'a.id') {
        ?>
<i class="icon-arrow-<?php 
        echo $new_sort == "asc" ? "up" : "down";
        ?>
"></i><?php 
    }
    ?>
                                        </a>
                                        <?php 
    //echo jnews::HTML_GridSort('ID', 'a.id', $setSort->orderDir, $setSort->orderValue, 'task');
    ?>
                                </th>
                            </tr>
                        </thead>
    <?php 
    if (sizeof($contentItems) > 0) {
        $k = 0;
        foreach ($contentItems as $contentItem) {
            if (empty($contentItem->section)) {
                $contentItem->section = JText::_('Uncategorised');
            }
            if (empty($contentItem->category)) {
                $contentItem->category = JText::_('Uncategorised');
            }
            echo '<tr style="cursor:pointer" class="row' . $k . '" onclick="setContentTag(\'' . $contentItem->id . '\',\'' . $url . '\');" ><td>' . $contentItem->title . '</td><td nowrap="nowrap" align="center">' . $contentItem->section . '</td><td nowrap="nowrap" align="center">' . $contentItem->category . '</td><td nowrap="nowrap" align="center">' . $contentItem->id . '</td></tr>';
            //echo '<tr style="cursor:pointer" class="row'.$k.'" onclick="setContentTag(\''.$contentItem->id.'\',\''.$url.'\');" ><td>'.$contentItem->title.'</td><td nowrap="nowrap" align="center">'.$contentItem->section.'</td><td nowrap="nowrap" align="center">'.$contentItem->category.'</td><td nowrap="nowrap" align="center">'.$contentItem->id.'</td></tr>';
            $k = 1 - $k;
        }
    }
    ?>
                        </tbody>
                    </table>
    <?php 
    echo jnews::setPaginationBot($setLimit, 'margin:auto;');
    ?>
                    <input type="hidden" value="<?php 
    echo JNEWS_OPTION;
    ?>
" name="option"/>
                    <input type="hidden" value="<?php 
    echo $action;
    ?>
" name="act"/>
                    <input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
                    <input type="hidden" value="<?php 
    echo $setSort->orderValue;
    ?>
" name="c_filter_order"/>
                    <input type="hidden" value="<?php 
    echo $setSort->orderValue;
    ?>
" name="filter_order"/>
                    <input type="hidden" value="<?php 
    echo $setSort->orderDir;
    ?>
" name="filter_order_Dir"/>
                    </form>
                </div>
                <div class="b">
                    <div class="b">
                        <div class="b"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="b">
            <div class="b">
                <div class="b"></div>
            </div>
        </div>
    </div>
    <?php 
    $return = ob_get_contents();
    ob_end_clean();
    return array(_JNEWS_CONTENT_ITEM, $return);
}
예제 #4
0
function virtuemartproduct($forms, $params = null)
{
    $vmproducts = new virtuemartProducts();
    $limit = -1;
    $limittotal = $vmproducts->_countVMProducts();
    $setLimit = jnews::setLimitPagination($limittotal);
    $action = JRequest::getVar('act', '', '', 'WORD');
    $task = JRequest::getVar('task');
    $vmproductsearch = JRequest::getVar('vmproductsearch', '');
    echo $forms['main'];
    $hidden = '<input type="hidden" name="option" value="' . JNEWS_OPTION . '" />';
    $hidden .= '<input type="hidden" name="limit" value="' . $limit . '" />';
    $toSearch = new stdClass();
    $toSearch->forms = '';
    $toSearch->hidden = $hidden;
    $toSearch->listsearch = $vmproductsearch;
    $toSearch->id = 'vmproductsearch';
    ?>

<div id="element-box">
	<div class="t">
		<div class="t">
			<div class="t"></div>
		</div>
	</div>
	<div class="m">
<?php 
    echo jnews::setTop($toSearch, null);
    $js = 'function insertjnewstag(tag){';
    if (version_compare(JVERSION, '1.6.0', '<')) {
        //1.5
        $js .= ' if(window.top.insertTag(tag)){window.top.document.getElementById(\'sbox-window\').close();}';
    } else {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            $js .= ' if(window.top.insertTag(tag)) {window.parent.SqueezeBox.close();}';
        } else {
            $js .= ' if(window.top.insertTag(tag)) {           
                     var need_click = jQuery(window.top.document).find("div.modal-backdrop");
                    if(need_click.length == 0) window.parent.SqueezeBox.close();
                    else    jQuery(window.top.document).find("div.modal-backdrop").click();}';
        }
    }
    $js .= '}';
    $doc = JFactory::getDocument();
    $doc->addScriptDeclaration($js);
    ?>
	<table class="<?php 
    echo jnews::myTheme();
    ?>
" cellpadding="0" cellspacing="0">
		<tbody>
			<thead>
				<tr>
					<th class="title"> Tag
					</th>
					<th class="title">
						<?php 
    echo 'Product Name';
    ?>
					</th>
					<th width="80px" class="title">
						<?php 
    echo 'Product Description';
    ?>
					</th>
					<th  width="60px" class="title">
						<?php 
    echo 'Product ID';
    ?>
					</th>
				</tr>
			</thead>
<?php 
    $products = $vmproducts->_getVMProducts($vmproductsearch, $setLimit);
    $k = 0;
    $html = '';
    foreach ($products as $product) {
        if (empty($product->product_s_desc) && !empty($product->product_desc)) {
            $product->product_s_desc = substr(strip_tags($product->product_desc), 0, 100);
        } else {
            $product->product_s_desc = '';
        }
        $insertTag = '{vmprod=' . $product->virtuemart_product_id . '}';
        $html .= '<tr style="cursor:pointer" class="row' . $k . '" onclick="insertjnewstag(\'' . $insertTag . '\')" ><td><strong>{vmprod=' . $product->virtuemart_product_id . '}</strong></td><td>' . $product->product_name . '</td><td nowrap="nowrap" align="left">' . $product->product_s_desc . '</td><td align="center" nowrap="nowrap">' . $product->virtuemart_product_id . '</td></tr>';
        $k = 1 - $k;
    }
    echo $html;
    ?>
		</tbody>
	</table>
<?php 
    $css = 'margin:auto;';
    echo jnews::setPaginationBot($setLimit, $css);
    ?>
	</div>
	<div class="b">
		<div class="b">
			<div class="b"></div>
		</div>
	</div>
</div>
	<input type="hidden" value="<?php 
    echo JNEWS_OPTION;
    ?>
" name="option"/>
	<input type="hidden" value="<?php 
    echo $action;
    ?>
" name="act"/>
	<input type="hidden" value="<?php 
    echo $task;
    ?>
" name="task"/>
  	</form>
<?php 
}