Пример #1
0
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
    /**
     * <p>public static function to create the view of the template list where the user can assign a template to a newsletter.</p>
     * @param mixed $templates - the array object list of templates in the database
     */
    public static function assignTemplate($templates, $forms, $setLimit, $templatesearch)
    {
        if (version_compare(JVERSION, '3.0.0', '<')) {
            JHTML::_('behavior.modal');
        } else {
            JHtml::_('behavior.modal');
        }
        if (version_compare(JVERSION, '3.0.0', '<')) {
            JHTML::_('behavior.mootools');
        } else {
            JHtmlBehavior::framework();
        }
        $action = JRequest::getString('act', '', 'request');
        $js = "function assignTemplate(templateid){var templatebody = window.document.getElementById('templatebody_'+templateid).innerHTML;\n\t \tvar templatealtbody = window.document.getElementById('templatealtbody_'+templateid).innerHTML;\n\t \twindow.top.changeTemplate(templatebody, templatealtbody,templateid);";
        if (version_compare(JVERSION, '1.6.0', '<')) {
            //1.5
            $js .= " window.top.document.getElementById('sbox-window').close();";
        } else {
            if (version_compare(JVERSION, '3.0.0', '<')) {
                $js .= " window.parent.SqueezeBox.close();";
            } else {
                $js .= 'jQuery(window.top.document).find("div.modal-backdrop").click();';
            }
        }
        $js .= "}";
        $doc = JFactory::getDocument();
        $doc->addScriptDeclaration($js);
        ?>
	  	<style type="text/css">
	  	div#pagination {
	  		background-color: #006699;
	  		margin: auto;
	  		padding: 0 8px;
	  		color: #FFFFFF;
	  	}

	  	div.template-container {
	  		border-bottom: 1px dotted #000000;
	  		padding: 5px;
	  		margin-top: 10px;
	  		float: left;
	  		width: 596px;
	  		cursor:pointer;
	  	}
	  	div.template-container:hover {
	  		background-color: #CCFFFF;
	  	}

	  	div.template-container div#image {
	  		float:left;
	  		margin-right: 5px;
	  	}

	  	div.template-container div#name {
	  		clear: right;
	  		border: 1px solid #000;
	  		font-weight: bold;
	  		font-size: 1.2em;
	  	}

	  	div.template-container div#description {
	  		margin-top: 5px;
	  	}

	  	</style>
	  	<?php 
        echo $forms['main'];
        ?>
		<div id="pagination">
		<?php 
        // for search
        $limit = -1;
        $hidden = '<input type="hidden" name="limit" value="' . $limit . '" />';
        $toSearch = new stdClass();
        //$toSearch->forms = '';
        $toSearch->hidden = $hidden;
        $toSearch->listsearch = $templatesearch;
        $toSearch->id = 'templatesearch';
        //echo jnews::setTop($toSearch, null, $setLimit, null, true);
        echo jnews::setTop($toSearch, null);
        ?>
		</div>
	 	<?php 
        foreach ($templates as $countMeNow => $template) {
            if ($template->availability == 1 && $template->published == 1) {
                if (empty($template->thumbnail)) {
                    $template->thumbnail = 'sample-image.png';
                }
                $findposhttp = strpos($template->thumbnail, 'http://');
                $findposwww = strpos($template->thumbnail, 'www.');
                if ($findposhttp === false || $findposwww === false) {
                    $path = $template->thumbnail;
                    $img = '<img src="' . $path . '" alt="' . $template->name . '">';
                } else {
                    $path = $template->thumbnail;
                    $img = '<img src="' . $path . '" alt="' . $template->name . '">';
                }
                ?>
			<div class="template-container" onclick="assignTemplate(<?php 
                echo $template->template_id;
                ?>
);">
				<div id="image"><?php 
                echo $img;
                ?>
</div>
				<div id="name" style="text-indent:10px"><?php 
                echo $template->name;
                ?>
</div>
				<div id="description" style="text-indent:25px" ><?php 
                echo jnews::stringTruncate($template->description, 400, ".", "...");
                ?>
</div>
				<div id="templatebody_<?php 
                echo $template->template_id;
                ?>
" style="display:none;"><?php 
                echo $template->body;
                ?>
</div>
				<div id="templatealtbody_<?php 
                echo $template->template_id;
                ?>
" style="display:none;"><?php 
                echo $template->altbody;
                ?>
</div>
			</div>
		<?php 
            }
        }
        $css = 'margin:auto;';
        echo jnews::setPaginationBot($setLimit, $css);
        ?>
	 	<input type="hidden" value="<?php 
        echo JNEWS_OPTION;
        ?>
" name="option"/>
		<input type="hidden" value="<?php 
        echo $action;
        ?>
" name="act"/>
		<input type="hidden" value="assign" name="task"/>
    	<input type="hidden" value="0" name="boxchecked" id="boxcount"/>

		</form>
	 	<?php 
    }
Пример #3
0
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 
}