Joomla module position with Yt framework - module

I am working with a Joomla 2.5 template called Sj_news25 - see the demo here http://demo.smartaddons.com/templates/joomla17/sj-news/
What I want to do is create a module position somewhere between the logo and the search box, so I can fit a language switcher flags there. I have previously used a tutorial on http://docs.joomla.org/How_do_you_add_a_new_module_position%3F and that has worked fine, but this template uses a so-called "Yt Framework" and when I look at the index.php file, I'm stumped. Is there anyone here who could venture a guess? Thanks!
<?php
/****************************************************************************************
* #copyright Copyright (C) 2005 - 2010 Open Source Matters. All rights reserved.
* #license GNU/GPL, see LICENSE.php
* Yt Framework
****************************************************************************************/
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
include_once (dirname(__FILE__).DS.'includes'.DS.'yt_template.class.php');
include_once (dirname(__FILE__).DS.'includes'.DS.'frame_inc.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" <?php echo ($ytrtl == 'rtl')?'dir="rtl"':''; ?> lang="<?php echo $this->language; ?>">
<head>
<jdoc:include type="head" />
</head>
<body id="<?php echo $yt->template; ?>" class="<?php echo $yt->isHomePage()?'homepage ':'';
echo isset($_GET['option'])?$_GET['option'].' ':'';
echo isset($_GET['view'])?'view-'.$_GET['view'].' ':'';
echo $yt->getParam('sitestyle').' ';
echo $ytrtl=='rtl'?'rtl'.' ':'';
echo $yt->getParam('menustyle').' ';
echo 'fs'.$yt->getParam('fontsize'); ?>">
<div id="yt-wrapper"><div id="yt-wrapper-inner1"><div id="yt-wrapper-inner2">
<?php
// add mobile head
if( $yt->is_mobile ){
include_once (dirname(__FILE__).DS.'includes'.DS.'mobile_head.php');
}
?>
<a id="top" name="scroll-to-top"></a>
<?php
foreach($yt_render->arr_TB as $tagBD): if( $tagBD["countModules"] > 0 ){
if( ($tagBD["name"] == 'content') ){ // Block content - #content ?>
<div id="<?php echo $tagBD["id"]; ?>" class="<?php echo $yt_render->layouttype.$tagBD['class_content'];?>">
<?php
//
if($tagBD['showDivTop']=='1'){ ?>
<div class="yt-main yt-div-top-1"><div class="yt-div-top-2"><div class="yt-div-top-3"></div></div></div>
<?php } ?>
<div class="yt-main"><div class="yt-main-in1"><div class="yt-main-in2 clearfix">
<?php
$countL = $countR = $countM = $countCL1 = $countCL2 = 0;
foreach($tagBD['positions'] as $position):
if( isset($position['column']) && $position['column'] == 'yt-col1' ){
$countCL1++;
if($countCL1==1){
?>
<div id="yt-col1" style="float:left; width:<?php echo $yt_render->cinfo['w-yt-col1']; ?>;<?php echo $yt_render->cinfo['display-yt-col1']; ?>">
<?php
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
if($tagBD['count-yt-col1']==1){
?>
</div>
<?php
}
}elseif( $countCL1==$tagBD['count-yt-col1'] && $tagBD['count-yt-col1']>1 ){
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
?>
</div>
<?php
}else{
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
}
}elseif( isset($position['column']) && $position['column'] == 'yt-col2' ){
$countCL2++;
if($countCL2==1){
?>
<div id="yt-col2" style="float:right; width:<?php echo $yt_render->cinfo['w-yt-col2']; ?>;<?php echo $yt_render->cinfo['display-yt-col2']; ?>">
<?php
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
if($tagBD['count-yt-col2']==1){
?>
</div>
<?php
}
}elseif( $countCL2==$tagBD['count-yt-col2'] && $tagBD['count-yt-col2']>1 ){
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
?>
</div>
<?php
}else{
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
}
}else{
include (dirname(__FILE__).DS.'includes'.DS.'block-content.php');
}
endforeach; //End foreach position of block content
?>
</div></div></div>
<?php
//
if($tagBD['showDivBottom']=='1'){ ?>
<div class="yt-main yt-div-bottom-1"><div class="yt-div-bottom-2"><div class="yt-div-bottom-3"></div></div></div>
<?php } ?>
</div>
<?php
}elseif($tagBD["name"] != 'content'){ // Block is not content
?>
<div id="<?php echo $tagBD["id"]; ?>">
<div class="yt-main"><div class="yt-main-in1"><div class="yt-main-in2 clearfix">
<?php
if( !empty($tagBD["hasGroup"]) && $tagBD["hasGroup"]=="1"){ // Tag Body has group
$flag = ''; $openG = 0; $c = 0;
foreach( $tagBD['positions'] as $posFG ): $c = $c+1;
if( $posFG['group'] != "" && $posFG['group']!= $flag){
$flag = $posFG['group'];
if($openG == 0){ $openG =1;?>
<div class="group-<?php echo $flag.$tagBD['class_groupnormal'];?> clearfix" style="<?php echo isset($tagBD['width-'.$flag])?'width:'.$tagBD['width-'.$flag].'; ':'' ; ?><?php echo $float1;?>">
<?php
echo $yt->renPositionGroup($posFG);
if($c == count( $tagBD['positions']) ){echo '</div>';}
}else{
$openG = 0;
?>
</div>
<div class="group-<?php echo $flag; ?>" style="width:<?php echo $tagBD['width-'.$flag]; ?>; <?php echo $float1;?>">
<?php
echo $yt->renPositionGroup($posFG);
}
}elseif($posFG['group']!="" && $posFG['group'] == $flag){
echo $yt->renPositionGroup($posFG);
if($c == count( $tagBD['positions']) ){echo '</div>';}
}elseif($posFG['group']==""){
if($openG ==1){
$openG = 0;
echo '</div>';
}
echo $yt->renPositionGroup($posFG);
}
endforeach;
}else{ //Tag Body normal
if(isset($tagBD['positions'])){
if(isset($tagBD['autosize'])){
echo $yt->renPositionNormals($tagBD['positions'], $tagBD["countModules"], $tagBD["limited"], $tagBD['autosize']);
}else{
echo $yt->renPositionNormals($tagBD['positions'], $tagBD["countModules"], $tagBD["limited"]);
}
}
}
?>
</div></div></div>
</div>
<?php
} // end elseif($tagBD["name"] != 'content')
}
endforeach;
?>
</div></div></div>
<jdoc:include type="modules" name="debug" />
<?php
if( !$yt->is_mobile && $yt->getParam('showCpanel') ) {
include_once (dirname(__FILE__).DS.'includes'.DS.'cpanel.php');
}
?>
</body>
</html>
<?php /*}*/ ?>

Please go to file: your_template/layouts/layout-homepage.xml(or current layout) replace code:
#logo
header1
by:
#logo
your_position
header1
You can find out more about Yt Framework here: http://www.smartaddons.com/joomla/templates/yt-framework

Related

Issue to open dialog: Yii

I have used ajaxSubmitButton in my form.On click of button i am trying to open dialog When i click the button ,the dialog opens and it displays entire code written for that form . How to resolve this?
my code for button is :
<div class="btnalign" style="margin-top: 20px;margin-left:20px;">
<?=CHtml::ajaxSubmitButton('Mail to Client', Yii::app()->createUrl('reply/composeMail'),
array('type'=>'POST',
'data'=> 'js:{"data1":callData()}',
//'success' => 'function(response){afterSubmitForm(response);}'
'success'=>'js:function(string){ alert(string);$.fn.yiiGridView.update("my-grid"); }'
),
array('class' => 'btn btn-primary'));
?>
</div>
my controller code:
public function actionComposeMail()
{
if(Yii::app()->request->isAjaxRequest){
print_r($_POST['data1']);
if(isset($_POST['data1'])){
$model=new Reply;
$model->scenario = 'compose';
EQuickDlgs::render('_compose',array(
'model'=>$model,
));
}else{
echo "Please select row to Mail.";
}
}
else
{
echo "The request is invalid.";
}
}
my dialog form code is:
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'reply-form',
'enableAjaxValidation'=>true,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); ?>
<p class="note">Fields with <span class="required">*</span> are required.For multiple recipients please seperate by comma</p>
<?php echo $form->errorSummary($model); ?>
<div class="row col2">
<?php echo $form->labelEx($model,'email_from'); ?>
<?php echo $form->textField($model,'email_from',array('size'=>50,'maxlength'=>50,'readonly'=>'readonly')); ?>
<?php echo $form->error($model,'email_from'); ?>
</div>
<div class="row col2">
<?php echo $form->labelEx($model,'email_to'); ?>
<?php echo $form->textField($model,'email_to',array('size'=>60,'maxlength'=>150)); ?>
<?php echo $form->error($model,'email_to'); ?>
</div>
<div style="clear:both"></div>
<div class="row col2">
<?php echo $form->labelEx($model,'email_cc'); ?>
<?php echo $form->textField($model,'email_cc',array('size'=>60,'maxlength'=>250)); ?>
<?php echo $form->error($model,'email_cc'); ?>
</div>
<div class="row col2">
<?php echo $form->labelEx($model,'subject'); ?>
<?php echo $form->textField($model,'subject',array('size'=>60,'maxlength'=>250)); ?>
<?php echo $form->error($model,'subject'); ?>
</div>
<div style="clear:both"></div>
<div class="row">
<?php echo $form->labelEx($model,'message'); ?>
<?php echo $form->textArea($model,'message',array('rows'=>6, 'cols'=>50)); ?>
<?php echo $form->error($model,'message'); ?>
</div>
<div style="clear:both"></div>
<div style="clear:both"></div>
<div class="row buttons">
<?php echo CHtml::submitButton($model->isNewRecord ? 'Send' : 'Send',array('class' => 'btn')); ?>
</div>
<?php $this->endWidget(); ?>
Image of dialog
You must use renderPartial() instead of render() and try to call Yii::app()->end() at the end in your mail form view
public function actionComposeMail()
{
if(Yii::app()->request->isAjaxRequest){
print_r($_POST['data1']);
if(isset($_POST['data1'])){
$model=new Reply;
$model->scenario = 'compose';
$this->renderPartial('_compose',array(
'model'=>$model,
));
}else{
echo "Please select row to Mail.";
}
}
else
{
echo "The request is invalid.";
}
}

