I want the button of download in yii framework
when i click on that button then new pop up window will open for to ask to open or save ..
plz help me sooon
thank you so much....
I have tried like this but it will open in new window only i cant download...
echo "<b>".$data->job_related_file->srvr_name."</b> (".CHtml::link("<b>Download</b>",$downloadLink,array('target'=>'_blank')).")";
When I click on word button then see this image
You need to add
//action in the CONTROLLER
function actionDownload($name){
$filecontent=file_get_contents('path_to_file'.$name);
header("Content-Type: text/plain");
header("Content-disposition: attachment; filename=$name");
header("Pragma: no-cache");
echo $filecontent;
exit;
}
//download link in view
echo "<b>".
$data->job_related_file->srvr_name."</b> (".
CHtml::link("Download","CONTROLLER/download/$filename",
array('class'=>'donwload_link')
)
.")";
I haven't tested it though , let me know if this works
Related
I am trying to create a simple confirmation ("Do you want to close this window?") when closing a modal dialog page with the (X)-button.
What would be the most efficient way to implement this in Apex 5.0?
I tried to implement a solution using the dialog closed event, this seemed to have had no effects on closing the dialog with the (X)-button, however.
Try to create a dynamic action, on page load, in your modal page with that code:
Your da should execute a javascript code:
var button = parent.$('.ui-dialog-titlebar-close'); //get the button
button.unbind(); //remove the behavior
//put another behavior to the button
button.on('click', function() {
apex.message.confirm( "Your message here", function( okPressed ) {
if( okPressed ) {
apex.navigation.dialog.cancel(true);
}
});
});
Try to confirm if the "X" button have the css class "ui-dialog-titlebar-close", they can change between versions of apex.
If necessary, update the first line of the code with the correct class.
Have you considered hiding the button (x) and canceling the modal dialog page by clicking on the "cancel" button?
If you want to rename the standard button names in the confirmation window, use:
apex.lang.addMessages({"APEX.DIALOG.OK": pOkLabel});
apex.lang.addMessages({"APEX.DIALOG.CANCEL": pCancelLabel});
can I change the joomla menu from source code?
I want to test if I have an open session, and if I have it , I want to change the Login menu, into My Account menu !
Can anyone help me? Thanks.
You need to make a template override of the menu.
https://docs.joomla.org/How_to_override_the_output_from_the_Joomla!_core
Then inside that use:
$user = JFactory::getUser();
if ($user->guest())
{
//Insert HTML if not logged in
}
else
{
//Insert HTML if logged in
}
I am use Ajax with PHP and return JSON. Chrome and Firefox work well, but in Internet Explorer not return message what i want, it show save dialog instead.
Bellow is my PHP code that return json:
header("HTTP/1.0 200 OK");
header('Content-Type: application/json');
$jstatus = 'My message...';
$status_data = array("code" => "1", "status"=> $jstatus);
echo json_encode($status_data);
In Internet Explorer can not catch it in ajax but show dialog "Do you want to open or save...".
I don't know why this appear in Internet Explorer, and others browsers work well?
I've successfully created my first admin grid. It works fine when adding a new item. However, when I want to edit an item, strangely, the DELETE button is missing. Even worse, when I click the SAVE button, it creates a new item instead of saving the current item. What have I done wrong?
I'm not sure what file to look at, thus I don't know which code must be posted here. If I put all the code from all files, it will be too much. Please advise.
Update: Not sure why, but now the SAVE button doesn't recreate any more. So I can edit an item peacefully. However, the DELETE button is still missing.
Late in the game, but hopefully this will help a Googler.
Is your _objectId property correctly set to the corresponding parameter in the URL?
$this->_objectId = 'id';
Where ID refers to this part of the URL:
/module/adminhtml_controller/edit/id/1/
See the parent class Mage_Adminhtml_Block_Widget_Form_Container::__construct:
...
$objId = $this->getRequest()->getParam($this->_objectId);
if (! empty($objId)) {
$this->_addButton('delete', array(
'label' => Mage::helper('adminhtml')->__('Delete'),
'class' => 'delete',
'onclick' => 'deleteConfirm(\''. Mage::helper('adminhtml')->__('Are you sure you want to do this?')
.'\', \'' . $this->getDeleteUrl() . '\')',
));
}
...
We can see that if $objId is empty, no delete button will be added.
After struggling around, the culprit was because I put parent::__construct(); at the top (right after the __construct() method. Instead, it should be put AFTER the $this->_controller line. Geezz...
***Remove or rename add new save continue delete button from magento admin
If you don’t want to show the ‘Add New’ button in the Grid. The Add New button is present in top right corner of Grid Page.
Rename ‘Add New’ button
Here are the steps to rename the ‘Add New’ text to anything you required (for example, ‘Add Report’):-
Go to YourNamespace -> YourModule -> Block -> Adminhtml -> YourFile.phenter code herep
Add the following code in the constructor of this file:-
$this->addButtonLabel = Mage::helper('yourmodulename')->_('Add Report');
Remove ‘Add New’ button
Here are the steps to remove the ‘Add New’ button:-
Go to YourNamespace -> YourModule -> Block -> Adminhtml -> YourFile.php
Add the following code in the constructor of this file (it should be just below the call to parent constructor):-
parent::__construct();
$this->_removeButton('add');
In edit.php
parent::__construct();
$this->_removeButton('delete');
$this->_removeButton('save');
$this->_removeButton('back');
in grid.php
parent::__construct();
$this->_removeButton('add');
Try on your Grid.php:
public function getRowUrl($row){
return $this->getUrl('*/*/form', array('id' => $row->getId()));
}
i know its sounds a bit crazy, but so many clients have problems with not saving their article properly.
I just wanted to use a simple method to trigger the onclick of the APPLY button inside a joomla article in edit mode.
Primarily back end editing as i have a good admin template that allows me to show clients the bare bones.
I know that by clicking apply the page reloads but thats better than nothing.
How on earth do i add do this?
I was hoping something like this would work but i dont quite know how to trigger a button that seems to reside inside a toolbar function of some sort.
I have this:
<script type="text/javascript">
$(document).ready(function() {
$('??????').trigger('click');
});
</script>
What would replace the question marks?
Also i know i would need to put a timer into the jquery code but how do i get the link below to trigger?
http://mydomain.com/administrator/index.php?option=com_content§ionid=1&task=edit&cid[]=97
In the toolbar.content.html.php file joomla has this:
class TOOLBAR_content
{
function _EDIT($edit)
{
$cid = JRequest::getVar( 'cid', array(0), '', 'array' );
$cid = intval($cid[0]);
$text = ( $edit ? JText::_( 'Edit' ) : JText::_( 'New' ) );
JToolBarHelper::title( JText::_( 'Article' ).': <small><small>[ '. $text.' ]</small></small>', 'addedit.png' );
JToolBarHelper::preview( 'index.php?option=com_content&id='.$cid.'&tmpl=component', true );
JToolBarHelper::save();
/////////////////////////////////////
JToolBarHelper::apply(); // < // THIS IS WHAT I WANT TO TRIGGER
/////////////////////////////////////
if ( $edit ) {
// for existing articles the button is renamed `close`
JToolBarHelper::cancel( 'cancel', 'Close' );
} else {
JToolBarHelper::cancel();
}
}
...... more stuff here
}
I know this might sound crazy but wouldnt it be great if autosave could happen even without a reload, but i guess that would mean posting all the data using jquery rather than the php post and reload page method.
Anyways im not expecting a miracle here but if anyone could help that would be great.
Cheers in advance
John
PS:
i just tried something like this hoping maybe it will work but it just reloads the page:
function autosave()
{
window.location = "index.php?option=com_content§ionid=<?php echo $_GET['sectionid'];?>&task=edit&cid[]=<?php echo $row->id;?>"
}
You won't be able to do it without forcing a reload unless you decide to re-write the whole of com_content with an ajax implementation.
Looking at the code you've posted I guessing Joomla! 1.5 - which by default has MooTools 1.12 or 1.2.5 (if you enabled the MooTools upgrade plugin in later versions of 1.5.x) - so more of a question but why not use that?
You will have to modify the admin template to embed the JS you need, 1.5 has few triggers and none that are really worth using in the admin screens (unless you're up for a fair bit of PHP coding)
Somewhere in the <head> tag of com_content's Article view you will need to add this:
<script type="text/javascript">
var interval = 30 //seconds
var timer = setTimeout(submitbutton('apply'),(interval * 1000));
}
</script>
Please note I haven't tried this just typed it straight into here.
Since you're on 1.5 have you tried the Simple Content Versioning extension - it has autosave functionality that appears to be what you want - and probably works whereas who knows with my code in #3.