dijit.layout.ContentPane shifts right on page load

I have a problem which I am unable to fix, maybe somebody can help?
I have a dijit.layout.ContentPane at the top of my page, this sits in a dijit.layout.BorderContainer. On page load the contents of the container shift right and down by about 15px. All other elements work fine.
I have isolated the issue to dijit.layout.ContentPane. In side the container I am running some php if statements and drawing some simple buttons:
<!-- Here are the common buttons above the tabs -->
<div id="toolPane" dojoType="dijit.layout.ContentPane" region="top" >
<?php
if($this->restrict == 1){
if($this->teammembers == 1 || $this->newleaders == 1 || $this->newadminleaders == 1){
if ($this->mayUpdateSummary){
?><span style="white-space:nowrap;" ><?php echo $this->issueActionLink($issue, 'Create report', 'report', 'reportLink'); ?></span>
<span style="white-space:nowrap;" ><a class="emailLink" href="mailto:?subject=Task%20%23<?php echo $issue->id; ?>&body=<?php echo urlencode($this->serverUrl(true)); ?>">Share link</a></span><?php
}
}
}else if($this->restrict == 2){
if ($this->mayUpdateSummary){
?><span style="white-space:nowrap;" ><?php echo $this->issueActionLink($issue, 'Create report', 'report', 'reportLink'); ?></span>
<span style="white-space:nowrap;" ><a class="emailLink" href="mailto:?subject=Task%20%23<?php echo $issue->id; ?>&body=<?php echo urlencode($this->serverUrl(true)); ?>">Share link</a></span><?php
}
}
?>
<?php if ($this->mayUpdateSummary): ?>
<span style="white-space:nowrap;" ><?php echo $this->issueActionLink($issue,'Edit summary', 'progress-summary', 'editbutton'); ?></span>
<?php endif; ?>
<?php if ($closeButton): ?>
<span style="white-space:nowrap;" ><?php echo $closeButton; ?></span>
<?php endif; ?>
<?php if ($reopenButton): ?>
<span style="white-space:nowrap;" ><?php echo $reopenButton; ?></span>
<?php endif; ?>
</div>
Ok, we have decided to hide the page until the dijit elements have loaded. To do this we have added this script which fades in the page giving it time to sort itself out before it is displayed:
<script type="text/javascript">
$(document).ready(function(){
$(".content").hide();
});
$(window).load(function(){
$(".content").fadeIn("fast");
});
</script>
<div class="content">
[faded in content goes here]
</div>

want to implement the desoslider in my website

my web site is using osclass classified script and i want to implement the desoslider in my website and i followed the [http://sylouuu.github.io/desoslide/documentation.html#setup][1]
the code and script i have used is below
PHP
<?php if( osc_images_enabled_at_items() ) { ?>
<?php if( osc_count_item_resources() > 0 ) { ?>
<div id="photos">
<?php for ( $i = 0; osc_has_item_resources(); $i++ ) { ?>
<a href="<?php echo osc_resource_url(); ?>" rel="image_group" title="<?php _e('Image', 'modern'); ?> <?php echo $i+1;?> / <?php echo osc_count_item_resources();?>">
<?php if( $i == 0 ) { ?>
<img src="<?php echo osc_resource_url(); ?>" width="70" height="50" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
<?php } else { ?>
<img src="<?php echo osc_resource_thumbnail_url(); ?>" width="70" height="50" alt="<?php echo osc_item_title(); ?>" title="<?php echo osc_item_title(); ?>" />
<?php } ?>
</a>
<?php } ?>
</div>
<?php } ?>
<?php } ?>
<div id=demo></div>
JS
$(function() {
$('#photos').desoSlide({
main: {
container: '#demo',
cssClass: 'img-responsive'
},
caption: true
});
});
the document says that we have to specify your images links and the alt attribute. i tried several steps but no success. help me to successfully use this desoslider
Because in 1.* versions your thumbnails must be inside an <ul> tag with <li>. So replace <div id="photos"> by <ul id="photos"> and wrap <a> within <li>.
But anyway, this mandatory markup structure has been changed, the version 2 is more permissive. Check it out: http://sylouuu.github.io/desoslide/doc/

Yii CJuiDialog isn't being recognized

I've went through this tutorial http://www.yiiframework.com/wiki/561/ajax-login-form-with-validation-errors-inside-jquery-modal-dialog/ It appears to be functioning properly, but instead of the form being in the modal dialog, it just renders it right on the page like zii.widgets.jui.CJuiDialog isn't even there.
<?php $this->beginWidget('zii.widgets.jui.CJuiDialog',array(
'id'=>'login-dialog',
'options'=>array(
'title'=>'Login',
'autoOpen'=>false,
),
));?>
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'user_login_form',
'enableAjaxValidation'=>false,
'enableClientValidation'=>true,
'method' => 'POST',
'clientOptions'=>array(
'validateOnSubmit'=>true,
'validateOnChange'=>true,
'validateOnType'=>false,
),
)); ?>
<h1>
Login</h1>
<p>
Please fill out the following form with your login credentials:</p>
<p class="note">
Fields with <span class="required">*</span> are required.</p>
<div id="login-error-div" class="errorMessage" style="display: none;">
</div>
<div class="row">
<?php echo $form->labelEx($model,'username'); ?>
<?php echo $form->textField($model,'username',array("onfocus"=>"$('#login-error- div').hide();")); ?>
<?php //echo $form->error($model,'username'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'password'); ?>
<?php echo $form->passwordField($model,'password',array("onfocus"=>"$('#login-error- div').hide();")); ?>
<?php //echo $form->error($model,'password'); ?>
<p class="hint">
Hint: You may login with <tt>demo/demo</tt>.
</p>
</div>
<div class="row rememberMe">
<?php echo $form->checkBox($model,'rememberMe'); ?>
<?php echo $form->label($model,'rememberMe'); ?>
<?php echo $form->error($model,'rememberMe'); ?>
</div>
<div class="row submit">
<?php echo CHtml::ajaxSubmitButton(
'Sign In',
array('/site/login.GetLogin'),
array(
'beforeSend' => 'function(){
$("#login").attr("disabled",true);
}',
'complete' => 'function(){
$("#user_login_form").each(function(){ this.reset();});
$("#login").attr("disabled",false);
}',
'success'=>'function(data){
var obj = jQuery.parseJSON(data);
// View login errors!
// alert(data);
if(obj.login == "success"){
$("#user_login_form").html("<h4>
Login Successful! Please Wait...</h4>
");
parent.location.href = "/";
}
else{
$("#login-error-div").show();
$("#login-error-div").html("Login failed! Try again.");$("#login-error-div").append("
");
}
}'
),
array("id"=>"login","class" => "btn btn-primary")
); ?>
</div>
<?php $this->endWidget(); ?>
</div>
<!-- form -->
<?php $this->endWidget('zii.widgets.jui.CJuiDialog'); ?>
Its suppose to render like this above so when i click the link below it opens
echo CHtml::link('Login', array('/site/login.GetLogin'), array('onclick'=>'$("#login-dialog").dialog("open"); return false;'));
Its built in a widget, if you have a look at the tutorial. Here's the complete widget
<?php
class loginProvider extends CWidget{
public static function actions(){
return array(
'GetLogin'=>'application.components.actions.getLogin',
);
}
public function run(){
$this->renderContent();
}
protected function renderContent(){
echo '<span style="float:right;">';
if(Yii::app()->user->isGuest){
echo CHtml::link('Login', array('/site/login.GetLogin'), array('onclick'=>'$("#login-dialog").dialog("open"); return false;'));
echo '</span>';
$this->getController()- >renderPartial('application.components.views.login',array('model'=>new LoginForm));
}
else
echo CHtml::link('Logout ('.Yii::app()->user->name.')', array('site/logout'), array('visible'=>!Yii::app()->user->isGuest));
echo '</span>';
}
}

How can I display a warning message on textfield in Yii

I'm new to Yii framework and I need to display the validation error message as in login form "Username cannot be blank". Now, I have a text field where I updated the fields and the during validation I want a message to be displayed. How can I do this?
Controller
public function actionUpdate($id)
{
$model = $this->loadModel($id);
// set the parameters for the bizRule
$params = array('GroupzSupport'=>$model);
// now check the bizrule for this user
if (!Yii::app()->user->checkAccess('updateSelf', $params) &&
!Yii::app()->user->checkAccess('admin'))
{
throw new CHttpException(403, 'You are not authorized to perform this action');
}
else
{
if(isset($_POST['GroupzSupport']))
{
$password_current=$_POST['GroupzSupport']['password_current'];
$pass=$model->validatePassword($password_current);
$model->attributes=$_POST['GroupzSupport'];
if($pass==1)
{
$model->password = $model->hashPassword($_POST['GroupzSupport']['password_new']);
if($model->save())
$this->redirect(array('/messageTemplate/admin'));
}
else {$errors="Incorrect Current password"; print '<span style="color:red"><b>';
print '</b><b>'.$errors;
print '</b></span>';}
}
$this->render('update',array(
'model'=>$model,
));
}
}
View
<div class="form">
<?php $form=$this->beginWidget('CActiveForm', array(
'id'=>'password-recovery-reset-password-form',
'enableAjaxValidation'=>false,
)); ?>
<div class="row"><?php
echo $form->labelEx($model,'username');
echo $form->textField($model,'username',array('size'=>45,'maxlength'=>150));
echo $form->error($model,'username');
?></div>
<div class="row">
<?php echo $form->labelEx($model,'current password'); ?>
<?php echo $form->passwordField($model,'password_current',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'password_current'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'new password'); ?>
<?php echo $form->textField($model,'password_new',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'password_new'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($model,'confirm new password'); ?>
<?php echo $form->passwordField($model,'password_repeat',array('size'=>30,'maxlength'=>30)); ?>
<?php echo $form->error($model,'password_repeat'); ?>
</div>
<div class="row buttons"><?php
echo CHtml::submitButton('Reset Your Password');
?></div><?php
$this->endWidget(); ?>
</div>
Now currently I'm displaying it at the top.
I want to display it right on the textfield as in login page. How can I do this?
Before redirect, add the message to the desired field.
In the model Validator:
$this->addError('field_name', "Message error.");
Or in Controller action:
$model->addError('field_name', "Message error.");